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

bisitz bisitz at source.lon-capa.org
Wed Apr 18 12:22:31 EDT 2012


bisitz		Wed Apr 18 16:22:31 2012 EDT

  Modified files:              
    /loncom/interface	lonannounce.pm 
  Log:
  Confirmation of server announcement postings:
  - Standard design (confirm_success)
  - Improved wording
  
  
  
Index: loncom/interface/lonannounce.pm
diff -u loncom/interface/lonannounce.pm:1.83 loncom/interface/lonannounce.pm:1.84
--- loncom/interface/lonannounce.pm:1.83	Wed Feb 22 18:38:29 2012
+++ loncom/interface/lonannounce.pm	Wed Apr 18 16:22:31 2012
@@ -1,7 +1,7 @@
 # The LearningOnline Network
 # Announce
 #
-# $Id: lonannounce.pm,v 1.83 2012/02/22 18:38:29 bisitz Exp $
+# $Id: lonannounce.pm,v 1.84 2012/04/18 16:22:31 bisitz Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -569,15 +569,29 @@
     }
 # ------------------------------------------------------------ Process commands
     if ($serverpost) {
-	if ($env{'form.serveraction'}) {
-	    foreach my $key (keys(%env)) {
-		if ($key=~/^form\.postto\_(\w+[\w|-]*)/) {
-		    $r->print( 
-			'<br />Posting '.$1.': '.&Apache::lonnet::postannounce
-			($1,$env{'form.serverannnounce'}));
-		}
-	    }
-	}
+        if ($env{'form.serveraction'}) {
+            my $rc;
+            my $message;
+            foreach my $key (keys(%env)) {
+                if ($key=~/^form\.postto\_(\w+[\w|-]*)/) {
+                     $rc = &Apache::lonnet::postannounce
+                           ($1,$env{'form.serverannnounce'});
+                    if ($rc eq 'ok') {
+                        $message .= 
+                            &Apache::lonhtmlcommon::confirm_success(
+                                &mt('Announcement posted to [_1]',$1))
+                               .'<br />';
+                    } else {
+                        $message .=
+                            &Apache::lonhtmlcommon::confirm_success(
+                                &mt('Posting announcement to [_1] failed: [_2]'
+                                    ,$1,$rc), 1)
+                               .'<br />';
+                    }
+                }
+            }
+            $r->print(&Apache::loncommon::confirmwrapper($message));
+        }
 	$r->print('<form name="serveranno" method="post">'
                  .'<h2>'.&mt('Post Server Announcements').'</h2>'
                  .&mt('Post announcements to the system login and roles screen').'<br />'




More information about the LON-CAPA-cvs mailing list