Diff for /loncom/homework/structuretags.pm between versions 1.273 and 1.283

version 1.273, 2004/11/30 23:28:57 version 1.283, 2005/04/01 18:08:14
Line 91  sub page_start { Line 91  sub page_start {
     if (!defined($found{'body'}) && $ENV{'request.state'} eq 'construct'      if (!defined($found{'body'}) && $ENV{'request.state'} eq 'construct'
  && $ENV{'environment.remote'} eq 'off') {   && $ENV{'environment.remote'} eq 'off') {
  $body_tag_start=&Apache::loncommon::bodytag();   $body_tag_start=&Apache::loncommon::bodytag();
    $body_tag_start.=&Apache::lonxml::message_location();
     } elsif (!defined($found{'body'})) {      } elsif (!defined($found{'body'})) {
  $body_tag_start='<body onload="'.&Apache::lonmenu::loadevents().'" '.   $body_tag_start='<body onload="'.&Apache::lonmenu::loadevents().'" '.
     'onunload="'.&Apache::lonmenu::unloadevents().'" ';      'onunload="'.&Apache::lonmenu::unloadevents().'" ';
Line 114  sub page_start { Line 115  sub page_start {
     $body_tag_start.=' style="font-size: x-large;" ';      $body_tag_start.=' style="font-size: x-large;" ';
  }   }
  $body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);   $body_tag_start.='>'.&Apache::lonmenu::menubuttons(undef,$target,1);
    if ($ENV{'environment.texengine'} eq 'jsMath') {
       $body_tag_start.='<script type="text/javascript">
                        function NoFontMessage () {}
                      </script>'."\n".
          '<script src="/adm/jsMath/jsMath.js"></script>'."\n";
    }
  if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {   if ($target eq 'web' && $ENV{'request.state'} ne 'construct') {
     my ($symb,undef,undef,undef,$publicuser)=      my ($symb,undef,undef,undef,$publicuser)=
  &Apache::lonxml::whichuser();   &Apache::lonxml::whichuser();
Line 127  sub page_start { Line 134  sub page_start {
     }      }
     my $form_tag_start;      my $form_tag_start;
     if (!defined($found{'form'})) {      if (!defined($found{'form'})) {
  $form_tag_start='<form name="lonhomework" method="post" action="';   $form_tag_start='<form name="lonhomework" enctype="multipart/form-data" method="POST" action="';
  my $uri=$ENV{'request.uri'};   my $uri=$ENV{'request.uri'};
  if ($ENV{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }   if ($ENV{'request.enc'}) { $uri=&Apache::lonenc::encrypted($uri); }
  $form_tag_start.=$uri.'">';   $form_tag_start.=$uri.'">';
Line 141  sub get_resource_name { Line 148  sub get_resource_name {
     if (defined($Apache::lonhomework::name)) {      if (defined($Apache::lonhomework::name)) {
  return $Apache::lonhomework::name;   return $Apache::lonhomework::name;
     }      }
     my $name=&Apache::lonnet::gettitle();      my ($symb)=&Apache::lonxml::whichuser();
       my $name=&Apache::lonnet::gettitle($symb);
     if ($name eq '') {      if ($name eq '') {
  $name=&Apache::lonnet::EXT('resource.title');   $name=&Apache::lonnet::EXT('resource.title');
  if ($name eq 'con_lost') { $name = ''; }   if ($name eq 'con_lost') { $name = ''; }
Line 208  sub problem_edit_header { Line 216  sub problem_edit_header {
        <input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'.         <input type="submit" name="submit" accesskey="v" value="'.&mt('Submit Changes and View').'" /><table><tr><td>'.
        &Apache::loncommon::help_open_menu('','Problem Editing Help','Problem_Editor_XML_Index','',5,'Authoring',undef,undef,undef,'Problem Editing Help')         &Apache::loncommon::help_open_menu('','Problem Editing Help','Problem_Editor_XML_Index','',5,'Authoring',undef,undef,undef,'Problem Editing Help')
        .'</td></tr></table>'.         .'</td></tr></table>'.
        '<table border="0"><tr><td bgcolor="#DDDDDD">';         '<table border="0" width="100%"><tr><td bgcolor="#DDDDDD">';
 }  }
   
 sub problem_edit_footer {  sub problem_edit_footer {
     return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />      return '</td></tr></table><br /><input type="submit" name="submit" value="'.&mt('Submit Changes and Edit').'" />
     <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'.      <input type="submit" name="submit" value="'.&mt('Submit Changes and View').'" />'.
     &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields).      &Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields).
     "\n</form>\n</body>\n</html>";      "\n</form>\n".&Apache::loncommon::endbodytag()."\n</html>";
 }  }
   
 sub option {  sub option {
Line 239  sub problem_web_to_edit_header { Line 247  sub problem_web_to_edit_header {
               <input type="text" name="rndseed" size="10" value="'.                <input type="text" name="rndseed" size="10" value="'.
        $rndseed.'"         $rndseed.'"
            onchange="javascript:document.lonhomework.changerandseed.click()" /></nobr>             onchange="javascript:document.lonhomework.changerandseed.click()" /></nobr>
              <input type="checkbox" name="showallfoils" ';               <label><input type="checkbox" name="showallfoils" ';
     if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }      if (defined($ENV{'form.showallfoils'})) { $result.='checked="on"'; }
     $result.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils').      $result.= ' />'.&mt('&nbsp;Show&nbsp;All&nbsp;Foils').
  &Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').   &Apache::loncommon::help_open_topic('Problem_Editor_Testing_Area','Testing Problems').
  '<hr />';   '</label><hr />';
     $result.="      $result.="
 <nobr>  <nobr>
 Problem Status:  Problem Status:
Line 341  sub checkout_msg { Line 349  sub checkout_msg {
 <font color="red">  <font color="red">
 <p>$lt{'warning'}</p>  <p>$lt{'warning'}</p>
 </font>  </font>
 <form name="checkout" method="post" action="$ENV{'request.uri'}">  <form name="checkout" method="POST" action="$ENV{'request.uri'}">
 <input type="hidden" name="doescheckout" value="yes" />  <input type="hidden" name="doescheckout" value="yes" />
 <input type="button" name="checkoutbutton" value="$lt{'checkout'}" onClick="javascript:if (confirm('$lt{'checkout?'}')) { document.checkout.submit(); }" />  <input type="button" name="checkoutbutton" value="$lt{'checkout'}" onClick="javascript:if (confirm('$lt{'checkout?'}')) { document.checkout.submit(); }" />
 </form>  </form>
Line 355  sub firstaccess_msg { Line 363  sub firstaccess_msg {
     &Apache::lonxml::debug("map is $map title is $foldertitle");      &Apache::lonxml::debug("map is $map title is $foldertitle");
     return (<<ENDCHECKOUT);      return (<<ENDCHECKOUT);
 <h2>The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle".</h2>  <h2>The resources in "$foldertitle" are open for a limited time. Once you click the 'Show Resource' button below you have $time to complete all resources "$foldertitle".</h2>
 <form name="markaccess" method="post" action="$ENV{'request.uri'}">  <form name="markaccess" method="POST" action="$ENV{'request.uri'}">
 <input type="hidden" name="markaccess" value="yes" />  <input type="hidden" name="markaccess" value="yes" />
 <input type="button" name="accessbutton" value="Show Resource" onClick="javascript:if (confirm('Start Timer?')) { document.markaccess.submit(); }" />  <input type="button" name="accessbutton" value="Show Resource" onClick="javascript:if (confirm('Start Timer?')) { document.markaccess.submit(); }" />
 </form>  </form>
Line 580  sub start_problem { Line 588  sub start_problem {
     $allow_print_points=1;      $allow_print_points=1;
  }   }
     }      }
       my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
       if (defined($maxtries) && $maxtries < 0) { $allow_print_points=0; }
     my $duedate = &Apache::lonnet::EXT("resource.$id.duedate");       my $duedate = &Apache::lonnet::EXT("resource.$id.duedate"); 
     $duedate = POSIX::strftime("%c",localtime($duedate));      $duedate = POSIX::strftime("%c",localtime($duedate));
     my $temp_file;      my $temp_file;
Line 662  sub end_problem { Line 672  sub end_problem {
  $ENV{'form.answer_output_mode'} ne 'tex') {   $ENV{'form.answer_output_mode'} ne 'tex') {
  $result.="</form>";   $result.="</form>";
  $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields);   $result.=&Apache::lonhtmlcommon::htmlareaselectactive(@Apache::lonxml::htmlareafields);
  $result.="</body>\n";  
     }      }
     if ($target eq 'web') {      if ($target eq 'web') {
  $result.=&Apache::lonxml::xmlend();   $result.=&Apache::lonxml::xmlend().'</html>';
     } elsif ($target eq 'tex') {      } elsif ($target eq 'tex') {
  my $endminipage = '';   my $endminipage = '';
  if (not $ENV{'form.problem_split'}=~/yes/) {   if (not $ENV{'form.problem_split'}=~/yes/) {
Line 753  sub end_library { Line 762  sub end_library {
  $result=&problem_edit_footer();   $result=&problem_edit_footer();
     } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&      } elsif ($target eq 'web' && $$tagstack[0] ne 'problem' &&
      $ENV{'request.state'} eq "construct") {       $ENV{'request.state'} eq "construct") {
  $result.='</form></body>'.&Apache::lonxml::xmlend();   $result.='</form>'.&Apache::loncommon::endbodytag().
       &Apache::lonxml::xmlend();
     }      }
     if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };      if ($$tagstack[0] eq 'library') { &reset_problem_globals('library') };
     return $result;      return $result;
Line 1056  sub end_randomlist { Line 1066  sub end_randomlist {
     return $result;      return $result;
 }  }
   
   sub ordered_show_check {
       my $last_part=$Apache::inputtags::partlist[-2];
       my $in_order=
    &Apache::lonnet::EXT('resource.'.$Apache::inputtags::part.'.ordered');
       my $in_order_show=1;
       if ($last_part ne '0' && lc($in_order) eq 'yes') {
    $in_order_show=&Apache::response::check_status($last_part);
       }
       return $in_order_show;
   }
   
 sub start_part {  sub start_part {
     my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;      my ($target,$token,$tagstack,$parstack,$parser,$safeeval)=@_;
     my $result='';      my $result='';
Line 1070  sub start_part { Line 1091  sub start_part {
     my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);      my $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
     my $newtype=&Apache::lonnet::EXT("resource.$id.type");      my $newtype=&Apache::lonnet::EXT("resource.$id.type");
     if ($newtype) { $Apache::lonhomework::type=$newtype; }      if ($newtype) { $Apache::lonhomework::type=$newtype; }
       my $in_order_show=&ordered_show_check();
     my $expression='$external::part=\''.$Apache::inputtags::part.'\';';      my $expression='$external::part=\''.$Apache::inputtags::part.'\';';
     $expression.='$external::type=\''.$Apache::lonhomework::type.'\';';      $expression.='$external::type=\''.$Apache::lonhomework::type.'\';';
     &Apache::run::run($expression,$safeeval);      &Apache::run::run($expression,$safeeval);
Line 1081  sub start_part { Line 1102  sub start_part {
        &Apache::response::meta_parameter_write('display','string',$display,'Part Description');         &Apache::response::meta_parameter_write('display','string',$display,'Part Description');
     } elsif ($target eq 'web' || $target eq 'grade' ||      } elsif ($target eq 'web' || $target eq 'grade' ||
      $target eq 'answer' || $target eq 'tex') {       $target eq 'answer' || $target eq 'tex') {
  if ($hidden) {   if ($hidden || !$in_order_show) {
     my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);      my $bodytext=&Apache::lonxml::get_all_text("/part",$parser);
  } else {   } else {
     my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);      my ($status,$accessmsg) = &Apache::lonhomework::check_access($id);
Line 1126  sub start_part { Line 1147  sub start_part {
     if ($1 ne '0') {$allow_print_points=1;}      if ($1 ne '0') {$allow_print_points=1;}
  }   }
     }      }
       my $maxtries = &Apache::lonnet::EXT("resource.$id.maxtries");
       if (defined($maxtries) && $maxtries < 0) {
    $allow_print_points=0;
       }
     if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}      if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { $result .= '\fbox{\textit{'.$weight.' pt}}';}
  } elsif ($target eq 'web') {   } elsif ($target eq 'web') {
     $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';      $result.='<a name="'.&Apache::lonnet::escape($Apache::inputtags::part).'" />';
Line 1157  sub end_part { Line 1182  sub end_part {
     &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 $hidden=&Apache::loncommon::check_if_partid_hidden($Apache::inputtags::part);
       my $in_order_show=&ordered_show_check();
     my $result='';      my $result='';
     if ( $target eq 'meta' ) {      if ( $target eq 'meta' ) {
  $result='';   $result='';
     } elsif ($target eq 'grade') {      } elsif ($target eq 'grade') {
  if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&   if (($status eq 'CAN_ANSWER' || $Apache::lonhomework::scantronmode) &&
     !$hidden) {      !$hidden && $in_order_show) {
     $result=&Apache::inputtags::grade;      $result=&Apache::inputtags::grade;
  } else {   } else {
     # move any submission data to .hidden      # move any submission data to .hidden
     &Apache::inputtags::hidealldata($Apache::inputtags::part);      &Apache::inputtags::hidealldata($Apache::inputtags::part);
  }   }
     } elsif (($target eq 'web' || $target eq 'tex') && !$hidden ) {      } elsif (($target eq 'web' || $target eq 'tex') &&
        !$hidden && $in_order_show) {
  my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,   my $gradestatus=&Apache::inputtags::gradestatus($Apache::inputtags::part,
  $target);   $target);
  if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {   if ($Apache::lonhomework::type eq 'exam' && $target eq 'tex') {
Line 1368  sub start_simpleeditbutton { Line 1395  sub start_simpleeditbutton {
         (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {          (&Apache::lonnet::allowed('srm',$ENV{'request.course.id'}))) {
         my $url=$ENV{'request.noversionuri'};          my $url=$ENV{'request.noversionuri'};
         $url=~s/\?.*$//;          $url=~s/\?.*$//;
    my ($symb) = &Apache::lonxml::whichuser();
  $result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'.   $result='<table width="100%" bgcolor="#FFFFAA" border="2"><tr><td>'.
                 '<a href="'.$url.'/smpedit">'.&mt('Edit').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').                  '<a href="'.$url.'/smpedit?symb='.&Apache::lonnet::escape($symb).'">'.&mt('Edit').'</a> - '.&mt('Note: it can take up to 10 minutes for changes to take effect for all users.').
 &Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />';  &Apache::loncommon::help_open_topic('Caching').'</td></tr></table><br />';
     }      }
     return $result;      return $result;

Removed from v.1.273  
changed lines
  Added in v.1.283


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