From bc05340c84213b2771c012ff42ed2ff5d00974af Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 31 Aug 2014 12:55:51 +0200 Subject: Fix #11: Add ‘other templates’ field MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MediaWikiExportServiceProvider.lua | 19 +++++++++++++++++-- mediawiki.lrdevplugin/MediaWikiInterface.lua | 5 +++-- mediawiki.lrdevplugin/TranslatedStrings_de.txt | 1 + 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua index 1a984bd..04e783a 100755 --- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua +++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua @@ -90,11 +90,12 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext, end local author = exportSettings.info_author local license = exportSettings.info_license + local templates = exportSettings.info_templates local other = exportSettings.info_other local categories = exportSettings.info_categories local additionalCategories = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'categories') or '' - local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, other, categories, additionalCategories) + local fileDescription = MediaWikiInterface.buildFileDescription(description, source, timestamp, author, license, templates, other, categories, additionalCategories) MediaWikiInterface.uploadFile(pathOrMessage, fileDescription) LrFileUtils.delete(pathOrMessage) @@ -202,6 +203,19 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr }, }, + viewFactory:row { + spacing = viewFactory:control_spacing(), + + viewFactory:static_text { + title = LOC '$$$/LrMediaWiki/Section/Licensing/OtherTemplates=Other templates', + }, + + viewFactory:edit_field { + value = bind 'info_templates', + immediate = true, + }, + }, + viewFactory:row { spacing = viewFactory:control_spacing(), @@ -240,7 +254,7 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr viewFactory:push_button { title = LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', action = function(button) - local wikitext = MediaWikiInterface.buildFileDescription('', propertyTable.info_source, '', propertyTable.info_author, propertyTable.info_license, propertyTable.info_other, propertyTable.info_categories, '') + local wikitext = MediaWikiInterface.buildFileDescription('', propertyTable.info_source, '', propertyTable.info_author, propertyTable.info_license, propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '') LrDialogs.message(LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', wikitext, 'info') end, }, @@ -266,6 +280,7 @@ MediaWikiExportServiceProvider.exportPresetFields = { { key = 'info_source', default = '{{own}}' }, { key = 'info_author', default = '' }, { key = 'info_license', default = '{{Cc-by-sa-4.0}}' }, + { 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 5201b2d..715243c 100755 --- a/mediawiki.lrdevplugin/MediaWikiInterface.lua +++ b/mediawiki.lrdevplugin/MediaWikiInterface.lua @@ -37,6 +37,7 @@ local MediaWikiInterface = { |other_versions= |other_fields=%s }} +%s == {{int:license-header}} == %s %s[[Category:Uploaded with LrMediaWiki]]]=], @@ -121,7 +122,7 @@ MediaWikiInterface.uploadFile = function(filePath, description, fileName) end end -MediaWikiInterface.buildFileDescription = function(description, source, timestamp, author, license, other, categories, additionalCategories) +MediaWikiInterface.buildFileDescription = function(description, source, timestamp, author, license, templates, other, categories, additionalCategories) local categoriesString = '' for category in string.gmatch(categories, '[^;]+') do if category then @@ -133,7 +134,7 @@ MediaWikiInterface.buildFileDescription = function(description, source, timestam categoriesString = categoriesString .. string.format('[[Category:%s]]\n', category) end end - return string.format(MediaWikiInterface.fileDescriptionPattern, description, source, timestamp, author, other, license, categoriesString) + return string.format(MediaWikiInterface.fileDescriptionPattern, description, source, timestamp, author, other, templates, license, categoriesString) end return MediaWikiInterface \ No newline at end of file diff --git a/mediawiki.lrdevplugin/TranslatedStrings_de.txt b/mediawiki.lrdevplugin/TranslatedStrings_de.txt index 7be208a..3bcc72e 100755 --- a/mediawiki.lrdevplugin/TranslatedStrings_de.txt +++ b/mediawiki.lrdevplugin/TranslatedStrings_de.txt @@ -32,6 +32,7 @@ "$$$/LrMediaWiki/Section/Licensing/Categories=Kategorien" "$$$/LrMediaWiki/Section/Licensing/License=Lizenz" "$$$/LrMediaWiki/Section/Licensing/Other=Andere Felder" +"$$$/LrMediaWiki/Section/Licensing/OtherTemplates=Andere Vorlagen" "$$$/LrMediaWiki/Section/Licensing/Preview=Vorschau des generierten Wikitexts" "$$$/LrMediaWiki/Section/Licensing/Source=Quelle" "$$$/LrMediaWiki/Section/Licensing/Title=Upload-Informationen" -- cgit v1.2.3