X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Ftemplates%2Freports.tpl;h=95b4a43642ed262ccce154f79b7eb957719b7911;hb=3297bc03f58074f5b688d867f3477e6af47d73de;hp=7e4c90bdc7a89d0446ff895e987c7a73d8575739;hpb=9a23a8c0a51b7ec38a96f525484134f3cb85dc7e;p=timetracker.git
diff --git a/WEB-INF/templates/reports.tpl b/WEB-INF/templates/reports.tpl
index 7e4c90bd..95b4a436 100644
--- a/WEB-INF/templates/reports.tpl
+++ b/WEB-INF/templates/reports.tpl
@@ -27,7 +27,7 @@ var idx = 0;
idx++;
{/foreach}
-
+
// empty_label is the mandatory top option in the tasks dropdown.
empty_label = '{$i18n.dropdown.all|escape:'javascript'}';
@@ -35,13 +35,13 @@ empty_label = '{$i18n.dropdown.all|escape:'javascript'}';
function inArray(needle, haystack) {
var length = haystack.length;
for(var i = 0; i < length; i++) {
- if(haystack[i] == needle) return true;
+ if(haystack[i] == needle) return true;
}
return false;
}
-
+
// The fillTaskDropdown function populates the task combo box with
-// tasks associated with a selected project_id.
+// tasks associated with a selected project_id.
function fillTaskDropdown(project_id) {
var str_task_ids;
// Get a string of comma-separated task ids.
@@ -53,11 +53,11 @@ function fillTaskDropdown(project_id) {
var task_ids = new Array(); // Array of task ids.
task_ids = str_task_ids.split(",");
}
-
+
var dropdown = document.getElementById("task");
// Determine previously selected item.
var selected_item = dropdown.options[dropdown.selectedIndex].value;
-
+
// Remove existing content.
dropdown.length = 0;
// Add mandatory top option.
@@ -77,7 +77,7 @@ function fillTaskDropdown(project_id) {
dropdown.options[dropdown_idx+1] = new Option(task_names[i][1], task_names[i][0]);
dropdown_idx++;
}
- }
+ }
}
// If a previously selected item is still in dropdown - select it.
@@ -95,14 +95,14 @@ var assigned_projects = new Array();
{if $assigned_projects}
{foreach $assigned_projects as $user_id => $projects}
assigned_projects[{$user_id}] = new Array();
- {if $projects}
- {foreach $projects as $idx => $project_id}
- assigned_projects[{$user_id}][{$idx}] = {$project_id};
- {/foreach}
+ {if $projects}
+ {foreach $projects as $idx => $project_id}
+ assigned_projects[{$user_id}][{$idx}] = {$project_id};
+ {/foreach}
{/if}
{/foreach}
{/if}
-
+
// selectAssignedUsers is called when a project is changed in project dropdown.
// It selects users on the form who are assigned to this project.
function selectAssignedUsers(project_id) {
@@ -133,23 +133,36 @@ function selectAssignedUsers(project_id) {
}
}
-// handleCheckboxes - unmarks and disables 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.
+// handleCheckboxes - unmarks and hides the "Totals only" checkbox when
+// "no grouping" is selected in the associated group by dropdowns.
function handleCheckboxes() {
var totalsOnlyCheckbox = document.getElementById("chtotalsonly");
- if ("no_grouping" == document.getElementById("group_by").value) {
- // Unmark and disable the "Totals only" checkbox.
+ var totalsOnlyLabel = document.getElementById("totals_only_label");
+ var groupBy1 = document.getElementById("group_by1");
+ var groupBy2 = document.getElementById("group_by2");
+ var groupBy3 = document.getElementById("group_by3");
+ var grouping = false;
+ if ((groupBy1 != null && "no_grouping" != groupBy1.value) ||
+ (groupBy2 != null && "no_grouping" != groupBy2.value) ||
+ (groupBy3 != null && "no_grouping" != groupBy3.value)) {
+ grouping = true;
+ }
+ if (grouping) {
+ // Show the "Totals only" checkbox.
+ totalsOnlyCheckbox.style.visibility = "visible";
+ totalsOnlyLabel.style.visibility = "visible";
+ } else {
+ // Unmark and hide the "Totals only" checkbox.
totalsOnlyCheckbox.checked = false;
- totalsOnlyCheckbox.disabled = true;
- } else
- totalsOnlyCheckbox.disabled = false;
+ totalsOnlyCheckbox.style.visibility = "hidden";
+ totalsOnlyLabel.style.visibility = "hidden";
+ }
}
{$forms.reportForm.open}