--- loncom/xml/londefdef.pm 2009/04/11 01:11:02 1.400
+++ loncom/xml/londefdef.pm 2010/11/09 21:28:20 1.415.4.2
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Tags Default Definition Module
#
-# $Id: londefdef.pm,v 1.400 2009/04/11 01:11:02 raeburn Exp $
+# $Id: londefdef.pm,v 1.415.4.2 2010/11/09 21:28:20 raeburn Exp $
#
#
# Copyright Michigan State University Board of Trustees
@@ -538,36 +538,75 @@ 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
.$extra_head,
{'add_entries' => $token->[2],
- 'no_title' => 1,
+# '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}';
- }
+ $currentstring = ''; # '\begin{document}' is in header.
+ }
+
return $currentstring;
}
sub edit_controls {
+ my ($nochgview) = @_;
my $result .= '
-
';
+';
return $result;
}
@@ -1344,10 +1383,6 @@ sub start_font {
my $currentstring = '';
if ($target eq 'web' || $target eq 'webgrade') {
my $face=&Apache::lonxml::get_param('face',$parstack,$safeeval);
- if ($face!~/symbol/i) {
- if (($env{'browser.fontenhance'} eq 'on') ||
- ($env{'browser.blackwhite'} eq 'on')) { return ''; }
- }
$currentstring = $token->[4];
} elsif ($target eq 'tex') {
my $fontsize=&Apache::lonxml::get_param('TeXsize',$parstack,$safeeval);
@@ -2013,26 +2048,36 @@ 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 '') {
- $table->table_border(1);
+ if ((defined $border) && ($border > 0)) {
+ # &Apache::lonnet::logthis("Turning on table borders: $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%';
}
@@ -2687,7 +2732,7 @@ sub tag_check {
#
sub cell_config_hash {
- my ($align, $rowspan, $colspan) = @_;
+ my ($align, $rowspan, $colspan, $width) = @_;
my %config;
if ($align ne '') {
$config{'halign'} = $align;
@@ -2698,6 +2743,9 @@ sub cell_config_hash {
if ($rowspan ne '') {
$config{'rowspan'} = $rowspan;
}
+ if ($width ne '') {
+ $config{'width'} = $width;
+ }
return \%config;
}
@@ -2709,11 +2757,11 @@ sub start_td_tex {
# attributes, but empty of text. end_td_tex will
# fetch the contents from the recursive parse and
# fill the cell with them:
- my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval, undef, 1);
- my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval, undef, 1);
- my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval, undef, 1);
-
- my $config = &cell_config_hash($align, $rowspan, $colspan);
+ my $align = &Apache::lonxml::get_param('align', $parstack, $safeeval);
+ my $rowspan = &Apache::lonxml::get_param('rowspan', $parstack, $safeeval);
+ my $colspan = &Apache::lonxml::get_param('colspan', $parstack, $safeeval);
+ my $width = &Apache::lonxml::get_param('TeXwidth', $parstack, $safeeval);
+ my $config = &cell_config_hash($align, $rowspan, $colspan, $width);
my $table = $Apache::londefdef::table[-1];
$table->add_cell('', $config);
@@ -3240,21 +3288,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';
+ $currentstring.=&mt('Variable image source');
+ } elsif ($token->[2]{'src'}=~/\S/) {
+ $currentstring .= ' $token->[2],
- 'no_title' => 1,
+# 'no_title' => 1,
'force_register' => 1,
'frameset' => 1,});
@@ -4716,7 +4771,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 = '}';
@@ -4759,8 +4814,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);
}
@@ -4780,14 +4833,16 @@ 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 = '';
$currentstring .=
+ "\n% &Apache::lonxml::londefdef \n" .
'\documentclass[letterpaper,twoside]{article}\raggedbottom';
if (($env{'form.latex_type'}=~'batchmode') ||
- (!$env{'request.role.adv'})) {$currentstring .='\batchmode';}
+ (!$env{'request.role.adv'}) ||
+ ($mode eq 'batchmode')) {$currentstring .='\batchmode';}
$currentstring .= '\newcommand{\keephidden}[1]{}'.
'\renewcommand{\deg}{$^{\circ}$}'.
'\usepackage{multirow}'.
@@ -4815,8 +4870,14 @@ sub latex_header
'\usepackage{amssymb}'.
'\usepackage{amsfonts}'.
'\usepackage{amsthm}'.
- '\usepackage{amscd}';
-
+ '\usepackage{amscd}'
+ .'\usepackage{picins}\usepackage{calc}'."\n". # From lonprintout.pm
+ '\usepackage[T1]{fontenc}'."\n".
+ '\usepackage{lmodern}'."\n".
+ '\usepackage[postscript]{ucs}'."\n".
+ '\usepackage[utf8x]{inputenc}'."\n".
+ '\usepackage{pifont}' . "\n";
+
if($env{'form.pdfFormFields'} eq 'yes') {
$currentstring .= '\usepackage{hyperref}'.
'\usepackage{eforms}'.
@@ -4825,6 +4886,7 @@ sub latex_header
$currentstring .= '\newenvironment{choicelist}{\begin{list}{}{\setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.05in}\setlength{\itemsep}{0.022in}\setlength{\parsep}{0in}\setlength{\belowdisplayskip}{0.04in}\setlength{\abovedisplayskip}{0.05in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.04in}}}{\end{list}}'.
'\renewenvironment{theindex}{\begin{list}{}{{\vskip 1mm \noindent \large\textbf{Index}} \newline \setlength{\rightmargin}{0in}\setlength{\leftmargin}{0.13in}\setlength{\topsep}{0.01in}\setlength{\itemsep}{0.1in}\setlength{\parsep}{-0.02in}\setlength{\belowdisplayskip}{0.01in}\setlength{\abovedisplayskip}{0.01in}\setlength{\abovedisplayshortskip}{-0.04in}\setlength{\belowdisplayshortskip}{0.01in}}}{\end{list}}';
+ $currentstring .= '\begin{document}';
return $currentstring;