Index: trunk/extensions/EducationProgram/actions/EPViewAction.php |
— | — | @@ -65,6 +65,11 @@ |
66 | 66 | } |
67 | 67 | else { |
68 | 68 | $out->addWikiMsg( strtolower( get_called_class() ) . '-none', $name ); |
| 69 | + |
| 70 | + $class::displayDeletionLog( |
| 71 | + $this->getContext(), |
| 72 | + 'ep-' . strtolower( $this->getName() ) . '-deleted' |
| 73 | + ); |
69 | 74 | } |
70 | 75 | } |
71 | 76 | else { |
Index: trunk/extensions/EducationProgram/actions/EPHistoryAction.php |
— | — | @@ -35,25 +35,7 @@ |
36 | 36 | $object = $c::get( $this->getTitle()->getText() ); |
37 | 37 | |
38 | 38 | if ( $object === false ) { |
39 | | - $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-norevs' ); |
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 | | - ); |
53 | | - |
54 | | - if ( $lastRev !== false ) { |
55 | | - // TODO: show available info about deletion |
56 | | - $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-deleted' ); |
57 | | - } |
| 39 | + $this->displayNoRevisions(); |
58 | 40 | } |
59 | 41 | else { |
60 | 42 | $this->displayRevisions( $object ); |
— | — | @@ -62,6 +44,15 @@ |
63 | 45 | return ''; |
64 | 46 | } |
65 | 47 | |
| 48 | + protected function displayNoRevisions() { |
| 49 | + $this->getOutput()->addWikiMsg( 'ep-' . strtolower( $this->getName() ) . '-norevs' ); |
| 50 | + |
| 51 | + $c::displayDeletionLog( |
| 52 | + $this->getContext(), |
| 53 | + 'ep-' . strtolower( $this->getName() ) . '-deleted' |
| 54 | + ); |
| 55 | + } |
| 56 | + |
66 | 57 | /** |
67 | 58 | * Returns the page title. |
68 | 59 | * |
Index: trunk/extensions/EducationProgram/actions/EPEditAction.php |
— | — | @@ -89,6 +89,11 @@ |
90 | 90 | } |
91 | 91 | else { |
92 | 92 | if ( $object === false ) { |
| 93 | + $c::displayDeletionLog( |
| 94 | + $this->getContext(), |
| 95 | + 'ep-' . strtolower( $this->getName() ) . '-deleted' |
| 96 | + ); |
| 97 | + |
93 | 98 | $this->isNew = true; |
94 | 99 | $object = new $c( $data, true ); |
95 | 100 | } |
Index: trunk/extensions/EducationProgram/includes/EPRevision.php |
— | — | @@ -147,5 +147,16 @@ |
148 | 148 | |
149 | 149 | return $this->user; |
150 | 150 | } |
| 151 | + |
| 152 | + public static function getLastRevision( array $conditions ) { |
| 153 | + return EPRevision::selectRow( |
| 154 | + null, |
| 155 | + $conditions, |
| 156 | + array( |
| 157 | + 'SORT BY' => EPRevision::getPrefixedField( 'time' ), |
| 158 | + 'ORDER' => 'DESC', |
| 159 | + ) |
| 160 | + ); |
| 161 | + } |
151 | 162 | |
152 | 163 | } |
Index: trunk/extensions/EducationProgram/includes/EPPageObject.php |
— | — | @@ -40,16 +40,6 @@ |
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 | | - } |
54 | 44 | |
55 | 45 | public static function getIdentifierField() { |
56 | 46 | return self::$info[get_called_class()]['identifier']; |
— | — | @@ -156,4 +146,40 @@ |
157 | 147 | ); |
158 | 148 | } |
159 | 149 | |
| 150 | + public static function getTypeForNS( $ns ) { |
| 151 | + foreach ( self::$info as $type => $info ) { |
| 152 | + if ( $info['ns'] === $ns ) { |
| 153 | + return $type; |
| 154 | + } |
| 155 | + } |
| 156 | + |
| 157 | + throw new MWException( 'Unknown EPPageObject ns' ); |
| 158 | + } |
| 159 | + |
| 160 | + public static function getLatestRevForTitle( Title $title, $conditions = array() ) { |
| 161 | + $conds = array( |
| 162 | + 'type' => self::getTypeForNS( $title->getNamespace() ), |
| 163 | + 'object_identifier' => $title->getText(), |
| 164 | + ); |
| 165 | + |
| 166 | + return EPRevision::getLastRevision( array_merge( $conds, $conditions ) ); |
| 167 | + } |
| 168 | + |
| 169 | + public static function displayDeletionLog( IContextSource $context, $messageKey ) { |
| 170 | + $out = $context->getOutput(); |
| 171 | + |
| 172 | + LogEventsList::showLogExtract( |
| 173 | + $out, |
| 174 | + array( self::$info[get_called_class()]['log-type'] ), |
| 175 | + $context->getTitle(), |
| 176 | + '', |
| 177 | + array( |
| 178 | + 'lim' => 10, |
| 179 | + 'conds' => array( 'log_action' => 'remove' ), |
| 180 | + 'showIfEmpty' => false, |
| 181 | + 'msgKey' => array( $messageKey ) |
| 182 | + ) |
| 183 | + ); |
| 184 | + } |
| 185 | + |
160 | 186 | } |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -283,7 +283,10 @@ |
284 | 284 | 'ep-editorg-exists-already' => 'This institution already exists. You are editing it.', |
285 | 285 | 'ep-editorg-edit' => 'Editing institution: $1', |
286 | 286 | 'ep-editorg-add' => 'Adding institution: $1', |
| 287 | + 'ep-editorg-deleted' => "'''Warning: You are recreating an institution that was previously deleted.''' |
287 | 288 | |
| 289 | +You should consider whether it is appropriate to continue editing this institution. |
| 290 | +The deletion log for this institution is provided below for convenience:", |
288 | 291 | |
289 | 292 | // Course editing |
290 | 293 | 'editcourse-add-legend' => 'Add course', |
— | — | @@ -306,7 +309,11 @@ |
307 | 310 | 'ep-editcourse-exists-already' => 'This course already exists. You are editing it.', |
308 | 311 | 'ep-editcourse-edit' => 'Editing course: $1', |
309 | 312 | 'ep-editcourse-add' => 'Adding course: $1', |
| 313 | + 'ep-editcourse-deleted' => "'''Warning: You are recreating a course that was previously deleted.''' |
310 | 314 | |
| 315 | +You should consider whether it is appropriate to continue editing this course. |
| 316 | +The deletion log for this course is provided below for convenience:", |
| 317 | + |
311 | 318 | 'ep-course-invalid-org' => 'This institution does not exist.', |
312 | 319 | 'ep-course-invalid-token' => 'The token needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', |
313 | 320 | 'ep-course-invalid-description' => 'The description needs to be at least contain $1 {{PLURAL:$1|character|characters}}.', |
— | — | @@ -332,6 +339,7 @@ |
333 | 340 | 'ep-institution-inactive' => 'Inactive', |
334 | 341 | 'ep-institution-active' => 'Active', |
335 | 342 | 'ep-institution-courses' => 'Courses', |
| 343 | + 'ep-vieworg-deleted' => 'This institution has been deleted. The deletion log for the institution is provided below for reference.', |
336 | 344 | |
337 | 345 | // Course viewing |
338 | 346 | 'ep-course-title' => 'Course: $1', |
— | — | @@ -363,18 +371,19 @@ |
364 | 372 | 'ep-instructor-summary' => 'Summary:', |
365 | 373 | 'ep-online-summary' => 'Summary:', |
366 | 374 | 'ep-campus-summary' => 'Summary:', |
| 375 | + 'ep-viewcourse-deleted' => 'This course has been deleted. The deletion log for the course is provided below for reference.', |
367 | 376 | |
368 | 377 | // Institution history |
369 | 378 | 'ep-org-history' => 'View logs for this institution', |
370 | 379 | 'ep-orghistory-title' => 'Revision history of institution "$1"', |
371 | 380 | 'ep-orghistory-norevs' => 'There is no edit history for this institution.', |
372 | | - 'ep-orghistory-deleted' => 'This institution has been deleted.', |
| 381 | + 'ep-orghistory-deleted' => 'This institution has been deleted. The deletion log for the institution is provided below for reference.', |
373 | 382 | |
374 | 383 | // Course history |
375 | 384 | 'ep-course-history' => 'View logs for this course', |
376 | 385 | 'ep-coursehistory-title' => 'Revision history of course "$1"', |
377 | 386 | 'ep-coursehistory-norevs' => 'There is no edit history for this course.', |
378 | | - 'ep-coursehistory-deleted' => 'This course has been deleted.', |
| 387 | + 'ep-coursehistory-deleted' => 'This course has been deleted. The deletion log for the course is provided below for reference.', |
379 | 388 | |
380 | 389 | // Special:Ambassador |
381 | 390 | 'ep-ambassador-does-not-exist' => 'There is no ambassador with name "$1". See [[Special:Ambassadors|here]] for a list of ambassadors.', |