https://www.mediawiki.org/wiki/Special:Code/MediaWiki/112508

Revision: 112508
Author:   jeroendedauw
Date:     2012-02-27 19:40:57 +0000 (Mon, 27 Feb 2012)
Log Message:
-----------
adding info on which fields are reveratbale and added js to undo and restore 
pages

Modified Paths:
--------------
    trunk/extensions/EducationProgram/actions/EPRestoreAction.php
    trunk/extensions/EducationProgram/actions/EPUndoAction.php
    trunk/extensions/EducationProgram/includes/EPCourses.php
    trunk/extensions/EducationProgram/includes/EPOrgs.php
    trunk/extensions/EducationProgram/includes/EPPageTable.php
    trunk/extensions/EducationProgram/resources/ep.formpage.js

Modified: trunk/extensions/EducationProgram/actions/EPRestoreAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPRestoreAction.php       
2012-02-27 19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/actions/EPRestoreAction.php       
2012-02-27 19:40:57 UTC (rev 112508)
@@ -94,6 +94,8 @@
        protected function displayForm( EPPageObject $object ) {
                $out = $this->getOutput();
 
+               $out->addModules( 'ep.formpage' );
+               
                $out->addWikiMsg( $this->prefixMsg( 'text' ), 
$object->getField( 'name' ) );
 
                $out->addHTML( Html::openElement(

Modified: trunk/extensions/EducationProgram/actions/EPUndoAction.php
===================================================================
--- trunk/extensions/EducationProgram/actions/EPUndoAction.php  2012-02-27 
19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/actions/EPUndoAction.php  2012-02-27 
19:40:57 UTC (rev 112508)
@@ -94,6 +94,8 @@
        protected function displayForm( EPPageObject $object ) {
                $out = $this->getOutput();
 
+               $out->addModules( 'ep.formpage' );
+               
                $out->addWikiMsg( $this->prefixMsg( 'text' ), 
$object->getField( 'name' ) );
 
                $out->addHTML( Html::openElement(

Modified: trunk/extensions/EducationProgram/includes/EPCourses.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCourses.php    2012-02-27 
19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/includes/EPCourses.php    2012-02-27 
19:40:57 UTC (rev 112508)
@@ -118,9 +118,28 @@
                        'instructor_count',
                        'oa_count',
                        'ca_count',
+                       'field',
+                       'level',
+                       'term',
+                       'lang',
+                       'mc',
                );
        }
        
+       /**
+        * (non-PHPdoc)
+        * @see EPPageTable::getRevertableFields()
+        */
+       public function getRevertableFields() {
+               return array(
+                       'name',
+                       'start',
+                       'end',
+                       'description',
+                       'token',
+               );
+       }
+       
        public function hasActiveName( $courseName ) {
                $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() );
 

Modified: trunk/extensions/EducationProgram/includes/EPOrgs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOrgs.php       2012-02-27 
19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/includes/EPOrgs.php       2012-02-27 
19:40:57 UTC (rev 112508)
@@ -89,18 +89,29 @@
        
        /**
         * (non-PHPdoc)
+        * @see EPPageTable::getRevertableFields()
+        */
+       public function getRevertableFields() {
+               return array_diff( 
+                       array_keys( $this->getFieldTypes() ),
+                       array_merge( array( 'id', $this->getSummaryFields() ) )
+               );
+       }
+       
+       /**
+        * (non-PHPdoc)
         * @see DBTable::getSummaryFields()
         * @since 0.1
         * @return array
         */
        public function getSummaryFields() {
                return array(
-                       'active',
+                       'active',       
                        'course_count',
                        'student_count',
                        'instructor_count',
+                       'oa_count',
                        'ca_count',
-                       'oa_count',
                );
        }
 

Modified: trunk/extensions/EducationProgram/includes/EPPageTable.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPPageTable.php  2012-02-27 
19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/includes/EPPageTable.php  2012-02-27 
19:40:57 UTC (rev 112508)
@@ -32,6 +32,16 @@
        public abstract function getNamespace();
        
        /**
+        * Returns the name of the fields that can be changed
+        * when doing a revert or restoring to a previous revision.
+        * 
+        * @since 0.1
+        * 
+        * @return array
+        */
+       public abstract function getRevertableFields();
+       
+       /**
         * Returns the right needed to edit items in this table.
         * 
         * @since 0.1

Modified: trunk/extensions/EducationProgram/resources/ep.formpage.js
===================================================================
--- trunk/extensions/EducationProgram/resources/ep.formpage.js  2012-02-27 
19:25:01 UTC (rev 112507)
+++ trunk/extensions/EducationProgram/resources/ep.formpage.js  2012-02-27 
19:40:57 UTC (rev 112508)
@@ -12,13 +12,11 @@
                
                $( '#bodyContent' ).find( '[type="submit"]' ).button();
                
-               $( '#cancelEdit, #cancelDelete' ).click( function( event ) {
+               $( '.ep-cancel' ).button().click( function( event ) {
                        window.location = $( this ).attr( 'target-url' );
                        event.preventDefault();
                } );
 
-               $( '#cancelDelete' ).button();
-
        } );
        
 })( window.jQuery, window.mediaWiki );
\ No newline at end of file


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to