[LON-CAPA-cvs] cvs: loncom(version_2_11_X) /interface loncommon.pm lonmenu.pm mydesk.tab

raeburn raeburn at source.lon-capa.org
Tue May 22 20:29:23 EDT 2012


raeburn		Wed May 23 00:29:23 2012 EDT

  Modified files:              (Branch: version_2_11_X)
    /loncom/interface	loncommon.pm lonmenu.pm mydesk.tab 
  Log:
  - For 2.11
    - 'Home' removed from primary menu items ("3.0" feature).
    - 'Main Menu', 'Course Editor' restored to secondary menu.
    - Order of items in secondary menu changed.
    - For course personnel: Grades, People, Settings are now dropdown lists.
    - For students, 'People' link not shown if access to classlist not enabled.
  
  
-------------- next part --------------
Index: loncom/interface/loncommon.pm
diff -u loncom/interface/loncommon.pm:1.1075.2.3 loncom/interface/loncommon.pm:1.1075.2.4
--- loncom/interface/loncommon.pm:1.1075.2.3	Sat May 19 17:57:54 2012
+++ loncom/interface/loncommon.pm	Wed May 23 00:29:22 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # a pile of common routines
 #
-# $Id: loncommon.pm,v 1.1075.2.3 2012/05/19 17:57:54 raeburn Exp $
+# $Id: loncommon.pm,v 1.1075.2.4 2012/05/23 00:29:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -6548,15 +6548,51 @@
   margin: 0;
   width: 100%;
   text-align: left;
+  float: left;
 }
 
 ul#LC_secondary_menu li {
   font-weight: bold;
   line-height: 1.8em;
-  padding: 0 0.8em;
   border-right: 1px solid black;
-  display: inline;
   vertical-align: middle;
+  float: left;
+}
+
+ul#LC_secondary_menu li.LC_hoverable:hover, ul#LC_secondary_menu li.hover {
+  background-color: $data_table_light;
+}
+
+ul#LC_secondary_menu li a {
+  padding: 0 0.8em;
+}
+
+ul#LC_secondary_menu li ul {
+  display: none;
+}
+
+ul#LC_secondary_menu li:hover ul, ul#LC_secondary_menu li.hover ul {
+  display: block;
+  position: absolute;
+  margin: 0;
+  padding: 0;
+  list-style:none;
+  float: none;
+  background-color: $data_table_light;
+}
+
+ul#LC_secondary_menu li ul li {
+  font-size: 90%;
+  vertical-align: top;
+  border-left: 1px solid black;
+  border-right: 1px solid black;
+  background-color: $data_table_light
+  list-style:none;
+  float: none;
+}
+
+ul#LC_secondary_menu li ul li:hover, ul#LC_secondary_menu li ul li.hover {
+  background-color: $data_table_dark;
 }
 
 ul.LC_TabContent {
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.369.2.4 loncom/interface/lonmenu.pm:1.369.2.5
--- loncom/interface/lonmenu.pm:1.369.2.4	Mon May 21 16:25:37 2012
+++ loncom/interface/lonmenu.pm	Wed May 23 00:29:22 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.369.2.4 2012/05/21 16:25:37 raeburn Exp $
+# $Id: lonmenu.pm,v 1.369.2.5 2012/05/23 00:29:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -166,7 +166,7 @@
 use HTML::Entities();
 
 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;
 
@@ -234,7 +234,7 @@
                     $title =
                         '<span class="LC_nobreak">'.$title.
                         '<span class="LC_fontsize_small">'.
-                        '▼</span></span>';
+                        ' ▼</span></span>';
                 }
             }
             $menu .= '<li class="LC_hoverable">'.
@@ -322,12 +322,13 @@
                                                ? "/$env{'request.course.sec'}"
                                                : '');
     my $canedit       = &Apache::lonnet::allowed('mdc', $env{'request.course.id'});
-    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 $canviewroster = $env{'course.'.$env{'request.course.id'}.'.student_classlist_view'};
+    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 $canvgr        = &Apache::lonnet::allowed('vgr', $crs_sec);
-    my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec); 
+    my $canmgr        = &Apache::lonnet::allowed('mgr', $crs_sec);
     my $author        = &getauthor();
 
     my %groups = &Apache::lonnet::get_active_groups(
@@ -343,6 +344,10 @@
                 && !$env{'request.course.id'};
         next if    $$menuitem[4]   =~ /^mdc/
                 && !$canedit;
+        next if    $$menuitem[4]  eq 'mdcCourse'
+                && ($crstype eq 'Community');
+        next if    $$menuitem[4]  eq 'mdcCommunity'
+                && ($crstype eq 'Course');
         next if    $$menuitem[4]  eq 'nvgr'
                 && $canvgr;
         next if    $$menuitem[4]  eq 'vgr'
@@ -350,7 +355,7 @@
         next if    $$menuitem[4]   eq 'cst'
                 && !$canmodifyuser;
         next if    $$menuitem[4]   eq 'ncst'
-                && $canmodifyuser;
+                && ($canmodifyuser || !$canviewroster);
         next if    $$menuitem[4]   eq 'mgr'
                 && !$canmgr;
         next if    $$menuitem[4]   eq 'nmgr'
@@ -359,19 +364,76 @@
                 && !$canviewwnew;
         next if    $$menuitem[4]   eq 'opa'
                 && !$canmodpara;
-        next if    $$menuitem[4]   =~ /showgroups$/
-                && !$canviewgrps
-                && !%groups;
+        next if    $$menuitem[4]   eq 'nvcg'
+                && ($canviewgrps || !%groups);
         next if    $$menuitem[4]    eq 'author'
                 && !$author;
 
-        if ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
+        my $title = $menuitem->[3];
+        if (defined($secondary_submenu{$title})) {
+            my ($link,$target,$numsub);
+            if ($menuitem->[0] ne '') {
+                $link = $menuitem->[0];
+                $target = '_top';
+            } else {
+                $link = '#';
+            }
+
+            my @scndsub;   
+            if (ref($secondary_submenu{$title}) eq 'ARRAY') {
+                $numsub = 0;
+                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 'cst' && !$canmodifyuser);
+                        next if ($item->[2] eq 'mgr' && !$canmgr);
+                        next if ($item->[2] eq 'vcg' && !$canviewgrps);
+                        push(@scndsub,$item); 
+                        $numsub ++;
+                    }
+                }
+                if ($numsub) {
+                    $title =
+                        '<span class="LC_nobreak">'.$title.
+                        '<span class="LC_fontsize_small" style="font-weight:normal">'.
+                        ' ▼</span></span>';
+                }
+            }
+            $menu .= '<li class="LC_hoverable">'.
+                     '<a href="'.$link.'" target="'.$target.'">'.$title.'</a>';
+            if ($numsub) {
+                $menu .= '<ul>';
+                my $count = 0;
+                foreach my $item (@scndsub) {
+                    $count ++;
+                    if (ref($item) eq 'ARRAY') {
+                        my $borderbot;
+                        my ($padtop,$padbot) = (0,0);
+                        if ($count == 1)  {
+                            $padtop = '5px';
+                        }
+                        if ($count == $numsub) {
+                            $padbot = '5px';
+                            $borderbot = 'border-bottom:1px solid black;';
+                        }
+                        $menu .= '<li style="margin:0;padding-left:0;padding-right:0;'.
+                                 'padding-top:'.$padtop.';padding-bottom:'.$padbot.';'.
+                                 $borderbot.'"><a href="'.$item->[0].
+                                 '" style="padding: 0 5px 0 10px">'.
+                                 $item->[1].'</a></li>';
+                    }
+                }
+                $menu .= '</ul>';
+            }
+            $menu .= '</li>';
+        } elsif ($$menuitem[3] eq 'Roles' && $env{'request.course.id'}) {
             # special treatment for role selector
             my $roles_selector = &roles_selector(
                         $env{'course.' . $env{'request.course.id'} . '.domain'},
                         $env{'course.' . $env{'request.course.id'} . '.num'}  );
 
-            $menu .= $roles_selector ? "<li>$roles_selector</li>"
+            $menu .= $roles_selector ? "<li style=\"padding: 0 0.8em;\">$roles_selector</li>"
                                      : '';
         } else {
             $menu .= &prep_menuitem(\@$menuitem);
@@ -1954,6 +2016,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.149.2.2 loncom/interface/mydesk.tab:1.149.2.3
--- loncom/interface/mydesk.tab:1.149.2.2	Fri May 18 16:29:05 2012
+++ loncom/interface/mydesk.tab	Wed May 23 00:29:22 2012
@@ -16,7 +16,6 @@
 #   - courses: show Courses instead of Roles
 # prim:link:icon:alt:text:condition
 prim:/adm/about.html:/adm/lonIcons/minilogo.gif:LON-CAPA Logo:About:public
-prim:/adm/menu:::Home:
 prim:/adm/communicate:::Messages:nonewmsg
 prim:/adm/communicate:::New Messages:newmsg
 prim::::Personal:
@@ -44,7 +43,7 @@
 primsub:Personal:/adm/preferences:Preferences:
 primsub:Personal:/adm/portfolio:Portfolio:portfolio
 primsub:Personal:/adm/announcements:Calendar:
-primsub:Personal:/adm/[domain]/[user]/_rss.html:Feeds:blog
+primsub:Personal:/adm/[domain]/[user]/_rss.html:RSS Feeds:blog
 primsub:Personal:/adm/requestcourse:Course Requests:reqcrs
 
 # secondary menu links
@@ -56,32 +55,58 @@
 # text: link text
 # condition: when to show link, secondary_menu will act upon this
 #   possible conditions:
-#   - empty: 
-#   - showgroups: user is member of a group
+#   - empty:
 #   - always: show this link even if user hasn't selected a role
-#   - whn: access what's new
-#   - cst: Grant/revoke role of Student:Grant/revoke role of Member 
-#   - ncst: Not grant/revoke roles
-#   - opa: Set assessment parameters
-#   - nvgr: cannot view other people's grades 
-#   - mgr: Manage grades
-#   - nmgr: cannot manage grade
+#   - mdcCourse: user can modify content in a Course
+#   - mdcCommunity: user can modify content in a Community 
+#   - vgr: user can view grades
+#   - cst: user can grant/revoke student/member roles
+#   - opa: user can set assessment parameters
+#   - ncst: user can not grant/revoke student roles
+#   - nvcg: user can only groups in which he/she is a member
+#   - nmgr: user cannot manage grades
+#   - nvgr: user cannot view other people's grades
+#   - whn: user can access what's new
 #   - author: authors (au, ca, aa)
-# prim:link:icon:alt:text:condition
-scnd:/adm/whatsnew:::What's New:whn
+# scnd:link:icon:alt:text:condition
+scnd:/adm/menu:::Main Menu:always
 scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Contents:
-scnd:/adm/createuser:::People:cst
+scnd:/adm/coursedocs:::Course Editor:mdcCourse
+scnd:/adm/coursedocs:::Community Editor:mdcCommunity
+scnd::::Grades:vgr
+scnd::::People:cst
+scnd::::Settings:opa
 scnd:/adm/viewclasslist:::People:ncst
-scnd:/adm/coursegroups:::Groups:showgroups
+scnd:/adm/coursegroups:::Groups:nvcg
 scnd:/adm/slotrequest?command=manageresv:::Reservations:nmgr
-scnd:/adm/slotrequest?command=showslots:::Slots:mgr
 scnd:/adm/quickgrades:::Grades:nvgr
-scnd:/adm/grades:::Grades:vgr
-scnd:/adm/parmset:::Settings:opa
+scnd:/adm/whatsnew:::What's New:whn
 scnd:/adm/roles:::Roles:
 scnd:/priv/[udom]/[uname]/:::Construction Space:author
 scnd:/res/[udom]/[uname]/?launch=1:::Browse:author
 
+# 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
+#   - vgr: link displayed if user can view grades
+#   - opa: link displayed if user can set assessment parameters
+#   - mgr: link displayed if user can manage grades
+#   - cst: link displayed if user can grant/revoke student/member roles
+#   - 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 Configuration:opa
+scndsub:Settings:/adm/parmset:Content Parameters:opa
+scndsub:Settings:/adm/slotrequest?command=showslots:Slot Management:mgr
+scndsub:People:/adm/createuser:User Management:cst
+scndsub:People:/adm/coursegroups:Group Management:vcg
 
 # Categories for main menu
 # cat:column,row:title


More information about the LON-CAPA-cvs mailing list