--- loncom/interface/lonhelper.pm 2003/12/08 19:24:42 1.63 +++ loncom/interface/lonhelper.pm 2004/04/20 15:08:26 1.69 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # .helper XML handler to implement the LON-CAPA helper # -# $Id: lonhelper.pm,v 1.63 2003/12/08 19:24:42 matthew Exp $ +# $Id: lonhelper.pm,v 1.69 2004/04/20 15:08:26 sakharuk Exp $ # # Copyright Michigan State University Board of Trustees # @@ -230,7 +230,7 @@ my $paramHash; # In the debugger, this means that breakpoints are ignored until you step into # a function and get out of what must be a "faked up scope" in the Apache-> # mod_perl connection. In this code, it was manifesting itself in the existence -# of two seperate file-scoped $helper variables, one set to the value of the +# of two separate file-scoped $helper variables, one set to the value of the # helper in the helper constructor, and one referenced by the handler on the # "$helper->process()" line. Using the debugger, one could actually # see the two different $helper variables, as hashes at completely @@ -263,21 +263,8 @@ sub real_handler { # Send header, don't cache this page - if ($r->header_only) { - if ($ENV{'browser.mathml'}) { - $r->content_type('text/xml; charset=UTF-8'); - } else { - $r->content_type('text/html; charset=UTF-8'); - } - $r->send_http_header; - return OK; - } - if ($ENV{'browser.mathml'}) { - $r->content_type('text/xml'); - } else { - $r->content_type('text/html'); - } - $r->send_http_header; + + if (&Apache::lonhomework::setupheader($r)) { return OK; } $r->rflush(); # Discard result, we just want the objects that get created by the @@ -462,11 +449,11 @@ sub _saveVars { my $self = shift; my $result = ""; $result .= '\n"; + HTML::Entities::encode($self->{STATE},'<>&"') . "\" />\n"; $result .= '\n"; $result .= '\n"; + HTML::Entities::encode($self->{RETURN_PAGE},'<>&"') . "\" />\n"; return $result; } @@ -583,7 +570,7 @@ sub display { } # Phase 4: Display. - my $stateTitle = &mt($state->title()); + my $stateTitle=&mt($state->title()); my $helperTitle = &mt($self->{TITLE}); my $bodytag = &Apache::loncommon::bodytag($helperTitle,'',''); my $previous = HTML::Entities::encode(&mt("<- Previous"), '<>&"'); @@ -593,6 +580,30 @@ sub display { $result .= < + $loncapaHelper: $helperTitle @@ -998,8 +1009,8 @@ sub start_message { return ''; } - $paramHash->{MESSAGE_TEXT} = &Apache::lonxml::get_all_text('/message', - $parser); + $paramHash->{MESSAGE_TEXT} = &mtn(&Apache::lonxml::get_all_text('/message', + $parser)); if (defined($token->[2]{'nextstate'})) { $paramHash->{NEXTSTATE} = $token->[2]{'nextstate'}; @@ -1169,8 +1180,8 @@ sub start_choice { } my $computer = $token->[2]{'computer'}; - my $human = &Apache::lonxml::get_all_text('/choice', - $parser); + my $human = &mt(&Apache::lonxml::get_all_text('/choice', + $parser)); my $nextstate = $token->[2]{'nextstate'}; my $evalFlag = $token->[2]{'eval'}; push @{$paramHash->{CHOICES}}, [$human, $computer, $nextstate, @@ -1206,10 +1217,13 @@ SCRIPT # Only print "select all" and "unselect all" if there are five or # more choices; fewer then that and it looks silly. if ($self->{'multichoice'} && scalar(@{$self->{CHOICES}}) > 4) { + my %lt=&Apache::lonlocal::texthash( + 'sa' => "Select All", + 'ua' => "Unselect All"); $buttons = < - - + +
  BUTTONS } @@ -1264,7 +1278,7 @@ BUTTONS $result .= "\n \n"; $result .= "&"') . "'"; if ($checkedChoices{$choice->[1]}) { $result .= " checked "; @@ -1276,6 +1290,7 @@ BUTTONS $choiceLabel = eval($choiceLabel); $choiceLabel = &$choiceLabel($helper, $self); } + &Apache::lonnet::logthis("TITLE TRANSLATION >$choiceLabel<"); $result .= "/> " . &mtn($choiceLabel) . "\n"; } $result .= "\n\n\n"; @@ -1419,7 +1434,7 @@ sub render { $result .= " - + +
  BUTTONS } @@ -1945,7 +1965,7 @@ BUTTONS $checked = 1; } $col .= "value='" . - HTML::Entities::encode(&$valueFunc($resource)) + HTML::Entities::encode(&$valueFunc($resource),'<>&"') . "' />"; return $col; } @@ -1962,6 +1982,7 @@ BUTTONS 'showParts' => 0, 'filterFunc' => $filterFunc, 'resource_no_folder_link' => 1, + 'closeAllPages' => $self->{'closeallpages'}, 'suppressEmptySequences' => $self->{'suppressEmptySequences'}, 'iterator_map' => $mapUrl } ); @@ -2102,16 +2123,21 @@ sub render { SCRIPT - my $selectAllStudents = &mt('Select All Students'); - my $unselectAllStudents = &mt('Unselect All Students'); + my %lt=&Apache::lonlocal::texthash( + 'ocs' => "Select Only Current Students", + 'sas' => "Select All Students", + 'uas' => "Unselect All Students", + 'sfsg' => "Select for Section/Group", + 'ufsg' => "Unselect for Section/Group"); + $buttons = < - - - - + + + +   - +
BUTTONS } @@ -2170,15 +2196,16 @@ BUTTONS } } - my $name = &mt($self->{'coursepersonnel'} ? 'Name' : 'Student Name'); + my $name = $self->{'coursepersonnel'} ? &mt('Name') : &mt('Student Name'); + &Apache::lonnet::logthis("THE NAME IS >$name<"); my $type = 'radio'; if ($self->{'multichoice'}) { $type = 'checkbox'; } $result .= "\n"; $result .= "". "" . - "" . - "" . - ""; + "" . + "" . + ""; my $checked = 0; for my $choice (@$choices) { @@ -2190,17 +2217,17 @@ BUTTONS $checked = 1; } $result .= - " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3]) + " value='" . HTML::Entities::encode($choice->[0] . ':' . $choice->[2] . ':' . $choice->[1] . ':' . $choice->[3],'<>&"') . "' />\n\n\n\n"; } @@ -2401,20 +2428,22 @@ sub render { } SCRIPT - my $selectAllFiles = &mt("Select All Files"); - my $unselectAllFiles = &mt("Unselect All Files"); - $buttons = < "Select All Files", + 'uaf' => "Unselect All Files"); + $buttons = <   - - + + BUTTONS - my $selectAllPublished = &mt("Select All Published"); - my $unselectAllPublished= &mt("UnselectAllPublished"); + %lt=&Apache::lonlocal::texthash( + 'sap' => "Select All Published", + 'uap' => "Unselect All Published"); if ($helper->{VARS}->{'construction'}) { - $buttons .= < - + $buttons .= < +
  BUTTONS } @@ -2496,7 +2525,7 @@ BUTTONS } $result .= '
$name" . &mt('Section') . "Status" . &mt("Role") . "
Username:Domain
".&mt('Status')."" . &mt("Role") . "".&mt('Username').":".&mt('Domain')."
" - . HTML::Entities::encode($choice->[1]) + . HTML::Entities::encode($choice->[1],'<>&"') . "" - . HTML::Entities::encode($choice->[2]) + . HTML::Entities::encode($choice->[2],'<>&"') . "" - . HTML::Entities::encode($choice->[3]) + . HTML::Entities::encode($choice->[3],'<>&"') . "" - . HTML::Entities::encode($choice->[4]) + . HTML::Entities::encode($choice->[4],'<>&"') . "" - . HTML::Entities::encode($choice->[0]) + . HTML::Entities::encode($choice->[0],'<>&"') . "
" . "&"'). "'"; if (!$self->{'multichoice'} && $choices == 0) { $result .= ' checked'; @@ -2999,6 +3028,11 @@ sub render { if ($self->{'restartCourse'}) { my $targetURL = '/adm/menu'; + if ($ENV{'course.'.$ENV{'request.course.id'}.'.url'}=~/^uploaded/) { + $targetURL = '/adm/coursedocs'; + } else { + $targetURL = '/adm/navmaps'; + } if ($ENV{'course.'.$ENV{'request.course.id'}.'.clonedfrom'}) { $targetURL = '/adm/parmset?overview=1'; } @@ -3035,6 +3069,7 @@ package Apache::lonhelper::parmwizfinal; no strict; @ISA = ('Apache::lonhelper::element'); use strict; +use Apache::lonlocal; BEGIN { &Apache::lonhelper::register('Apache::lonhelper::parmwizfinal', @@ -3114,7 +3149,7 @@ sub render { } my $result = "
\n"; - $result .= '

Confirm that this information is correct, then click "Finish Helper" to complete setting the parameter.

    '; + $result .= '

    '.&mt('Confirm that this information is correct, then click "Finish Helper" to complete setting the parameter.').'

      '; # Print the type of manipulation: $result .= '
    • Setting the ' . $dateTypeHash{$vars->{ACTION_TYPE}} . ''; @@ -3159,7 +3194,7 @@ sub render { $result .= "
    • for section $section
    • "; $level -= 3; $result .= "\n"; + HTML::Entities::encode($section,'<>&"') . "' />\n"; } else { # FIXME: This is probably wasteful! Store the name! my $classlist = Apache::loncoursedata::get_classlist(); @@ -3171,9 +3206,9 @@ sub render { $level -= 6; my ($uname, $udom) = split /:/, $vars->{USER_NAME}; $result .= "\n"; + HTML::Entities::encode($uname,'<>&"') . "' />\n"; $result .= "\n"; + HTML::Entities::encode($udom,'<>&"') . "' />\n"; } # Print value