[LON-CAPA-cvs] cvs: loncom /interface lonmenu.pm mydesk.tab

raeburn raeburn at source.lon-capa.org
Thu Aug 2 21:23:38 EDT 2012


raeburn		Fri Aug  3 01:23:38 2012 EDT

  Modified files:              
    /loncom/interface	mydesk.tab lonmenu.pm 
  Log:
  - Use of Stored Links requires user to have $env{'user.adv'}
    (allows links to be stored, when instructor is made a student in a
     colleague's course).
  - Eliminate duplicate entries in $menuitems for Printout and Stored Links.
  
  
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.153 loncom/interface/mydesk.tab:1.154
--- loncom/interface/mydesk.tab:1.153	Thu Aug  2 15:08:07 2012
+++ loncom/interface/mydesk.tab	Fri Aug  3 01:23:38 2012
@@ -222,7 +222,7 @@
 8:1:clear
 8:1:tools:reqcrsshc:rcrs.png:request[_1]:course[_16]:go('/adm/requestcourse');:Course/Community requests:rcr
 8:1:tools:reqcrsnsc:rcrs.png:request[_1]:course[_16]:go('/adm/requestcourse');:Course/Community requests:rol
-9:3:pbre:$requested_domain:wishlist.png:view[_1]:wishlist[_1]:go('/adm/wishlist'):Stored Links:set
+9:3:adv:any:wishlist.png:view[_1]:linkstor[_1]:go('/adm/wishlist'):Stored Links:set
 10:1:clear
 10:1:any:any:anno.png:calendar[_1]:announce[_1]:go('/adm/announcements');:Announcements and my calendar:com
 10:1:course:any:anno.png:calendar[_1]:announce[_1]:go('/adm/announcements');:Course anouncements and my calendar:com
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.382 loncom/interface/lonmenu.pm:1.383
--- loncom/interface/lonmenu.pm:1.382	Thu Jul  5 19:22:47 2012
+++ loncom/interface/lonmenu.pm	Fri Aug  3 01:23:38 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.382 2012/07/05 19:22:47 raeburn Exp $
+# $Id: lonmenu.pm,v 1.383 2012/08/03 01:23:38 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -247,9 +247,7 @@
             my @primsub;
             if (ref($primary_submenu{$title}) eq 'ARRAY') {
                 foreach my $item (@{$primary_submenu{$title}}) {
-                    next if (($item->[2] eq 'wishlist') &&
-                             ((!&Apache::lonnet::allowed('bre',"/res/$env{'user.domain'}/")) &&
-                              (!&Apache::lonnet::allowed('bro',"/res/$env{'user.domain'}/"))));
+                    next if (($item->[2] eq 'wishlist') && (!$env{'user.adv'}));
                     next if (($item->[2] eq 'reqcrs') && (!&check_for_rcrs()));
                     next if ((($item->[2] eq 'portfolio') ||
                              ($item->[2] eq 'blog')) &&
@@ -663,7 +661,7 @@
         ###
         ###
 # Prepare the rest of the buttons
-        my $menuitems;
+        my ($menuitems,$got_prt,$got_wishlist);
         if ($const_space) {
 #
 # We are in construction space
@@ -699,7 +697,7 @@
         } elsif ( defined($env{'request.course.id'}) && 
 		 $env{'request.symb'} ne '' ) {
 #
-# We are in a course and looking at a registred URL
+# We are in a course and looking at a registered URL
 # Should probably be in mydesk.tab
 #
 	    $menuitems=(<<ENDMENUITEMS);
@@ -711,12 +709,15 @@
 c&8&2
 s&8&3&prt.png&Print&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 ENDMENUITEMS
-            if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F' && $env{'request.uri'} =~ /^\/res/) {
+            $got_prt = 1;
+            if (($env{'user.adv'}) && ($env{'request.uri'} =~ /^\/res/)
+                && (!$env{'request.enc'})) {
                 # wishlist is only available for users with access to resource-pool
                 # and links can only be set for resources within the resource-pool
                 $menuitems .= (<<ENDMENUITEMS);
 s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1
 ENDMENUITEMS
+                $got_wishlist = 1;
             }
 
 my $currentURL = &Apache::loncommon::get_symb();
@@ -748,16 +749,22 @@
 	    }
         }
 	if ($env{'request.uri'} =~ /^\/res/) {
-	    $menuitems .= (<<ENDMENUITEMS);
+            unless ($got_prt) {
+	        $menuitems .= (<<ENDMENUITEMS);
 s&8&3&prt.png&Print&printout[_1]&gopost('/adm/printout',currentURL)&Prepare a printable document
 ENDMENUITEMS
-            if (&Apache::lonnet::allowed('bre', $env{'request.course.id'}) eq 'F') {
-                # wishlist is only available for users with access to resource-pool
-                $menuitems .= (<<ENDMENUITEMS);
+                $gotprt = 1;
+            }
+            unless ($got_wishlist) {
+                if (($env{'user.adv'}) && (!$env{'request.enc'})) {
+                    # wishlist is only available for users with access to resource-pool
+                    $menuitems .= (<<ENDMENUITEMS);
 s&9&1&wishlist-link.png&Stored Links&wishlistlink[_2]&set_wishlistlink()&Save a link for this resource in your personal Stored Links repository&&1
 ENDMENUITEMS
-            }
-	}
+                    $got_wishlist = 1;
+                }
+	    }
+        }
         my $buttons='';
         foreach (split(/\n/,$menuitems)) {
 	    my ($command, at rest)=split(/\&/,$_);




More information about the LON-CAPA-cvs mailing list