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

version 1.453, 2009/06/03 17:17:03 version 1.464, 2009/06/30 14:59:17
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 1248  sub parmmenu { Line 1249  sub parmmenu {
     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 1269  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 1334  sub parmmenu { Line 1338  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));
 }  }
   
 sub parmboxes {  sub parmboxes {
Line 1372  sub parmboxes { Line 1374  sub parmboxes {
     my $tempkey;      my $tempkey;
   
     #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"
                .'<table>'
       );
     my $cnt=0;      my $cnt=0;
   
     $r->print('<tr>');      $r->print('<tr>');
Line 1395  sub parmboxes { Line 1400  sub parmboxes {
     }      }
     $r->print('</tr>'      $r->print('</tr>'
              .'</table>'               .'</table>'
              .'<a href="javascript:hideParms()" style="font-weight:normal">('.&mt('hide more parameter').')');               .'<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>');
 }  }
 sub shortCuts {  sub shortCuts {
     my ($r,$allparms,$pscat,$keyorder)=@_;      my ($r,$allparms,$pscat,$keyorder)=@_;
Line 1406  sub shortCuts { Line 1415  sub shortCuts {
     #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 1430  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 1509  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 1521  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 1565  sub displaymenu { Line 1578  sub displaymenu {
     $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 1577  sub displaymenu { Line 1589  sub displaymenu {
   
 sub mapmenu {  sub mapmenu {
     my ($r,$allmaps,$pschp,$maptitles)=@_;      my ($r,$allmaps,$pschp,$maptitles)=@_;
       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;
   
           while ($curRes = $it->next()) {
               if ($curRes == $it->BEGIN_MAP()) {
                   $depth++;
               }
               if ($curRes == $it->END_MAP()) {
                   $depth--;
               }
               if (ref($curRes)) {
                   if (($curRes->is_sequence()) || ($curRes->is_page())) {
                       my $type = 'sequence';
                       if ($curRes->is_page()) {
                           $type = 'page';
                       }
                       my $id= $curRes->id();
                       my ($mapid,$resid)=split(/\./,$id);
                       if(!exists($treeinfo->{$mapid})) {
                           push(@$tree,$mapid);    
                           $treeinfo->{$mapid} = {
                                       depth => $depth,
                                       type  => $type,
                                       };
                       }
                   }
               }
           }
       }
   
     $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="" />';
           foreach my $mapid (@{$tree}) {
               # Indentation
               my $depth = $treeinfo->{$mapid}->{'depth'};
               my $indent;
               for (my $i = 0; $i < $depth; $i++) {
                   $indent.= $whitespace;
               }
               $icon =  '<img src="/adm/lonIcons/navmap.folder.open.gif" alt="" />';
               if ($treeinfo->{$mapid}->{'type'} eq 'page') {
                   $icon = '<img src="/adm/lonIcons/navmap.page.open.gif" alt="" />';
               }
               $r->print(&Apache::loncommon::start_data_table_row()
                        .'<td>'.$indent.$icon
                        .'<label>&nbsp;'
                        .'<input type ="radio" name="pschp" value="'.$mapid.'"'
               );
               if ($pschp eq $mapid) {
                   $r->print(' checked="checked"');
               }
               $r->print('/>'
                        .$$maptitles{$mapid}
                        .($$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 1908  sub assessparms { Line 1988  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 1925  sub assessparms { Line 2008  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 parameter selection boxes
     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 1954  sub assessparms { Line 2058  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 2865  ENDOVER Line 2990  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 3008  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 3031  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'; }

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


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