r42934 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42933‎ | r42934 | r42935 >
Date:19:34, 31 October 2008
Author:tomasz
Status:old (Comments)
Tags:
Comment:
adding weight options for templates to add
Modified paths:
  • /branches/CentralNotice-SpecialPage-Integration/SpecialNoticeCentral.php (modified) (history)

Diff [purge]

Index: branches/CentralNotice-SpecialPage-Integration/SpecialNoticeCentral.php
@@ -161,7 +161,8 @@
162162 if ( $method == 'addTemplateTo' ) {
163163 $noticeName = $wgRequest->getVal( 'noticeName' );
164164 $templateName = $wgRequest->getVal( 'templateName' );
165 - $this->addTemplateTo( $noticeName, $templateName, 100 );
 165+ $templateWeight = $wgRequest->getVal ( 'weight' );
 166+ $this->addTemplateTo( $noticeName, $templateName, $weight );
166167 $this->listNoticeDetail( $noticeName );
167168 return;
168169 }
@@ -528,8 +529,9 @@
529530 // Handle adding of templates
530531 $templatesToAdd = $wgRequest->getArray( 'addTemplates' );
531532 if ( isset( $templatesToAdd ) ) {
 533+ $weight = $wgRequest->getArray( 'weight' );
532534 foreach ( $templatesToAdd as $template ) {
533 - $this->addTemplateTo( $notice, $template, 0 );
 535+ $this->addTemplateTo( $notice, $template, $weight[$template] );
534536 }
535537 }
536538 }
@@ -541,7 +543,7 @@
542544 */
543545 $this->showAll = 'Y';
544546
545 - if ( isset( $this->showAll )) {
 547+ if ( isset( $this->showAll )) {
546548 $res = $dbr->select( 'cn_notices',
547549 array(
548550 'not_id',
@@ -768,6 +770,7 @@
769771 $htmlOut .= Xml::openElement( 'table', array( 'cellpadding' => 9 ) );
770772
771773 $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-template-name') );
 774+ $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-weight' ) );
772775 $htmlOut .= Xml::element( 'th', null, wfMsg ( 'centralnotice-add' ) );
773776
774777 // Build rows
@@ -785,8 +788,16 @@
786789 );
787790
788791 // 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+ );
789800 $htmlOut .= Xml::tags( 'td', null,
790 - Xml::check( 'addTemplates[]', '', array ( 'value' => $row->tmp_name))
 801+ Xml::check( 'addTemplates[]', '', array ( 'value' => $row->tmp_name))
791802 );
792803 $htmlOut .= Xml::closeElement( 'tr' );
793804 }

Comments

#Comment by Brion VIBBER (talk | contribs)   19:42, 31 October 2008

adding is eating old weights

Status & tagging log