<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.37.4743 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.37.4744 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
}
}
-// 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 {
- clientControl.value = '';
+ 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;
}
</tr>
{/if}
{if $show_projects}
+<tbody id="projects_control">
<tr valign="top">
<td align="right">{$i18n.label.projects}:</td>
<td>{$forms.userForm.projects.control}</td>
<tr>
<td colspan="2" align="center">{$i18n.label.required_fields}</td>
</tr>
+</tbody>
{/if}
<tr>
<td colspan="2" align="center" height="50">{$forms.userForm.btn_submit.control}</td>
}
}
-// 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 {
- clientControl.value = '';
+ 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;
}
</tr>
{/if}
{if $show_projects}
+<tbody id="projects_control">
<tr valign="top">
<td align="right">{$i18n.label.projects}:</td>
<td>{$forms.userForm.projects.control}</td>
</tr>
+</tbody>
{/if}
<tr>
<td colspan="2" align="center">{$i18n.label.required_fields}</td>
// Create projects table.
$table = new Table('projects');
$table->setIAScript('setDefaultRate');
-$table->setTableOptions(array('width'=>'100%','cellspacing'=>'1','cellpadding'=>'3','border'=>'0'));
+$table->setTableOptions(array('width'=>'250','cellspacing'=>'1','cellpadding'=>'3','border'=>'0'));
$table->setRowOptions(array('valign'=>'top','class'=>'tableHeader'));
$table->setData($projects);
$table->setKeyField('id');
// Create projects table.
$table = new Table('projects');
$table->setIAScript('setRate');
-$table->setTableOptions(array('width'=>'100%','cellspacing'=>'1','cellpadding'=>'3','border'=>'0'));
+$table->setTableOptions(array('width'=>'250','cellspacing'=>'1','cellpadding'=>'3','border'=>'0'));
$table->setRowOptions(array('valign'=>'top','class'=>'tableHeader'));
$table->setData($projects);
$table->setKeyField('id');