Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -384,6 +384,15 @@ |
385 | 385 | ), |
386 | 386 | ); |
387 | 387 | |
| 388 | +$wgResourceModules['ep.disenroll'] = $moduleTemplate + array( |
| 389 | + 'scripts' => array( |
| 390 | + 'ep.disenroll.js', |
| 391 | + ), |
| 392 | + 'dependencies' => array( |
| 393 | + 'jquery.ui.button', |
| 394 | + ), |
| 395 | +); |
| 396 | + |
388 | 397 | $wgResourceModules['ep.ambprofile'] = $moduleTemplate + array( |
389 | 398 | 'scripts' => array( |
390 | 399 | 'ep.ambprofile.js', |
Index: trunk/extensions/EducationProgram/specials/SpecialDisenroll.php |
— | — | @@ -53,6 +53,7 @@ |
54 | 54 | $this->doDisenroll( $course ); |
55 | 55 | } |
56 | 56 | else { |
| 57 | + $this->getOutput()->setPageTitle( wfMsgExt( 'ep-disenroll-title', 'parsemag', $course->getField( 'mc' ) ) ); |
57 | 58 | $this->showDisenrollForm( $course ); |
58 | 59 | } |
59 | 60 | } |
— | — | @@ -96,7 +97,57 @@ |
97 | 98 | * @param EPCourse $course |
98 | 99 | */ |
99 | 100 | protected function showDisenrollForm( EPCourse $course ) { |
100 | | - // TODO |
| 101 | + $out = $this->getOutput(); |
| 102 | + |
| 103 | + $out->addModules( 'ep.disenroll' ); |
| 104 | + |
| 105 | + $target = $this->getTitle( $this->subPage )->getLocalURL(); |
| 106 | + |
| 107 | + $out->addElement( 'p', array(), wfMsgExt( 'ep-disenroll-text', 'parsemag', $course->getField( 'name' ) ) ); |
| 108 | + |
| 109 | + $out->addHTML( Html::openElement( |
| 110 | + 'form', |
| 111 | + array( |
| 112 | + 'method' => 'post', |
| 113 | + 'action' => $target, |
| 114 | + ) |
| 115 | + ) ); |
| 116 | + |
| 117 | + $out->addHTML( ' ' . Xml::inputLabel( |
| 118 | + wfMsg( 'ep-disenroll-summary' ), |
| 119 | + 'summary', |
| 120 | + 'summary', |
| 121 | + 65, |
| 122 | + false, |
| 123 | + array( |
| 124 | + 'maxlength' => 250, |
| 125 | + 'spellcheck' => true, |
| 126 | + ) |
| 127 | + ) ); |
| 128 | + |
| 129 | + $out->addHTML( '<br />' ); |
| 130 | + |
| 131 | + $out->addElement( |
| 132 | + 'button', |
| 133 | + array( |
| 134 | + 'class' => 'ep-disenroll-cancel', |
| 135 | + ), |
| 136 | + wfMsg( 'ep-disenroll-cancel' ) |
| 137 | + ); |
| 138 | + |
| 139 | + $out->addHTML( Html::input( |
| 140 | + 'disenroll', |
| 141 | + wfMsg( 'ep-disenroll-button' ), |
| 142 | + 'submit', |
| 143 | + array( |
| 144 | + 'class' => 'ep-disenroll', |
| 145 | + 'target-url' => '', // TODO |
| 146 | + ) |
| 147 | + ) ); |
| 148 | + |
| 149 | + $out->addHTML( Html::hidden( 'disenrollToken', $this->getUser()->getEditToken( $target ) ) ); |
| 150 | + |
| 151 | + $out->addHTML( '</form>' ); |
101 | 152 | } |
102 | 153 | |
103 | 154 | /** |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -446,6 +446,11 @@ |
447 | 447 | 'ep-disenroll-invalid-name' => 'There is no course with name "$1".', |
448 | 448 | 'ep-disenroll-course-passed' => 'This course has ended. You can no longer disenroll from it.', |
449 | 449 | 'ep-disenroll-not-enrolled' => 'You are not enrolled in this course, so cannot disenroll from it.', |
| 450 | + 'ep-disenroll-title' => 'Disenroll from course "$1"', |
| 451 | + 'ep-disenroll-text' => 'You are about to disenroll from course "$1". This will remove any articles you are working on for this course from your student profile.', |
| 452 | + 'ep-disenroll-button' => 'Disenroll', |
| 453 | + 'ep-disenroll-summary' => 'Why are you disenrolling?', |
| 454 | + 'ep-disenroll-cancel' => 'Cancel', |
450 | 455 | |
451 | 456 | // Special:MyCourses |
452 | 457 | 'ep-mycourses-enrolled' => 'You have successfully enrolled for $1 at $2.', |
Index: trunk/extensions/EducationProgram/resources/ep.disenroll.js |
— | — | @@ -0,0 +1,23 @@ |
| 2 | +/** |
| 3 | + * JavasSript for the Education Program MediaWiki extension. |
| 4 | + * @see https://www.mediawiki.org/wiki/Extension:Education_Program |
| 5 | + * |
| 6 | + * @licence GNU GPL v3 or later |
| 7 | + * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
| 8 | + */ |
| 9 | + |
| 10 | +(function( $, mw ) { |
| 11 | + |
| 12 | + $( document ).ready( function() { |
| 13 | + |
| 14 | + $( '.ep-disenroll-cancel' ).button(); |
| 15 | + $( '.ep-disenroll' ).button(); |
| 16 | + |
| 17 | + $( '.ep-disenroll-cancel' ).click( function( event ) { |
| 18 | + window.location = $( this ).attr( 'target-url' ); |
| 19 | + event.preventDefault(); |
| 20 | + } ); |
| 21 | + |
| 22 | + } ); |
| 23 | + |
| 24 | +})( window.jQuery, window.mediaWiki ); |
\ No newline at end of file |