--- loncom/interface/lonmenu.pm 2010/08/20 17:59:04 1.244.2.18
+++ loncom/interface/lonmenu.pm 2009/05/06 12:13:18 1.262
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.244.2.18 2010/08/20 17:59:04 raeburn Exp $
+# $Id: lonmenu.pm,v 1.262 2009/05/06 12:13:18 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -120,6 +120,11 @@ The javascript is usually similar to "go
=item get_nav_status()
+=item convert_menu_function()
+
+FIXME this needs to move into mydesktab and the other locations
+the text is generated
+
=item hidden_button_check()
=item roles_selector()
@@ -139,7 +144,6 @@ use Apache::loncommon();
use Apache::lonenc();
use Apache::lonlocal;
use LONCAPA qw(:DEFAULT :match);
-use HTML::Entities();
use vars qw(@desklines %category_names %category_members %category_positions $readdesk);
@@ -163,23 +167,19 @@ sub show_course {
}
sub initlittle {
- my %lt=&Apache::lonlocal::texthash('ret' => 'Return to Last Location',
- 'nav' => 'Course Contents',
+ return &Apache::lonlocal::texthash('ret' => 'Return to Last Location',
+ 'nav' => 'Navigate Contents',
'main' => 'Main Menu',
- 'roles' => (&Apache::loncommon::show_course()?
+ 'roles' => (&show_course()?
'Courses':'Roles'),
'other' => 'Other Roles',
- 'docs' => 'Course Editor',
+ 'docs' => 'Edit Course',
'exit' => 'Logout',
'login' => 'Log In',
'launch' => 'Launch Remote Control',
'groups' => 'Groups',
+ 'gdoc' => 'Group Documents',
);
- if (&Apache::loncommon::course_type() eq 'Community') {
- $lt{'nav'} = &mt('Community Contents');
- $lt{'docs'} = &mt('Community Editor');
- }
- return %lt;
}
sub menubuttons {
@@ -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'}))) {
@@ -246,8 +246,8 @@ ENDNAV
$lt{'ret'}
ENDRELOAD
}
- if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
- $docs=(<$lt{'docs'}
ENDDOCS
}
@@ -292,17 +292,16 @@ ENDMAINMENU
return (<
- $logo
+ $logo |
|
$lt{'login'}
|
-
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='.
@@ -311,32 +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=(<$lt{'docs'}
+$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='';
@@ -346,31 +348,40 @@ 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 (<
-//
-
+$role_selector
+
$form
+
$reg
ENDINLINEMENU
} else {
@@ -407,9 +418,7 @@ sub registerurl {
&unescape($env{'request.noversionuri'})))) &&
(!$forcereg))) {
return $result.
- ''.$force_title;
+ ''.$force_title;
}
# Graphical display after login only
if ($env{'request.registered'} && !$forcereg) { return ''; }
@@ -557,57 +566,37 @@ sub innerregister {
my $cfuname='';
my $cfudom='';
my $uploaded;
- my $switchserver='';
- my $home;
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)) {
- $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;
- } else {
- $switchserver=$file;
- }
- }
- }
- # Finally, turn the button on or off
- if (($cfile || $switchserver) && !$const_space) {
- my $nocrsedit;
- # Suppress display where CC has switched to student role.
- if ($env{'request.course.id'}) {
- unless(&Apache::lonnet::allowed('mdc',
- $env{'request.course.id'})) {
- $nocrsedit = 1;
- }
+ if (defined($cnum) && defined($cdom)) {
+ $uploaded = &is_course_upload($file,$cnum,$cdom);
}
- if ($nocrsedit) {
- $editbutton=&clear(6,1);
- } else {
- my $bot = "go('$cfile')";
- if ($switchserver) {
- if ( $env{'request.symb'} && $env{'request.course.id'} ) {
- $cfile = '/adm/switchserver?otherserver='.$home.'&role='.
- &HTML::Entities::encode($env{'request.role'},'"<>&').'&symb='.
- &HTML::Entities::encode($env{'request.symb'},'"<>&');
+ 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;
}
- $bot = "need_switchserver('$cfile');";
}
- $editbutton=&switch
- ('','',6,1,'pcstr.png','edit[_1]','resource[_2]',
- $bot,"Edit this resource");
- $noeditbutton = 0;
}
+ }
+ # 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 (($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)) {
@@ -670,15 +659,8 @@ if(length($annotation) > 0){
$menuitems.="&anno-[_1]&tations[_1]&annotate()&";
$menuitems.="Make notes and annotations about this resource&&1\n";
- unless ($noremote) {
- my $showreqcrs = &check_for_rcrs();
- if ($showreqcrs) {
- $menuitems.="s&8&1&rcrs.gif&request[_1]&course[_16]".
- "&go('/adm/requestcourse')&Course requests\n";
- }
- }
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme)(\?|$)/) {
- if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
+ if (!$env{'request.enc'}) {
$menuitems.=(<
-//
ENDREGTHIS
}
@@ -834,7 +814,6 @@ ENDDONOTREGTEXT
$result = (<
-//
ENDDONOTREGTHIS
}
@@ -931,7 +909,6 @@ sub startupremote {
my $message=&mt('"Waiting for Remote Control window to load: "+[_1]','waited');
return(<
-//
+
ENDREMOTESTARTUP
}
@@ -989,10 +966,8 @@ ENDREMOTESTARTUP
sub setflags() {
return(<
-//
ENDSETFLAGS
}
@@ -1002,9 +977,7 @@ sub maincall() {
($env{'environment.remote'} eq 'off')) { return ''; }
return(<
-//
ENDMAINCALL
}
@@ -1016,9 +989,9 @@ sub load_remote_msg {
($env{'environment.remote'} eq 'off')) { return ''; }
my $esclowerurl=&escape($lowerurl);
- my $link=&mt('[_1]Continue[_2] on in Inline Menu mode',
- '',
- '');
+ my $link=&mt('[_1]Continue[_2] on in Inline Menu mode'
+ ,''
+ ,'');
return(<