Diff for /loncom/homework/structuretags.pm between versions 1.260.2.1 and 1.269

version 1.260.2.1, 2004/08/13 18:51:33 version 1.269, 2004/09/20 15:57:11
Line 36  use Apache::File(); Line 36  use Apache::File();
 use Apache::lonmenu;  use Apache::lonmenu;
 use Apache::lonlocal;  use Apache::lonlocal;
 use Apache::lonxml;  use Apache::lonxml;
   use Time::HiRes qw( gettimeofday tv_interval );
 BEGIN {  BEGIN {
     &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));      &Apache::lonxml::register('Apache::structuretags',('block','languageblock','instructorcomment','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','problemtype','startouttext','endouttext','simpleeditbutton','definetag'));
 }  }
Line 58  sub start_tex { Line 58  sub start_tex {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result='';      my $result='';
     my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser);      my $bodytext=&Apache::lonxml::get_all_text("/tex",$parser);
     &Apache::lonnet::logthis("Hrrm? $bodytext --");  
     if ($target eq 'tex') {      if ($target eq 'tex') {
  return $bodytext.' ';   return $bodytext.' ';
     }      }
     return $result;      return $result;;
 }  }
   
 sub end_tex {  sub end_tex {
Line 84  sub page_start { Line 83  sub page_start {
  $result=&Apache::londefdef::start_html($target,$token,$tagstack,   $result=&Apache::londefdef::start_html($target,$token,$tagstack,
        $parstack,$parser,$safeeval);         $parstack,$parser,$safeeval);
  $head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target).   $head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target).
     &Apache::lonhtmlcommon::htmlareaheaders();      &Apache::lonhtmlcommon::htmlareaheaders().
       &Apache::lonhtmlcommon::spellheader();
     }      }
     my $body_tag_start;      my $body_tag_start;
     if (!defined($found{'body'})) {      if (!defined($found{'body'})) {
Line 184  sub setup_rndseed { Line 184  sub setup_rndseed {
     return $rndseed;      return $rndseed;
 }  }
   
   sub remember_problem_state {
       return '
          <input type="hidden" name="problemstate" value="'.$ENV{'form.problemstate'}.'" />
          <input type="hidden" name="problemtype" value="'.$ENV{'form.problemtype'}.'" />
          <input type="hidden" name="problemstatus" value="'.$ENV{'form.problemstatus'}.'" />';
   }
   
 sub problem_edit_header {  sub problem_edit_header {
     return '<input type="hidden" name="submitted" value="edit" />      return '<input type="hidden" name="submitted" value="edit" />'.
    &Apache::structuretags::remember_problem_state().'
        <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />         <input type="hidden" name="problemmode" value="'.&mt('Edit').'" />
        <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />         <input type="submit" name="problemmode" accesskey="d" value="'.&mt('Discard Edits and View').'" />
        <input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />         <input type="submit" name="problemmode" accesskey="x" value="'.&mt('EditXML').'" />
Line 354  sub init_problem_globals { Line 362  sub init_problem_globals {
     if ($type eq 'problem') {      if ($type eq 'problem') {
  $Apache::inputtags::part='0';   $Apache::inputtags::part='0';
  @Apache::inputtags::partlist=('0');   @Apache::inputtags::partlist=('0');
    $Apache::lonhomework::problemstatus=&get_problem_status('0');
  $Apache::lonhomework::problemstatus=&get_problem_status('0')   $Apache::lonhomework::ignore_response_errors=0;
     } else {      } elsif ($type eq 'library') {
  $Apache::inputtags::part='';   $Apache::inputtags::part='';
  @Apache::inputtags::partlist=();   @Apache::inputtags::partlist=();
  $Apache::lonhomework::problemstatus='';   $Apache::lonhomework::problemstatus='';
    $Apache::lonhomework::ignore_response_errors=1;
     }      }
     @Apache::inputtags::responselist = ();      @Apache::inputtags::responselist = ();
     @Apache::inputtags::importlist = ();      @Apache::inputtags::importlist = ();
Line 395  sub set_problem_state { Line 404  sub set_problem_state {
   
 sub get_problem_status {  sub get_problem_status {
     my ($part)=@_;      my ($part)=@_;
     my $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");      my $problem_status;
     &Apache::lonxml::debug("problem status for $part is $problem_status");  
     &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});  
     if ($ENV{'request.state'} eq 'construct' &&      if ($ENV{'request.state'} eq 'construct' &&
  defined($ENV{'form.problemstatus'})) {   defined($ENV{'form.problemstatus'})) {
  $problem_status=$ENV{'form.problemstatus'};   $problem_status=$ENV{'form.problemstatus'};
       } else {
    $problem_status=&Apache::lonnet::EXT("resource.$part.problemstatus");
    &Apache::lonxml::debug("problem status for $part is $problem_status");
    &Apache::lonxml::debug("env probstat is ".$ENV{'form.problemstatus'});
     }      }
     return $problem_status;      return $problem_status;
 }  }
Line 484  sub start_problem { Line 495  sub start_problem {
     '<input type="submit" name="resetdata"      '<input type="submit" name="resetdata"
                              value="'.&mt('New Problem Variation').'" />'.                               value="'.&mt('New Problem Variation').'" />'.
     '<input type="hidden" name="username"      '<input type="hidden" name="username"
                              value="'.$ENV{'form.username'}.'" /> <br />';                               value="'.$ENV{'form.username'}.'" />';
       if ($ENV{'user.adv'}) {
    $form_tag_start.=
       ' <input type="checkbox" name="showallfoils" ';
    if (defined($ENV{'form.showallfoils'})) {
       $form_tag_start.='checked="on"';
    }
    $form_tag_start.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils');
       }
       $form_tag_start.='<hr />';
  }   }
  ($status,$accessmsg) = &Apache::lonhomework::check_access('0');   ($status,$accessmsg) = &Apache::lonhomework::check_access('0');
  push (@Apache::inputtags::status,$status);   push (@Apache::inputtags::status,$status);
Line 646  sub end_problem { Line 666  sub end_problem {
     $endminipage = '\end{minipage}';      $endminipage = '\end{minipage}';
  }   }
                 if ($ENV{'form.print_discussions'} eq 'yes') {                  if ($ENV{'form.print_discussions'} eq 'yes') {
     $result.=&Apache::lonxml::xmlend();      $result.=&Apache::lonxml::xmlend($target,$parser);
     $result=~s/<\/html>//;      $result=~s/<\/html>//;
  }  
  $result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';  
  if (not $ENV{'request.symb'} =~ m/\.page_/) {  
     $result .= $endminipage.'\end{document} ';  
  } else {   } else {
     $result .= '';      $result .= '\keephidden{ENDOFPROBLEM}\vskip 0.5mm\noindent\makebox[\textwidth/$number_of_columns][b]{\hrulefill}';
       if (not $ENV{'request.symb'} =~ m/\.page_/) {
    $result .= $endminipage.'\end{document} ';
       } else {
    $result .= '';
       }
  }   }
     }      }
  }   }
Line 861  sub start_instructorcomment { Line 882  sub start_instructorcomment {
     if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||      if ($target eq 'web' || $target eq 'grade' || $target eq 'answer' ||
  $target eq 'tex' || $target eq 'analyze') {   $target eq 'tex' || $target eq 'analyze') {
         $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/);          $result=($ENV{'request.role'}=~/^(in|cc|au|ca|li)/);
  if ( ! $result ) {   if ( (! $result) or ($ENV{'form.instructor_comments'} eq 'hide')) {
     my $skip=&Apache::lonxml::get_all_text("/instructorcomment",      my $skip=&Apache::lonxml::get_all_text("/instructorcomment",
    $parser,$style);     $parser,$style);
     &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");      &Apache::lonxml::debug("skipping ahead :$skip: $$parser[-1]");
Line 1148  sub end_part { Line 1169  sub end_part {
     $gradestatus='';      $gradestatus='';
  }   }
  $result=$gradestatus;   $result=$gradestatus;
  if ($$tagstack[-2] eq 'td') {$result.='\end{minipage}';}    if ($$tagstack[-2] eq 'td' and $target eq 'tex') {$result.='\end{minipage}';} 
     } elsif ($target eq 'edit') {      } elsif ($target eq 'edit') {
  $result=&Apache::edit::end_table();   $result=&Apache::edit::end_table();
     }      }

Removed from v.1.260.2.1  
changed lines
  Added in v.1.269


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