--- loncom/xml/lonxml.pm 2004/11/29 22:45:51 1.347
+++ loncom/xml/lonxml.pm 2005/01/28 09:49:52 1.352
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# XML Parser Module
#
-# $Id: lonxml.pm,v 1.347 2004/11/29 22:45:51 albertel Exp $
+# $Id: lonxml.pm,v 1.352 2005/01/28 09:49:52 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -1261,6 +1261,8 @@ sub handler {
&Apache::loncommon::content_type($request,'text/html');
}
&Apache::loncommon::no_cache($request);
+ $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
+ 'lastrevisiondate');
$request->send_http_header;
return OK if $request->header_only;
@@ -1338,7 +1340,11 @@ ENDNOTFOUND
if ($ENV{'form.editmode'} && (!($ENV{'form.viewmode'}))) {
my $displayfile=$request->uri;
$displayfile=~s/^\/[^\/]*//;
- $result='
'.
+ my $bodytag='';
+ if ($ENV{'environment.remote'} eq 'off') {
+ $bodytag=&Apache::loncommon::bodytag();
+ }
+ $result=''.$bodytag.
&Apache::lonxml::message_location().''.
$displayfile.
'
';
@@ -1377,9 +1383,21 @@ sub debug {
}
}
+sub show_error_warn_msg {
+ if ($ENV{'request.filename'} eq '/home/httpd/html/res/lib/templates/simpleproblem.problem' &&
+ &Apache::lonnet::allowed('mdc',$ENV{'request.course.id'})) {
+ return 1;
+ }
+ return (($Apache::lonxml::debug eq 1) ||
+ ($ENV{'request.state'} eq 'construct') ||
+ ($Apache::lonhomework::browse eq 'F'
+ &&
+ $ENV{'form.show_errors'} eq 'on'));
+}
+
sub error {
$errorcount++;
- if (($Apache::lonxml::debug eq 1) || ($ENV{'request.state'} eq 'construct') ) {
+ if ( &show_error_warn_msg() ) {
# If printing in construction space, put the error inside
push(@Apache::lonxml::error_messages,
$Apache::lonxml::warnings_error_header.
@@ -1419,7 +1437,7 @@ sub warning {
$warningcount++;
if ($ENV{'form.grade_target'} ne 'tex') {
- if ($ENV{'request.state'} eq 'construct' || $Apache::lonxml::debug) {
+ if ( &show_error_warn_msg() ) {
my $request=$Apache::lonxml::request;
if (!$request) { $request=Apache->request; }
push(@Apache::lonxml::warning_messages,
@@ -1584,35 +1602,36 @@ sub whichuser {
my ($passedsymb)=@_;
my ($symb,$courseid,$domain,$name,$publicuser);
if (defined($ENV{'form.grade_symb'})) {
- my $tmp_courseid=$ENV{'form.grade_courseid'};
- my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
- if (!$allowed &&
- exists($ENV{'request.course.sec'}) &&
- $ENV{'request.course.sec'} !~ /^\s*$/) {
- $allowed=&Apache::lonnet::allowed('vgr',$ENV{'form.grade_courseid'}.
- '/'.$ENV{'request.course.sec'});
- }
- if ($allowed) {
- $symb=$ENV{'form.grade_symb'};
- $courseid=$ENV{'form.grade_courseid'};
- $domain=$ENV{'form.grade_domain'};
- $name=$ENV{'form.grade_username'};
- }
- } else {
- if (!$passedsymb) {
- $symb=&Apache::lonnet::symbread();
- } else {
- $symb=$passedsymb;
+ my ($tmp_courseid)=
+ &Apache::loncommon::get_env_multiple('form.grade_courseid');
+ my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
+ if (!$allowed &&
+ exists($ENV{'request.course.sec'}) &&
+ $ENV{'request.course.sec'} !~ /^\s*$/) {
+ $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid.
+ '/'.$ENV{'request.course.sec'});
}
- $courseid=$ENV{'request.course.id'};
- $domain=$ENV{'user.domain'};
- $name=$ENV{'user.name'};
- if ($name eq 'public' && $domain eq 'public') {
- if (!defined($ENV{'form.username'})) {
- $ENV{'form.username'}.=time.rand(10000000);
- }
- $name.=$ENV{'form.username'};
+ if ($allowed) {
+ ($symb)=&Apache::loncommon::get_env_multiple('form.grade_symb');
+ $courseid=$tmp_courseid;
+ ($domain)=&Apache::loncommon::get_env_multiple('form.grade_domain');
+ ($name)=&Apache::loncommon::get_env_multiple('form.grade_username');
+ return ($symb,$courseid,$domain,$name,$publicuser);
+ }
+ }
+ if (!$passedsymb) {
+ $symb=&Apache::lonnet::symbread();
+ } else {
+ $symb=$passedsymb;
+ }
+ $courseid=$ENV{'request.course.id'};
+ $domain=$ENV{'user.domain'};
+ $name=$ENV{'user.name'};
+ if ($name eq 'public' && $domain eq 'public') {
+ if (!defined($ENV{'form.username'})) {
+ $ENV{'form.username'}.=time.rand(10000000);
}
+ $name.=$ENV{'form.username'};
}
return ($symb,$courseid,$domain,$name,$publicuser);
}