--- loncom/interface/lonmenu.pm 2003/04/04 22:00:26 1.57 +++ loncom/interface/lonmenu.pm 2003/07/05 10:07:11 1.80 @@ -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.80 2003/07/05 10:07:11 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 $reg=''; + if ($registration) { + $reg=&innerregister($forcereg,$target); } - 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 .="'; + return $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 @@ -136,6 +196,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 +211,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
': + '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)) { @@ -163,17 +245,23 @@ sub innerregister { my $hwkadd=''; if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) { - if (&Apache::lonnet::allowed('vgr',$ENV{'request.course.id'})) { - $hwkadd.=&switch('','',7,1,'subm.gif','view sub','missions', + my $crs='/'.$ENV{'request.course.id'}; + if ($ENV{'request.course.sec'}) { + $crs.='_'.$ENV{'request.course.sec'}; + } + $crs=~s/\_/\//g; + + if (&Apache::lonnet::allowed('vgr',$crs)) { + $hwkadd.=&switch('','',7,1,'subm.gif','view sub-','missions', "gocmd('/adm/grades','submission')", 'View user submissions for this assessment resource'); } - if (&Apache::lonnet::allowed('mgr',$ENV{'request.course.id'})) { + if (&Apache::lonnet::allowed('mgr',$crs)) { $hwkadd.=&switch('','',7,2,'pgrd.gif','problem','grades', "gocmd('/adm/grades','gradingmenu')", 'Modify user grades for this assessment resource'); } - if (&Apache::lonnet::allowed('opa',$ENV{'request.course.id'})) { + if (&Apache::lonnet::allowed('opa',$crs)) { $hwkadd.=&switch('','',7,3,'pparm.gif','problem','parms', "gocmd('/adm/parmset','set')", 'Modify deadlines, etc, for this assessment resource'); @@ -240,15 +328,22 @@ sub innerregister { my $menuitems=(< $timesync $newmail +$tablestart $inlinebuttons +$tableend $form ENDREGTEXT @@ -315,7 +412,6 @@ 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); - } // END LON-CAPA Internal @@ -367,10 +463,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 +581,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 ''; } @@ -518,18 +617,22 @@ sub switch { # Accessibility if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; - $text=~s/\- //; + $text=~s/\s*\-\s*//gs; $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); + $text=~s/\s*\-\s*//gs; + $inlineremote[10*$row+$col]="\n". + ($nobreak==3?''.$text.''. + ($nobreak?'':''.$desc.'').($nobreak!=1?'':''); } return ''; } @@ -716,7 +819,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 +831,7 @@ ENDUTILITY sub serverform { return(< +
@@ -747,6 +850,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 +879,7 @@ $utility $bodytag ENDHEADER - $r->print(&inlinemenu().$form); + $r->print(''.&inlinemenu().'
'.$form); $r->print(''); return OK; }