r111576 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r111575‎ | r111576 | r111577 >
Date:20:27, 15 February 2012
Author:jeroendedauw
Status:deferred (Comments)
Tags:
Comment:
work on disenroll page
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.disenroll.js (added) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialDisenroll.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -384,6 +384,15 @@
385385 ),
386386 );
387387
 388+$wgResourceModules['ep.disenroll'] = $moduleTemplate + array(
 389+ 'scripts' => array(
 390+ 'ep.disenroll.js',
 391+ ),
 392+ 'dependencies' => array(
 393+ 'jquery.ui.button',
 394+ ),
 395+);
 396+
388397 $wgResourceModules['ep.ambprofile'] = $moduleTemplate + array(
389398 'scripts' => array(
390399 'ep.ambprofile.js',
Index: trunk/extensions/EducationProgram/specials/SpecialDisenroll.php
@@ -53,6 +53,7 @@
5454 $this->doDisenroll( $course );
5555 }
5656 else {
 57+ $this->getOutput()->setPageTitle( wfMsgExt( 'ep-disenroll-title', 'parsemag', $course->getField( 'mc' ) ) );
5758 $this->showDisenrollForm( $course );
5859 }
5960 }
@@ -96,7 +97,57 @@
9798 * @param EPCourse $course
9899 */
99100 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>' );
101152 }
102153
103154 /**
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -446,6 +446,11 @@
447447 'ep-disenroll-invalid-name' => 'There is no course with name "$1".',
448448 'ep-disenroll-course-passed' => 'This course has ended. You can no longer disenroll from it.',
449449 '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',
450455
451456 // Special:MyCourses
452457 '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

Follow-up revisions

RevisionCommit summaryAuthorDate
r111656follow up to r111576 - because Nikerabbit was sad :)jeroendedauw17:52, 16 February 2012

Comments

#Comment by Nikerabbit (talk | contribs)   06:46, 16 February 2012

Why not just addWikiMsg?

+$out->addElement( 'p', array(), wfMsgExt( 'ep-disenroll-text', 'parsemag', $course->getField( 'name' ) ) );

Status & tagging log