--- loncom/interface/lonmenu.pm 2004/11/11 20:05:56 1.126 +++ loncom/interface/lonmenu.pm 2004/12/03 06:51:50 1.134 @@ -1,7 +1,7 @@ # The LearningOnline Network with CAPA # Routines to control the menu # -# $Id: lonmenu.pm,v 1.126 2004/11/11 20:05:56 albertel Exp $ +# $Id: lonmenu.pm,v 1.134 2004/12/03 06:51:50 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -43,6 +43,7 @@ use Apache::lonnet(); use Apache::Constants qw(:common); use Apache::lonhtmlcommon(); use Apache::loncommon(); +use Apache::lonenc(); use Apache::lonlocal; use vars qw(@desklines $readdesk); @@ -68,6 +69,7 @@ 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 ''; } @@ -76,6 +78,13 @@ sub menubuttons { my $reloadlink=''; 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(); @@ -95,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."
"; @@ -136,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\//) && @@ -150,11 +161,12 @@ ENDRELOAD } my $reg=''; if ($registration) { - $reg=&innerregister($forcereg,$target); + $reg=&innerregister($forcereg,$target,$titletable); } + my $form=&serverform(); my $utility=&utilityfunctions(); return (< + @@ -166,15 +178,16 @@ $utility $reloadlink $navmaps - + $lt{'launch'} LON-CAPA +$form - $reg @@ -224,14 +237,11 @@ sub registerurl { sub innerregister { my $forcereg=shift; my $target = shift; + my $titletable = shift; my $result = ''; my ($uname,$thisdisfn); - my $const_space = 0; - if ($ENV{'request.filename'} =~ /^\/home\/([^\/]+)\/public_html\/(.*)/) { - $const_space = 1; - $uname = $1; - $thisdisfn = $2; - } + my $const_space = ($ENV{'request.state'} eq 'construct'); + my $is_const_dir = 0; if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; } @@ -251,44 +261,12 @@ sub innerregister { if ($noremote) { $newmail=' - - -
'; } - if ($textual && $const_space) { - my $formaction='/priv/'.$uname.'/'.$thisdisfn; - $formaction=~s/\/+/\//g; - my $titleinfo = '
'. - &Apache::lonhtmlcommon::crumbs($uname.'/'.$thisdisfn,'_top','/priv','','-1'). - &Apache::lonhtmlcommon::select_recent('construct','recent', - 'this.form.action=this.form.recent.value;this.form.submit()'). - '
'; - &Apache::lonhtmlcommon::store_recent('construct',$formaction,$formaction); - $newmail .= &constspaceform(); -# role and realm - my ($role,$realm) = &Apache::lonnet::plaintext((split(/\./,$ENV{'request.role'}))[0]); - unless ($realm) { $realm=' '; } - $newmail .= < -
-$titleinfo - - - $ENV{'environment.firstname'} - $ENV{'environment.middlename'} - $ENV{'environment.lastname'} - $ENV{'environment.generation'} -  
- $role  -
-END - } if (($textual) && ($ENV{'request.symb'}) && ($ENV{'request.course.id'})) { 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); - if ($maptitle) { + if ($maptitle && $maptitle ne 'default.sequence') { $newmail.=', '.$maptitle; } if ($restitle) { @@ -301,6 +279,9 @@ END 'You have new messages
': 'swmenu.setstatus("you have","messages");'); } + if ($ENV{'request.state'} eq 'construct') { + $newmail = $titletable; + } if ($noremote) { $newmail.='
'; } @@ -400,15 +381,21 @@ END # Prepare the rest of the buttons my $menuitems; if ($const_space) { + my ($uname,$thisdisfn) = + ($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|); my $currdir = '/priv/'.$uname.'/'.$thisdisfn; - $currdir =~ s#[^/]+$##; - $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 @@ -464,8 +453,7 @@ $newmail $tablestart $inlinebuttons $tableend -$form - @@ -478,7 +466,7 @@ ENDREGTEXT my $navstatus=&get_nav_status(); $result = (< + @@ -655,7 +643,7 @@ sub maincall() { if (($ENV{'browser.interface'} eq 'textual') || ($ENV{'environment.remote'} eq 'off')) { return ''; } return(< + ENDMAINCALL @@ -713,7 +701,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 ''; } @@ -941,7 +929,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'; @@ -1116,6 +1127,7 @@ sub handler { $r->print(< LON-CAPA Main Menu +$script_tag $bodytag ENDHEADER