--- loncom/interface/loncommon.pm 2005/04/07 06:56:22 1.258 +++ loncom/interface/loncommon.pm 2005/07/12 15:54:19 1.270 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # a pile of common routines # -# $Id: loncommon.pm,v 1.258 2005/04/07 06:56:22 albertel Exp $ +# $Id: loncommon.pm,v 1.270 2005/07/12 15:54:19 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -673,7 +673,6 @@ sub help_open_menu { foreach (\$color,\$function,\$topic,\$component_help,\$faq,\$bug,\$origurl) { $$_ = &Apache::lonnet::escape($$_); } - if (!$stayOnPage) { $link = "javascript:helpMenu('open')"; } else { @@ -684,9 +683,10 @@ sub help_open_menu { my $template; if ($text ne "") { $template .= - "". - "'); $i++; }
$text"; + "". + "'.$roleinfo.'
$text"; } + my $nothing=&Apache::lonhtmlcommon::javascript_nothing(); my $html=&Apache::lonxml::xmlbegin(); my $helpicon=&lonhttpdurl("/adm/lonIcons/helpgateway.gif"); $template .= <<"ENDTEMPLATE"; @@ -698,7 +698,7 @@ function helpMenu(target) { if (target == 'open') { var newWindow = null; try { - newWindow = window.open("/adm/rat/empty.html","helpmenu","HEIGHT=$height,WIDTH=$width,resizable=yes,scrollbars=yes" ) + newWindow = window.open($nothing,"helpmenu","HEIGHT=$height,WIDTH=$width,resizable=yes,scrollbars=yes" ) } catch(error) { writeHelp(caller); @@ -712,9 +712,9 @@ function helpMenu(target) { return; } function writeHelp(caller) { - caller.document.write('$htmlLON-CAPA Help Menu') - caller.document.write("") - caller.document.write("") + caller.document.writeln('$htmlLON-CAPA Help Menu') + caller.document.writeln("") + caller.document.writeln("") caller.document.close() caller.focus() } @@ -1984,24 +1984,23 @@ sub syllabuswrapper { } sub track_student_link { - my ($linktext,$sname,$sdom,$target) = @_; - my $link ="/adm/trackstudent"; + my ($linktext,$sname,$sdom,$target,$start) = @_; + my $link ="/adm/trackstudent?"; my $title = 'View recent activity'; if (defined($sname) && $sname !~ /^\s*$/ && defined($sdom) && $sdom !~ /^\s*$/) { - $link .= "?selected_student=$sname:$sdom"; + $link .= "selected_student=$sname:$sdom"; $title .= ' of this student'; - } + } if (defined($target) && $target !~ /^\s*$/) { $target = qq{target="$target"}; } else { $target = ''; } + if ($start) { $link.='&start='.$start; } return qq{$linktext}; } - - =pod =back @@ -2729,11 +2728,9 @@ a:focus { color: red; background: yellow END + &Apache::lontexconvert::jsMath_reset(); if ($env{'environment.texengine'} eq 'jsMath') { - $bodytag.=''."\n". - ''."\n"; + $bodytag.=&Apache::lontexconvert::jsMath_header(); } my $upperleft=''. - '
'. + '
'. $titleinfo.'
'; if ($env{'request.state'} eq 'construct') { $bodytag .= &Apache::lonmenu::menubuttons($forcereg,'web',$forcereg,$titletable); @@ -2880,10 +2877,7 @@ Returns: A uniform footer for LON-CAPA w sub endbodytag { my $endbodytag=''; - if ($env{'environment.texengine'} eq 'jsMath') { - $endbodytag=''. - "\n".$endbodytag; - } + $endbodytag=&Apache::lontexconvert::jsMath_process()."\n".$endbodytag; return $endbodytag; } @@ -2975,8 +2969,9 @@ sub get_posted_cgi { my $r=shift; my $buffer; - - $r->read($buffer,$r->header_in('Content-length'),0); + if ($r->header_in('Content-length')) { + $r->read($buffer,$r->header_in('Content-length'),0); + } unless ($buffer=~/^(\-+\w+)\s+Content\-Disposition\:\s*form\-data/si) { my @pairs=split(/&/,$buffer); my $pair; @@ -3135,18 +3130,14 @@ sub add_to_env { if (ref($env{$name})) { #already have multiple values push(@{ $env{$name} },$value); - push(@{ $ENV{$name} },$value); } else { #first time seeing multiple values, convert hash entry to an arrayref my $first=$env{$name}; undef($env{$name}); - undef($ENV{$name}); push(@{ $env{$name} },$first,$value); - push(@{ $ENV{$name} },$first,$value); } } else { $env{$name}=$value; - $ENV{$name}=$value; } } @@ -3266,6 +3257,11 @@ Separate a record into fields $record sh =cut +sub takeleft { + my $index=shift; + return substr('0000'.$index,-4,4); +} + sub record_sep { my $record=shift; my %components=(); @@ -3276,7 +3272,7 @@ sub record_sep { my $field=$_; $field=~s/^(\"|\')//; $field=~s/(\"|\')$//; - $components{$i}=$field; + $components{&takeleft($i)}=$field; $i++; } } elsif ($env{'form.upfiletype'} eq 'tab') { @@ -3285,7 +3281,7 @@ sub record_sep { my $field=$_; $field=~s/^(\"|\')//; $field=~s/(\"|\')$//; - $components{$i}=$field; + $components{&takeleft($i)}=$field; $i++; } } else { @@ -3303,7 +3299,7 @@ sub record_sep { $field=~s/^\s*$delimiter//; $field=~s/$delimiter\s*$//; } - $components{$i}=$field; + $components{&takeleft($i)}=$field; $i++; } } @@ -3460,9 +3456,9 @@ sub csv_samples_select_table { $display.''); } $r->print('
'); - if (defined($sone{$_})) { $r->print($sone{$_}."
\n"); } - if (defined($stwo{$_})) { $r->print($stwo{$_}."
\n"); } - if (defined($sthree{$_})) { $r->print($sthree{$_}."
\n"); } + if (defined($sone{$_})) { $r->print($sone{$_}."
\n"); } + if (defined($stwo{$_})) { $r->print($stwo{$_}."
\n"); } + if (defined($sthree{$_})) { $r->print($sthree{$_}."
\n"); } $r->print('