--- loncom/interface/lonmenu.pm 2003/08/15 14:55:45 1.84 +++ loncom/interface/lonmenu.pm 2003/11/11 20:27:15 1.102 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.84 2003/08/15 14:55:45 www Exp $ +# $Id: lonmenu.pm,v 1.102 2003/11/11 20:27:15 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -44,12 +44,25 @@ use Apache::Constants qw(:common); use Apache::lonhtmlcommon(); use Apache::loncommon; use Apache::File; +use Apache::lonlocal; + use vars qw(@desklines $readdesk); + + my @inlineremote; my $font; my $tabbg; my $pgbg; +# ================================================================ Little texts + +sub initlittle { + return &Apache::lonlocal::texthash('ret' => 'Return to Last Location', + 'nav' => 'Navigate Contents', + 'main' => 'Main Menu', + 'launch' => 'Launch Remote Control'); +} + # ============================= This gets called at the top of the body section sub menubuttons { @@ -58,20 +71,24 @@ sub menubuttons { my $registration=shift; my $navmaps=''; my $reloadlink=''; - my $escurl=&Apache::lonnet::escape($ENV{'REQUEST_URI'}); + my $escurl=&Apache::lonnet::escape($ENV{'request.noversionuri'}); my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'}); if ($ENV{'browser.interface'} eq 'textual') { # Textual display only + my %lt=&initlittle(); + $pgbg='#FFFFFF'; + $tabbg='#FFFFFF'; + $font='#000000'; if ($ENV{'request.course.id'}) { $navmaps=(<Navigate Contents +$lt{'nav'} ENDNAV - if (($ENV{'REQUEST_URI'}=~/^\/adm\//) && - ($ENV{'REQUEST_URI'}!~/^\/adm\/wrapper\//) && - ($ENV{'REQUEST_URI'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { + if (($ENV{'request.noversionuri'}=~/^\/adm\//) && + ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && + ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { my $escreload=&Apache::lonnet::escape('return:'); $reloadlink=(<Return to Last Location +$lt{'ret'} ENDRELOAD } } @@ -79,7 +96,7 @@ ENDRELOAD -Main Menu +$lt{'main'} $reloadlink $navmaps
- +
$reloadlink $navmaps +$lt{'launch'}
-Main Menu +$lt{'main'} -Launch Remote Control LON-CAPA
+ @@ -164,7 +183,7 @@ sub registerurl { my $forcereg=shift; my $target = shift; my $result = ''; - if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } my $force_title=''; if ($ENV{'request.state'} eq 'construct') { $force_title=&Apache::lonxml::display_title(); @@ -179,14 +198,16 @@ sub registerurl { ($ENV{'environment.remote'} eq 'off') || ((($ENV{'request.publicaccess'}) || (!&Apache::lonnet::is_on_map( - &Apache::lonnet::unescape($ENV{'REQUEST_URI'})))) && + &Apache::lonnet::unescape($ENV{'request.noversionuri'})))) && (!$forcereg))) { return $result. ''.$force_title; } # Graphical display after login only if ($Apache::lonxml::registered && !$forcereg) { return ''; } - $result.=&innerregister($forcereg,$target); + if ($target ne 'edit') { + $result.=&innerregister($forcereg,$target); + } return $result.$force_title; } @@ -197,7 +218,7 @@ sub innerregister { my $forcereg=shift; my $target = shift; my $result = ''; - if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } $Apache::lonxml::registered=1; @@ -213,10 +234,10 @@ sub innerregister { my $newmail=''; if ($noremote) { - $newmail='
'; + $newmail='
'; } if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) { - my ($mapurl,$rid,$resurl)=split(/\_\_\_/,$ENV{'request.symb'}); + my ($mapurl,$rid,$resurl)=&Apache::lonnet::decode_symb($ENV{'request.symb'}); $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; my $maptitle=&Apache::lonnet::gettitle($mapurl); my $restitle=&Apache::lonnet::gettitle($resurl); @@ -234,14 +255,14 @@ sub innerregister { 'swmenu.setstatus("you have","messages");'); } if ($noremote) { - $newmail.='
'; + $newmail.='
'; } my $timesync=($textual?'':'swmenu.syncclock(1000*'.time.');'); - my $tablestart=($noremote?'':''); - my $tableend=($noremote?'
':''); + my $tablestart=($noremote?'':'').($textinter?'
'.&mt('Skip to Content').'
':''); + my $tableend=($noremote?'
':'').($textinter?'':''); # ============================================================================= # ============================ This is for URLs that actually can be registered - if (($ENV{'REQUEST_URI'}!~/^\/(res\/)*adm\//) || ($forcereg)) { + if (($ENV{'request.noversionuri'}!~/^\/(res\/)*adm\//) || ($forcereg)) { # -- This applies to homework problems for users with grading privileges my $hwkadd=''; if @@ -337,7 +358,7 @@ s&8&3&prt.gif&prepare&printout&gopost('/ s&9&1&sbkm.gif&set&bookmark&set_bookmark()&Set a bookmark for this resource&2 s&9&3&anot.gif&anno-&tations&annotate()&Make notes and annotations about this resource&2 ENDMENUITEMS - unless ($ENV{'REQUEST_URI'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { + unless ($ENV{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) { $menuitems.=(< @@ -391,7 +413,7 @@ var swmenu=null; $newmail $buttons swmenu.currentURL="$requri"; - swmenu.reloadURL=currentURL+window.location.search; + swmenu.reloadURL=swmenu.currentURL+window.location.search; swmenu.currentSymb="$ENV{'request.symb'}"; swmenu.reloadSymb="$ENV{'request.symb'}"; swmenu.currentStale=0; @@ -464,12 +486,12 @@ ENDDONOTREGTHIS } sub loadevents() { - if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAreg();'; } sub unloadevents() { - if ($ENV{'REQUEST_URI'} eq '/res/adm/pages/menu.html') { return ''; } + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } return 'LONCAPAstale();'; } @@ -609,6 +631,9 @@ sub switch { my ($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$nobreak)=@_; $act=~s/\$uname/$uname/g; $act=~s/\$udom/$udom/g; + $top=&mt($top); + $bot=&mt($bot); + $desc=&mt($desc); unless (($ENV{'browser.interface'} eq 'textual') || ($ENV{'environment.remote'} eq 'off')) { # Remote @@ -619,21 +644,37 @@ sub switch { if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; $text=~s/\s*\-\s*//gs; - $inlineremote[10*$row+$col]="\n".($nobreak?' ':'
'). - '
'.$text.' '. - ($nobreak?'':$desc); + if ($nobreak) { + $inlineremote[10*$row+$col]= + ''.$text.''; + } else { + $inlineremote[10*$row+$col]="\n
". + $desc.' '.$text.''; + } } else { # Inline Remote if ($nobreak==2) { return ''; } my $text=$top.' '.$bot; $text=~s/\s*\-\s*//gs; - $inlineremote[10*$row+$col]="\n". - ($nobreak==3?''.$text.''. - ($nobreak?'':''.$desc.'').($nobreak!=1?'':''); + my $pic= + ''.$text.''; + if ($nobreak==3) { + $inlineremote[10*$row+$col]="\n". + ''.$text. + ''. + ''.$pic.''; + } elsif ($nobreak) { + $inlineremote[10*$row+$col]="\n". + ''. + ''.$pic. + ''.$text.''; + } else { + $inlineremote[10*$row+$col]="\n". + ''. + ''.$pic. + ''.$desc. + ''; + } } return ''; } @@ -789,7 +830,7 @@ sub footer { sub utilityfunctions { unless (($ENV{'browser.interface'} eq 'textual') || ($ENV{'environment.remote'} eq 'off')) { return ''; } - my $currenturl=$ENV{'REQUEST_URI'}; + my $currenturl=$ENV{'request.noversionuri'}; my $currentsymb=$ENV{'request.symb'}; return (<content_type('text/html'); + &Apache::loncommon::content_type($r,'text/html'); $r->send_http_header; return OK if $r->header_only; @@ -867,7 +908,7 @@ sub handler { $function='admin'; } if (($ENV{'request.role'}=~/^(au|ca)/) || - ($ENV{'REQUEST_URI'}=~/^(\/priv|\~)/)) { + ($ENV{'request.noversionuri'}=~/^(\/priv|\~)/)) { $function='author'; } my $domain=&Apache::loncommon::determinedomain();