--- loncom/interface/lonmenu.pm 2006/05/15 16:23:58 1.181
+++ loncom/interface/lonmenu.pm 2007/07/10 23:38:09 1.219
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.181 2006/05/15 16:23:58 albertel Exp $
+# $Id: lonmenu.pm,v 1.219 2007/07/10 23:38:09 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,12 +44,15 @@ use Apache::lonhtmlcommon();
use Apache::loncommon();
use Apache::lonenc();
use Apache::lonlocal;
+use LONCAPA qw(:DEFAULT :match);
-use vars qw(@desklines $readdesk);
+use vars qw(@desklines %category_names %category_members %category_positions $readdesk);
my @inlineremote;
+
+
# ================================================================ Little texts
sub initlittle {
@@ -58,10 +61,13 @@ sub initlittle {
'main' => 'Main Menu',
'roles' => ($env{'user.adv'}?
'Roles':'Courses'),
- 'docs' => 'Course Documents',
+ 'docs' => 'Edit Course',
'exit' => 'Exit',
+ 'login' => 'Log In',
'launch' => 'Launch Remote Control',
- 'groups' => 'Groups');
+ 'groups' => 'Groups',
+ 'gdoc' => 'Group Documents',
+ );
}
# ============================= This gets called at the top of the body section
@@ -83,23 +89,27 @@ sub menubuttons {
my $docs='';
my $groups='';
my $showgroups=0;
- my $escurl=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
- my $escsymb=&Apache::lonnet::escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
+ my $escurl=&escape(&Apache::lonenc::check_encrypt($env{'request.noversionuri'}));
+ my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
+
+ my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
+ $logo = '
| ';
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);
+ $escurl = &escape($returnurl);
}
}
if ($env{'request.course.id'}) {
my %coursegroups;
- my $viewgrps_permission =
- &Apache::lonnet::allowed('vcg',$env{'request.course.id'});
+ my $viewgrps_permission =
+ &Apache::lonnet::allowed('vcg',$env{'request.course.id'}.($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''));
if (!$viewgrps_permission) {
%coursegroups = &Apache::lonnet::get_active_groups($env{'user.domain'},$env{'user.name'},$env{'course.'.$env{'request.course.id'}.'.domain'}, $env{'course.'.$env{'request.course.id'}.'.num'});
- }
+ }
if ((keys(%coursegroups) > 0) || ($viewgrps_permission)) {
$showgroups = 1;
}
@@ -114,7 +124,7 @@ ENDNAV
if (($env{'request.noversionuri'}=~/^\/adm\//) &&
($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
($env{'request.noversionuri'}!~/^\/adm\/.*\/(smppg|bulletinboard|aboutme)(\?|$)/)) {
- my $escreload=&Apache::lonnet::escape('return:');
+ my $escreload=&escape('return:');
$reloadlink=(<$lt{'ret'}
ENDRELOAD
@@ -126,7 +136,7 @@ ENDDOCS
}
if ($showgroups) {
$groups =(<$lt{'groups'}
+$lt{'groups'}
ENDGROUPS
}
}
@@ -163,18 +173,15 @@ ENDMAINMENU
my $vlink=&Apache::loncommon::designparm($function.'.vlink',$domain);
my $sidebg=&Apache::loncommon::designparm($function.'.sidebg',$domain);
if ($env{'user.name'} eq 'public' && $env{'user.domain'} eq 'public') {
- my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
return (<
-
- $lt{'exit'}
- |
-
-
- LON-CAPA
+ $logo
+ | |
+
+ $lt{'login'}
|
-
+
ENDINLINEMENU
@@ -189,9 +196,11 @@ ENDINLINEMENU
$navmaps=(<$lt{'nav'}
ENDNAV
+my $is_group = (&Apache::loncommon::course_type() eq 'Group');
if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
$docs=(<$lt{'docs'}
+$text |
ENDDOCS
}
if ($showgroups) {
@@ -209,14 +218,14 @@ ENDGROUPS
m[^/adm/.*/(smppg|bulletinboard|aboutme)($|\?)])
)
) {
- my $escreload=&Apache::lonnet::escape('return:');
+ my $escreload=&escape('return:');
$reloadlink=(<$lt{'ret'}
ENDRELOAD
}
}
if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
- my $escreload=&Apache::lonnet::escape('return:');
+ my $escreload=&escape('return:');
$reloadlink=(<$lt{'ret'}
ENDCRELOAD
@@ -227,11 +236,12 @@ ENDCRELOAD
}
my $form=&serverform();
my $utility=&utilityfunctions();
- my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
my $remote;
if ($env{'user.adv'}) {
$remote = ''.$lt{'launch'}.' | '
}
+
+ my $helplink=&Apache::loncommon::top_nav_help('Help');
return (<
// BEGIN LON-CAPA Internal
@@ -241,6 +251,7 @@ $utility
$form
@@ -277,7 +288,7 @@ sub registerurl {
($env{'environment.remote'} eq 'off') ||
((($env{'request.publicaccess'}) ||
(!&Apache::lonnet::is_on_map(
- &Apache::lonnet::unescape($env{'request.noversionuri'})))) &&
+ &unescape($env{'request.noversionuri'})))) &&
(!$forcereg))) {
return $result.
''.$force_title;
@@ -378,7 +389,7 @@ sub innerregister {
&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');
+ 'Modify parameter settings for this resource');
}
# -- End Homework
###
@@ -396,7 +407,7 @@ sub innerregister {
my $desc = "Enter my resource construction space";
# Set defaults for co-authors
if ($env{'request.role'} =~ /^ca/) {
- ($cadom,$caname)=($env{'request.role'}=~/(\w+)\/(\w+)$/);
+ ($cadom,$caname)=($env{'request.role'}=~/($match_domain)\/($match_username)$/);
($top,$bottom) = ('co con-','struct');
$action = "go('/priv/".$caname."');";
$desc = "Enter construction space as co-author";
@@ -418,7 +429,7 @@ sub innerregister {
my $cfudom='';
if ($env{'request.filename'}) {
my $file=&Apache::lonnet::declutter($env{'request.filename'});
- $file=~s/^(\w+)\/(\w+)/\/priv\/$2/;
+ $file=~s/^($match_domain)\/($match_username)/\/priv\/$2/;
# Check that the user has permission to edit this resource
($cfuname,$cfudom)=&Apache::loncacc::constructaccess($file,$1);
if (defined($cfudom)) {
@@ -434,13 +445,10 @@ sub innerregister {
# Finally, turn the button on or off
if ($cfile && !$const_space) {
$editbutton=&switch
- ('','',6,1,'cstr.gif','edit[_1]','resource[_2]',
+ ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
"go('".$cfile."');","Edit this resource");
} elsif ($editbutton eq '') {
- $editbutton=&switch('','',6,1,'port.gif',
- 'port-[_1]','folio[_1]',
- "go('/adm/portfolio');",
- "Enter my portfolio space");
+ $editbutton=&clear(6,1);
}
}
###
@@ -455,35 +463,47 @@ sub innerregister {
$is_const_dir = 1;
} else {
$currdir =~ s#[^/]+$##;
+ my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
+ my $esc_currdir = &Apache::loncommon::escape_single($currdir);
$menuitems=(<
+$inlineremote[21] $inlineremote[23]
+$inlineremote[61] $inlineremote[63]
+$inlineremote[71] $inlineremote[72] $inlineremote[73]
+$inlineremote[81] $inlineremote[82] $inlineremote[83]
+$inlineremote[91] $inlineremote[92] $inlineremote[93] |
+ENDINLINEICONS
+ } 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 =(<
@@ -729,9 +760,9 @@ sub load_remote_msg {
if (($env{'browser.interface'} eq 'textual') ||
($env{'environment.remote'} eq 'off')) { return ''; }
- my $esclowerurl=&Apache::lonnet::escape($lowerurl);
+ my $esclowerurl=&escape($lowerurl);
my $link=&mt('Continue on in Inline Menu mode',
- "/adm/remote?action=collapse?url=$esclowerurl");
+ "/adm/remote?action=collapse&url=$esclowerurl");
return(<