r107670 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107669‎ | r107670 | r107671 >
Date:23:26, 30 December 2011
Author:jeroendedauw
Status:deferred (Comments)
Tags:educationprogram 
Comment:
work on student workflow
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.pager.js (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialEPFormPage.php
@@ -61,6 +61,8 @@
6262 * @see SpecialPage::getDescription
6363 *
6464 * @since 0.1
 65+ *
 66+ * @return string
6567 */
6668 public function getDescription() {
6769 $action = $this->isNew() ? 'add' : 'edit';
@@ -253,6 +255,8 @@
254256 * @since 0.1
255257 *
256258 * @param array $fields
 259+ *
 260+ * @return array
257261 */
258262 protected function processFormFields( array $fields ) {
259263 if ( $this->item !== false ) {
@@ -341,19 +345,20 @@
342346 foreach ( $unknownValues as $name => $value ) {
343347 $this->handleUnknownField( $item, $name, $value );
344348 }
345 -
 349+
346350 $success = $item->writeToDB();
347351
348352 if ( $success ) {
349353 return true;
350354 }
351355 else {
 356+ die('meh');
352357 return array(); // TODO
353358 }
354359 }
355360
356361 /**
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.
358363 *
359364 * @since 0.1
360365 *
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -73,9 +73,8 @@
7474 if ( !$this->hasField( 'org_id' ) ) {
7575 $this->setField( 'org_id', $this->getCourse( 'org_id' )->getField( 'org_id' ) );
7676 }
77 -
78 -
79 - parent::insertIntoDB();
 77+
 78+ return parent::insertIntoDB();
8079 }
8180
8281 /**
Index: trunk/extensions/EducationProgram/resources/ep.pager.js
@@ -53,11 +53,13 @@
5454 } );
5555
5656 $( '.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' );
5860
5961 var ids = [];
6062
61 - selectAllCheckbox.closest( 'table' ).find( 'input[type=checkbox]:checked' ).each( function( i, element ) {
 63+ $table.find( 'input[type=checkbox]:checked' ).each( function( i, element ) {
6264 ids.push( $( element ).val() );
6365 } );
6466
@@ -74,13 +76,19 @@
7577 },
7678 function( result ) {
7779 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+ }
8593 }
8694 else {
8795 alert( mw.msg( 'ep-pager-delete-selected-fail' ) ); // TODO
@@ -91,4 +99,4 @@
92100
93101 } );
94102
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

Follow-up revisions

RevisionCommit summaryAuthorDate
r107727Follow up to r107670; mehjeroendedauw17:56, 31 December 2011

Comments

#Comment by Nikerabbit (talk | contribs)   09:36, 31 December 2011

meh

Status & tagging log