Diff for /loncom/homework/structuretags.pm between versions 1.131 and 1.137

version 1.131, 2002/11/06 22:58:36 version 1.137, 2002/11/13 23:37:56
Line 29 Line 29
 # 6/26/2001 fixed extra web display at end of <web></web> tags  # 6/26/2001 fixed extra web display at end of <web></web> tags
 # 8/17,8/18,8/20 Gerd Kortemeyer  # 8/17,8/18,8/20 Gerd Kortemeyer
   
   
 package Apache::structuretags;   package Apache::structuretags; 
   
 use strict;  use strict;
Line 100  sub page_start { Line 101  sub page_start {
       }        }
     }      }
     $body_tag_start.='>';      $body_tag_start.='>';
       if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {
    my ($symb)=&Apache::lonxml::whichuser();
    if ($symb eq '') {
       my $help = &Apache::loncommon::help_open_topic("Ambiguous_Reference");
       $help="Browsing or <a href=\"/adm/ambiguous\">ambiguous</a> reference, submissions ignored $help<br />";
       $body_tag_start.=$help;
    }
       }
   }    }
   my $form_tag_start;    my $form_tag_start;
   if (!defined($found{'form'})) {    if (!defined($found{'form'})) {
Line 129  sub setup_rndseed { Line 138  sub setup_rndseed {
       $rndseed=time;        $rndseed=time;
       $ENV{'form.rndseed'}=$rndseed;        $ENV{'form.rndseed'}=$rndseed;
     }      }
       &Apache::lonxml::debug("Setting rndseed to $rndseed");
     &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);      &Apache::run::run('$external::randomseed='.$rndseed.';',$safeeval);
   }    }
   return $rndseed;    return $rndseed;
Line 140  sub problem_edit_header { Line 150  sub problem_edit_header {
        <input type="submit" name="problemmode" value="Discard Edits and View" />         <input type="submit" name="problemmode" value="Discard Edits and View" />
        <input type="submit" name="problemmode" value="EditXML" />         <input type="submit" name="problemmode" value="EditXML" />
        <input type="submit" name="Undo" value="undo" /> <hr />         <input type="submit" name="Undo" value="undo" /> <hr />
        <input type="submit" name="submit" value="Submit Changes" />         <input type="submit" name="submit" value="Submit Changes and Edit" />
        <input type="submit" name="submit" value="Submit Changes and View" /><br /><p>&nbsp;</p>         <input type="submit" name="submit" value="Submit Changes and View" /><br /><p>&nbsp;</p><table border="0"><tr><td bgcolor="#DDDDDD">
       ';        ';
 }  }
   
 sub problem_edit_footer {  sub problem_edit_footer {
   return '<br /><input type="submit" name="submit" value="Submit Changes and Edit" />    return '</td></tr></table><br /><input type="submit" name="submit" value="Submit Changes and Edit" />
     <input type="submit" name="submit" value="Submit Changes and View" />';      <input type="submit" name="submit" value="Submit Changes and View" />';
 }  }
   
Line 165  sub problem_web_to_edit_header { Line 175  sub problem_web_to_edit_header {
              <hr />';               <hr />';
   my $numtoanalyze=$ENV{'form.numtoanalyze'};    my $numtoanalyze=$ENV{'form.numtoanalyze'};
   if (!$numtoanalyze) { $numtoanalyze=100; }    if (!$numtoanalyze) { $numtoanalyze=100; }
   #DISABLED for now.    $result.= '<input type="submit" name="problemmode" value="Answer Distribution" />
   #$result.= '<input type="submit" name="problemmode" value="Answer Distribution" />               <input type="text" name="numtoanalyze" value="'.
 #             <input type="text" name="numtoanalyze" value="'.         $numtoanalyze.'" size="5" /> <hr />';
 # $numtoanalyze.'" size="5" /> <hr />';  
   return $result;    return $result;
 }  }
   
Line 272  sub start_problem { Line 281  sub start_problem {
     &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);      &page_start($target,$token,$tagstack,$parstack,$parser,$safeeval);
   if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) { $result = '';}    if ($target eq 'tex' and $ENV{'request.symb'} =~ m/\.page_/) { $result = '';}
   
     if ($target eq 'analyze') { my $rndseed=&setup_rndseed($safeeval); }
   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {    if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
     #handle exam checkout      #handle exam checkout
     if ($Apache::lonhomework::type eq 'exam') {      if ($Apache::lonhomework::type eq 'exam') {
Line 290  sub start_problem { Line 300  sub start_problem {
     my $expression='$external::datestatus="'.$status.'";';      my $expression='$external::datestatus="'.$status.'";';
     $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';      $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.0.solved"}.'";';
     &Apache::run::run($expression,$safeeval);      &Apache::run::run($expression,$safeeval);
       &Apache::lonxml::debug("Got $status");
     if (( $status eq 'CLOSED' ) ||      if (( $status eq 'CLOSED' ) ||
         ( $status eq 'UNCHECKEDOUT') ||          ( $status eq 'UNCHECKEDOUT') ||
         ( $status eq 'BANNED')) {          ( $status eq 'BANNED')) {
       my $bodytext=&Apache::lonxml::get_all_text("/problem",$$parser[$#$parser]);        my $bodytext=&Apache::lonxml::get_all_text("/problem",$parser);
       if ( $target eq "web" ) {        if ( $target eq "web" ) {
  $result.= $head_tag_start.'</head>';   $result.= $head_tag_start.'</head>';
         my $msg=$body_tag_start.          my $msg=$body_tag_start.
Line 491  sub start_block { Line 502  sub start_block {
  if ($code) {   if ($code) {
     $code =~ s/\"//g;      $code =~ s/\"//g;
     $code .=';return $condition;';      $code .=';return $condition;';
       if (!$Apache::lonxml::default_homework_loaded) {
    &Apache::lonxml::default_homework_load($safeeval);
       }
     $result = &Apache::run::run($code,$safeeval);      $result = &Apache::run::run($code,$safeeval);
     &Apache::lonxml::debug("block :$code: returned :$result:");      &Apache::lonxml::debug("block :$code: returned :$result:");
  } else {   } else {
Line 526  sub start_while { Line 540  sub start_while {
   $code .=';return $condition;';    $code .=';return $condition;';
   
   push( @Apache::structuretags::whileconds, $code);     push( @Apache::structuretags::whileconds, $code); 
     if (!$Apache::lonxml::default_homework_loaded) {
         &Apache::lonxml::default_homework_load($safeeval);
     }
   my $result = &Apache::run::run($code,$safeeval);    my $result = &Apache::run::run($code,$safeeval);
   my $bodytext=$$parser[$#$parser]->get_text("/while");    my $bodytext=$$parser[$#$parser]->get_text("/while");
   push( @Apache::structuretags::whilebody, $bodytext);    push( @Apache::structuretags::whilebody, $bodytext);
Line 655  sub start_part { Line 672  sub start_part {
  }   }
       }        }
     }      }
     } elsif ($target eq 'edit') {
         $result.=&Apache::edit::tag_start($target,$token);
         $result.=&Apache::edit::text_arg('Part ID:','id',$token).
     &Apache::loncommon::help_open_topic("Part_Tag_Edit_Help").
         &Apache::edit::end_row().&Apache::edit::start_spanning_row();
   
     } elsif ($target eq 'modified') {
         my $constructtag=&Apache::edit::get_new_args($token,$parstack,$safeeval,
      'id');
         if ($constructtag) {
     $result = &Apache::edit::rebuild_tag($token);
     $result.=&Apache::edit::handle_insert();
         }
   }    }
   return $result;    return $result;
 }  }
Line 680  sub start_preduedate { Line 710  sub start_preduedate {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {    if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {
     if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&      if ($Apache::inputtags::status['-1'] ne 'CAN_ANSWER' &&
  $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' ) {   $Apache::inputtags::status['-1'] ne 'CANNOT_ANSWER' && 
           $Apache::inputtags::status['-1'] ne 'SHOW_ANSWER') {
       &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]);        &Apache::lonxml::get_all_text("/preduedate",$$parser[$#$parser]);
     }      }
   }    }

Removed from v.1.131  
changed lines
  Added in v.1.137


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