Index: trunk/extensions/EducationProgram/actions/ViewCourseAction.php |
— | — | @@ -27,7 +27,14 @@ |
28 | 28 | |
29 | 29 | if ( $this->getUser()->isAllowed( 'ep-course' ) ) { |
30 | 30 | $out->addWikiMsg( 'ep-course-create', $name ); |
31 | | - EPCourse::displayAddNewRegion( $this->getContext(), array( 'name' => $name ) ); |
| 31 | + |
| 32 | + EPCourse::displayAddNewRegion( |
| 33 | + $this->getContext(), |
| 34 | + array( |
| 35 | + 'name' => $this->getRequest()->getText( 'newname', '' ), |
| 36 | + 'term' => $this->getRequest()->getText( 'newterm', '' ), |
| 37 | + ) |
| 38 | + ); |
32 | 39 | } |
33 | 40 | else { |
34 | 41 | $out->addWikiMsg( 'ep-course-none', $name ); |
Index: trunk/extensions/EducationProgram/actions/EditCourseAction.php |
— | — | @@ -107,7 +107,15 @@ |
108 | 108 | ); |
109 | 109 | |
110 | 110 | $mcs = EPCourse::selectFields( 'mc', array(), array( 'DISTINCT' ) ); |
111 | | - $mcs = array_merge( array( '' => '' ), $mcs ); |
| 111 | + |
| 112 | + if ( $this->getRequest()->getCheck( 'newname' ) ) { |
| 113 | + $newName = $this->getRequest()->getText( 'newname' ); |
| 114 | + $mcs = array_merge( array( $newName => $newName ), $mcs ); |
| 115 | + } |
| 116 | + else { |
| 117 | + $mcs = array_merge( array( '' => '' ), $mcs ); |
| 118 | + } |
| 119 | + |
112 | 120 | $fields['mc'] = array ( |
113 | 121 | 'class' => 'EPHTMLCombobox', |
114 | 122 | 'label-message' => 'ep-course-edit-mc', |
Index: trunk/extensions/EducationProgram/includes/EPOrg.php |
— | — | @@ -216,7 +216,7 @@ |
217 | 217 | 'form', |
218 | 218 | array( |
219 | 219 | 'method' => 'post', |
220 | | - 'action' => self::getTitleFor( 'NAME' )->getLocalURL(), |
| 220 | + 'action' => self::getTitleFor( 'NAME_PLACEHOLDER' )->getLocalURL( array( 'action' => 'edit' ) ), |
221 | 221 | ) |
222 | 222 | ) ); |
223 | 223 | |
Index: trunk/extensions/EducationProgram/includes/EPCourse.php |
— | — | @@ -336,7 +336,7 @@ |
337 | 337 | 'form', |
338 | 338 | array( |
339 | 339 | 'method' => 'post', |
340 | | - 'action' => self::getTitleFor( 'NAME' )->getLocalURL(), |
| 340 | + 'action' => self::getTitleFor( 'NAME_PLACEHOLDER' )->getLocalURL( array( 'action' => 'edit' ) ), |
341 | 341 | ) |
342 | 342 | ) ); |
343 | 343 | |
— | — | @@ -357,9 +357,21 @@ |
358 | 358 | $select->addOptions( EPOrg::getOrgOptions() ); |
359 | 359 | $out->addHTML( $select->getHTML() ); |
360 | 360 | |
361 | | - $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-courses-newname' ), 'newname', 'newname', 20 ) ); |
| 361 | + $out->addHTML( ' ' . Xml::inputLabel( |
| 362 | + wfMsg( 'ep-courses-newname' ), |
| 363 | + 'newname', |
| 364 | + 'newname', |
| 365 | + 20, |
| 366 | + array_key_exists( 'name', $args ) ? $args['name'] : false |
| 367 | + ) ); |
362 | 368 | |
363 | | - $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-courses-newterm' ), 'newterm', 'newterm', 10 ) ); |
| 369 | + $out->addHTML( ' ' . Xml::inputLabel( |
| 370 | + wfMsg( 'ep-courses-newterm' ), |
| 371 | + 'newterm', |
| 372 | + 'newterm', |
| 373 | + 10, |
| 374 | + array_key_exists( 'term', $args ) ? $args['term'] : false |
| 375 | + ) ); |
364 | 376 | |
365 | 377 | $out->addHTML( ' ' . Html::input( |
366 | 378 | 'addnewcourse', |
Index: trunk/extensions/EducationProgram/resources/ep.addcourse.js |
— | — | @@ -11,10 +11,12 @@ |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | 14 | $( '.ep-course-add' ).closest( 'form' ).submit( function() { |
15 | | - var action = $( this ).attr( 'action' ); |
16 | 15 | $( this ).attr( |
17 | 16 | 'action', |
18 | | - action.substring( 0, action.length - 4 ) + $( '#newname' ).val() + ' (' + $( '#newterm' ).val() + ')' |
| 17 | + $( this ).attr( 'action' ).replace( |
| 18 | + 'NAME_PLACEHOLDER', |
| 19 | + $( '#newname' ).val() + ' (' + $( '#newterm' ).val() + ')' |
| 20 | + ) |
19 | 21 | ); |
20 | 22 | } ); |
21 | 23 | |
Index: trunk/extensions/EducationProgram/resources/ep.addorg.js |
— | — | @@ -11,8 +11,7 @@ |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | 14 | $( '.ep-org-add' ).closest( 'form' ).submit( function() { |
15 | | - var action = $( this ).attr( 'action' ); |
16 | | - $( this ).attr( 'action', action.substring( 0, action.length - 4 ) + $( '#newname' ).val() ); |
| 15 | + $( this ).attr( 'action', $( this ).attr( 'action' ).replace( 'NAME_PLACEHOLDER', $( '#newname' ).val() ) ); |
17 | 16 | } ); |
18 | 17 | |
19 | 18 | $( '.ep-org-add' ).removeAttr( 'disabled' ); |