--- loncom/homework/lonhomework.pm 2003/09/18 20:35:30 1.147 +++ loncom/homework/lonhomework.pm 2003/09/21 21:40:06 1.151 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # The LON-CAPA Homework handler # -# $Id: lonhomework.pm,v 1.147 2003/09/18 20:35:30 albertel Exp $ +# $Id: lonhomework.pm,v 1.151 2003/09/21 21:40:06 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -90,8 +90,8 @@ sub get_target { return ('web'); } } else { - if ( $ENV{'form.problemmode'} eq 'View' || - $ENV{'form.problemmode'} eq 'Discard Edits and View') { + if ( $ENV{'form.problemmode'} eq &mt('View') || + $ENV{'form.problemmode'} eq &mt('Discard Edits and View')) { if ( defined($ENV{'form.submitted'}) && (!defined($ENV{'form.resetdata'})) && (!defined($ENV{'form.newrandomization'}))) { @@ -99,9 +99,9 @@ sub get_target { } else { return ('web','answer'); } - } elsif ( $ENV{'form.problemmode'} eq 'Edit' ) { + } elsif ( $ENV{'form.problemmode'} eq &mt('Edit') ) { if ( $ENV{'form.submitted'} eq 'edit' ) { - if ( $ENV{'form.submit'} eq 'Submit Changes and View' ) { + if ( $ENV{'form.submit'} eq &mt('Submit Changes and View') ) { return ('modified','web','answer'); } else { return ('modified','edit'); @@ -307,11 +307,10 @@ sub setuppermissions { sub setupheader { my $request=$_[0]; if ($ENV{'browser.mathml'}) { - $request->content_type('text/xml'); + &Apache::loncommon::content_type($request,'text/xml'); } else { - $request->content_type('text/html'); + &Apache::loncommon::content_type($request,'text/html'); } - $request->content_encoding('UTF-8'); if (!$Apache::lonxml::debug && ($ENV{'REQUEST_METHOD'} eq 'GET')) { &Apache::loncommon::no_cache($request); } @@ -327,7 +326,7 @@ sub handle_save_or_undo { my $filetmp =$file.".tmp"; my $error=0; - if ($ENV{'form.Undo'} eq 'undo') { + if ($ENV{'form.Undo'} eq &mt('undo')) { my $error=0; if (!copy($file,$filetmp)) { $error=1; } if ((!$error) && (!copy($filebak,$file))) { $error=1; } @@ -445,9 +444,7 @@ sub analyze { } } if (scalar(keys(%allparts)) == 0 ) { - $request->print('

'.&mt('Found no analyzable parts in this problem, - currently only Numerical, Formula and String response - styles are supported.').'

'); + $request->print('

'.&mt('Found no analyzable parts in this problem, currently only Numerical, Formula and String response styles are supported.').'

'); } &Apache::lonhtmlcommon::Close_PrgWin($request,\%prog_state); &analyze_footer($request); @@ -470,7 +467,7 @@ sub editxmlmode { if (!$error) { $problem=&Apache::lonnet::getfile($file); } } &Apache::lonhomework::showhashsubset(\%ENV,'^form'); - if ( $ENV{'form.submit'} eq 'Submit Changes and View' ) { + if ( $ENV{'form.submit'} eq &mt('Submit Changes and View') ) { &Apache::lonhomework::showhashsubset(\%ENV,'^form'); $ENV{'form.problemmode'}='View'; &renderpage($request,$file); @@ -609,7 +606,7 @@ sub newproblem { 'button' => 'button'); $request->print(< -

$lt{'create'} $extension <{'resource'}

+

$lt{'create'} $extension $lt{'resource'}

$errormsg $lt{'requested'} $url $lt{'not exist'}.

@@ -686,9 +683,9 @@ sub handler { my ($symb) = &Apache::lonxml::whichuser(); &Apache::lonxml::debug('symb is '.$symb); if ($ENV{'request.state'} eq "construct" || $symb eq '') { - if ($ENV{'form.resetdata'} eq 'Reset Submissions' || - $ENV{'form.resetdata'} eq 'New Problem Variation' || - $ENV{'form.newrandomization'} eq 'New Randomization') { + if ($ENV{'form.resetdata'} eq &mt('Reset Submissions') || + $ENV{'form.resetdata'} eq &mt('New Problem Variation') || + $ENV{'form.newrandomization'} eq &mt('New Randomization')) { my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser(); &Apache::lonnet::tmpreset($symb,'',$domain,$name); &Apache::lonxml::debug("Attempt reset"); @@ -703,9 +700,9 @@ sub handler { #&view_or_edit_menu($request); $ENV{'form.problemmode'}='View'; &renderpage($request,$file); - } elsif ($ENV{'form.problemmode'} eq 'EditXML') { + } elsif ($ENV{'form.problemmode'} eq &mt('EditXML')) { &editxmlmode($request,$file); - } elsif ($ENV{'form.problemmode'} eq 'Calculate answers') { + } elsif ($ENV{'form.problemmode'} eq &mt('Calculate answers')) { &analyze($request,$file); } else { &renderpage($request,$file);