--- loncom/interface/lonmenu.pm 2004/09/18 16:28:35 1.116 +++ loncom/interface/lonmenu.pm 2004/12/04 02:01:04 1.137 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.116 2004/09/18 16:28:35 albertel Exp $ +# $Id: lonmenu.pm,v 1.137 2004/12/04 02:01:04 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,7 +43,7 @@ use Apache::lonnet(); use Apache::Constants qw(:common); use Apache::lonhtmlcommon(); use Apache::loncommon(); -use Apache::lonnavmaps(); +use Apache::lonenc(); use Apache::lonlocal; use vars qw(@desklines $readdesk); @@ -69,14 +69,22 @@ sub menubuttons { my $forcereg=shift; my $target =shift; my $registration=shift; + my $titletable=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{'request.state'} eq 'construct') { + if (($ENV{'request.noversionuri'} eq '') || (!defined($ENV{'request.noversionuri'}))) { + my $returnurl = $ENV{'request.filename'}; + $returnurl =~ s:^/home/([^/]+)/public_html/(.*)$:/priv/$1/$2:; + $escurl = &Apache::lonnet::escape($returnurl); + } + } if ($ENV{'browser.interface'} eq 'textual') { # Textual display only my %lt=&initlittle(); @@ -96,17 +104,19 @@ ENDNAV ENDRELOAD } } + my $form=&serverform(); my $utility=&utilityfunctions(); my $output=(< + $lt{'main'} $reloadlink $navmaps
- +$form ENDMAINMENU if ($registration) { $output.=&innerregister($forcereg,$target); } return $output."
"; @@ -137,7 +147,7 @@ ENDMAINMENU if ($ENV{'request.course.id'}) { $navmaps=(< -$lt{'nav'} +$lt{'nav'} ENDNAV if (($ENV{'request.noversionuri'}=~/^\/adm\//) && ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) && @@ -151,11 +161,12 @@ ENDRELOAD } my $reg=''; if ($registration) { - $reg=&innerregister($forcereg,$target); + $reg=&innerregister($forcereg,$target,$titletable); } + my $form=&serverform(); my $utility=&utilityfunctions(); return (< + @@ -167,15 +178,16 @@ $utility $reloadlink $navmaps - + $lt{'launch'} LON-CAPA +$form - $reg @@ -225,7 +237,12 @@ sub registerurl { sub innerregister { my $forcereg=shift; my $target = shift; + my $titletable = shift; my $result = ''; + my ($uname,$thisdisfn); + my $const_space = ($ENV{'request.state'} eq 'construct'); + my $is_const_dir = 0; + if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } $Apache::lonxml::registered=1; @@ -249,7 +266,7 @@ sub innerregister { $newmail.=$ENV{'course.'.$ENV{'request.course.id'}.'.description'}; my $maptitle=&Apache::lonnet::gettitle($mapurl); my $restitle=&Apache::lonnet::gettitle($resurl); - if ($maptitle) { + if ($maptitle && $maptitle ne 'default.sequence') { $newmail.=', '.$maptitle; } if ($restitle) { @@ -262,6 +279,9 @@ sub innerregister { 'You have new messages
': 'swmenu.setstatus("you have","messages");'); } + if ($ENV{'request.state'} eq 'construct') { + $newmail = $titletable; + } if ($noremote) { $newmail.=''; } @@ -348,7 +368,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"); @@ -359,7 +379,25 @@ sub innerregister { ### ### # Prepare the rest of the buttons - my $menuitems=(<$inlineremote[21] $inlineremote[23] +$inlineremote[21] $inlineremote[23] $inlineremote[61]$inlineremote[62]$inlineremote[63] $inlineremote[71]$inlineremote[72]$inlineremote[73] $inlineremote[81]$inlineremote[82]$inlineremote[83] $inlineremote[91]$inlineremote[92]$inlineremote[93] ENDINLINE } + if ($const_space && $is_const_dir) { + $inlinebuttons = ''; + } $result =(< + $timesync @@ -412,8 +453,7 @@ $newmail $tablestart $inlinebuttons $tableend -$form - @@ -421,11 +461,12 @@ 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 = (< + @@ -593,11 +645,30 @@ sub maincall() { if (($ENV{'browser.interface'} eq 'textual') || ($ENV{'environment.remote'} eq 'off')) { return ''; } return(< + 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 { @@ -632,7 +703,7 @@ var menu=window.open("/res/adm/pages/men "height=350,width=150,scrollbars=no,menubar=no,top=5,left=5,screenX=5,screenY=5"); self.name='loncapaclient'; ENDOPEN - return ''; + return ''; } @@ -805,6 +876,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'}) && @@ -840,7 +916,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; } @@ -851,7 +931,7 @@ sub close { ($ENV{'environment.remote'} eq 'off')) { return ''; } my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; return(< + +ENDSCRIPT + } +# ---- Print the screen, pretend to be in text mode to generate text-based menu unless ($ENV{'browser.interface'} eq 'textual') { $ENV{'browser.interface'}='faketextual'; $ENV{'environment.remote'}='off'; @@ -981,6 +1152,7 @@ sub handler { $r->print(< LON-CAPA Main Menu +$script_tag $bodytag ENDHEADER