--- loncom/interface/lonmenu.pm 2004/08/10 18:05:12 1.112
+++ loncom/interface/lonmenu.pm 2005/02/17 08:29:42 1.147
@@ -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.147 2005/02/17 08:29:42 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,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,15 +104,20 @@ ENDNAV
ENDRELOAD
}
}
+ my $form=&serverform();
+ my $utility=&utilityfunctions();
my $output=(<
-
+$form
ENDMAINMENU
if ($registration) { $output.=&innerregister($forcereg,$target); }
return $output."
";
@@ -133,13 +146,25 @@ ENDMAINMENU
my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
# Do we have a NAV link?
if ($ENV{'request.course.id'}) {
- $navmaps=(<
-
$reg
@@ -221,7 +252,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;
@@ -245,7 +281,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) {
@@ -258,6 +294,9 @@ sub innerregister {
'You have new messages
@@ -163,15 +193,16 @@ ENDRELOAD
$reloadlink
$navmaps
-
+
$lt{'launch'}
-
+
LON-CAPA
+$form
':
'swmenu.setstatus("you have","messages");');
}
+ if ($ENV{'request.state'} eq 'construct') {
+ $newmail = $titletable;
+ }
if ($noremote) {
$newmail.='';
}
@@ -266,7 +305,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'}) {
@@ -275,7 +314,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')",
@@ -287,7 +327,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');
@@ -344,7 +385,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 +396,26 @@ 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]
ENDINLINE
}
+ if ($const_space && $is_const_dir) {
+ $inlinebuttons = '';
+ }
$result =(<$inlineremote[91] $inlineremote[92] $inlineremote[93]
$link
+ENDREMOTEFORM +} # ================================================================= Reopen menu sub reopenmenu { @@ -628,7 +725,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 ''; } @@ -801,6 +898,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 +938,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; } @@ -847,7 +953,7 @@ sub close { ($ENV{'environment.remote'} eq 'off')) { return ''; } my $menuname='LCmenu'.$Apache::lonnet::perlvar{'lonHostID'}; return(<