Diff for /loncom/homework/structuretags.pm between versions 1.167 and 1.171

version 1.167, 2003/05/03 20:35:43 version 1.171, 2003/05/13 20:38:55
Line 38  use Apache::File(); Line 38  use Apache::File();
 use Apache::lonmenu;  use Apache::lonmenu;
   
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::structuretags',('block','languageblock','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));      &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));
 }  }
   
 sub start_web {  sub start_web {
Line 272  sub start_problem { Line 272  sub start_problem {
     @Apache::structuretags::whilebody=();      @Apache::structuretags::whilebody=();
     @Apache::structuretags::whileline=();      @Apache::structuretags::whileline=();
     $Apache::lonhomework::scantronmode=0;      $Apache::lonhomework::scantronmode=0;
       $Apache::lonhomework::problemstatus=
    &Apache::lonnet::EXT('resource.0.problemstatus');
   
     if (defined($ENV{'scantron.maxquest'})) {      if (defined($ENV{'scantron.maxquest'})) {
  $Apache::lonhomework::scantronmode=1;   $Apache::lonhomework::scantronmode=1;
Line 479  sub end_problem { Line 481  sub end_problem {
    ) {     ) {
     if ($status eq 'CAN_ANSWER') {      if ($status eq 'CAN_ANSWER') {
  if ($target ne 'tex') {   if ($target ne 'tex') {
     $result.="</form></body>\n";      if ($ENV{'form.print_answer'} ne 'yes') {$result.="</form></body>\n";}
  }   }
     } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' ||      } elsif ($status eq 'SHOW_ANSWER' || $status eq 'CANNOT_ANSWER' ||
      $status eq 'UNCHECKEDOUT' ) {       $status eq 'UNCHECKEDOUT' ) {
Line 503  sub end_problem { Line 505  sub end_problem {
     &finalize_storage();      &finalize_storage();
  }   }
  if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) {   if ($target eq 'answer' && ($ENV{'request.state'} eq 'construct') ) {
     $result.='</html>'; #normally we get it from xmlend, but in CSTR      if ($ENV{'form.print_answer'} ne 'yes') {
                         # we always show answer mode too.   $result.='</html>'; #normally we get it from xmlend, but in CSTR
                       # we always show answer mode too.
       }
  }   }
     } elsif ($target eq 'meta') {      } elsif ($target eq 'meta') {
  if ($Apache::inputtags::part eq '0') {   if ($Apache::inputtags::part eq '0') {
Line 644  sub start_languageblock { Line 648  sub start_languageblock {
  $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();   $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
     } elsif ($target eq 'modified') {      } elsif ($target eq 'modified') {
  my $constructtag=&Apache::edit::get_new_args($token,$parstack,   my $constructtag=&Apache::edit::get_new_args($token,$parstack,
      $safeeval,'include')       $safeeval,'include',
                         .&Apache::edit::get_new_args($token,$parstack,       'exclude');
      $safeeval,'exclude');  
  if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }   if ($constructtag) { $result = &Apache::edit::rebuild_tag($token); }
     }      }
     return $result;      return $result;
Line 661  sub end_languageblock { Line 664  sub end_languageblock {
     return $result;      return $result;
 }  }
   
   sub start_instructorcomment {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
       my $result;
   
       if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
    $target eq 'tex' || $target eq 'analyze') {
           $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/);
    if ( ! $result ) {
       my $skip=&Apache::lonxml::get_all_text("/instructorcomment",$parser);
       &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
    }
    $result='';
       } elsif ($target eq 'edit') {
    $result .=&Apache::edit::tag_start($target,$token);
    $result .=&Apache::edit::end_row().&Apache::edit::start_spanning_row();
       }
       return $result;
   }
   
   sub end_instructorcomment {
       my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
       my $result;
       if ($target eq "edit") {
    $result.= &Apache::edit::tag_end($target,$token,'');
       }
       return $result;
   }
   
 sub start_while {  sub start_while {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   
Line 815  sub start_part { Line 847  sub start_part {
     @Apache::inputtags::responselist = ();      @Apache::inputtags::responselist = ();
     @Apache::inputtags::previous=();      @Apache::inputtags::previous=();
     @Apache::inputtags::previous_version=();      @Apache::inputtags::previous_version=();
       $Apache::lonhomework::problemstatus=
    &Apache::lonnet::EXT("resource.$id.problemstatus");
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);      my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
   
     if ($target eq 'meta') {      if ($target eq 'meta') {

Removed from v.1.167  
changed lines
  Added in v.1.171


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