aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2014-08-31 12:55:51 +0200
committerRobin Krahl <me@robin-krahl.de>2014-08-31 12:55:51 +0200
commitbc05340c84213b2771c012ff42ed2ff5d00974af (patch)
tree518b4a8efebbca7e0f1fdfb80eefd33d50c6c12f
parent66e62f684ae128955ae2d6fb109bae48006b483b (diff)
downloadLrMediaWiki-bc05340c84213b2771c012ff42ed2ff5d00974af.tar.gz
LrMediaWiki-bc05340c84213b2771c012ff42ed2ff5d00974af.tar.bz2
Fix #11: Add ‘other templates’ field
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua19
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiInterface.lua5
-rwxr-xr-xmediawiki.lrdevplugin/TranslatedStrings_de.txt1
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)
@@ -206,6 +207,19 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr
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(),
+
+ viewFactory:static_text {
title = LOC '$$$/LrMediaWiki/Section/Licensing/Other=Other fields',
},
@@ -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('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file categories -->')
+ local wikitext = MediaWikiInterface.buildFileDescription('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file 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"