X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Ftemplates%2Fuser_edit.tpl;h=2bba1842d81231db1aaf0beff06b753d67ae0ab3;hb=b14cf15f563feabc7015e3af99ea8cb7a1903dc1;hp=b1026f2c1cd30650b5eb84dab9fb0bce75a80374;hpb=448c3e07930dbf902c97c93f252a474cb0931e23;p=timetracker.git diff --git a/WEB-INF/templates/user_edit.tpl b/WEB-INF/templates/user_edit.tpl index b1026f2c..2bba1842 100644 --- a/WEB-INF/templates/user_edit.tpl +++ b/WEB-INF/templates/user_edit.tpl @@ -51,19 +51,32 @@ function setRate(element) { } } -// handleClientControl - controls visibility of the client dropdown depending on the selected user role. -// We need to show it only when the "Client" user role is selected. +// handleClientControl - controls visibility of the client dropdown depending on the selected user role, +// also hides and unselects projects when "Client" user role is selected. function handleClientControl() { var selectedRoleId = document.getElementById("role").value; var clientControl = document.getElementById("client"); + var projectsControl = document.getElementById("projects_control"); + var len = roles.length; for (var i = 0; i < len; i++) { if (selectedRoleId == roles[i][0]) { var isClient = roles[i][1]; - if (isClient == 1) + if (isClient == 1) { clientControl.style.visibility = "visible"; - else + projectsControl.style.display = "none"; + + // Uncheck all project checkboxes. + var checkboxes = document.getElementsByName("projects[]"); + var j; + for (j = 0; j < checkboxes.length; j++) { + checkboxes[j].checked = false; + } + } else { + clientControl.value = ""; clientControl.style.visibility = "hidden"; + projectsControl.style.display = ""; + } break; } } @@ -117,16 +130,18 @@ function handleClientControl() { {if $show_quota} - {$i18n.form.quota.quota} (%): - {$forms.userForm.quota_percent.control} + {$i18n.label.quota} (%): + {$forms.userForm.quota_percent.control} {$i18n.label.what_is_it} {/if} {if $show_projects} +   {$i18n.label.projects}: {$forms.userForm.projects.control} + {/if} {$i18n.label.required_fields}