Index: branches/CentralNotice-SpecialPage-Integration/SpecialNoticeCentral.php |
— | — | @@ -161,7 +161,8 @@ |
162 | 162 | if ( $method == 'addTemplateTo' ) { |
163 | 163 | $noticeName = $wgRequest->getVal( 'noticeName' ); |
164 | 164 | $templateName = $wgRequest->getVal( 'templateName' ); |
165 | | - $this->addTemplateTo( $noticeName, $templateName, 100 ); |
| 165 | + $templateWeight = $wgRequest->getVal ( 'weight' ); |
| 166 | + $this->addTemplateTo( $noticeName, $templateName, $weight ); |
166 | 167 | $this->listNoticeDetail( $noticeName ); |
167 | 168 | return; |
168 | 169 | } |
— | — | @@ -528,8 +529,9 @@ |
529 | 530 | // Handle adding of templates |
530 | 531 | $templatesToAdd = $wgRequest->getArray( 'addTemplates' ); |
531 | 532 | if ( isset( $templatesToAdd ) ) { |
| 533 | + $weight = $wgRequest->getArray( 'weight' ); |
532 | 534 | foreach ( $templatesToAdd as $template ) { |
533 | | - $this->addTemplateTo( $notice, $template, 0 ); |
| 535 | + $this->addTemplateTo( $notice, $template, $weight[$template] ); |
534 | 536 | } |
535 | 537 | } |
536 | 538 | } |
— | — | @@ -541,7 +543,7 @@ |
542 | 544 | */ |
543 | 545 | $this->showAll = 'Y'; |
544 | 546 | |
545 | | - if ( isset( $this->showAll )) { |
| 547 | + if ( isset( $this->showAll )) { |
546 | 548 | $res = $dbr->select( 'cn_notices', |
547 | 549 | array( |
548 | 550 | 'not_id', |
— | — | @@ -768,6 +770,7 @@ |
769 | 771 | $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) ); |
770 | 772 | |
771 | 773 | $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-template-name') ); |
| 774 | + $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-weight' ) ); |
772 | 775 | $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-add' ) ); |
773 | 776 | |
774 | 777 | // Build rows |
— | — | @@ -785,8 +788,16 @@ |
786 | 789 | ); |
787 | 790 | |
788 | 791 | // Add |
| 792 | + $htmlOut .= Xml::tags( 'td', null, |
| 793 | + Xml::listDropDown( "weight[$row->tmp_name]", |
| 794 | + $this->dropDownList( wfMsg( 'centralnotice-weight' ), range ( 0, 100, 5)), |
| 795 | + '', |
| 796 | + 0, |
| 797 | + '', |
| 798 | + 16) |
| 799 | + ); |
789 | 800 | $htmlOut .= Xml::tags( 'td', null, |
790 | | - Xml::check( 'addTemplates[]', '', array ( 'value' => $row->tmp_name)) |
| 801 | + Xml::check( 'addTemplates[]', '', array ( 'value' => $row->tmp_name)) |
791 | 802 | ); |
792 | 803 | $htmlOut .= Xml::closeElement( 'tr' ); |
793 | 804 | } |