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

raeburn lon-capa-cvs-allow@mail.lon-capa.org
Thu, 03 May 2007 12:13:35 -0000


raeburn		Thu May  3 08:13:35 2007 EDT

  Modified files:              
    /loncom/interface	lonmsgdisplay.pm 
  Log:
  Bug 5030.
  - Wording of buttons changed depending on whether $content{sendback} is set.
  - On button click, message is automatically marked as read after transfer to Inbox.
  
  
Index: loncom/interface/lonmsgdisplay.pm
diff -u loncom/interface/lonmsgdisplay.pm:1.74 loncom/interface/lonmsgdisplay.pm:1.75
--- loncom/interface/lonmsgdisplay.pm:1.74	Wed May  2 16:26:08 2007
+++ loncom/interface/lonmsgdisplay.pm	Thu May  3 08:13:35 2007
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # Routines for messaging display
 #
-# $Id: lonmsgdisplay.pm,v 1.74 2007/05/02 20:26:08 albertel Exp $
+# $Id: lonmsgdisplay.pm,v 1.75 2007/05/03 12:13:35 raeburn Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -737,12 +737,20 @@
             '<br />'.&mt('Subject').': '.$content{'subject'}.
             '<br /><pre>'.
               &Apache::lontexconvert::msgtexconverted($content{'message'}).
-            '</pre><small>'.
-&mt('You have to confirm that you received this message. After confirmation, this message will be moved to your regular inbox').
-            '</small><br />'.
-            '<input type="submit" name="rec_'.$key.'" value="'.&mt('Confirm Receipt').'" />'.
+            '</pre><small>';
+        my $rec_button = &mt('Move to Inbox');
+        my $reprec_button = &mt('Move to Inbox/Compose reply');
+        if ($content{'sendback'}) {
+            $rec_button = &mt('Confirm Receipt');
+            $reprec_button = &mt('Confirm Receipt and Reply');
+            $result .= &mt('You have to confirm that you have received this message before you can view other pages. After confirmation, this message will be moved to your regular inbox');
+        } else {
+            $result .= &mt('Click one of the buttons below to move the message to your inbox').' '.&mt('Access to other pages will be prevented until you have done this.');
+        }
+        $result .= '</small><br />'.
+            '<input type="submit" name="rec_'.$key.'" value="'.$rec_button.'" />'.
             '<input type="submit" name="reprec_'.$key.'" '.
-                  'value="'.&mt('Confirm Receipt and Reply').'" />';
+                  'value="'.$reprec_button.'" />';
     }
     # Check to see if there were any messages.
     if ($result eq '') {
@@ -2636,16 +2644,18 @@
 	&printheader($r,'','Confirmed Receipt');
 	my $replying = 0;
 	foreach my $envkey (keys(%env)) {
-	    if ($envkey=~/^form\.rec\_(.*)$/) {
-		$r->print('<b>'.&mt('Confirming Receipt').':</b> '.
-			  &Apache::lonmsg::user_crit_received($1).'<br>');
-	    }
-	    if ($envkey=~/^form\.reprec\_(.*)$/) {
-		my $msgid=$1;
-		$r->print('<b>'.&mt('Confirming Receipt').':</b> '.
-			  &Apache::lonmsg::user_crit_received($msgid).'<br>');
-		&compout($r,'','','',$msgid);
-		$replying = 1;
+	    if ($envkey=~/^form\.(rep)?rec\_(.*)$/) {
+       		my $msgid = $2;
+		$r->print('<b>'.&mt('Confirming Receipt').':</b> ');
+		my $result = &Apache::lonmsg::user_crit_received($msgid);
+                if ($result =~ /trans:\s+ok/) {
+                    &statuschange($msgid,'read');
+                }
+                $r->print($result.'<br>');
+                if ($1 eq 'rep') {
+		    &compout($r,'','','',$msgid);
+		    $replying = 1;
+                }
 	    }
 	}
 	if (!$replying) {