r92969 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92968‎ | r92969 | r92970 >
Date:22:11, 23 July 2011
Author:jeroendedauw
Status:ok (Comments)
Tags:
Comment:
merge the campaign uptions in with the other config
Modified paths:
  • /trunk/extensions/UploadWizard/SpecialUploadWizard.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizardCampaign.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizardCampaign.php
@@ -215,11 +215,12 @@
216216 * @return array
217217 */
218218 public function getAllConfig() {
219 - $config = $this->getConfig();
 219+ $setConfig = $this->getConfig();
 220+ $config = array();
220221
221222 foreach ( self::getDefaultConfig() as $name => $data ) {
222 - if ( array_key_exists( $name, $config ) ) {
223 - $data['default'] = $config[$name];
 223+ if ( array_key_exists( $name, $setConfig ) ) {
 224+ $data['default'] = $setConfig[$name];
224225 }
225226
226227 $config[$name] = $data;
@@ -236,8 +237,8 @@
237238 * @return array
238239 */
239240 public static function getDefaultConfig() {
240 - return array (
241 - 'skiptutorial' => array ( 'type' => 'check', 'default' => true )
 241+ return array ( // TODO
 242+ 'skipTutorial' => array ( 'type' => 'check', 'default' => true )
242243 );
243244 }
244245
Index: trunk/extensions/UploadWizard/SpecialUploadWizard.php
@@ -56,7 +56,7 @@
5757
5858 // fallback for non-JS
5959 $wgOut->addHTML( '<noscript>' );
60 - $wgOut->addHTML( '<p class="errorbox">' . wfMsg( 'mwe-upwiz-js-off' ) . '</p>' );
 60+ $wgOut->addHTML( '<p class="errorbox">' . htmlspecialchars( wfMsg( 'mwe-upwiz-js-off' ) ) . '</p>' );
6161 $this->simpleForm->show();
6262 $wgOut->addHTML( '</noscript>' );
6363
@@ -95,12 +95,23 @@
9696 * @param subpage, e.g. the "foo" in Special:UploadWizard/foo
9797 */
9898 public function addJsVars( $subPage ) {
99 - global $wgOut, $wgUpwizDir, $wgUploadWizardConfig, $wgSitename;
 99+ global $wgOut, $wgUpwizDir, $wgUploadWizardConfig, $wgSitename, $wgRequest;
100100
 101+ $capmaignSettings = array();
 102+ $capaignName = $wgRequest->getVal( 'campaign' );
 103+
 104+ if ( !is_null( $capaignName ) ) {
 105+ $capaign = UploadWizardCampaign::newFromName( $capaignName );
 106+
 107+ if ( $capaign !== false ) {
 108+ $capmaignSettings = $capaign->getConfig();
 109+ }
 110+ }
 111+
101112 // Merge the default configuration with the local settings $wgUploadWizardConfig configuration
102113 $configPath = $wgUpwizDir . '/UploadWizard.config.php';
103114 if( is_file( $configPath ) ){
104 - $wgUploadWizardConfig = array_merge( include( $configPath ), $wgUploadWizardConfig );
 115+ $wgUploadWizardConfig = array_merge( include( $configPath ), $wgUploadWizardConfig, $capmaignSettings );
105116 }
106117
107118 $wgOut->addScript(
Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -286,9 +286,4 @@
287287 // URL for alternative uploading form
288288 'altUploadForm' => '',
289289
290 - 'campaignDefaults' => array(
291 - 'skiptutorial' => false,
292 -
293 - ),
294 -
295290 );
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -295,7 +295,7 @@
296296 'uploadcampaign-text' => 'You are modifying an Upload Wizard campaign.',
297297 'mwe-upwiz-campaign-name' => 'Campaign name',
298298 'mwe-upwiz-campaign-enabled' => 'Campaign enabled',
299 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Skip the licensing tutorial',
 299+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Skip the licensing tutorial',
300300 );
301301
302302 /** Message documentation (Message documentation)
@@ -3228,7 +3228,7 @@
32293229 'uploadcampaign-text' => 'Du modifizierst gerade eine Kampagne.',
32303230 'mwe-upwiz-campaign-name' => 'Name der Kampagne',
32313231 'mwe-upwiz-campaign-enabled' => 'Kampagne aktiviert',
3232 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Das Tutorium zur Lizenzierung überspringen',
 3232+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Das Tutorium zur Lizenzierung überspringen',
32333233 );
32343234
32353235 /** German (formal address) (‪Deutsch (Sie-Form)‬)
@@ -5449,7 +5449,7 @@
54505450 'uploadcampaign-text' => 'אתם משנים מבצע פרסום של אשף ההעלאות.',
54515451 'mwe-upwiz-campaign-name' => 'שם מבצע הפרסום',
54525452 'mwe-upwiz-campaign-enabled' => 'מבצע הפרסום הופעל',
5453 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'לדלג על דף ההסברים על רישיונות',
 5453+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'לדלג על דף ההסברים על רישיונות',
54545454 );
54555455
54565456 /** Hindi (हिन्दी)
@@ -6501,7 +6501,7 @@
65026502 'uploadcampaign-text' => 'Tu modifica ora un campania del Assistente de Incargamento.',
65036503 'mwe-upwiz-campaign-name' => 'Nomine del campania',
65046504 'mwe-upwiz-campaign-enabled' => 'Campania activate',
6505 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Saltar le tutorial de licentiamento',
 6505+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Saltar le tutorial de licentiamento',
65066506 );
65076507
65086508 /** Indonesian (Bahasa Indonesia)
@@ -8391,7 +8391,7 @@
83928392 'uploadcampaign-text' => 'Менувате кампања на Помошникот за подигање.',
83938393 'mwe-upwiz-campaign-name' => 'Име на кампањата',
83948394 'mwe-upwiz-campaign-enabled' => 'Кампањата е овозможена',
8395 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Прескокни го објаснувањето за лиценцирање',
 8395+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Прескокни го објаснувањето за лиценцирање',
83968396 );
83978397
83988398 /** Malayalam (മലയാളം)
@@ -8660,7 +8660,7 @@
86618661 'uploadcampaign-text' => 'താങ്കൾ അപ്‌ലോഡ് സഹായി മേള പുതുക്കിക്കൊണ്ടിരിക്കുകയാണ്.',
86628662 'mwe-upwiz-campaign-name' => 'മേളയുടെ പേര്',
86638663 'mwe-upwiz-campaign-enabled' => 'മേള സജ്ജമാക്കിയിരിക്കുന്നു',
8664 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'അനുമതി നൽകൽ പഠനസഹായി വേണ്ട',
 8664+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'അനുമതി നൽകൽ പഠനസഹായി വേണ്ട',
86658665 );
86668666
86678667 /** Mongolian (Монгол)
@@ -8938,7 +8938,7 @@
89398939 'uploadcampaign-text' => 'Anda sedang mengubah suai kempen Alat Muat Naik Ajaib.',
89408940 'mwe-upwiz-campaign-name' => 'Nama kempen',
89418941 'mwe-upwiz-campaign-enabled' => 'Kempen dihidupkan',
8942 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Langkau tutorial pelesenan',
 8942+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Langkau tutorial pelesenan',
89438943 );
89448944
89458945 /** Burmese (မြန်မာဘာသာ)
@@ -10385,7 +10385,7 @@
1038610386 'uploadcampaign-text' => 'Está a modificar uma campanha do Assistente de Envio de Ficheiros.',
1038710387 'mwe-upwiz-campaign-name' => 'Nome da campanha',
1038810388 'mwe-upwiz-campaign-enabled' => 'Campanha activada',
10389 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Saltar o guia prático de licenciamento',
 10389+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Saltar o guia prático de licenciamento',
1039010390 );
1039110391
1039210392 /** Brazilian Portuguese (Português do Brasil)
@@ -11648,7 +11648,7 @@
1164911649 'uploadcampaign-text' => 'Spreminjate kampanjo čarovnika nalaganja',
1165011650 'mwe-upwiz-campaign-name' => 'Ime kampanje',
1165111651 'mwe-upwiz-campaign-enabled' => 'Kampanja je omogočena',
11652 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Preskoči vodnik po licenciranju',
 11652+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Preskoči vodnik po licenciranju',
1165311653 );
1165411654
1165511655 /** Somali (Soomaaliga)
@@ -13134,7 +13134,7 @@
1313513135 'uploadcampaign-text' => 'Bạn đang sửa đổi một thông báo chung cho Trình thuật sĩ tải lên.',
1313613136 'mwe-upwiz-campaign-name' => 'Tên thông báo chung',
1313713137 'mwe-upwiz-campaign-enabled' => 'Thông báo chung được kích hoạt',
13138 - 'mwe-upwiz-campaign-conf-skiptutorial' => 'Bỏ qua hướng dẫn giấy phép',
 13138+ 'mwe-upwiz-campaign-conf-skipTutorial' => 'Bỏ qua hướng dẫn giấy phép',
1313913139 );
1314013140
1314113141 /** Wu (吴语) */

Follow-up revisions

RevisionCommit summaryAuthorDate
r93011fu r92969 r92970 - work on campaign configjeroendedauw20:11, 24 July 2011

Comments

#Comment by NeilK (talk | contribs)   13:03, 22 August 2011

$capmaignSettings $capaignName

This is why IDEs are evil :)

Anyway these were fixed in subsequent revisions

Status & tagging log