r112508 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112507‎ | r112508 | r112509 >
Date:19:40, 27 February 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
adding info on which fields are reveratbale and added js to undo and restore pages
Modified paths:
  • /trunk/extensions/EducationProgram/actions/EPRestoreAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/actions/EPUndoAction.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCourses.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgs.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPPageTable.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.formpage.js (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/actions/EPRestoreAction.php
@@ -94,6 +94,8 @@
9595 protected function displayForm( EPPageObject $object ) {
9696 $out = $this->getOutput();
9797
 98+ $out->addModules( 'ep.formpage' );
 99+
98100 $out->addWikiMsg( $this->prefixMsg( 'text' ), $object->getField( 'name' ) );
99101
100102 $out->addHTML( Html::openElement(
Index: trunk/extensions/EducationProgram/actions/EPUndoAction.php
@@ -94,6 +94,8 @@
9595 protected function displayForm( EPPageObject $object ) {
9696 $out = $this->getOutput();
9797
 98+ $out->addModules( 'ep.formpage' );
 99+
98100 $out->addWikiMsg( $this->prefixMsg( 'text' ), $object->getField( 'name' ) );
99101
100102 $out->addHTML( Html::openElement(
Index: trunk/extensions/EducationProgram/includes/EPOrgs.php
@@ -89,18 +89,29 @@
9090
9191 /**
9292 * (non-PHPdoc)
 93+ * @see EPPageTable::getRevertableFields()
 94+ */
 95+ public function getRevertableFields() {
 96+ return array_diff(
 97+ array_keys( $this->getFieldTypes() ),
 98+ array_merge( array( 'id', $this->getSummaryFields() ) )
 99+ );
 100+ }
 101+
 102+ /**
 103+ * (non-PHPdoc)
93104 * @see DBTable::getSummaryFields()
94105 * @since 0.1
95106 * @return array
96107 */
97108 public function getSummaryFields() {
98109 return array(
99 - 'active',
 110+ 'active',
100111 'course_count',
101112 'student_count',
102113 'instructor_count',
 114+ 'oa_count',
103115 'ca_count',
104 - 'oa_count',
105116 );
106117 }
107118
Index: trunk/extensions/EducationProgram/includes/EPPageTable.php
@@ -32,6 +32,16 @@
3333 public abstract function getNamespace();
3434
3535 /**
 36+ * Returns the name of the fields that can be changed
 37+ * when doing a revert or restoring to a previous revision.
 38+ *
 39+ * @since 0.1
 40+ *
 41+ * @return array
 42+ */
 43+ public abstract function getRevertableFields();
 44+
 45+ /**
3646 * Returns the right needed to edit items in this table.
3747 *
3848 * @since 0.1
Index: trunk/extensions/EducationProgram/includes/EPCourses.php
@@ -118,9 +118,28 @@
119119 'instructor_count',
120120 'oa_count',
121121 'ca_count',
 122+ 'field',
 123+ 'level',
 124+ 'term',
 125+ 'lang',
 126+ 'mc',
122127 );
123128 }
124129
 130+ /**
 131+ * (non-PHPdoc)
 132+ * @see EPPageTable::getRevertableFields()
 133+ */
 134+ public function getRevertableFields() {
 135+ return array(
 136+ 'name',
 137+ 'start',
 138+ 'end',
 139+ 'description',
 140+ 'token',
 141+ );
 142+ }
 143+
125144 public function hasActiveName( $courseName ) {
126145 $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() );
127146
Index: trunk/extensions/EducationProgram/resources/ep.formpage.js
@@ -12,13 +12,11 @@
1313
1414 $( '#bodyContent' ).find( '[type="submit"]' ).button();
1515
16 - $( '#cancelEdit, #cancelDelete' ).click( function( event ) {
 16+ $( '.ep-cancel' ).button().click( function( event ) {
1717 window.location = $( this ).attr( 'target-url' );
1818 event.preventDefault();
1919 } );
2020
21 - $( '#cancelDelete' ).button();
22 -
2321 } );
2422
2523 })( window.jQuery, window.mediaWiki );
\ No newline at end of file

Status & tagging log