Diff for /loncom/homework/lonhomework.pm between versions 1.132 and 1.140

version 1.132, 2003/05/23 06:45:45 version 1.140, 2003/09/11 20:03:28
Line 50  use Apache::essayresponse(); Line 50  use Apache::essayresponse();
 use Apache::externalresponse();  use Apache::externalresponse();
 use Apache::rankresponse();  use Apache::rankresponse();
 use Apache::matchresponse();  use Apache::matchresponse();
 #use Apache::chemresponse();  use Apache::chemresponse();
 use Apache::Constants qw(:common);  use Apache::Constants qw(:common);
 use HTML::Entities();  use HTML::Entities();
 use Apache::loncommon();  use Apache::loncommon();
Line 69  sub get_target { Line 69  sub get_target {
     } elsif ( defined($ENV{'form.grade_target'}  )       } elsif ( defined($ENV{'form.grade_target'}  ) 
  && ($Apache::lonhomework::viewgrades eq 'F' )) {   && ($Apache::lonhomework::viewgrades eq 'F' )) {
       return ($ENV{'form.grade_target'});        return ($ENV{'form.grade_target'});
       } elsif (defined($ENV{'form.grade_target'}  ) 
    && ($ENV{'form.grade_target'} eq 'answer')) {
         return ($ENV{'form.grade_target'});
     }      }
     
     if ( defined($ENV{'form.submitted'}) &&      if ( defined($ENV{'form.submitted'}) &&
  ( !defined($ENV{'form.resetdata'}))) {   ( !defined($ENV{'form.resetdata'})) &&
    ( !defined($ENV{'form.newrandomization'}))) {
       return ('grade', 'web');        return ('grade', 'web');
     } else {      } else {
       return ('web');        return ('web');
Line 91  sub get_target { Line 95  sub get_target {
       if ( $ENV{'form.problemmode'} eq 'View' ||        if ( $ENV{'form.problemmode'} eq 'View' ||
    $ENV{'form.problemmode'} eq 'Discard Edits and View') {     $ENV{'form.problemmode'} eq 'Discard Edits and View') {
  if ( defined($ENV{'form.submitted'}) &&   if ( defined($ENV{'form.submitted'}) &&
      (!defined($ENV{'form.resetdata'})) ) {       (!defined($ENV{'form.resetdata'})) &&
        (!defined($ENV{'form.newrandomization'}))) {
   return ('grade', 'web','answer');    return ('grade', 'web','answer');
  } else {   } else {
   return ('web','answer');    return ('web','answer');
Line 225  sub check_access { Line 230  sub check_access {
     }      }
   }    }
   
   if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&    #if (($status ne 'CLOSED') && ($Apache::lonhomework::type eq 'exam') &&
       (!$Apache::lonhomework::history{"resource.0.outtoken"})) {    #    (!$Apache::lonhomework::history{"resource.0.outtoken"})) {
       return ('UNCHECKEDOUT','needs to be checked out');    #    return ('UNCHECKEDOUT','needs to be checked out');
   }    #}
   
   
   &Apache::lonxml::debug("sending back :$status:$datemsg:");    &Apache::lonxml::debug("sending back :$status:$datemsg:");
Line 417  sub analyze { Line 422  sub analyze {
     }      }
     &Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state,      &Apache::lonhtmlcommon::Update_PrgWin($request,\%prog_state,
   'Analyzing Results');    'Analyzing Results');
     foreach my $part (keys(%allparts)) {      foreach my $part (sort(keys(%allparts))) {
  if (defined(@{ $overall{$part.'.answer'} })) {   if (defined(@{ $overall{$part.'.answer'} })) {
     my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] });      my $num_cols=scalar(@{ $overall{$part.'.answer'}->[0] });
     $request->print('<table><tr><td colspan="'.($num_cols+1).'">Part '.$part.'</td></tr>');      $request->print('<table><tr><td colspan="'.($num_cols+1).'">Part '.$part.'</td></tr>');
Line 469  sub editxmlmode { Line 474  sub editxmlmode {
     &renderpage($request,$file);      &renderpage($request,$file);
   } else {    } else {
     my ($rows,$cols) = &Apache::edit::textarea_sizes(\$problem);      my ($rows,$cols) = &Apache::edit::textarea_sizes(\$problem);
     my $xml_help = '<table><tr><td>'.      my $xml_help = Apache::loncommon::helpLatexCheatsheet("Problem_Editor_XML_Index",
  &Apache::loncommon::help_open_topic("Problem_Editor_XML_Index",'Problem Editing Help')    "Problem Editing Help");
     .'</td><td>'.  
  &Apache::loncommon::help_open_topic("Greek_Symbols",'Greek Symbols',  
     undef,undef,600)  
     .'</td><td>'.  
         &Apache::loncommon::help_open_topic("Other_Symbols",'Other Symbols',  
     undef,undef,600)  
     .'</td></tr></table>';  
     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; }
Line 662  sub handler { Line 660  sub handler {
     # if we are browsing we might not be able to know where we are      # if we are browsing we might not be able to know where we are
     if ($Apache::lonhomework::browse ne 'F') {      if ($Apache::lonhomework::browse ne 'F') {
       #should know where we are, so ask        #should know where we are, so ask
       $request->internal_redirect('/adm/ambiguous'); return;   if ( Apache::exists_config_define("MODPERL2") ) {
       &Apache::lonnet::cleanenv();
    }
    $request->internal_redirect('/adm/ambiguous'); return;
     }      }
   }    }
   
Line 670  sub handler { Line 671  sub handler {
   &Apache::lonxml::debug('symb is '.$symb);    &Apache::lonxml::debug('symb is '.$symb);
   if ($ENV{'request.state'} eq "construct" || $symb eq '') {    if ($ENV{'request.state'} eq "construct" || $symb eq '') {
       if ($ENV{'form.resetdata'} eq 'Reset Submissions' ||        if ($ENV{'form.resetdata'} eq 'Reset Submissions' ||
   $ENV{'form.resetdata'} eq 'New Problem Variation' ) {    $ENV{'form.resetdata'} eq 'New Problem Variation' ||
             $ENV{'form.newrandomization'} eq 'New Randomization') {
   my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();    my ($symb,$courseid,$domain,$name) = &Apache::lonxml::whichuser();
   &Apache::lonnet::tmpreset($symb,'',$domain,$name);    &Apache::lonnet::tmpreset($symb,'',$domain,$name);
   &Apache::lonxml::debug("Attempt reset");
       }        }
   }    }
   if ($ENV{'request.state'} eq "construct") {    if ($ENV{'request.state'} eq "construct") {
     if ( -e $file ) {      if ( -e $file ) {
         &Apache::loncommon::get_unprocessed_cgi
                             ($ENV{'QUERY_STRING'},['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);   #&view_or_edit_menu($request);

Removed from v.1.132  
changed lines
  Added in v.1.140


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