--- loncom/interface/lonmenu.pm 2006/05/30 20:09:25 1.184
+++ loncom/interface/lonmenu.pm 2006/12/05 02:55:53 1.206
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.184 2006/05/30 20:09:25 raeburn Exp $
+# $Id: lonmenu.pm,v 1.206 2006/12/05 02:55:53 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -44,14 +44,15 @@ use Apache::lonhtmlcommon();
use Apache::loncommon();
use Apache::lonenc();
use Apache::lonlocal;
-use lib '/home/httpd/lib/perl/';
-use LONCAPA;
+use LONCAPA qw{:DEFAULT :match);
use vars qw(@desklines $readdesk);
my @inlineremote;
+
+
# ================================================================ Little texts
sub initlittle {
@@ -62,10 +63,10 @@ sub initlittle {
'Roles':'Courses'),
'docs' => 'Course Documents',
'exit' => 'Exit',
+ 'login' => 'Log In',
'launch' => 'Launch Remote Control',
- 'groups' => 'Course Groups',
+ 'groups' => 'Groups',
'gdoc' => 'Group Documents',
- 'teams' => 'Teams',
);
}
@@ -91,6 +92,10 @@ sub menubuttons {
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'};
@@ -100,11 +105,11 @@ sub menubuttons {
}
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;
}
@@ -131,7 +136,7 @@ ENDDOCS
}
if ($showgroups) {
$groups =(<$lt{'groups'}
+$lt{'groups'}
ENDGROUPS
}
}
@@ -168,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
@@ -194,24 +196,16 @@ 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 = $lt{'docs'};
- if ($env{'course.'.$env{'request.course.id'}.'.type'} eq
- 'Group') {
- $text = $lt{'gdoc'};
- }
+ my $text = ($is_group) ? $lt{'gdoc'} : $lt{'docs'};
$docs=(<$text
ENDDOCS
}
if ($showgroups) {
- my $text = $lt{'groups'};
- if ($env{'course.'.$env{'request.course.id'}.'.type'} eq
- 'Group') {
- $text = $lt{'teams'};
- }
$groups =(<$text
+$lt{'groups'}
ENDGROUPS
}
if (
@@ -242,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
@@ -256,6 +251,7 @@ $utility
$form
@@ -393,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
###
@@ -411,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";
@@ -433,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)) {
@@ -452,10 +448,7 @@ sub innerregister {
('','',6,1,'cstr.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);
}
}
###
@@ -470,16 +463,17 @@ sub innerregister {
$is_const_dir = 1;
} else {
$currdir =~ s#[^/]+$##;
+ my $cleandisfn = &Apache::loncommon::escape_single($thisdisfn);
$menuitems=(<'.$returnval.'';
@@ -940,7 +939,7 @@ sub rawconfig {
$prt=~s/\$udom/$udom/g;
$prt=~s/\$crs/$crs/g;
$prt=~s/\$requested_domain/$requested_domain/g;
- my $type = $env{'course.'.$env{'request.course.id'}.'.type'};
+ my $type = &Apache::loncommon::course_type();
if ($type eq 'Group') {
$desc = &convert_menu_function($desc,$type);
}
@@ -989,7 +988,7 @@ sub rawconfig {
my $caname=$env{'user.name'};
if ($prt eq 'rca') {
($cadom,$caname)=
- ($env{'request.role'}=~/(\w+)\/(\w+)$/);
+ ($env{'request.role'}=~/($match_domain)\/($match_username)$/);
}
$act =~ s/\$caname/$caname/g;
my $home = &Apache::lonnet::homeserver($caname,$cadom);
@@ -1077,13 +1076,16 @@ sub utilityfunctions {
'add_entries' => {
'onload' => 'javascript:document.goannotate.submit();'}});
+ my $end_page_annotate =
+ &Apache::loncommon::end_page({'js_ready' => 1});
+
my $start_page_bookmark =
&Apache::loncommon::start_page('Bookmarks',undef,
{'only_body' => 1,
'js_ready' => 1,
'bgcolor' => '#BBBBBB',});
- my $end_page =
+ my $end_page_bookmark =
&Apache::loncommon::end_page({'js_ready' => 1});
return (<"
+" "
+"<\\/form>"
- +'$end_page');
+ +'$end_page_annotate');
annotator.document.close();
}
@@ -1225,7 +1227,7 @@ function set_bookmark() {
+"value='Save' /> <\\/center><\\/td>"
+"<\\/tr><\\/table><\\/form><\\/center>"
- +'$end_page' );
+ +'$end_page_bookmark' );
bmquery.document.close();
}
@@ -1272,6 +1274,8 @@ sub get_nav_status {
return $navstatus;
}
+#FIXME this needs to move into mydesktab and the other locations
+# the text is generated
sub convert_menu_function {
my ($rolename,$type) = @_;
if ($type eq 'Group') {