Diff for /loncom/interface/lonparmset.pm between versions 1.61.2.1 and 1.72

version 1.61.2.1, 2002/08/29 03:57:45 version 1.72, 2002/10/03 22:31:58
Line 87  my $coursename; Line 87  my $coursename;
   
 Figure out a cascading parameter.  Figure out a cascading parameter.
   
 Inputs:  $what $id $def  Inputs:  $what - a parameter spec (incluse part info and name I.E. 0.weight)
            $id   - a bighash Id number
 Returns: I am not entirely sure.           $def  - the resource's default value   'stupid emacs
   
   Returns:  A list, the first item is the index into the remaining list of items of parm valuse that is the active one, the list consists of parm values at the 11 possible levels
   
   11- resource default
   10- map default
   9 - General Course
   8 - Map level in course
   7 - resource level in course
   6 - General for section
   5 - Map level for section
   4 - resource level in section
   3 - General for specific student
   2 - Map level for specific student
   1 - resource level for specific student
   
 =cut  =cut
   
Line 123  sub parmval { Line 137  sub parmval {
   
 # --------------------------------------------------------- third, check course  # --------------------------------------------------------- third, check course
   
     if ($courseopt{$courselevel}) {      if (defined($courseopt{$courselevel})) {
  $outpar[9]=$courseopt{$courselevel};   $outpar[9]=$courseopt{$courselevel};
  $result=9;   $result=9;
     }      }
   
     if ($courseopt{$courselevelm}) {      if (defined($courseopt{$courselevelm})) {
  $outpar[8]=$courseopt{$courselevelm};   $outpar[8]=$courseopt{$courselevelm};
  $result=8;   $result=8;
     }      }
   
     if ($courseopt{$courselevelr}) {      if (defined($courseopt{$courselevelr})) {
  $outpar[7]=$courseopt{$courselevelr};   $outpar[7]=$courseopt{$courselevelr};
  $result=7;   $result=7;
     }      }
   
     if ($csec) {      if (defined($csec)) {
         if ($courseopt{$seclevel}) {          if (defined($courseopt{$seclevel})) {
     $outpar[6]=$courseopt{$seclevel};      $outpar[6]=$courseopt{$seclevel};
     $result=6;      $result=6;
  }   }
         if ($courseopt{$seclevelm}) {          if (defined($courseopt{$seclevelm})) {
     $outpar[5]=$courseopt{$seclevelm};      $outpar[5]=$courseopt{$seclevelm};
     $result=5;      $result=5;
  }   }
   
         if ($courseopt{$seclevelr}) {          if (defined($courseopt{$seclevelr})) {
     $outpar[4]=$courseopt{$seclevelr};      $outpar[4]=$courseopt{$seclevelr};
     $result=4;      $result=4;
  }   }
Line 156  sub parmval { Line 170  sub parmval {
   
 # ---------------------------------------------------------- fourth, check user  # ---------------------------------------------------------- fourth, check user
   
     if ($uname) {      if (defined($uname)) {
  if ($useropt{$courselevel}) {   if (defined($useropt{$courselevel})) {
     $outpar[3]=$useropt{$courselevel};      $outpar[3]=$useropt{$courselevel};
     $result=3;      $result=3;
  }   }
   
  if ($useropt{$courselevelm}) {   if (defined($useropt{$courselevelm})) {
     $outpar[2]=$useropt{$courselevelm};      $outpar[2]=$useropt{$courselevelm};
     $result=2;      $result=2;
  }   }
   
  if ($useropt{$courselevelr}) {   if (defined($useropt{$courselevelr})) {
     $outpar[1]=$useropt{$courselevelr};      $outpar[1]=$useropt{$courselevelr};
     $result=1;      $result=1;
  }   }
     }      }
   
     return ($result,@outpar);      return ($result,@outpar);
 }  }
   
Line 199  sub valout { Line 212  sub valout {
     my $result = '';      my $result = '';
     # Values of zero are valid.      # Values of zero are valid.
     if (! $value && $value ne '0') {      if (! $value && $value ne '0') {
         $result = '  ';   $result = '  ';
     } else {      } else {
         if ($type=~/^date/) {          if ($type eq 'date_interval') {
               my ($sec,$min,$hour,$mday,$mon,$year)=gmtime($value);
               $year=$year-70;
               $mday--;
               if ($year) {
    $result.=$year.' yrs ';
               }
               if ($mon) {
    $result.=$mon.' mths ';
               }
               if ($mday) {
    $result.=$mday.' days ';
               }
               if ($hour) {
    $result.=$hour.' hrs ';
               }
               if ($min) {
    $result.=$min.' mins ';
               }
               if ($sec) {
    $result.=$sec.' secs ';
               }
               $result=~s/\s+$//;
           } elsif ($type=~/^date/) {
             $result = localtime($value);              $result = localtime($value);
         } else {          } else {
             $result = $value;              $result = $value;
Line 249  sub startpage { Line 285  sub startpage {
     my ($r,$id,$udom,$csec,$uname)=@_;      my ($r,$id,$udom,$csec,$uname)=@_;
     $r->content_type('text/html');      $r->content_type('text/html');
     $r->send_http_header;      $r->send_http_header;
    
       my $bodytag=&Apache::loncommon::bodytag('Set Course Parameters','',
                                               'onUnload="pclose()"');
     $r->print(<<ENDHEAD);      $r->print(<<ENDHEAD);
 <html>  <html>
 <head>  <head>
Line 303  sub startpage { Line 342  sub startpage {
     }      }
 </script>  </script>
 </head>  </head>
 <body bgcolor="#FFFFFF" onUnload="pclose()">  $bodytag
 <h1>Set Course Parameters for Course:  
 $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h1>  
 <form method="post" action="/adm/parmset" name="envform">  <form method="post" action="/adm/parmset" name="envform">
 <h3>Course Environment</h3>  <h3>Course Environment</h3>
 <input type="submit" name="crsenv" value="Set Course Environment">  <input type="submit" name="crsenv" value="Set Course Environment">
Line 331  ENDHEAD Line 368  ENDHEAD
 }  }
   
 sub print_row {  sub print_row {
     my ($r,$which,$part,$name,$rid,$default,$type,$display,$defbgone,      my ($r,$which,$part,$name,$rid,$default,$defaulttype,$display,$defbgone,
  $defbgtwo,$parmlev)=@_;   $defbgtwo,$parmlev)=@_;
   # get the values for the parameter in cascading order
   # empty levels will remain empty
     my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which},      my ($result,@outpar)=&parmval($$part{$which}.'.'.$$name{$which},
   $rid,$$default{$which});    $rid,$$default{$which});
   # get the type for the parameters
   # problem: these may not be set for all levels
       my ($typeresult,@typeoutpar)=&parmval($$part{$which}.'.'.
                                             $$name{$which}.'.type',
     $rid,$$defaulttype{$which});
   # cascade down manually
       my $cascadetype=$defaulttype;
       for (my $i=$#typeoutpar;$i>0;$i--) {
    if ($typeoutpar[$i]) { 
               $cascadetype=$typeoutpar[$i];
    } else {
               $typeoutpar[$i]=$cascadetype;
           }
       }
    
     my $parm=$$display{$which};      my $parm=$$display{$which};
   
     if ($parmlev eq 'full' || $parmlev eq 'brief') {      if ($parmlev eq 'full' || $parmlev eq 'brief') {
Line 353  sub print_row { Line 407  sub print_row {
     if ($parmlev eq 'general') {      if ($parmlev eq 'general') {
   
         if ($uname) {          if ($uname) {
             &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);              &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
         } elsif ($csec) {          } elsif ($csec) {
             &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);               &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); 
         } else {          } else {
             &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);               &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display); 
         }          }
     } elsif ($parmlev eq 'map') {      } elsif ($parmlev eq 'map') {
   
         if ($uname) {          if ($uname) {
             &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);              &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
         } elsif ($csec) {          } elsif ($csec) {
             &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);              &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
         } else {          } else {
             &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);              &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
         }          }
     } else {      } else {
   
         &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,$type,$display);          &print_td($r,11,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
   
         if ($parmlev eq 'brief') {          if ($parmlev eq 'brief') {
   
            &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);             &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
   
            if ($csec) {             if ($csec) {
                &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            }             }
            if ($uname) {             if ($uname) {
                &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            }             }
         } else {          } else {
   
            &print_td($r,10,'#FFDDDD',$result,\@outpar,$mprefix,$_,$type,$display);             &print_td($r,10,'#FFDDDD',$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);             &print_td($r,9,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);             &print_td($r,8,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);             &print_td($r,7,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
   
            if ($csec) {             if ($csec) {
                &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,6,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
                &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,5,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
                &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,4,$defbgtwo,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            }             }
            if ($uname) {             if ($uname) {
                &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
                &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
                &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,$type,$display);                 &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$_,\@typeoutpar,$display);
            }             }
         } # end of $brief if/else          } # end of $brief if/else
     } # end of $parmlev if/else      } # end of $parmlev if/else
   
     if ($parmlev eq 'full' || $parmlev eq 'brief') {      if ($parmlev eq 'full' || $parmlev eq 'brief') {
         $r->print('<td bgcolor=#CCCCFF align="center">'.          $r->print('<td bgcolor=#CCCCFF align="center">'.
                   &valout($outpar[$result],$$type{$which}).'</td>');                    &valout($outpar[$result],$typeoutpar[$result]).'</td>');
     }      }
     my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.      my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
                                         '.'.$$name{$which},$symbp{$rid});                                          '.'.$$name{$which},$symbp{$rid});
   # this doesn't seem to work, and I don't think is correct
   #    my $sessionvaltype=&Apache::lonnet::EXT('resource.'.$$part{$which}.
   #                                      '.'.$$name{$which}.'.type',$symbp{$rid});
   # this seems to work
       my $sessionvaltype=$typeoutpar[$result];
       if (!defined($sessionvaltype)) { $sessionvaltype=$$defaulttype{$which}; }
     $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.      $r->print('<td bgcolor=#999999 align="center"><font color=#FFFFFF>'.
                   &valout($sessionval,$$type{$which}).'&nbsp;'.                    &valout($sessionval,$sessionvaltype).'&nbsp;'.
                   '</font></td>');                    '</font></td>');
     $r->print('</tr>');      $r->print('</tr>');
     $r->print("\n");      $r->print("\n");
 }  }
   
 sub print_td {  sub print_td {
     my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$type,$display)=@_;      my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display)=@_;
     $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).      $r->print('<td bgcolor='.(($result==$which)?'"#AAFFAA"':$defbg).
               ' align="center">'.                ' align="center">'.
               &plink($$type{$value},$$display{$value},$$outpar[$which],                &plink($$typeoutpar[$which],$$display{$value},$$outpar[$which],
                      $mprefix."$which",'parmform.pres','psub').'</td>'."\n");                       $mprefix."$which",'parmform.pres','psub').'</td>'."\n");
 }  }
   
Line 437  sub get_env_multiple { Line 497  sub get_env_multiple {
     return(@values);      return(@values);
 }  }
   
   =pod
   
   =item B<extractResourceInformation>: Given the course data hash, extractResourceInformation extracts lots of information about the course's resources into a variety of hashes.
   
   Input: See list below:
   
   =over 4
   
   =item B<ids>: An array that will contain all of the ids in the course.
   
   =item B<typep>: hash, id->type, where "type" contains the extension of the file, thus, I<problem exam quiz assess survey form>.
   
   =item B<keyp>: hash, id->key list, will contain a comma seperated list of the meta-data keys available for the given id
   
   =item B<allparms>: hash, name of parameter->display value (what is the display value?)
   
   =item B<allparts>: hash, part identification->text representation of part, where the text representation is "[Part $part]"
   
   =item B<allkeys>: hash, full key to part->display value (what's display value?)
   
   =item B<allmaps>: hash, ???
   
   =item B<fcat>: ???
   
   =item B<defp>: hash, ???
   
   =item B<mapp>: ??
   
   =item B<symbp>: hash, id->full sym?
   
   =back
   
   =cut
   
   sub extractResourceInformation {
       my $bighash = shift;
       my $ids = shift;
       my $typep = shift;
       my $keyp = shift;
       my $allparms = shift;
       my $allparts = shift;
       my $allkeys = shift;
       my $allmaps = shift;
       my $fcat = shift;
       my $defp = shift;
       my $mapp = shift;
       my $symbp = shift;
   
       foreach (keys %$bighash) {
    if ($_=~/^src\_(\d+)\.(\d+)$/) {
       my $mapid=$1;
       my $resid=$2;
       my $id=$mapid.'.'.$resid;
       my $srcf=$$bighash{$_};
       if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {
    $$ids[$#$ids+1]=$id;
    $$typep{$id}=$1;
    $$keyp{$id}='';
    foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {
     if ($_=~/^parameter\_(.*)/) {
                       my $key=$_;
                       my $allkey=$1;
                       $allkey=~s/\_/\./g;
                       my $display= &Apache::lonnet::metadata($srcf,$key.'.display');
                       my $name=&Apache::lonnet::metadata($srcf,$key.'.name');
                       my $part= &Apache::lonnet::metadata($srcf,$key.'.part');
                       my $parmdis = $display;
                       $parmdis =~ s|(\[Part.*$)||g;
                       my $partkey = $part;
                       $partkey =~ tr|_|.|;
                       $$allparms{$name} = $parmdis;
                       $$allparts{$part} = "[Part $part]";
                       $$allkeys{$allkey}=$display;
                       if ($allkey eq $fcat) {
           $$defp{$id}= &Apache::lonnet::metadata($srcf,$key);
       }
       if ($$keyp{$id}) {
           $$keyp{$id}.=','.$key;
       } else {
           $$keyp{$id}=$key;
       }
     }
    }
    $$mapp{$id}=
       &Apache::lonnet::declutter($$bighash{'map_id_'.$mapid});
                   $$mapp{$mapid}=$$mapp{$id};
    $$allmaps{$mapid}=$$mapp{$id};
    $$symbp{$id}=$$mapp{$id}.
    '___'.$resid.'___'.
       &Apache::lonnet::declutter($srcf);
                   $$symbp{$mapid}=$$mapp{$id}.'___(all)';
       }
    }
       }
   }
   
 ##################################################  ##################################################
 ##################################################  ##################################################
   
Line 451  Inputs: $r Line 607  Inputs: $r
   
 Returns: nothing  Returns: nothing
   
   Variables used (guessed by Jeremy):
   
   =over 4
   
   =item B<pscat>: ParameterS CATegories? ends up a list of the types of parameters that exist, e.g., tol, weight, acc, opendate, duedate, answerdate, sig, maxtries, type.
   
   =item B<psprt>: ParameterS PaRTs? a list of the parts of a problem that we are displaying? Used to display only selected parts?
   
   =item B<allmaps>:
   
   =back
   
 =cut  =cut
   
 ##################################################  ##################################################
Line 580  sub assessparms { Line 748  sub assessparms {
  $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)");   $r->print("Unable to access parameter data. (File $ENV{'request.course.fn'}_parms.db not tieable)");
  return ;   return ;
     }      }
   
 # --------------------------------------------------------- Get all assessments  # --------------------------------------------------------- Get all assessments
     foreach (keys %bighash) {      extractResourceInformation(\%bighash, \@ids, \%typep,\%keyp, \%allparms, \%allparts, \%allkeys, \%allmaps, $fcat, \%defp, \%mapp, \%symbp);
  if ($_=~/^src\_(\d+)\.(\d+)$/) {  
     my $mapid=$1;  
     my $resid=$2;  
     my $id=$mapid.'.'.$resid;  
     my $srcf=$bighash{$_};  
     if ($srcf=~/\.(problem|exam|quiz|assess|survey|form)$/) {  
  $ids[$#ids+1]=$id;  
  $typep{$id}=$1;  
  $keyp{$id}='';  
  foreach (split(/\,/,&Apache::lonnet::metadata($srcf,'allpossiblekeys'))) {  
   if ($_=~/^parameter\_(.*)/) {  
                     my $key=$_;  
                     my $allkey=$1;  
                     $allkey=~s/\_/\./g;  
                     my $display= &Apache::lonnet::metadata($srcf,$key.'.display');  
                     my $name=&Apache::lonnet::metadata($srcf,$key.'.name');  
                     my $part= &Apache::lonnet::metadata($srcf,$key.'.part');  
                     my $parmdis = $display;  
                     $parmdis =~ s|(\[Part.*$)||g;  
                     my $partkey = $part;  
                     $partkey =~ tr|_|.|;  
                     $allparms{$name} = $parmdis;  
                     $allparts{$part} = "[Part $part]";  
                     $allkeys{$allkey}=$display;  
                     if ($allkey eq $fcat) {  
         $defp{$id}= &Apache::lonnet::metadata($srcf,$key);  
     }  
     if ($keyp{$id}) {  
         $keyp{$id}.=','.$key;  
     } else {  
         $keyp{$id}=$key;  
     }  
   }  
  }  
  $mapp{$id}=  
     &Apache::lonnet::declutter($bighash{'map_id_'.$mapid});  
                 $mapp{$mapid}=$mapp{$id};  
  $allmaps{$mapid}=$mapp{$id};  
  $symbp{$id}=$mapp{$id}.  
  '___'.$resid.'___'.  
     &Apache::lonnet::declutter($srcf);  
                 $symbp{$mapid}=$mapp{$id}.'___(all)';  
     }  
  }  
     }  
     $mapp{'0.0'} = '';      $mapp{'0.0'} = '';
     $symbp{'0.0'} = '';      $symbp{'0.0'} = '';
 # ---------------------------------------------------------- Anything to store?  # ---------------------------------------------------------- Anything to store?
Line 654  sub assessparms { Line 779  sub assessparms {
  if ($snum==5) { $storeunder=$seclevelm; }   if ($snum==5) { $storeunder=$seclevelm; }
  if ($snum==4) { $storeunder=$seclevelr; }   if ($snum==4) { $storeunder=$seclevelr; }
   
         my %storecontent = ($storeunder        => $ENV{'form.pres_value'},          my %storecontent = ($storeunder         => $ENV{'form.pres_value'},
                             $storeunder.'type' => $ENV{'form.pres_type'});                              $storeunder.'.type' => $ENV{'form.pres_type'});
  my $reply='';   my $reply='';
  if ($snum>3) {   if ($snum>3) {
 # ---------------------------------------------------------------- Store Course  # ---------------------------------------------------------------- Store Course
Line 698  sub assessparms { Line 823  sub assessparms {
  }   }
 # ---------------------------------------------------------------- Done storing  # ---------------------------------------------------------------- Done storing
     }      }
   # --------------------------------------------- Devalidate cache for this child
           &Apache::lonnet::devalidatecourseresdata(
                    $ENV{'course.'.$ENV{'request.course.id'}.'.num'},
                    $ENV{'course.'.$ENV{'request.course.id'}.'.domain'});
 # -------------------------------------------------------------- Get coursedata  # -------------------------------------------------------------- Get coursedata
     %courseopt = &Apache::lonnet::dump      %courseopt = &Apache::lonnet::dump
         ('resourcedata',          ('resourcedata',
Line 725  sub assessparms { Line 854  sub assessparms {
     if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);}      if ($pscat[0] eq "all" || !@pscat) {@pscat = (keys %allparms);}
     if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}      if ($psprt[0] eq "all" || !@psprt) {@psprt = (keys %allparts);}
 # ------------------------------------------------------------------ Start page  # ------------------------------------------------------------------ Start page
   
     &startpage($r,$id,$udom,$csec,$uname);      &startpage($r,$id,$udom,$csec,$uname);
 #    if ($ENV{'form.url'}) {  #    if ($ENV{'form.url'}) {
 # $r->print('<input type="hidden" value="'.$ENV{'form.url'}.  # $r->print('<input type="hidden" value="'.$ENV{'form.url'}.
Line 1221  Returns: nothing Line 1351  Returns: nothing
 sub crsenv {  sub crsenv {
     my $r=shift;      my $r=shift;
     my $setoutput='';      my $setoutput='';
       my $bodytag=&Apache::loncommon::bodytag(
                                '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
Line 1233  sub crsenv { Line 1365  sub crsenv {
             }              }
             if ($name eq 'url') {              if ($name eq 'url') {
  $value=~s/^\/res\///;   $value=~s/^\/res\///;
                   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 ' => $tmp[1] },                           {'top level map backup '.$bkuptime => $tmp[1] },
                          $dom,$crs).                           $dom,$crs).
                     '<br>';                      '<br>';
             }              }
Line 1313  sub crsenv { Line 1446  sub crsenv {
  }   }
  foreach (sort keys %descriptions) {   foreach (sort keys %descriptions) {
             # onchange is javascript to automatically check the 'Set' button.              # onchange is javascript to automatically check the 'Set' button.
             my $onchange = 'onchange="javascript:window.document.forms'.              my $onchange = 'onFocus="javascript:window.document.forms'.
                 '[\'envform\'].elements[\''.$_.'_setparmval\']'.                  '[\'envform\'].elements[\''.$_.'_setparmval\']'.
                 '.checked=true;"';                  '.checked=true;"';
     $output.='<tr><td>'.$descriptions{$_}.'</td>'.      $output.='<tr><td>'.$descriptions{$_}.'</td>'.
Line 1322  sub crsenv { Line 1455  sub crsenv {
                 '<td><input type=checkbox name="'.$_.'_setparmval"></td>'.                  '<td><input type=checkbox name="'.$_.'_setparmval"></td>'.
                 '</tr>'."\n";                  '</tr>'."\n";
  }   }
         my $onchange = 'onchange="javascript:window.document.forms'.          my $onchange = 'onFocus="javascript:window.document.forms'.
             '[\'envform\'].elements[\'newp_setparmval\']'.              '[\'envform\'].elements[\'newp_setparmval\']'.
             '.checked=true;"';              '.checked=true;"';
  $output.='<tr><td><i>Create New Environment Variable</i><br />'.   $output.='<tr><td><i>Create New Environment Variable</i><br />'.
Line 1361  sub crsenv { Line 1494  sub crsenv {
 <head>  <head>
 <title>LON-CAPA Course Environment</title>  <title>LON-CAPA Course Environment</title>
 </head>  </head>
 <body bgcolor="#FFFFFF">  $bodytag
 <h1>Set Course Parameters</h1>  
 <form method="post" action="/adm/parmset" name="envform">  <form method="post" action="/adm/parmset" name="envform">
 <h2>Course: $ENV{'course.'.$ENV{'request.course.id'}.'.description'}</h2>  
 <h3>Course Environment</h3>  
 $setoutput  $setoutput
 <p>  <p>
 <table border=2>  <table border=2>

Removed from v.1.61.2.1  
changed lines
  Added in v.1.72


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