r87366 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87365‎ | r87366 | r87367 >
Date:23:08, 3 May 2011
Author:kaldari
Status:ok (Comments)
Tags:
Comment:
better api calls for flickr, fixing attribution license, restoring messages lost in merge
Modified paths:
  • /trunk/extensions/UploadWizard/UploadWizard.i18n.php (modified) (history)
  • /trunk/extensions/UploadWizard/resources/mw.FlickrChecker.js (modified) (history)

Diff [purge]

Index: trunk/extensions/UploadWizard/UploadWizard.i18n.php
@@ -226,6 +226,8 @@
227227 'mwe-upwiz-license-confirm-remove' => 'Are you sure you want to remove {{PLURAL:$1|this upload|these uploads}}?',
228228 'mwe-upwiz-license-confirm-remove-title' => 'Confirm remove',
229229
 230+ 'mwe-upwiz-license-external' => 'This file is under the following license on $1: <b>$2</b>.',
 231+ 'mwe-upwiz-license-external-invalid' => 'This file is under the following license on $1: <b>$2</b>. Unfortunately, this license is not appropriate for use on {{SITENAME}}.',
230232
231233 'mwe-upwiz-categories' => 'Categories',
232234 'mwe-upwiz-categories-add' => 'Add',
Index: trunk/extensions/UploadWizard/resources/mw.FlickrChecker.js
@@ -11,7 +11,7 @@
1212 // Live list at http://api.flickr.com/services/rest/?&method=flickr.photos.licenses.getInfo&api_key=e9d8174a79c782745289969a45d350e8
1313 licenseMaps: {
1414 'All Rights Reserved': 'invalid',
15 - 'Attribution License': 'invalid',
 15+ 'Attribution License': '{{flickrreview}}{{cc-by-2.0}}',
1616 'Attribution-NoDerivs License': 'invalid',
1717 'Attribution-NonCommercial-NoDerivs License': 'invalid',
1818 'Attribution-NonCommercial License': 'invalid',
@@ -36,7 +36,7 @@
3737 var photoIdMatches = url.match(/flickr.com\/photos\/[^\/]+\/([0-9]+)/);
3838 if ( photoIdMatches && photoIdMatches[1] > 0 ) {
3939 var photoId = photoIdMatches[1];
40 - $.getJSON( this.apiUrl + 'jsoncallback=?', { 'method': 'flickr.photos.getInfo', 'api_key': this.apiKey, 'photo_id': photoId, 'format': 'json' },
 40+ $.getJSON( this.apiUrl, { 'nojsoncallback': 1, 'method': 'flickr.photos.getInfo', 'api_key': this.apiKey, 'photo_id': photoId, 'format': 'json' },
4141 function( data ) {
4242 if ( typeof data.photo != 'undefined' ) {
4343 // The returned data.photo.license is just an ID that we use to look up the license name
@@ -62,7 +62,7 @@
6363 * Retrieve the list of all current Flickr licenses and store it in an array (mw.FlickrChecker.licenseList)
6464 */
6565 getLicenses: function() {
66 - $.getJSON( this.apiUrl + 'jsoncallback=?', { 'method': 'flickr.photos.licenses.getInfo', 'api_key': this.apiKey, 'format': 'json' },
 66+ $.getJSON( this.apiUrl, { 'nojsoncallback': 1, 'method': 'flickr.photos.licenses.getInfo', 'api_key': this.apiKey, 'format': 'json' },
6767 function( data ) {
6868 if ( typeof data.licenses != 'undefined' ) {
6969 $.each( data.licenses.license, function(index, value) {

Follow-up revisions

RevisionCommit summaryAuthorDate
r87422adding documentation for new messages, per r87366kaldari18:05, 4 May 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r87258FlickrChecker fixes, follow-up to r87002 and r87031kaldari17:24, 2 May 2011

Comments

#Comment by Nikerabbit (talk | contribs)   07:41, 4 May 2011

Can you btw add documentation for those two messages, thanks?

#Comment by Kaldari (talk | contribs)   18:06, 4 May 2011

done in r87422.

#Comment by Catrope (talk | contribs)   22:27, 4 May 2011

Are you sure this works? Won't this be thwarted by cross-domain restrictions?

#Comment by Kaldari (talk | contribs)   22:39, 4 May 2011

That's what I thought as well, but it seems to work somehow. Not sure what jQuery is doing on the back-end here, but it seems to work. Might be worth double-checking in Explorer.

#Comment by Catrope (talk | contribs)   22:53, 4 May 2011

It's likely doing JSONP behind the scenes anyway. Look at the Firebug net panel to be sure.

Status & tagging log