r110990 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r110989‎ | r110990 | r110991 >
Date:00:23, 9 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
display deletion notice on history page
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPHistoryAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPageObject.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/includes/EPPageObject.php
@@ -40,6 +40,16 @@
4141 'log-type' => 'institution',
4242 ),
4343 );
 44+
 45+ public static function getTypeForNS( $ns ) {
 46+ foreach ( self::$info as $type => $info ) {
 47+ if ( $info['ns'] === $ns ) {
 48+ return $type;
 49+ }
 50+ }
 51+
 52+ throw new MWException( 'Unknown EPPageObject ns' );
 53+ }
4454
4555 public static function getIdentifierField() {
4656 return self::$info[get_called_class()]['identifier'];
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -367,10 +367,14 @@
368368 // Institution history
369369 'ep-org-history' => 'View logs for this institution',
370370 'ep-orghistory-title' => 'Revision history of institution "$1"',
 371+ 'ep-orghistory-norevs' => 'There is no edit history for this institution.',
 372+ 'ep-orghistory-deleted' => 'This institution has been deleted.',
371373
372374 // Course history
373375 'ep-course-history' => 'View logs for this course',
374376 'ep-coursehistory-title' => 'Revision history of course "$1"',
 377+ 'ep-coursehistory-norevs' => 'There is no edit history for this course.',
 378+ 'ep-coursehistory-deleted' => 'This course has been deleted.',
375379
376380 // Special:Ambassador
377381 'ep-ambassador-does-not-exist' => 'There is no ambassador with name "$1". See [[Special:Ambassadors|here]] for a list of ambassadors.',
Index: trunk/extensions/EducationProgram/actions/EPHistoryAction.php
@@ -1,7 +1,7 @@
22 <?php
33
44 /**
5 - * Abstract action for viewing the history of EPDBObject items.
 5+ * Abstract action for viewing the history of EPPageObject items.
66 *
77 * @since 0.1
88 *
@@ -15,7 +15,7 @@
1616 abstract class EPHistoryAction extends FormlessAction {
1717
1818 /**
19 - * Returns the class name of the EPDBObject this action handles.
 19+ * Returns the class name of the EPPageObject this action handles.
2020 *
2121 * @since 0.1
2222 *
@@ -37,7 +37,23 @@
3838 if ( $object === false ) {
3939 $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-norevs' );
4040
 41+ $lastRev = EPRevision::selectRow(
 42+ null,
 43+ array(
 44+ 'type' => EPPageObject::getTypeForNS( $this->getTitle()->getNamespace() ),
 45+ 'object_identifier' => $this->getTitle()->getText(),
 46+ 'deleted' => true,
 47+ ),
 48+ array(
 49+ 'SORT BY' => EPRevision::getPrefixedField( 'time' ),
 50+ 'ORDER' => 'DESC',
 51+ )
 52+ );
4153
 54+ if ( $lastRev !== false ) {
 55+ // TODO: show available info about deletion
 56+ $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-deleted' );
 57+ }
4258 }
4359 else {
4460 $this->displayRevisions( $object );
@@ -66,9 +82,9 @@
6783 *
6884 * @since 0.1
6985 *
70 - * @param EPDBObject $object
 86+ * @param EPPageObject $object
7187 */
72 - protected function displayRevisions( EPDBObject $object ) {
 88+ protected function displayRevisions( EPPageObject $object ) {
7389 $conditions = array(
7490 'type' => get_class( $object ),
7591 );

Status & tagging log