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

raeburn raeburn@source.lon-capa.org
Wed, 18 Nov 2009 04:59:56 -0000


raeburn		Wed Nov 18 04:59:56 2009 EDT

  Modified files:              
    /loncom/interface	lonmenu.pm 
  Log:
  - When in a course only show "Edit this resource" icon for published resource 
    where viewer is author/co-author (or DC) if viewer has privilege to also "Edit Course".
  
  
Index: loncom/interface/lonmenu.pm
diff -u loncom/interface/lonmenu.pm:1.301 loncom/interface/lonmenu.pm:1.302
--- loncom/interface/lonmenu.pm:1.301	Tue Nov 10 13:58:55 2009
+++ loncom/interface/lonmenu.pm	Wed Nov 18 04:59:56 2009
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines to control the menu
 #
-# $Id: lonmenu.pm,v 1.301 2009/11/10 13:58:55 droeschl Exp $
+# $Id: lonmenu.pm,v 1.302 2009/11/18 04:59:56 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -689,10 +689,22 @@
             }
             # Finally, turn the button on or off
             if ($cfile && !$const_space) {
-                $editbutton=&switch
-                    ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
+                my $nocrsedit;
+                # Suppress display where CC has switched to student role.
+                if ($env{'request.course.id'}) {
+                    unless(&Apache::lonnet::allowed('mdc',
+                                                    $env{'request.course.id'})) {
+                        $nocrsedit = 1;
+                    }
+                }
+                if ($nocrsedit) {
+                    $editbutton=&clear(6,1);
+                } else {
+                    $editbutton=&switch
+                       ('','',6,1,'pcstr.gif','edit[_1]','resource[_2]',
                      "go('".$cfile."');","Edit this resource");
-                $noeditbutton = 0;
+                    $noeditbutton = 0;
+                }
             } elsif ($editbutton eq '') {
                 $editbutton=&clear(6,1);
             }