--- loncom/interface/lonmenu.pm 2004/11/11 23:45:36 1.128
+++ loncom/interface/lonmenu.pm 2005/02/21 00:32:04 1.149
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.128 2004/11/11 23:45:36 albertel Exp $
+# $Id: lonmenu.pm,v 1.149 2005/02/21 00:32:04 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -60,6 +60,9 @@ sub initlittle {
return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
'nav' => 'Navigate Contents',
'main' => 'Main Menu',
+ 'roles' => ($ENV{'user.adv'}?
+ 'Roles':'Courses'),
+ 'exit' => 'Exit',
'launch' => 'Launch Remote Control');
}
@@ -69,14 +72,23 @@ 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 ''; }
+ if (($ENV{'form.inhibitmenu'} eq 'yes') ||
+ ($ENV{'REQUEST_URI'} eq '/adm/logout')) { return ''; }
my $navmaps='';
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,18 +107,24 @@ ENDNAV
$lt{'ret'}
ENDRELOAD
}
- }
+ }
+ my $form=&serverform();
my $utility=&utilityfunctions();
my $output=(<
-// BEGIN LON-CAPA Internal
+
$lt{'main'}
-$reloadlink $navmaps
-
+$form
ENDMAINMENU
if ($registration) { $output.=&innerregister($forcereg,$target); }
return $output."
";
@@ -135,13 +153,25 @@ ENDMAINMENU
my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
# Do we have a NAV link?
if ($ENV{'request.course.id'}) {
- $navmaps=(<
-$lt{'nav'}
+$lt{'nav'}
ENDNAV
- if (($ENV{'request.noversionuri'}=~/^\/adm\//) &&
- ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
- ($ENV{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
+ if (
+ ($ENV{'request.noversionuri'}=~m[^/(res|public)/] &&
+ $ENV{'request.symb'} eq '')
+ ||
+ (($ENV{'request.noversionuri'}=~/^\/adm\//) &&
+ ($ENV{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
+ ($ENV{'request.noversionuri'}!~
+ m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
+ )
+ ) {
my $escreload=&Apache::lonnet::escape('return:');
$reloadlink=(<
@@ -151,13 +181,16 @@ ENDRELOAD
}
my $reg='';
if ($registration) {
- $reg=&innerregister($forcereg,$target);
+ $reg=&innerregister($forcereg,$target,$titletable);
}
+ my $form=&serverform();
my $utility=&utilityfunctions();
+ my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
return (<
-// BEGIN LON-CAPA Internal
+
-
$reg
@@ -225,9 +265,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 ''; }
@@ -252,7 +294,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) {
@@ -265,6 +307,9 @@ sub innerregister {
'You have new messages
':
'swmenu.setstatus("you have","messages");');
}
+ if ($ENV{'request.state'} eq 'construct') {
+ $newmail = $titletable;
+ }
if ($noremote) {
$newmail.='';
}
@@ -273,7 +318,7 @@ sub innerregister {
my $tableend=($noremote?'':'').($textinter?'':'');
# =============================================================================
# ============================ This is for URLs that actually can be registered
- if (($ENV{'request.noversionuri'}!~/^\/(res\/)*adm\//) || ($forcereg)) {
+ if (($ENV{'request.noversionuri'}!~m|^/(res/)*adm/|) || ($forcereg)) {
# -- This applies to homework problems for users with grading privileges
my $crs='/'.$ENV{'request.course.id'};
if ($ENV{'request.course.sec'}) {
@@ -282,7 +327,8 @@ sub innerregister {
$crs=~s/\_/\//g;
my $hwkadd='';
- if ($ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
+ if ($ENV{'request.symb'} ne '' &&
+ $ENV{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form)$/) {
if (&Apache::lonnet::allowed('vgr',$crs)) {
$hwkadd.=&switch('','',7,1,'subm.gif','view sub-[_1]','missions[_1]',
"gocmd('/adm/grades','submission')",
@@ -294,7 +340,8 @@ sub innerregister {
'Modify user grades for this assessment resource');
}
}
- if (&Apache::lonnet::allowed('opa',$crs)) {
+ if ($ENV{'request.symb'} ne '' &&
+ &Apache::lonnet::allowed('opa',$crs)) {
$hwkadd.=&switch('','',7,3,'pparm.gif','problem[_2]','parms[_2]',
"gocmd('/adm/parmset','set')",
'Modify deadlines, etc, for this resource');
@@ -367,15 +414,20 @@ sub innerregister {
my ($uname,$thisdisfn) =
($ENV{'request.filename'}=~m|^/home/([^/]+)/public_html/(.*)|);
my $currdir = '/priv/'.$uname.'/'.$thisdisfn;
- $currdir =~ s#[^/]+$##;
- $menuitems=(<$inlineremote[21] |   | $inlineremote[23] |
+ } else {
+ $inlinebuttons=(<$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
+ }
}
$result =(<
+
$timesync
@@ -430,22 +486,24 @@ $newmail
$tablestart
$inlinebuttons
$tableend
-$form
-
ENDREGTEXT
# Registered, graphical output
} else {
- my $requri=(split(/\?/,$ENV{'request.noversionuri'}))[0];
+ my $requri=&Apache::lonnet::clutter(&Apache::lonnet::fixversion((split(/\?/,$ENV{'request.noversionuri'}))[0]));
$requri=&Apache::lonenc::check_encrypt(&Apache::lonnet::unescape($requri));
my $cursymb=&Apache::lonenc::check_encrypt($ENV{'request.symb'});
my $navstatus=&get_nav_status();
+ my $clearcstr;
+
+ if ($ENV{'user.adv'}) { $clearcstr='clearbut(6,1)'; }
$result = (<
-// BEGIN LON-CAPA Internal
+
ENDREGTHIS
}
@@ -495,7 +553,7 @@ ENDDONOTREGTEXT
# Not registered, graphical
$result = (<
+
@@ -621,7 +681,7 @@ sub maincall() {
if (($ENV{'browser.interface'} eq 'textual') ||
($ENV{'environment.remote'} eq 'off')) { return ''; }
return(<
+
ENDMAINCALL
@@ -679,7 +739,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 '';
}
@@ -907,7 +967,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';
}
+ my $html=&Apache::lonxml::xmlbegin();
$r->print(<
+$html
+
LON-CAPA Main Menu
+$script_tag
$bodytag
ENDHEADER