--- loncom/interface/lonmenu.pm 2003/04/04 21:21:51 1.56 +++ loncom/interface/lonmenu.pm 2003/05/24 12:43:55 1.71 @@ -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.71 2003/05/24 12:43:55 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 ''; } @@ -108,7 +164,11 @@ sub registerurl { my $forcereg=shift; my $target = shift; my $result = ''; - + if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } + my $force_title=''; + if ($ENV{'request.state'} eq 'construct') { + $force_title=&Apache::lonxml::display_title(); + } if ($target eq 'edit') { $result .="'; + my $loadfunction=''; + my $unloadfunction=''; + unless (($ENV{'browser.interface'} eq 'textual') || + ($ENV{'environment.remote'} eq 'off') || + ($ENV{'request.publicaccess'})) { + my $reopen=&Apache::lonmenu::reopenmenu(); + $loadfunction='swmenu='.$reopen.'swmenu.windowloaded(self.name);'; + $unloadfunction='swmenu='.$reopen.'swmenu.windowunloaded(self.name);'; + } + return $result.(< +function LONCAPAreg() { + $loadfunction +} + +function LONCAPAstale() { + $unloadfunction +} + +$force_title +ENDFUNCTIONS } # 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 @@ -136,6 +215,7 @@ sub innerregister { my $forcereg=shift; my $target = shift; my $result = ''; + if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } $Apache::lonxml::registered=1; @@ -150,12 +230,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 +341,7 @@ sub innerregister { my $menuitems=(< $timesync $newmail +$tablestart $inlinebuttons +$tableend $form ENDREGTEXT @@ -288,6 +391,7 @@ var swmenu=null; function LONCAPAreg() { swmenu=$reopen; + swmenu.windowloaded(self.name); swmenu.clearTimeout(swmenu.menucltim); $timesync $newmail @@ -315,7 +419,7 @@ var swmenu=null; 'clearbut(2,1);clearbut(2,3);clearbut(8,1);clearbut(8,2);clearbut(8,3);'+ 'clearbut(9,1);clearbut(9,2);clearbut(9,3);clearbut(6,3);clearbut(6,1)', 2000); - + swmenu.windowunloaded(self.name); } // END LON-CAPA Internal @@ -339,6 +443,7 @@ var swmenu=null; function LONCAPAreg() { swmenu=$reopen + swmenu.windowloaded(self.name); $timesync swmenu.currentStale=1; swmenu.clearbut(2,1); @@ -355,6 +460,8 @@ var swmenu=null; } function LONCAPAstale() { + swmenu=$reopen + swmenu.windowunloaded(self.name); } // END LON-CAPA Internal @@ -367,10 +474,12 @@ ENDDONOTREGTHIS } sub loadevents() { + if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAreg();'; } sub unloadevents() { + if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAstale();'; } @@ -483,6 +592,7 @@ ENDRESIZE window.status='Opening LON-CAPA Remote Control'; var menu=window.open("/res/adm/pages/menu.html","$menuname", "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5"); +self.name='loncapaclient'; ENDOPEN return ''; } @@ -520,16 +630,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 +828,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 +861,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 +890,7 @@ $utility $bodytag ENDHEADER - $r->print(&inlinemenu().$form); + $r->print(''.&inlinemenu().'
'.$form); $r->print(''); return OK; }