--- loncom/xml/londefdef.pm 2009/05/15 18:06:20 1.405
+++ loncom/xml/londefdef.pm 2010/08/11 10:57:36 1.420
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.405 2009/05/15 18:06:20 bisitz Exp $
+# $Id: londefdef.pm,v 1.420 2010/08/11 10:57:36 foxr Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -538,6 +538,23 @@ sub start_body {
my $extra_head = &generate_css_links();
+ # Breadcrumbs
+ &Apache::lonhtmlcommon::clear_breadcrumbs();
+ if ($env{'request.state'} eq 'construct') {
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ 'text' => 'Construction Space',
+ 'href' => &Apache::loncommon::authorspace(),
+ });
+ &Apache::lonhtmlcommon::add_breadcrumb({
+ 'text' => 'HTML Editor',
+ 'href' => '',
+ });
+ # breadcrumbs (and tools) will be created
+ # in start_page->bodytag->innerregister
+ } else {
+ # FIXME Where are we?
+ }
+
$currentstring =
&Apache::loncommon::start_page($Apache::londefdef::title,
$Apache::londefdef::head
@@ -546,14 +563,26 @@ sub start_body {
# 'no_title' => 1,
'force_register' => 1});
- if ($env{'request.state'} ne 'published') {
- $currentstring.=&Apache::lonmenu::constspaceform();
- $currentstring.=&Apache::londefdef::edit_controls();
- }
- $currentstring.=&Apache::lonxml::message_location();
+ my $header = '';
+ if ($env{'request.state'} ne 'published' &&
+ $env{'request.state'} ne 'construct') {
+ $header=&Apache::lonmenu::constspaceform();
+ }
+ if ($env{'request.state'} ne 'published') {
+ $header.=&Apache::londefdef::edit_controls();
+ }
+ if ($env{'request.state'} eq 'construct') {
+ $currentstring.=&Apache::loncommon::head_subbox(
+ &Apache::loncommon::CSTR_pageheader()
+ .$header);
+ } elsif ($env{'request.state'} eq 'edit') {
+ $currentstring.=&Apache::loncommon::head_subbox($header);
+ }
+ $currentstring.=&Apache::lonxml::message_location();
} elsif ($target eq 'tex') {
- $currentstring = ''; # '\begin{document}' is in header.
- }
+ $currentstring = ''; # '\begin{document}' is in header.
+ }
+
return $currentstring;
}
@@ -570,9 +599,14 @@ sub edit_controls {
';
}
$result .= '
-
+';
+ if (($env{'request.course.id'}) && ($env{'form.forceedit'})) {
+ $result .= (' ' x 3).'';
+ }
+ $result .= '
+
-
';
+';
return $result;
}
@@ -2014,29 +2048,39 @@ sub start_table {
my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval, undef, 0);
my $theme = &Apache::lonxml::get_param('TeXtheme', $parstack, $safeeval, undef, 0);
my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 0);
+ my $cell_border = &Apache::lonxml::get_param('rules', $parstack, $safeeval, undef, 0);
# The only thing that needs any figuring out is the width.. and then only if it is
# a percent. If not it's assumed to be some valid TeX measurement unit e.g. 3.0cm
#
my $table = new Apache::lontable();
- if ($border ne '') {
+ if ((defined $border) && ($border > 0)) {
+ &Apache::lonnet::logthis("Turning on table borderes: $border");
$table->table_border(1);
+ if ($cell_border ne 'none') {
+ $table->cell_border(1); # html specs that border turns on both...unless rules='none'.
+ }
+ }
+ # Only all or nothing for cell borders for now:
+
+ if ((defined $cell_border) && ($cell_border ne 'none')) {
+ &Apache::lonnet::logthis("Turning on cell borders: $cell_border");
$table->cell_border(1);
}
- if ($theme ne '') {
+ if (defined $theme) {
$table->theme($theme);
}
- if ($align ne '') {
+ if (defined $align) {
$table->alignment($align);
}
# Missing width is most of page width
- if ($width eq "") {
+ if (!(defined $width)) {
$width = '70%';
}
-
+
# If a percentage, need to calculate what this means in terms of
# page width:
@@ -3125,24 +3169,13 @@ sub start_img {
# Render unto browsers that which are the browser's...
if ($target eq 'web' || $target eq 'webgrade') {
- if ($env{'browser.imagesuppress'} ne 'on') {
- my $enc = ('yes' eq
- lc(&Apache::lonxml::get_param('encrypturl',$parstack,
- $safeeval)));
- $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},
- $enc);
- } else {
- my $alttag = &Apache::lonxml::get_param('alt',$parstack,$safeeval,
- undef,1);
- if (!$alttag) {
- $alttag = &Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],
- $src);
- }
- $currentstring.='[IMAGE: '.$alttag.']';
- }
-
- # and render unto TeX that which is LaTeX
+ my $enc = ('yes' eq
+ lc(&Apache::lonxml::get_param('encrypturl',$parstack,
+ $safeeval)));
+ $currentstring.=&Apache::lonenc::encrypt_ref($token,{'src'=>$src},
+ $enc);
+ # and render unto TeX that which is LaTeX
} elsif ($target eq 'tex') {
#
# The alignment will require some superstructure to be put around
@@ -3241,21 +3274,28 @@ sub start_img {
['','bottom','middle','top','left','right'],$token,5);
$currentstring .=&Apache::edit::select_arg('TeXwrap:', 'TeXwrap',
['', 'none','parbox', 'parpic', 'wrapfigure'], $token, 2);
+ my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval);
+ my $enc= &Apache::lonxml::get_param('encrypturl',$parstack,$safeeval);
+
$currentstring .=&Apache::edit::select_arg('Encrypt URL:','encrypturl',
['no','yes'], $token, 2);
+ if (($alt=~/\S/) && (lc($enc) eq 'yes')) {
+ $currentstring.='
'.&mt('Warning: the description "[_1]" will be available, even for encrypted URL',$alt).'
';
+ }
$currentstring .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
my $src= &Apache::lonxml::get_param('src',$parstack,$safeeval);
- my $alt= &Apache::lonxml::get_param('alt',$parstack,$safeeval);
my $width= &Apache::lonxml::get_param('width',$parstack,$safeeval);
my $height= &Apache::lonxml::get_param('height',$parstack,$safeeval);
if ($token->[2]{'src'}=~/\$/) {
- $currentstring.='Variable image source';
- } else {
+ $currentstring.=&mt('Variable image source');
+ } elsif ($token->[2]{'src'}=~/\S/) {
$currentstring .= '$code,
- 'archive'=>$archive}
- );
- } else {
- my $alttag= &Apache::lonxml::get_param('alt',$parstack,
- $safeeval,undef,1);
- unless ($alttag) {
- $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],
- $code);
- }
- $currentstring='[APPLET: '.$alttag.']';
- }
+ $currentstring = &Apache::lonenc::encrypt_ref($token,
+ {'code'=>$code,
+ 'archive'=>$archive}
+ );
} elsif ($target eq 'tex') {
- # Turn off some stuff we can't be inside thank you LaTeX
-
+ # Turn off some stuff we can't be inside thank you LaTeX
my $restart_sub = 0;
my $restart_sup = 0;
@@ -3404,16 +3433,7 @@ sub start_embed {
&Apache::lonxml::extlink($src);
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- if ($env{'browser.embedsuppress'} ne 'on') {
- $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
- } else {
- my $alttag=&Apache::lonxml::get_param
- ('alt',$parstack,$safeeval,undef,1);
- unless ($alttag) {
- $alttag=&Apache::lonmeta::alttag($Apache::lonxml::pwd[-1],$src);
- }
- $currentstring='[EMBED: '.$alttag.']';
- }
+ $currentstring=&Apache::lonenc::encrypt_ref($token,{'src'=>$src});
} elsif ($target eq 'tex') {
}
return $currentstring;
@@ -3423,9 +3443,10 @@ sub end_embed {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[2];
- } elsif ($target eq 'tex') {
- }
+ $currentstring = $token->[2];
+ } elsif ($target eq 'tex') {
+ # ./.
+ }
return $currentstring;
}
@@ -3863,12 +3884,16 @@ sub end_colgroup {
return $currentstring;
}
+
#-- tag (end tag required)
sub start_del {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
$currentstring = $token->[4];
+ } elsif ($target eq 'tex') {
+ &disable_para();
+ $currentstring .= '\st{';
}
return $currentstring;
}
@@ -3877,7 +3902,10 @@ sub end_del {
my ($target,$token) = @_;
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
- $currentstring = $token->[2];
+ $currentstring = $token->[2];
+ } elsif ($target eq 'tex') {
+ &enable_para();
+ $currentstring = '}';
}
return $currentstring;
}
@@ -4717,7 +4745,7 @@ sub align_latex_image {
# Even though we set a default alignment value, the user
# could have given us an illegal value. In that case we
# just use the default alignment of bottom..
- $currentstring = "\n% figurewrapping \n";
+ $currentstring = '';
if ($align eq "top") {
$currentstring .= '\raisebox{-'.$height.'mm}{'.$image;
$closure = '}';
@@ -4760,8 +4788,6 @@ sub align_latex_image {
$currentstring .= "{$image";
$closure = '}';
}
- $currentstring .= "\n% end wrappage\n";
- $closure = "\n% Begin closure\n".$closure."\n% End closure\n";
return ($currentstring, $closure);
}
@@ -4781,8 +4807,7 @@ sub is_inside_of {
#
# This sub provides the typical LaTeX prefix matter for tex output:
#
-sub latex_header
-{
+sub latex_header {
my ($mode) = @_;
my $currentstring = '';
@@ -4816,6 +4841,7 @@ sub latex_header
"\\usepackage{xcolor}\n".
'\usepackage{calc}'.
'\usepackage{amsmath}'.
+ '\usepackage{soul}',
'\usepackage{amssymb}'.
'\usepackage{amsfonts}'.
'\usepackage{amsthm}'.