https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112407
Revision: 112407 Author: jeroendedauw Date: 2012-02-25 19:40:27 +0000 (Sat, 25 Feb 2012) Log Message: ----------- fixed error when viewing old rev and some cleanup Modified Paths: -------------- trunk/extensions/EducationProgram/actions/EPViewAction.php trunk/extensions/EducationProgram/includes/EPCourses.php trunk/extensions/EducationProgram/includes/EPOrgs.php trunk/extensions/EducationProgram/includes/EPPageTable.php Modified: trunk/extensions/EducationProgram/actions/EPViewAction.php =================================================================== --- trunk/extensions/EducationProgram/actions/EPViewAction.php 2012-02-25 17:58:18 UTC (rev 112406) +++ trunk/extensions/EducationProgram/actions/EPViewAction.php 2012-02-25 19:40:27 UTC (rev 112407) @@ -48,7 +48,7 @@ $currentObject = $this->table->get( $name, 'id' ); if ( $currentObject !== false ) { - $rev = EPRevision::selectRow( null, array( + $rev = EPRevisions::singleton()->selectRow( null, array( 'id' => $this->getRequest()->getInt( 'revid' ), 'object_id' => $currentObject->getField( 'id' ) ) ); Modified: trunk/extensions/EducationProgram/includes/EPCourses.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPCourses.php 2012-02-25 17:58:18 UTC (rev 112406) +++ trunk/extensions/EducationProgram/includes/EPCourses.php 2012-02-25 19:40:27 UTC (rev 112407) @@ -13,6 +13,20 @@ */ class EPCourses extends EPPageTable { + protected static $info = array( + 'ns' => EP_NS_COURSE, + 'actions' => array( + 'view' => false, + 'edit' => 'ep-course', + 'history' => false, + 'enroll' => 'ep-enroll', + ), + 'edit-right' => 'ep-course', + 'identifier' => 'name', + 'list' => 'Courses', + 'log-type' => 'course', + ); + /** * (non-PHPdoc) * @see DBTable::getDBTable() Modified: trunk/extensions/EducationProgram/includes/EPOrgs.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPOrgs.php 2012-02-25 17:58:18 UTC (rev 112406) +++ trunk/extensions/EducationProgram/includes/EPOrgs.php 2012-02-25 19:40:27 UTC (rev 112407) @@ -13,6 +13,19 @@ */ class EPOrgs extends EPPageTable { + protected static $info = array( + 'ns' => EP_NS_INSTITUTION, + 'actions' => array( + 'view' => false, + 'edit' => 'ep-org', + 'history' => false, + ), + 'edit-right' => 'ep-org', + 'identifier' => 'name', + 'list' => 'Institutions', + 'log-type' => 'institution', + ); + /** * (non-PHPdoc) * @see DBTable::getDBTable() Modified: trunk/extensions/EducationProgram/includes/EPPageTable.php =================================================================== --- trunk/extensions/EducationProgram/includes/EPPageTable.php 2012-02-25 17:58:18 UTC (rev 112406) +++ trunk/extensions/EducationProgram/includes/EPPageTable.php 2012-02-25 19:40:27 UTC (rev 112407) @@ -13,47 +13,18 @@ */ abstract class EPPageTable extends DBTable { - // TODO - protected static $info = array( - 'EPCourses' => array( - 'ns' => EP_NS_COURSE, - 'actions' => array( - 'view' => false, - 'edit' => 'ep-course', - 'history' => false, - 'enroll' => 'ep-enroll', - ), - 'edit-right' => 'ep-course', - 'identifier' => 'name', - 'list' => 'Courses', - 'log-type' => 'course', - ), - 'EPOrgs' => array( - 'ns' => EP_NS_INSTITUTION, - 'actions' => array( - 'view' => false, - 'edit' => 'ep-org', - 'history' => false, - ), - 'edit-right' => 'ep-org', - 'identifier' => 'name', - 'list' => 'Institutions', - 'log-type' => 'institution', - ), - ); - public function getIdentifierField() { - return self::$info[get_called_class()]['identifier']; + return static::$info['identifier']; } public function getEditRight() { - return self::$info[get_called_class()]['edit-right']; + return static::$info['edit-right']; } public static function getTitleFor( $identifierValue ) { return Title::newFromText( $identifierValue, - self::$info[get_called_class()]['ns'] + static::$info['ns'] ); } @@ -79,7 +50,7 @@ } public function getListPage() { - return self::$info[get_called_class()]['list']; + return static::$info['list']; } /** @@ -117,13 +88,13 @@ */ public function getLogInfoForTitle( Title $title ) { return array( - 'type' => self::$info[get_called_class()]['log-type'], + 'type' => static::$info['log-type'], 'title' => $title, ); } public static function getTypeForNS( $ns ) { - foreach ( self::$info as $type => $info ) { + foreach ( static::$info as $type => $info ) { if ( $info['ns'] === $ns ) { return $type; } @@ -146,7 +117,7 @@ LogEventsList::showLogExtract( $out, - array( self::$info[get_called_class()]['log-type'] ), + array( static::$info['log-type'] ), $context->getTitle(), '', array( _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs