https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113520

Revision: 113520
Author:   jeroendedauw
Date:     2012-03-09 20:38:41 +0000 (Fri, 09 Mar 2012)
Log Message:
-----------
Follow up to r113507; finish up code I accidentally comited earlier on

Modified Paths:
--------------
    trunk/extensions/EducationProgram/EducationProgram.i18n.php
    trunk/extensions/EducationProgram/actions/EPAction.php
    trunk/extensions/EducationProgram/actions/EPDeleteAction.php
    trunk/extensions/EducationProgram/actions/EPEditAction.php
    trunk/extensions/EducationProgram/actions/EPViewAction.php
    trunk/extensions/EducationProgram/includes/EPUtils.php
    trunk/extensions/EducationProgram/specials/SpecialEPPage.php

Modified: trunk/extensions/EducationProgram/EducationProgram.i18n.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-09 
20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-09 
20:38:41 UTC (rev 113520)
@@ -491,6 +491,8 @@
        'coursepage-delete-cancel-button' => 'Cancel',
        'coursepage-delete-delete-button' => 'Delete course',
        'coursepage-delete-none' => 'There is no course titled "$1". Existing 
courses can be found in [[Special:Courses|the courses list]].',
+       'coursepage-delete-deleted' => 'Successfully deleted course $1.',
+       'coursepage-delete-delete-failed' => 'Failed to deleted course 
[[Course:$1|$1]].',
 
        // Institution deletion
        'orgpage-delete-text' => "You are about to delete institution $1. This 
will remove all it's courses and their associated students!",
@@ -499,6 +501,8 @@
        'orgpage-delete-cancel-button' => 'Cancel',
        'orgpage-delete-delete-button' => 'Delete institution',
        'orgpage-delete-none' => 'There is no institution titled "$1". Existing 
institutions can be found in [[Special:Courses|the institution list]].',
+       'coursepage-delete-deleted' => 'Successfully deleted institution $1 and 
its associated courses.',
+       'coursepage-delete-delete-failed' => 'Failed to deleted institution 
[[Institution:$1|$1]].',
 
        // Institution restoration
        'orgpage-eprestore-title' => 'Restore institution "$1"',

Modified: trunk/extensions/EducationProgram/actions/EPAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPAction.php      2012-03-09 
20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/actions/EPAction.php      2012-03-09 
20:38:41 UTC (rev 113520)
@@ -13,7 +13,7 @@
  * @author Jeroen De Dauw < [email protected] >
  */
 abstract class EPAction extends FormlessAction {
-       
+
        /**
         * Display a warning that the page has been deleted together with the 
first
         * few items from its deletion log.

Modified: trunk/extensions/EducationProgram/actions/EPDeleteAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPDeleteAction.php        
2012-03-09 20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/actions/EPDeleteAction.php        
2012-03-09 20:38:41 UTC (rev 113520)
@@ -60,13 +60,16 @@
                                if ( $success ) {
                                        $title = SpecialPage::getTitleFor( 
$this->page->getListPage() );
                                        $this->getRequest()->setSessionData(
-                                               'epdeleted',
-                                               $this->msg( $this->prefixMsg( 
'deleted' ) )
+                                               'epsuccess',
+                                               $this->msg( $this->prefixMsg( 
'deleted' ), $this->getTitle()->getText() )->text()
                                        );
                                }
                                else {
                                        $title = $this->getTitle();
-                                       $this->getRequest()->setSessionData( 
'epdelfailed', true );
+                                       $this->getRequest()->setSessionData(
+                                               'epfail',
+                                               $this->msg( $this->prefixMsg( 
'delete-failed' ), $this->getTitle()->getText() )->parse()
+                                       );
                                }
                                
                                $this->getOutput()->redirect( 
$title->getLocalURL() );

Modified: trunk/extensions/EducationProgram/actions/EPEditAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPEditAction.php  2012-03-09 
20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/actions/EPEditAction.php  2012-03-09 
20:38:41 UTC (rev 113520)
@@ -55,6 +55,8 @@
         * @see FormlessAction::onView()
         */
        public function onView() {
+               EPUtils::displayResult( $this->getContext() );
+
                $this->getOutput()->addModules( 'ep.formpage' );
                
                if ( $this->getRequest()->wasPosted() && 
$this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) 
) ) {

Modified: trunk/extensions/EducationProgram/actions/EPViewAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPViewAction.php  2012-03-09 
20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/actions/EPViewAction.php  2012-03-09 
20:38:41 UTC (rev 113520)
@@ -40,6 +40,7 @@
         */
        public function onView() {
                $out = $this->getOutput();
+
                $name = $this->getTitle()->getText();
 
                $object = false;
@@ -74,12 +75,15 @@
                                $out->redirect( $this->getTitle()->getLocalURL( 
array( 'action' => 'edit' ) ) );
                        }
                        else {
+                               EPUtils::displayResult( $this->getContext() );
+
                                $out->addWikiMsg( strtolower( 
get_called_class() ) . '-none', $name );
 
                                $this->displayDeletionLog();
                        }
                }
                else {
+                       EPUtils::displayResult( $this->getContext() );
                        $this->displayPage( $object );
                }
 

Modified: trunk/extensions/EducationProgram/includes/EPUtils.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPUtils.php      2012-03-09 
20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/includes/EPUtils.php      2012-03-09 
20:38:41 UTC (rev 113520)
@@ -219,4 +219,25 @@
                return $items;          
        }
 
+       public static function displayResult( IContextSource $context ) {
+               $req = $context->getRequest();
+               $out = $context->getOutput();
+
+               if ( $req->getSessionData( 'epsuccess' ) ) {
+                       $out->addHTML(
+                               '<div class="successbox"><strong><p>' . 
$req->getSessionData( 'epsuccess' ) . '</p></strong></div>'
+                                       . '<hr style="display: block; clear: 
both; visibility: hidden;" />'
+                       );
+                       $req->setSessionData( 'epsuccess', false );
+               }
+
+               if ( $req->getSessionData( 'epfail' ) ) {
+                       $out->addHTML(
+                               '<p class="visualClear errorbox">' . 
$req->getSessionData( 'epfail' ). '</p>'
+                                       . '<hr style="display: block; clear: 
both; visibility: hidden;" />'
+                       );
+                       $req->setSessionData( 'epfail', false );
+               }
+       }
+
 }

Modified: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
===================================================================
--- trunk/extensions/EducationProgram/specials/SpecialEPPage.php        
2012-03-09 20:37:44 UTC (rev 113519)
+++ trunk/extensions/EducationProgram/specials/SpecialEPPage.php        
2012-03-09 20:38:41 UTC (rev 113520)
@@ -66,10 +66,7 @@
                        return false;
                }
 
-               if ( $this->getRequest()->getSessionData( 'epdeleted' ) ) {
-                       $this->showSuccess( 
$this->getRequest()->getSessionData( 'epdeleted' ) );
-                       $this->getRequest()->setSessionData( 'epdeleted', false 
);
-               }
+               EPUtils::displayResult( $this->getContext() );
 
                return true;
        }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to