Diff for /loncom/homework/lonhomework.pm between versions 1.236 and 1.239

version 1.236, 2006/02/26 20:01:17 version 1.239, 2006/04/11 21:08:29
Line 143  sub setup_vars { Line 143  sub setup_vars {
 #  return ';$external::target='.$target.';';  #  return ';$external::target='.$target.';';
 }  }
   
 sub send_header {  
     my ($request)= @_;  
     $request->print(&Apache::lontexconvert::header());  
 #  $request->print('<form name='.$env{'form.request.prefix'}.'lonhomework method="POST" action="'.$request->uri.'">');  
 }  
   
 sub createmenu {  sub createmenu {
     my ($which,$request)=@_;      my ($which,$request)=@_;
     if ($which eq 'grade') {      if ($which eq 'grade') {
Line 159  sub createmenu { Line 153  sub createmenu {
     }      }
 }  }
   
 sub send_footer {  
     my ($request)= @_;  
 #  $request->print('</form>');  
     $request->print(&Apache::lontexconvert::footer());  
 }  
   
 sub proctor_checked_in {  sub proctor_checked_in {
     my ($slot_name,$slot,$type)=@_;      my ($slot_name,$slot,$type)=@_;
     my @possible_proctors=split(",",$slot->{'proctor'});      my @possible_proctors=split(",",$slot->{'proctor'});
Line 634  sub handle_save_or_undo { Line 622  sub handle_save_or_undo {
   
 sub analyze_header {  sub analyze_header {
     my ($request) = @_;      my ($request) = @_;
     my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,      my $result =
     ($env{'environment.remote'} ne 'off'));   &Apache::loncommon::start_page('Analyzing a problem',undef,
     my $html=&Apache::lonxml::xmlbegin();         {'only_body' => ($env{'environment.remote'} ne 'off'),});
     my $result.=$html.'      $result .= 
             <head><title>'.&mt("Analyzing a problem").'</title></head>   &Apache::lonxml::message_location().'
             '.$bodytag.&Apache::lonxml::message_location().'  
             <form name="lonhomework" method="POST" action="'.              <form name="lonhomework" method="POST" action="'.
     &HTML::Entities::encode($env{'request.uri'},'<>&"').'">'.      &HTML::Entities::encode($env{'request.uri'},'<>&"').'">'.
     &Apache::structuretags::remember_problem_state().'      &Apache::structuretags::remember_problem_state().'
Line 656  sub analyze_header { Line 643  sub analyze_header {
   
 sub analyze_footer {  sub analyze_footer {
     my ($request) = @_;      my ($request) = @_;
     my $result='</body></html>';      $request->print(&Apache::loncommon::end_page());
     $request->print($result);  
     $request->rflush();      $request->rflush();
 }  }
   
Line 768  sub editxmlmode { Line 754  sub editxmlmode {
  if ($cols > 80) { $cols = 80; }   if ($cols > 80) { $cols = 80; }
  if ($cols < 70) { $cols = 70; }   if ($cols < 70) { $cols = 70; }
  if ($rows < 20) { $rows = 20; }   if ($rows < 20) { $rows = 20; }
  my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,   my $start_page = 
  ($env{'environment.remote'} ne 'off'));      &Apache::loncommon::start_page("EditXML $file",
  my $html=&Apache::lonxml::xmlbegin();     &Apache::edit::js_change_detection(),
  my $head="<head><title>EditXML $file</title>".     {'only_body' =>
     &Apache::edit::js_change_detection()."</head>";   ($env{'environment.remote'} ne 'off')});
   
  $result.=$html.$head.$bodytag.   $result.=$start_page.
     &renderpage($request,$file,['no_output_web'],1).      &renderpage($request,$file,['no_output_web'],1).
     &Apache::lonxml::message_location().'      &Apache::lonxml::message_location().'
             <form '.&Apache::edit::form_change_detection().' name="lonhomework" method="POST" action="'.              <form '.&Apache::edit::form_change_detection().' name="lonhomework" method="POST" action="'.
Line 793  sub editxmlmode { Line 779  sub editxmlmode {
     &HTML::Entities::encode($problem,'<>&"').'</textarea><br />      &HTML::Entities::encode($problem,'<>&"').'</textarea><br />
             <input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes').'" />              <input type="submit" name="submit" accesskey="s" value="'.&mt('Submit Changes').'" />
             <input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" />              <input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" />
             </form></body></html>';              </form>'.&Apache::loncommon::end_page();
  &Apache::lonxml::add_messages(\$result);   &Apache::lonxml::add_messages(\$result);
  $request->print($result);   $request->print($result);
     }      }
Line 950  ENDNEWPROBLEM Line 936  ENDNEWPROBLEM
     $request->print("<select name=\"template\">$templatelist</select>");      $request->print("<select name=\"template\">$templatelist</select>");
  }   }
  $request->print("<br /><input type=\"submit\" name=\"newfile\" value=\"".&mt('Create')." $extension\" />");   $request->print("<br /><input type=\"submit\" name=\"newfile\" value=\"".&mt('Create')." $extension\" />");
  $request->print("</form></p></body>");   $request->print("</form></p>".&Apache::loncommon::end_page());
     }      }
     return '';      return '';
 }  }
   
 sub view_or_edit_menu {  
     my ($request) = @_;  
     my $url=&HTML::Entities::encode($request->uri,'<>&"');  
     my %lt=&Apache::lonlocal::texthash( 'would' => 'Would you like to',  
       'view' => 'View',  
       'Edit' => 'edit',  
       'or' => 'or',  
       'the problem' => 'the problem');  
     $request->print(<<EDITMENU);  
 <body bgcolor="#FFFFFF">  
 <form action="$url" method="POST">  
 $lt{'would'} <input type="submit" name="problemmode" accesskey="v" value="&lt{'view'}">  
 &lt{'or'} <input type="submit" name="problemmode" accesskey="e" value="&lt{'Edit'}">  
 &lt{'the problem'}.  
 </form>  
 </body>  
 EDITMENU  
 }  
   
 sub handler {  sub handler {
     #my $t0 = [&gettimeofday()];      #my $t0 = [&gettimeofday()];
     my $request=$_[0];      my $request=$_[0];
Line 1011  sub handler { Line 978  sub handler {
     ['problemmode']);      ['problemmode']);
     if (!(defined $env{'form.problemmode'})) {      if (!(defined $env{'form.problemmode'})) {
  #first visit to problem in construction space   #first visit to problem in construction space
  #&view_or_edit_menu($request);  
  $env{'form.problemmode'}='View';   $env{'form.problemmode'}='View';
  &renderpage($request,$file);   &renderpage($request,$file);
     } elsif ($env{'form.problemmode'} eq &mt('EditXML') ||      } elsif ($env{'form.problemmode'} eq &mt('EditXML') ||
Line 1033  sub handler { Line 999  sub handler {
     }      }
     #my $td=&tv_interval($t0);      #my $td=&tv_interval($t0);
     #&Apache::lonxml::debug("Spent $td seconds processing");      #&Apache::lonxml::debug("Spent $td seconds processing");
     # &Apache::lonhomework::send_footer($request);  
     # always turn off debug messages      # always turn off debug messages
     $Apache::lonxml::debug=0;      $Apache::lonxml::debug=0;
     return OK;      return OK;

Removed from v.1.236  
changed lines
  Added in v.1.239


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