Files
lightroom_plugin/photonodes.lrplugin/PhotonodesUploadExportDialogSections.lua
2025-08-20 10:37:50 -06:00

169 lines
4.1 KiB
Lua

-- Lightroom SDK
local LrView = import 'LrView'
--============================================================================--
PhotonodesUploadExportDialogSections = {}
-------------------------------------------------------------------------------
local function updateExportStatus( propertyTable )
local message = nil
repeat
-- Use a repeat loop to allow easy way to "break" out.
-- (It only goes through once.)
if propertyTable.client_id == nil or propertyTable.client_id == "" then
message = LOC "$$$/Photonodes/ExportDialog/Messages/SelectPreset=Enter a PhotoNodes Client Id"
break
end
if propertyTable.event_code == nil or propertyTable.event_code == "" then
message = LOC "$$$/Photonodes/ExportDialog/Messages/SelectPreset=Enter a PhotoNodes Event Code"
break
end
if propertyTable.gallery_name == nil or propertyTable.gallery_name == "" then
message = LOC "$$$/Photonodes/ExportDialog/Messages/SelectPreset=Enter a Gallery Name"
break
end
until true
if message then
propertyTable.message = message
propertyTable.hasError = true
propertyTable.hasNoError = false
propertyTable.LR_cantExportBecause = message
else
propertyTable.message = nil
propertyTable.hasError = false
propertyTable.hasNoError = true
propertyTable.LR_cantExportBecause = nil
end
end
-------------------------------------------------------------------------------
function PhotonodesUploadExportDialogSections.startDialog( propertyTable )
propertyTable:addObserver( 'items', updateExportStatus )
propertyTable:addObserver( 'client_id', updateExportStatus )
propertyTable:addObserver( 'event_code', updateExportStatus )
propertyTable:addObserver( 'gallery_name', updateExportStatus )
updateExportStatus( propertyTable )
end
-------------------------------------------------------------------------------
function PhotonodesUploadExportDialogSections.sectionsForBottomOfDialog( _, propertyTable )
local f = LrView.osFactory()
local bind = LrView.bind
local share = LrView.share
local result = {
{
title = LOC "$$$/Photonodes/ExportDialog/EventSettings=Photonodes Settings",
synopsis = bind { key = 'fullPath', object = propertyTable },
-- f:row {
-- f:static_text {
-- title = LOC "$$$/FtpUpload/ExportDialog/Destination=Destination:",
-- alignment = 'right',
-- width = share 'labelWidth'
-- },
-- LrFtp.makeFtpPresetPopup {
-- factory = f,
-- properties = propertyTable,
-- valueBinding = 'ftpPreset',
-- itemsBinding = 'items',
-- fill_horizontal = 1,
-- },
-- },
f:row {
f:spacer {
width = share 'labelWidth'
},
f:static_text {
title = LOC "$$$/PhotonodesUpload/ExportDialog/ClientId=Client Id:",
alignment = 'right',
width = share 'labelWidth',
},
f:edit_field {
title = LOC "$$$/PhotonodesUpload/ExportDialog/ClientId=Client Id:",
value = bind 'client_id',
enabled = true,
truncation = 'middle',
immediate = true,
fill_horizontal = 1,
},
},
f:row {
f:spacer {
width = share 'labelWidth'
},
f:static_text {
title = LOC "$$$/PhotonodesUpload/ExportDialog/EventCode=Event Code:",
alignment = 'right',
width = share 'labelWidth',
},
f:edit_field {
title = LOC "$$$/PhotonodesUpload/ExportDialog/EventCode=Event Code:",
value = bind 'event_code',
enabled = true,
truncation = 'middle',
immediate = true,
fill_horizontal = 1,
},
},
f:row {
f:spacer {
width = share 'labelWidth'
},
f:static_text {
title = LOC "$$$/PhotonodesUpload/ExportDialog/GalleryName=Gallery Name:",
alignment = 'right',
width = share 'labelWidth',
},
f:edit_field {
title = LOC "$$$/PhotonodesUpload/ExportDialog/GalleryName=Gallery Name:",
value = bind 'gallery_name',
enabled = true,
truncation = 'middle',
immediate = true,
fill_horizontal = 1,
},
},
},
}
return result
end