Diff for /loncom/homework/lonhomework.pm between versions 1.237 and 1.241

version 1.237, 2006/03/24 17:34:11 version 1.241, 2006/04/21 15:26:25
Line 266  sub check_slot_access { Line 266  sub check_slot_access {
     my $slotstatus='NOT_IN_A_SLOT';      my $slotstatus='NOT_IN_A_SLOT';
     my ($returned_slot,$slot_name);      my ($returned_slot,$slot_name);
     foreach my $slot (@slots) {      foreach my $slot (@slots) {
    $slot =~ s/(^\s*|\s*$)//g;
  &Apache::lonxml::debug("getting $slot");   &Apache::lonxml::debug("getting $slot");
  my %slot=&Apache::lonnet::get_slot($slot);   my %slot=&Apache::lonnet::get_slot($slot);
  &Apache::lonhomework::showhash(%slot);   &Apache::lonhomework::showhash(%slot);
Line 622  sub handle_save_or_undo { Line 623  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();  
     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 755  sub editxmlmode { Line 755  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>".  
     &Apache::edit::js_change_detection()."</head>";  
   
  $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 780  sub editxmlmode { Line 778  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 912  sub newproblem { Line 910  sub newproblem {
     $errormsg='<p><font color="red">'.&mt('You did not select a template.').'</font></p>'."\n";      $errormsg='<p><font color="red">'.&mt('You did not select a template.').'</font></p>'."\n";
  }   }
  my $instructions;   my $instructions;
  my $bodytag=&Apache::loncommon::bodytag(undef,undef,undef,   my $start_page = 
  ($env{'environment.remote'} ne 'off'));      &Apache::loncommon::start_page("Create New $extension");
  if ($templatelist) { $instructions=&mt(", select a template from the pull-down menu below.").'<br />'.&mt("Then");}   if ($templatelist) { $instructions=&mt(", select a template from the pull-down menu below.").'<br />'.&mt("Then");}
  my %lt=&Apache::lonlocal::texthash( 'create' => 'Creating a new',   my %lt=&Apache::lonlocal::texthash( 'create' => 'Creating a new',
   'resource' => 'resource',    'resource' => 'resource',
Line 924  sub newproblem { Line 922  sub newproblem {
   'Create' => 'Create',    'Create' => 'Create',
   'button' => 'button');    'button' => 'button');
  $request->print(<<ENDNEWPROBLEM);   $request->print(<<ENDNEWPROBLEM);
 $bodytag  $start_page
 <h1>$lt{'create'} $extension $lt{'resource'}</h1>  <h1>$lt{'create'} $extension $lt{'resource'}</h1>
 $errormsg  $errormsg
 $lt{'requested'} <tt>$shownurl</tt> $lt{'not exist'}.  $lt{'requested'} <tt>$shownurl</tt> $lt{'not exist'}.
Line 937  ENDNEWPROBLEM Line 935  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 998  sub handler { Line 977  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') ||

Removed from v.1.237  
changed lines
  Added in v.1.241


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