Fix some labels in import/export dialogs not pointing to inputs/selects

This commit is contained in:
Aleksander Machniak 2019-02-21 11:22:31 +00:00
parent 7288bac122
commit f5c586cf7b
3 changed files with 22 additions and 8 deletions

View file

@ -513,6 +513,7 @@ class calendar_ui
}
$input = new html_inputfield(array(
'id' => 'importfile',
'type' => 'file',
'name' => '_data',
'size' => $attrib['uploadfieldsize'],
@ -533,7 +534,7 @@ class calendar_ui
$html = html::div('form-section form-group row',
html::label(array('class' => 'col-sm-4 col-form-label', 'for' => 'importfile'), rcube::Q($this->rc->gettext('importfromfile')))
. html::div('col-sm-8', $input->show()
. html::div('hint', $this->rc->gettext(array('id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))))
. html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))))
);
$html .= html::div('form-section form-group row',

View file

@ -862,6 +862,16 @@ function rcube_tasklist_ui(settings)
loadstate.lists = active_lists();
}
var init_cloned_form = function(form) {
// update element IDs after clone
$('select,input,label', form).each(function() {
if (this.htmlFor)
this.htmlFor += '-clone';
else if (this.id)
this.id += '-clone';
});
}
// open a dialog to upload an .ics file with tasks to be imported
this.import_tasks = function(tasklist)
{
@ -876,6 +886,8 @@ function rcube_tasklist_ui(settings)
if (tasklist)
$('#task-import-list').val(tasklist);
init_cloned_form(form);
buttons[rcmail.gettext('import', 'tasklist')] = function() {
if (form && form.elements._data.value) {
rcmail.async_upload_form(form, 'import', function(e) {
@ -939,22 +951,22 @@ function rcube_tasklist_ui(settings)
this.export_tasks = function()
{
// close show dialog first
var $dialog = $("#tasksexport").clone(true).removeClass('uidialog'),
var list, $dialog = $("#tasksexport").clone(true).removeClass('uidialog'),
form = $dialog.find('form').get(0),
buttons = {};
if ($dialog.is(':ui-dialog'))
$dialog.dialog('close');
$("#task-export-list").val('');
list = $("#task-export-list").val('');
init_cloned_form(form);
buttons[rcmail.gettext('export', 'tasklist')] = function() {
var data = {},
source = $('#task-export-list').val(),
form_elements = $('select, input', form);
var data = {}, form_elements = $('select, input', form);
// "current view" export, use hidden form to POST task IDs
if (source === '') {
if (list.val() === '') {
var cache = {}, tasks = [], inputs = [],
postform = $('#tasks-export-form-post');

View file

@ -500,6 +500,7 @@ class tasklist_ui
}
$input = new html_inputfield(array(
'id' => 'importfile',
'type' => 'file',
'name' => '_data',
'size' => $attrib['uploadfieldsize'],
@ -509,7 +510,7 @@ class tasklist_ui
$html = html::div('form-section form-group row',
html::label(array('class' => 'col-sm-4 col-form-label', 'for' => 'importfile'), rcube::Q($this->rc->gettext('importfromfile')))
. html::div('col-sm-8', $input->show()
. html::div('hint', $this->rc->gettext(array('id' => 'importfile', 'name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))))
. html::div('hint', $this->rc->gettext(array('name' => 'maxuploadsize', 'vars' => array('size' => $max_filesize)))))
);
$html .= html::div('form-section form-group row',