Index: trunk/extensions/EducationProgram/actions/EPAddArticleAction.php |
— | — | @@ -57,7 +57,17 @@ |
58 | 58 | } |
59 | 59 | } |
60 | 60 | |
61 | | - $this->getOutput()->redirect( $this->getTitle()->getLocalURL() ); |
| 61 | + $returnTo = null; |
| 62 | + |
| 63 | + if ( $req->getCheck( 'returnto' ) ) { |
| 64 | + $returnTo = Title::newFromText( $req->getText( 'returnto' ) ); |
| 65 | + } |
| 66 | + |
| 67 | + if ( is_null( $returnTo ) ) { |
| 68 | + $returnTo = $this->getTitle()->getLocalURL(); |
| 69 | + } |
| 70 | + |
| 71 | + $this->getOutput()->redirect( $returnTo->getLocalURL() ); |
62 | 72 | return ''; |
63 | 73 | } |
64 | 74 | |
Index: trunk/extensions/EducationProgram/specials/SpecialMyCourses.php |
— | — | @@ -221,7 +221,36 @@ |
222 | 222 | |
223 | 223 | $out->addElement( 'h2', array(), wfMsg( 'ep-mycourses-course-enrollment' ) ); |
224 | 224 | |
225 | | - $out->addHTML( $this->msg( 'ep-mycourses-enrolledin', Message::rawParam( $course->getLink() ) )->text() ); |
| 225 | + $out->addHTML( $this->msg( |
| 226 | + 'ep-mycourses-enrolledin', |
| 227 | + array( |
| 228 | + Message::rawParam( $course->getLink() ), |
| 229 | + Message::rawParam( $course->getOrg()->getLink() ) |
| 230 | + ) |
| 231 | + )->text() ); |
| 232 | + |
| 233 | + $out->addWikiMsg( 'ep-mycourses-articletable' ); |
| 234 | + |
| 235 | + $pager = new EPArticleTable( |
| 236 | + $this->getContext(), |
| 237 | + array( 'id' => $this->getUser()->getId() ), |
| 238 | + array( |
| 239 | + 'course_id' => $course->getId(), |
| 240 | + 'user_id' => $this->getUser()->getId(), |
| 241 | + ) |
| 242 | + ); |
| 243 | + |
| 244 | + $pager->setShowStudents( false ); |
| 245 | + |
| 246 | + if ( $pager->getNumRows() ) { |
| 247 | + $out->addHTML( |
| 248 | + $pager->getFilterControl() . |
| 249 | + $pager->getNavigationBar() . |
| 250 | + $pager->getBody() . |
| 251 | + $pager->getNavigationBar() . |
| 252 | + $pager->getMultipleItemControl() |
| 253 | + ); |
| 254 | + } |
226 | 255 | } |
227 | 256 | |
228 | 257 | } |
Index: trunk/extensions/EducationProgram/includes/EPArticleTable.php |
— | — | @@ -40,6 +40,14 @@ |
41 | 41 | protected $courseName = false; |
42 | 42 | |
43 | 43 | /** |
| 44 | + * Show the students column or not. |
| 45 | + * |
| 46 | + * @since 0.1 |
| 47 | + * @var boolean |
| 48 | + */ |
| 49 | + protected $showStudents = true; |
| 50 | + |
| 51 | + /** |
44 | 52 | * Constructor. |
45 | 53 | * |
46 | 54 | * @param IContextSource $context |
— | — | @@ -53,6 +61,17 @@ |
54 | 62 | // when MW 1.19 becomes min, we want to pass an IContextSource $context here. |
55 | 63 | parent::__construct( $context, $conds, EPStudents::singleton() ); |
56 | 64 | } |
| 65 | + |
| 66 | + /** |
| 67 | + * Set if the student column should be shown or not. |
| 68 | + * |
| 69 | + * @since 0.1 |
| 70 | + * |
| 71 | + * @param boolean $showStudents |
| 72 | + */ |
| 73 | + public function setShowStudents( $showStudents ) { |
| 74 | + $this->showStudents = $showStudents; |
| 75 | + } |
57 | 76 | |
58 | 77 | public function getBody() { |
59 | 78 | $this->getOutput()->addModules( 'ep.articletable' ); |
— | — | @@ -64,10 +83,13 @@ |
65 | 84 | * @see EPPager::getFields() |
66 | 85 | */ |
67 | 86 | public function getFields() { |
68 | | - return array( |
69 | | - 'id', |
70 | | - 'user_id', |
71 | | - ); |
| 87 | + $fields = array( 'id' ); |
| 88 | + |
| 89 | + if ( $this->showStudents ) { |
| 90 | + $fields[] = 'user_id'; |
| 91 | + } |
| 92 | + |
| 93 | + return $fields; |
72 | 94 | } |
73 | 95 | |
74 | 96 | /** |
— | — | @@ -113,7 +135,9 @@ |
114 | 136 | $rowCount++; |
115 | 137 | } |
116 | 138 | |
117 | | - $html .= $this->getUserCell( $student->getField( 'user_id' ), max( 1, $rowCount ) ); |
| 139 | + if ( $this->showStudents ) { |
| 140 | + $html .= $this->getUserCell( $student->getField( 'user_id' ), max( 1, $rowCount ) ); |
| 141 | + } |
118 | 142 | |
119 | 143 | $this->addNonStudentHTML( $html, $articles, $showArticleAdittion ); |
120 | 144 | |
— | — | @@ -377,11 +401,18 @@ |
378 | 402 | protected function getArticleAdittionControl( $courseId ) { |
379 | 403 | $html = ''; |
380 | 404 | |
| 405 | + $courseName = EPCourses::singleton()->selectFieldsRow( 'name', array( 'id' => $courseId ) ); |
| 406 | + $query = array( 'action' => 'epaddarticle' ); |
| 407 | + |
| 408 | + if ( $this->getTitle()->getNamespace() !== EP_NS_COURSE ) { |
| 409 | + $query['returnto'] = $this->getTitle()->getFullText(); |
| 410 | + } |
| 411 | + |
381 | 412 | $html .= Html::openElement( |
382 | 413 | 'form', |
383 | 414 | array( |
384 | 415 | 'method' => 'post', |
385 | | - 'action' => $this->getTitle()->getLocalURL( array( 'action' => 'epaddarticle' ) ), |
| 416 | + 'action' => EPCourses::getTitleFor( $courseName )->getLocalURL( $query ), |
386 | 417 | ) |
387 | 418 | ); |
388 | 419 | |
— | — | @@ -466,7 +497,10 @@ |
467 | 498 | |
468 | 499 | unset( $fields['id'] ); |
469 | 500 | |
470 | | - $fields['user_id'] = 'student'; |
| 501 | + if ( $this->showStudents ) { |
| 502 | + $fields['user_id'] = 'student'; |
| 503 | + } |
| 504 | + |
471 | 505 | $fields['_articles'] = 'articles'; |
472 | 506 | $fields['_reviewers'] = 'reviewers'; |
473 | 507 | |
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php |
— | — | @@ -534,7 +534,8 @@ |
535 | 535 | 'ep-mycourses-nocourses-epca' => 'There are no courses you are Campus Ambassador for yet.', |
536 | 536 | 'ep-mycourses-nocourses-epoa' => 'There are no courses you are Online Ambassador for yet.', |
537 | 537 | 'ep-mycourses-nocourses-epinstructor' => 'There are no courses you are Instructor for yet.', |
538 | | - 'ep-mycourses-enrolledin' => 'You are currently enrolled in $1.', |
| 538 | + 'ep-mycourses-enrolledin' => 'You are currently enrolled in course $1 at institution $2.', |
| 539 | + 'ep-mycourses-articletable' => 'These are the articles you are working on and their reviewers:', |
539 | 540 | |
540 | 541 | // ep.enlist instructor |
541 | 542 | 'ep-instructor-remove-title' => 'Remove instructor from course', |