r113520 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113519‎ | r113520 | r113521 >
Date:20:38, 9 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r113507; finish up code I accidentally comited earlier on
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPDeleteAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPEditAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPViewAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPUtils.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/EPViewAction.php
@@ -40,6 +40,7 @@
4141 */
4242 public function onView() {
4343 $out = $this->getOutput();
 44+
4445 $name = $this->getTitle()->getText();
4546
4647 $object = false;
@@ -74,12 +75,15 @@
7576 $out->redirect( $this->getTitle()->getLocalURL( array( 'action' => 'edit' ) ) );
7677 }
7778 else {
 79+ EPUtils::displayResult( $this->getContext() );
 80+
7881 $out->addWikiMsg( strtolower( get_called_class() ) . '-none', $name );
7982
8083 $this->displayDeletionLog();
8184 }
8285 }
8386 else {
 87+ EPUtils::displayResult( $this->getContext() );
8488 $this->displayPage( $object );
8589 }
8690
Index: trunk/extensions/EducationProgram/actions/EPAction.php
@@ -13,7 +13,7 @@
1414 * @author Jeroen De Dauw < jeroendedauw@gmail.com >
1515 */
1616 abstract class EPAction extends FormlessAction {
17 -
 17+
1818 /**
1919 * Display a warning that the page has been deleted together with the first
2020 * few items from its deletion log.
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php
@@ -55,6 +55,8 @@
5656 * @see FormlessAction::onView()
5757 */
5858 public function onView() {
 59+ EPUtils::displayResult( $this->getContext() );
 60+
5961 $this->getOutput()->addModules( 'ep.formpage' );
6062
6163 if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
Index: trunk/extensions/EducationProgram/actions/EPDeleteAction.php
@@ -60,13 +60,16 @@
6161 if ( $success ) {
6262 $title = SpecialPage::getTitleFor( $this->page->getListPage() );
6363 $this->getRequest()->setSessionData(
64 - 'epdeleted',
65 - $this->msg( $this->prefixMsg( 'deleted' ) )
 64+ 'epsuccess',
 65+ $this->msg( $this->prefixMsg( 'deleted' ), $this->getTitle()->getText() )->text()
6666 );
6767 }
6868 else {
6969 $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+ );
7174 }
7275
7376 $this->getOutput()->redirect( $title->getLocalURL() );
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -66,10 +66,7 @@
6767 return false;
6868 }
6969
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() );
7471
7572 return true;
7673 }
Index: trunk/extensions/EducationProgram/includes/EPUtils.php
@@ -219,4 +219,25 @@
220220 return $items;
221221 }
222222
 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+
223244 }
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -491,6 +491,8 @@
492492 'coursepage-delete-cancel-button' => 'Cancel',
493493 'coursepage-delete-delete-button' => 'Delete course',
494494 '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]].',
495497
496498 // Institution deletion
497499 '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 @@
500502 'orgpage-delete-cancel-button' => 'Cancel',
501503 'orgpage-delete-delete-button' => 'Delete institution',
502504 '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]].',
503507
504508 // Institution restoration
505509 'orgpage-eprestore-title' => 'Restore institution "$1"',

Follow-up revisions

RevisionCommit summaryAuthorDate
r113521Follow up to r113520; similar handling on other places as welljeroendedauw20:49, 9 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r113507added autocompletion to article adittion controljeroendedauw19:42, 9 March 2012

Status & tagging log