Diff for /loncom/homework/lonsimpleproblemedit.pm between versions 1.33 and 1.34

version 1.33, 2012/11/08 21:55:11 version 1.34, 2012/11/09 03:28:01
Line 205  sub handler { Line 205  sub handler {
     my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.';      my $weightprefix=$env{'request.course.id'}.'.'.$symb.'.';
           
 # ---------------------------------------------------------- Anything to store?  # ---------------------------------------------------------- Anything to store?
       my $storeresult;
     if (($symb) && (defined($env{'form.questiontype'}))) {      if (($symb) && (defined($env{'form.questiontype'}))) {
         my %storecontent=();          my %storecontent=();
         undef %storecontent;          undef %storecontent;
Line 247  sub handler { Line 247  sub handler {
         &Apache::lonnet::devalidatecourseresdata(          &Apache::lonnet::devalidatecourseresdata(
                             $env{'course.'.$env{'request.course.id'}.'.num'},                              $env{'course.'.$env{'request.course.id'}.'.num'},
                             $env{'course.'.$env{'request.course.id'}.'.domain'});                              $env{'course.'.$env{'request.course.id'}.'.domain'});
           if ($reply eq 'ok') {
               if ($env{'form.forceview'}) {
                   my $dest = &get_parent_uri($symb);
                   if ($dest) {
                       $r->internal_redirect($dest);
                   }
               }
           } else {
               $storeresult = $reply;
           }
     }      }
 # ------------------------------------------------------------------- Read Data  # ------------------------------------------------------------------- Read Data
   
Line 256  sub handler { Line 265  sub handler {
      $env{'course.'.$env{'request.course.id'}.'.num'},       $env{'course.'.$env{'request.course.id'}.'.num'},
      $env{'request.course.id'}.'.'.$symb);       $env{'request.course.id'}.'.'.$symb);
   
       my $js = <<"ENDJS";
   
   <script type="text/javascript">
   // <![CDATA[
   
   function setForceView() {
       if (document.getElementById('spview')) {
           document.getElementById('spview').value = 1;
       }
       return true;
   }
   // END LON-CAPA Internal -->
   // ]]>
   </script>
   
   ENDJS
   
 # ------------------------------------------------------------ Print the screen  # ------------------------------------------------------------ Print the screen
     my $spell_header=&Apache::lonhtmlcommon::spellheader();      my $spell_header=&Apache::lonhtmlcommon::spellheader();
     $r->print(&Apache::loncommon::start_page('Simple Problem Editor',      $r->print(&Apache::loncommon::start_page('Simple Problem Editor',
      $spell_header));       $spell_header.$js));
     if ($symb) {      if ($symb) {
     my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>';      my $title='<h1>'.&Apache::lonnet::gettitle($symb).'</h1>';
         if (&get_parent_uri($symb)) {          if (&get_parent_uri($symb)) {
             $r->print($title);              $r->print($title);
               if ($storeresult) {
                   $r->print('<p class="LC_error">'.&mt('An error: [_1] occurred saving your changes',$storeresult).'</p>'); 
               }
         } else {          } else {
             $r->print($title              $r->print($title
                      .'<p class="LC_error">'                       .'<p class="LC_error">'
Line 307  sub handler { Line 336  sub handler {
         );          );
         $r->print(          $r->print(
             '<p>'              '<p>'
              .'<input type="hidden" name="forceview" value="" id="spview" />' 
            .'<input type="submit" value="'.&mt('Save and Edit').'" />'             .'<input type="submit" value="'.&mt('Save and Edit').'" />'
              .('&nbsp;' x3)
              .'<input type="submit" value="'.&mt('Save and View').'" onclick="javascript:setForceView();" />'
            .'</p>'             .'</p>'
         );          );
 # Script  # Script
Line 407  sub handler { Line 439  sub handler {
         }          }
 # Store Button  # Store Button
  $r->print(   $r->print(
   '<input type="submit" value="'.&mt('Save and Edit').'" /></form>');    '<input type="submit" value="'.&mt('Save and Edit').'" />'.
     ('&nbsp;' x3).
     '<input type="submit" value="'.&mt('Save and View').'" onclick="javascript:setForceView();" />'.
     '</form>');
     } else {      } else {
  $r->print(&mt('Could not identify problem.'));   $r->print(&mt('Could not identify problem.'));
     }      }

Removed from v.1.33  
changed lines
  Added in v.1.34


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