Matthias Mullie has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/337566 )
Change subject: Add 'uploadwizard' & 'uploadwizard-flickr' tags to uploads
......................................................................
Add 'uploadwizard' & 'uploadwizard-flickr' tags to uploads
In order to be able to add these tags,
I6e054cfc065c8d8ae7d20a518b1963cd0551c5c2 will also have
to be merged in core. But it's not a strict requirement
(UW will continue to work without it)
Bug: T121880
Bug: T121872
Change-Id: Ib0eba7c394f3515bd17e11bcc30f090f9c3c45ce
---
M UploadWizardHooks.php
M extension.json
M i18n/en.json
M i18n/qqq.json
M includes/specials/SpecialUploadWizard.php
M resources/mw.FlickrChecker.js
M resources/mw.UploadWizardDetails.js
7 files changed, 42 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/UploadWizard
refs/changes/66/337566/1
diff --git a/UploadWizardHooks.php b/UploadWizardHooks.php
index d611e45..a184c2d 100644
--- a/UploadWizardHooks.php
+++ b/UploadWizardHooks.php
@@ -204,4 +204,17 @@
return wfMessage( $licenseConfig[$licenseName]['msg']
)->text();
}
}
+
+ /**
+ * Lists tags used by UploadWizard (via ListDefinedTags,
+ * ListExplicitlyDefinedTags & ChangeTagsListActive hooks)
+ *
+ * @param array $tags
+ * @return bool true
+ */
+ public static function onListDefinedTags( &$tags ) {
+ $tags[] = 'uploadwizard';
+ $tags[] = 'uploadwizard-flickr';
+ return true;
+ }
}
diff --git a/extension.json b/extension.json
index 18cb3ac..1776b8d 100644
--- a/extension.json
+++ b/extension.json
@@ -805,10 +805,15 @@
"remoteExtPath": "UploadWizard"
},
"Hooks": {
+ // uploadwizard hooks
"LoadExtensionSchemaUpdates":
"UploadWizardHooks::onSchemaUpdate",
"GetPreferences": "UploadWizardHooks::onGetPreferences",
"IsUploadAllowedFromUrl":
"UploadWizardHooks::onIsUploadAllowedFromUrl",
"ResourceLoaderTestModules":
"UploadWizardHooks::onResourceLoaderTestModules",
+ "ListDefinedTags": "UploadWizardHooks::onListDefinedTags",
+ "ChangeTagsListActive": "UploadWizardHooks::onListDefinedTags",
+ "ChangeTagsAllowedAdd": "UploadWizardHooks::onListDefinedTags",
+ // campaign hooks
"ContentModelCanBeUsedOn":
"CampaignHooks::onContentModelCanBeUsedOn",
"EditFilterMergedContent":
"CampaignHooks::onEditFilterMergedContent",
"CodeEditorGetPageLanguage":
"CampaignHooks::onCodeEditorGetPageLanguage",
diff --git a/i18n/en.json b/i18n/en.json
index 8c52a40..df7b9c4 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -4,6 +4,10 @@
},
"uploadwizard": "Upload Wizard",
"uploadwizard-desc": "Upload Wizard, a user-friendly tool for uploading
multimedia",
+ "tag-uploadwizard": "Upload Wizard",
+ "tag-uploadwizard-description": "Uploads made with Upload Wizard",
+ "tag-uploadwizard-flickr": "Flickr",
+ "tag-uploadwizard-flickr-description": "Flickr uploads made with Upload
Wizard",
"right-upwizcampaigns": "Configure Upload Wizard campaigns",
"action-upwizcampaigns": "configure upload campaigns",
"group-upwizcampeditors": "Upload Wizard campaign editors",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index dddf81d..629d4c0 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -30,6 +30,10 @@
},
"uploadwizard": "{{doc-special|UploadWizard}}\nUploadWizard is a wizard
to upload multimedia files to a MediaWiki website.\nFor more information, see
[[mw:UploadWizard]].",
"uploadwizard-desc": "{{desc|name=Upload
Wizard|url=https://www.mediawiki.org/wiki/Extension:UploadWizard}}",
+ "tag-uploadwizard": "Display name for 'uploadwizard' tag (= files
uploaded with Upload Wizard)",
+ "tag-uploadwizard-description": "Description for 'uploadwizard' tag (=
files uploaded with Upload Wizard)",
+ "tag-uploadwizard-flickr": "Display name for 'uploadwizard-flickr' tag
(= Flickr files uploaded with Upload Wizard)",
+ "tag-uploadwizard-flickr-description": "Description for
'uploadwizard-flickr' tag (= Flickr files uploaded with Upload Wizard)",
"right-upwizcampaigns": "{{doc-right|upwizcampaigns}}\n\n\"Upload
campaign\" can also be worded as \"a campaign for the promotion of
uploading\".",
"action-upwizcampaigns": "{{doc-action|upwizcampaigns}}",
"group-upwizcampeditors": "{{doc-group|upwizcampeditors}}",
diff --git a/includes/specials/SpecialUploadWizard.php
b/includes/specials/SpecialUploadWizard.php
index 58efebc..823b9bb 100644
--- a/includes/specials/SpecialUploadWizard.php
+++ b/includes/specials/SpecialUploadWizard.php
@@ -230,6 +230,12 @@
}
}
+ // add an 'uploadwizard' tag, but only if it'll be allowed
+ $tags = array();
+ UploadWizardHooks::onListDefinedTags( $tags );
+ $status = ChangeTags::canAddTagsAccompanyingChange( $tags,
$this->getUser() );
+ $config['CanAddTags'] = $status->isOK();
+
$bitmapHandler = new BitmapHandler();
$this->getOutput()->addJsConfigVars(
[
diff --git a/resources/mw.FlickrChecker.js b/resources/mw.FlickrChecker.js
index 9b37c13..2be117c 100644
--- a/resources/mw.FlickrChecker.js
+++ b/resources/mw.FlickrChecker.js
@@ -408,6 +408,7 @@
url: '',
type: 'JPEG',
fromURL: true,
+ source: 'flickr',
licenseValue: licenseValue,
licenseMessage:
license.licenseMessage,
license: license.licenseName
!== 'Public Domain Mark',
@@ -553,6 +554,7 @@
url: '',
type: 'JPEG',
fromURL: true,
+ source: 'flickr',
licenseValue: license.licenseValue,
licenseMessage: license.licenseMessage,
license: license.licenseName !==
'Public Domain Mark',
diff --git a/resources/mw.UploadWizardDetails.js
b/resources/mw.UploadWizardDetails.js
index e4c5215..f4e3790 100644
--- a/resources/mw.UploadWizardDetails.js
+++ b/resources/mw.UploadWizardDetails.js
@@ -728,7 +728,8 @@
* @return {jQuery.Promise}
*/
submit: function () {
- var params;
+ var params,
+ tags = [ 'uploadwizard' ];
$( 'form', this.containerDiv ).submit();
@@ -739,11 +740,16 @@
this.firstPoll = ( new Date() ).getTime();
+ if ( this.upload.file.source ) {
+ tags.push( 'uploadwizard-' +
this.upload.file.source );
+ }
+
params = {
action: 'upload',
filekey: this.upload.fileKey,
filename: this.getTitle().getMain(),
- comment: 'User created page with ' +
mw.UploadWizard.userAgent
+ comment: 'User created page with ' +
mw.UploadWizard.userAgent,
+ tags: mw.UploadWizard.config.CanAddTags ? tags
: []
};
// Only enable async publishing if file is larger than
10MiB
--
To view, visit https://gerrit.wikimedia.org/r/337566
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib0eba7c394f3515bd17e11bcc30f090f9c3c45ce
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/UploadWizard
Gerrit-Branch: master
Gerrit-Owner: Matthias Mullie <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits