Diff for /loncom/interface/lonparmset.pm between versions 1.570 and 1.579

version 1.570, 2016/10/25 18:19:19 version 1.579, 2017/07/15 02:31:33
Line 36  lonparmset - Handler to set parameters f Line 36  lonparmset - Handler to set parameters f
   
 =head1 SYNOPSIS  =head1 SYNOPSIS
   
 lonparmset provides an interface to setting course parameters.  lonparmset provides an interface to setting content parameters in a 
   course.
   
 It contains all the code for the "Content and Problem Settings" UI, except  It contains all the code for the "Content and Problem Settings" UI, except
 for the helpers parameter.helper and resettimes.helper, and lonhelper.pm,  for the helpers parameter.helper and resettimes.helper, and lonhelper.pm,
Line 846  sub storeparm_by_symb_inner { Line 847  sub storeparm_by_symb_inner {
     my $courselevelm=$env{'request.course.id'}.'.'.$mapparm;      my $courselevelm=$env{'request.course.id'}.'.'.$mapparm;
   
     my $storeunder='';      my $storeunder='';
       my $possreplace='';
     if (($snum==18) || ($snum==4)) { $storeunder=$courselevel; }      if (($snum==18) || ($snum==4)) { $storeunder=$courselevel; }
     if (($snum==17) || ($snum==3)) { $storeunder=$courseleveli; }       if (($snum==17) || ($snum==3)) { 
     if (($snum==16) || ($snum==2)) { $storeunder=$courselevelm; }          $storeunder=$courseleveli;
           $possreplace=$courselevelm; 
       } 
       if (($snum==16) || ($snum==2)) { 
           $storeunder=$courselevelm;
           $possreplace=$courseleveli;
       }
     if (($snum==13) || ($snum==1)) { $storeunder=$courselevelr; }      if (($snum==13) || ($snum==1)) { $storeunder=$courselevelr; }
     if ($snum==12) { $storeunder=$seclevel; }      if ($snum==12) { $storeunder=$seclevel; }
     if ($snum==11) { $storeunder=$secleveli; }      if ($snum==11) { 
     if ($snum==10) { $storeunder=$seclevelm; }          $storeunder=$secleveli;
           $possreplace=$seclevelm; 
       }
       if ($snum==10) { 
           $storeunder=$seclevelm;
           $possreplace=$secleveli;
       }
     if ($snum==9) { $storeunder=$seclevelr; }      if ($snum==9) { $storeunder=$seclevelr; }
     if ($snum==8) { $storeunder=$grplevel; }      if ($snum==8) { $storeunder=$grplevel; }
     if ($snum==7) { $storeunder=$grpleveli; }      if ($snum==7) { 
     if ($snum==6) { $storeunder=$grplevelm; }          $storeunder=$grpleveli;
           $possreplace=$grplevelm;
       }
       if ($snum==6) {
           $storeunder=$grplevelm;
           $possreplace=$grpleveli;
       }
     if ($snum==5) { $storeunder=$grplevelr; }      if ($snum==5) { $storeunder=$grplevelr; }
   
   
Line 875  sub storeparm_by_symb_inner { Line 895  sub storeparm_by_symb_inner {
         &Apache::lonnet::expirespread('','','studentcalc');          &Apache::lonnet::expirespread('','','studentcalc');
         if (($snum==13) || ($snum==9) || ($snum==5)) {          if (($snum==13) || ($snum==9) || ($snum==5)) {
             &Apache::lonnet::expirespread('','','assesscalc',$symb);              &Apache::lonnet::expirespread('','','assesscalc',$symb);
         } elsif (($snum==14) || ($snum==10) || ($snum==6)) {          } elsif (($snum==17) || ($snum==16) || ($snum==11) || ($snum==10) || ($snum==7) || ($snum==6)) {
             &Apache::lonnet::expirespread('','','assesscalc',$map);              &Apache::lonnet::expirespread('','','assesscalc',$map);
         } else {          } else {
             &Apache::lonnet::expirespread('','','assesscalc');              &Apache::lonnet::expirespread('','','assesscalc');
Line 889  sub storeparm_by_symb_inner { Line 909  sub storeparm_by_symb_inner {
             $reply=&Apache::lonnet::cput              $reply=&Apache::lonnet::cput
             ('resourcedata',\%storecontent,$cdom,$cnum);              ('resourcedata',\%storecontent,$cdom,$cnum);
             &log_parmset(\%storecontent);              &log_parmset(\%storecontent);
               if ($possreplace) {
                   my $resdata = &Apache::lonnet::get_courseresdata($cnum,$cdom);
                   if (ref($resdata) eq 'HASH') {
                       if (exists($resdata->{$possreplace})) {
                           if (&Apache::lonnet::del
                               ('resourcedata',[$possreplace,$possreplace.'.type'],$cdom,$cnum) eq 'ok') {
                               &log_parmset({$possreplace => '', $possreplace.'.type' => $ntype},1);   
                           }
                       }
                   }
               }
         }          }
         &Apache::lonnet::devalidatecourseresdata($cnum,$cdom);          &Apache::lonnet::devalidatecourseresdata($cnum,$cdom);
     } else {      } else {
Line 899  sub storeparm_by_symb_inner { Line 930  sub storeparm_by_symb_inner {
         if ($snum==1) {          if ($snum==1) {
             &Apache::lonnet::expirespread              &Apache::lonnet::expirespread
             ($uname,$udom,'assesscalc',$symb);              ($uname,$udom,'assesscalc',$symb);
         } elsif ($snum==2) {          } elsif (($snum==2) || ($snum==3)) {
             &Apache::lonnet::expirespread              &Apache::lonnet::expirespread
             ($uname,$udom,'assesscalc',$map);              ($uname,$udom,'assesscalc',$map);
         } else {          } else {
Line 914  sub storeparm_by_symb_inner { Line 945  sub storeparm_by_symb_inner {
             $reply=&Apache::lonnet::cput              $reply=&Apache::lonnet::cput
             ('resourcedata',\%storecontent,$udom,$uname);              ('resourcedata',\%storecontent,$udom,$uname);
             &log_parmset(\%storecontent,0,$uname,$udom);              &log_parmset(\%storecontent,0,$uname,$udom);
               if ($possreplace) {
                   my $resdata = &Apache::lonnet::get_userresdata($uname,$udom);
                   if (ref($resdata) eq 'HASH') {
                       if (exists($resdata->{$possreplace})) {
                           if (&Apache::lonnet::del
                               ('resourcedata',[$possreplace,$possreplace.'.type'],$udom,$uname) eq 'ok') {
                               &log_parmset({$possreplace => '',$possreplace.'.type' => $ntype},1,
                                             $uname,$udom);
                           }
                       }
                   }
               }
         }          }
         &Apache::lonnet::devalidateuserresdata($uname,$udom);          &Apache::lonnet::devalidateuserresdata($uname,$udom);
     }      }
Line 1022  sub valout { Line 1065  sub valout {
 # @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change.  # @param {string} $marker - identifier for the parameter, "resource id&part_parameter name&level", will be passed as pres_marker when the user submits a change.
 # @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres')  # @param {string} $return - prefix for the name of the form and field names that will be used to submit the form ('parmform.pres')
 # @param {string} $call - javascript function to call to submit the form ('psub')  # @param {string} $call - javascript function to call to submit the form ('psub')
   # @param {boolean} $recursive - true if link is for a map/folder where parameter is currently set to be recursive. 
 sub plink {  sub plink {
     my ($type,$dis,$value,$marker,$return,$call)=@_;      my ($type,$dis,$value,$marker,$return,$call,$recursive)=@_;
     my $winvalue=$value;      my $winvalue=$value;
     unless ($winvalue) {      unless ($winvalue) {
         if (&isdateparm($type)) {          if (&isdateparm($type)) {
Line 1045  sub plink { Line 1089  sub plink {
     return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'.      return '<table width="100%"><tr valign="top" align="right"><td><a name="'.$unencmarker.'" /></td></tr><tr><td align="center">'.
     '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"      '<a href="javascript:pjump('."'".$type."','".$dis."','".$winvalue."','"
         .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.          .$marker."','".$return."','".$call."','".$hour."','".$min."','".$sec."'".');">'.
         $valout.'</a></td></tr></table>';          $valout.'</a></td></tr>'.($recursive?'<tr><td align="center" class="LC_parm_recursive">'.
                                                 &mt('recursive').'</td></tr>' : '').'</table>';
   
 }  }
   
 # Javascript for table mode.  # Javascript for table mode.
Line 1425  sub print_row { Line 1471  sub print_row {
     $thismarker=~s/^parameter\_//;      $thismarker=~s/^parameter\_//;
     my $mprefix=$rid.'&'.$thismarker.'&';      my $mprefix=$rid.'&'.$thismarker.'&';
     my $effective_parm = &valout($outpar[$result],$typeoutpar[$result],$thismarker);      my $effective_parm = &valout($outpar[$result],$typeoutpar[$result],$thismarker);
     my ($othergrp,$grp_parm,$controlgrp);      my ($othergrp,$grp_parm,$controlgrp,$effparm_rec);
       if ($result == 17 || $result == 11 || $result == 7 || $result == 3) {
           $effparm_rec = 1;
       }
     if ($parmlev eq 'general') {      if ($parmlev eq 'general') {
         if ($uname) {          if ($uname) {
             &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
Line 1439  sub print_row { Line 1487  sub print_row {
         }          }
     } elsif ($parmlev eq 'map') {      } elsif ($parmlev eq 'map') {
         if ($uname) {          if ($uname) {
             &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1); 
             &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);   
         } elsif ($cgroup) {          } elsif ($cgroup) {
             &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);              &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1);
             &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);  
         } elsif ($csec) {          } elsif ($csec) {
             &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1);
             &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);  
         } else {          } else {
             &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1);
             &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);  
         }          }
     } else {      } else {
         if ($uname) {          if ($uname) {
Line 1470  sub print_row { Line 1514  sub print_row {
         }          }
   
         &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);          &print_td($r,18,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
         &print_td($r,17,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);          &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1);
         &print_td($r,16,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);  
         &print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);          &print_td($r,15,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
         &print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);          &print_td($r,14,'#FFDDDD',$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
         &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);          &print_td($r,13,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
   
         if ($csec) {          if ($csec) {
             &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,12,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
             &print_td($r,11,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1);
             &print_td($r,10,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);  
             &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,9,$defbgtwo,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
         }          }
   
         if ($cgroup) {          if ($cgroup) {
             &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);              &print_td($r,8,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);
             &print_td($r,7,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);              &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly,1);
             &print_td($r,6,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp,$readonly);  
             &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.$readonly);              &print_td($r,5,$defbgthree,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,$noeditgrp.$readonly);
         }          }
   
Line 1495  sub print_row { Line 1536  sub print_row {
                 $r->print($othergrp);                  $r->print($othergrp);
             }              }
             &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,4,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
             &print_td($r,3,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly,1);
             &print_td($r,2,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);  
             &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);              &print_td($r,1,$defbgone,$result,\@outpar,$mprefix,$which,\@typeoutpar,$display,'',$readonly);
         }          }
   
     } # end of $parmlev if/else      } # end of $parmlev if/else
     $r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.'</td>');      $r->print('<td style="background-color:#CCCCFF;" align="center">'.$effective_parm.
                 ($effparm_rec?'<br /><span class="LC_parm_recursive">'.&mt('recursive').
                               '</span>':'').'</td>');
   
     if ($parmlev eq 'full') {      if ($parmlev eq 'full') {
         my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.          my $sessionval=&Apache::lonnet::EXT('resource.'.$$part{$which}.
Line 1535  sub print_row { Line 1577  sub print_row {
 # @param {hash reference} $display - parameter key -> full title for the parameter  # @param {hash reference} $display - parameter key -> full title for the parameter
 # @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters  # @param {boolean} $noeditgrp - true if no edit is allowed for group level parameters
 # @param {boolean} $readonly -true if editing not allowed.  # @param {boolean} $readonly -true if editing not allowed.
   # @param {boolean} $ismaplevel - true if level is for a map. 
 sub print_td {  sub print_td {
     my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,$noeditgrp,$readonly)=@_;      my ($r,$which,$defbg,$result,$outpar,$mprefix,$value,$typeoutpar,$display,
     $r->print('<td style="background-color:'.(($result==$which)?'#AAFFAA':$defbg).          $noeditgrp,$readonly,$ismaplevel)=@_;
       my ($ineffect,$recursive,$currval,$currtype,$currlevel);
       $ineffect = 0;
       $currval = $$outpar[$which];
       $currtype = $$typeoutpar[$which];
       $currlevel = $which;
       if (($result) && ($result == $which)) {
           $ineffect = 1;
       } 
       if ($ismaplevel) {
           if ($mprefix =~ /(hiddenresource|encrypturl)\&/) {
               if (($result) && ($result == $which)) {
                   $recursive = 1;
               }
           } elsif ($$outpar[$which+1] ne '') {
               $recursive = 1;
               $currlevel = $which+1;
               $currval = $$outpar[$currlevel];
               $currtype = $$typeoutpar[$currlevel];
               if (($result) && ($result == $currlevel)) {
                   $ineffect = 1;
               }
           }
       }
       $r->print('<td style="background-color:'.($ineffect?'#AAFFAA':$defbg).
               ';" align="center">');                ';" align="center">');
     my $nolink = 0;      my $nolink = 0;
     if ($readonly) {      if ($readonly) {
         $nolink = 1;          $nolink = 1;
     } else {       } else { 
         if ($which == 14 || $which == 15) {          if ($which == 14 || $which == 15 || $mprefix =~ /mapalias\&$/) {
             $nolink = 1;              $nolink = 1;
         } elsif (($env{'request.course.sec'} ne '') && ($which > 12)) {          } elsif (($env{'request.course.sec'} ne '') && ($which > 12)) {
             $nolink = 1;              $nolink = 1;
Line 1562  sub print_td { Line 1629  sub print_td {
         }          }
     }      }
     if ($nolink) {      if ($nolink) {
         $r->print(&valout($$outpar[$which],$$typeoutpar[$which],$mprefix));          my ($parmname)=((split(/\&/,$mprefix))[1]=~/\_([^\_]+)$/);
 # FIXME: probably a good thing that mprefix is not used in valout, because it does not look like a parameter name !          $r->print(&valout($currval,$currtype,$parmname));
     } else {      } else {
         $r->print(&plink($$typeoutpar[$which],          $r->print(&plink($currtype,
                          $$display{$value},$$outpar[$which],                           $$display{$value},$currval,
                          $mprefix."$which",'parmform.pres','psub'));                           $mprefix.$currlevel,'parmform.pres','psub',$recursive));
     }      }
     $r->print('</td>'."\n");      $r->print('</td>'."\n");
 }  }
Line 1935  sub lookUpTableParameter { Line 2002  sub lookUpTableParameter {
         'retrypartial' => 'tries',          'retrypartial' => 'tries',
         'discussvote'  => 'misc',          'discussvote'  => 'misc',
         'examcode' => 'high_level_randomization',           'examcode' => 'high_level_randomization', 
     );          );
 }  }
   
 # Adds the given parameter name to an array of arrays listing all parameters for each category.  # Adds the given parameter name to an array of arrays listing all parameters for each category.
Line 2029  sub parmboxes { Line 2096  sub parmboxes {
         $r->print('<div class="LC_Box LC_400Box">'          $r->print('<div class="LC_Box LC_400Box">'
                  .'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n");                   .'<h4 class="LC_hcell">'.&mt($categories{$key}).'</h4>'."\n");
         foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {          foreach my $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
               next if ($tempkey eq '');
             $r->print('<span class="LC_nobreak">'              $r->print('<span class="LC_nobreak">'
                      .'<label><input type="checkbox" name="pscat" '                       .'<label><input type="checkbox" name="pscat" '
                      .'value="'.$tempkey.'" ');                       .'value="'.$tempkey.'" ');
Line 3114  ENDPARMSELSCRIPT Line 3182  ENDPARMSELSCRIPT
 #  #
 # This produces the cascading table output of parameters  # This produces the cascading table output of parameters
 #  #
             my $coursespan=$csec?10:6;              my $coursespan=$csec?8:5;
             my $userspan=4;              my $userspan=3;
             if ($cgroup ne '') {              if ($cgroup ne '') {
                 $coursespan += 4;                  $coursespan += 3;
             }              }
   
             $r->print(&Apache::loncommon::start_data_table());              $r->print(&Apache::loncommon::start_data_table());
Line 3147  ENDPARMSELSCRIPT Line 3215  ENDPARMSELSCRIPT
                 'femof'  => 'from Enclosing Map or Folder',                  'femof'  => 'from Enclosing Map or Folder',
                 'gen'    => 'general',                  'gen'    => 'general',
                 'foremf' => 'for Enclosing Map or Folder',                  'foremf' => 'for Enclosing Map or Folder',
                 'formfr' => 'for Map or Folder (recursive)',  
                 'fr'     => 'for Resource'                  'fr'     => 'for Resource'
             );              );
             $r->print(<<ENDTABLETWO);              $r->print(<<ENDTABLETWO);
 <th rowspan="3">$lt{'pie'}</th>  <th rowspan="3">$lt{'pie'}</th>
 <th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th>  <th rowspan="3">$lt{'csv'}<br />($csuname:$csudom)</th>
 </tr><tr><td colspan="5"></td><th colspan="3">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th>  </tr><tr><td colspan="5"></td><th colspan="2">$lt{'ic'}</th><th colspan="2">$lt{'rl'}</th>
 <th colspan="1">$lt{'ic'}</th>  <th colspan="1">$lt{'ic'}</th>
   
 ENDTABLETWO  ENDTABLETWO
             if ($csec) {              if ($csec) {
                 $r->print('<th colspan="4">'.                  $r->print('<th colspan="3">'.
                 &mt("in Section")." $csec</th>");                  &mt("in Section")." $csec</th>");
             }              }
             if ($cgroup) {              if ($cgroup) {
                 $r->print('<th colspan="4">'.                  $r->print('<th colspan="3">'.
                 &mt("in Group")." $cgroup</th>");                  &mt("in Group")." $cgroup</th>");
             }              }
             $r->print(<<ENDTABLEHEADFOUR);              $r->print(<<ENDTABLEHEADFOUR);
 </tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th>  </tr><tr><th>$lt{'aut'}</th><th>$lt{'type'}</th>
 <th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th>  <th>$lt{'emof'}</th><th>$lt{'part'}</th><th>$lt{'pn'}</th>
 <th>$lt{'gen'}</th><th>$lt{'formfr'}</th><th>$lt{'foremf'}</th>  <th>$lt{'gen'}</th><th>$lt{'foremf'}</th>
 <th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th>  <th>$lt{'def'}</th><th>$lt{'femof'}</th><th>$lt{'fr'}</th>
 ENDTABLEHEADFOUR  ENDTABLEHEADFOUR
   
             if ($csec) {              if ($csec) {
                 $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>');                  $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>');
             }              }
   
             if ($cgroup) {              if ($cgroup) {
                 $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.&mt('foremf').'</th><th>'.$lt{'fr'}.'</th>');                  $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>');
             }              }
   
             if ($uname) {              if ($uname) {
                 if (@usersgroups > 1) {                  if (@usersgroups > 1) {
                     $r->print('<th>'.&mt('Control by other group?').'</th>');                      $r->print('<th>'.&mt('Control by other group?').'</th>');
                 }                  }
                 $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'formfr'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>');                  $r->print('<th>'.$lt{'gen'}.'</th><th>'.$lt{'foremf'}.'</th><th>'.$lt{'fr'}.'</th>');
             }              }
   
             $r->print('</tr>');              $r->print('</tr>');
Line 3405  ENDTABLEHEADFOUR Line 3472  ENDTABLEHEADFOUR
                 $r->print('<p>'.&Apache::loncommon::start_data_table()                  $r->print('<p>'.&Apache::loncommon::start_data_table()
                          .&Apache::loncommon::start_data_table_header_row()                           .&Apache::loncommon::start_data_table_header_row()
                          .'<th>'.&mt('Parameter Name').'</th>'                           .'<th>'.&mt('Parameter Name').'</th>'
                          .'<th>'.&mt('Recursive Value').'</th>'                           .'<th>'.&mt('Value').'</th>'
                          .'<th>'.&mt('Non-Recursive Value').'</th>'  
                          .'<th>'.&mt('Parameter in Effect').'</th>'                           .'<th>'.&mt('Parameter in Effect').'</th>'
                          .&Apache::loncommon::end_data_table_header_row()                           .&Apache::loncommon::end_data_table_header_row()
                 );                  );
Line 3532  my $tableopen; # boolean, true if HTML t Line 3598  my $tableopen; # boolean, true if HTML t
 # @param {boolean} $readonly - true if values cannot be edited (otherwise more columns are added)  # @param {boolean} $readonly - true if values cannot be edited (otherwise more columns are added)
 # @returns {string}  # @returns {string}
 sub tablestart {  sub tablestart {
     my ($readonly) = @_;      my ($readonly,$is_map) = @_;
     if ($tableopen) {      if ($tableopen) {
         return '';          return '';
     } else {      } else {
Line 3541  sub tablestart { Line 3607  sub tablestart {
         if ($readonly) {          if ($readonly) {
             $output .= '<th>'.&mt('Current value').'</th>';              $output .= '<th>'.&mt('Current value').'</th>';
         } else {          } else {
             $output .= '<th>'.&mt('Delete').'</th><th>'.&mt('Set to ...').'</th>';              $output .= '<th>'.&mt('Delete').'</th>'.
                          '<th>'.&mt('Set to ...').'</th>';
               if ($is_map) {
                   $output .= '<th>'.&mt('Recursive?').'</th>';
               }
         }          }
         $output .= '</tr>';          $output .= '</tr>';
         return $output;          return $output;
Line 3620  sub storedata { Line 3690  sub storedata {
     my %newdata=();      my %newdata=();
     undef %newdata;      undef %newdata;
     my @deldata=();      my @deldata=();
       my @delrec=();
       my @delnonrec=();
     undef @deldata;      undef @deldata;
     my ($got_chostname,$chostname,$cmajor,$cminor);      my ($got_chostname,$chostname,$cmajor,$cminor);
     my $now = time;      my $now = time;
Line 3627  sub storedata { Line 3699  sub storedata {
         if ($key =~ /^form\.([a-z]+)\_(.+)$/) {          if ($key =~ /^form\.([a-z]+)\_(.+)$/) {
             my $cmd=$1;              my $cmd=$1;
             my $thiskey=$2;              my $thiskey=$2;
             next if ($cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny');              my ($altkey,$recursive,$tkey,$tkeyrec,$tkeynonrec);
               next if ($cmd eq 'rec' || $cmd eq 'settext' || $cmd eq 'setipallow' || $cmd eq 'setipdeny');
               if ((($cmd eq 'set') || ($cmd eq 'datepointer') || ($cmd eq 'dateinterval') || ($cmd eq 'del')) && 
                    ($thiskey =~ /(?:sequence|page)\Q___(all)\E/)) {
                   unless ($thiskey =~ /(encrypturl|hiddenresource)$/) {
                       $altkey = $thiskey;
                       $altkey =~ s/\Q___(all)\E/___(rec)/;
                       if ($env{'form.rec_'.$thiskey}) {
                           $recursive = 1;
                       }
                   }
               }
             my ($tuname,$tudom)=&extractuser($thiskey);              my ($tuname,$tudom)=&extractuser($thiskey);
             my $tkey=$thiskey;  
             if ($tuname) {              if ($tuname) {
                   $tkey=$thiskey;
                 $tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;                  $tkey=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
                   if ($altkey) {
                       $tkeynonrec = $tkey; 
                       $tkeyrec = $altkey;
                       $tkeyrec=~s/\.\[useropt\:$tuname\:$tudom\]\./\./;
                   }
             }              }
             if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {              if ($cmd eq 'set' || $cmd eq 'datepointer' || $cmd eq 'dateinterval') {
                 my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch);                  my ($data, $typeof, $text, $name, $valchk, $valmatch, $namematch);
Line 3715  sub storedata { Line 3803  sub storedata {
                     $typeof=$env{'form.typeof_'.$thiskey};                      $typeof=$env{'form.typeof_'.$thiskey};
                     $text = &mt('Saved modified date for');                      $text = &mt('Saved modified date for');
                 }                  }
                 if ($thiskey =~ m{\.(?:sequence|page)___\(rec\)}) {                  if ($recursive) {
                     $namematch = 'maplevelrecurse';                      $namematch = 'maplevelrecurse';
                 }                  }
                 if (($name ne '') || ($namematch ne '')) {                  if (($name ne '') || ($namematch ne '')) {
Line 3762  sub storedata { Line 3850  sub storedata {
                         next;                          next;
                     }                      }
                 }                  }
                 if (defined($data) and $$olddata{$thiskey} ne $data) {                  my ($reconlychg,$haschange,$storekey);
                     if ($tuname) {                  if ($tuname) {
                         if (&Apache::lonnet::put('resourcedata',{$tkey=>$data,                      my $ustorekey;
                                             $tkey.'.type' => $typeof},                      if ($altkey) {
                                     $tudom,$tuname) eq 'ok') {                          if ($recursive) {
                             &log_parmset({$tkey=>$data,$tkey.'.type' => $typeof},0,$tuname,$tudom);                              if (exists($$olddata{$thiskey})) {
                             $r->print('<br />'.$text.' '.                                  if ($$olddata{$thiskey} eq $data) {
                                 &Apache::loncommon::plainname($tuname,$tudom));                                      $reconlychg = 1;
                                   }
                                   &Apache::lonnet::del('resourcedata',[$tkeynonrec,$tkeynonrec.'.type'],$tudom,$tuname);
                               }
                               if (exists($$olddata{$altkey})) {
                                   if (defined($data) && $$olddata{$altkey} ne $data) {
                                       $haschange = 1;
                                   }
                               } elsif ((!$reconlychg) && ($data ne '')) {
                                   $haschange = 1;
                               }
                               $ustorekey = $tkeyrec;
                         } else {                          } else {
                             $r->print('<div class="LC_error">'.                              if (exists($$olddata{$altkey})) {
                                 &mt('Error saving parameters').'</div>');                                  if ($$olddata{$altkey} eq $data) {
                                       $reconlychg = 1;
                                   }
                                   &Apache::lonnet::del('resourcedata',[$tkeyrec,$tkeyrec.'.type'],$tudom,$tuname);
                               }
                               if (exists($$olddata{$thiskey})) {
                                   if (defined($data) && $$olddata{$thiskey} ne $data) {
                                       $haschange = 1;
                                   }
                               } elsif ((!$reconlychg) && ($data ne '')) {
                                   $haschange = 1;
                               }
                               $ustorekey = $tkeynonrec;
                         }                          }
                         &Apache::lonnet::devalidateuserresdata($tuname,$tudom);  
                     } else {                      } else {
                         $newdata{$thiskey}=$data;                          if (exists($$olddata{$tkey})) {
                         $newdata{$thiskey.'.type'}=$typeof;                              if (defined($data) && $$olddata{$tkey} ne $data) {
                                   $haschange = 1;
                               }
                               $ustorekey = $tkey;
                           }
                       }
                       if ($haschange || $reconlychg)  {
                           unless ($env{'form.del_'.$thiskey}) {
                               if (&Apache::lonnet::put('resourcedata',{$ustorekey=>$data,
                                                                        $ustorekey.'.type' => $typeof},
                                                                        $tudom,$tuname) eq 'ok') {
                                   &log_parmset({$ustorekey=>$data,$ustorekey.'.type' => $typeof},0,$tuname,$tudom);
                                   $r->print('<br />'.$text.' '.
                                             &Apache::loncommon::plainname($tuname,$tudom));
                               } else {
                                   $r->print('<div class="LC_error">'.
                                             &mt('Error saving parameters').'</div>');
                               }
                               &Apache::lonnet::devalidateuserresdata($tuname,$tudom);
                           }
                       }
                   } else {
                       if ($altkey) {
                           if ($recursive) {
                               if (exists($$olddata{$thiskey})) {
                                   if ($$olddata{$thiskey} eq $data) {
                                       $reconlychg = 1;
                                   }
                                   push(@delnonrec,($thiskey,$thiskey.'.type'));
                               }
                               if (exists($$olddata{$altkey})) {
                                   if (defined($data) && $$olddata{$altkey} ne $data) {
                                       $haschange = 1;
                                   }
                               } elsif (($data ne '') && (!$reconlychg)) {
                                   $haschange = 1;
                               }
                               $storekey = $altkey;
                           } else {
                               if (exists($$olddata{$altkey})) {
                                   if ($$olddata{$altkey} eq $data) {
                                       $reconlychg = 1;
                                   }
                                   push(@delrec,($altkey,$altkey.'.type'));
                               } 
                               if (exists($$olddata{$thiskey})) {
                                   if (defined($data) && $$olddata{$thiskey} ne $data) {
                                       $haschange = 1;
                                   }
                               } elsif (($data ne '') && (!$reconlychg)) {
                                   $haschange = 1;
                               }
                               $storekey = $thiskey;
                           }
                       } else {
                           if (defined($data) && $$olddata{$thiskey} ne $data) {
                               $haschange = 1;
                               $storekey = $thiskey;
                           }
                       }
                   }
                   if ($reconlychg || $haschange) {
                       unless ($env{'form.del_'.$thiskey}) {
                           $newdata{$storekey}=$data;
                           $newdata{$storekey.'.type'}=$typeof;
                     }                      }
                 }                  }
             } elsif ($cmd eq 'del') {              } elsif ($cmd eq 'del') {
                 if ($tuname) {                  if ($tuname) {
                     if (&Apache::lonnet::del('resourcedata',[$tkey],$tudom,$tuname) eq 'ok') {                      my $error;
                             &log_parmset({$tkey=>''},1,$tuname,$tudom);                      if ($altkey) {  
                         $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));                          if (exists($$olddata{$altkey})) {
                               if (&Apache::lonnet::del('resourcedata',[$tkeyrec,$tkeyrec.'.type'],$tudom,$tuname) eq 'ok') {
                                   &log_parmset({$tkeyrec=>''},1,$tuname,$tudom);
                                   if ($recursive) {
                                       $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));
                                   }
                               } elsif ($recursive) {
                                   $error = 1;
                               }
                           }
                           if (exists($$olddata{$thiskey})) {
                               if (&Apache::lonnet::del('resourcedata',[$tkeynonrec,$tkeynonrec.'.type'],$tudom,$tuname) eq 'ok') {
                                   &log_parmset({$tkeynonrec=>''},1,$tuname,$tudom);
                                   unless ($recursive) {
                                       $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));
                                   }
                               } elsif (!$recursive) {
                                   $error = 1;
                               }
                           }
                     } else {                      } else {
                           if (exists($$olddata{$thiskey})) {
                               if (&Apache::lonnet::del('resourcedata',[$tkey,$tkey.'.type'],$tudom,$tuname) eq 'ok') {
                                   &log_parmset({$tkey=>''},1,$tuname,$tudom);
                                   $r->print('<br />'.&mt('Deleted parameter for').' '.&Apache::loncommon::plainname($tuname,$tudom));
                               } else {
                                   $error = 1;
                               }
                           }
                       }
                       if ($error) { 
                         $r->print('<div class="LC_error">'.                          $r->print('<div class="LC_error">'.
                             &mt('Error deleting parameters').'</div>');                              &mt('Error deleting parameters').'</div>');
                     }                      }
                     &Apache::lonnet::devalidateuserresdata($tuname,$tudom);                      &Apache::lonnet::devalidateuserresdata($tuname,$tudom);
                 } else {                  } else {
                     push (@deldata,$thiskey,$thiskey.'.type');                      if ($altkey) {
                           if (exists($$olddata{$altkey})) {
                               unless (grep(/^\Q$altkey\E$/,@delrec)) {
                                   push(@deldata,($altkey,$altkey.'.type'));
                               }
                           }
                           if (exists($$olddata{$thiskey})) {
                               unless (grep(/^\Q$thiskey\E$/,@delnonrec)) {
                                   push(@deldata,($thiskey,$thiskey.'.type'));
                               }
                           }
                       } elsif (exists($$olddata{$thiskey})) {
                           push(@deldata,($thiskey,$thiskey.'.type'));
                       }
                 }                  }
             }              }
         }          }
     }      }
 # Store all course level  # Store all course level
     my $delentries=$#deldata+1;      my $delentries=$#deldata+1;
       my @alldels;
       if (@delrec) {
           push(@alldels,@delrec);
       }
       if (@delnonrec) {
           push(@alldels,@delnonrec);
       }
       if (@deldata) {
           push(@alldels,@deldata);
       }
     my @newdatakeys=keys(%newdata);      my @newdatakeys=keys(%newdata);
     my $putentries=$#newdatakeys+1;      my $putentries=$#newdatakeys+1;
     if ($delentries) {      my ($delresult,$devalidate);
         if (&Apache::lonnet::del('resourcedata',\@deldata,$dom,$crs) eq 'ok') {      if (@alldels) {
             my %loghash=map { $_ => '' } @deldata;          if (&Apache::lonnet::del('resourcedata',\@alldels,$dom,$crs) eq 'ok') {
               my %loghash=map { $_ => '' } @alldels;
             &log_parmset(\%loghash,1);              &log_parmset(\%loghash,1);
             $r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>');              if ($delentries) {
         } else {                  $r->print('<h2>'.&mt('Deleted [quant,_1,parameter]',$delentries/2).'</h2>');
               }
           } elsif ($delentries) {
             $r->print('<div class="LC_error">'.              $r->print('<div class="LC_error">'.
                 &mt('Error deleting parameters').'</div>');                  &mt('Error deleting parameters').'</div>');
         }          }
         &Apache::lonnet::devalidatecourseresdata($crs,$dom);          $devalidate = 1; 
     }      }
     if ($putentries) {      if ($putentries) {
         if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {          if (&Apache::lonnet::put('resourcedata',\%newdata,$dom,$crs) eq 'ok') {
Line 3819  sub storedata { Line 4048  sub storedata {
             $r->print('<div class="LC_error">'.              $r->print('<div class="LC_error">'.
                 &mt('Error saving parameters').'</div>');                  &mt('Error saving parameters').'</div>');
         }          }
           $devalidate = 1; 
       }
       if ($devalidate) {
         &Apache::lonnet::devalidatecourseresdata($crs,$dom);          &Apache::lonnet::devalidatecourseresdata($crs,$dom);
     }      }
 }  }
Line 3890  sub listdata { Line 4122  sub listdata {
         }          }
     }      }
   
     foreach my $thiskey (sort {      foreach my $key (sort {
         my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata);          my ($astudent,$ares,$apart,$aparm) = &parse_listdata_key($a,$listdata);
         my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata);          my ($bstudent,$bres,$bpart,$bparm) = &parse_listdata_key($b,$listdata);
   
Line 3930  sub listdata { Line 4162  sub listdata {
   
         $result;          $result;
                   
     } keys(%{$listdata})) { # foreach my $thiskey      } keys(%{$listdata})) { # foreach my $key
           my $thiskey = $key;
         if ($$listdata{$thiskey.'.type'}) {          if ($$listdata{$thiskey.'.type'}) {
             my $thistype=$$listdata{$thiskey.'.type'};              my $thistype=$$listdata{$thiskey.'.type'};
             if ($$resourcedata{$thiskey.'.type'}) {              if ($$resourcedata{$thiskey.'.type'}) {
                 $thistype=$$resourcedata{$thiskey.'.type'};                  $thistype=$$resourcedata{$thiskey.'.type'};
             }              }
             my ($middle,$part,$name)=              my ($middle,$part,$name)=
                 ($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);                  ($thiskey=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/);
             my $section=&mt('All Students');              my $section=&mt('All Students');
               my $showval = $$resourcedata{$thiskey}; 
             if ($middle=~/^\[(.*)\]/) {              if ($middle=~/^\[(.*)\]/) {
                 my $issection=$1;                  my $issection=$1;
                 if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {                  if ($issection=~/^useropt\:($match_username)\:($match_domain)/) {
Line 3972  sub listdata { Line 4205  sub listdata {
             $middle=~s/\.+$//;              $middle=~s/\.+$//;
             $middle=~s/^\.+//;              $middle=~s/^\.+//;
             my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>';              my $realm='<span class="LC_parm_scope_all">'.&mt('All Resources').'</span>';
             if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) {              my ($is_map,$is_recursive,$mapurl,$maplevel);
                 my $mapurl = $1;              if ($caller eq 'overview') {
                 my $maplevel = $2;                  if ($middle=~/^(.+)\_\_\_\((all|rec)\)$/) {
                       $mapurl = $1;
                       $maplevel = $2;
                       $is_map = 1;
                   }
               } elsif ($caller eq 'newoverview') {
                   if ($middle=~/^(.+)\_\_\_\((all)\)$/) {
                       $mapurl = $1;
                       $maplevel = $2;
                       $is_map = 1;
                   }
               }
               if ($is_map) {
                 my $leveltitle = &mt('Folder/Map');                  my $leveltitle = &mt('Folder/Map');
                 if ($maplevel eq 'rec') {                  unless (($name eq 'hiddenresource') || ($name eq 'encrypturl')) {   
                     $leveltitle = &mt('Recursive');                      if ($caller eq 'newoverview') {
                           my $altkey = $thiskey;
                           $altkey =~ s/\Q___(all)\E/___(rec)/;
                           if ((exists($$resourcedata{$altkey})) & (!exists($$resourcedata{$thiskey}))) {
                               $is_recursive = 1;
                               if ($$resourcedata{$altkey.'.type'}) {
                                   $thistype=$$resourcedata{$altkey.'.type'};
                               }
                               $showval = $$resourcedata{$altkey};
                           }
                       } elsif (($caller eq 'overview') && ($maplevel eq 'rec')) {
                           $thiskey =~ s/\Q___(rec)\E/___(all)/;
                           $is_recursive = 1;
                       }
                 }                  }
                 $realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>';                  $realm='<span class="LC_parm_scope_folder">'.$leveltitle.': '.&Apache::lonnet::gettitle($mapurl).' <br /><span class="LC_parm_folder">('.$mapurl.')</span></span>';
             } elsif ($middle) {              } elsif ($middle) {
Line 4019  sub listdata { Line 4277  sub listdata {
     # Ready to print      # Ready to print
     #      #
             my $parmitem = &standard_parameter_names($name);              my $parmitem = &standard_parameter_names($name);
             $r->print(&tablestart($readonly).              $r->print(&tablestart($readonly,$is_map).
                 &Apache::loncommon::start_data_table_row().                  &Apache::loncommon::start_data_table_row().
                 '<td><b>'.&mt($parmitem).                  '<td><b>'.&mt($parmitem).
                 '</b></td>');                  '</b></td>');
Line 4039  sub listdata { Line 4297  sub listdata {
                 $r->print(                  $r->print(
                     &Apache::lonhtmlcommon::date_setter('parmform',                      &Apache::lonhtmlcommon::date_setter('parmform',
                                                         $jskey,                                                          $jskey,
                                                         $$resourcedata{$thiskey},                                                          $showval,
                                                         '',1,$state));                                                          '',1,$state));
                 unless  ($readonly) {                  unless  ($readonly) {
                     $r->print(                      $r->print(
     '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.      '<input type="hidden" name="datepointer_'.$thiskey.'" value="'.$jskey.'" />'.
     (($$resourcedata{$thiskey}!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$$resourcedata{$thiskey}.'">'.      (($showval!=0)?'<span class="LC_nobreak"><a href="/adm/parmset?&action=dateshift1&timebase='.$showval.'">'.
     &mt('Shift all dates based on this date').'</a></span>':'').      &mt('Shift all dates based on this date').'</a></span>':'').
     &date_sanity_info($$resourcedata{$thiskey})      &date_sanity_info($showval)
                     );                      );
                 }                  }
             } elsif ($thistype eq 'date_interval') {              } elsif ($thistype eq 'date_interval') {
                 $r->print(&date_interval_selector($thiskey,$name,                  $r->print(&date_interval_selector($thiskey,$name,
                         $$resourcedata{$thiskey},$readonly));                            $showval,$readonly));
             } elsif ($thistype =~ m/^string/) {              } elsif ($thistype =~ m/^string/) {
                 $r->print(&string_selector($thistype,$thiskey,                  $r->print(&string_selector($thistype,$thiskey,
                         $$resourcedata{$thiskey},$name,$readonly));                            $showval,$name,$readonly));
             } else {              } else {
                 $r->print(&default_selector($thiskey,$$resourcedata{$thiskey},$readonly));                  $r->print(&default_selector($thiskey,$showval,$readonly));
             }              }
             unless ($readonly) {              unless ($readonly) {
                 $r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'.                  $r->print('<input type="hidden" name="typeof_'.$thiskey.'" value="'.
                         $thistype.'" />');                          $thistype.'" />');
             }              }
             $r->print('</td>'.&Apache::loncommon::end_data_table_row());              $r->print('</td>');
               if ($is_map) {
                   if (($name eq 'encrypturl') || ($name eq 'hiddenresource')) {
                       $r->print('<td><table><tr><td>'.&mt('Yes').'</td></tr></table></td>');
                   } else {
                       my ($disabled,$recon,$recoff);
                       if ($readonly) {
                           $disabled = ' disabled="disabled"';
                       }
                       if ($is_recursive) {
                           $recon = ' checked="checked"';
                       } else {
                           $recoff = ' checked="checked"';
                       }
                       $r->print('<td><table><tr><td><label><input type="radio" name="rec_'.$thiskey.'" value="1"'.$recon.$disabled.' />'.&mt('Yes').'</label>'.
                                 '</td><td><label><input type="radio" name="rec_'.$thiskey.'" value="0"'.$recoff.$disabled.' />'.&mt('No').'</label></td></tr></table></td>');
                   }
               }
               $r->print(&Apache::loncommon::end_data_table_row());
         }          }
     }      }
     return $foundkeys;      return $foundkeys;
Line 4936  sub secgroup_lister { Line 5212  sub secgroup_lister {
                     my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat;                      my $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(all).'.$part.'.'.$cat;
                     $$listdata{$newparmkey}=1;                      $$listdata{$newparmkey}=1;
                     $$listdata{$newparmkey.'.type'}=$$defkeytype{$cat};                      $$listdata{$newparmkey.'.type'}=$$defkeytype{$cat};
                     $newparmkey=$rootparmkey.'.'.$$allmaps{$mapid}.'___(rec).'.$part.'.'.$cat;  
                     $$listdata{$newparmkey}=1;  
                     $$listdata{$newparmkey.'.type'}=$$defkeytype{$cat};  
                 }                  }
             } else {              } else {
 # resource-level parameter  # resource-level parameter
Line 5186  sub parse_key { Line 5459  sub parse_key {
     my ($key) = @_;      my ($key) = @_;
     my %data;      my %data;
     my ($middle,$part,$name)=      my ($middle,$part,$name)=
     ($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);      ($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/);
     $data{'scope_type'} = 'all';      $data{'scope_type'} = 'all';
     if ($middle=~/^\[(.*)\]/) {      if ($middle=~/^\[(.*)\]/) {
         $data{'scope'} = $1;          $data{'scope'} = $1;
Line 5594  sub addmetafield { Line 5867  sub addmetafield {
             $r->print('<input type="submit" name="undelete" value="Undelete" />');              $r->print('<input type="submit" name="undelete" value="Undelete" />');
             $r->print('</form>');              $r->print('</form>');
         }          }
         $r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata"'); # FIXME: HTML error, input will not be displayed !          $r->print('<hr /><strong>Or</strong> you may enter a new metadata field name.<form method="post" action="/adm/parmset?action=addmetadata">');
         $r->print('<input type="text" name="fieldname" /><br />');          $r->print('<input type="text" name="fieldname" /><br />');
         $r->print('<input type="submit" value="Add Metadata Field" />');          $r->print('<input type="submit" value="Add Metadata Field" />');
     }      }
Line 5938  sub components { Line 6211  sub components {
     }      }
   
     my ($middle,$part,$name)=      my ($middle,$part,$name)=
         ($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s]+)\.(\w+)$/);          ($key=~/^$env{'request.course.id'}\.(?:(.+)\.)*([\w\s\-]+)\.(\w+)$/);
     my $issection;      my $issection;
   
     my $section=&mt('All Students');      my $section=&mt('All Students');
Line 5998  sub load_parameter_names { Line 6271  sub load_parameter_names {
     close($config);      close($config);
     $standard_parms{'int_pos'}      = 'Positive Integer';      $standard_parms{'int_pos'}      = 'Positive Integer';
     $standard_parms{'int_zero_pos'} = 'Positive Integer or Zero';      $standard_parms{'int_zero_pos'} = 'Positive Integer or Zero';
       $standard_parms{'scoreformat'}  = 'Format for display of score';
 }  }
   
 # Returns a parameter title for standard parameters, the name for others.  # Returns a parameter title for standard parameters, the name for others.

Removed from v.1.570  
changed lines
  Added in v.1.579


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