r110284 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110283‎ | r110284 | r110285 >
Date:12:39, 30 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
handle redlinks correctly
Modified paths:
  • /trunk/extensions/EducationProgram/actions/EPEditAction.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/EPEditAction.php
@@ -36,7 +36,6 @@
3737 $this->getOutput()->addModules( 'ep.formpage' );
3838
3939 if ( $this->getRequest()->wasPosted() && $this->getUser()->matchEditToken( $this->getRequest()->getVal( 'wpEditToken' ) ) ) {
40 -
4140 $this->showForm();
4241 }
4342 else {
@@ -69,19 +68,24 @@
7069 $data = $this->getNewData();
7170
7271 $object = $c::selectRow( null, $data );
73 -
74 - if ( $object === false ) {
75 - $this->isNew = true;
76 - $object = new $c( $data, true );
 72+
 73+ if ( $object !== false && $this->getRequest()->getText( 'redlink' ) === '1' ) {
 74+ $this->getOutput()->redirect( $this->getTitle()->getLocalURL() );
7775 }
78 - elseif ( $this->isNewPost() ) {
79 - $this->showWarning( wfMessage( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ) );
 76+ else {
 77+ if ( $object === false ) {
 78+ $this->isNew = true;
 79+ $object = new $c( $data, true );
 80+ }
 81+ elseif ( $this->isNewPost() ) {
 82+ $this->showWarning( wfMessage( 'educationprogram-' . strtolower( $this->getName() ) . '-exists-already' ) );
 83+ }
 84+
 85+ $this->getOutput()->setSubtitle( $this->getDescription() );
 86+
 87+ $this->item = $object;
 88+ $this->showForm();
8089 }
81 -
82 - $this->getOutput()->setSubtitle( $this->getDescription() );
83 -
84 - $this->item = $object;
85 - $this->showForm();
8690 }
8791
8892 /**

Status & tagging log