Diff for /loncom/interface/lonparmset.pm between versions 1.453 and 1.472

version 1.453, 2009/06/03 17:17:03 version 1.472, 2009/10/20 10:19:26
Line 854  sub page_js { Line 854  sub page_js {
   
     return(<<ENDJS);      return(<<ENDJS);
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
     function pclose() {      function pclose() {
         parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",          parmwin=window.open("/adm/rat/empty.html","LONCAPAparms",
                  "height=350,width=350,scrollbars=no,menubar=no");                   "height=350,width=350,scrollbars=no,menubar=no");
Line 893  sub page_js { Line 893  sub page_js {
         var newWin = window.open(url, wdwName, options);          var newWin = window.open(url, wdwName, options);
         newWin.focus();          newWin.focus();
     }      }
   // ]]>
 </script>  </script>
 $selscript  $selscript
 ENDJS  ENDJS
Line 1184  sub extractResourceInformation { Line 1185  sub extractResourceInformation {
     $parmdis = $display;      $parmdis = $display;
     $parmdis =~ s/\s*\[Part.*$//g;      $parmdis =~ s/\s*\[Part.*$//g;
  } else {   } else {
     $parmdis = $display;      $parmdis = &mt($display);
  }   }
  $$allparms{$name}=$parmdis;   $$allparms{$name}=$parmdis;
  if (ref($defkeytype)) {   if (ref($defkeytype)) {
Line 1243  sub isdateparm { Line 1244  sub isdateparm {
     return (($type=~/^date/) && (!($type eq 'date_interval')));      return (($type=~/^date/) && (!($type eq 'date_interval')));
 }  }
   
   #
   # This function prints a list of parameters, which were selected. It also display a link from which you can
   # hide or show the complete parameter list, from which you can choose your parameters. 
   #
 sub parmmenu {  sub parmmenu {
     my ($r,$allparms,$pscat,$keyorder)=@_;      my ($r,$allparms,$pscat,$keyorder)=@_;
     my $tempkey;      my $tempkey;
     $r->print(<<ENDSCRIPT);      $r->print(<<ENDSCRIPT);
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
     function checkall(value, checkName) {      function checkall(value, checkName) {
   
         var li = "_li";          var li = "_li";
Line 1267  sub parmmenu { Line 1273  sub parmmenu {
     }      }
   
     function checkthis(thisvalue, checkName) {      function checkthis(thisvalue, checkName) {
         checkboxChecked(thisvalue);  
           document.getElementById(thisvalue.concat("_li")).style.display = "";        
   
  for (i=0; i<document.forms.parmform.elements.length; i++) {   for (i=0; i<document.forms.parmform.elements.length; i++) {
             ele = document.forms.parmform.elements[i];              ele = document.forms.parmform.elements[i];
             if (ele.name == checkName) {              if (ele.name == checkName) {
Line 1326  sub parmmenu { Line 1334  sub parmmenu {
     function checkboxChecked(id) {      function checkboxChecked(id) {
         var li = "_li";          var li = "_li";
         var id_li = id.concat(li);          var id_li = id.concat(li);
   
         if (document.getElementById(id_li).style.display == "none") {          if (document.getElementById(id_li).style.display == "none") {
             document.getElementById(id_li).style.display = "";              document.getElementById(id_li).style.display = "";
         }          }
Line 1334  sub parmmenu { Line 1341  sub parmmenu {
             document.getElementById(id_li).style.display = "none";              document.getElementById(id_li).style.display = "none";
         }          }
     }      }
   // ]]>
 </script>  </script>
 ENDSCRIPT  ENDSCRIPT
     $r->print();  
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View')));
   
     #part to print selected parms overview      #part to print selected parms overview
     $r->print('<table id="LC_parm_overview_parm_overview">'      $r->print(&mt('Selected Parameters:').'<br />');
              .'<tr>'  
              .'<td style="vertical-align:top; width:250px"><p>'.&mt('Selected Parameters').': ');      #print out all possible parms and hide them by default
       $r->print('<ul>');
     #print out all possible parms and hide it  
     $r->print('<td>');  
     $r->print('<ol style="list-style-type:disc">');  
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {      foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
         $r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"');          $r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"');
         if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) {          if (!($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat})) {
             $r->print('style="display:none"');              $r->print(' style="display:none"');
         }          }
                   $r->print('>'
         $r->print('>'.($$allparms{$tempkey}=~/\s/ ? $$allparms{$tempkey} : $tempkey).'</li>');                   .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey)
     }                   .'</li>'
     $r->print('<a href="javascript:showParms()">('.&mt('add more parameter').')'          );
              .'</a></p></td>');      }
     $r->print('</td>');      $r->print('</ul>'
     $r->print('</tr>'               .'<p><a href="javascript:showParms()">'
              .'</table>');               .&mt('Show detailed Parameter Selection')
                .'</a></p>'
       );
   
     &shortCuts($r,$allparms,$pscat,$keyorder);      &shortCuts($r,$allparms,$pscat,$keyorder);
   
     $r->print('</table>');      $r->print(&Apache::lonhtmlcommon::row_closure(1));
   }
   # return a hash
   sub categories {
       return ('time_settings' => 'Time Settings',
       'grading' => 'Grading',
       'tries' => 'Tries',
       'problem_appearance' => 'Problem Appearance',
       'behaviour_of_input_fields' => 'Behaviour of Input Fields',
       'hiding' => 'Hiding',
       'high_level_randomization' => 'High Level Randomization',
       'slots' => 'Slots',
       'file_submission' => 'File Submission',
       'misc' => 'Miscellaneous' ); 
   }
   
   # return a hash. Like a look-up table
   sub lookUpTableParameter {
    
       return ( 
           'opendate' => 'time_settings',
           'duedate' => 'time_settings',
           'answerdate' => 'time_settings',
           'interval' => 'time_settings',
           'contentopen' => 'time_settings',
           'contentclose' => 'time_settings',
           'discussend' => 'time_settings',
           'weight' => 'grading',
           'handgrade' => 'grading',
           'maxtries' => 'tries',
           'hinttries' => 'tries',
           'type' => 'problem_appearance',
           'problemstatus' => 'problem_appearance',
           'display' => 'problem_appearance',
           'ordered' => 'problem_appearance',
           'numbubbles' => 'problem_appearance',
           'tol' => 'behaviour_of_input_fields',
           'sig' => 'behaviour_of_input_fields',
           'turnoffunit' => 'behaviour_of_input_fields',
           'hiddenresource' => 'hiding',
           'hiddenparts' => 'hiding',
           'discusshide' => 'hiding',
           'buttonshide' => 'hiding',
           'turnoffeditor' => 'hiding',
           'encrypturl' => 'hiding',
           'randomorder' => 'high_level_randomization',
           'randompick' => 'high_level_randomization',
           'available' => 'slots',
           'useslots' => 'slots',
           'availablestudent' => 'slots',
           'uploadedfiletypes' => 'file_submission',
           'maxfilesize' => 'file_submission',
           'cssfile' => 'misc',
           'mapalias' => 'misc',
           'acc' => 'misc',
           'maxcollaborators' => 'misc',
           'scoreformat' => 'misc',
   
       );    
   }
   
   sub whatIsMyCategory {
       my $name = shift;
       my $catList = shift;
       my @list;
       my %lookUpList = &lookUpTableParameter; #Initilize the lookupList
       my $cat = $lookUpList{$name};
       if (defined($cat)) {
           if (!defined($$catList{$cat})){
               push @list, ($name);
               $$catList{$cat} = \@list;
           } else {
               push @{${$catList}{$cat}}, ($name);     
           }
       } else {
           if (!defined($$catList{'misc'})){
               push @list, ($name);
               $$catList{'misc'} = \@list;
           } else {
               push @{${$catList}{'misc'}}, ($name);     
           }
       }        
   }
   
   sub keysindisplayorderCategory {
       my ($name,$keyorder)=@_;
       return sort {
       $$keyorder{'parameter_0_'.$a} <=> $$keyorder{'parameter_0_'.$b}; 
       } ( @{$name});
   }
   
   sub category_order {
       return (
           'time_settings' => 1,
           'grading' => 2,
           'tries' => 3,
           'problem_appearance' => 4,
           'hiding' => 5,
           'behaviour_of_input_fields' => 6,
           'high_level_randomization'  => 7,
           'slots' => 8,
           'file_submission' => 9,
           'misc' => 10
       );
   
 }  }
   
 sub parmboxes {  sub parmboxes {
     my ($r,$allparms,$pscat,$keyorder)=@_;      my ($r,$allparms,$pscat,$keyorder)=@_;
     my $tempkey;      my $tempkey;
       my $tempparameter;
       my %categories = &categories;
       my %category_order = &category_order();
       my %categoryList = (
           'time_settings' => [],
           'grading' => [],
           'tries' => [],
           'problem_appearance' => [],
           'behaviour_of_input_fields' => [],
           'hiding' => [],
           'high_level_randomization' => [],
           'slots' => [],
           'file_submission' => [],
           'misc' => [],
      );
       foreach $tempparameter (keys %$allparms) {
           &whatIsMyCategory($tempparameter, \%categoryList);
       }
     #part to print the parm-list      #part to print the parm-list
     $r->print('<table><tr><td><fieldset id="LC_parm_overview_parm_menu" style="display:none"><legend><b>'.&mt('Parameter').'</legend>');      $r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">'
     $r->print("\n".'<table>');               .'<legend>'.&mt('Parameter').'</legend>'."\n"
     my $cnt=0;      );
   
     $r->print('<tr>');      #Print parameters
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {      for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
  $r->print("\n".'<td><label><input type="checkbox" name="pscat" ');          if(@{$categoryList{$key}} == 0) {
  $r->print('value="'.$tempkey.'" ');              next;
         $r->print('onclick="checkboxChecked(\''.$tempkey.'\')"');          } else { 
  if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {              $r->print('<fieldset>'
     $r->print(' checked="checked"');                       .'<legend>'
  }                       .&mt($categories{$key})
         $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}                       .'</legend>'."\n");
                                                   : $tempkey)              foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
                   .'</label></td>');                      $r->print('<span class="LC_nobreak">'
   $cnt++;                               .'<label><input type="checkbox" name="pscat" ');
         if ($cnt==4) {              $r->print('value="'.$tempkey.'" ');
     $r->print("</tr>\n<tr>");                  $r->print('onclick="checkboxChecked(\''.$tempkey.'\')"');
     $cnt=0;              if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
  }                  $r->print(' checked="checked"');
     }              }
     $r->print('</tr>'                  $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
              .'</table>'                                                        : $tempkey)
              .'<a href="javascript:hideParms()" style="font-weight:normal">('.&mt('hide more parameter').')');                          .'</label></span> ');
               }
               $r->print('</fieldset>');
           }
       }
       $r->print('<hr />'
                .'<a href="javascript:hideParms()">'
                .&mt('Hide')
                .'</a>'
       );
   
     #&shortCuts($r,$allparms,$pscat,$keyorder);      #&shortCuts($r,$allparms,$pscat,$keyorder);
     $r->print('</fieldset></td></tr></table>');      $r->print('</fieldset>');
 }  }
   #
   # This function offers some links on the parameter section to get with one click a group a parameters
   #
 sub shortCuts {  sub shortCuts {
     my ($r,$allparms,$pscat,$keyorder)=@_;      my ($r,$allparms,$pscat,$keyorder)=@_;
   
     #part to print out the shortcuts for parmselection      #part to print out the shortcuts for parmselection
     $r->print('<table><tr id="LC_parm_overview_parm_menu_selectors">'      $r->print('<table><tr id="LC_parm_overview_parm_menu_selectors">'
              .'<td valign="top">'               .'<td valign="top">'
              .'<fieldset><legend><b>'.&mt('Parameter Selection').'</b></legend>'               .'<fieldset><legend>'.&mt('Parameter Selection').'</legend>'
              .'<span class="LC_nobreak">'               .'<span class="LC_nobreak">'
              .'&bull; <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>'               .'&bull; <a href="javascript:checkall(true, \'pscat\')">'.&mt('Select All').'</a>'
              .'</span>'               .'</span>'
Line 1421  sub shortCuts { Line 1559  sub shortCuts {
              .'</fieldset>'               .'</fieldset>'
              .'</td>'               .'</td>'
              .'<td colspan="2" valign="top">'               .'<td colspan="2" valign="top">'
              .'<fieldset><legend><b>'.&mt('Add Selection for...').'</b></legend>'               .'<fieldset><legend>'.&mt('Add Selection for...').'</legend>'
              .'<span class="LC_nobreak">'               .'<span class="LC_nobreak">'
              .'&bull; <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>'               .'&bull; <a href="javascript:checkdates()">'.&mt('Problem Dates').'</a>'
              .'</span>'               .'</span>'
Line 1500  sub usermenu { Line 1638  sub usermenu {
         $sections .= '&nbsp;'.&mt('or').'&nbsp;';          $sections .= '&nbsp;'.&mt('or').'&nbsp;';
         $sections .= qq|          $sections .= qq|
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 function group_or_section(caller) {  function group_or_section(caller) {
    if (caller == "cgroup") {     if (caller == "cgroup") {
        if (document.parmform.cgroup.selectedIndex != 0) {         if (document.parmform.cgroup.selectedIndex != 0) {
Line 1511  function group_or_section(caller) { Line 1650  function group_or_section(caller) {
        }         }
    }     }
 }  }
   // ]]>
 </script>  </script>
 |;  |;
     } else {      } else {
         $sections .= qq|          $sections .= qq|
 <script type="text/javascript">  <script type="text/javascript">
   // <![CDATA[
 function group_or_section(caller) {  function group_or_section(caller) {
     return;      return;
 }  }
   // ]]>
 </script>  </script>
 |;  |;
     }      }
Line 1560  function group_or_section(caller) { Line 1702  function group_or_section(caller) {
                  ,$chooseopt));                   ,$chooseopt));
 }  }
   
   #
   # This function shows on table Mode the available Parameters for the selected Resources
   #
 sub displaymenu {  sub displaymenu {
     my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_;      my ($r,$allparms,$allparts,$pscat,$psprt,$keyorder)=@_;
     $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters')));      $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters')));
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
     &parmmenu($r,$allparms,$pscat,$keyorder);      &parmmenu($r,$allparms,$pscat,$keyorder);
     #$r->print(&Apache::lonhtmlcommon::row_closure());  
     $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::lonhtmlcommon::end_pick_box());
     &parmboxes($r,$allparms,$pscat,$keyorder);      &parmboxes($r,$allparms,$pscat,$keyorder);
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
Line 1576  sub displaymenu { Line 1720  sub displaymenu {
 }  }
   
 sub mapmenu {  sub mapmenu {
     my ($r,$allmaps,$pschp,$maptitles)=@_;      my ($r,$allmaps,$pschp,$maptitles, $symbp)=@_;
       my %allmaps_inverted = reverse %$allmaps;
       my $navmap = Apache::lonnavmaps::navmap->new();
       my $tree=[];
       my $treeinfo={};
       if (defined($navmap)) {
           my $it=$navmap->getIterator(undef,undef,undef,1,undef,undef);
           my $curRes;
           my $depth = 0;
           my %parent = ();
           my $startcount = 5;
           my $lastcontainer = $startcount;
   # preparing what is to show ...
           while ($curRes = $it->next()) {
               if ($curRes == $it->BEGIN_MAP()) {
                   $depth++;
                   $parent{$depth}= $lastcontainer;
               }
               if ($curRes == $it->END_MAP()) {
                   $depth--;
                   $lastcontainer = $parent{$depth};
               }
               if (ref($curRes)) {
                   my $symb = $curRes->symb();
                   my $ressymb = $symb;
                   if (($curRes->is_sequence()) || ($curRes->is_page())) {
                       my $type = 'sequence';
                       if ($curRes->is_page()) {
                           $type = 'page';
                       }
                       my $id= $curRes->id();
                       my $srcf = $curRes->src();
                       my $resource_name = &Apache::lonnet::gettitle($srcf);
                       if(!exists($treeinfo->{$id})) {
                           push(@$tree,$id);
                           my $enclosing_map_folder = &Apache::lonnet::declutter($curRes->enclosing_map_src());    
                           $treeinfo->{$id} = {
                                       depth => $depth,
                                       type  => $type,
                                       name  => $resource_name,
                                       enclosing_map_folder => $enclosing_map_folder,
                                       };
                       }
                   }
               }
           }
       }
   # Show it ...
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Enclosing Map or Folder')));
     $r->print('<select name="pschp">');      if ((ref($tree) eq 'ARRAY') && (ref($treeinfo) eq 'HASH')) {
     $r->print('<option value="all">'.&mt('All Maps or Folders').'</option>');          my $icon = '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
     foreach (sort {$$allmaps{$a} cmp $$allmaps{$b}} keys %{$allmaps}) {          $r->print(&Apache::loncommon::start_data_table()
  $r->print('<option value="'.$_.'"');                   .&Apache::loncommon::start_data_table_row()
  if (($pschp eq $_)) { $r->print(' selected="selected"'); }                   .'<td>'.$icon
  $r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>');                   .'<label>&nbsp;'
                    .'<input type="radio" name="pschp" checked="checked" value="all" />'
                    .&mt('All Maps or Folders')
                    .'</label></td>'
                    .&Apache::loncommon::end_data_table_row()
           );
           my $whitespace = '<img src="'
                           .&Apache::loncommon::lonhttpdurl("/adm/lonIcons/whitespace_21.gif")
                           .'" alt="" />';
           if (exists($$allmaps{1})) {
               $r->print(&Apache::loncommon::start_data_table_row()
                   .'<td>'.$icon
                   .'<label>&nbsp;'
                   .'<input type="radio" name="pschp" value="1"'
               );
               if ($pschp eq 1) {
                   $r->print(' checked="checked"');
               }
               $r->print('/>'
                   .$$maptitles{1}
                   .($$allmaps{1} !~/^uploaded/?' ['.$$allmaps{1}.']':'')
                   .'</label>'
                   .'</td>'
                   .&Apache::loncommon::end_data_table_row()
               );
           }
           foreach my $id (@{$tree}) {
               my ($mapid,$resid)=split(/\./,$id);
               # Indentation
               my $depth = $treeinfo->{$id}->{'depth'};
               my $indent;
               for (my $i = 0; $i < $depth; $i++) {
                   $indent.= $whitespace;
               }
               $icon =  '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
               if ($treeinfo->{$id}->{'type'} eq 'page') {
                   $icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />';
               }
               my $symb_name = $$symbp{$id};
               my ($front, $tail) = split (/___${resid}___/, $symb_name);
               $symb_name = $tail;
               $r->print(&Apache::loncommon::start_data_table_row()
                        .'<td>'.$indent.$icon
                        .'<label>&nbsp;'
                        .'<input type ="radio" name="pschp" value="'.$allmaps_inverted{$symb_name}.'"'
               );
               if ($pschp eq $allmaps_inverted{$symb_name}) {
                   $r->print(' checked="checked"');
               }
               $r->print('/>'
                        .$treeinfo->{$id}->{name}
                        .($$allmaps{$mapid}!~/^uploaded/?' ['.$$allmaps{$mapid}.']':'')
                        .'</label>'
                        .'</td>'
                        .&Apache::loncommon::end_data_table_row()
               );
           }
           $r->print(&Apache::loncommon::end_data_table());
     }      }
     $r->print("</select>");  
   
 }  }
   
 sub levelmenu {  sub levelmenu {
Line 1765  sub assessparms { Line 2010  sub assessparms {
     } elsif ($udom=$env{'request.role.domain'}) {      } elsif ($udom=$env{'request.role.domain'}) {
     } elsif ($udom=$env{'user.domain'}) {      } elsif ($udom=$env{'user.domain'}) {
     } else {      } else {
  $udom=$r->dir_config('lonDefDomain');   $udom=$r->dir_config('lonDefDomain');
     }      }
       
   
     my @pscat=&Apache::loncommon::get_env_multiple('form.pscat');      my @pscat=&Apache::loncommon::get_env_multiple('form.pscat');
     my $pschp=$env{'form.pschp'};      my $pschp=$env{'form.pschp'};
Line 1786  sub assessparms { Line 2032  sub assessparms {
   
     if (($env{'form.command'} eq 'set') && ($env{'form.url'})      if (($env{'form.command'} eq 'set') && ($env{'form.url'})
  && (!$env{'form.dis'})) {   && (!$env{'form.dis'})) {
  my $url=$env{'form.url'};   my $url=$env{'form.url'};
  $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;   $url=~s-^http://($ENV{'SERVER_NAME'}|$ENV{'HTTP_HOST'})--;
  $pssymb=&Apache::lonnet::symbread($url);   $pssymb=&Apache::lonnet::symbread($url);
  if (!@pscat) { @pscat=('all'); }   if (!@pscat) { @pscat=('all'); }
  $pschp='';   $pschp='';
         $parmlev = 'full';          $parmlev = 'full';
     } elsif ($env{'form.symb'}) {      } elsif ($env{'form.symb'}) {
  $pssymb=$env{'form.symb'};   $pssymb=$env{'form.symb'};
  if (!@pscat) { @pscat=('all'); }   if (!@pscat) { @pscat=('all'); }
  $pschp='';   $pschp='';
         $parmlev = 'full';          $parmlev = 'full';
     } else {      } else {
  $env{'form.url'}='';   $env{'form.url'}='';
     }      }
   
     my $id=$env{'form.id'};      my $id=$env{'form.id'};
     if (($id) && ($udom)) {      if (($id) && ($udom)) {
  $uname=(&Apache::lonnet::idget($udom,$id))[1];   $uname=(&Apache::lonnet::idget($udom,$id))[1];
  if ($uname) {   if ($uname) {
     $id='';       $id='';
  } else {   } else {
     $message=       $message=
  '<span class="LC_error">'.&mt("Unknown ID")." '$id' ".   '<span class="LC_error">'.&mt("Unknown ID")." '$id' ".
  &mt('at domain')." '$udom'</span>";   &mt('at domain')." '$udom'</span>";
  }   }
     } else {      } else {
  $uname=$env{'form.uname'};   $uname=$env{'form.uname'};
     }      }
     unless ($udom) { $uname=''; }      unless ($udom) { $uname=''; }
     $uhome='';      $uhome='';
     if ($uname) {      if ($uname) {
  $uhome=&Apache::lonnet::homeserver($uname,$udom);   $uhome=&Apache::lonnet::homeserver($uname,$udom);
         if ($uhome eq 'no_host') {          if ($uhome eq 'no_host') {
     $message=       $message=
  '<span class="LC_error">'.&mt("Unknown user")." '$uname' ".   '<span class="LC_error">'.&mt("Unknown user")." '$uname' ".
  &mt("at domain")." '$udom'</span>";   &mt("at domain")." '$udom'</span>";
     $uname='';       $uname='';
         } else {          } else {
     $csec=&Apache::lonnet::getsection($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='<span class="LC_error">'.
  $message='<span class="LC_error">'.       &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".
     &mt("User")." '$uname' ".&mt("at domain")." '$udom' ".       &mt("not in this course")."</span>";
     &mt("not in this course")."</span>";   $uname='';
  $uname='';   $csec=$env{'form.csec'};
  $csec=$env{'form.csec'};  
                 $cgroup=$env{'form.cgroup'};                  $cgroup=$env{'form.cgroup'};
     } else {       } else {
  my %name=&Apache::lonnet::userenvironment($udom,$uname,   my %name=&Apache::lonnet::userenvironment($udom,$uname,
       ('firstname','middlename','lastname','generation','id'));         ('firstname','middlename','lastname','generation','id'));
  $message="\n<p>\n".&mt("Full Name").": ".   $message="\n<p>\n".&mt("Full Name").": ".
     $name{'firstname'}.' '.$name{'middlename'}.' '       $name{'firstname'}.' '.$name{'middlename'}.' '
  .$name{'lastname'}.' '.$name{'generation'}.   .$name{'lastname'}.' '.$name{'generation'}.
     "<br />\n".&mt('ID').": ".$name{'id'}.'<p>';      "<br />\n".&mt('ID').": ".$name{'id'}.'<p>';
     }       }
             @usersgroups = &Apache::lonnet::get_users_groups(              @usersgroups = &Apache::lonnet::get_users_groups(
                                        $udom,$uname,$env{'request.course.id'});                                         $udom,$uname,$env{'request.course.id'});
             if (@usersgroups > 0) {              if (@usersgroups > 0) {
Line 1868  sub assessparms { Line 2113  sub assessparms {
         my @markers=split(/\&\&\&/,$env{'form.pres_marker'});          my @markers=split(/\&\&\&/,$env{'form.pres_marker'});
         my @values=split(/\&\&\&/,$env{'form.pres_value'});          my @values=split(/\&\&\&/,$env{'form.pres_value'});
         my @types=split(/\&\&\&/,$env{'form.pres_type'});          my @types=split(/\&\&\&/,$env{'form.pres_type'});
  for (my $i=0;$i<=$#markers;$i++) {   for (my $i=0;$i<=$#markers;$i++) {
             if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {              if ($markers[$i] =~ /^[\d.]+\&0_availablestudent\&(1|2|3)$/) {
                 my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};                  my $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
                 my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};                  my $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
Line 1902  sub assessparms { Line 2147  sub assessparms {
                     }                      }
                 }                  }
             }              }
     $message.=&storeparm(split(/\&/,$markers[$i]),       $message.=&storeparm(split(/\&/,$markers[$i]),
  $values[$i],   $values[$i],
  $types[$i],   $types[$i],
  $uname,$udom,$csec,$cgroup);   $uname,$udom,$csec,$cgroup);
  }   }
 # ---------------------------------------------------------------- Done storing  # ---------------------------------------------------------------- Done storing
  $message.='<h3>'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'</h3>';      $message.='<p class="LC_warning">'
                    .&mt('Changes can take up to 10 minutes before being active for all students.')
                    .&Apache::loncommon::help_open_topic('Caching')
                    .'</p>';
     }      }
 #----------------------------------------------- if all selected, fill in array  #----------------------------------------------- if all selected, fill in array
     if ($pscat[0] eq "all") {@pscat = (keys %allparms);}      if ($pscat[0] eq "all") {@pscat = (keys %allparms);}
Line 1919  sub assessparms { Line 2167  sub assessparms {
     &startpage($r);      &startpage($r);
   
     foreach ('tolerance','date_default','date_start','date_end',      foreach ('tolerance','date_default','date_start','date_end',
      'date_interval','int','float','string') {      'date_interval','int','float','string') {
  $r->print('<input type="hidden" value="'.   $r->print('<input type="hidden" value="'.
   &HTML::Entities::encode($env{'form.recent_'.$_},'"&<>').    &HTML::Entities::encode($env{'form.recent_'.$_},'"&<>').
   '" name="recent_'.$_.'" />');    '" name="recent_'.$_.'" />');
     }      }
   
       # ----- Start Parameter Selection
   
       # Hide parm selection?
       $r->print(<<ENDPARMSELSCRIPT);
   <script type="text/javascript">
   // <![CDATA[
   function parmsel_show() {
     document.getElementById('parmsel').style.display = "";
     document.getElementById('parmsellink').style.display = "none";
   }
   // ]]>
   </script>
   ENDPARMSELSCRIPT
       my $parmselhiddenstyle=' style="display:none"';
       if($env{'form.hideparmsel'} eq 'hidden') {
           $r->print('<div id="parmsel"'.$parmselhiddenstyle.'>');
       } else  {
           $r->print('<div id="parmsel">');
       }
   
       # Display Unit 1 "General Parameters"
     if (!$pssymb) {      if (!$pssymb) {
         $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters')));          $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters')));
         $r->print(&Apache::lonhtmlcommon::start_pick_box());          $r->print(&Apache::lonhtmlcommon::start_pick_box());
   
         &levelmenu($r,\%alllevs,$parmlev);          &levelmenu($r,\%alllevs,$parmlev);
   
  if ($parmlev ne 'general') {   if ($parmlev ne 'general') {
             $r->print(&Apache::lonhtmlcommon::row_closure());          $r->print(&Apache::lonhtmlcommon::row_closure());
     &mapmenu($r,\%allmaps,$pschp,\%maptitles);       &mapmenu($r,\%allmaps,$pschp,\%maptitles, \%symbp);
  }   }
   
         $r->print(&Apache::lonhtmlcommon::row_closure(1));      $r->print(&Apache::lonhtmlcommon::row_closure(1));
         $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::lonhtmlcommon::end_pick_box());
              #Display Unit 2 "Select Parameter"   
  &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);   &displaymenu($r,\%allparms,\%allparts,\@pscat,\@psprt,\%keyorder);
     } else {      } else {
         my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);          my ($map,$id,$resource)=&Apache::lonnet::decode_symb($pssymb);
  my $title = &Apache::lonnet::gettitle($pssymb);   my $title = &Apache::lonnet::gettitle($pssymb);
         $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource).          $r->print(&mt('Specific Resource: [_1] ([_2])',$title,$resource).
                   '<input type="hidden" value="'.$pssymb.'" name="symb" />'.                  '<input type="hidden" value="'.$pssymb.'" name="symb" />'.
   '<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.     '<br /><label><b>'.&mt('Show all parts').': <input type="checkbox" name="psprt" value="all"'.
   ($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');     ($env{'form.psprt'}?' checked="checked"':'').' /></b></label><br />');
     }      }
     $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection')));      $r->print(&Apache::lonhtmlcommon::topic_bar (3,&mt('User Selection')));
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
Line 1954  sub assessparms { Line 2223  sub assessparms {
     $r->print(&Apache::lonhtmlcommon::row_closure(1));      $r->print(&Apache::lonhtmlcommon::row_closure(1));
     $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::lonhtmlcommon::end_pick_box());
           
       # parm selection is shown: display parm update button
       $r->print('<p>'
                .'<input type="submit" name="dis"'
                .' value="'.&mt('Update Parameter Display').'" />'
                .'<input type="hidden" name="hideparmsel" value="hidden" />'
                .'</p>'
       );
   
       $r->print('</div>');
       # ----- End Parameter Selection
   
       # Offer link to display parameter selection again
       $r->print('<p id="parmsellink"');
       if($env{'form.hideparmsel'} ne 'hidden') {
           $r->print($parmselhiddenstyle);
       }
       $r->print('>'
                .'<a href="javascript:parmsel_show()">'
                .&mt('Change Parameter Selection')
                .'</a>'
                .'</p>'
    );
   
     $r->print('<p>'.$message.'</p>');      # Display Messages
       $r->print('<div>'.$message.'</div>');
   
     $r->print('<br /><input type="submit" name="dis" value="'.&mt("Update Parameter Display").'" />');  
   
     my @temp_pscat;      my @temp_pscat;
     map {      map {
Line 1974  sub assessparms { Line 2265  sub assessparms {
         my $csudom=$env{'user.domain'};          my $csudom=$env{'user.domain'};
   
         if ($parmlev eq 'full') {          if ($parmlev eq 'full') {
            my $coursespan=$csec?8:5;          my $coursespan=$csec?8:5;
            my $userspan=3;              my $userspan=3;
            if ($cgroup ne '') {              if ($cgroup ne '') {
               $coursespan += 3;               $coursespan += 3;
            }              }
   
            $r->print('<p><table border="2">');              $r->print('<p><table border="2">');
            $r->print('<tr><td colspan="5"></td>');              $r->print('<tr><td colspan="5"></td>');
            $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');              $r->print('<th colspan="'.($coursespan).'">'.&mt('Any User').'</th>');
            if ($uname) {              if ($uname) {
                if (@usersgroups > 1) {              if (@usersgroups > 1) {
                    $userspan ++;                      $userspan ++;
                }                  }
                $r->print('<th colspan="'.$userspan.'" rowspan="2">');                  $r->print('<th colspan="'.$userspan.'" rowspan="2">');
                $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>");                  $r->print(&mt("User")." $uname ".&mt('at Domain')." $udom</th>");
            }              }
    my %lt=&Apache::lonlocal::texthash(     my %lt=&Apache::lonlocal::texthash(
   'pie'    => "Parameter in Effect",   'pie'    => "Parameter in Effect",
   'csv'    => "Current Session Value",   'csv'    => "Current Session Value",
                                   'at'     => 'at',                  'at'     => 'at',
                                   'rl'     => "Resource Level",                  'rl'     => "Resource Level",
   'ic'     => 'in Course',   'ic'     => 'in Course',
   'aut'    => "Assessment URL and Title",   'aut'    => "Assessment URL and Title",
   'type'   => 'Type',   'type'   => 'Type',
   'emof'   => "Enclosing Map or Folder",   'emof'   => "Enclosing Map or Folder",
   'part'   => 'Part',   'part'   => 'Part',
                                   'pn'     => 'Parameter Name',                  'pn'     => 'Parameter Name',
   'def'    => 'default',   'def'    => 'default',
   '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',
   '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 $lt{'at'} $csudom)</th>  <th rowspan="3">$lt{'csv'}<br />($csuname $lt{'at'} $csudom)</th>
 </tr><tr><td colspan="5"></td><th colspan="2">$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="3">'.              $r->print('<th colspan="3">'.
   &mt("in Section")." $csec</th>");     &mt("in Section")." $csec</th>");
            }              }
            if ($cgroup) {              if ($cgroup) {
                 $r->print('<th colspan="3">'.                  $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{'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>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');              $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
            }              }
   
            if ($cgroup) {              if ($cgroup) {
                $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');              $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</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>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');                  $r->print('<th>'.&mt('general').'</th><th>'.&mt('for Enclosing Map or Folder').'</th><th>'.&mt('for Resource').'</th>');
            }              }
   
            $r->print('</tr>');              $r->print('</tr>');
   
            my $defbgone='';              my $defbgone='';
            my $defbgtwo='';              my $defbgtwo='';
            my $defbgthree = '';              my $defbgthree = '';
   
            foreach (@ids) {              foreach (@ids) {
   
                 my $rid=$_;              my $rid=$_;
                 my ($inmapid)=($rid=~/\.(\d+)$/);                  my ($inmapid)=($rid=~/\.(\d+)$/);
   
                 if ((!$pssymb &&                  if ((!$pssymb &&
      (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))       (($pschp eq 'all') || ($allmaps{$pschp} eq $mapp{$rid})))
     ||       ||
     ($pssymb && $pssymb eq $symbp{$rid})) {       ($pssymb && $pssymb eq $symbp{$rid})) {
 # ------------------------------------------------------ Entry for one resource  # ------------------------------------------------------ Entry for one resource
                     if ($defbgone eq '#E0E099') {                  if ($defbgone eq '#E0E099') {
                         $defbgone='#E0E0DD';                      $defbgone='#E0E0DD';
                     } else {                      } else {
                         $defbgone='#E0E099';                          $defbgone='#E0E099';
                     }                      }
                     if ($defbgtwo eq '#FFFF99') {                      if ($defbgtwo eq '#FFFF99') {
                         $defbgtwo='#FFFFDD';                      $defbgtwo='#FFFFDD';
                     } else {                      } else {
                         $defbgtwo='#FFFF99';                      $defbgtwo='#FFFF99';
                     }                      }
                     if ($defbgthree eq '#FFBB99') {                      if ($defbgthree eq '#FFBB99') {
                         $defbgthree='#FFBBDD';                          $defbgthree='#FFBBDD';
Line 2109  ENDTABLEHEADFOUR Line 2400  ENDTABLEHEADFOUR
                     }                      }
                     my $totalparms=scalar keys %name;                      my $totalparms=scalar keys %name;
                     if ($totalparms>0) {                      if ($totalparms>0) {
                         my $firstrow=1;                      my $firstrow=1;
  my $title=&Apache::lonnet::gettitle($symbp{$rid});   my $title=&Apache::lonnet::gettitle($symbp{$rid});
                         $r->print('<tr><td style="background-color:'.$defbgone.';"'.                          $r->print('<tr><td style="background-color:'.$defbgone.';"'.
                              ' rowspan='.$totalparms.                               ' rowspan='.$totalparms.
                              '><tt><font size="-1">'.                               '><tt><font size="-1">'.
                              join(' / ',split(/\//,$uri)).                               join(' / ',split(/\//,$uri)).
                              '</font></tt><p><b>'.                               '</font></tt><p><b>'.
                              "<a href=\"javascript:openWindow('".                               "<a href=\"javascript:openWindow('".
   &Apache::lonnet::clutter($uri).'?symb='.     &Apache::lonnet::clutter($uri).'?symb='.
   &escape($symbp{$rid}).     &escape($symbp{$rid}).
                              "', 'metadatafile', '450', '500', 'no', 'yes');\"".                               "', 'metadatafile', '450', '500', 'no', 'yes');\"".
                              " target=\"_self\">$title");                               " target=\"_self\">$title");
   
                         if ($thistitle) {                          if ($thistitle) {
                             $r->print(' ('.$thistitle.')');                          $r->print(' ('.$thistitle.')');
                         }                          }
                         $r->print('</a></b></td>');                          $r->print('</a></b></td>');
                         $r->print('<td style="background-color:'.$defbgtwo.';"'.                          $r->print('<td style="background-color:'.$defbgtwo.';"'.
Line 2167  ENDTABLEHEADFOUR Line 2458  ENDTABLEHEADFOUR
   
 #-------------------------------------------- for each map, gather information  #-------------------------------------------- for each map, gather information
             my $mapid;              my $mapid;
     foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {     foreach $mapid (sort {$maplist{$a} cmp $maplist{$b}} keys %maplist) {
                 my $maptitle = $maplist{$mapid};                  my $maptitle = $maplist{$mapid};
   
 #-----------------------  loop through ids and get all parameter types for map  #-----------------------  loop through ids and get all parameter types for map
Line 2182  ENDTABLEHEADFOUR Line 2473  ENDTABLEHEADFOUR
 # $r->print("Catmarker: @catmarker<br />\n");  # $r->print("Catmarker: @catmarker<br />\n");
   
                 foreach (@ids) {                  foreach (@ids) {
                   ($map)=(/([\d]*?)\./);                  ($map)=(/([\d]*?)\./);
                   my $rid = $_;                    my $rid = $_;
   
 #                  $r->print("$mapid:$map:   $rid <br /> \n");  #                  $r->print("$mapid:$map:   $rid <br /> \n");
   
                   if ($map eq $mapid) {                    if ($map eq $mapid) {
                     my $uri=&Apache::lonnet::declutter($uris{$rid});                      my $uri=&Apache::lonnet::declutter($uris{$rid});
 #                    $r->print("Keys: $keyp{$rid} <br />\n");  #                    $r->print("Keys: $keyp{$rid} <br />\n");
   
 #--------------------------------------------------------------------  #--------------------------------------------------------------------
Line 2198  ENDTABLEHEADFOUR Line 2489  ENDTABLEHEADFOUR
 # When storing information, store as part 0  # When storing information, store as part 0
 # When requesting information, request from full part  # When requesting information, request from full part
 #-------------------------------------------------------------------  #-------------------------------------------------------------------
                     foreach (&keysplit($keyp{$rid})) {                     foreach (&keysplit($keyp{$rid})) {
                       my $tempkeyp = $_;                      my $tempkeyp = $_;
                       my $fullkeyp = $tempkeyp;                        my $fullkeyp = $tempkeyp;
                       $tempkeyp =~ s/_\w+_/_0_/;                        $tempkeyp =~ s/_\w+_/_0_/;
   
                       if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {                        if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                         $part{$tempkeyp}="0";                          $part{$tempkeyp}="0";
                         $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');                          $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
                         my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');                          my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
                         if ($allparms{$name{$tempkeyp}} ne '') {                          if ($allparms{$name{$tempkeyp}} ne '') {
                             my $identifier;                              my $identifier;
                             if ($parmdis =~ /(\s*\[Part.*)$/) {                              if ($parmdis =~ /(\s*\[Part.*)$/) {
                                 $identifier = $1;                                  $identifier = $1;
                             }                              }
                             $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;                              $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
                         } else {                          } else {
                             $display{$tempkeyp} = $parmdis;                              $display{$tempkeyp} = $parmdis;
                         }                          }
                         unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }                          unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
                         $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';                          $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
                         $display{$tempkeyp} =~ s/_\w+_/_0_/;                          $display{$tempkeyp} =~ s/_\w+_/_0_/;
                         $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);                          $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
                         $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');                          $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
                       }                        }
                     } # end loop through keys                      } # end loop through keys
                   }                    }
                 } # end loop through ids                  } # end loop through ids
   
 #---------------------------------------------------- print header information  #---------------------------------------------------- print header information
Line 2231  ENDTABLEHEADFOUR Line 2522  ENDTABLEHEADFOUR
                 my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');                  my $showtitle=$maptitles{$maptitle}.($maptitle!~/^uploaded/?' ['.$maptitle.']':'');
                 my $tmp="";                  my $tmp="";
                 if ($uname) {                  if ($uname) {
     my $person=&Apache::loncommon::plainname($uname,$udom);       my $person=&Apache::loncommon::plainname($uname,$udom);
                     $tmp.=&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ".                      $tmp.=&mt("User")." <font color=\"red\"><i>$uname \($person\) </i></font> ".
                         &mt('in')." \n";                          &mt('in')." \n";
                 } else {                  } else {
Line 2262  ENDTABLEHEADFOUR Line 2553  ENDTABLEHEADFOUR
                          .&Apache::loncommon::end_data_table_header_row()                           .&Apache::loncommon::end_data_table_header_row()
                 );                  );
   
         foreach (&keysinorder(\%name,\%keyorder)) {           foreach (&keysinorder(\%name,\%keyorder)) {
                     $r->print(&Apache::loncommon::start_data_table_row());                  $r->print(&Apache::loncommon::start_data_table_row());
                     &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,                      &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                            \%type,\%display,$defbgone,$defbgtwo,$defbgthree,                             \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
                            $parmlev,$uname,$udom,$csec,$cgroup);                             $parmlev,$uname,$udom,$csec,$cgroup);
Line 2275  ENDTABLEHEADFOUR Line 2566  ENDTABLEHEADFOUR
         } # end of $parmlev eq map          } # end of $parmlev eq map
 #--------------------------------- Entry for parm level general (Course level)  #--------------------------------- Entry for parm level general (Course level)
         if ($parmlev eq 'general') {          if ($parmlev eq 'general') {
             my $defbgone = '#E0E099';          my $defbgone = '#E0E099';
             my $defbgtwo = '#FFFF99';              my $defbgtwo = '#FFFF99';
             my $defbgthree = '#FFBB99';              my $defbgthree = '#FFBB99';
   
Line 2301  ENDTABLEHEADFOUR Line 2592  ENDTABLEHEADFOUR
 # When storing information, store as part 0  # When storing information, store as part 0
 # When requesting information, request from full part  # When requesting information, request from full part
 #-------------------------------------------------------------------  #-------------------------------------------------------------------
                 foreach (&keysplit($keyp{$rid})) {              foreach (&keysplit($keyp{$rid})) {
                   my $tempkeyp = $_;                  my $tempkeyp = $_;
                   my $fullkeyp = $tempkeyp;                    my $fullkeyp = $tempkeyp;
                   $tempkeyp =~ s/_\w+_/_0_/;                    $tempkeyp =~ s/_\w+_/_0_/;
                   if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {                    if ((grep $_ eq $fullkeyp, @catmarker) &&(!$name{$tempkeyp})) {
                     $part{$tempkeyp}="0";                      $part{$tempkeyp}="0";
                     $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');                      $name{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.name');
                     my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');                      my $parmdis=&Apache::lonnet::metadata($uri,$fullkeyp.'.display');
                     if ($allparms{$name{$tempkeyp}} ne '') {                      if ($allparms{$name{$tempkeyp}} ne '') {
                         my $identifier;                          my $identifier;
                         if ($parmdis =~ /(\s*\[Part.*)$/) {                          if ($parmdis =~ /(\s*\[Part.*)$/) {
                             $identifier = $1;                              $identifier = $1;
                         }                          }
                         $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;                          $display{$tempkeyp} = $allparms{$name{$tempkeyp}}.$identifier;
                     } else {                      } else {
                         $display{$tempkeyp} = $parmdis;                          $display{$tempkeyp} = $parmdis;
                     }                      }
                     unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }                      unless ($display{$tempkeyp}) { $display{$tempkeyp}=''; }
                     $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';                      $display{$tempkeyp}.=' ('.$name{$tempkeyp}.')';
                     $display{$tempkeyp} =~ s/_\w+_/_0_/;                      $display{$tempkeyp} =~ s/_\w+_/_0_/;
                     $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);                      $default{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp);
                     $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');                      $type{$tempkeyp}=&Apache::lonnet::metadata($uri,$fullkeyp.'.type');
                   }                    }
                 } # end loop through keys                  } # end loop through keys
             } # end loop through ids              } # end loop through ids
   
 #---------------------------------------------------- print header information  #---------------------------------------------------- print header information
     my $setdef=&mt("Set Defaults for All Resources in Course");       my $setdef=&mt("Set Defaults for All Resources in Course");
             $r->print(<<ENDMAPONE);              $r->print(<<ENDMAPONE);
 <center>  <center>
 <h4>$setdef  <h4>$setdef
 <font color="red"><i>$coursename</i></font><br />  <font color="red"><i>$coursename</i></font><br />
 ENDMAPONE  ENDMAPONE
             if ($uname) {              if ($uname) {
  my $person=&Apache::loncommon::plainname($uname,$udom);   my $person=&Apache::loncommon::plainname($uname,$udom);
                 $r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n");                  $r->print(" ".&mt("User")."<font color=\"red\"> <i>$uname \($person\) </i></font> \n");
             } else {              } else {
                 $r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n");                  $r->print("<i><font color=\"red\"> ".&mt("ALL")."</i> ".&mt("USERS")."</font> \n");
Line 2353  ENDMAPONE Line 2644  ENDMAPONE
                      .&Apache::loncommon::end_data_table_header_row()                       .&Apache::loncommon::end_data_table_header_row()
             );              );
   
     foreach (&keysinorder(\%name,\%keyorder)) {       foreach (&keysinorder(\%name,\%keyorder)) {
                 $r->print(&Apache::loncommon::start_data_table_row());                  $r->print(&Apache::loncommon::start_data_table_row());
                 &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,                  &print_row($r,$_,\%part,\%name,\%symbp,$mapid,\%default,
                        \%type,\%display,$defbgone,$defbgtwo,$defbgthree,                         \%type,\%display,$defbgone,$defbgtwo,$defbgthree,
Line 2647  sub listdata { Line 2938  sub listdata {
 #  #
 # Ready to print  # Ready to print
 #  #
               my $parmitem = &standard_parameter_names($name);
     $r->print(&tablestart().      $r->print(&tablestart().
       &Apache::loncommon::start_data_table_row().        &Apache::loncommon::start_data_table_row().
       '<td><b>'.&standard_parameter_names($name).        '<td><b>'.&mt($parmitem).
       '</b></td><td><input type="checkbox" name="del_'.        '</b></td><td><input type="checkbox" name="del_'.
       $thiskey.'" /></td><td>');        $thiskey.'" /></td><td>');
     $foundkeys++;      $foundkeys++;
Line 2865  ENDOVER Line 3157  ENDOVER
   
     #$r->print('<table id="LC_parm_overview_scope">      #$r->print('<table id="LC_parm_overview_scope">
     #           <tr><td class="LC_parm_overview_level_menu">');      #           <tr><td class="LC_parm_overview_level_menu">');
     $r->print('<div class="LC_ContentBoxSpecial">');      $r->print('<div class="LC_Box">');
     #$r->print('<h2 class="LC_hcell">Step 1</h2>');      #$r->print('<h2 class="LC_hcell">Step 1</h2>');
     $r->print('<div>');      $r->print('<div>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
Line 2883  ENDOVER Line 3175  ENDOVER
   
     #$r->print('<table id="LC_parm_overview_controls">      #$r->print('<table id="LC_parm_overview_controls">
     #           <tr><td class="LC_parm_overview_parm_selectors">');      #           <tr><td class="LC_parm_overview_parm_selectors">');
     $r->print('<div class="LC_ContentBoxSpecial">');      $r->print('<div class="LC_Box">');
     $r->print('<div>');      $r->print('<div>');
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
     &parmmenu($r,\%allparms,\@pscat,\%keyorder);      &parmmenu($r,\%allparms,\@pscat,\%keyorder);
     #$r->print(&Apache::lonhtmlcommon::row_closure());  
     $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::lonhtmlcommon::end_pick_box());
     &parmboxes($r,\%allparms,\@pscat,\%keyorder);      &parmboxes($r,\%allparms,\@pscat,\%keyorder);
     $r->print(&Apache::lonhtmlcommon::start_pick_box());      $r->print(&Apache::lonhtmlcommon::start_pick_box());
Line 2907  ENDOVER Line 3198  ENDOVER
     $r->print(&Apache::lonhtmlcommon::end_pick_box());      $r->print(&Apache::lonhtmlcommon::end_pick_box());
     $r->print('</div></div>');      $r->print('</div></div>');
   
     $r->print('<div class="LC_ContentBoxSpecial">');      $r->print('<div class="LC_Box">');
     $r->print('<div>');      $r->print('<div>');
     my $sortorder=$env{'form.sortorder'};      my $sortorder=$env{'form.sortorder'};
     unless ($sortorder) { $sortorder='realmstudent'; }      unless ($sortorder) { $sortorder='realmstudent'; }
Line 3064  ENDOVER Line 3355  ENDOVER
  $display_value =   $display_value =
     &Apache::lonlocal::locallocaltime($display_value);      &Apache::lonlocal::locallocaltime($display_value);
     }      }
               my $parmitem = &standard_parameter_names($data{'parameter_name'});
               $parmitem = &mt($parmitem);
     $r->print(&mt('Parameter: "[_1]" with value: "[_2]"',      $r->print(&mt('Parameter: "[_1]" with value: "[_2]"',
   &standard_parameter_names($data{'parameter_name'}),    $parmitem,$resourcedata->{$thiskey}));
   $resourcedata->{$thiskey}));  
     $r->print('<br />');      $r->print('<br />');
     if ($data{'scope_type'} eq 'all') {      if ($data{'scope_type'} eq 'all') {
  $r->print(&mt('All users'));   $r->print(&mt('All users'));
Line 3928  sub components { Line 4220  sub components {
 }  }
   
 my %standard_parms;  my %standard_parms;
   my %standard_parms_types;
   
 sub load_parameter_names {  sub load_parameter_names {
     open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab");      open(my $config,"<$Apache::lonnet::perlvar{'lonTabDir'}/packages.tab");
Line 3939  sub load_parameter_names { Line 4231  sub load_parameter_names {
  my (undef,$name,$type)=split(/\&/,$short,3);   my (undef,$name,$type)=split(/\&/,$short,3);
  if ($type eq 'display') {   if ($type eq 'display') {
     $standard_parms{$name} = $plain;      $standard_parms{$name} = $plain;
  }          } elsif ($type eq 'type') {
               $standard_parms_types{$name} = $plain;
           }
     }      }
     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=&Apache::lonlocal::texthash(%standard_parms);  
 }  }
   
 sub standard_parameter_names {  sub standard_parameter_names {
Line 3959  sub standard_parameter_names { Line 4252  sub standard_parameter_names {
     }      }
 }  }
   
   sub standard_parameter_types {
       my ($name)=@_;
       if (!%standard_parms_types) {
           &load_parameter_names();
       }
       if ($standard_parms_types{$name}) {
           return $standard_parms_types{$name};
       }
       return;
   }
   
 sub parm_change_log {  sub parm_change_log {
     my ($r)=@_;      my ($r)=@_;
Line 4057  sub parm_change_log { Line 4359  sub parm_change_log {
     } else {      } else {
  $makenewrow=1;   $makenewrow=1;
     }      }
               my $parmitem = &standard_parameter_names($parmname);
     $output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'.      $output .='<td>'.$realm.'</td><td>'.$section.'</td><td>'.
       &standard_parameter_names($parmname).'</td><td>'.        &mt($parmitem).'</td><td>'.
       ($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>';        ($part?&mt('Part: [_1]',$part):&mt('All Parts')).'</td><td>';
     my $stillactive=0;      my $stillactive=0;
     if ($parmlog{$id}{'delflag'}) {      if ($parmlog{$id}{'delflag'}) {
  $output .= &mt('Deleted');   $output .= &mt('Deleted');
     } else {      } else {
  if ($typeflag) {   if ($typeflag) {
     $output .= &mt('Type: [_1]',&standard_parameter_names($value));                      my $parmitem = &standard_parameter_names($value); 
                       $parmitem = &mt($parmitem);
       $output .= &mt('Type: [_1]',$parmitem);
  } else {   } else {
     my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),      my ($level,@all)=&parmval_by_symb($what,$middle,&Apache::lonnet::metadata($middle,$what),
       $uname,$udom,$issection,$issection,$courseopt);        $uname,$udom,$issection,$issection,$courseopt);
     if (&isdateparm($istype{$parmname})) {                      my $showvalue = $value;
  $output .= &Apache::lonlocal::locallocaltime($value);                      if ($istype{$parmname} eq '') {
     } else {                          my $type = &standard_parameter_types($parmname);
  $output .= $value;                          if ($type ne '') {
     }                              if (&isdateparm($type)) {
                                   $showvalue =
                                       &Apache::lonlocal::locallocaltime($value);
                               }
                           }
                       } else {
           if (&isdateparm($istype{$parmname})) {
       $showvalue = 
                                   &Apache::lonlocal::locallocaltime($value);
           }
                       }
                       $output .= $showvalue;
     if ($value ne $all[$level]) {      if ($value ne $all[$level]) {
  $output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>';   $output .= '<br /><span class="LC_warning">'.&mt('Not active anymore').'</span>';
     } else {      } else {
Line 4082  sub parm_change_log { Line 4398  sub parm_change_log {
  }   }
     }      }
     $output .= '</td><td>';      $output .= '</td><td>';
               
     if ($stillactive) {      if ($stillactive) {
  my $title=&mt('Changed [_1]',&standard_parameter_names($parmname));                  my $parmitem = &standard_parameter_names($parmname);
                 my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription,                  $parmitem = &mt($parmitem);
    my $title=&mt('Changed [_1]',$parmitem);
                   my $description=&mt('Changed [_1] for [_2] to [_3]',
                                       $parmitem,$realmdescription,
     (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));      (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));
  if (($uname) && ($udom)) {   if (($uname) && ($udom)) {
     $output .=      $output .=

Removed from v.1.453  
changed lines
  Added in v.1.472


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