r112506 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112505‎ | r112506 | r112507 >
Date:19:16, 27 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fix error when editing an org
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPCourses.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgs.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPageObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPageTable.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPRevisionPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/pages/EPPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/pages/EPPage.php
@@ -165,6 +165,10 @@
166166 return static::$info['list'];
167167 }
168168
 169+ public function getLogType() {
 170+ return static::$info['log-type'];
 171+ }
 172+
169173 public static function displayDeletionLog( IContextSource $context, $messageKey ) {
170174 $out = $context->getOutput();
171175
Index: trunk/extensions/EducationProgram/includes/EPOrgs.php
@@ -143,4 +143,12 @@
144144 return EP_NS_INSTITUTION;
145145 }
146146
 147+ /**
 148+ * (non-PHPdoc)
 149+ * @see EPPageTable::getEditRight()
 150+ */
 151+ public function getEditRight() {
 152+ return 'ep-org';
 153+ }
 154+
147155 }
Index: trunk/extensions/EducationProgram/includes/EPPageTable.php
@@ -31,6 +31,15 @@
3232 */
3333 public abstract function getNamespace();
3434
 35+ /**
 36+ * Returns the right needed to edit items in this table.
 37+ *
 38+ * @since 0.1
 39+ *
 40+ * @return string
 41+ */
 42+ public abstract function getEditRight();
 43+
3544 public function hasIdentifier( $identifier ) {
3645 return $this->has( array( $this->getIdentifierField() => $identifier ) );
3746 }
@@ -69,17 +78,6 @@
7079 }
7180
7281 /**
73 - * (non-PHPdoc)
74 - * @see EPRevisionedObject::getLogInfo()
75 - */
76 - public function getLogInfoForTitle( Title $title ) {
77 - return array(
78 - 'type' => static::$info['log-type'],
79 - 'title' => $title,
80 - );
81 - }
82 -
83 - /**
8482 * Construct a new title for an object of this type with the provided identifier value.
8583 *
8684 * @since 0.1
Index: trunk/extensions/EducationProgram/includes/EPPageObject.php
@@ -59,7 +59,7 @@
6060 * @see DBDataObject::save()
6161 */
6262 public function save() {
63 - if ( $this->hasField( $this->getIdentifierField() ) && is_null( $this->getTitle() ) ) {
 63+ if ( $this->hasField( $this->table->getIdentifierField() ) && is_null( $this->getTitle() ) ) {
6464 throw new MWException( 'The title for a EPPageObject needs to be valid when saving.' );
6565 return false;
6666 }
@@ -78,7 +78,10 @@
7979 return false;
8080 }
8181 else {
82 - return $this->table->getLogInfoForTitle( $this->getTitle() );
 82+ return array(
 83+ 'type' => EPPage::factory( $title )->getLogType(),
 84+ 'title' => $title,
 85+ );
8386 }
8487 }
8588
Index: trunk/extensions/EducationProgram/includes/EPRevisionPager.php
@@ -107,8 +107,7 @@
108108 );
109109 }
110110
111 - // TODO: $this->getUser()->isAllowed( $this->table->getEditRight() )
112 - if ( false ) {
 111+ if ( $this->getUser()->isAllowed( $this->table->getEditRight() ) ) {
113112 $actionLinks = array();
114113
115114 if ( $this->mOffset !== '' || $this->rowNr < $this->mResult->numRows() - 1 ) {
Index: trunk/extensions/EducationProgram/includes/EPCourses.php
@@ -175,4 +175,12 @@
176176 return $conditions;
177177 }
178178
 179+ /**
 180+ * (non-PHPdoc)
 181+ * @see EPPageTable::getEditRight()
 182+ */
 183+ public function getEditRight() {
 184+ return 'ep-course';
 185+ }
 186+
179187 }

Status & tagging log