Index: trunk/extensions/EducationProgram/EducationProgram.php |
— | — | @@ -424,6 +424,16 @@ |
425 | 425 | ), |
426 | 426 | ); |
427 | 427 | |
| 428 | +$wgResourceModules['ep.articletable'] = $moduleTemplate + array( |
| 429 | + 'scripts' => array( |
| 430 | + 'ep.articletable.js', |
| 431 | + ), |
| 432 | + 'dependencies' => array( |
| 433 | + 'jquery.ui.button', |
| 434 | + 'jquery.ui.dialog', |
| 435 | + ), |
| 436 | +); |
| 437 | + |
428 | 438 | $wgResourceModules['ep.addorg'] = $moduleTemplate + array( |
429 | 439 | 'scripts' => array( |
430 | 440 | 'ep.addorg.js', |
Index: trunk/extensions/EducationProgram/includes/EPArticleTable.php |
— | — | @@ -45,6 +45,11 @@ |
46 | 46 | // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
47 | 47 | parent::__construct( $context, $conds, EPStudents::singleton() ); |
48 | 48 | } |
| 49 | + |
| 50 | + public function getBody() { |
| 51 | + $this->getOutput()->addModules( 'ep.articletable' ); |
| 52 | + return parent::getBody(); |
| 53 | + } |
49 | 54 | |
50 | 55 | /** |
51 | 56 | * (non-PHPdoc) |
— | — | @@ -108,6 +113,23 @@ |
109 | 114 | |
110 | 115 | $html .= $this->getUserCell( $student->getField( 'user_id' ), $rowCount ); |
111 | 116 | |
| 117 | + $this->addNonStudentHTML( $html, $articles, $showArticleAdittion ); |
| 118 | + |
| 119 | + $html .= '</tr>'; |
| 120 | + |
| 121 | + return $html; |
| 122 | + } |
| 123 | + |
| 124 | + /** |
| 125 | + * Adds the HTML for the article and reviewers to the table row. |
| 126 | + * |
| 127 | + * @since 0.1 |
| 128 | + * |
| 129 | + * @param string $html |
| 130 | + * @param array $articles |
| 131 | + * @param boolean $showArticleAdittion |
| 132 | + */ |
| 133 | + protected function addNonStudentHTML( &$html, array $articles, $showArticleAdittion ) { |
112 | 134 | $isFirst = true; |
113 | 135 | |
114 | 136 | foreach ( $articles as /* EPArticle */ $article ) { |
— | — | @@ -121,7 +143,7 @@ |
122 | 144 | |
123 | 145 | $articleRowCount = count( $reviewers ); |
124 | 146 | |
125 | | - if ( $article->canBecomeReviewer( $user ) ) { |
| 147 | + if ( $article->canBecomeReviewer( $this->getUser() ) ) { |
126 | 148 | $articleRowCount++; |
127 | 149 | } |
128 | 150 | |
— | — | @@ -137,7 +159,7 @@ |
138 | 160 | $html .= $this->getReviewerCell( $article, $userId ); |
139 | 161 | } |
140 | 162 | |
141 | | - if ( $article->canBecomeReviewer( $user ) ) { |
| 163 | + if ( $article->canBecomeReviewer( $this->getUser() ) ) { |
142 | 164 | if ( count( $reviewers ) !== 0 ) { |
143 | 165 | $html .= '</tr><tr>'; |
144 | 166 | } |
— | — | @@ -152,11 +174,7 @@ |
153 | 175 | } |
154 | 176 | |
155 | 177 | $html .= $this->getArticleAdittionControl( $this->articleConds['course_id'] ); |
156 | | - } |
157 | | - |
158 | | - $html .= '</tr>'; |
159 | | - |
160 | | - return $html; |
| 178 | + } |
161 | 179 | } |
162 | 180 | |
163 | 181 | /** |
— | — | @@ -304,6 +322,15 @@ |
305 | 323 | ); |
306 | 324 | } |
307 | 325 | |
| 326 | + /** |
| 327 | + * Returns the HTML for the article adittion control. |
| 328 | + * |
| 329 | + * @since 0.1 |
| 330 | + * |
| 331 | + * @param integer $courseId |
| 332 | + * |
| 333 | + * @return string |
| 334 | + */ |
308 | 335 | protected function getArticleAdittionControl( $courseId ) { |
309 | 336 | $html = ''; |
310 | 337 | |
— | — | @@ -337,12 +364,21 @@ |
338 | 365 | return '<td colspan="2">' . $html . '</td>'; |
339 | 366 | } |
340 | 367 | |
| 368 | + /** |
| 369 | + * Returns the HTML for the reviewer adittion control. |
| 370 | + * |
| 371 | + * @since 0.1 |
| 372 | + * |
| 373 | + * @param EPArticle $article |
| 374 | + * |
| 375 | + * @return string |
| 376 | + */ |
341 | 377 | protected function getReviewerAdittionControl( EPArticle $article ) { |
342 | 378 | $html = Html::element( |
343 | 379 | 'button', |
344 | 380 | array( |
345 | 381 | 'class' => 'ep-become-reviewer', |
346 | | - //'disabled' => 'disabled', |
| 382 | + 'disabled' => 'disabled', |
347 | 383 | 'data-article-id' => $article->getId(), |
348 | 384 | ), |
349 | 385 | wfMsg( 'ep-artciles-becomereviewer' ) |
Index: trunk/extensions/EducationProgram/resources/ep.articletable.js |
— | — | @@ -0,0 +1,62 @@ |
| 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( $, ep ) { |
| 11 | + |
| 12 | + function addReviewer() { |
| 13 | + $dialog = $( '<div>' ).html( '' ).dialog( { |
| 14 | + 'title': ep.msg( 'ep-articletable-addreviwer-title' ), |
| 15 | + 'minWidth': 550, |
| 16 | + 'buttons': [ |
| 17 | + { |
| 18 | + 'text': ep.msg( 'ep-articletable-addreviwer-button' ), |
| 19 | + 'id': 'ep-addreviwer-button', |
| 20 | + 'click': function() { |
| 21 | + alert( 'submit' ); |
| 22 | + // TODO |
| 23 | + } |
| 24 | + }, |
| 25 | + { |
| 26 | + 'text': ep.msg( 'ep-articletable-addreviwer-cancel' ), |
| 27 | + 'id': 'ep-addreviwer-cancel', |
| 28 | + 'click': function() { |
| 29 | + $dialog.dialog( 'close' ); |
| 30 | + } |
| 31 | + } |
| 32 | + ] |
| 33 | + } ); |
| 34 | + } |
| 35 | + |
| 36 | + function addArticle() { |
| 37 | + // TODO |
| 38 | + } |
| 39 | + |
| 40 | + function removeStudent() { |
| 41 | + // TODO |
| 42 | + } |
| 43 | + |
| 44 | + function removeArticle() { |
| 45 | + // TODO |
| 46 | + } |
| 47 | + |
| 48 | + function removeReviewer() { |
| 49 | + // TODO |
| 50 | + } |
| 51 | + |
| 52 | + $( document ).ready( function() { |
| 53 | + |
| 54 | + $( '.ep-rem-reviewer-self, .ep-become-reviewer' ).removeAttr( 'disabled' ); |
| 55 | + |
| 56 | + $( '.ep-become-reviewer' ).click( addReviewer ); |
| 57 | + |
| 58 | + $( '.ep-rem-reviewer-self' ).click( removeReviewer ); |
| 59 | + |
| 60 | + // TODO |
| 61 | + } ); |
| 62 | + |
| 63 | +})( window.jQuery, mw.educationProgram ); |
\ No newline at end of file |
Property changes on: trunk/extensions/EducationProgram/resources/ep.articletable.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 64 | + native |
Index: trunk/extensions/EducationProgram/resources/ep.disenroll.js |
— | — | @@ -10,8 +10,7 @@ |
11 | 11 | |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | | - $( '.ep-disenroll-cancel' ).button(); |
15 | | - $( '.ep-disenroll' ).button(); |
| 14 | + $( '.ep-disenroll-cancel, .ep-disenroll' ).button(); |
16 | 15 | |
17 | 16 | $( '.ep-disenroll-cancel' ).click( function( event ) { |
18 | 17 | window.location = $( this ).attr( 'target-url' ); |
Index: trunk/extensions/EducationProgram/resources/ep.formpage.js |
— | — | @@ -17,8 +17,6 @@ |
18 | 18 | event.preventDefault(); |
19 | 19 | } ); |
20 | 20 | |
21 | | - //$( 'textarea.wiki-editor-input' ).attr( 'class', 'wiki-editor' ).wikiEditor( 'addModule', $.wikiEditor.modules.toolbar.config.getDefaultConfig() ); |
22 | | - |
23 | 21 | } ); |
24 | 22 | |
25 | 23 | })( window.jQuery, window.mediaWiki ); |
\ No newline at end of file |