--- loncom/xml/lonxml.pm 2008/03/21 18:52:28 1.473.2.1
+++ loncom/xml/lonxml.pm 2008/08/01 16:31:26 1.482
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.473.2.1 2008/03/21 18:52:28 raeburn Exp $
+# $Id: lonxml.pm,v 1.482 2008/08/01 16:31:26 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -361,8 +361,8 @@ sub xmlparse {
$safeeval,\%style_for_target,1);
if (@stack) {
- &warning("At end of file some tags were still left unclosed, ".
- '<'.join('>, <',reverse(@stack)).
+ &warning(&mt('At end of file some tags were still left unclosed:').
+ ' <'.join('>, <',reverse(@stack)).
'>');
}
if ($env{'request.uri'}) {
@@ -718,6 +718,7 @@ sub init_safespace {
$safeeval->permit(":base_math");
$safeeval->permit("sort");
$safeeval->permit("time");
+ $safeeval->permit("caller");
$safeeval->deny("rand");
$safeeval->deny("srand");
$safeeval->deny(":base_io");
@@ -737,6 +738,9 @@ sub init_safespace {
$safehole->wrap(\&Apache::caparesponse::capa_formula_fix,$safeeval,
'&capa_formula_fix');
+ $safehole->wrap(\&Apache::lonlocal::locallocaltime,$safeeval,
+ '&locallocaltime');
+
$safehole->wrap(\&Math::Cephes::asin,$safeeval,'&asin');
$safehole->wrap(\&Math::Cephes::acos,$safeeval,'&acos');
$safehole->wrap(\&Math::Cephes::atan,$safeeval,'&atan');
@@ -1080,6 +1084,7 @@ Optional Arguments:
sub increment_counter {
my ($increment, $part_response) = @_;
+ if ($env{'form.grade_noincrement'}) { return; }
if (!defined($increment) || $increment le 0) {
$increment = 1;
}
@@ -1121,7 +1126,7 @@ sub init_counter {
}
sub store_counter {
- &Apache::lonnet::appenv(('form.counter' => $Apache::lonxml::counter));
+ &Apache::lonnet::appenv({'form.counter' => $Apache::lonxml::counter});
$Apache::lonxml::counter_changed=0;
return '';
}
@@ -1142,7 +1147,7 @@ sub store_counter {
sub restore_problem_counter {
if (defined($state)) {
- &Apache::lonnet::appenv(('form.counter' => $state));
+ &Apache::lonnet::appenv({'form.counter' => $state});
}
}
sub get_problem_counter {
@@ -1379,7 +1384,7 @@ sub writeallows {
&Apache::lonnet::hreflocation($thisdir,&unescape($_))}=$thisurl;
}
@extlinks=();
- &Apache::lonnet::appenv(%httpref);
+ &Apache::lonnet::appenv(\%httpref);
}
sub register_ssi {
@@ -1446,7 +1451,7 @@ sub storefile {
$fh->close();
return 1;
} else {
- &warning("Unable to save file $file");
+ &warning(&mt('Unable to save file [_1]',''.$file.''));
return 0;
}
}
@@ -1496,6 +1501,30 @@ sub verify_html {
return '';
}
+sub renderingoptions {
+ my %langchoices=('' => '');
+ foreach (&Apache::loncommon::languageids()) {
+ if (&Apache::loncommon::supportedlanguagecode($_)) {
+ $langchoices{&Apache::loncommon::supportedlanguagecode($_)}
+ = &Apache::loncommon::plainlanguagedescription($_);
+ }
+ }
+ return
+ ''.
+ &mt('Language:').' '.
+ &Apache::loncommon::select_form($env{'form.languages'},'languages',
+ %langchoices).'
+
+ '.
+ &mt('Math Rendering:').' '.
+ &Apache::loncommon::select_form($env{'form.texengine'},'texengine',
+ ('' => '',
+ 'tth' => 'tth (Tex-to-HTML)',
+ 'jsMath' => 'jsMath',
+ 'mimetex' => 'mimetex (Convert to Images)')).'
+ ';
+}
+
sub inserteditinfo {
my ($filecontents, $filetype, $filename)=@_;
$filecontents = &HTML::Entities::encode($filecontents,'<>&"');
@@ -1761,7 +1790,8 @@ sub display_title {
$title = $env{'request.filename'};
$title = substr($title, rindex($title, '/') + 1);
}
- $result = "";
+ $result = "";
}
return $result;
}
@@ -1815,7 +1845,7 @@ sub error {
# If printing in construction space, put the error inside
push(@Apache::lonxml::error_messages,
$Apache::lonxml::warnings_error_header.
- "ERROR:".join("
\n",@errors)."
\n");
+ "".&mt('ERROR:')."".join("
\n",@errors)."
\n");
$Apache::lonxml::warnings_error_header='';
} else {
my $errormsg;
@@ -1825,7 +1855,9 @@ sub error {
$errormsg=&mt("An error occured while processing this resource. The author has been notified.");
}
my $host=$Apache::lonnet::perlvar{'lonHostID'};
- push(@errors, "The error occurred on host $host");
+ push(@errors,
+ &mt("The error occurred on host [_1]",
+ "$host"));
my $msg = join('
', @errors);
@@ -1875,7 +1907,10 @@ sub warning {
if ( &show_error_warn_msg() ) {
push(@Apache::lonxml::warning_messages,
$Apache::lonxml::warnings_error_header.
- "WARNING:".join('
',@_)."
\n");
+ ''.
+ &mt('[_1]W[_2]ARNING','','').": ".join('
',@_)."
\n".
+ ''
+ );
$Apache::lonxml::warnings_error_header='';
}
}