Index: trunk/extensions/EducationProgram/actions/EPRestoreAction.php |
— | — | @@ -94,6 +94,8 @@ |
95 | 95 | protected function displayForm( EPPageObject $object ) { |
96 | 96 | $out = $this->getOutput(); |
97 | 97 | |
| 98 | + $out->addModules( 'ep.formpage' ); |
| 99 | + |
98 | 100 | $out->addWikiMsg( $this->prefixMsg( 'text' ), $object->getField( 'name' ) ); |
99 | 101 | |
100 | 102 | $out->addHTML( Html::openElement( |
Index: trunk/extensions/EducationProgram/actions/EPUndoAction.php |
— | — | @@ -94,6 +94,8 @@ |
95 | 95 | protected function displayForm( EPPageObject $object ) { |
96 | 96 | $out = $this->getOutput(); |
97 | 97 | |
| 98 | + $out->addModules( 'ep.formpage' ); |
| 99 | + |
98 | 100 | $out->addWikiMsg( $this->prefixMsg( 'text' ), $object->getField( 'name' ) ); |
99 | 101 | |
100 | 102 | $out->addHTML( Html::openElement( |
Index: trunk/extensions/EducationProgram/includes/EPOrgs.php |
— | — | @@ -89,18 +89,29 @@ |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * (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) |
93 | 104 | * @see DBTable::getSummaryFields() |
94 | 105 | * @since 0.1 |
95 | 106 | * @return array |
96 | 107 | */ |
97 | 108 | public function getSummaryFields() { |
98 | 109 | return array( |
99 | | - 'active', |
| 110 | + 'active', |
100 | 111 | 'course_count', |
101 | 112 | 'student_count', |
102 | 113 | 'instructor_count', |
| 114 | + 'oa_count', |
103 | 115 | 'ca_count', |
104 | | - 'oa_count', |
105 | 116 | ); |
106 | 117 | } |
107 | 118 | |
Index: trunk/extensions/EducationProgram/includes/EPPageTable.php |
— | — | @@ -32,6 +32,16 @@ |
33 | 33 | public abstract function getNamespace(); |
34 | 34 | |
35 | 35 | /** |
| 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 | + /** |
36 | 46 | * Returns the right needed to edit items in this table. |
37 | 47 | * |
38 | 48 | * @since 0.1 |
Index: trunk/extensions/EducationProgram/includes/EPCourses.php |
— | — | @@ -118,9 +118,28 @@ |
119 | 119 | 'instructor_count', |
120 | 120 | 'oa_count', |
121 | 121 | 'ca_count', |
| 122 | + 'field', |
| 123 | + 'level', |
| 124 | + 'term', |
| 125 | + 'lang', |
| 126 | + 'mc', |
122 | 127 | ); |
123 | 128 | } |
124 | 129 | |
| 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 | + |
125 | 144 | public function hasActiveName( $courseName ) { |
126 | 145 | $now = wfGetDB( DB_SLAVE )->addQuotes( wfTimestampNow() ); |
127 | 146 | |
Index: trunk/extensions/EducationProgram/resources/ep.formpage.js |
— | — | @@ -12,13 +12,11 @@ |
13 | 13 | |
14 | 14 | $( '#bodyContent' ).find( '[type="submit"]' ).button(); |
15 | 15 | |
16 | | - $( '#cancelEdit, #cancelDelete' ).click( function( event ) { |
| 16 | + $( '.ep-cancel' ).button().click( function( event ) { |
17 | 17 | window.location = $( this ).attr( 'target-url' ); |
18 | 18 | event.preventDefault(); |
19 | 19 | } ); |
20 | 20 | |
21 | | - $( '#cancelDelete' ).button(); |
22 | | - |
23 | 21 | } ); |
24 | 22 | |
25 | 23 | })( window.jQuery, window.mediaWiki ); |
\ No newline at end of file |