--- loncom/interface/lonparmset.pm 2009/06/10 16:06:13 1.460 +++ loncom/interface/lonparmset.pm 2009/06/17 20:01:57 1.461 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.460 2009/06/10 16:06:13 bisitz Exp $ +# $Id: lonparmset.pm,v 1.461 2009/06/17 20:01:57 neumanie Exp $ # # Copyright Michigan State University Board of Trustees # @@ -1589,17 +1589,57 @@ sub displaymenu { sub mapmenu { 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(''.&mt('All Maps or Folders').''); + foreach my $mapid (@{$tree}) { + my $depth = $treeinfo->{$mapid}->{'depth'}; + my $indent = (' 'x$depth); + $icon = ''; + if ($treeinfo->{$mapid}->{'type'} eq 'page') { + $icon = ''; + } + $r->print(''.$indent.$icon.''); + } + $r->print(''); } - $r->print(""); - } sub levelmenu {