--- loncom/xml/londefdef.pm 2004/08/19 20:20:40 1.234 +++ loncom/xml/londefdef.pm 2004/10/12 22:55:22 1.242 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Tags Default Definition Module # -# $Id: londefdef.pm,v 1.234 2004/08/19 20:20:40 albertel Exp $ +# $Id: londefdef.pm,v 1.242 2004/10/12 22:55:22 albertel Exp $ # # # Copyright Michigan State University Board of Trustees @@ -66,6 +66,7 @@ sub initialize_londefdef { @Apache::londefdef::description=(); $Apache::londefdef::DD_redirection=0; $Apache::londefdef::DT_redirection=0; + $Apache::londefdef::list_index=0; } #======================= TAG SUBROUTINES ===================== @@ -150,8 +151,7 @@ sub start_html { my $options=$ENV{'course.'.$ENV{'request.course.id'}.'.tthoptions'}; &Apache::lontexconvert::init_tth(); if ($target eq 'web' || $target eq 'edit') { - $currentstring = &Apache::lonxml::xmlbegin(). - &Apache::lonxml::fontsettings(); + $currentstring = &Apache::lonxml::xmlbegin(); } elsif ($target eq 'tex') { @Apache::londefdef::table = (); $currentstring .= '\documentclass[letterpaper]{book}'; @@ -189,7 +189,7 @@ sub start_head { my ($target,$token) = @_; my $currentstring = ''; if ($target eq 'web') { - $currentstring = $token->[4]; + $currentstring = $token->[4].&Apache::lonxml::fontsettings(); } return $currentstring; } @@ -1485,17 +1485,28 @@ sub start_li { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { - my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,1); - if ($type=~/circle/) { - $currentstring .= ' \item[o] '; + my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); + my $value=&Apache::lonxml::get_param('value',$parstack,$safeeval,undef,0); + #FIXME need to support types i and I + if ($type=~/disc/) { + $currentstring .= ' \item[$\bullet$] '; + } elsif ($type=~/circle/) { + $currentstring .= ' \item[$\circ$] '; } elsif ($type=~/square/) { - $currentstring .= ' \item[$\Box$] '; - } elsif ($type ne '') { - $currentstring .= ' \item['.$type.'] '; + $currentstring .= ' \item[$\diamond$] '; + } elsif ($type eq '1') { + $currentstring .= ' \item['.($Apache::londefdef::list_index+1).'.]'; + } elsif ($type eq 'A') { + $currentstring .= ' \item['.('A'..'Z')[$Apache::londefdef::list_index].'.]'; + } elsif ($type eq 'a') { + $currentstring .= ' \item['.('a'..'z')[$Apache::londefdef::list_index].'.]'; + } elsif ($value ne '') { + $currentstring .= ' \item['.$value.'] '; } else { $currentstring .= ' \item '; } - } + $Apache::londefdef::list_index++; + } return $currentstring; } @@ -1542,6 +1553,7 @@ sub start_ul { $currentstring = $token->[4]; } elsif ($target eq 'tex') { my $TeXtype=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); + $Apache::londefdef::list_index=0; if ($TeXtype eq 'disc') { $currentstring .= '\renewcommand{\labelitemi}{$\bullet$}'. '\renewcommand{\labelitemii}{$\bullet$}'. @@ -1630,6 +1642,7 @@ sub start_ol { if ($target eq 'web') { $currentstring = $token->[4]; } elsif ($target eq 'tex') { + $Apache::londefdef::list_index=0; my $type=&Apache::lonxml::get_param('type',$parstack,$safeeval,undef,0); if ($type eq '1') { $currentstring .= '\renewcommand{\labelenumi}{\arabic{enumi}.}'. @@ -2420,13 +2433,9 @@ sub start_img { $currentstring.='[IMAGE: '.$alttag.']'; } } elsif ($target eq 'tex') { + my $oldSRC=$src; + $oldSRC=~s/\.(gif|jpg|png)$/\.eps/; $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); - #if uploaded restore the path - if ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/simplepage\/([^\/]+)$/) { - $src=&Apache::loncommon::propath($1,$2).'/userfiles/simplepage/'.$3; - } elsif ($src=~/^\/uploaded\/([^\/]+)\/([^\/]+)\/aboutme\/([^\/]+)$/) { - $src=&Apache::loncommon::propath($1,$2).'/userfiles/aboutme/'.$3; - } #if original gif/jpg/png file exist do following: if (-e $src) { #what is the image size? @@ -2434,6 +2443,7 @@ sub start_img { my ($file,$path)=&file_path($src); my $newsrc = $src; $newsrc =~ s/\.(gif|jpg|png)$/.eps/i; + &Apache::lonnet::repcopy($oldSRC); $file=~s/\.(gif|jpg|png)$/.eps/i; #where can we find the picture? if (-e $newsrc) { @@ -2661,7 +2671,7 @@ sub start_allow { $src=&Apache::lonnet::filelocation($Apache::lonxml::pwd[-1],$src); $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]= &Apache::lonnet::clutter($src); - &image_replication($src); + if ($target eq 'tex') { &image_replication($src); } my $result; if ($target eq 'edit') { $result .=&Apache::edit::tag_start($target,$token); @@ -3702,7 +3712,11 @@ sub eps_generation { $newsrc=~s/\/home\/httpd\/lonUsers//; $newsrc=~s/\/([^\/]+)\/(\w)\/(\w)\/(\w)\//\/$1\//; } - return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; + if ($newsrc=~/\/userfiles\//) { + return ' \graphicspath{{'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; + } else { + return ' \graphicspath{{/home/httpd/prtspool'.$newsrc.'}}\includegraphics[width='.$width_param.' mm]{'.$file.'} '; + } } sub file_path {