Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php |
— | — | @@ -61,6 +61,8 @@ |
62 | 62 | * @see SpecialPage::getDescription |
63 | 63 | * |
64 | 64 | * @since 0.1 |
| 65 | + * |
| 66 | + * @return string |
65 | 67 | */ |
66 | 68 | public function getDescription() { |
67 | 69 | $action = $this->isNew() ? 'add' : 'edit'; |
— | — | @@ -253,6 +255,8 @@ |
254 | 256 | * @since 0.1 |
255 | 257 | * |
256 | 258 | * @param array $fields |
| 259 | + * |
| 260 | + * @return array |
257 | 261 | */ |
258 | 262 | protected function processFormFields( array $fields ) { |
259 | 263 | if ( $this->item !== false ) { |
— | — | @@ -341,19 +345,20 @@ |
342 | 346 | foreach ( $unknownValues as $name => $value ) { |
343 | 347 | $this->handleUnknownField( $item, $name, $value ); |
344 | 348 | } |
345 | | - |
| 349 | + |
346 | 350 | $success = $item->writeToDB(); |
347 | 351 | |
348 | 352 | if ( $success ) { |
349 | 353 | return true; |
350 | 354 | } |
351 | 355 | else { |
| 356 | + die('meh'); |
352 | 357 | return array(); // TODO |
353 | 358 | } |
354 | 359 | } |
355 | 360 | |
356 | 361 | /** |
357 | | - * Gets called for evey unknown submitted value, so they can be dealth with if needed. |
| 362 | + * Gets called for evey unknown submitted value, so they can be dealt with if needed. |
358 | 363 | * |
359 | 364 | * @since 0.1 |
360 | 365 | * |
Index: trunk/extensions/EducationProgram/includes/EPTerm.php |
— | — | @@ -73,9 +73,8 @@ |
74 | 74 | if ( !$this->hasField( 'org_id' ) ) { |
75 | 75 | $this->setField( 'org_id', $this->getCourse( 'org_id' )->getField( 'org_id' ) ); |
76 | 76 | } |
77 | | - |
78 | | - |
79 | | - parent::insertIntoDB(); |
| 77 | + |
| 78 | + return parent::insertIntoDB(); |
80 | 79 | } |
81 | 80 | |
82 | 81 | /** |
Index: trunk/extensions/EducationProgram/resources/ep.pager.js |
— | — | @@ -53,11 +53,13 @@ |
54 | 54 | } ); |
55 | 55 | |
56 | 56 | $( '.ep-pager-delete-selected' ).click( function() { |
57 | | - var selectAllCheckbox = $( '#ep-pager-select-all-' + $( this ).attr( 'data-pager-id' ) ); |
| 57 | + var $deleteButton = $( this ); |
| 58 | + var $selectAllCheckbox = $( '#ep-pager-select-all-' + $( this ).attr( 'data-pager-id' ) ); |
| 59 | + var $table = $selectAllCheckbox.closest( 'table' ); |
58 | 60 | |
59 | 61 | var ids = []; |
60 | 62 | |
61 | | - selectAllCheckbox.closest( 'table' ).find( 'input[type=checkbox]:checked' ).each( function( i, element ) { |
| 63 | + $table.find( 'input[type=checkbox]:checked' ).each( function( i, element ) { |
62 | 64 | ids.push( $( element ).val() ); |
63 | 65 | } ); |
64 | 66 | |
— | — | @@ -74,13 +76,19 @@ |
75 | 77 | }, |
76 | 78 | function( result ) { |
77 | 79 | if ( result.success ) { |
78 | | - for ( i in ids ) { |
79 | | - if ( ids.hasOwnProperty( i ) ) { |
80 | | - console.log('#select-' + pagerId + '-' + ids[i]); |
81 | | - console.log($( '#select-' + pagerId + '-' + ids[i] )); |
82 | | - $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove(); |
83 | | - } |
84 | | - } |
| 80 | + if ( ids.length > 0 && ( $table.find( 'tr' ).length - ids.length > 1 ) ) { |
| 81 | + for ( i in ids ) { |
| 82 | + if ( ids.hasOwnProperty( i ) ) { |
| 83 | + $( '#select-' + pagerId + '-' + ids[i] ).closest( 'tr' ).remove(); |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + else { |
| 88 | + $table.slideUp( 'slow', function() { |
| 89 | + $table.remove(); |
| 90 | + $deleteButton.closest( 'fieldset' ).remove(); |
| 91 | + } ); |
| 92 | + } |
85 | 93 | } |
86 | 94 | else { |
87 | 95 | alert( mw.msg( 'ep-pager-delete-selected-fail' ) ); // TODO |
— | — | @@ -91,4 +99,4 @@ |
92 | 100 | |
93 | 101 | } ); |
94 | 102 | |
95 | | -})( window.jQuery, window.mediaWiki, window.educationProgram ); |
\ No newline at end of file |
| 103 | +})( window.jQuery, window.mediaWiki, window.educationProgram ) |
\ No newline at end of file |