Index: trunk/extensions/EducationProgram/includes/EPPageObject.php |
— | — | @@ -40,6 +40,16 @@ |
41 | 41 | 'log-type' => 'institution', |
42 | 42 | ), |
43 | 43 | ); |
| 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 | + } |
44 | 54 | |
45 | 55 | public static function getIdentifierField() { |
46 | 56 | return self::$info[get_called_class()]['identifier']; |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -367,10 +367,14 @@ |
368 | 368 | // Institution history |
369 | 369 | 'ep-org-history' => 'View logs for this institution', |
370 | 370 | '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.', |
371 | 373 | |
372 | 374 | // Course history |
373 | 375 | 'ep-course-history' => 'View logs for this course', |
374 | 376 | '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.', |
375 | 379 | |
376 | 380 | // Special:Ambassador |
377 | 381 | '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 @@ |
2 | 2 | <?php |
3 | 3 | |
4 | 4 | /** |
5 | | - * Abstract action for viewing the history of EPDBObject items. |
| 5 | + * Abstract action for viewing the history of EPPageObject items. |
6 | 6 | * |
7 | 7 | * @since 0.1 |
8 | 8 | * |
— | — | @@ -15,7 +15,7 @@ |
16 | 16 | abstract class EPHistoryAction extends FormlessAction { |
17 | 17 | |
18 | 18 | /** |
19 | | - * Returns the class name of the EPDBObject this action handles. |
| 19 | + * Returns the class name of the EPPageObject this action handles. |
20 | 20 | * |
21 | 21 | * @since 0.1 |
22 | 22 | * |
— | — | @@ -37,7 +37,23 @@ |
38 | 38 | if ( $object === false ) { |
39 | 39 | $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-norevs' ); |
40 | 40 | |
| 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 | + ); |
41 | 53 | |
| 54 | + if ( $lastRev !== false ) { |
| 55 | + // TODO: show available info about deletion |
| 56 | + $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-deleted' ); |
| 57 | + } |
42 | 58 | } |
43 | 59 | else { |
44 | 60 | $this->displayRevisions( $object ); |
— | — | @@ -66,9 +82,9 @@ |
67 | 83 | * |
68 | 84 | * @since 0.1 |
69 | 85 | * |
70 | | - * @param EPDBObject $object |
| 86 | + * @param EPPageObject $object |
71 | 87 | */ |
72 | | - protected function displayRevisions( EPDBObject $object ) { |
| 88 | + protected function displayRevisions( EPPageObject $object ) { |
73 | 89 | $conditions = array( |
74 | 90 | 'type' => get_class( $object ), |
75 | 91 | ); |