r71830 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r71829‎ | r71830 | r71831 >
Date:00:29, 28 August 2010
Author:kaldari
Status:ok
Tags:
Comment:
moving weight setting to listNoticeDetail(), removing use of isset()
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialCentralNotice.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialCentralNotice.php
@@ -198,14 +198,6 @@
199199 $this->addNotice( $noticeName, '0', $start, $project_name, $project_languages );
200200 }
201201 }
202 -
203 - // Handle weight change
204 - $updatedWeights = $wgRequest->getArray( 'weight' );
205 - if ( isset( $updatedWeights ) ) {
206 - foreach ( $updatedWeights as $templateId => $weight ) {
207 - $this->updateWeight( $noticeName, $templateId, $weight );
208 - }
209 - }
210202
211203 } else {
212204 $wgOut->wrapWikiMsg( "<div class='cn-error'>\n$1\n</div>", 'sessionfailure' );
@@ -589,7 +581,7 @@
590582
591583 // Handle adding of banners to the campaign
592584 $templatesToAdd = $wgRequest->getArray( 'addTemplates' );
593 - if ( isset( $templatesToAdd ) ) {
 585+ if ( $templatesToAdd ) {
594586 $weight = $wgRequest->getArray( 'weight' );
595587 foreach ( $templatesToAdd as $templateName ) {
596588 $templateId = $this->getTemplateId( $templateName );
@@ -599,21 +591,29 @@
600592
601593 // Handle removing of banners from the campaign
602594 $templateToRemove = $wgRequest->getArray( 'removeTemplates' );
603 - if ( isset( $templateToRemove ) ) {
 595+ if ( $templateToRemove ) {
604596 foreach ( $templateToRemove as $template ) {
605597 $this->removeTemplateFor( $notice, $template );
606598 }
607599 }
 600+
 601+ // Handle weight changes
 602+ $updatedWeights = $wgRequest->getArray( 'weight' );
 603+ if ( $updatedWeights ) {
 604+ foreach ( $updatedWeights as $templateId => $weight ) {
 605+ $this->updateWeight( $notice, $templateId, $weight );
 606+ }
 607+ }
608608
609609 // Handle new project name
610610 $projectName = $wgRequest->getVal( 'project_name' );
611 - if ( isset( $projectName ) ) {
 611+ if ( $projectName ) {
612612 $this->updateProjectName ( $notice, $projectName );
613613 }
614614
615615 // Handle new project languages
616616 $projectLangs = $wgRequest->getArray( 'project_languages' );
617 - if ( isset( $projectLangs ) ) {
 617+ if ( $projectLangs ) {
618618 $this->updateProjectLanguages( $notice, $projectLangs );
619619 }
620620

Status & tagging log