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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Sun, 22 Apr 2007 13:41:24 -0000


raeburn		Sun Apr 22 09:41:24 2007 EDT

  Modified files:              
    /loncom/interface	lonmsg.pm lonmsgdisplay.pm 
  Log:
  - Bug 4551.  Users with dff privilege in a course can add a copy of a message to a User's Record (category Archive).
  - Wording change for forwarding screen
  
  
Index: loncom/interface/lonmsg.pm
diff -u loncom/interface/lonmsg.pm:1.199 loncom/interface/lonmsg.pm:1.200
--- loncom/interface/lonmsg.pm:1.199	Sat Apr 21 22:25:36 2007
+++ loncom/interface/lonmsg.pm	Sun Apr 22 09:41:22 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging
 #
-# $Id: lonmsg.pm,v 1.199 2007/04/22 02:25:36 raeburn Exp $
+# $Id: lonmsg.pm,v 1.200 2007/04/22 13:41:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -581,12 +581,16 @@
        &Apache::lonnet::put
                          ('email_status',{'recnewemail'=>time},$domain,$user);
 # Into sent-mail folder unless a broadcast message or critical message
-       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'}.
-					     '/'.$env{'request.course.sec'})))) {
+       unless (($env{'request.course.id'}) &&
+               (($env{'form.courserecord'}) &&
+                (&Apache::lonnet::allowed('dff',$env{'request.course.id'})
+                 || &Apache::lonnet::allowed('dff',$env{'request.course.id'}.
+                  '/'.$env{'request.course.sec'}))) ||
+                (($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'}.
+                                             '/'.$env{'request.course.sec'})))) {
            (undef,my $packed_message_no_citation) =
                &packagemsg($subject,$message,undef,$baseurl,$attachmenturl,
                            $user,$domain,$currid,undef,$crsmsgid,$symb,$error);
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.69 loncom/interface/lonmsgdisplay.pm:1.70
--- loncom/interface/lonmsgdisplay.pm:1.69	Sat Apr 21 22:25:36 2007
+++ loncom/interface/lonmsgdisplay.pm	Sun Apr 22 09:41:22 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.69 2007/04/22 02:25:36 raeburn Exp $
+# $Id: lonmsgdisplay.pm,v 1.70 2007/04/22 13:41:22 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1186,7 +1186,13 @@
           text=>"Display All Messages"});
         &printheader($r,'/adm/email?compose=multiforward',
              'Forwarding Multiple Messages');
-        $r->print(&mt('Each of the <b>[quant,_1,message]</b> you checked will be forwarded to the recipient(s) you select below.',$multiforward).'<br />');
+        if ($multiforward > 1) {
+            $r->print(&mt('Each of the <b>[quant,_1,message]</b> you checked
+will be forwarded to the recipient(s) you select below.',$multiforward).'<br />');
+        } else {
+            $r->print(&mt('The message you checked will be forwarded to the recipient(s) you select below.').'<br />');
+        }
+
     } else {
 	&printheader($r,'/adm/email?compose=upload',
 	     'Distribute from Uploaded File');
@@ -1222,7 +1228,17 @@
 &mt('Send copy to permanent email address (if known)').'</label></p>'.
 '<p><label><input type="checkbox" name="rsspost" /> '.
 		  &mt('Include in course RSS newsfeed').'</label></p>';
-     }
+    }
+    if (&Apache::lonnet::allowed('dff',$env{'request.course.id'}) ||
+        &Apache::lonnet::allowed('dff',$env{'request.course.id'}.
+                                 '/'.$env{'request.course.sec'})) {
+
+        $dispcrit.='<p><label>'.
+                   '<input type="checkbox" name="courserecord" value="1" /> '.
+                   &mt("Include in course's 'User records' for recipient(s)").
+                   '</label></p>';
+    }
+
     my %message;
     my %content;
     my $defdom=$env{'user.domain'};
@@ -1507,7 +1523,20 @@
                     '<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br />'.
                     $content{'message'};
                 }
-            }    
+            }
+        } elsif ($content{'subject'}=~/^Archive/) {
+            $result.='<h3>'.&mt('Archived Message').'</h3>';
+            if (defined($content{'coursemsgid'})) {
+                my $crsmsgid = &escape($content{'coursemsgid'});
+                my $archive_message = &general_message($crsmsgid);
+                $content{'message'} = '<b>'.&mt('Subject').': '.$content{'message'}.'</b><br />'.$archive_message;
+            } else {
+                %content=&Apache::lonmsg::unpackagemsg($content{'message'});
+                $content{'message'} =
+                '<b>'.&mt('Subject').': '.$content{'subject'}.'</b><br
+'.
+                $content{'message'};
+            }
         } else {
             $result.='<h3>'.&mt('Critical Message').'</h3>';
             if (defined($content{'coursemsgid'})) {
@@ -1570,7 +1599,7 @@
                                         : 'faculty and staff';
     &printheader($r,
 		 '/adm/email?recordftf=query',
-		 "User Notes, Face-to-Face, Critical Messages, Broadcast Messages");
+		 "User Notes, Face-to-Face, Critical Messages, Broadcast Messages, Archived Messages");
 # from query string
 
     if ($env{'form.recname'}) { $env{'form.recuname'}=$env{'form.recname'}; }
@@ -1585,7 +1614,7 @@
 	('stdselect','recuname','recdomain');
     my %lt=&Apache::lonlocal::texthash('user' => 'Username',
 				       'dom' => 'Domain',
-				       'head' => "User Notes, Records of Face-To-Face Discussions, Critical Messages, and Broadcast Messages in $crstype",
+				       'head' => "User Notes, Records of Face-To-Face Discussions, Critical Messages, Broadcast Messages and Archived Messages in $crstype",
 				       'subm' => 'Retrieve discussion and message records',
 				       'newr' => 'New Record (record is visible to '.lc($crstype).' '.$leaders.')',
 				       'post' => 'Post this Record');
@@ -2319,8 +2348,10 @@
 						     $env{'form.permanent'},
 						     \$sentmessage{$address});
             }
-	    if (($env{'request.course.id'}) && (($msgtype eq 'critical') || 
-                                         ($env{'form.sendmode'} eq 'group'))) {
+	    if (($env{'request.course.id'}) && 
+                (($msgtype eq 'critical') || 
+                 ($env{'form.sendmode'} eq 'group') ||
+                 ($env{'form.courserecord'}))) {
 	        $specialmsg_status{$recuname.':'.$recdomain} =
 		    join(' ',@thismsg);
 		foreach my $result (@thismsg) {
@@ -2331,13 +2362,17 @@
 	    }
 	    $sendstatus.=' '.join(' ',@thismsg);
 	}
-        if (($env{'request.course.id'}) && (($env{'form.sendmode'} eq 'group')
-                                              || ($msgtype eq 'critical'))) {
+        if (($env{'request.course.id'}) && 
+            (($env{'form.sendmode'} eq 'group') ||
+             ($env{'form.courserecord'}) ||
+             ($msgtype eq 'critical'))) {
             my $subj_prefix;
             if ($msgtype eq 'critical') {
                 $subj_prefix = 'Critical.';
-            } else {
+            } elsif ($env{'form.sendmode'} eq 'group') {
                 $subj_prefix = 'Broadcast.';
+            } else {
+                $subj_prefix = 'Archive';
             }
             my ($specialmsgid,$specialresult);
             my $course_str = &escape('['.$cnum.':'.$cdom.']');