Diff for /loncom/interface/lonparmset.pm between versions 1.101 and 1.106

version 1.101, 2003/06/16 20:24:13 version 1.106, 2003/06/20 14:56:09
Line 728  sub assessparms { Line 728  sub assessparms {
  "<font color=red>Unknown user '$uname' at domain '$udom'</font>";   "<font color=red>Unknown user '$uname' at domain '$udom'</font>";
     $uname='';      $uname='';
         } else {          } else {
     $csec=&Apache::lonnet::usection($udom,$uname,      $csec=&Apache::lonnet::getsection($udom,$uname,
     $ENV{'request.course.id'});        $ENV{'request.course.id'});
     if ($csec eq '-1') {      if ($csec eq '-1') {
  $message="<font color=red>".   $message="<font color=red>".
     "User '$uname' at domain '$udom' not ".      "User '$uname' at domain '$udom' not ".
Line 1074  ENDTABLETWO Line 1074  ENDTABLETWO
            }             }
            $r->print(<<ENDTABLEHEADFOUR);             $r->print(<<ENDTABLEHEADFOUR);
 </tr><tr><th>Assessment URL and Title</th><th>Type</th>  </tr><tr><th>Assessment URL and Title</th><th>Type</th>
 <th>Enclosing Map or Folder</th><th>Part No.</th><th>Parameter Name</th>  <th>Enclosing Map or Folder</th><th>Part</th><th>Parameter Name</th>
 <th>default</th><th>from Enclosing Map or Folder</th>  <th>default</th><th>from Enclosing Map or Folder</th>
 <th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th>  <th>general</th><th>for Enclosing Map or Folder</th><th>for Resource</th>
 ENDTABLEHEADFOUR  ENDTABLEHEADFOUR
Line 1371  ENDMAPONE Line 1371  ENDMAPONE
   
 =item crsenv  =item crsenv
   
 Show course data and parameters.  This is a large routine that should  Show and set course data and parameters.  This is a large routine that should
 be simplified and shortened... someday.  be simplified and shortened... someday.
   
 Inputs: $r  Inputs: $r
Line 1389  sub crsenv { Line 1389  sub crsenv {
                              'Set Course Environment Parameters');                               'Set Course Environment Parameters');
     my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};      my $dom = $ENV{'course.'.$ENV{'request.course.id'}.'.domain'};
     my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};      my $crs = $ENV{'course.'.$ENV{'request.course.id'}.'.num'};
 # -------------------------------------------------- Go through list of changes  
       #
       # Go through list of changes
     foreach (keys %ENV) {      foreach (keys %ENV) {
  if ($_=~/^form\.(.+)\_setparmval$/) {          next if ($_!~/^form\.(.+)\_setparmval$/);
             my $name=$1;          my $name  = $1;
             my $value=$ENV{'form.'.$name.'_value'};          my $value = $ENV{'form.'.$name.'_value'};
             if ($name eq 'newp') {          if ($name eq 'newp') {
                 $name=$ENV{'form.newp_name'};              $name = $ENV{'form.newp_name'};
             }          }
             if ($name eq 'url') {          if ($name eq 'url') {
  $value=~s/^\/res\///;              $value=~s/^\/res\///;
                 my $bkuptime=time;              my $bkuptime=time;
                 my @tmp = &Apache::lonnet::get              my @tmp = &Apache::lonnet::get
                     ('environment',['url'],$dom,$crs);                  ('environment',['url'],$dom,$crs);
                 $setoutput.='Backing up previous URL: '.              $setoutput.='Backing up previous URL: '.
                     &Apache::lonnet::put                  &Apache::lonnet::put
                         ('environment',                  ('environment',
                          {'top level map backup '.$bkuptime => $tmp[1] },                   {'top level map backup '.$bkuptime => $tmp[1] },
                          $dom,$crs).                   $dom,$crs).
                     '<br>';                       '<br>';
           }
           #
           # Deal with modified default spreadsheets
           if ($name =~ /^spreadsheet_default_(classcalc|
                                               studentcalc|
                                               assesscalc)$/x) {
               my $sheettype = $1; 
               if ($sheettype eq 'classcalc') {
                   # no need to do anything since viewing the sheet will
                   # cause it to be updated. 
               } elsif ($sheettype eq 'studentcalc') {
                   # expire all the student spreadsheets
                   &Apache::lonnet::expirespread('','','studentcalc');
               } else {
                   # expire all the assessment spreadsheets 
                   #    this includes non-default spreadsheets, but better to
                   #    be safe than sorry.
                   &Apache::lonnet::expirespread('','','assesscalc');
                   # expire all the student spreadsheets
                   &Apache::lonnet::expirespread('','','studentcalc');
             }              }
             if ($name =~ /^spreadsheet_default_(classcalc|          }
                                                 studentcalc|          #
                                                 assesscalc)$/x) {          # Let the user know we made the changes
                 my $sheettype = $1;           if ($name) {
                 if ($sheettype eq 'classcalc') {              my $put_result = &Apache::lonnet::put('environment',
                     # no need to do anything since viewing the sheet will                                                    {$name=>$value},$dom,$crs);
                     # cause it to be updated.               if ($put_result eq 'ok') {
                 } elsif ($sheettype eq 'studentcalc') {                  $setoutput.='Set <b>'.$name.'</b> to <b>'.$value.'</b>.<br />';
                     # expire all the student spreadsheets              } else {
                     &Apache::lonnet::expirespread('','','studentcalc');                  $setoutput.='Unable to set <b>'.$name.'</b> to '.
                 } else {                      '<b>'.$value.'</b> due to '.$put_result.'.<br />';
                     # expire all the default assessment spreadsheets  
                 }  
             }              }
   
             if ($name) {  
                 $setoutput.='Setting <tt>'.$name.'</tt> to <tt>'.  
                     $value.'</tt>: '.  
                     &Apache::lonnet::put  
                             ('environment',{$name=>$value},$dom,$crs).  
                     '<br>';  
     }  
         }          }
     }      }
   
 # -------------------------------------------------------- Get parameters again  # -------------------------------------------------------- Get parameters again
   
     my %values=&Apache::lonnet::dump('environment',$dom,$crs);      my %values=&Apache::lonnet::dump('environment',$dom,$crs);
Line 1496  sub crsenv { Line 1509  sub crsenv {
                     '<font color="red">Modifying this will make problems '.                      '<font color="red">Modifying this will make problems '.
                     'have different numbers and answers</font>',                      'have different numbers and answers</font>',
              'problem_stream_switch'               'problem_stream_switch'
                  => '<b>Allow problems to be splitted over pages</b><br />'.                   => '<b>Allow problems to be split over pages</b><br />'.
                     ' (<tt><b>yes</b> if allow anything else if not</tt>)'                      ' (<tt><b>yes</b> if allow anything else if not</tt>)'
              );               );
  foreach (keys(%values)) {   foreach (keys(%values)) {
Line 1593  sub handler { Line 1606  sub handler {
     }      }
     &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});      &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'});
   
     $r->content_type('text/html');  
     $r->send_http_header;  
 # ----------------------------------------------------- Needs to be in a course  # ----------------------------------------------------- Needs to be in a course
   
     if (($ENV{'request.course.id'}) &&       if (($ENV{'request.course.id'}) && 
  (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {   (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'}))) {
   
           $r->content_type('text/html');
           $r->send_http_header;
     
         $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};          $coursename=$ENV{'course.'.$ENV{'request.course.id'}.'.description'};
   

Removed from v.1.101  
changed lines
  Added in v.1.106


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