Index: trunk/extensions/UploadWizard/UploadWizard.config.php |
— | — | @@ -27,6 +27,10 @@ |
28 | 28 | // WikiText to automatically (and silently) add to all uploaded images. |
29 | 29 | 'autoWikiText' => '', |
30 | 30 | |
| 31 | + // Should the own work option be shown, and if not, what option should be set? |
| 32 | + // Possible values: choice, own, notown |
| 33 | + 'ownWorkOption' => 'choice', |
| 34 | + |
31 | 35 | // 'licenses' is a list of licenses you could possibly use elsewhere, for instance in |
32 | 36 | // licensesOwnWork or licensesThirdParty. |
33 | 37 | // It just describes what licenses go with what wikitext, and how to display them in |
Index: trunk/extensions/UploadWizard/includes/UploadWizardConfig.php |
— | — | @@ -103,7 +103,7 @@ |
104 | 104 | $capaign = UploadWizardCampaign::newFromName( $campaignName ); |
105 | 105 | |
106 | 106 | if ( $capaign !== false && $capaign->getIsEnabled() ) { |
107 | | - return $capaign->getConfig(); |
| 107 | + return $capaign->getConfigForGlobalMerge(); |
108 | 108 | } |
109 | 109 | |
110 | 110 | return array(); |
Index: trunk/extensions/UploadWizard/includes/specials/SpecialUploadCampaign.php |
— | — | @@ -24,7 +24,7 @@ |
25 | 25 | * @param $request is the request (usually wgRequest) |
26 | 26 | * @param $par is everything in the URL after Special:UploadCampaign. Not sure what we can use it for |
27 | 27 | */ |
28 | | - public function __construct($request = null, $par = null) { |
| 28 | + public function __construct( $request = null, $par = null ) { |
29 | 29 | parent::__construct ( 'UploadCampaign', 'upwizcampaigns', false ); |
30 | 30 | } |
31 | 31 | |
— | — | @@ -75,10 +75,6 @@ |
76 | 76 | } |
77 | 77 | } |
78 | 78 | |
79 | | - if ( $data['type'] == 'textarea' ) { |
80 | | - $data['rows'] = 4; |
81 | | - } |
82 | | - |
83 | 79 | $fields[$name] = $data; |
84 | 80 | } |
85 | 81 | |
Index: trunk/extensions/UploadWizard/includes/UploadWizardCampaign.php |
— | — | @@ -150,12 +150,44 @@ |
151 | 151 | * @return array |
152 | 152 | */ |
153 | 153 | public static function getConfigTypes() { |
154 | | - return array( |
155 | | - 'skipTutorial' => 'check', |
156 | | - 'autoCategories' => 'text', |
157 | | - 'defaultCategories' => 'text', |
158 | | - 'autoWikiText' => 'textarea', |
| 154 | + $config = array( |
| 155 | + 'skipTutorial' => array( |
| 156 | + 'type' => 'check' |
| 157 | + ), |
| 158 | + 'autoCategories' => array( |
| 159 | + 'type' => 'text' |
| 160 | + ), |
| 161 | + 'defaultCategories' => array( |
| 162 | + 'type' => 'text' |
| 163 | + ), |
| 164 | + 'autoWikiText' => array( |
| 165 | + 'type' => 'textarea', |
| 166 | + 'rows' => 4 |
| 167 | + ), |
| 168 | + 'ownWorkOption' => array( |
| 169 | + 'type' => 'radio', |
| 170 | + 'options' => array( |
| 171 | + wfMsg( 'mwe-upwiz-campaign-owner-choice' ) => 'choice', |
| 172 | + wfMsg( 'mwe-upwiz-campaign-owner-own' ) => 'own', |
| 173 | + wfMsg( 'mwe-upwiz-campaign-owner-notown' ) => 'notown' |
| 174 | + ) |
| 175 | + ), |
159 | 176 | ); |
| 177 | + |
| 178 | + $globalConfig = UploadWizardConfig::getConfig(); |
| 179 | + |
| 180 | + $config['licensesOwnWork'] = array( |
| 181 | + 'type' => 'multiselect', |
| 182 | + 'options' => array(), |
| 183 | + 'default' => $globalConfig['licensesOwnWork']['licenses'] |
| 184 | + ); |
| 185 | + |
| 186 | + foreach ( $globalConfig['licensesOwnWork']['licenses'] as $license ) { |
| 187 | + $licenceMsg = wfMsg( $globalConfig['licenses'][$license]['msg'] ); |
| 188 | + $config['licensesOwnWork']['options'][$licenceMsg] = $license; |
| 189 | + } |
| 190 | + |
| 191 | + return $config; |
160 | 192 | } |
161 | 193 | |
162 | 194 | /** |
— | — | @@ -173,9 +205,9 @@ |
174 | 206 | $config = array(); |
175 | 207 | $globalConf = UploadWizardConfig::getConfig(); |
176 | 208 | |
177 | | - foreach ( self::getConfigTypes() as $setting => $type ) { |
| 209 | + foreach ( self::getConfigTypes() as $setting => $data ) { |
178 | 210 | if ( array_key_exists( $setting, $globalConf ) ) { |
179 | | - $config[$setting] = array( 'type' => $type, 'default' => $globalConf[$setting] ); |
| 211 | + $config[$setting] = array_merge( array( 'default' => $globalConf[$setting] ), $data ); |
180 | 212 | } |
181 | 213 | else { |
182 | 214 | wfWarn( "Nonexiting Upload Wizard configuration setting '$setting' will be ignored." ); |
— | — | @@ -269,6 +301,21 @@ |
270 | 302 | return $this->config; |
271 | 303 | } |
272 | 304 | |
| 305 | + public function getConfigForGlobalMerge() { |
| 306 | + $config = $this->getConfig(); |
| 307 | + |
| 308 | + foreach ( $config as $settingName => &$settingValue ) { |
| 309 | + if ( $settingName == 'licensesOwnWork' ) { |
| 310 | + $settingValue = array_merge( |
| 311 | + UploadWizardConfig::getSetting( 'licensesOwnWork' ), |
| 312 | + array( 'licenses' => $settingValue ) |
| 313 | + ); |
| 314 | + } |
| 315 | + } |
| 316 | + |
| 317 | + return $config; |
| 318 | + } |
| 319 | + |
273 | 320 | /** |
274 | 321 | * Returns all config properties by merging the set ones with a list of default ones. |
275 | 322 | * Property name => array( 'default' => $value, 'type' => HTMLForm input type ) |
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php |
— | — | @@ -302,6 +302,11 @@ |
303 | 303 | 'mwe-upwiz-campaign-conf-autoCategories' => 'Categories to add the files to automatically and silently', |
304 | 304 | 'mwe-upwiz-campaign-conf-defaultCategories' => 'Default categories to list in the describe tab', |
305 | 305 | 'mwe-upwiz-campaign-conf-autoWikiText' => 'WikiText to automatically add to all uploaded images', |
| 306 | + 'mwe-upwiz-campaign-conf-ownWorkOption' => 'How to handle own-work or not own-work', |
| 307 | + 'mwe-upwiz-campaign-owner-choice' => 'Allow the user to choose between own work and non-own work', |
| 308 | + 'mwe-upwiz-campaign-owner-own' => 'Only allow for own work uploads', |
| 309 | + 'mwe-upwiz-campaign-owner-notown' => 'Only allow for non-own work uploads', |
| 310 | + 'mwe-upwiz-campaign-conf-licensesOwnWork' => 'The licences that should be choosable for own-work', |
306 | 311 | |
307 | 312 | // Coolcats |
308 | 313 | 'mw-coolcats-confirm-new-title' => 'Confirm new category', |