Initial repo created
[timetracker.git] / WEB-INF / templates / user_add.tpl
1 <script>
2 // The setDefaultRate function sets / unsets default rate for a project
3 // when a corresponding checkbox is ticked.
4 function setDefaultRate(element) {
5   var default_rate = document.userForm.rate.value;
6   if (default_rate == '') {
7     // No default rate, nothing to do!
8     return;
9   }
10   // Iterate through elements of the form to find and set the project rate. 
11   for (var i = 0; i < userForm.elements.length; i++) {
12     if ((userForm.elements[i].type == 'text') && (userForm.elements[i].name == ('rate_'+element.value))) {
13       if (element.checked) {
14         userForm.elements[i].value = default_rate;
15       } else {
16         userForm.elements[i].value = '';
17       }
18       break; // Element is found and set, nothing more to do, break out of the loop.
19     }
20   }
21 }
22
23 // handleClientControl - controls visibility of the client dropdown depending on the selected user role.
24 // We need to show it only when the "Client" user role is selected.
25 function handleClientControl() {
26   var clientControl = document.getElementById("client");
27   if ("16" == document.getElementById("role").value)
28     clientControl.style.visibility = "visible";
29   else
30     clientControl.style.visibility = "hidden";
31 }
32 </script>
33
34 {$forms.userForm.open}
35 <table cellspacing="4" cellpadding="7" border="0">
36   <table cellspacing="1" cellpadding="2" border="0">
37     <tr>
38       <td align="right">{$i18n.label.person_name} (*):</td>
39       <td>{$forms.userForm.name.control}</td>
40     </tr>
41     <tr>
42       <td align="right">{$i18n.label.login} (*):</td>
43       <td>{$forms.userForm.login.control}</td>
44     </tr>
45 {if !$auth_external}
46     <tr>
47       <td align="right">{$i18n.label.password} (*):</td>
48       <td>{$forms.userForm.pas1.control}</td>
49     </tr>
50     <tr>
51       <td align="right">{$i18n.label.confirm_password} (*):</td>
52       <td>{$forms.userForm.pas2.control}</td>
53     </tr>
54 {/if}
55     <tr>
56       <td align="right" nowrap>{$i18n.label.email}:</td>
57       <td>{$forms.userForm.email.control}</td>
58     </tr>
59 {if $user->isManager()}
60     <tr>
61       <td align="right">{$i18n.form.users.role}:</td>
62       <td>{$forms.userForm.role.control} {$forms.userForm.client.control}</td>
63     </tr>
64 {/if}
65     <tr>
66       <td align="right">{$i18n.form.users.default_rate}&nbsp;(0{$user->decimal_mark}00):</td>
67       <td>{$forms.userForm.rate.control}</td>
68     </tr>
69 {if ($smarty.const.MODE_PROJECTS == $user->tracking_mode || $smarty.const.MODE_PROJECTS_AND_TASKS == $user->tracking_mode)}
70     <tr valign="top">
71       <td align="right">{$i18n.label.projects}:</td>
72       <td>{$forms.userForm.projects.control}</td>
73     </tr>
74     <tr>
75       <td colspan="2" align="center">{$i18n.label.required_fields}</td>
76     </tr>
77 {/if}
78     <tr>
79       <td colspan="2" align="center" height="50">{$forms.userForm.btn_submit.control}</td>
80     </tr>
81   </table>
82 </table>
83 {$forms.userForm.close}