From d5d0248a58dd3832e81ed41daaeeb80a01af0bb6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Thu, 9 Nov 2017 11:29:48 +0100 Subject: [PATCH] Support predefined values for "Add Storage" dialog forms (Bifrost#T55341) --- plugins/kolab_files/kolab_files.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/plugins/kolab_files/kolab_files.js b/plugins/kolab_files/kolab_files.js index 5941d942..47817f4b 100644 --- a/plugins/kolab_files/kolab_files.js +++ b/plugins/kolab_files/kolab_files.js @@ -552,13 +552,21 @@ function kolab_files_folder_mount_dialog() rcmail.drivers_list_initialized = true; $('td.source', dialog).each(function() { - $(this).click(function() { + var td = $(this), + id = td.attr('id').replace('source-', ''), + meta = rcmail.env.external_sources[id]; + + $.each(meta.form_values || [], function(i, v) { + td.find('#source-' + id + '-' + i).val(v); + }); + + td.click(function() { $('td.selected', dialog).removeClass('selected'); dialog.find('.driverform').hide(); $(this).addClass('selected').find('.driverform').show(); $('input[type="radio"]', this).prop('checked', true); - }); - }); + }); + }); } args.button_classes = ['mainaction'];