Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -70,6 +70,7 @@ |
71 | 71 | $wgAutoloadClasses['EPRemoveReviewerAction'] = dirname( __FILE__ ) . '/actions/EPRemoveReviewerAction.php'; |
72 | 72 | $wgAutoloadClasses['EPRemoveStudentAction'] = dirname( __FILE__ ) . '/actions/EPRemoveStudentAction.php'; |
73 | 73 | $wgAutoloadClasses['EPRestoreAction'] = dirname( __FILE__ ) . '/actions/EPRestoreAction.php'; |
| 74 | +$wgAutoloadClasses['EPUndeleteAction'] = dirname( __FILE__ ) . '/actions/EPUndeleteAction.php'; |
74 | 75 | $wgAutoloadClasses['EPUndoAction'] = dirname( __FILE__ ) . '/actions/EPUndoAction.php'; |
75 | 76 | $wgAutoloadClasses['EPViewAction'] = dirname( __FILE__ ) . '/actions/EPViewAction.php'; |
76 | 77 | $wgAutoloadClasses['ViewCourseAction'] = dirname( __FILE__ ) . '/actions/ViewCourseAction.php'; |
Index: trunk/extensions/EducationProgram/pages/EPPage.php |
— | — | @@ -169,9 +169,27 @@ |
170 | 170 | return static::$info['log-type']; |
171 | 171 | } |
172 | 172 | |
| 173 | + // TODO |
173 | 174 | public static function displayDeletionLog( IContextSource $context, $messageKey ) { |
174 | 175 | $out = $context->getOutput(); |
175 | 176 | |
| 177 | + if ( true ) { // $context->getUser()->isAllowed( '' ) |
| 178 | + $revisionCount = EPRevisions::singleton()->count( array( |
| 179 | + 'object_identifier' => $context->getTitle()->getText() |
| 180 | + ) ); |
| 181 | + |
| 182 | + if ( $revisionCount > 0 ) { |
| 183 | + $out->addHTML( $context->msg( 'thisisdeleted' )->rawParams( |
| 184 | + Linker::linkKnown( |
| 185 | + $context->getTitle(), |
| 186 | + $context->msg( 'restorelink' )->numParams( $revisionCount )->escaped(), |
| 187 | + array(), |
| 188 | + array( 'action' => 'epundelete' ) |
| 189 | + ) |
| 190 | + )->text() ); |
| 191 | + } |
| 192 | + } |
| 193 | + |
176 | 194 | LogEventsList::showLogExtract( |
177 | 195 | $out, |
178 | 196 | array( static::$info['log-type'] ), |
Index: trunk/extensions/EducationProgram/actions/EPRestoreAction.php |
— | — | @@ -102,6 +102,7 @@ |
103 | 103 | |
104 | 104 | if ( $success ) { |
105 | 105 | // TODO: log |
| 106 | + // Already logged - just alter message? |
106 | 107 | } |
107 | 108 | } |
108 | 109 | |
Index: trunk/extensions/EducationProgram/includes/EPRevisions.php |
— | — | @@ -99,4 +99,24 @@ |
100 | 100 | return new EPRevision( $this, $fields ); |
101 | 101 | } |
102 | 102 | |
| 103 | + /** |
| 104 | + * Returns the most recent revision matching the provided conditions. |
| 105 | + * |
| 106 | + * @since 0.1 |
| 107 | + * |
| 108 | + * @param array $conds |
| 109 | + * |
| 110 | + * @return EPRevision|false |
| 111 | + */ |
| 112 | + public function getLatestRevision( array $conds ) { |
| 113 | + return $this->selectRow( |
| 114 | + null, |
| 115 | + $conds, |
| 116 | + array( |
| 117 | + 'SORT BY' => $this->getPrefixedField( 'id' ), |
| 118 | + 'ORDER' => 'DESC', |
| 119 | + ) |
| 120 | + ); |
| 121 | + } |
| 122 | + |
103 | 123 | } |