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

albertel lon-capa-cvs@mail.lon-capa.org
Mon, 09 Jan 2006 20:07:27 -0000


albertel		Mon Jan  9 15:07:27 2006 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm 
  Log:
  - fix up the perm hadnling in messaging
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.169 loncom/interface/lonmsg.pm:1.170
--- loncom/interface/lonmsg.pm:1.169	Thu Jan  5 15:10:54 2006
+++ loncom/interface/lonmsg.pm	Mon Jan  9 15:07:27 2006
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.169 2006/01/05 20:10:54 albertel Exp $
+# $Id: lonmsg.pm,v 1.170 2006/01/09 20:07:27 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -558,7 +558,9 @@
        unless (($env{'request.course.id'}) && 
                (($env{'form.sendmode'} eq 'group')  || 
                (($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&
-               (&Apache::lonnet::allowed('srm',$env{'request.course.id'})))) {
+               (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+		|| &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+					    '/'.$env{'request.course.sec'})))) {
            $status .= &store_sent_mail($msgid,$message);
        }
     } else {
@@ -1228,7 +1230,9 @@
 				       'ca' => 'Cancel',
 				       'ma' => 'Mail');
 
-    if (&Apache::lonnet::allowed('srm',$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'})) {
 	 my $crithelp = Apache::loncommon::help_open_topic("Course_Critical_Message");
          $dispcrit=
  '<p><label><input type="checkbox" name="critmsg" /> '.&mt('Send as critical message').'</label> ' . $crithelp . 
@@ -1354,7 +1358,7 @@
 ENDUPLOAD
     }
     if ($broadcast eq 'group') {
-       &discourse;
+       &discourse($r);
     }
     $r->print('</form>'.
 	      &Apache::lonfeedback::generate_preview_button('compemail','message').
@@ -1367,7 +1371,9 @@
     my ($user,$domain)=@_;
     my $target=$env{'form.grade_target'};
     if (! $env{'request.course.id'}) { return; }
-    if (! &Apache::lonnet::allowed('srm',$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'})) {
 	return;
     }
     my %records=&Apache::lonnet::dump('nohist_email',
@@ -1392,7 +1398,10 @@
     my ($r,$user,$domain)=@_;
     my $target=$env{'form.grade_target'};
     unless ($env{'request.course.id'}) { return; }
-    unless (&Apache::lonnet::allowed('srm',$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'})) {
+	$r->print('Not allowed');
 	return;
     }
     my %records=&Apache::lonnet::dump('nohist_email',
@@ -1446,7 +1455,10 @@
 
 sub facetoface {
     my ($r,$stage)=@_;
-    unless (&Apache::lonnet::allowed('srm',$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'})) {
+	$r->print('Not allowed');
 	return;
     }
     &printheader($r,
@@ -1521,7 +1533,12 @@
 sub examblock {
     my ($r,$action) = @_;
     unless ($env{'request.course.id'}) { return;}
-    unless (&Apache::lonnet::allowed('srm',$env{'request.course.id'})) { $r->print('Not allowed'); }
+    if (!&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+	&& ! &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+				      '/'.$env{'request.course.sec'})) {
+	$r->print('Not allowed');
+	return;
+    }
     my %lt=&Apache::lonlocal::texthash(
             'comb' => 'Communication Blocking',
             'cbds' => 'Communication blocking during scheduled exams',
@@ -2137,7 +2154,10 @@
         my $msgtype;
         my %sentmessage;
         if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) &&
-            (&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) {
+            (&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+	     || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+					 '/'.$env{'request.course.sec'})
+	     )) {
             $savemsg=&Apache::lonfeedback::clear_out_html($env{'form.message'},1);
             $msgtype = 'critical';
         } else {
@@ -2150,7 +2170,9 @@
 	    if ($toaddr{$_}) { $msgtxt.='<hr />'.$toaddr{$_}; }
 	    my $thismsg;
 	    if ((($env{'form.critmsg'}) || ($env{'form.sendbck'})) && 
-		(&Apache::lonnet::allowed('srm',$env{'request.course.id'}))) {
+		(&Apache::lonnet::allowed('srm',$env{'request.course.id'})
+		 || &Apache::lonnet::allowed('srm',$env{'request.course.id'}.
+					     '/'.$env{'request.course.sec'}))) {
 		$r->print(&mt('Sending critical message').' '.$recuname.'@'.$recdomain.': ');
 		$thismsg=&user_crit_msg($recuname,$recdomain,
 					&Apache::lonfeedback::clear_out_html($env{'form.subject'}),