--- loncom/interface/lonmenu.pm 2004/08/10 18:05:12 1.112 +++ loncom/interface/lonmenu.pm 2004/11/11 23:45:36 1.128 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.112 2004/08/10 18:05:12 albertel Exp $ +# $Id: lonmenu.pm,v 1.128 2004/11/11 23:45:36 albertel Exp $ # # Copyright Michigan State University Board of Trustees # @@ -39,10 +39,11 @@ package Apache::lonmenu; use strict; -use Apache::lonnet; +use Apache::lonnet(); use Apache::Constants qw(:common); use Apache::lonhtmlcommon(); -use Apache::loncommon; +use Apache::loncommon(); +use Apache::lonenc(); use Apache::lonlocal; use vars qw(@desklines $readdesk); @@ -68,15 +69,14 @@ sub menubuttons { my $forcereg=shift; my $target =shift; my $registration=shift; - &Apache::loncommon::get_unprocessed_cgi($ENV{'QUERY_STRING'}, ['inhibitmenu']); if ($ENV{'form.inhibitmenu'} eq 'yes') { return ''; } my $navmaps=''; my $reloadlink=''; - my $escurl=&Apache::lonnet::escape($ENV{'request.noversionuri'}); - my $escsymb=&Apache::lonnet::escape($ENV{'request.symb'}); + my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'})); + my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($ENV{'request.symb'})); if ($ENV{'browser.interface'} eq 'textual') { # Textual display only my %lt=&initlittle(); @@ -96,9 +96,11 @@ ENDNAV ENDRELOAD } } + my $utility=&utilityfunctions(); my $output=(< // BEGIN LON-CAPA Internal +$utility $lt{'main'} $reloadlink $navmaps
@@ -133,11 +135,11 @@ ENDMAINMENU my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain); # Do we have a NAV link? if ($ENV{'request.course.id'}) { - $navmaps=(< -$lt{'nav'} -ENDNAVREM - if (($ENV{'request.noversionuri'}=~/^\/adm\//) && +$lt{'nav'} +ENDNAV + if (($ENV{'request.noversionuri'}=~/^\/adm\//) && ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) { my $escreload=&Apache::lonnet::escape('return:'); @@ -151,9 +153,11 @@ ENDRELOAD if ($registration) { $reg=&innerregister($forcereg,$target); } + my $utility=&utilityfunctions(); return (< // BEGIN LON-CAPA Internal +$utility @@ -222,6 +226,9 @@ sub innerregister { my $forcereg=shift; my $target = shift; my $result = ''; + my ($uname,$thisdisfn); + my $const_space = ($ENV{'request.state'} eq 'construct'); + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } $Apache::lonxml::registered=1; @@ -344,7 +351,7 @@ sub innerregister { } } # Finally, turn the button on or off - if ($cfile) { + if ($cfile && !$const_space) { $editbutton=&switch ('','',6,1,'cstr.gif','edit[_1]','resource[_2]', "go('".$cfile."');","Edit this resource"); @@ -355,7 +362,21 @@ sub innerregister { ### ### # Prepare the rest of the buttons - my $menuitems=(< // BEGIN LON-CAPA Internal -$utility $timesync $newmail @@ -419,7 +439,9 @@ ENDREGTEXT # Registered, graphical output } else { my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0]; - $requri=&Apache::lonnet::unescape($requri); + $requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri)); + my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'}); + my $navstatus=&get_nav_status(); $result = (< @@ -434,9 +456,10 @@ var swmenu=null; $buttons swmenu.currentURL="$requri"; swmenu.reloadURL=swmenu.currentURL+window.location.search; - swmenu.currentSymb="$ENV{'request.symb'}"; - swmenu.reloadSymb="$ENV{'request.symb'}"; + swmenu.currentSymb="$cursymb"; + swmenu.reloadSymb="$cursymb"; swmenu.currentStale=0; + $navstatus $hwkadd $editbutton } @@ -528,11 +551,18 @@ sub startupremote { # my $configmenu=&rawconfig(); my $esclowerurl=&Apache::lonnet::escape($lowerurl); - + my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited'); return(< - +var timestart; function wheelswitch() { + if (typeof(document.wheel) != 'undefined') { + if (typeof(document.wheel.spin) != 'undefined') { + var date=new Date(); + var waited=Math.round(30-((date.getTime()-timestart)/1000)); + document.wheel.spin.value=$message; + } + } if (window.status=='|') { window.status='/'; } else { @@ -569,6 +599,8 @@ function wait() { function main() { canceltim=setTimeout('tim=1;',30000); window.status='-'; + var date=new Date(); + timestart=date.getTime(); wait(); } @@ -594,6 +626,25 @@ sub maincall() { ENDMAINCALL } + +sub load_remote_msg { + my ($lowerurl)=@_; + + if (($ENV{'browser.interface'} eq 'textual') || + ($ENV{'environment.remote'} eq 'off')) { return ''; } + + my $esclowerurl=&Apache::lonnet::escape($lowerurl); + my $link=&mt('Continue on in Inline Menu mode', + "/adm/remote?action=collapse?url=$esclowerurl"); + return(< +
+ + +

+

$link

+ENDREMOTEFORM +} # ================================================================= Reopen menu sub reopenmenu { @@ -801,6 +852,11 @@ sub rawconfig { if ($ENV{'request.course.fn'}) { $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); } + } elsif ($pro =~ /^courseenv_(.*)$/) { + my $key = $1; + if ($ENV{'course.'.$ENV{'request.course.id'}.'.'.$key}) { + $output.=switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc); + } } elsif ($pro =~ /^course_(.*)$/) { # Check for permissions inside of a course if (($ENV{'request.course.id'}) && @@ -836,7 +892,11 @@ sub rawconfig { unless (($ENV{'browser.interface'} eq 'textual') || ($ENV{'environment.remote'} eq 'off')) { $output.="\nwindow.status='Synchronizing Time';swmenu.syncclock(1000*".time.");\nwindow.status='Remote Control Configured.';"; + if (&Apache::lonmsg::newmail()) { + $output.='swmenu.setstatus("you have","messages");'; + } } + return $output; } @@ -867,17 +927,38 @@ sub footer { } +sub nav_control_js { + my $nav=($ENV{'environment.remotenavmap'} eq 'on'); + return (< ENDSERVERFORM } + +sub constspaceform { + return(< + + +
+ + + +ENDCONSTSPACEFORM +} + + +sub get_nav_status { + my $navstatus="swmenu.w_loncapanav_flag="; + if ($ENV{'environment.remotenavmap'} eq 'on') { + $navstatus.="1"; + } else { + $navstatus.="-1"; + } + return $navstatus; +} + # ================================================ Handler when called directly @@ -960,13 +1079,9 @@ sub handler { $ENV{'browser.interface'}='faketextual'; $ENV{'environment.remote'}='off'; } - my $utility=&utilityfunctions(); $r->print(< LON-CAPA Main Menu - $bodytag ENDHEADER