--- loncom/interface/lonmenu.pm 2009/07/11 19:58:29 1.274 +++ loncom/interface/lonmenu.pm 2009/08/12 18:38:04 1.279 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.274 2009/07/11 19:58:29 www Exp $ +# $Id: lonmenu.pm,v 1.279 2009/08/12 18:38:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -165,7 +165,6 @@ sub initlittle { sub menubuttons { my $forcereg=shift; - my $registration=shift; my $titletable=shift; # # Early-out for pages that should not have a menu, triggered by query string "inhibitmenu=yes" @@ -288,24 +287,20 @@ ENDRELOAD
  • $lt{'ret'}
  • ENDCRELOAD } - my $reg=''; - if ($registration) { - $reg=&innerregister($forcereg,$titletable); - } - my $form=&serverform(); - my $utility=&utilityfunctions(); + my $reg = $forcereg ? &innerregister($forcereg,$titletable) : ''; + my $form = &serverform(); + my $utility = &utilityfunctions(); + + #Prepare the message link that indicates the arrival of new mail + my $messagelink = Apache::lonmsg::mynewmail() ? "Message (new)" : "Message"; + $messagelink = '' + . mt($messagelink) .''; - my $messagelink = ""; - if(&Apache::lonmsg::mynewmail()){ - $messagelink = 'Message(new)' - }else{ - $messagelink = 'Message' - } - my $helplink=&Apache::loncommon::top_nav_help('Help'); + my $helplink = &Apache::loncommon::top_nav_help('Help'); return (< -// BEGIN LON-CAPA Internal // @@ -362,8 +357,14 @@ sub registerurl { (!&Apache::lonnet::is_on_map( &unescape($env{'request.noversionuri'})))) && (!$forcereg))) { - return $result. - ''.$force_title; + return + $result + .'' + .$force_title; } # Graphical display after login only if ($env{'request.registered'} && !$forcereg) { return ''; } @@ -389,12 +390,13 @@ sub innerregister { my $reopen=&Apache::lonmenu::reopenmenu(); my $newmail=''; - my $breadcrumb; if (&Apache::lonmsg::newmail() && !$noremote) { # We have new mail and remote is up $newmail= 'swmenu.setstatus("you have","messages");'; } + + my $breadcrumb; if ($noremote && ($env{'request.symb'}) && ($env{'request.course.id'})) { @@ -615,6 +617,13 @@ if(length($annotation) > 0){ $menuitems.="&anno-[_1]&tations[_1]&annotate()&"; $menuitems.="Make notes and annotations about this resource&&1\n"; + unless ($noremote) { + my $showreqcrs = &check_for_rcrs(); + if ($showreqcrs) { + $menuitems.="s&8&1&rcrs.gif&request[_1]&course[_16]". + "&go('/adm/requestcourse')&Course requests\n"; + } + } unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { if (!$env{'request.enc'}) { $menuitems.=(< +// ENDREGTHIS } @@ -766,6 +777,7 @@ ENDDONOTREGTEXT $result = (< +// ENDDONOTREGTHIS } @@ -860,6 +873,7 @@ sub startupremote { my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited'); return(< +// ENDREMOTESTARTUP } @@ -917,8 +932,10 @@ ENDREMOTESTARTUP sub setflags() { return(< +// ENDSETFLAGS } @@ -927,7 +944,9 @@ sub maincall() { if ($env{'environment.remote'} eq 'off') { return ''; } return(< +// ENDMAINCALL } @@ -969,7 +988,12 @@ sub reopenmenu { sub open { my $returnval=''; if ($env{'environment.remote'} eq 'off') { - return ''; + return + ''; } my $menuname = &get_menu_name(); @@ -982,11 +1006,13 @@ sub open { #} #ENDRESIZE # } - $returnval.=(< ENDOPEN return ''; } @@ -997,6 +1023,7 @@ ENDOPEN sub clear { my ($row,$col)=@_; unless ($env{'environment.remote'} eq 'off') { + if (($row<1) || ($row>13)) { return ''; } return "\n".qq(window.status+='.';swmenu.clearbut($row,$col);); } else { $inlineremote[10*$row+$col]=''; @@ -1022,6 +1049,7 @@ sub switch { $category_members{$cat}.=':'.$idx; unless ($env{'environment.remote'} eq 'off') { + if (($row<1) || ($row>13)) { return ''; } # Remote return "\n". qq(window.status+='.';swmenu.switchbutton($row,$col,"$img","$top","$bot","$act","$desc");); @@ -1095,6 +1123,7 @@ sub openmenu { sub inlinemenu { undef(@inlineremote); undef(%category_members); +# calling rawconfig with "1" will evaluate mydesk.tab, even if there is no active remote control &rawconfig(1); my $output=''; for (my $col=1; $col<=2; $col++) { @@ -1249,16 +1278,14 @@ sub rawconfig { $output.=&clear($row,$col); next; } - } elsif ($prt eq 'reqcrs') { - my $showreqcrs = 0; - foreach my $type ('official','unofficial') { - if (&Apache::lonnet::usertools_access($env{'user.name'}, - $env{'user.domain'}, - $type,undef,'requestcourses')) { - $showreqcrs = 1; - last; - } + } elsif (($prt eq 'reqcrsnsc') || ($prt eq 'reqcrsshc')) { + if (($prt eq 'reqcrsnsc') && ($show_course)) { + next; } + if (($prt eq 'reqcrsshc') && (!$show_course)) { + next; + } + my $showreqcrs = &check_for_rcrs(); if (!$showreqcrs) { $output.=&clear($row,$col); next; @@ -1279,6 +1306,19 @@ sub rawconfig { return $output; } +sub check_for_rcrs { + my $showreqcrs = 0; + foreach my $type ('official','unofficial','community') { + if (&Apache::lonnet::usertools_access($env{'user.name'}, + $env{'user.domain'}, + $type,undef,'requestcourses')) { + $showreqcrs = 1; + last; + } + } + return $showreqcrs; +} + # ======================================================================= Close sub close { @@ -1286,6 +1326,7 @@ sub close { my $menuname = &get_menu_name(); return(< +// ENDCLOSE }