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

raeburn lon-capa-cvs@mail.lon-capa.org
Wed, 29 Nov 2006 07:53:55 -0000


raeburn		Wed Nov 29 02:53:55 2006 EDT

  Modified files:              
    /loncom/interface	loncommunicate.pm 
  Log:
  dcm privilege used to determine if link to communication block configuration is provided to user.
  
  
Index: loncom/interface/loncommunicate.pm
diff -u loncom/interface/loncommunicate.pm:1.34 loncom/interface/loncommunicate.pm:1.35
--- loncom/interface/loncommunicate.pm:1.34	Tue May 30 16:09:25 2006
+++ loncom/interface/loncommunicate.pm	Wed Nov 29 02:53:55 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Communicate
 #
-# $Id: loncommunicate.pm,v 1.34 2006/05/30 20:09:25 raeburn Exp $
+# $Id: loncommunicate.pm,v 1.35 2006/11/29 07:53:55 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -65,7 +65,20 @@
 	$help{$_}=&Apache::loncommon::help_open_topic($_);
     }
 # ------------------------------------------------------------------------ Menu
-   $r->print(<<END);
+    my ($can_srm,$can_dcm);
+    if ($env{'request.course.id'}) {
+        if ((&Apache::lonnet::allowed('srm',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.
+                                           $env{'request.course.sec'}))) {
+            $can_srm = 1;
+        }
+        if ((&Apache::lonnet::allowed('dcm',$env{'request.course.id'})) ||
+            (&Apache::lonnet::allowed('dcm',$env{'request.course.id'}.'/'.
+                                           $env{'request.course.sec'}))) {
+            $can_dcm = 1;
+        }
+    }   
+    $r->print(<<END);
 <table cellspacing="10" cellpadding="2">
 <tr><td bgcolor="#FFFFAA"><form method="post" action="/adm/email">
 <input type="submit" value="$lt{'mnf'}" />
@@ -76,13 +89,12 @@
 </td></tr>
 <tr><td bgcolor="#FFFFAA">
   <b><a href="/adm/$env{'user.domain'}/$env{'user.name'}/_rss.html">$lt{'blog'}</a></b>
-</td><td></td></tr>
+</td>
 END
-    if (($env{'request.course.id'}) && 
-        (
-	 &Apache::lonnet::allowed('srm',$env{'request.course.id'}) ||
-	 &Apache::lonnet::allowed('srm',$env{'request.course.id'}.'/'.$env{'request.course.sec'})
-	 )) {
+    if ($can_srm || !$can_dcm) {
+        $r->print('<td></td></tr>');
+    }
+    if ($can_srm) {
         $r->print(<<END);
 <tr><td bgcolor="#FFFFAA">
     <b><a href="/adm/email?compose=group">$lt{'bmc'}</a></b>$help{'Course_Broadcast_Message'}
@@ -93,11 +105,17 @@
 <tr><td bgcolor="#FFFFAA">
 <b><a href="/adm/email?recordftf=query">$lt{'unr'}</a></b>$help{'Course_Face_To_Face_Records,Course_Critical_Message'}
 </td>
-<td bgcolor="#FFFFAA">
-  <b><a href="/adm/email?block=display">$lt{'cbs'}</a>
-</td></tr>
 END
     }
+    if ($can_dcm) {
+        $r->print('
+<td bgcolor="#FFFFAA">
+  <b><a href="/adm/email?block=display">'.$lt{'cbs'}.'</a>
+</td>');
+    }
+    if ($can_srm || $can_dcm) {
+        $r->print('</tr>');
+    }
     $r->print('</table>');
 }