aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2014-11-01 16:24:36 +0100
committerRobin Krahl <me@robin-krahl.de>2014-11-01 16:25:09 +0100
commite1257f32eec1503c1230c4f4642bf2e0bafb7aa4 (patch)
tree4ef14205a5d68c0c7f4ab220c47ac420bebad1ce
parent6f251c2526004faa55e4bcb9935aad38bfed7a48 (diff)
downloadLrMediaWiki-e1257f32eec1503c1230c4f4642bf2e0bafb7aa4.tar.gz
LrMediaWiki-e1257f32eec1503c1230c4f4642bf2e0bafb7aa4.tar.bz2
Add permission field to export dialog
Add the permission field to the export dialog and to the file description template. - add permission to the template in `description.txt` - add permission to the UI in `MediaWikiExportServiceProvider` - add permission to the data items in `MediaWikiInterface` Fix https://github.com/ireas/LrMediaWiki/issues/27
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiApi.lua4
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua23
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiInterface.lua3
-rw-r--r--mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua4
-rwxr-xr-xmediawiki.lrdevplugin/TranslatedStrings_de.txt1
-rw-r--r--mediawiki.lrdevplugin/description.txt2
6 files changed, 27 insertions, 10 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiApi.lua b/mediawiki.lrdevplugin/MediaWikiApi.lua
index cde8b48..33ae9a6 100755
--- a/mediawiki.lrdevplugin/MediaWikiApi.lua
+++ b/mediawiki.lrdevplugin/MediaWikiApi.lua
@@ -5,9 +5,9 @@
-- Copyright (C) 2014 by the LrMediaWiki team (see CREDITS.txt file in the
-- project root directory or [2])
--
--- [0] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/LICENSE.txt>
+-- [0] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/LICENSE.txt>
-- [1] <https://commons.wikimedia.org/wiki/Commons:LrMediaWiki>
--- [2] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/CREDITS.txt>
+-- [2] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/CREDITS.txt>
-- Code status:
-- doc: partly
diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
index 079225e..d91c971 100755
--- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
+++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
@@ -5,9 +5,9 @@
-- Copyright (C) 2014 by the LrMediaWiki team (see CREDITS.txt file in the
-- project root directory or [2])
--
--- [0] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/LICENSE.txt>
+-- [0] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/LICENSE.txt>
-- [1] <https://commons.wikimedia.org/wiki/Commons:LrMediaWiki>
--- [2] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/CREDITS.txt>
+-- [2] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/CREDITS.txt>
-- Code status:
-- doc: missing
@@ -91,6 +91,7 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
end
local author = exportSettings.info_author
local license = exportSettings.info_license
+ local permission = exportSettings.info_permission
local templates = exportSettings.info_templates
local additionalTemplates = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'templates') or ''
if not MediaWikiUtils.isStringEmpty(additionalTemplates) then
@@ -106,7 +107,7 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext,
templates = location .. templates
end
- local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, templates, other, categories, additionalCategories)
+ local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, templates, other, categories, additionalCategories, permission)
MediaWikiInterface.uploadFile(pathOrMessage, fileDescription)
LrFileUtils.delete(pathOrMessage)
@@ -219,6 +220,19 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr
spacing = viewFactory:control_spacing(),
viewFactory:static_text {
+ title = LOC '$$$/LrMediaWiki/Section/Licensing/Permission=Permission',
+ },
+
+ viewFactory:edit_field {
+ value = bind 'info_permission',
+ immediate = true,
+ },
+ },
+
+ viewFactory:row {
+ spacing = viewFactory:control_spacing(),
+
+ viewFactory:static_text {
title = LOC '$$$/LrMediaWiki/Section/Licensing/OtherTemplates=Other templates',
},
@@ -268,7 +282,7 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr
action = function(button)
result, message = MediaWikiInterface.loadFileDescriptionTemplate()
if result then
- local wikitext = MediaWikiInterface.buildFileDescription('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, '<!-- {{Location}} if GPS metadata is available -->\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file categories -->')
+ local wikitext = MediaWikiInterface.buildFileDescription('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, '<!-- {{Location}} if GPS metadata is available -->\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file categories -->', '<!-- permission -->')
LrDialogs.message(LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', wikitext, 'info')
else
LrDialogs.message(LOC '$$$/LrMediaWiki/Export/DescriptionError=Error reading the file description', message, 'error')
@@ -297,6 +311,7 @@ MediaWikiExportServiceProvider.exportPresetFields = {
{ key = 'info_source', default = '{{own}}' },
{ key = 'info_author', default = '' },
{ key = 'info_license', default = '{{Cc-by-sa-4.0}}' },
+ { key = 'info_permission', default = '' },
{ key = 'info_templates', default = '' },
{ key = 'info_other', default = '' },
{ key = 'info_categories', default = '' },
diff --git a/mediawiki.lrdevplugin/MediaWikiInterface.lua b/mediawiki.lrdevplugin/MediaWikiInterface.lua
index be874f0..2473406 100755
--- a/mediawiki.lrdevplugin/MediaWikiInterface.lua
+++ b/mediawiki.lrdevplugin/MediaWikiInterface.lua
@@ -132,7 +132,7 @@ MediaWikiInterface.uploadFile = function(filePath, description, fileName)
end
end
-MediaWikiInterface.buildFileDescription = function(description, source, timestamp, author, license, templates, other, categories, additionalCategories)
+MediaWikiInterface.buildFileDescription = function(description, source, timestamp, author, license, templates, other, categories, additionalCategories, permission)
local categoriesString = ''
for category in string.gmatch(categories, '[^;]+') do
if category then
@@ -153,6 +153,7 @@ MediaWikiInterface.buildFileDescription = function(description, source, timestam
templates = templates,
license = license,
categories = categoriesString,
+ permission = permission,
}
return MediaWikiUtils.formatString(MediaWikiInterface.fileDescriptionPattern, arguments)
end
diff --git a/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua b/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua
index bab12af..a094652 100644
--- a/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua
+++ b/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua
@@ -5,9 +5,9 @@
-- Copyright (C) 2014 by the LrMediaWiki team (see CREDITS.txt file in the
-- project root directory or [2])
--
--- [0] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/LICENSE.txt>
+-- [0] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/LICENSE.txt>
-- [1] <https://commons.wikimedia.org/wiki/Commons:LrMediaWiki>
--- [2] <https://raw.githubusercontent.com/LrMediaWiki/LrMediaWiki/master/CREDITS.txt>
+-- [2] <https://raw.githubusercontent.com/ireas/LrMediaWiki/master/CREDITS.txt>
-- Code status:
-- doc: missing
diff --git a/mediawiki.lrdevplugin/TranslatedStrings_de.txt b/mediawiki.lrdevplugin/TranslatedStrings_de.txt
index 2585861..a662099 100755
--- a/mediawiki.lrdevplugin/TranslatedStrings_de.txt
+++ b/mediawiki.lrdevplugin/TranslatedStrings_de.txt
@@ -37,6 +37,7 @@
"$$$/LrMediaWiki/Section/Licensing/License=Lizenz"
"$$$/LrMediaWiki/Section/Licensing/Other=Andere Felder"
"$$$/LrMediaWiki/Section/Licensing/OtherTemplates=Andere Vorlagen"
+"$$$/LrMediaWiki/Section/Licensing/Permission=Genehmigung"
"$$$/LrMediaWiki/Section/Licensing/Preview=Vorschau des generierten Wikitexts"
"$$$/LrMediaWiki/Section/Licensing/Source=Quelle"
"$$$/LrMediaWiki/Section/Licensing/Title=Upload-Informationen"
diff --git a/mediawiki.lrdevplugin/description.txt b/mediawiki.lrdevplugin/description.txt
index 69818f0..47bb91d 100644
--- a/mediawiki.lrdevplugin/description.txt
+++ b/mediawiki.lrdevplugin/description.txt
@@ -4,7 +4,7 @@
|Source=${source}
|Date=${timestamp}
|Author=${author}
-|Permission=
+|Permission=${permission}
|other_versions=
|other_fields=${other_fields}
}}