--- loncom/interface/lonmenu.pm 2010/12/30 21:36:50 1.315.2.6
+++ loncom/interface/lonmenu.pm 2012/05/01 12:39:32 1.315.2.15.2.3
@@ -1,7 +1,7 @@
# The LearningOnline Network with CAPA
# Routines to control the menu
#
-# $Id: lonmenu.pm,v 1.315.2.6 2010/12/30 21:36:50 raeburn Exp $
+# $Id: lonmenu.pm,v 1.315.2.15.2.3 2012/05/01 12:39:32 raeburn Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -205,10 +205,10 @@ sub prep_menuitem {
} else { # textual Link
$link = &mt($$menuitem[3]);
}
- if($$menuitem[4] eq 'newmsg'){ #special style for New Messages
- return '
'.$link.'';
- }
- return ''.$link.'';
+ return '$link|;
}
# primary_menu() evaluates @primary_menu and returns XHTML for the menu
@@ -258,9 +258,7 @@ sub primary_menu {
$menu .= ''.&Apache::loncommon::top_nav_help('Help').'';
}
} else {
- my @items = @{$menuitem};
- $items[0] = 'javascript:'.$menuitem->[0].';';
- $menu .= &prep_menuitem(\@items);
+ $menu .= &prep_menuitem($menuitem);
}
}
@@ -455,12 +453,12 @@ sub innerregister {
$newmail= 'swmenu.setstatus("you have","messages");';
}
- my ($breadcrumb,$separator);
+ my ($breadcrumb,$separator,$resurl);
if ($noremote
&& ($env{'request.symb'})
&& ($env{'request.course.id'})) {
- my ($mapurl,$rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
+ (my $mapurl, my $rid,$resurl) = &Apache::lonnet::decode_symb(&Apache::lonnet::symbread());
my $coursetitle = $env{'course.'.$env{'request.course.id'}.'.description'};
my $maptitle = &Apache::lonnet::gettitle($mapurl);
@@ -672,6 +670,18 @@ sub innerregister {
}
}
}
+ if ($env{'request.course.id'}) {
+ if ($resurl eq "public/$cdom/$cnum/syllabus") {
+ if ($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'} =~ /\w/) {
+ if (&Apache::lonnet::allowed('mdc',$env{'request.course.id'})) {
+ $editbutton=&switch('','',6,1,'pcstr.png','Edit',
+ 'resource[_2]',
+ "go('/adm/courseprefs?phase=display&actions=courseinfo')",
+ 'Edit this resource');
+ }
+ }
+ }
+ }
###
###
# Prepare the rest of the buttons
@@ -714,6 +724,18 @@ ENDMENUITEMS
# We are in a course and looking at a registred URL
# Should probably be in mydesk.tab
#
+
+ my %icon_text;
+ if ($noremote) {
+ %icon_text = &Apache::lonlocal::texthash (
+ annotate => 'Notes',
+ bookmark => 'Bookmark',
+ catalog => 'Info',
+ evaluate => 'Evaluate',
+ feedback => 'Communicate',
+ printout => 'Print',
+ );
+ }
$menuitems=(< 0){
$menuitems.="anot.gif";
}
$menuitems.="&anno-[_1]&tations[_1]&annotate()&";
-$menuitems.="Make notes and annotations about this resource&&1\n";
+$menuitems.="Make notes and annotations about this resource&&1&$icon_text{'annotate'}\n";
unless ($noremote) {
my $showreqcrs = &check_for_rcrs();
@@ -746,21 +772,30 @@ $menuitems.="Make notes and annotations
}
unless ($env{'request.noversionuri'}=~/\/(bulletinboard|smppg|navmaps|syllabus|aboutme|viewclasslist|portfolio)(\?|$)/) {
if ((!$env{'request.enc'}) && ($env{'request.noversionuri'} !~ m{^/adm/wrapper/ext/})) {
+ my $tail;
+ unless ($env{'request.state'} eq 'construct') {
+ $tail = '&&&'.$icon_text{'catalog'};
+ }
$menuitems.=(<13)) { return ''; }
@@ -1238,9 +1275,13 @@ sub switch {
if ($env{'environment.icons'} eq 'iconsonly') {
$inlineremote[$idx]=''.$pic.'';
} else {
+ my $icon_text = $desc;
+ if ($inlinetools) {
+ $icon_text = $inlinetools.' ';
+ }
$inlineremote[$idx]=
'';
+ '';
}
}
}
@@ -1663,12 +1704,6 @@ function go(url) {
}
}
-function gotop(url) {
- if (url!='' && url!= null) {
- top.location.href = url;
- }
-}
-
function need_switchserver(url) {
if (url!='' && url!= null) {
if (confirm("$confirm_switch")) {
@@ -1864,7 +1899,7 @@ sub roles_selector {
my ($cdom,$cnum) = @_;
my $crstype = &Apache::loncommon::course_type();
my $now = time;
- my (%courseroles,%seccount);
+ my (%courseroles,%seccount,%courseprivs);
my $is_cc;
my $role_selector;
my $ccrole;
@@ -1872,7 +1907,17 @@ sub roles_selector {
$ccrole = 'co';
} else {
$ccrole = 'cc';
- }
+ }
+ my $priv;
+ my $destinationurl = $ENV{'REQUEST_URI'};
+ my $reqprivs = &required_privs();
+ if (ref($reqprivs) eq 'HASH') {
+ my $destination = $destinationurl;
+ $destination =~ s/(\?.*)$//;
+ if (exists($reqprivs->{$destination})) {
+ $priv = $reqprivs->{$destination};
+ }
+ }
if ($env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum}) {
my ($start,$end) = split(/\./,$env{'user.role.'.$ccrole.'./'.$cdom.'/'.$cnum});
@@ -1885,7 +1930,7 @@ sub roles_selector {
}
}
if ($is_cc) {
- &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount);
+ &get_all_courseroles($cdom,$cnum,\%courseroles,\%seccount,\%courseprivs,$priv);
} else {
my %gotnosection;
foreach my $item (keys(%env)) {
@@ -1901,6 +1946,18 @@ sub roles_selector {
$gotnosection{$role} = 1;
}
}
+ if ($priv ne '') {
+ my $cnumsec = $cnum;
+ if ($sec ne '') {
+ $cnumsec .= "/$sec";
+ }
+ $courseprivs{"$role./$cdom/$cnumsec./"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/"};
+ $courseprivs{"$role./$cdom/$cnumsec./$cdom/$cnumsec"} =
+ $env{"user.priv.$role./$cdom/$cnumsec./$cdom/$cnumsec"};
+ }
if (ref($courseroles{$role}) eq 'ARRAY') {
if ($sec ne '') {
if (!grep(/^\Q$sec\E$/,@{$courseroles{$role}})) {
@@ -1926,7 +1983,7 @@ sub roles_selector {
}
my @roles_order = ($ccrole,'in','ta','ep','ad','st');
if (keys(%courseroles) > 1) {
- $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles);
+ $role_selector = &jump_to_role($cdom,$cnum,\%seccount,\%courseroles,\%courseprivs,$priv);
$role_selector .= '