From 9bacdbc0d4bdf21bc0d5372417c585b456ad9c15 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 28 Sep 2019 13:21:21 +0200 Subject: [PATCH] Fix calendar/tasklist edit form in Elastic when using database driver --- plugins/calendar/drivers/calendar_driver.php | 14 ++++++++------ plugins/tasklist/drivers/tasklist_driver.php | 15 +++++++++------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/plugins/calendar/drivers/calendar_driver.php b/plugins/calendar/drivers/calendar_driver.php index 1cbeab02..0a745a65 100644 --- a/plugins/calendar/drivers/calendar_driver.php +++ b/plugins/calendar/drivers/calendar_driver.php @@ -592,14 +592,16 @@ abstract class calendar_driver */ public function calendar_form($action, $calendar, $formfields) { - $html = ''; - foreach ($formfields as $field) { - $html .= html::div('form-section', - html::label($field['id'], $field['label']) . - $field['value']); + $table = new html_table(array('cols' => 2, 'class' => 'propform')); + + foreach ($formfields as $col => $colprop) { + $label = !empty($colprop['label']) ? $colprop['label'] : $rcmail->gettext("$domain.$col"); + + $table->add('title', html::label($colprop['id'], rcube::Q($label))); + $table->add(null, $colprop['value']); } - return $html; + return $table->show(); } /** diff --git a/plugins/tasklist/drivers/tasklist_driver.php b/plugins/tasklist/drivers/tasklist_driver.php index df68d005..11c8578e 100644 --- a/plugins/tasklist/drivers/tasklist_driver.php +++ b/plugins/tasklist/drivers/tasklist_driver.php @@ -423,18 +423,21 @@ abstract class tasklist_driver * @param string The action called this form * @param array Tasklist properties * @param array List with form fields to be rendered + * * @return string HTML content of the form */ public function tasklist_edit_form($action, $list, $formfields) { - $html = ''; - foreach ($formfields as $field) { - $html .= html::div('form-section', - html::label($field['id'], $field['label']) . - $field['value']); + $table = new html_table(array('cols' => 2, 'class' => 'propform')); + + foreach ($formfields as $col => $colprop) { + $label = !empty($colprop['label']) ? $colprop['label'] : $rcmail->gettext("$domain.$col"); + + $table->add('title', html::label($colprop['id'], rcube::Q($label))); + $table->add(null, $colprop['value']); } - return $html; + return $table->show(); } /**