Diff for /loncom/homework/structuretags.pm between versions 1.465.2.13 and 1.465.2.14

version 1.465.2.13, 2011/01/13 18:41:48 version 1.465.2.14, 2011/10/06 03:23:44
Line 129  sub homework_js { Line 129  sub homework_js {
  <<'JS';   <<'JS';
 <script type="text/javascript">  <script type="text/javascript">
 // <![CDATA[  // <![CDATA[
 function setSubmittedPart (part) {  function setSubmittedPart (part,prefix) {
    this.document.lonhomework.submitted.value="part_"+part;      if (typeof(prefix) == 'undefined') {
           this.document.lonhomework.submitted.value="part_"+part;
       } else {
           for (var i=0;i<this.document.lonhomework.elements.length;i++) {
               if (this.document.lonhomework.elements[i].name == prefix+'submitted') {
                   this.document.lonhomework.elements[i].value="part_"+part;
               }
           }
       }
 }  }
   
 function image_response_click (which, e) {  function image_response_click (which, e) {
Line 468  sub remember_problem_state { Line 476  sub remember_problem_state {
        <input type="hidden" name="problemstatus" value="'.$env{'form.problemstatus'}.'" />';         <input type="hidden" name="problemstatus" value="'.$env{'form.problemstatus'}.'" />';
 }  }
   
   sub problem_edit_action_button {
       my ($name,$action,$accesskey,$text,$flag)=@_;
       my $actionscript="setmode(this.form,'$action')";
       return "\n<input type='button' name='$name' accesskey='$accesskey' value='".&mt($text)."'".
              ($flag?&Apache::edit::submit_ask_anyway($actionscript):&Apache::edit::submit_dont_ask($actionscript))." />";
   }
   
 sub problem_edit_buttons {  sub problem_edit_buttons {
    return  '      my ($mode)=@_;
 <div class="LC_edit_problem_discards">  # Buttons that do not save
        <input type="button" name="submitmode" accesskey="d" value="'.&mt('Discard Edits and View').'" '.      my $result='<div class="LC_edit_problem_discards">'.
        ' onclick="javscript:setmode(this.form,'."'discard'".')"  />                &problem_edit_action_button('subdiscview','discard','d','Discard Edits and View',1);
        <input '.&Apache::edit::submit_ask_anyway('setmode(this.form,'."'editxml'".')').' type="button" name="submitmode" accesskey="x" value="'.&mt('EditXML').'" />      if ($mode eq 'editxml') {
        <input type="submit" name="Undo" accesskey="u" value="'.&mt('undo').'" />          $result.=&problem_edit_action_button('subedit','edit','e','Edit',1);
 </div>          $result.=&problem_edit_action_button('subundo','undoxml','u','Undo',1);
 <div class="LC_edit_problem_saves">          $result.=&Apache::lonhtmlcommon::dragmath_button("LC_editxmltext",1);
        <input type="submit" name="submitbutton" accesskey="s" value="'.&mt('Save and Edit').'" />      } else {
        <input type="submit" name="submitbutton" accesskey="v" value="'.&mt('Save and View').'" />          $result.=&problem_edit_action_button('subeditxml','editxml','x','EditXML',1);
 </div>';          $result.=&problem_edit_action_button('subundo','undo','u','Undo',1);
       }
       $result.="\n</div>";
   # Buttons that save
       $result.='<div class="LC_edit_problem_saves">';
       if ($mode eq 'editxml') {
           $result.=&problem_edit_action_button('subsaveedit','saveeditxml','s','Save and EditXML');
           $result.=&problem_edit_action_button('subsaveview','saveviewxml','v','Save and View');
       } else {
           $result.=&problem_edit_action_button('subsaveedit','saveedit','s','Save and Edit');
           $result.=&problem_edit_action_button('subsaveview','saveview','v','Save and View');
       }
       $result.="\n</div>\n";
       return $result;
 }  }
   
 sub problem_edit_header {  sub problem_edit_header {
     return '<input type="hidden" name="submitted" value="edit" /><input type="hidden" name="problemmode" value="edit" />'.      return '<input type="hidden" name="submitted" value="edit" />'.
  &Apache::structuretags::remember_problem_state().'   &remember_problem_state('edit').'
 <div class="LC_edit_problem_header">  <div class="LC_edit_problem_header">
 <div class="LC_edit_problem_header_title">  <div class="LC_edit_problem_header_title">
 '.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').'  '.&mt('Problem Editing').&Apache::loncommon::help_open_menu('Problem Editing','Problem_Editor_XML_Index',5,'Authoring').'
 </div>'.  </div>'.
   '<input type="hidden" name="problemmode" value="saveedit" />'.
 &problem_edit_buttons().'  &problem_edit_buttons().'
 <hr style="clear:both;" />  <hr style="clear:both;" />
 '.&Apache::lonxml::message_location().'  '.&Apache::lonxml::message_location().'
Line 1276  sub end_problem { Line 1305  sub end_problem {
  } else {   } else {
     $frontmatter.= $begin_doc.$toc_line;      $frontmatter.= $begin_doc.$toc_line;
     if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) {       if ($Apache::lonhomework::type eq 'exam' and $allow_print_points==1) { 
  $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';   $frontmatter .= '\fbox{\textit{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
     }      }
  }   }
     } else {      } else {
Line 1286  sub end_problem { Line 1315  sub end_problem {
     if (not $env{'request.symb'} =~ m/\.page_/) {      if (not $env{'request.symb'} =~ m/\.page_/) {
  $frontmatter .= $begin_doc.$toc_line;   $frontmatter .= $begin_doc.$toc_line;
  if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) {    if (($Apache::lonhomework::type eq 'exam') and ($allow_print_points==1)) { 
     $frontmatter .= '\fbox{\textit{'.$weight.' pt}}';      $frontmatter .= '\fbox{\textit{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
  }   }
     } else {      } else {
  $frontmatter .= '\vskip 1mm \\\\\\\\'.$startminipage;   $frontmatter .= '\vskip 1mm \\\\\\\\'.$startminipage;
Line 1310  sub end_problem { Line 1339  sub end_problem {
     }      }
  } elsif ( ($target eq 'web' || $target eq 'tex') &&   } elsif ( ($target eq 'web' || $target eq 'tex') &&
   $Apache::inputtags::part eq '0' &&    $Apache::inputtags::part eq '0' &&
   $status ne 'UNCHECKEDOUT' && $status ne 'NOT_YET_VIEWED') {    $status ne 'UNCHECKEDOUT' && $status ne 'NOT_YET_VIEWED') { 
     # if part is zero, no <part>s existed, so we need show the current      # if part is zero, no <part>s existed, so we need show the current
     # grading status      # grading status
     my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);      my $gradestatus = &Apache::inputtags::gradestatus($Apache::inputtags::part,$target);
Line 1320  sub end_problem { Line 1349  sub end_problem {
     (($target eq 'web') && ($env{'request.state'} ne 'construct')) ||      (($target eq 'web') && ($env{'request.state'} ne 'construct')) ||
     ($target eq 'answer') || ($target eq 'tex')      ($target eq 'answer') || ($target eq 'tex')
    ) {     ) {
     if ($target ne 'tex' &&      if (($target ne 'tex') &&
  $env{'form.answer_output_mode'} ne 'tex') {   ($env{'form.answer_output_mode'} ne 'tex')) {
  $result.="</form>";   $result.="</form>";
     }      }
     if ($target eq 'web') {      if ($target eq 'web') {
Line 1970  sub start_part { Line 1999  sub start_part {
  $allow_print_points=0;   $allow_print_points=0;
     }      }
     if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) {       if (($Apache::lonhomework::type eq 'exam') && ($allow_print_points)) { 
  $result .= '\vskip 10mm\fbox{\textit{'.$weight.' pt}}';   $result .= '\vskip 10mm\fbox{\textit{'.&mt('[quant,_1,pt,pt]',$weight ).'}}';
   
     }      }
  } elsif ($target eq 'web') {   } elsif ($target eq 'web') {
Line 2280  sub start_simpleeditbutton { Line 2309  sub start_simpleeditbutton {
 #              .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.')  #              .&mt('Note: it can take up to 10 minutes for changes to take effect for all users.')
 #              .&Apache::loncommon::help_open_topic('Caching')  #              .&Apache::loncommon::help_open_topic('Caching')
 #              .'</p>';  #              .'</p>';
         $result.=&Apache::lonhtmlcommon::start_funclist()          $result.=&Apache::loncommon::head_subbox(
                    &Apache::lonhtmlcommon::start_funclist()
                 .&Apache::lonhtmlcommon::add_item_funclist(                  .&Apache::lonhtmlcommon::add_item_funclist(
                      '<a href="'.$url.'/smpedit?symb='.&escape($symb).'">'                       '<a href="'.$url.'/smpedit?symb='.&escape($symb).'">'
                     .&mt('Edit').'</a>')                      .&mt('Edit').'</a>')
                 .&Apache::lonhtmlcommon::end_funclist();                  .&Apache::lonhtmlcommon::end_funclist());
   
     }      }
     return $result;      return $result;

Removed from v.1.465.2.13  
changed lines
  Added in v.1.465.2.14


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