Diff for /loncom/interface/lonparmset.pm between versions 1.460 and 1.461

version 1.460, 2009/06/10 16:06:13 version 1.461, 2009/06/17 20:01:57
Line 1589  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);
                       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('<table><tr><td>'.$icon.'<label>&nbsp;<input type="radio" name="pschp" value="all"/>'.&mt('All Maps or Folders').'</td></tr>');
  $r->print('<option value="'.$_.'"');          foreach my $mapid (@{$tree}) {
  if (($pschp eq $_)) { $r->print(' selected="selected"'); }              my $depth = $treeinfo->{$mapid}->{'depth'};
  $r->print('>'.$$maptitles{$_}.($$allmaps{$_}!~/^uploaded/?' ['.$$allmaps{$_}.']':'').'</option>');              my $indent = ('&nbsp;'x$depth);
               $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('<tr><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></tr>');
           }
           $r->print('</table>');
     }      }
     $r->print("</select>");  
   
 }  }
   
 sub levelmenu {  sub levelmenu {

Removed from v.1.460  
changed lines
  Added in v.1.461


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