--- loncom/interface/lonparmset.pm 2009/05/27 13:36:46 1.451 +++ loncom/interface/lonparmset.pm 2009/06/30 14:30:26 1.463 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Handler to set parameters for assessments # -# $Id: lonparmset.pm,v 1.451 2009/05/27 13:36:46 bisitz Exp $ +# $Id: lonparmset.pm,v 1.463 2009/06/30 14:30:26 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -854,7 +854,7 @@ sub page_js { return(< - +// $selscript ENDJS @@ -1248,16 +1249,29 @@ sub parmmenu { my $tempkey; $r->print(< +// ENDSCRIPT - $r->print(); $r->print(&Apache::lonhtmlcommon::row_title(&mt('Select Parameters to View'))); - $r->print("\n".''); + + #part to print selected parms overview + $r->print(&mt('Selected Parameters:').'
'); + + #print out all possible parms and hide them by default + $r->print('' + .'

' + .&mt('Show detailed Parameter Selection') + .'

' + ); + + &shortCuts($r,$allparms,$pscat,$keyorder); + + $r->print(&Apache::lonhtmlcommon::row_closure(1)); +} + +sub parmboxes { + my ($r,$allparms,$pscat,$keyorder)=@_; + my $tempkey; + + #part to print the parm-list + $r->print('
' + ); my $cnt=0; + + $r->print(''); foreach $tempkey (&keysindisplayorder($allparms,$keyorder)) { $r->print("\n".''); $cnt++; - if ($cnt==3) { + if ($cnt==4) { $r->print("\n"); $cnt=0; } } $r->print('' - .'' + .'
' + .'
' + .'' + .&mt('Hide') + .'' + ); + + #&shortCuts($r,$allparms,$pscat,$keyorder); + $r->print(''); +} +sub shortCuts { + my ($r,$allparms,$pscat,$keyorder)=@_; + + #part to print out the shortcuts for parmselection + $r->print('' .'' .'' - .'
' - .'
'.&mt('Parameter Selection').'' + .'
'.&mt('Parameter Selection').'' .'' .'• '.&mt('Select All').'' .'' @@ -1345,7 +1430,7 @@ ENDSCRIPT .'
' .'
' - .'
'.&mt('Add Selection for...').'' + .'
'.&mt('Add Selection for...').'' .'' .'• '.&mt('Problem Dates').'' .'' @@ -1365,8 +1450,7 @@ ENDSCRIPT .'' .'
' .'
' - ); + .''); } sub partmenu { @@ -1425,6 +1509,7 @@ sub usermenu { $sections .= ' '.&mt('or').' '; $sections .= qq| |; } else { $sections .= qq| |; } @@ -1490,8 +1578,9 @@ sub displaymenu { $r->print(&Apache::lonhtmlcommon::topic_bar (2,&mt('Select Parameters'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &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'))); &partmenu($r,$allparts,$psprt); $r->print(&Apache::lonhtmlcommon::row_closure(1)); @@ -1500,17 +1589,78 @@ 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); + 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('' + .&mt('All Maps or Folders') + .'' + .&Apache::loncommon::end_data_table_row() + ); + foreach my $mapid (@{$tree}) { + my $depth = $treeinfo->{$mapid}->{'depth'}; + my $indent = (' 'x$depth); + $icon = ''; + if ($treeinfo->{$mapid}->{'type'} eq 'page') { + $icon = ''; + } + $r->print(&Apache::loncommon::start_data_table_row() + .''.$indent.$icon + .'' + .'' + .&Apache::loncommon::end_data_table_row() + ); + } + $r->print(&Apache::loncommon::end_data_table()); } - $r->print(""); - } sub levelmenu { @@ -1831,7 +1981,10 @@ sub assessparms { $uname,$udom,$csec,$cgroup); } # ---------------------------------------------------------------- Done storing - $message.='

'.&mt('Changes can take up to 10 minutes before being active for all students.').&Apache::loncommon::help_open_topic('Caching').'

'; + $message.='

' + .&mt('Changes can take up to 10 minutes before being active for all students.') + .&Apache::loncommon::help_open_topic('Caching') + .'

'; } #----------------------------------------------- if all selected, fill in array if ($pscat[0] eq "all") {@pscat = (keys %allparms);} @@ -1848,6 +2001,27 @@ sub assessparms { '" name="recent_'.$_.'" />'); } + # ----- Start Parameter Selection + + # Hide parm selection? + $r->print(< +// + +ENDPARMSELSCRIPT + my $parmselhiddenstyle=' style="display:none"'; + if($env{'form.hideparmsel'} eq 'hidden') { + $r->print('
'); + } else { + $r->print('
'); + } + + # Display parameter selection boxes if (!$pssymb) { $r->print(&Apache::lonhtmlcommon::topic_bar (1,&mt('General Parameters'))); $r->print(&Apache::lonhtmlcommon::start_pick_box()); @@ -1877,10 +2051,31 @@ sub assessparms { $r->print(&Apache::lonhtmlcommon::row_closure(1)); $r->print(&Apache::lonhtmlcommon::end_pick_box()); + # parm selection is shown: display parm update button + $r->print('

' + .'' + .'' + .'

' + ); + + $r->print('
'); + # ----- End Parameter Selection - $r->print('

'.$message.'

'); + # Offer link to display parameter selection again + $r->print(''); + + # Display Messages + $r->print('
'.$message.'
'); - $r->print('
'); my @temp_pscat; map { @@ -2788,9 +2983,9 @@ ENDOVER #$r->print(' #
'); - $r->print('
'); + $r->print('
'); #$r->print('

Step 1

'); - $r->print('
' ); + $r->print('
'); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &levelmenu($r,\%alllevs,$parmlev); if ($parmlev ne 'general') { @@ -2806,12 +3001,13 @@ ENDOVER #$r->print(' #
'); - $r->print('
'); - $r->print('
' ); + $r->print('
'); + $r->print('
'); $r->print(&Apache::lonhtmlcommon::start_pick_box()); &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('
'. $r->print(''. @@ -2828,8 +3024,8 @@ ENDOVER $r->print(&Apache::lonhtmlcommon::end_pick_box()); $r->print(''); - $r->print('
'); - $r->print('
' ); + $r->print('
'); + $r->print('
'); my $sortorder=$env{'form.sortorder'}; unless ($sortorder) { $sortorder='realmstudent'; } &sortmenu($r,$sortorder);