r104495 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r104494‎ | r104495 | r104496 >
Date:21:54, 28 November 2011
Author:erik
Status:ok
Tags:neilk 
Comment:
* Add support for URLs to the legal code of a license.
* Add URLs for licenses enabled on Wikimedia Commons and
include those URLs in relevant messages as "[legal code]"
links.
* Add pluralization support to a message which needed it,
and message documentation for it.
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.config.php (modified) (history)
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.config.php
@@ -80,7 +80,8 @@
8181 'licenses' => array(
8282 'cc-by-sa-3.0' => array(
8383 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0',
84 - 'icons' => array( 'cc-by', 'cc-sa' )
 84+ 'icons' => array( 'cc-by', 'cc-sa' ),
 85+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/legalcode'
8586 ),
8687 'cc-by-sa-3.0-gfdl' => array(
8788 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-gfdl',
@@ -90,60 +91,72 @@
9192 'cc-by-sa-3.0-at' => array(
9293 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-at',
9394 'templates' => array( 'cc-by-sa-3.0-at' ),
94 - 'icons' => array( 'cc-by', 'cc-sa' )
 95+ 'icons' => array( 'cc-by', 'cc-sa' ),
 96+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/at/legalcode'
9597 ),
9698 'cc-by-sa-3.0-de' => array(
9799 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-de',
98100 'templates' => array( 'cc-by-sa-3.0-de' ),
99 - 'icons' => array( 'cc-by', 'cc-sa' )
 101+ 'icons' => array( 'cc-by', 'cc-sa' ),
 102+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/de/legalcode'
100103 ),
101104 'cc-by-sa-3.0-ee' => array(
102105 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ee',
103106 'templates' => array( 'cc-by-sa-3.0-ee' ),
104 - 'icons' => array( 'cc-by', 'cc-sa' )
 107+ 'icons' => array( 'cc-by', 'cc-sa' ),
 108+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/ee/legalcode'
105109 ),
106110 'cc-by-sa-3.0-es' => array(
107111 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-es',
108112 'templates' => array( 'cc-by-sa-3.0-es' ),
109 - 'icons' => array( 'cc-by', 'cc-sa' )
 113+ 'icons' => array( 'cc-by', 'cc-sa' ),
 114+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/es/legalcode'
110115 ),
111116 'cc-by-sa-3.0-hr' => array(
112117 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-hr',
113118 'templates' => array( 'cc-by-sa-3.0-hr' ),
114 - 'icons' => array( 'cc-by', 'cc-sa' )
 119+ 'icons' => array( 'cc-by', 'cc-sa' ),
 120+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/hr/legalcode'
115121 ),
116122 'cc-by-sa-3.0-lu' => array(
117123 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-lu',
118124 'templates' => array( 'cc-by-sa-3.0-lu' ),
119 - 'icons' => array( 'cc-by', 'cc-sa' )
 125+ 'icons' => array( 'cc-by', 'cc-sa' ),
 126+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/lu/legalcode'
120127 ),
121128 'cc-by-sa-3.0-nl' => array(
122129 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-nl',
123130 'templates' => array( 'cc-by-sa-3.0-nl' ),
124 - 'icons' => array( 'cc-by', 'cc-sa' )
 131+ 'icons' => array( 'cc-by', 'cc-sa' ),
 132+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/nl/legalcode'
125133 ),
126134 'cc-by-sa-3.0-no' => array(
127135 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-no',
128136 'templates' => array( 'cc-by-sa-3.0-no' ),
129 - 'icons' => array( 'cc-by', 'cc-sa' )
 137+ 'icons' => array( 'cc-by', 'cc-sa' ),
 138+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/no/legalcode'
130139 ),
131140 'cc-by-sa-3.0-pl' => array(
132141 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-pl',
133142 'templates' => array( 'cc-by-sa-3.0-pl' ),
134 - 'icons' => array( 'cc-by', 'cc-sa' )
 143+ 'icons' => array( 'cc-by', 'cc-sa' ),
 144+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/pl/legalcode'
135145 ),
136146 'cc-by-sa-3.0-ro' => array(
137147 'msg' => 'mwe-upwiz-license-cc-by-sa-3.0-ro',
138148 'templates' => array( 'cc-by-sa-3.0-ro' ),
139 - 'icons' => array( 'cc-by', 'cc-sa' )
 149+ 'icons' => array( 'cc-by', 'cc-sa' ),
 150+ 'url' => 'http://creativecommons.org/licenses/by-sa/3.0/ro/legalcode'
140151 ),
141152 'cc-by-3.0' => array(
142153 'msg' => 'mwe-upwiz-license-cc-by-3.0',
143 - 'icons' => array( 'cc-by' )
 154+ 'icons' => array( 'cc-by' ),
 155+ 'url' => 'http://creativecommons.org/licenses/by/3.0/legalcode'
144156 ),
145157 'cc-zero' => array(
146158 'msg' => 'mwe-upwiz-license-cc-zero',
147 - 'icons' => array( 'cc-zero' )
 159+ 'icons' => array( 'cc-zero' ),
 160+ 'url' => 'http://creativecommons.org/publicdomain/zero/1.0/legalcode'
148161 ),
149162 'own-pd' => array(
150163 'msg' => 'mwe-upwiz-license-own-pd',
@@ -152,19 +165,24 @@
153166 ),
154167 'cc-by-sa-2.5' => array(
155168 'msg' => 'mwe-upwiz-license-cc-by-sa-2.5',
156 - 'icons' => array( 'cc-by', 'cc-sa' )
 169+ 'icons' => array( 'cc-by', 'cc-sa' ),
 170+ 'url' => 'http://creativecommons.org/licenses/by-sa/2.5/legalcode'
157171 ),
158172 'cc-by-2.5' => array(
159173 'msg' => 'mwe-upwiz-license-cc-by-2.5',
160 - 'icons' => array( 'cc-by' )
 174+ 'icons' => array( 'cc-by' ),
 175+ 'url' => 'http://creativecommons.org/licenses/by/2.5/legalcode'
161176 ),
162177 'cc-by-sa-2.0' => array(
163178 'msg' => 'mwe-upwiz-license-cc-by-sa-2.0',
164 - 'icons' => array( 'cc-by', 'cc-sa' )
 179+ 'icons' => array( 'cc-by', 'cc-sa' ),
 180+ 'url' => 'http://creativecommons.org/licenses/by-sa/2.0/legalcode'
 181+
165182 ),
166183 'cc-by-2.0' => array(
167184 'msg' => 'mwe-upwiz-license-cc-by-2.0',
168 - 'icons' => array( 'cc-by' )
 185+ 'icons' => array( 'cc-by' ),
 186+ 'url' => 'http://creativecommons.org/licenses/by/2.0/legalcode'
169187 ),
170188 'fal' => array(
171189 'msg' => 'mwe-upwiz-license-fal',
@@ -214,7 +232,8 @@
215233 ),
216234 'custom' => array(
217235 'msg' => 'mwe-upwiz-license-custom',
218 - 'templates' => array( 'subst:Custom license marker added by UW' )
 236+ 'templates' => array( 'subst:Custom license marker added by UW' ),
 237+ 'url' => '//commons.wikimedia.org/wiki/Commons:Copyright_tags'
219238 )
220239 ),
221240
Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -106,7 +106,7 @@
107107 'mwe-upwiz-source-ownwork-assert-any-license' => 'I, $2, the copyright holder of {{PLURAL:$1|this work|these works}}, hereby irrevocably grant anyone the right to use, modify and redistribute {{PLURAL:$1|this work|these works}} for any purpose, and I therefore publish {{PLURAL:$1|it|them}} under the following terms:',
108108 'mwe-upwiz-source-ownwork-assert' => 'I, $2, the copyright holder of {{PLURAL:$1|this work|these works}}, hereby irrevocably grant anyone the right to use {{PLURAL:$1|this work|these works}} for any purpose, as long as they credit me and share derivative work under the same terms.',
109109 'mwe-upwiz-source-ownwork-assert-custom' => 'I, $2, the copyright holder of {{PLURAL:$1|this work|these works}}, hereby publish {{PLURAL:$1|this work|these works}} under the following license:',
110 - 'mwe-upwiz-source-ownwork-assert-note' => 'I, copyright holder of these works, publish these works under the $1 license.',
 110+ 'mwe-upwiz-source-ownwork-assert-note' => 'I, copyright holder of {{PLURAL:$2|this work|these works}}, publish {{PLURAL:$2|this work|these works}} under the $1 license.',
111111 'mwe-upwiz-source-permission' => 'Their author gave you explicit permission to upload them',
112112 'mwe-upwiz-source-thirdparty' => '{{PLURAL:$1|This file is|These files are}} not my own work.',
113113 'mwe-upwiz-source-thirdparty-intro' => 'Please enter the address where you found each file.',
@@ -220,24 +220,24 @@
221221
222222 /* LICENSES & combinations of licenses */
223223 /* may be a good idea to shift to WikimediaLicenseTexts? */
224 - 'mwe-upwiz-license-cc-by-sa-3.0' => 'Creative Commons Attribution ShareAlike 3.0',
225 - 'mwe-upwiz-license-cc-by-sa-3.0-at' => 'Creative Commons Attribution ShareAlike 3.0 Austria',
226 - 'mwe-upwiz-license-cc-by-sa-3.0-de' => 'Creative Commons Attribution ShareAlike 3.0 Germany',
227 - 'mwe-upwiz-license-cc-by-sa-3.0-ee' => 'Creative Commons Attribution ShareAlike 3.0 Estonia',
228 - 'mwe-upwiz-license-cc-by-sa-3.0-es' => 'Creative Commons Attribution ShareAlike 3.0 Spain',
229 - 'mwe-upwiz-license-cc-by-sa-3.0-hr' => 'Creative Commons Attribution ShareAlike 3.0 Croatia',
230 - 'mwe-upwiz-license-cc-by-sa-3.0-lu' => 'Creative Commons Attribution ShareAlike 3.0 Luxembourg',
231 - 'mwe-upwiz-license-cc-by-sa-3.0-nl' => 'Creative Commons Attribution ShareAlike 3.0 Netherlands',
232 - 'mwe-upwiz-license-cc-by-sa-3.0-no' => 'Creative Commons Attribution ShareAlike 3.0 Norway',
233 - 'mwe-upwiz-license-cc-by-sa-3.0-pl' => 'Creative Commons Attribution ShareAlike 3.0 Poland',
234 - 'mwe-upwiz-license-cc-by-sa-3.0-ro' => 'Creative Commons Attribution ShareAlike 3.0 Romania',
235 - 'mwe-upwiz-license-cc-by-3.0' => 'Creative Commons Attribution 3.0',
236 - 'mwe-upwiz-license-cc-by-sa-2.5' => 'Creative Commons Attribution ShareAlike 2.5',
237 - 'mwe-upwiz-license-cc-by-2.5' => 'Creative Commons Attribution 2.5',
238 - 'mwe-upwiz-license-cc-by-sa-2.0' => 'Creative Commons Attribution ShareAlike 2.0',
239 - 'mwe-upwiz-license-cc-by-2.0' => 'Creative Commons Attribution 2.0',
240 - 'mwe-upwiz-license-cc-zero' => 'Creative Commons CC0 Waiver (release all rights, like public domain)',
241 - 'mwe-upwiz-license-custom' => 'The license is described by the following wikitext:',
 224+ 'mwe-upwiz-license-cc-by-sa-3.0' => 'Creative Commons Attribution ShareAlike 3.0 ([$2 legal code])',
 225+ 'mwe-upwiz-license-cc-by-sa-3.0-at' => 'Creative Commons Attribution ShareAlike 3.0 Austria ([$2 legal code])',
 226+ 'mwe-upwiz-license-cc-by-sa-3.0-de' => 'Creative Commons Attribution ShareAlike 3.0 Germany ([$2 legal code])',
 227+ 'mwe-upwiz-license-cc-by-sa-3.0-ee' => 'Creative Commons Attribution ShareAlike 3.0 Estonia ([$2 legal code])',
 228+ 'mwe-upwiz-license-cc-by-sa-3.0-es' => 'Creative Commons Attribution ShareAlike 3.0 Spain ([$2 legal code])',
 229+ 'mwe-upwiz-license-cc-by-sa-3.0-hr' => 'Creative Commons Attribution ShareAlike 3.0 Croatia ([$2 legal code])',
 230+ 'mwe-upwiz-license-cc-by-sa-3.0-lu' => 'Creative Commons Attribution ShareAlike 3.0 Luxembourg ([$2 legal code])',
 231+ 'mwe-upwiz-license-cc-by-sa-3.0-nl' => 'Creative Commons Attribution ShareAlike 3.0 Netherlands ([$2 legal code])',
 232+ 'mwe-upwiz-license-cc-by-sa-3.0-no' => 'Creative Commons Attribution ShareAlike 3.0 Norway ([$2 legal code])',
 233+ 'mwe-upwiz-license-cc-by-sa-3.0-pl' => 'Creative Commons Attribution ShareAlike 3.0 Poland ([$2 legal code])',
 234+ 'mwe-upwiz-license-cc-by-sa-3.0-ro' => 'Creative Commons Attribution ShareAlike 3.0 Romania ([$2 legal code])',
 235+ 'mwe-upwiz-license-cc-by-3.0' => 'Creative Commons Attribution 3.0 ([$2 legal code])',
 236+ 'mwe-upwiz-license-cc-by-sa-2.5' => 'Creative Commons Attribution ShareAlike 2.5 ([$2 legal code])',
 237+ 'mwe-upwiz-license-cc-by-2.5' => 'Creative Commons Attribution 2.5 ([$2 legal code])',
 238+ 'mwe-upwiz-license-cc-by-sa-2.0' => 'Creative Commons Attribution ShareAlike 2.0 ([$2 legal code])',
 239+ 'mwe-upwiz-license-cc-by-2.0' => 'Creative Commons Attribution 2.0 ([$2 legal code])',
 240+ 'mwe-upwiz-license-cc-zero' => 'Creative Commons CC0 Waiver (release all rights, like public domain: [$2 legal code])',
 241+ 'mwe-upwiz-license-custom' => 'The license is described by the following wikitext (must contain a valid [$2 copyright tag]):',
242242 'mwe-upwiz-license-fal' => 'Free Art License',
243243 'mwe-upwiz-license-own-pd' => 'All rights waived with Creative Commons Zero license (like public domain)',
244244 'mwe-upwiz-license-pd-old-100' => 'Author died more than 100 years ago',
@@ -453,6 +453,7 @@
454454 'mwe-upwiz-show-thumb-tip' => 'The tooltip for the mwe-upwiz-show-thumb link',
455455 'mwe-upwiz-upload' => '{{Identical|Upload}}',
456456 'mwe-upwiz-source-thirdparty-accept' => '{{Identical|OK}}',
 457+ 'mwe-upwiz-source-ownwork-assert-note' => '{{doc-important|In this message, $1 is the name of the license, and $2 is the number of uploads for pluralization.}}',
457458 'mwe-upwiz-more-options' => "Text for a 'more options' toggle that opens more of a form so a user can make more detailed descriptions/add more properties for uploaded images.",
458459 'mwe-upwiz-fewer-options' => '[[File:Commons-uw-L52P.png|right|thumb|Screenshot showing a sample of this message]]',
459460 'mwe-upwiz-desc' => '[[File:Commons-uw-L52P.png|right|thumb|Screenshot showing a sample of this message]]
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardDeed.js
@@ -121,6 +121,12 @@
122122 _this.$form = $j( '<form />' );
123123
124124 _this.$authorInput2 = $j( '<input type="text" />' ).attr( { name: "author2" } ).addClass( 'mwe-upwiz-sign' );
 125+
 126+ var defaultLicense = mw.UploadWizard.config.licensesOwnWork.defaults[0];
 127+ var defaultLicenseURL = mw.isDefined ( mw.UploadWizard.config.licenses[defaultLicense].url ) ?
 128+ mw.UploadWizard.config.licenses[defaultLicense].url :
 129+ '#missing license URL';
 130+ var defaultLicenseLink = $j( '<a>' ).attr( { 'target': '_blank', 'href': defaultLicenseURL } );
125131 var $standardDiv = $j( '<div />' ).append(
126132 $j( '<label for="author2" generated="true" class="mwe-validator-error" style="display:block;" />' ),
127133 $j( '<p></p>' ).msg( 'mwe-upwiz-source-ownwork-assert',
@@ -128,7 +134,8 @@
129135 _this.$authorInput2 ),
130136 $j( '<p class="mwe-small-print"></p>' ).msg(
131137 'mwe-upwiz-source-ownwork-assert-note',
132 - gM( 'mwe-upwiz-license-' + mw.UploadWizard.config.licensesOwnWork.defaults[0] )
 138+ gM( 'mwe-upwiz-license-' + defaultLicense, uploadCount, defaultLicenseLink ),
 139+ uploadCount
133140 )
134141 );
135142
Index: trunk/extensions/UploadWizard/resources/mw.UploadWizardLicenseInput.js
@@ -215,6 +215,11 @@
216216 */
217217 createInputElementLabel: function( license, $input ) {
218218 var messageKey = mw.isDefined( license.props['msg'] ) ? license.props.msg : '[missing msg for ' + license.name + ']';
 219+
 220+ // The URL is optional, but if the message includes it as $2, we surface the fact
 221+ // that it's misisng.
 222+ var licenseURL = mw.isDefined( license.props['url'] ) ? license.props.url : '#missing license URL';
 223+ var licenseLink = $j( '<a>' ).attr( { 'target': '_blank', 'href': licenseURL } );
219224 var $icons = $j( '<span></span>' );
220225 if ( mw.isDefined( license.props['icons'] ) ) {
221226 $j.each( license.props.icons, function( i, icon ) {
@@ -223,7 +228,7 @@
224229 }
225230 return $j( '<label />' )
226231 .attr( { 'for': $input.attr('id') } )
227 - .msg( messageKey, this.count )
 232+ .msg( messageKey, this.count, licenseLink )
228233 .append( $icons );
229234 },
230235

Sign-offs

UserFlagDate
Hasharinspected10:02, 13 December 2011

Status & tagging log