--- loncom/interface/lonmenu.pm 2003/04/04 21:21:51 1.56 +++ loncom/interface/lonmenu.pm 2003/04/18 17:51:32 1.65 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.56 2003/04/04 21:21:51 www Exp $ +# $Id: lonmenu.pm,v 1.65 2003/04/18 17:51:32 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -46,6 +46,9 @@ use Apache::loncommon; use Apache::File; use vars qw(@desklines $readdesk); my @inlineremote; +my $font; +my $tabbg; +my $pgbg; # ============================= This gets called at the top of the body section @@ -54,6 +57,7 @@ sub menubuttons { my $target =shift; my $registration=shift; my $navmaps=''; + my $reloadlink=''; my $escurl=&Apache::lonnet::escape($ENV{'REQUEST_URI'}); my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'}); if ($ENV{'browser.interface'} eq 'textual') { @@ -62,13 +66,21 @@ sub menubuttons { $navmaps=(<Navigate Contents ENDNAV + if (($ENV{'REQUEST_URI'}=~/^\/adm\//) && + ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) && + ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { + my $escreload=&Apache::lonnet::escape('return:'); + $reloadlink=(<Return to Last Location +ENDRELOAD + } } my $output=(< // BEGIN LON-CAPA Internal Main Menu -$navmaps
+$reloadlink $navmaps
@@ -77,26 +89,70 @@ ENDMAINMENU return $output."
"; } elsif ($ENV{'environment.remote'} eq 'off') { # Remote Control is switched off +# figure out colors + my $function='student'; + if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { + $function='coordinator'; + } + if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) { + $function='admin'; + } + if (($ENV{'request.role'}=~/^(au|ca)/) || + ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) { + $function='author'; + } + my $domain=&Apache::loncommon::determinedomain(); + $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); + $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); + $font=&Apache::loncommon::designparm($function.'.font',$domain); + my $link=&Apache::loncommon::designparm($function.'.link',$domain); + my $alink=&Apache::loncommon::designparm($function.'.alink',$domain); + my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain); + my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain); +# Do we have a NAV link? if ($ENV{'request.course.id'}) { $navmaps=(<Navigate Contents + +Navigate Contents ENDNAVREM + if (($ENV{'REQUEST_URI'}=~/^\/adm\//) && + ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) && + ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { + my $escreload=&Apache::lonnet::escape('return:'); + $reloadlink=(< +Return to Last Location +ENDRELOAD + } } - my $output=(< // BEGIN LON-CAPA Internal -
-Main Menu + + + +$reloadlink $navmaps -Launch Remote Control -
+ + + +
+Main Menu + + +Launch Remote Control + +LON-CAPA
+$reg ENDINLINEMENU - if ($registration) { $output.=&innerregister($forcereg,$target); } - return $output."
"; } else { return ''; } @@ -150,12 +206,33 @@ sub innerregister { my $reopen=&Apache::lonmenu::reopenmenu(); my $newmail=''; + if ($noremote) { + $newmail='
'; + } + if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) { + my ($mapurl,$rid,$resurl)=split(/\_\_\_/,$ENV{'request.symb'}); + $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; + my $maptitle=&Apache::lonnet::gettitle($mapurl); + my $restitle=&Apache::lonnet::gettitle($resurl); + if ($maptitle) { + $newmail.=', '.$maptitle; + } + if ($restitle) { + $newmail.=': '.$restitle; + } + $newmail.='   '; + } if (&Apache::lonmsg::newmail()) { $newmail=($textual? 'You have new messages
': 'swmenu.setstatus("you have","messages");'); } + if ($noremote) { + $newmail.='
'; + } my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); + my $tablestart=($noremote?'':''); + my $tableend=($noremote?'
':''); # ============================================================================= # ============================ This is for URLs that actually can be registered if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { @@ -240,7 +317,7 @@ sub innerregister { my $menuitems=(< $timesync $newmail +$tablestart $inlinebuttons +$tableend $form ENDREGTEXT @@ -520,16 +599,20 @@ sub switch { my $text=$top.' '.$bot; $text=~s/\- //; $inlineremote[10*$row+$col]="\n".($nobreak?' ':'
'). - ''.$text.' '. + ''.$text.' '. ($nobreak?'':$desc); } else { # Inline Remote if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; $text=~s/\- //; - $inlineremote[10*$row+$col]="\n".($nobreak?' ':'
'). - ''.$text.' '. - ($nobreak?'':$desc); + $inlineremote[10*$row+$col]="\n". + ($nobreak==3?''.$text.''. + ($nobreak?'':''.$desc.'').($nobreak!=1?'':''); } return ''; } @@ -714,13 +797,21 @@ function gocmd(url,cmd) { this.document.server.submit(); } } + +function catalog_info() { + loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizeable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no'); +} + +function chat_win() { + lonchat=window.open('/res/adm/pages/chatroom.html',"LONchat",'height=320,width=280,resizeable=yes,location=no,menubar=no,toolbar=no'); +} ENDUTILITY } sub serverform { return(< +
@@ -739,6 +830,21 @@ sub handler { my $form=&serverform(); my $bodytag=&Apache::loncommon::bodytag('Main Menu'); + my $function='student'; + if ($ENV{'request.role'}=~/^(cc|in|ta|ep)/) { + $function='coordinator'; + } + if ($ENV{'request.role'}=~/^(su|dc|ad|li)/) { + $function='admin'; + } + if (($ENV{'request.role'}=~/^(au|ca)/) || + ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) { + $function='author'; + } + my $domain=&Apache::loncommon::determinedomain(); + $pgbg=&Apache::loncommon::designparm($function.'.pgbg',$domain); + $tabbg=&Apache::loncommon::designparm($function.'.tabbg',$domain); + $font=&Apache::loncommon::designparm($function.'.font',$domain); # ---- Print the screen, pretent to be in text mode to generate text-based menu unless ($ENV{'brower.interface'} eq 'textual') { $ENV{'environment.remote'}='off'; @@ -753,7 +859,7 @@ $utility $bodytag ENDHEADER - $r->print(&inlinemenu().$form); + $r->print(''.&inlinemenu().'
'.$form); $r->print(''); return OK; }