r50715 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50714‎ | r50715 | r50716 >
Date:07:43, 18 May 2009
Author:nad
Status:deferred
Tags:
Comment:
redirect to record normal view after updating or creating a record
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin.php (modified) (history)
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -120,8 +120,14 @@
121121 $text = $text ? "{{" . "$type\n$text}}" : "{{" . "$type}}";
122122 $success = $article->doEdit( $text, $summary, EDIT_NEW );
123123
124 - # Report success or error
125 - if ( $success ) $wgOut->addHTML( "<div class='successbox'>" . wfMsg( 'recordadmin-createsuccess', $wpTitle ) . "</div>\n" );
 124+ # Redirect to view the record if successfully updated
 125+ if ( $success ) {
 126+ $wgOut->disable();
 127+ wfResetOutputBuffers();
 128+ header( "Location: " . $t->getFullUrl() );
 129+ }
 130+
 131+ # Or stay in edit view and report error
126132 else $wgOut->addHTML( "<div class='errorbox'>" . wfMsg( 'recordadmin-createerror', $type ) . "</div>\n" );
127133 }
128134 } else $wgOut->addHTML( "<div class='errorbox'>" . wfMsg( 'recordadmin-badtitle' ) . "</div>\n" );
@@ -182,8 +188,14 @@
183189 $success = $article->doEdit( $text, $summary, EDIT_UPDATE|$minor );
184190 if ($watch) $article->doWatch();
185191
186 - # Report success or error
187 - if ( $success ) $wgOut->addHTML( "<div class='successbox'>" . wfMsg( 'recordadmin-updatesuccess', $type ) . "</div>\n" );
 192+ # Redirect to view the record if successfully updated
 193+ if ( $success ) {
 194+ $wgOut->disable();
 195+ wfResetOutputBuffers();
 196+ header( "Location: " . $rtitle->getFullUrl() );
 197+ }
 198+
 199+ # Stay at edit form and render error if not edited successfully
188200 else $wgOut->addHTML( "<div class='errorbox'>" . wfMsg( 'recordadmin-updateerror' ) . "</div>\n" );
189201 $wgOut->addHTML( "<br /><br /><br /><br />\n" );
190202 }
Index: trunk/extensions/RecordAdmin/RecordAdmin.php
@@ -11,7 +11,7 @@
1212 * @licence GNU General Public Licence 2.0 or later
1313 */
1414
15 -define( 'RECORDADMIN_VERSION', '0.6.3, 2009-04-01' );
 15+define( 'RECORDADMIN_VERSION', '0.6.4, 2009-05-18' );
1616
1717 $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type
1818 $wgRecordAdminCategory = 'Records'; # Category containing record types

Status & tagging log