--- loncom/interface/lonmenu.pm 2008/12/17 13:02:37 1.250
+++ loncom/interface/lonmenu.pm 2009/04/29 16:57:29 1.261
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.250 2008/12/17 13:02:37 harmsja Exp $
+# $Id: lonmenu.pm,v 1.261 2009/04/29 16:57:29 bisitz Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -174,7 +174,7 @@ sub initlittle {
'Courses':'Roles'),
'other' => 'Other Roles',
'docs' => 'Edit Course',
- 'exit' => 'Exit',
+ 'exit' => 'Logout',
'login' => 'Log In',
'launch' => 'Launch Remote Control',
'groups' => 'Groups',
@@ -206,8 +206,8 @@ sub menubuttons {
my $escsymb=&escape(&Apache::lonenc::check_encrypt($env{'request.symb'}));
my $logo=&Apache::loncommon::lonhttpdurl("/adm/lonIcons/minilogo.gif");
- $logo = '
| ';
+ $logo = '';
if ($env{'request.state'} eq 'construct') {
if (($env{'request.noversionuri'} eq '') || (!defined($env{'request.noversionuri'}))) {
@@ -292,7 +292,7 @@ ENDMAINMENU
return (<
- $logo
+ $logo |
|
$lt{'login'}
@@ -301,7 +301,7 @@ ENDMAINMENU
ENDINLINEMENU
}
- $roles = ' | '.$lt{'roles'}.' | ';
+ $roles = ''.$lt{'roles'}.'';
# Do we have a NAV link?
if ($env{'request.course.id'}) {
my $link='/adm/navmaps?postdata='.$escurl.'&postsymb='.
@@ -310,34 +310,35 @@ ENDINLINEMENU
$link="javascript:gonav('".$link."')";
}
$navmaps=(<$lt{'nav'}
+$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=(<$text
+$text
ENDDOCS
}
if ($showgroups) {
$groups =(<$lt{'groups'}
+$lt{'groups'}
ENDGROUPS
}
if (&show_return_link()) {
my $escreload=&escape('return:');
$reloadlink=(<$lt{'ret'}
+$lt{'ret'}
ENDRELOAD
}
if ($role_selector) {
- $roles = ''.$role_selector.' | '.$lt{'other'}.' | ';
+ #$roles = ''.$role_selector.' | '.$lt{'other'}.' | ';
+ $role_selector = ''.$role_selector.'';
}
}
if (($env{'request.state'} eq 'construct') && ($env{'request.course.id'})) {
my $escreload=&escape('return:');
$reloadlink=(<$lt{'ret'}
+$lt{'ret'}
ENDCRELOAD
}
my $reg='';
@@ -347,6 +348,12 @@ ENDCRELOAD
my $form=&serverform();
my $utility=&utilityfunctions();
+ my $messagelink = "";
+ if(&Apache::lonmsg::mynewmail()){
+ $messagelink = 'Message(new)'
+ }else{
+ $messagelink = 'Message'
+ }
my $helplink=&Apache::loncommon::top_nav_help('Help');
return (<
@@ -355,23 +362,26 @@ ENDCRELOAD
$utility
// ]]>
-
+$role_selector
+
$form
+
$reg
ENDINLINEMENU
} else {
@@ -492,7 +502,7 @@ sub innerregister {
if ($env{'request.symb'} ne '' &&
$env{'request.filename'}=~/\.(problem|exam|quiz|assess|survey|form|task)$/) {
if (&Apache::lonnet::allowed('mgr',$crs)) {
- $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_3]',
+ $hwkadd.=&switch('','',7,2,'pgrd.gif','problem[_1]','grades[_4]',
"gocmd('/adm/grades','gradingmenu')",
'Modify user grades for this assessment resource');
} elsif (&Apache::lonnet::allowed('vgr',$crs)) {
@@ -513,6 +523,12 @@ sub innerregister {
### resource
###
my $editbutton = '';
+ my $noeditbutton = 1;
+ my ($cnum,$cdom);
+ if ($env{'request.course.id'}) {
+ $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
+ $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
+ }
if ($env{'user.author'}) {
if ($env{'request.role'}=~/^(aa|ca|au)/) {
# Set defaults for authors
@@ -540,6 +556,7 @@ sub innerregister {
foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
if (!$allowed) {
$editbutton=&switch('','',6,1,$top,,$bottom,$action,$desc);
+ $noeditbutton = 0;
}
}
##
@@ -548,30 +565,53 @@ sub innerregister {
my $cfile='';
my $cfuname='';
my $cfudom='';
+ my $uploaded;
if ($env{'request.filename'}) {
my $file=&Apache::lonnet::declutter($env{'request.filename'});
- $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)) {
- my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
- my $allowed=0;
- my @ids=&Apache::lonnet::current_machine_ids();
- foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
- if ($allowed) {
- $cfile=$file;
+ if (defined($cnum) && defined($cdom)) {
+ $uploaded = &is_course_upload($file,$cnum,$cdom);
+ }
+ if (!$uploaded) {
+ $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)) {
+ my $home=&Apache::lonnet::homeserver($cfuname,$cfudom);
+ my $allowed=0;
+ my @ids=&Apache::lonnet::current_machine_ids();
+ foreach my $id (@ids) { if ($id eq $home) { $allowed=1; } }
+ if ($allowed) {
+ $cfile=$file;
+ }
}
}
- }
+ }
# Finally, turn the button on or off
if ($cfile && !$const_space) {
$editbutton=&switch
('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
"go('".$cfile."');","Edit this resource");
+ $noeditbutton = 0;
} elsif ($editbutton eq '') {
$editbutton=&clear(6,1);
}
}
+ if (($noeditbutton) && ($env{'request.filename'})) {
+ if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ my $file=&Apache::lonnet::declutter($env{'request.filename'});
+ if (defined($cnum) && defined($cdom)) {
+ if (&is_course_upload($file,$cnum,$cdom)) {
+ my $cfile = &edit_course_upload($file,$cnum,$cdom);
+ if ($cfile) {
+ $editbutton=&switch
+ ('','',6,1,'pcstr.gif','edit[_1]',
+ 'resource[_2]',"go('".$cfile."');",
+ 'Edit this resource');
+ }
+ }
+ }
+ }
+ }
###
###
# Prepare the rest of the buttons
@@ -589,7 +629,7 @@ sub innerregister {
$menuitems=(<&');
+ }
+ }
+ return $cfile;
+}
+
sub loadevents() {
if ($env{'request.state'} eq 'construct' ||
$env{'request.noversionuri'} =~ m{^/res/adm/pages/}) { return ''; }
@@ -913,8 +989,9 @@ sub load_remote_msg {
($env{'environment.remote'} eq 'off')) { return ''; }
my $esclowerurl=&escape($lowerurl);
- my $link=&mt('Continue on in Inline Menu mode',
- "/adm/remote?action=collapse&url=$esclowerurl");
+ my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
+ ,''
+ ,'');
return(<