Diff for /loncom/xml/lonxml.pm between versions 1.347 and 1.353

version 1.347, 2004/11/29 22:45:51 version 1.353, 2005/01/28 21:08:45
Line 1261  sub handler { Line 1261  sub handler {
  &Apache::loncommon::content_type($request,'text/html');   &Apache::loncommon::content_type($request,'text/html');
     }      }
     &Apache::loncommon::no_cache($request);      &Apache::loncommon::no_cache($request);
       $request->set_last_modified(&Apache::lonnet::metadata($request->uri,
     'lastrevisiondate'));
     $request->send_http_header;      $request->send_http_header;
           
     return OK if $request->header_only;      return OK if $request->header_only;
Line 1338  ENDNOTFOUND Line 1340  ENDNOTFOUND
  if ($ENV{'form.editmode'} && (!($ENV{'form.viewmode'}))) {   if ($ENV{'form.editmode'} && (!($ENV{'form.viewmode'}))) {
     my $displayfile=$request->uri;      my $displayfile=$request->uri;
     $displayfile=~s/^\/[^\/]*//;      $displayfile=~s/^\/[^\/]*//;
     $result='<html><body bgcolor="#FFFFFF">'.      my $bodytag='<body bgcolor="#FFFFFF">';
       if ($ENV{'environment.remote'} eq 'off') {
    $bodytag=&Apache::loncommon::bodytag();
       }
       $result='<html>'.$bodytag.
  &Apache::lonxml::message_location().'<h3>'.   &Apache::lonxml::message_location().'<h3>'.
  $displayfile.   $displayfile.
  '</h3></body></html>';   '</h3></body></html>';
Line 1377  sub debug { Line 1383  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 {  sub error {
     $errorcount++;      $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 <pre></pre>   # If printing in construction space, put the error inside <pre></pre>
  push(@Apache::lonxml::error_messages,   push(@Apache::lonxml::error_messages,
      $Apache::lonxml::warnings_error_header.       $Apache::lonxml::warnings_error_header.
Line 1419  sub warning { Line 1437  sub warning {
     $warningcount++;      $warningcount++;
       
     if ($ENV{'form.grade_target'} ne 'tex') {      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;      my $request=$Apache::lonxml::request;
     if (!$request) { $request=Apache->request; }      if (!$request) { $request=Apache->request; }
     push(@Apache::lonxml::warning_messages,      push(@Apache::lonxml::warning_messages,
Line 1584  sub whichuser { Line 1602  sub whichuser {
   my ($passedsymb)=@_;    my ($passedsymb)=@_;
   my ($symb,$courseid,$domain,$name,$publicuser);    my ($symb,$courseid,$domain,$name,$publicuser);
   if (defined($ENV{'form.grade_symb'})) {    if (defined($ENV{'form.grade_symb'})) {
     my $tmp_courseid=$ENV{'form.grade_courseid'};        my ($tmp_courseid)=
     my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);    &Apache::loncommon::get_env_multiple('form.grade_courseid');
     if (!$allowed &&         my $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid);
  exists($ENV{'request.course.sec'}) &&         if (!$allowed && 
  $ENV{'request.course.sec'} !~ /^\s*$/) {    exists($ENV{'request.course.sec'}) && 
  $allowed=&Apache::lonnet::allowed('vgr',$ENV{'form.grade_courseid'}.    $ENV{'request.course.sec'} !~ /^\s*$/) {
   '/'.$ENV{'request.course.sec'});    $allowed=&Apache::lonnet::allowed('vgr',$tmp_courseid.
     }      '/'.$ENV{'request.course.sec'});
     if ($allowed) {        }
       $symb=$ENV{'form.grade_symb'};        if ($allowed) {
       $courseid=$ENV{'form.grade_courseid'};    ($symb)=&Apache::loncommon::get_env_multiple('form.grade_symb');
       $domain=$ENV{'form.grade_domain'};    $courseid=$tmp_courseid;
       $name=$ENV{'form.grade_username'};    ($domain)=&Apache::loncommon::get_env_multiple('form.grade_domain');
     }    ($name)=&Apache::loncommon::get_env_multiple('form.grade_username');
   } else {    return ($symb,$courseid,$domain,$name,$publicuser);
       if (!$passedsymb) {  
           $symb=&Apache::lonnet::symbread();  
       } else {  
           $symb=$passedsymb;  
       }        }
       $courseid=$ENV{'request.course.id'};    }
       $domain=$ENV{'user.domain'};    if (!$passedsymb) {
       $name=$ENV{'user.name'};        $symb=&Apache::lonnet::symbread();
       if ($name eq 'public' && $domain eq 'public') {    } else {
   if (!defined($ENV{'form.username'})) {        $symb=$passedsymb;
       $ENV{'form.username'}.=time.rand(10000000);    }
   }    $courseid=$ENV{'request.course.id'};
   $name.=$ENV{'form.username'};    $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);    return ($symb,$courseid,$domain,$name,$publicuser);
 }  }

Removed from v.1.347  
changed lines
  Added in v.1.353


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>