X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Ftemplates%2Fmobile%2Fuser_edit.tpl;h=6bddbb99f77ceb00c98682c0beedb9409de3281c;hb=b14cf15f563feabc7015e3af99ea8cb7a1903dc1;hp=6c5e12e7ca975186d1ef5b4d7948958855e11cb5;hpb=a4ecfaf39d301762cb6332da5d72978b60846092;p=timetracker.git diff --git a/WEB-INF/templates/mobile/user_edit.tpl b/WEB-INF/templates/mobile/user_edit.tpl index 6c5e12e7..6bddbb99 100644 --- a/WEB-INF/templates/mobile/user_edit.tpl +++ b/WEB-INF/templates/mobile/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; } } @@ -111,15 +124,17 @@ function handleClientControl() { {if $show_quota} - {$i18n.form.quota.quota} (%): + {$i18n.label.quota} (%): {$forms.userForm.quota_percent.control} {/if} {if $show_projects} + {$i18n.label.projects}: {$forms.userForm.projects.control} + {/if} {$i18n.label.required_fields}