https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112506
Revision: 112506
Author: jeroendedauw
Date: 2012-02-27 19:16:02 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
fix error when editing an org
Modified Paths:
--------------
trunk/extensions/EducationProgram/includes/EPCourses.php
trunk/extensions/EducationProgram/includes/EPOrgs.php
trunk/extensions/EducationProgram/includes/EPPageObject.php
trunk/extensions/EducationProgram/includes/EPPageTable.php
trunk/extensions/EducationProgram/includes/EPRevisionPager.php
trunk/extensions/EducationProgram/pages/EPPage.php
Modified: trunk/extensions/EducationProgram/includes/EPCourses.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCourses.php 2012-02-27
19:05:02 UTC (rev 112505)
+++ trunk/extensions/EducationProgram/includes/EPCourses.php 2012-02-27
19:16:02 UTC (rev 112506)
@@ -175,4 +175,12 @@
return $conditions;
}
+ /**
+ * (non-PHPdoc)
+ * @see EPPageTable::getEditRight()
+ */
+ public function getEditRight() {
+ return 'ep-course';
+ }
+
}
Modified: trunk/extensions/EducationProgram/includes/EPOrgs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOrgs.php 2012-02-27
19:05:02 UTC (rev 112505)
+++ trunk/extensions/EducationProgram/includes/EPOrgs.php 2012-02-27
19:16:02 UTC (rev 112506)
@@ -143,4 +143,12 @@
return EP_NS_INSTITUTION;
}
+ /**
+ * (non-PHPdoc)
+ * @see EPPageTable::getEditRight()
+ */
+ public function getEditRight() {
+ return 'ep-org';
+ }
+
}
Modified: trunk/extensions/EducationProgram/includes/EPPageObject.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPPageObject.php 2012-02-27
19:05:02 UTC (rev 112505)
+++ trunk/extensions/EducationProgram/includes/EPPageObject.php 2012-02-27
19:16:02 UTC (rev 112506)
@@ -59,7 +59,7 @@
* @see DBDataObject::save()
*/
public function save() {
- if ( $this->hasField( $this->getIdentifierField() ) && is_null(
$this->getTitle() ) ) {
+ if ( $this->hasField( $this->table->getIdentifierField() ) &&
is_null( $this->getTitle() ) ) {
throw new MWException( 'The title for a EPPageObject
needs to be valid when saving.' );
return false;
}
@@ -78,7 +78,10 @@
return false;
}
else {
- return $this->table->getLogInfoForTitle(
$this->getTitle() );
+ return array(
+ 'type' => EPPage::factory( $title
)->getLogType(),
+ 'title' => $title,
+ );
}
}
Modified: trunk/extensions/EducationProgram/includes/EPPageTable.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPPageTable.php 2012-02-27
19:05:02 UTC (rev 112505)
+++ trunk/extensions/EducationProgram/includes/EPPageTable.php 2012-02-27
19:16:02 UTC (rev 112506)
@@ -31,6 +31,15 @@
*/
public abstract function getNamespace();
+ /**
+ * Returns the right needed to edit items in this table.
+ *
+ * @since 0.1
+ *
+ * @return string
+ */
+ public abstract function getEditRight();
+
public function hasIdentifier( $identifier ) {
return $this->has( array( $this->getIdentifierField() =>
$identifier ) );
}
@@ -69,17 +78,6 @@
}
/**
- * (non-PHPdoc)
- * @see EPRevisionedObject::getLogInfo()
- */
- public function getLogInfoForTitle( Title $title ) {
- return array(
- 'type' => static::$info['log-type'],
- 'title' => $title,
- );
- }
-
- /**
* Construct a new title for an object of this type with the provided
identifier value.
*
* @since 0.1
Modified: trunk/extensions/EducationProgram/includes/EPRevisionPager.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPRevisionPager.php
2012-02-27 19:05:02 UTC (rev 112505)
+++ trunk/extensions/EducationProgram/includes/EPRevisionPager.php
2012-02-27 19:16:02 UTC (rev 112506)
@@ -107,8 +107,7 @@
);
}
- // TODO: $this->getUser()->isAllowed(
$this->table->getEditRight() )
- if ( false ) {
+ if ( $this->getUser()->isAllowed( $this->table->getEditRight()
) ) {
$actionLinks = array();
if ( $this->mOffset !== '' || $this->rowNr <
$this->mResult->numRows() - 1 ) {
Modified: trunk/extensions/EducationProgram/pages/EPPage.php
===================================================================
--- trunk/extensions/EducationProgram/pages/EPPage.php 2012-02-27 19:05:02 UTC
(rev 112505)
+++ trunk/extensions/EducationProgram/pages/EPPage.php 2012-02-27 19:16:02 UTC
(rev 112506)
@@ -165,6 +165,10 @@
return static::$info['list'];
}
+ public function getLogType() {
+ return static::$info['log-type'];
+ }
+
public static function displayDeletionLog( IContextSource $context,
$messageKey ) {
$out = $context->getOutput();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs