--- loncom/interface/lonmenu.pm 2007/04/13 20:22:15 1.214 +++ loncom/interface/lonmenu.pm 2007/10/30 23:46:02 1.230 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.214 2007/04/13 20:22:15 albertel Exp $ +# $Id: lonmenu.pm,v 1.230 2007/10/30 23:46:02 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -61,7 +61,7 @@ sub initlittle { 'main' => 'Main Menu', 'roles' => ($env{'user.adv'}? 'Roles':'Courses'), - 'docs' => 'Course Documents', + 'docs' => 'Edit Course', 'exit' => 'Exit', 'login' => 'Log In', 'launch' => 'Launch Remote Control', @@ -121,9 +121,7 @@ sub menubuttons { $navmaps=(<$lt{'nav'} ENDNAV - if (($env{'request.noversionuri'}=~/^\/adm\//) && - ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && - ($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { + if (&show_return_link()) { my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} @@ -196,7 +194,7 @@ ENDINLINEMENU $navmaps=(<$lt{'nav'} ENDNAV -my $is_group = (&Apache::loncommon::course_type() eq 'Group'); + my $is_group = (&Apache::loncommon::course_type() eq 'Group'); if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) { my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'}; $docs=(<$lt{'groups'} ENDGROUPS } - if ( - ($env{'request.noversionuri'}=~m[^/(res|public)/] && - $env{'request.symb'} eq '') - || - (($env{'request.noversionuri'}=~/^\/adm\//) && - ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && - ($env{'request.noversionuri'}!~ - m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) - ) - ) { + if (&show_return_link()) { my $escreload=&escape('return:'); $reloadlink=(<$lt{'ret'} @@ -274,6 +263,19 @@ ENDINLINEMENU } } +sub show_return_link { + return (($env{'request.noversionuri'}=~m{^/(res|public)/} && + $env{'request.symb'} eq '') + || + ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl}) + || + (($env{'request.noversionuri'}=~/^\/adm\//) && + ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) && + ($env{'request.noversionuri'}!~ + m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)]) + )); +} + # ====================================== This gets called in the header section sub registerurl { @@ -486,9 +488,14 @@ s&8&3&prt.gif&prepare[_1]&printout[_1]&g s&9&1&sbkm.gif&set[_1]&bookmark[_2]&set_bookmark()&Set a bookmark for this resource&&1 s&9&3&anot.gif&anno-[_1]&tations[_1]&annotate()&Make notes and annotations about this resource&&1 ENDMENUITEMS + unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { - $menuitems.=(< +$inlineremote[21] $inlineremote[23] +ENDARROWSINLINE + if (&hidden_button_check() ne 'yes') { + $inlinebuttons .= (< +ENDINLINEICONS + } + } else { + if ($inlineremote[21] ne '' || $inlineremote[23] ne '') { + $inlinebuttons=(<$inlineremote[21] $inlineremote[23] -$inlineremote[61]$inlineremote[62]$inlineremote[63] -$inlineremote[71]$inlineremote[72]$inlineremote[73] -$inlineremote[81]$inlineremote[82]$inlineremote[83] -$inlineremote[91]$inlineremote[92]$inlineremote[93] -ENDINLINE - } +ENDFIRSTLINE + } + if (&hidden_button_check() ne 'yes') { + foreach my $row (6..9) { + if ($inlineremote[${row}.'1'] ne '' + || $inlineremote[$row.'2'] ne '' + || $inlineremote[$row.'3'] ne '') { + $inlinebuttons .= <<"ENDLINE"; +$inlineremote["${row}1"]$inlineremote["${row}2"]$inlineremote["${row}3"] +ENDLINE + } + } + } + } + } } $result =(< // BEGIN LON-CAPA Internal $timesync -$newmail $tablestart $inlinebuttons $tableend +$newmail @@ -756,12 +795,19 @@ sub load_remote_msg {

$link

ENDREMOTEFORM } + +sub get_menu_name { + my $hostid = $Apache::lonnet::perlvar{'lonHostID'}; + $hostid =~ s/\W//g; + return 'LCmenu'.$hostid; +} + # ================================================================= Reopen menu sub reopenmenu { if (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off')) { return ''; } - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; + my $menuname = &get_menu_name(); my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); return('window.open('.$nothing.',"'.$menuname.'","",false);'); } @@ -774,16 +820,17 @@ sub open { ($env{'environment.remote'} eq 'off')) { return ''; } - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; - unless (shift eq 'unix') { + my $menuname = &get_menu_name(); + +# unless (shift eq 'unix') { # resizing does not work on linux because of virtual desktop sizes - $returnval.=(<'; + ''.$text.''; if ($env{'browser.interface'} eq 'faketextual') { # Accessibility if ($nobreak==3) { @@ -866,19 +911,23 @@ sub switch { $inlineremote[$idx]="\n". ''. ''.$pic.' - '.$text.''; + '.$text.''; } else { $inlineremote[$idx]="\n". ''. ''.$pic. ''. - $desc.''; + ''.$desc.''; } } else { # Inline Menu - $inlineremote[$idx]= - ''.$pic. - ''.$desc.''; + if ($env{'environment.icons'} eq 'iconsonly') { + $inlineremote[$idx]=''.$pic.''; + } else { + $inlineremote[$idx]= + ''.$pic. + ''.$desc.''; + } } } return ''; @@ -899,7 +948,7 @@ sub secondlevel { } sub openmenu { - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; + my $menuname = &get_menu_name(); if (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off')) { return ''; } my $nothing = &Apache::lonhtmlcommon::javascript_nothing(); @@ -1049,7 +1098,7 @@ sub rawconfig { sub close { if (($env{'browser.interface'} eq 'textual') || ($env{'environment.remote'} eq 'off')) { return ''; } - my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; + my $menuname = &get_menu_name(); return(< window.status='Accessing Remote Control'; @@ -1233,7 +1282,7 @@ function annotate() { '$start_page_annotate' +"
" - +"" + +"" +"<\\/form>" +'$end_page_annotate'); annotator.document.close(); @@ -1317,6 +1366,16 @@ sub convert_menu_function { return $rolename; } +sub hidden_button_check { + my $hidden; + if ($env{'request.course.id'} eq '') { + return; + } + if ($env{'request.role.adv'}) { + return; + } + return &Apache::lonnet::EXT('resource.0.buttonshide'); +} # ================================================================ Main Program