--- loncom/interface/lonmenu.pm 2010/06/14 09:16:33 1.331
+++ loncom/interface/lonmenu.pm 2011/01/16 22:45:05 1.342
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.331 2010/06/14 09:16:33 droeschl Exp $
+# $Id: lonmenu.pm,v 1.342 2011/01/16 22:45:05 www Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -107,8 +107,6 @@ entries from mydesk.tab
Same as primary_menu() but operates on @secondary_menu.
-=item show_return_link()
-
=item innerregister()
This gets called in order to register a URL in the body of the document
@@ -214,7 +212,18 @@ sub primary_menu {
if ($$menuitem[3] eq 'Help') { # special treatment for helplink
- $menu .= '
'.&Apache::loncommon::top_nav_help('Help').'
';
+ if ($public) {
+ my $origmail = $Apache::lonnet::perlvar{'lonSupportEMail'};
+ my $defdom = &Apache::lonnet::default_login_domain();
+ my $to = &Apache::loncommon::build_recipient_list(undef,
+ 'helpdeskmail',
+ $defdom,$origmail);
+ if ($to ne '') {
+ $menu .= &prep_menuitem($menuitem);
+ }
+ } else {
+ $menu .= '
'.&Apache::loncommon::top_nav_help('Help').'
';
+ }
} else {
$menu .= prep_menuitem($menuitem);
}
@@ -261,10 +270,10 @@ sub secondary_menu {
my $canviewgrps = &Apache::lonnet::allowed('vcg', $crs_sec);
my $canmodifyuser = &Apache::lonnet::allowed('cst', $crs_sec);
my $canviewwnew = &Apache::lonnet::allowed('whn', $crs_sec);
- my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec);
+ my $canmodpara = &Apache::lonnet::allowed('opa', $crs_sec);
+ my $canvgr = &Apache::lonnet::allowed('vgr', $crs_sec);
my $author = getauthor();
- my $showlink = &show_return_link();
my %groups = &Apache::lonnet::get_active_groups(
$env{'user.domain'}, $env{'user.name'},
$env{'course.' . $env{'request.course.id'} . '.domain'},
@@ -276,15 +285,12 @@ sub secondary_menu {
next if $$menuitem[4] ne 'always'
&& $$menuitem[4] ne 'author'
&& !$env{'request.course.id'};
- next if $$menuitem[4] eq 'showreturn'
- && !$showlink
- && !($env{'request.state'} eq 'construct');
next if $$menuitem[4] =~ /^mdc/
&& !$canedit;
- next if $$menuitem[4] eq 'mdcCourse'
- && $crstype eq 'Community';
- next if $$menuitem[4] eq 'mdcCommunity'
- && $crstype ne 'Community';
+ next if $$menuitem[4] eq 'nvgr'
+ && $canvgr;
+ next if $$menuitem[4] eq 'vgr'
+ && !$canvgr;
next if $$menuitem[4] eq 'cst'
&& !$canmodifyuser;
next if $$menuitem[4] eq 'whn'
@@ -334,24 +340,6 @@ sub secondary_menu {
return "
$menu
";
}
-sub show_return_link {
- if (($env{'request.noversionuri'} =~ m{^/adm/(viewclasslist|navmaps)($|\?)})
- || ($env{'request.noversionuri'} =~ m{^/adm/.*/aboutme($|\?)})) {
-
- return if ($env{'form.register'});
- }
- return (($env{'request.noversionuri'}=~m{^/(res|public)/} &&
- $env{'request.symb'} eq '')
- ||
- ($env{'request.noversionuri'}=~ m{^/cgi-bin/printout.pl})
- ||
- (($env{'request.noversionuri'}=~/^\/adm\//) &&
- ($env{'request.noversionuri'}!~/^\/adm\/wrapper\//) &&
- ($env{'request.noversionuri'}!~
- m{^/adm/.*/(smppg|bulletinboard)($|\?)})
- ));
-}
-
sub innerregister {
my ($forcereg,$bread_crumbs) = @_;
my $const_space = ($env{'request.state'} eq 'construct');
@@ -525,15 +513,18 @@ sub innerregister {
if ($nocrsedit) {
$editbutton=&clear(6,1);
} else {
+ my $bot = "go('$cfile')";
if ($switchserver) {
if ( $env{'request.symb'} && $env{'request.course.id'} ) {
- my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
- $cfile = '/adm/switchserver?otherserver='.$home.'&role='.$env{'request.role'}.'&symb='.$env{'request.symb'}.'&origurl='.$resurl;
+ $cfile = '/adm/switchserver?otherserver='.$home.'&role='.
+ &HTML::Entities::encode($env{'request.role'},'"<>&').'&symb='.
+ &HTML::Entities::encode($env{'request.symb'},'"<>&');
+ $bot = "need_switchserver('$cfile');";
}
}
$editbutton=&switch
('','',6,1,'pcstr.png','edit[_1]','resource[_2]',
- "go('".$cfile."');","Edit this resource");
+ $bot,"Edit this resource");
$noeditbutton = 0;
}
} elsif ($editbutton eq '') {
@@ -598,14 +589,20 @@ ENDMENUITEMS
#
$menuitems=(< 1});
- my $start_page_bookmark =
- &Apache::loncommon::start_page('Bookmarks',undef,
+ my $confirm_switch = &mt("Editing requires switching to the resource's home server.").'\n'.
+ &mt('Switch server?');
+
+ my $start_page_wishlistlink =
+ &Apache::loncommon::start_page('Set link to wishlist',undef,
{'only_body' => 1,
'js_ready' => 1,
- 'bgcolor' => '#BBBBBB',});
+ 'bgcolor' => '#FFFFFF',});
+
+ my $warningLink = &mt('You must insert a title!');
- my $end_page_bookmark =
+ # HTML-Markup for 'Set a link for this resource to wishlist'
+ # this is written via JavaScript document.write (function set_wishlistlink)
+ # it is split into 3 parts and the inputfields for title and path are left out
+ # these fields are inserted later to set the values for title and path
+ # automatically via JavaScript (document.title and location.pathname)
+ my %folders = &Apache::lonnet::get('wishlist',['folders']);
+ if ($folders{'folders'} eq '') {
+ $folders{'folders'} = '';
+ }
+ my $in_page_wishlistlink1 = '