Diff for /loncom/interface/lonparmset.pm between versions 1.452 and 1.470

version 1.452, 2009/05/30 21:52:30 version 1.470, 2009/09/03 16:05:20
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 displayOverview = "";
           
           if (value == false) {
               displayOverview = "none"
           }
   
  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) {
                 document.forms.parmform.elements[i].checked=value;                  document.forms.parmform.elements[i].checked=value;
                   document.getElementById(document.forms.parmform.elements[i].value.concat(li)).style.display = displayOverview;
             }              }
         }          }
     }      }
   
     function checkthis(thisvalue, checkName) {      function checkthis(thisvalue, checkName) {
   
           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 1284  sub parmmenu { Line 1302  sub parmmenu {
   checkthis('contentclose','pscat');    checkthis('contentclose','pscat');
     }      }
   
   
     function checkvisi() {      function checkvisi() {
  checkthis('hiddenresource','pscat');   checkthis('hiddenresource','pscat');
   checkthis('encrypturl','pscat');    checkthis('encrypturl','pscat');
Line 1306  sub parmmenu { Line 1323  sub parmmenu {
  checkthis('maxtries','pscat');   checkthis('maxtries','pscat');
     }      }
   
       function hideParms() {
           document.getElementById('LC_parm_overview_parm_menu').style.display = "none";
       }
   
       function showParms() {
           document.getElementById('LC_parm_overview_parm_menu').style.display = "";
       }
   
       function checkboxChecked(id) {
           var li = "_li";
           var id_li = id.concat(li);
           if (document.getElementById(id_li).style.display == "none") {
               document.getElementById(id_li).style.display = "";
           }
           else {
               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')));
     $r->print("\n".'<table id="LC_parm_overview_parm_menu"><tr>');  
     my $cnt=0;      #part to print selected parms overview
       $r->print(&mt('Selected Parameters:').'<br />');
   
       #print out all possible parms and hide them by default
       $r->print('<ul>');
     foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {      foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) {
  $r->print("\n".'<td><label><input type="checkbox" name="pscat" ');          $r->print('<li id="'.$tempkey.'_li" value="'.$tempkey.'_li" name="pscat_li"');
  $r->print('value="'.$tempkey.'"');          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(' checked="checked"');          }
  }          $r->print('>'
         $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}                   .($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey} : $tempkey)
                                                   : $tempkey)                   .'</li>'
                   .'</label></td>');          );
   $cnt++;      }
         if ($cnt==3) {      $r->print('</ul>'
     $r->print("</tr>\n<tr>");               .'<p><a href="javascript:showParms()">'
     $cnt=0;               .&mt('Show detailed Parameter Selection')
  }               .'</a></p>'
     }      );
     $r->print('</tr>'  
              .'<tr id="LC_parm_overview_parm_menu_selectors">'      &shortCuts($r,$allparms,$pscat,$keyorder);
   
       $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 {
       my ($r,$allparms,$pscat,$keyorder)=@_;
       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
       $r->print('<fieldset id="LC_parm_overview_parm_menu" style="display:none">'
                .'<legend>'.&mt('Parameter').'</legend>'."\n"
       );
   
       #Print parameters
       for my $key (sort { $category_order{$a} <=> $category_order{$b} } keys %categoryList) {
           if(@{$categoryList{$key}} == 0) {
               next;
           } else { 
               $r->print('<fieldset>'
                        .'<legend>'
                        .&mt($categories{$key})
                        .'</legend>'."\n");
               foreach $tempkey (&keysindisplayorderCategory($categoryList{$key},$keyorder)) {
                       $r->print('<span class="LC_nobreak">'
                                .'<label><input type="checkbox" name="pscat" ');
               $r->print('value="'.$tempkey.'" ');
                   $r->print('onclick="checkboxChecked(\''.$tempkey.'\')"');
               if ($$pscat[0] eq "all" || grep $_ eq $tempkey, @{$pscat}) {
                   $r->print(' checked="checked"');
               }
                   $r->print(' />'.($$allparms{$tempkey}=~/\S/ ? $$allparms{$tempkey}
                                                         : $tempkey)
                           .'</label></span> ');
               }
               $r->print('</fieldset>');
           }
       }
       $r->print('<hr />'
                .'<a href="javascript:hideParms()">'
                .&mt('Hide')
                .'</a>'
       );
   
       #&shortCuts($r,$allparms,$pscat,$keyorder);
       $r->print('</fieldset>');
   }
   #
   # This function offers some links on the parameter section to get with one click a group a parameters
   #
   sub shortCuts {
       my ($r,$allparms,$pscat,$keyorder)=@_;
   
       #part to print out the shortcuts for parmselection
       $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 1345  ENDSCRIPT Line 1559  ENDSCRIPT
              .'</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 1365  ENDSCRIPT Line 1579  ENDSCRIPT
              .'</span>'               .'</span>'
              .'</fieldset>'               .'</fieldset>'
              .'</td>'               .'</td>'
              .'</tr></table>'               .'</tr></table>');
     );  
 }  }
   
 sub partmenu {  sub partmenu {
Line 1425  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 1436  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 1485  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());
       &parmboxes($r,$allparms,$pscat,$keyorder);
       $r->print(&Apache::lonhtmlcommon::start_pick_box());
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));
     &partmenu($r,$allparts,$psprt);      &partmenu($r,$allparts,$psprt);
     $r->print(&Apache::lonhtmlcommon::row_closure(1));      $r->print(&Apache::lonhtmlcommon::row_closure(1));
Line 1499  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 1690  sub assessparms { Line 2012  sub assessparms {
     } 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 1831  sub assessparms { Line 2154  sub assessparms {
  $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 1848  sub assessparms { Line 2174  sub assessparms {
   '" 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());
Line 1856  sub assessparms { Line 2203  sub assessparms {
   
  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);
Line 1877  sub assessparms { Line 2224  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
   
     $r->print('<p>'.$message.'</p>');      # 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>');
   
       # 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 2570  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 2788  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 2806  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());
       &parmboxes($r,\%allparms,\@pscat,\%keyorder);
       $r->print(&Apache::lonhtmlcommon::start_pick_box());
     $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));      $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parts to View')));
     #$r->print('</td><td class="LC_parm_overview_restrictions">'.      #$r->print('</td><td class="LC_parm_overview_restrictions">'.
      $r->print('<table>'.       $r->print('<table>'.
Line 2828  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 2985  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 3849  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 3860  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 3880  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 3978  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 4003  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);
                   $parmitem = &mt($parmitem);
    my $title=&mt('Changed [_1]',$parmitem);
                 my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription,                  my $description=&mt('Changed [_1] for [_2] to [_3]',&standard_parameter_names($parmname),$realmdescription,
     (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));      (&isdateparm($istype{$parmname})?&Apache::lonlocal::locallocaltime($value):$value));
  if (($uname) && ($udom)) {   if (($uname) && ($udom)) {

Removed from v.1.452  
changed lines
  Added in v.1.470


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