Index: trunk/extensions/EducationProgram/actions/EPViewAction.php |
— | — | @@ -40,6 +40,7 @@ |
41 | 41 | */ |
42 | 42 | public function onView() { |
43 | 43 | $out = $this->getOutput(); |
| 44 | + |
44 | 45 | $name = $this->getTitle()->getText(); |
45 | 46 | |
46 | 47 | $object = false; |
— | — | @@ -74,12 +75,15 @@ |
75 | 76 | $out->redirect( $this->getTitle()->getLocalURL( array( 'action' => 'edit' ) ) ); |
76 | 77 | } |
77 | 78 | else { |
| 79 | + EPUtils::displayResult( $this->getContext() ); |
| 80 | + |
78 | 81 | $out->addWikiMsg( strtolower( get_called_class() ) . '-none', $name ); |
79 | 82 | |
80 | 83 | $this->displayDeletionLog(); |
81 | 84 | } |
82 | 85 | } |
83 | 86 | else { |
| 87 | + EPUtils::displayResult( $this->getContext() ); |
84 | 88 | $this->displayPage( $object ); |
85 | 89 | } |
86 | 90 | |
Index: trunk/extensions/EducationProgram/actions/EPAction.php |
— | — | @@ -13,7 +13,7 @@ |
14 | 14 | * @author Jeroen De Dauw < jeroendedauw@gmail.com > |
15 | 15 | */ |
16 | 16 | abstract class EPAction extends FormlessAction { |
17 | | - |
| 17 | + |
18 | 18 | /** |
19 | 19 | * Display a warning that the page has been deleted together with the first |
20 | 20 | * few items from its deletion log. |
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php |
— | — | @@ -55,6 +55,8 @@ |
56 | 56 | * @see FormlessAction::onView() |
57 | 57 | */ |
58 | 58 | public function onView() { |
| 59 | + EPUtils::displayResult( $this->getContext() ); |
| 60 | + |
59 | 61 | $this->getOutput()->addModules( 'ep.formpage' ); |
60 | 62 | |
61 | 63 | if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) { |
Index: trunk/extensions/EducationProgram/actions/EPDeleteAction.php |
— | — | @@ -60,13 +60,16 @@ |
61 | 61 | if ( $success ) { |
62 | 62 | $title = SpecialPage::getTitleFor( $this->page->getListPage() ); |
63 | 63 | $this->getRequest()->setSessionData( |
64 | | - 'epdeleted', |
65 | | - $this->msg( $this->prefixMsg( 'deleted' ) ) |
| 64 | + 'epsuccess', |
| 65 | + $this->msg( $this->prefixMsg( 'deleted' ), $this->getTitle()->getText() )->text() |
66 | 66 | ); |
67 | 67 | } |
68 | 68 | else { |
69 | 69 | $title = $this->getTitle(); |
70 | | - $this->getRequest()->setSessionData( 'epdelfailed', true ); |
| 70 | + $this->getRequest()->setSessionData( |
| 71 | + 'epfail', |
| 72 | + $this->msg( $this->prefixMsg( 'delete-failed' ), $this->getTitle()->getText() )->parse() |
| 73 | + ); |
71 | 74 | } |
72 | 75 | |
73 | 76 | $this->getOutput()->redirect( $title->getLocalURL() ); |
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php |
— | — | @@ -66,10 +66,7 @@ |
67 | 67 | return false; |
68 | 68 | } |
69 | 69 | |
70 | | - if ( $this->getRequest()->getSessionData( 'epdeleted' ) ) { |
71 | | - $this->showSuccess( $this->getRequest()->getSessionData( 'epdeleted' ) ); |
72 | | - $this->getRequest()->setSessionData( 'epdeleted', false ); |
73 | | - } |
| 70 | + EPUtils::displayResult( $this->getContext() ); |
74 | 71 | |
75 | 72 | return true; |
76 | 73 | } |
Index: trunk/extensions/EducationProgram/includes/EPUtils.php |
— | — | @@ -219,4 +219,25 @@ |
220 | 220 | return $items; |
221 | 221 | } |
222 | 222 | |
| 223 | + public static function displayResult( IContextSource $context ) { |
| 224 | + $req = $context->getRequest(); |
| 225 | + $out = $context->getOutput(); |
| 226 | + |
| 227 | + if ( $req->getSessionData( 'epsuccess' ) ) { |
| 228 | + $out->addHTML( |
| 229 | + '<div class="successbox"><strong><p>' . $req->getSessionData( 'epsuccess' ) . '</p></strong></div>' |
| 230 | + . '<hr style="display: block; clear: both; visibility: hidden;" />' |
| 231 | + ); |
| 232 | + $req->setSessionData( 'epsuccess', false ); |
| 233 | + } |
| 234 | + |
| 235 | + if ( $req->getSessionData( 'epfail' ) ) { |
| 236 | + $out->addHTML( |
| 237 | + '<p class="visualClear errorbox">' . $req->getSessionData( 'epfail' ). '</p>' |
| 238 | + . '<hr style="display: block; clear: both; visibility: hidden;" />' |
| 239 | + ); |
| 240 | + $req->setSessionData( 'epfail', false ); |
| 241 | + } |
| 242 | + } |
| 243 | + |
223 | 244 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -491,6 +491,8 @@ |
492 | 492 | 'coursepage-delete-cancel-button' => 'Cancel', |
493 | 493 | 'coursepage-delete-delete-button' => 'Delete course', |
494 | 494 | 'coursepage-delete-none' => 'There is no course titled "$1". Existing courses can be found in [[Special:Courses|the courses list]].', |
| 495 | + 'coursepage-delete-deleted' => 'Successfully deleted course $1.', |
| 496 | + 'coursepage-delete-delete-failed' => 'Failed to deleted course [[Course:$1|$1]].', |
495 | 497 | |
496 | 498 | // Institution deletion |
497 | 499 | '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 @@ |
500 | 502 | 'orgpage-delete-cancel-button' => 'Cancel', |
501 | 503 | 'orgpage-delete-delete-button' => 'Delete institution', |
502 | 504 | 'orgpage-delete-none' => 'There is no institution titled "$1". Existing institutions can be found in [[Special:Courses|the institution list]].', |
| 505 | + 'coursepage-delete-deleted' => 'Successfully deleted institution $1 and its associated courses.', |
| 506 | + 'coursepage-delete-delete-failed' => 'Failed to deleted institution [[Institution:$1|$1]].', |
503 | 507 | |
504 | 508 | // Institution restoration |
505 | 509 | 'orgpage-eprestore-title' => 'Restore institution "$1"', |