--- loncom/interface/lonmenu.pm 2003/04/04 22:00:26 1.57 +++ loncom/interface/lonmenu.pm 2003/05/16 20:47:07 1.66 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.57 2003/04/04 22:00:26 www Exp $ +# $Id: lonmenu.pm,v 1.66 2003/05/16 20:47:07 albertel 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 ''; } @@ -108,7 +164,11 @@ sub registerurl { my $forcereg=shift; my $target = shift; my $result = ''; - + + my $force_title=''; + if ($ENV{'request.state'} eq 'construct') { + $force_title=&Apache::lonxml::display_title(); + } if ($target eq 'edit') { $result .="'; + ''.$force_title; } # Graphical display after login only if ($Apache::lonxml::registered && !$forcereg) { return ''; } $result.=&innerregister($forcereg,$target); - return $result; + return $result.$force_title; } # =========== This gets called in order to register a URL, both with the Remote @@ -150,12 +210,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 +321,7 @@ sub innerregister { my $menuitems=(< $timesync $newmail +$tablestart $inlinebuttons +$tableend $form ENDREGTEXT @@ -520,16 +603,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 ''; } @@ -716,7 +803,7 @@ function gocmd(url,cmd) { } function catalog_info() { - loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizeable=yes,location=no,menubar=no,toolbar=no'); + 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() { @@ -728,7 +815,7 @@ ENDUTILITY sub serverform { return(< +
@@ -747,6 +834,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'; @@ -761,7 +863,7 @@ $utility $bodytag ENDHEADER - $r->print(&inlinemenu().$form); + $r->print(''.&inlinemenu().'
'.$form); $r->print(''); return OK; }