<script>
+// Prepare an array of available roles. We need it for "is_client" property.
+// It is used to selectively display client selector for client roles.
+roles = new Array();
+var idx = 0;
+{foreach $active_roles as $active_role}
+roles[idx] = new Array({$active_role.id}, '{$active_role.is_client}');
+idx++;
+{/foreach}
+
// Prepare an array of rates.
// Format: project_rates[0] = Array(100, '25.00'), project_rates[1] = Array(120, '30.00'), etc...
// First element = project_id, second element = rate for project. Quotes needed for string representation of rates.
// 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.
function handleClientControl() {
+ var selectedRoleId = document.getElementById("role").value;
var clientControl = document.getElementById("client");
- if ("16" == document.getElementById("role").value)
- clientControl.style.visibility = "visible";
- else
- clientControl.style.visibility = "hidden";
+ var len = roles.length;
+ for (var i = 0; i < len; i++) {
+ if (selectedRoleId == roles[i][0]) {
+ var isClient = roles[i][1];
+ if (isClient == 1)
+ clientControl.style.visibility = "visible";
+ else
+ clientControl.style.visibility = "hidden";
+ break;
+ }
+ }
}
</script>
<td align="right" nowrap>{$i18n.label.email}:</td>
<td>{$forms.userForm.email.control}</td>
</tr>
-{if $user->isManager() && ($user->id != $user_id)}
+{if $user->id != $user_id}
<tr>
<td align="right">{$i18n.form.users.role}:</td>
<td>{$forms.userForm.role.control} {$forms.userForm.client.control}</td>
</tr>
-{/if}
-{* Prohibit deactivating team manager. Deactivating others is ok. *}
-{if $user->canManageTeam() && !($user->isManager() && $user->id == $user_id)}
<tr>
<td align="right">{$i18n.label.status}:</td>
<td>{$forms.userForm.status.control}</td>
</tr>
+{/if}
+{if $user->id == $user_id}
+ <tr>
+ <td align="right">{$i18n.form.users.role}:</td>
+ <td>{$user->role_name} {if $can_swap}<a href="swap_roles.php">{$i18n.form.user_edit.swap_roles}</a>{/if}</td>
+ </tr>
{/if}
<tr>
- <td align="right">{$i18n.form.users.default_rate} (0{$user->decimal_mark}00):</td>
+ <td align="right">{$i18n.form.users.default_rate} (0{$user->getDecimalMark()}00):</td>
<td>{$forms.userForm.rate.control}</td>
</tr>
-{if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
+{if ($smarty.const.MODE_PROJECTS == $user->getTrackingMode() || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->getTrackingMode()) && $show_projects}
+ <tr><td> </td></tr>
<tr valign="top">
<td align="right">{$i18n.label.projects}:</td>
<td>{$forms.userForm.projects.control}</td>