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

raeburn raeburn at source.lon-capa.org
Sat Oct 7 18:20:20 EDT 2017


raeburn		Sat Oct  7 22:20:20 2017 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm mydesk.tab 
  Log:
  - Use sub-menu dropdown lists for Grades, People, Settings and Public for 
    course personnel (as used in 2.11). Separate Groups, Slots, Syllabus,
    and Feeds items are in the corresponding dropdown lists.
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.481 loncom/interface/lonmenu.pm:1.482
--- loncom/interface/lonmenu.pm:1.481	Sat Oct  7 21:07:17 2017
+++ loncom/interface/lonmenu.pm	Sat Oct  7 22:20:19 2017
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.481 2017/10/07 21:07:17 raeburn Exp $
+# $Id: lonmenu.pm,v 1.482 2017/10/07 22:20:19 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -214,7 +214,7 @@
 use Apache::lonwishlist();
 
 use vars qw(@desklines %category_names %category_members %category_positions 
-            $readdesk @primary_menu %primary_submenu @secondary_menu);
+            $readdesk @primary_menu %primary_submenu @secondary_menu %secondary_submenu);
 
 my @inlineremote;
 
@@ -401,10 +401,7 @@
     if ($env{'request.course.id'}) {
         $cdom = $env{'course.'.$env{'request.course.id'}.'.domain'};
         $cnum = $env{'course.'.$env{'request.course.id'}.'.num'};
-        if ($canedit || $canvieweditor)  {
-            $showsyllabus = 1;
-            $showfeeds = 1;
-        } else {
+        unless ($canedit || $canvieweditor)  {
             unless (&Apache::lonnet::is_on_map("public/$cdom/$cnum/syllabus")) {
                 if (($env{'course.'.$env{'request.course.id'}.'.externalsyllabus'}) ||
                     ($env{'course.'.$env{'request.course.id'}.'.uploadedsyllabus'}) ||
@@ -471,9 +468,8 @@
                 && !$canviewwnew;
         next if    $$menuitem[4]   eq 'params'
                 && (!$canmodpara && !$canviewpara);
-        next if    $$menuitem[4]   =~ /showgroups$/
-                && !$canviewgrps
-                && !$grouptools;
+        next if    $$menuitem[4]   eq 'showgroups'
+                && ($canviewgrps || !$grouptools);
         next if    $$menuitem[4]   eq 'showsyllabus'
                 && !$showsyllabus;
         next if    $$menuitem[4]   eq 'showfeeds'
@@ -483,7 +479,37 @@
         next if    $$menuitem[4]    eq 'cca'
                 && !$canmodifycoauthor;
 
-        if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
+        my $title = $menuitem->[3];
+        if (defined($secondary_submenu{$title})) {
+            my ($link,$target);
+            if ($menuitem->[0] ne '') {
+                $link = $menuitem->[0];
+                $target = '_top';
+            } else {
+                $link = '#';
+            }
+            my @scndsub;
+            if (ref($secondary_submenu{$title}) eq 'ARRAY') {
+                foreach my $item (@{$secondary_submenu{$title}}) {
+                    if (ref($item) eq 'ARRAY') {
+                        next if ($item->[2] eq 'vgr' && !$canvgr);
+                        next if ($item->[2] eq 'opa' && !$canmodpara);
+                        next if ($item->[2] eq 'vpa' && !$canviewpara);
+                        next if ($item->[2] eq 'viewusers' && !($canmodifyuser || $canviewusers));
+                        next if ($item->[2] eq 'mgr' && !$canmgr);
+                        next if ($item->[2] eq 'vcg' && !$canviewgrps);
+                        next if ($item->[2] eq 'crsedit' && !$canedit && !$canvieweditor);
+                        next if ($item->[2] eq 'params' && !$canmodpara && !$canviewpara);
+                        push(@scndsub,$item);
+                    }
+                }
+                if (@scndsub > 0) {
+                    $menu .= &create_submenu($link,$target,$title,\@scndsub,1);
+                } elsif ($link ne '#') {
+                    $menu .= '<li><a href="'.$link.'" target="'.$target.'">'.&mt($title).'</a></li>';
+                }
+            }
+        } elsif ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
             # special treatment for role selector
             ($roleswitcher_js,$roleswitcher_form,my $switcher) =
                 &roles_selector(
@@ -538,7 +564,7 @@
     }
     $menu =~ s/\[uname\]/$$author{user}/g;
     $menu =~ s/\[udom\]/$$author{dom}/g;
-    if ($showsyllabus || $showfeeds) {
+    if ($env{'request.course.id'}) {
         $menu =~ s/\[cnum\]/$cnum/g;
         $menu =~ s/\[cdom\]/$cdom/g;
     }
@@ -2783,6 +2809,9 @@
                     } elsif ($configline=~/^scnd\:/) {
                         my @entries = (split(/\:/, $configline))[1..5];
                         push(@secondary_menu,\@entries);
+                    } elsif ($configline=~/^scndsub\:/) {
+                        my ($parent, at entries) = (split(/\:/, $configline))[1..4];
+                        push(@{$secondary_submenu{$parent}},\@entries);
                     } elsif ($configline) {
                         push(@desklines,$configline);
                     }
Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.174 loncom/interface/mydesk.tab:1.175
--- loncom/interface/mydesk.tab:1.174	Fri Jun 30 14:51:46 2017
+++ loncom/interface/mydesk.tab	Sat Oct  7 22:20:20 2017
@@ -1,4 +1,4 @@
-# $Id: mydesk.tab,v 1.174 2017/06/30 14:51:46 raeburn Exp $
+# $Id: mydesk.tab,v 1.175 2017/10/07 22:20:20 raeburn Exp $
 # primary menu links
 # Apache::lonmenu::primary_menu() generates a menu from these elements
 # prim: item belongs to primary menu
@@ -79,16 +79,16 @@
 #   - author: authors (au, ca, aa)
 #   - cca:  Grant/revoke role of co-author (author only)
 # prim:link:icon:alt:text:condition
-scnd:/adm/whatsnew:::What's New:whn
 scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Contents:
+scnd:/adm/whatsnew:::What's New:whn
 scnd:/adm/quickgrades:::Grades:nvgr
-scnd:/adm/createuser:::People:viewusers
+scnd::::Grades:vgr
+scnd::::People:viewusers
+scnd::::Settings:params
 scnd:/adm/viewclasslist:::People:noviewusers
 scnd:/adm/coursegroups:::Groups:showgroups
 scnd:/adm/slotrequest?command=manageresv:::Reservations:showresv
-scnd:/adm/slotrequest?command=showslots:::Slots:vgr
-scnd:/adm/grades:::Grades:vgr
-scnd:/adm/parmset:::Settings:params
+scnd::::Public:crsedit
 scnd:/public/[cdom]/[cnum]/syllabus:::Syllabus:showsyllabus
 scnd:/adm/[cdom]/[cnum]/_rss.html:::Feeds:showfeeds
 scnd:/adm/roles:::Roles:
@@ -96,6 +96,31 @@
 scnd:/res/[udom]/[uname]/?launch=1:::Browse:author
 scnd:/adm/createuser:::People:cca
 
+# secondary sub-menu links
+# Apache::lonmenu::secondary_menu() generates a sub-menus from these elements
+# scndsub: item belongs to secondary sub-menu
+# parent: name of secondary menu item, for which this is a sub-menu
+# link: references the url
+# text: link text
+# condition: when to show link, secondary_menu() will act based on this
+#   possible conditions:
+#   - empty: link displayed if user is authenticated
+#   - crsedit: link displayed if user can access Course/Community Editor
+#   - vgr: link displayed if user can view grades
+#   - params: link displayed if user can set or view assessment parameters
+#   - mgr: link displayed if user can manage grades
+#   - viewusers: link displayed if user can either grant/revoke student/member roles or view classlists
+#   - vcg: link displayed if user can view groups to which he/she does not belong
+# scndsub:parent:link:text:condition
+scndsub:Grades:/adm/statistics?reportSelected=student_assessment:Assessment Chart:vgr
+scndsub:Grades:/adm/statistics:Statistics and Reports:vgr
+scndsub:Settings:/adm/courseprefs:Course Settings:params
+scndsub:Settings:/adm/parmset:Content Settings:params
+scndsub:Settings:/adm/slotrequest?command=showslots:Slots:vgr
+scndsub:People:/adm/createuser:Users:viewusers
+scndsub:People:/adm/coursegroups:Groups:vcg
+scndsub:Public:/public/[cdom]/[cnum]/syllabus:Syllabus:crsedit
+scndsub:Public:/adm/[cdom]/[cnum]/_rss.html:Feeds:crsedit
 
 # Categories for main menu
 # cat:column,row:title




More information about the LON-CAPA-cvs mailing list