Diff for /loncom/homework/structuretags.pm between versions 1.146 and 1.149

version 1.146, 2003/02/07 22:03:21 version 1.149, 2003/02/25 21:49:45
Line 35  package Apache::structuretags; Line 35  package Apache::structuretags;
 use strict;  use strict;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::File();  use Apache::File();
   use Apache::lonmenu;
   
 BEGIN {  BEGIN {
   &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));    &Apache::lonxml::register('Apache::structuretags',('block','while','randomlist','problem','library','web','tex','part','preduedate','postanswerdate','solved','notsolved','startouttext','endouttext'));
Line 81  sub page_start { Line 82  sub page_start {
   if (!defined($found{'html'})) {    if (!defined($found{'html'})) {
     $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,      $result=&Apache::londefdef::start_html($target,$token,$tagstack,$parstack,
    $parser,$safeeval);     $parser,$safeeval);
     $head_tag_start='<head>'.&Apache::lonxml::registerurl(undef,$target);      $head_tag_start='<head>'.&Apache::lonmenu::registerurl(undef,$target);
   }    }
   my $body_tag_start;    my $body_tag_start;
   if (!defined($found{'body'})) {    if (!defined($found{'body'})) {
     $body_tag_start='<body onLoad="'.&Apache::lonxml::loadevents().'" '.      $body_tag_start='<body onLoad="'.&Apache::lonmenu::loadevents().'" '.
       'onUnload="'.&Apache::lonxml::unloadevents().'" ';        'onUnload="'.&Apache::lonmenu::unloadevents().'" ';
     my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval);      my $background=&Apache::lonxml::get_param('background',$parstack,$safeeval);
     if ($background) {      if ($background) {
       $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=        $Apache::lonxml::extlinks[$#Apache::lonxml::extlinks+1]=
Line 100  sub page_start { Line 101  sub page_start {
  $body_tag_start.='bgcolor="#ffffff"';   $body_tag_start.='bgcolor="#ffffff"';
       }        }
     }      }
     $body_tag_start.='>';      $body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target);
     if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {      if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {
  my ($symb)=&Apache::lonxml::whichuser();   my ($symb)=&Apache::lonxml::whichuser();
  if ($symb eq '') {   if ($symb eq '') {
Line 665  sub start_part { Line 666  sub start_part {
   $Apache::inputtags::part=$id;    $Apache::inputtags::part=$id;
   @Apache::inputtags::responselist = ();    @Apache::inputtags::responselist = ();
   @Apache::inputtags::previous=();    @Apache::inputtags::previous=();
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
   
   if ($target eq 'meta') {    if ($target eq 'meta') {
     return &Apache::response::mandatory_part_meta;      return &Apache::response::mandatory_part_meta;
   } elsif ($target eq 'web' || $target eq 'grade' || $target eq 'answer' || $target eq 'tex') {    } elsif ($target eq 'web' || $target eq 'grade' ||
     my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);     $target eq 'answer' || $target eq 'tex') {
     push (@Apache::inputtags::status,$status);        if ($hidden) {
     my $expression='$external::datestatus="'.$status.'";';    my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
     $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';        } else {
     &Apache::run::run($expression,$safeeval);    my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
     if ( $status eq 'CLOSED' ) {    push (@Apache::inputtags::status,$status);
       my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);    my $expression='$external::datestatus="'.$status.'";';
       if ( $target eq "web" ) {    $expression.='$external::gradestatus="'.$Apache::lonhomework::history{"resource.$id.solved"}.'";';
  $result="<br />Part is not open to be viewed. It $accessmsg<br />";    &Apache::run::run($expression,$safeeval);
       } elsif ( $target eq 'tex' ) {    if ( $status eq 'CLOSED' ) {
  $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}";        my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
       }        if ( $target eq "web" ) {
     } else {    $result="<br />Part is not open to be viewed. It $accessmsg<br />";
       if ($target eq 'tex') {        } elsif ( $target eq 'tex' ) {
  if ($$tagstack[-2] ne 'problem') {    $result="\\end{minipage}\\vskip 0 mm Part is not open to be viewed. It $accessmsg \\\\\\begin{minipage}{\\textwidth}";
   $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';        }
  }    } else {
         if ($target eq 'tex') {
     if ($$tagstack[-2] ne 'problem') {
         $result.='\noindent \end{minipage}\vskip 0 mm \noindent \begin{minipage}{\textwidth}\noindent';
     }
         }
     }
       }        }
     }  
   } elsif ($target eq 'edit') {    } elsif ($target eq 'edit') {
       $result.=&Apache::edit::tag_start($target,$token);        $result.=&Apache::edit::tag_start($target,$token);
       $result.=&Apache::edit::text_arg('Part ID:','id',$token).        $result.=&Apache::edit::text_arg('Part ID:','id',$token).
Line 708  sub end_part { Line 716  sub end_part {
   my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;    my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
   &Apache::lonxml::debug("in end_part $target ");    &Apache::lonxml::debug("in end_part $target ");
   my $status=$Apache::inputtags::status['-1'];    my $status=$Apache::inputtags::status['-1'];
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
   my $result='';    my $result='';
   if ( $target eq 'meta' ) {    if ( $target eq 'meta' ) {
       $result='';        $result='';
   } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER') {    } elsif ( $target eq 'grade' && $status eq 'CAN_ANSWER' && !$hidden) {
     $result=&Apache::inputtags::grade;      $result=&Apache::inputtags::grade;
   } elsif ($target eq 'web' || $target eq 'tex' ) {    } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) {
     my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,      my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,
     $target);      $target);
     if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';}      if ($Apache::lonhomework::type eq 'exam') {$gradestatus='';}

Removed from v.1.146  
changed lines
  Added in v.1.149


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