From bcbff1b505f315c05b45e5a2eaa707ed574d1a9a Mon Sep 17 00:00:00 2001 From: Nik Okuntseff Date: Sun, 28 Oct 2018 16:14:19 +0000 Subject: [PATCH] More work in progress on multiple group by. --- WEB-INF/templates/reports.tpl | 15 +++++++++------ reports.php | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl index 290e2249..9c8221ad 100644 --- a/WEB-INF/templates/reports.tpl +++ b/WEB-INF/templates/reports.tpl @@ -133,17 +133,20 @@ function selectAssignedUsers(project_id) { } } -// handleCheckboxes - unmarks and disables the "Totals only" checkbox when +// handleCheckboxes - unmarks and hides the "Totals only" checkbox when // "no grouping" is selected in the associated dropdown. -// In future we need to improve this function and hide not relevant elements completely. function handleCheckboxes() { var totalsOnlyCheckbox = document.getElementById("chtotalsonly"); + var totalsOnlyLabel = document.getElementById("totals_only_label"); if ("no_grouping" == document.getElementById("group_by").value) { // Unmark and disable the "Totals only" checkbox. totalsOnlyCheckbox.checked = false; - totalsOnlyCheckbox.disabled = true; - } else - totalsOnlyCheckbox.disabled = false; + totalsOnlyCheckbox.style.visibility = "hidden"; + totalsOnlyLabel.style.visibility = "hidden"; + } else { + totalsOnlyCheckbox.style.visibility = "visible"; + totalsOnlyLabel.style.visibility = "visible"; + } } @@ -304,7 +307,7 @@ function handleCheckboxes() { {$forms.reportForm.group_by3.control} - + diff --git a/reports.php b/reports.php index ae5c9371..dae0c180 100644 --- a/reports.php +++ b/reports.php @@ -235,8 +235,8 @@ if ($custom_fields && $custom_fields->fields[0] && $custom_fields->fields[0]['ty $group_by_options_size = sizeof($group_by_options); $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by','data'=>$group_by_options)); if (defined('MULTIPLE_GROUP_BY_DEBUG') && isTrue(MULTIPLE_GROUP_BY_DEBUG)) { - if ($group_by_options_size > 2) $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by2','data'=>$group_by_options)); - if ($group_by_options_size > 3) $form->addInput(array('type'=>'combobox','onchange'=>'handleCheckboxes();','name'=>'group_by3','data'=>$group_by_options)); + if ($group_by_options_size > 2) $form->addInput(array('type'=>'combobox','name'=>'group_by2','data'=>$group_by_options)); + if ($group_by_options_size > 3) $form->addInput(array('type'=>'combobox','name'=>'group_by3','data'=>$group_by_options)); } $form->addInput(array('type'=>'checkbox','name'=>'chtotalsonly')); -- 2.20.1