--- loncom/interface/lonhelper.pm 2003/10/08 18:23:26 1.52
+++ loncom/interface/lonhelper.pm 2004/04/21 19:03:02 1.73
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# .helper XML handler to implement the LON-CAPA helper
#
-# $Id: lonhelper.pm,v 1.52 2003/10/08 18:23:26 bowersj2 Exp $
+# $Id: lonhelper.pm,v 1.73 2004/04/21 19:03:02 albertel 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,13 @@ 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');
+ &Apache::loncommon::content_type($r,'text/xml');
} else {
- $r->content_type('text/html');
+ &Apache::loncommon::content_type($r,'text/html');
}
$r->send_http_header;
+ return OK if $r->header_only;
$r->rflush();
# Discard result, we just want the objects that get created by the
@@ -462,11 +454,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 +575,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 +585,30 @@ sub display {
$result .= <
+
$loncapaHelper: $helperTitle
@@ -998,8 +1014,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 +1185,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 +1222,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 +1283,7 @@ BUTTONS
$result .= "