--- loncom/interface/lonmenu.pm 2004/11/14 07:32:20 1.130
+++ loncom/interface/lonmenu.pm 2004/12/03 22:10:39 1.135
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.130 2004/11/14 07:32:20 albertel Exp $
+# $Id: lonmenu.pm,v 1.135 2004/12/03 22:10:39 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -69,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 ''; }
@@ -77,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();
@@ -153,7 +161,7 @@ ENDRELOAD
}
my $reg='';
if ($registration) {
- $reg=&innerregister($forcereg,$target);
+ $reg=&innerregister($forcereg,$target,$titletable);
}
my $form=&serverform();
my $utility=&utilityfunctions();
@@ -229,9 +237,11 @@ 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 ''; }
@@ -256,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) {
@@ -269,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.='';
}
@@ -371,14 +384,18 @@ sub innerregister {
my ($uname,$thisdisfn) =
($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
- $currdir =~ s#[^/]+$##;
- $menuitems=(<$inlineremote[91] | $inlineremote[92] | $inlineremote[93] |
ENDINLINE
}
+ if ($const_space && $is_const_dir) {
+ $inlinebuttons = '';
+ }
$result =(<
// BEGIN LON-CAPA Internal
@@ -531,12 +551,14 @@ ENDDONOTREGTHIS
}
sub loadevents() {
- if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
+ if ($ENV{'request.state'} eq 'construct' ||
+ $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
return 'LONCAPAreg();';
}
sub unloadevents() {
- if ($ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
+ if ($ENV{'request.state'} eq 'construct' ||
+ $ENV{'request.noversionuri'} eq '/res/adm/pages/menu.html') { return ''; }
return 'LONCAPAstale();';
}
@@ -947,8 +969,9 @@ NAVCONTROL
}
sub utilityfunctions {
+ my $caller = shift;
unless (($ENV{'browser.interface'} eq 'textual') ||
- ($ENV{'environment.remote'} eq 'off')) { return ''; }
+ ($ENV{'environment.remote'} eq 'off') || ($caller eq '/adm/menu')) { return ''; }
my $currenturl=&Apache::lonenc::check_encrypt($ENV{'request.noversionuri'});
my $currentsymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
@@ -1004,6 +1027,15 @@ function gocstr(url,filename) {
}
}
+function golist(url) {
+ if (url!='' && url!= null) {
+ currentURL = null;
+ currentSymb= null;
+ top.location.href=url;
+ }
+}
+
+
function catalog_info() {
loncatinfo=window.open(window.location.pathname+'.meta',"LONcatInfo",'height=320,width=280,resizable=yes,scrollbars=yes,location=no,menubar=no,toolbar=no');
@@ -1080,7 +1112,16 @@ sub handler {
$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
+ my $script_tag;
+ if ($ENV{'environment.remote'} eq 'on') {
+ my $utility=&utilityfunctions('/adm/menu');
+ $script_tag=(<
+$utility
+
+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';
@@ -1088,6 +1129,7 @@ sub handler {
$r->print(<
LON-CAPA Main Menu
+$script_tag
$bodytag
ENDHEADER