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

raeburn raeburn@source.lon-capa.org
Mon, 26 Oct 2009 21:19:22 -0000


This is a MIME encoded message

--raeburn1256591962
Content-Type: text/plain

raeburn		Mon Oct 26 21:19:22 2009 EDT

  Modified files:              
    /loncom/interface	mydesk.tab lonmenu.pm 
  Log:
  - Main menu and inline menu use "Community" instead of "Course" when a user's current role is a community role.
  
  
--raeburn1256591962
Content-Type: text/plain
Content-Disposition: attachment; filename="raeburn-20091026211922.txt"

Index: loncom/interface/mydesk.tab
diff -u loncom/interface/mydesk.tab:1.116 loncom/interface/mydesk.tab:1.117
--- loncom/interface/mydesk.tab:1.116	Mon Oct 26 21:01:36 2009
+++ loncom/interface/mydesk.tab	Mon Oct 26 21:19:22 2009
@@ -35,17 +35,23 @@
 #   possible conditions:
 #   - empty: 
 #   - showreturn: link is displayed if return link is wanted
-#   - mdcCommunity: mdc from below and course is of type Community
-#   - mdcCourse: mdc from below and course is a regular course
+#   - mdcCommunity: user can modify course contents and course is of type Community
+#   - mdcCourse: user can modify course contents and course is a regular course
 #   - showgroups: user is member of a group
 #   - always: show this link even if user hasn't selected a role
 #   - remotenav: remote navmap is activated
 #   - noremotenav: remote navmap is _not_ activated
+#   - remotenavCommunity: remote navmap is activated 
+#                         and course is of type Community
+#   - noremotenavCommunity: remote navmap is _not_ activated 
+#                          and course is of type Community
 # prim:link:icon:alt:text:condition
 scnd:/adm/menu:::Main Menu:always
 scnd:/adm/flip?postdata=return%3a:::Return to Last Location:showreturn
 scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Course Contents:noremotenav
 scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Course Contents:remotenav
+scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Community Contents:noremotenavCommunity
+scnd:/adm/navmaps?postdata=[url]&postsymb=[symb]:::Community Contents:remotenavCommunity
 scnd:/adm/coursedocs:::Course Editor:mdcCourse
 scnd:/adm/coursedocs:::Community Editor:mdcCommunity
 scnd:/adm/coursegroups:::Groups:showgroups
@@ -59,11 +65,14 @@
 cat:1,3:set:My Space
 cat:2,1:umn:User Management
 cat:2,2:cmn:Course Management
+cat:2,2:cmm:Community Management
+cat:2,2:ccm:Course/Community Management
 cat:2,3:dom:Domain Management
 cat:2,4:grd:Grading and Statistics
 cat:2,5:crc:Course Content
+cat:2,5:cmc:Community Content
 cat:1,1:rol:My Roles
-cat:1,1:rcr:My Courses
+cat:1,1:rcr:My Courses/Communities
 cat:1,4:cnt:Content Library
 cat:2,6:oth:Other
 
@@ -80,22 +89,25 @@
 # txt-> text to display in the extended remote or inline remote
 # cat-> category that this belongs into (or "none" if in top menus)
 #
-# pro = clear    clear the button
-# pro = any      any permission level is allowed this button
-# pro = smp      allowed if $ENV{'user.adv'} is undefined
-# pro = adv      allowed if $ENV{'user.adv'} is defined
-# pro = shc      allowed if should use 'course' rather than 'role'
-# pro = nsc      allowed if should not use 'course' rather than 'role'
-# pro = author   prt = rca and user is a co-author
-# pro = author   prt = any 
-# pro = p???     allowed if the user has the permissions given in ???
-# course         allowed if in course
-# course_p???    allowed if in course and have permissions
-# courseenv_????   allowed if in course and course environment key exists
-# author         allowed if an author
-# tools          allowed if user has access to particular user tool (= prt)
-# editpriv       allowed if user has edit privileges for the current resource 
-# retlink        there is a valid location to return to
+# pro = clear		clear the button
+# pro = any      	any permission level is allowed this button
+# pro = smp      	allowed if $ENV{'user.adv'} is undefined
+# pro = adv      	allowed if $ENV{'user.adv'} is defined
+# pro = shc      	allowed if should use 'course' rather than 'role'
+# pro = nsc      	allowed if should not use 'course' rather than 'role'
+# pro = author   	prt = rca and user is a co-author
+# pro = author   	prt = any 
+# pro = p???     	allowed if the user has the permissions given in ???
+# course         	allowed if in course
+# community	 	allowed if in community
+# course_p???    	allowed if in course and have permissions
+# community_p??	 	allowed if in community and have permissions	
+# courseenv_??   	allowed if in course and course environment key exists
+# communityenv_??   	allowed if in community and course environment key exists
+# author         	allowed if an author
+# tools          	allowed if user has access to particular user tool (= prt)
+# editpriv       	allowed if user has edit privileges for current resource 
+# retlink        	there is a valid location to return to
 
 # 0 is very top menu line
 
@@ -122,36 +134,48 @@
 1:1:nsc:rcm:roles.gif:choose[_2]:role[_2]:go('/adm/roles');:Choose the user role:rol
 1:2:clear
 1:2:course:any:docs.gif:supplem-[_1]:entaldoc[_1]:go('/adm/coursedocs');:View supplemental course documents:crc
-1:2:pmdc:$crs:docs.gif:edit [_1]:course[_2]:go('/adm/coursedocs');:Edit course contents:crc
+1:2:community:any:docs.gif:supplem-[_1]:entaldoc[_1]:go('/adm/coursedocs');:View supplemental community documents:cmc
+1:2:pmdc:$crs:docs.gif:course[_7]:editor[_1]:go('/adm/coursedocs');::Edit course contents:crc
+1:2:pmdc:$cmty:docs.gif:communi-[_1]:ty edit[_1]:go('/adm/coursedocs');:Edit community contents:cmc
 2:1:clear
 2:2:clear
 2:2:course:any:nav.gif:course[_3]:contents[_1]:gonav('/adm/navmaps');:Table of course contents:crc
+2:2:community:any:nav.gif:commun[_1]:contents[_2]:gonav('/adm/navmaps');:Table of community contents:cmc
 2:3:clear
 3:1:clear
 4:1:clear
 4:1:course:any:grds.gif:my[_1]:grades[_1]:go('/adm/quickgrades');:View current problem status and grading information:grd
+4:1:community:any:grds.gif:my[_1]:grades[_1]:go('/adm/quickgrades');:View current problem status and grading information:grd
 4:1:pvgr:$crs:sprs.gif:course[_4]:grades[_2]:go('/adm/classcalc');:View calculated grades (Spreadsheet):grd
+4:1:pvgr:$cmty:sprs.gif:communi-[_2]:ty grade[_1]:go('/adm/classcalc');:View calculated grades (Spreadsheet):grd
 4:2:clear
 4:2:pvgr:$crs:chrt.gif:course[_5]:chart[_1]:gopost('/adm/statistics?reportSelected=student_assessment','Student Assessment');:View the course assessment progress chart:grd
+4:2:pvgr:$cmty:chrt.gif:communi-[_3]:ty chart[_1]:gopost('/adm/statistics?reportSelected=student_assessment','Student Assessment');:View the community assessment progress chart:grd
 4:3:clear
 4:3:pvgr:$crs:stat.gif:course[_6]:stats[_1]:gopost('/adm/statistics','Problem Statistics');:View course assessment statistics:grd
+4:3:pvgr:$cmty:stat.gif:communi-[_4]:ty stats[_1]:gopost('/adm/statistics','Problem Statistics');:View community assessment statistics:grd
 5:1:clear
 5:1:any:any:ccat.gif:course[_13]:catalog[_1]:go('/adm/coursecatalog');:Display catalog of courses and communities:oth
 5:2:courseenv_student_classlist_view:any:clst.gif:course[_12]:roster[_1]:go('/adm/viewclasslist');:View course roster:umn
+5:2:communityenv_student_classlist_view:any:clst.gif:communi-[_5]:ty list[_1]:go('/adm/viewclasslist');:View community membership:umn
 5:2:pvcl:$crs:clst.gif:course[_12]:roster[_1]:go('/adm/createuser?action=listusers');:View class lists:umn
+5:2:pvcl:$cmty:clst.gif:course[_12]:roster[_1]:go('/adm/createuser?action=listusers');:View membership lists:umn
 5:2:pcst:$crs:cprv.gif:user[_1]:privs[_1]:go('/adm/createuser');:Manage course users:umn
+5:2:pcst:$cmty:cprv.gif:user[_1]:privs[_1]:go('/adm/createuser');:Manage community users:umn
 5:2:pcca:$requested_domain:cprv.gif:user[_1]:privs[_1]:go('/adm/createuser');:Manage co-authors:umn
 5:2:pcdc:/:cprv.gif:user[_1]:privs[_1]:go('/adm/createuser');:Create users or modify the roles and privileges of users:umn
 5:2:pmau:$requested_domain:cprv.gif:user[_1]:privs[_1]:go('/adm/createuser');:Create users or modify the roles and privileges of users:umn
 5:3:clear
-5:3:pccc:$requested_domain:ccrs.gif:course[_8]:creation[_1]:go('/adm/createcourse');:Course Creation:cmn
+5:3:pccc:$requested_domain:ccrs.gif:course[_8]:creation[_1]:go('/adm/createcourse');:Course Creation:ccm
 5:3:popa:$crs:parm.gif:course[_9]:parms[_1]:go('/adm/parmset');:Modify parameter settings (due dates, etc) for resources and the course:cmn
+5:3:popa:$cmty:parm.gif:communi-[_6]:ty parms[_1]:go('/adm/parmset');:Modify parameter settings (due dates, etc) for resources and the community:cmm
 6:1:clear
 6:1:author:rau:cstr.gif:con-[_1]:struct[_1]:go('/priv/$uname/');:Enter my construction space:set
 6:1:author:rca:cstr.gif:co con-[_1]:struct[_2]:go('/priv/$caname/');:Enter construction space as a co-author:set
 6:1:author:raa:cstr.gif:co con-[_1]:struct[_2]:go('/priv/$caname/');:Enter construction space as an assistant co-author:set
 6:1:pmau:$requested_domain:conf.gif:domain[_1]:config[_1]:go('/adm/domainprefs');:Set domain configuration:dom
 6:1:course:any:pdfupload.gif:upload[_1]:pdf form[_1]:go('/pdfupload'):Upload a PDF Form with filled Form Fields:grd
+6:1:community:any:pdfupload.gif:upload[_1]:pdf form[_1]:go('/pdfupload'):Upload a PDF Form with filled Form Fields:grd
 6:2:clear
 6:2:pbre:$requested_domain:res.gif:resource[_1]:space[_1]:go('/res/$udom/?launch=1');:Browse published resources:cnt
 6:2:author:rau:res.gif:resource[_1]:space[_1]:go('/res/$udom/$uname/?launch=1');:Browse published resources:cnt
@@ -161,33 +185,43 @@
 7:1:clear
 7:1:pmau:$requested_domain:srvr.gif:server[_1]:status[_1]:go('/adm/domainstatus');:Status of domain servers:dom
 7:1:pwhn:$crs:new.gif:what is[_1]:new[_1]:go('/adm/whatsnew');:What's New?:cmn
+7:1:pwhn:$cmty:new.gif:what is[_1]:new[_1]:go('/adm/whatsnew');:What's New?:cmm
 7:2:clear
 7:2:adv:rcm:egrd.gif:enter[_1]:grades[_3]:go('/adm/grades');:Enter grades from check-out assessment resources:oth
 7:2:pusc:$requested_domain:sctr.gif:send bub[_1]:blesheet[_1]:gocmd('/adm/grades','scantronupload');:Send bubblesheet data to a course:oth
 7:3:clear
 7:3:pmky:$requested_domain:keys.gif:manage[_1]:acc keys[_1]:go('/adm/managekeys');:Manage Access Keys:dom
 8:1:clear
-8:1:tools:reqcrsshc:rcrs.gif:request[_1]:course[_16]:go('/adm/requestcourse');:Course requests:rcr
-8:1:tools:reqcrsnsc:rcrs.gif:request[_1]:course[_16]:go('/adm/requestcourse');:Course requests:rol
+8:1:tools:reqcrsshc:rcrs.gif:request[_1]:course[_16]:go('/adm/requestcourse');:Course/Community requests:rcr
+8:1:tools:reqcrsnsc:rcrs.gif:request[_1]:course[_16]:go('/adm/requestcourse');:Course/Community requests:rol
 9:2:any:any:vbkm.gif:view[_1]:bookmark[_1]:edit_bookmarks():Use or edit my bookmark collection:set
 10:1:clear
-10:1:any:any:anno.gif:calendar[_1]:announce[_1]:go('/adm/announcements');:Course announcements and my calendar:com
+10:1:any:any:anno.gif:calendar[_1]:announce[_1]:go('/adm/announcements');:Announcements and my calendar:com
+10:1:course:any:anno.gif:calendar[_1]:announce[_1]:go('/adm/announcements');:Course anouncements and my calendar:com
+10:1:community:any:anno.gif:calendar[_1]:announce[_1]:go('/adm/announcements');:Community announcements and my calendar:com
 10:2:any:any:com.gif:commu-[_1]:nication[_1]:go('/adm/communicate');:Send and receive messages:com
 10:3:clear
 10:3:ppsa:$requested_domain:mail.gif:bulk[_1]:e-mail[_1]:go('/adm/notify');:Send and display broadcast e-mail:com
 10:3:course_plc:any:bchat.gif:course[_10]:chatroom[_1]:chat_win();:Enter the chat room for the course:com
+10:3:community_plc:any:bchat.gif:communi-[_7]:ty chat[_1]:chat_win();:Enter the chat room for the community:com
 11:1:clear
 11:1:course:any:grps.gif:course[_14]:groups[_1]:go('/adm/coursegroups');:Enter my groups in the course:set
+11:1:community:any:grps.gif:communi-[_8]:ty group[_1]:go('/adm/coursegroups');:Enter my groups in the community:set
 11:1:course_vcg:any:grps.gif:course[_14]:groups[_1]:go('/adm/coursegroups');:Enter any group in the course:cmn
 11:1:course_mdg:any:grps.gif:course[_14]:groups[_1]:go('/adm/coursegroups');:Edit any group in the course:cmn
+11:1:community_vcg:any:grps.gif:communi-[_8]:ty group[_1]:go('/adm/coursegroups');:Enter any group in the community:cmm
+11:1:community_mdg:any:grps.gif:communi-[_8]:ty group[_1]:go('/adm/coursegroups');:Edit any group in the community:cmm
 11:2:tools:portfolio:port.gif:port-[_1]:folio[_1]:go('/adm/portfolio');:Enter my portfolio space:set
 11:3:tools:blog:blog.gif:edit[_1]:blogs[_1]:go('/adm/$udom/$uname/_rss.html');:Edit blogs, RSS feeds, and podcasts:set
 12:1:clear
 12:1:any:any:src.gif:search[_3]:prtfolio[_1]:go('/adm/searchcat');:Search the database of accessible portfolio files:cnt
 12:1:course:any:src.gif:search[_1]:course[_11]:go('/adm/searchcat');:Search the contents of this course or accessible portfolio files:cnt
+12:1:community:any:src.gif:search[_2]:commun[_1]:go('/adm/searchcat');:Search the contents of this community or accessible portfolio files:cnt
 12:1:pbre:$requested_domain:src.gif:search[_2]:library[_1]:go('/adm/searchcat');:Search the database of published resources and accessible portfolio files:cnt
 12:2:any:any:pref.gif:prefer-[_1]:ences[_1]:go('/adm/preferences');:Set my user preferences:set
 12:3:clear
 12:3:course:any:rsrv.gif:reserv-[_1]:ations[_1]:gocmd('/adm/slotrequest','manageresv');:Manage reservations:cmn
+12:3:community:any:rsrv.gif:reserv-[_1]:ations[_1]:gocmd('/adm/slotrequest','manageresv');:Manage reservations:cmm
 12:3:pmgr:$crs:rsrv.gif:reserv-[_1]:ations[_1]:gocmd('/adm/slotrequest','showslots');:Manage slots:cmn
+12:3:pmgr:$cmty:rsrv.gif:reserv-[_1]:ations[_1]:gocmd('/adm/slotrequest','showslots');:Manage slots:cmm
 13:2:any:any:logout.gif:logout[_1]: [_1]:go('/adm/logout');:Logout:oth
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.294 loncom/interface/lonmenu.pm:1.295
--- loncom/interface/lonmenu.pm:1.294	Tue Oct 20 03:18:14 2009
+++ loncom/interface/lonmenu.pm	Mon Oct 26 21:19:22 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.294 2009/10/20 03:18:14 raeburn Exp $
+# $Id: lonmenu.pm,v 1.295 2009/10/26 21:19:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -225,6 +225,10 @@
                 && $env{'environment.remotenavmap'} ne 'on';
         next if    $$menuitem[4]  =~ /noremotenav/
                 && $env{'environment.remotenavmap'} eq 'on';
+        next if $$menuitem[4] =~ /^(no|)remotenav$/ 
+                && $crstype eq 'Community';
+        next if $$menuitem[4] =~ /^(no|)remotenavCommunity$/ 
+                && $crstype ne 'Community';
         next if    $$menuitem[4]   =~ /showgroups$/
                 && $canviewgrps
                 && !%groups;
@@ -1320,12 +1324,14 @@
     my $show_course=&Apache::loncommon::show_course();
     my $author=$env{'user.author'};
     my $crs='';
+    my $crstype='';
     if ($env{'request.course.id'}) {
        $crs='/'.$env{'request.course.id'};
        if ($env{'request.course.sec'}) {
 	   $crs.='_'.$env{'request.course.sec'};
        }
        $crs=~s/\_/\//g;
+       $crstype = &Apache::loncommon::course_type();
     }
     my $pub=($env{'request.state'} eq 'published');
     my $con=($env{'request.state'} eq 'construct');
@@ -1335,10 +1341,17 @@
         my ($row,$col,$pro,$prt,$img,$top,$bot,$act,$desc,$cat)=split(/\:/,$line);
         $prt=~s/\$uname/$uname/g;
         $prt=~s/\$udom/$udom/g;
-        $prt=~s/\$crs/$crs/g; 
+        if ($prt =~ /\$crs/) {
+            next unless ($env{'request.course.id'});
+            next if ($crstype eq 'Community');
+            $prt=~s/\$crs/$crs/g;
+        } elsif ($prt =~ /\$cmty/) {
+            next unless ($env{'request.course.id'});
+            next if ($crstype ne 'Community');
+            $prt=~s/\$cmty/$crs/g;
+        }
         $prt=~s/\$requested_domain/$requested_domain/g;
         if ($category_names{$cat}!~/\w/) { $cat='oth'; }
-        my $type = &Apache::loncommon::course_type();
         if ($pro eq 'clear') {
 	    $output.=&clear($row,$col);
         } elsif ($pro eq 'any') {
@@ -1365,26 +1378,53 @@
 	  $uname,$udom,$rol,$crs,$pub,$con,$row,$col,$prt,$img,$top,$bot,$act,$desc,$cat);
             }
         } elsif (($pro=~/^p(\w+)/) && ($prt)) {
-	    if (&Apache::lonnet::allowed($1,$prt)) {
+            my $priv = $1;
+            if ($priv =~ /^mdc(Course|Community)/) {
+                if ($crstype eq $1) {
+                    $priv = 'mdc';
+                } else {
+                    next;
+                }
+            }
+	    if (&Apache::lonnet::allowed($priv,$prt)) {
                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
             }
-        } elsif ($pro eq 'course') {
-            if ($env{'request.course.fn'}) {
+        } elsif ($pro eq 'course')  {
+            if (($env{'request.course.fn'}) && ($crstype ne 'Community')) {
                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
 	    }
+        } elsif ($pro eq 'community')  {
+            if (($env{'request.course.fn'}) && ($crstype eq 'Community')) {
+               $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+            }
         } elsif ($pro =~ /^courseenv_(.*)$/) {
             my $key = $1;
-            if ($env{'course.'.$env{'request.course.id'}.'.'.$key}) {
+            if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && 
+                ($crstype ne 'Community')) {
+                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+            }
+        } elsif ($pro =~ /^communityenv_(.*)$/) {
+            my $key = $1;
+            if (($env{'course.'.$env{'request.course.id'}.'.'.$key}) && 
+                ($crstype eq 'Community')) {
                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
             }
         } elsif ($pro =~ /^course_(.*)$/) {
             # Check for permissions inside of a course
-            if (($env{'request.course.id'}) &&
+            if (($env{'request.course.id'}) && ($crstype ne 'Community') && 
                 (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
             ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
                  )) {
                 $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
 	    }
+        } elsif ($pro =~ /^community_(.*)$/) {
+            # Check for permissions inside of a community
+            if (($env{'request.course.id'}) && ($crstype eq 'Community') &&   
+                (&Apache::lonnet::allowed($1,$env{'request.course.id'}.
+            ($env{'request.course.sec'}?'/'.$env{'request.course.sec'}:''))
+                 )) {
+                $output.=&switch($uname,$udom,$row,$col,$img,$top,$bot,$act,$desc,$cat);
+            }
         } elsif ($pro eq 'author') {
             if ($author) {
                 if ((($prt eq 'rca') && ($env{'request.role'}=~/^ca/)) ||

--raeburn1256591962--