Only hash valid files, returns 404 when not found
[squasher.git] / templates / edit_user.tpl
1 {extends file='layout.tpl'}
2
3 {block extra_head}
4 {literal}
5 <script>
6         function check_form(wasenabled) {
7                 password1 = document.getElementById("u[user_pass]").value;
8                 password2 = document.getElementById("user_pass2").value;
9                 levelel = document.getElementById("u[user_level]");
10                 level = levelel!=null ? levelel.value : null;
11                 if (password1 != password2)
12                         alert("Passwords typo check failed:\r\nYou must enter the same password twice.");
13                 else if (!wasenabled && level>0 && !password1)
14                         alert("Account was disabled. A new password is required to enable it.");
15                 else if (level==0 && password1)
16                         alert("Disabling the account clears the password. It cannot be set now.");
17                 else
18                         document.usereditform.submit();
19         }
20 </script>
21 {/literal}
22 {/block}
23
24 {block menu}
25 <div class="menu">
26         <div class="menuhead">users</div>
27         {foreach item=user key=muser_id from=$users}
28                 <a {if $muser_id eq $edited_user}class="selected"{/if} href="?tools=edituser&amp;edited_user={$user.id|escape:'url'}">{$user.name|escape}</a>
29         {/foreach}
30         <a href="?tools=edituser" class="tool add">New User</a>
31 </div>
32 {/block}
33
34
35 {block content}
36 <form method=post name=usereditform>
37 <input type=hidden name="tools" value="edituser">
38 <input type=hidden name="edited_user" value="{$edited_user|escape}">
39 <table>
40         <tr>
41                 <td><label for="u[user_name]">Login name:</label>
42                 <td><input name="u[user_name]" id="u[user_name]" value="{$u.name|escape}">
43         <tr>
44                 <td><label for="u[user_pass]">New password:</label>
45                 <td><input type=password name="u[user_pass]" id="u[user_pass]">
46         <tr>
47                 <td><label for="user_pass2">Confirm password:</label>
48                 <td><input type=password name="user_pass2" id="user_pass2">
49         {if $user_level >= 200} {* only super admins see that table row *}
50         <tr>
51                 <td><label for="u[user_level]">Profile:</label>
52                 <td>
53                 {if $user_id == $edited_user}
54                         {$disabled = true}
55                 {else}
56                         {$disabled = false}
57                 {/if}
58                 {if $disabled}
59                         {html_options name="u[user_level]" id="u[user_level]" disabled=disabled options=$user_levels selected=$u.level}
60                 {else}
61                         {html_options name="u[user_level]" id="u[user_level]" options=$user_levels selected=$u.level}
62                 {/if}
63         {/if}
64 </table>
65 </form>
66 <div style='float:left;'>
67         <input type='submit' value='Save' onclick="check_form({$u.enabled});">
68 </div>
69 {/block}
70
71
72 {* vim: set syntax=smarty ts=4 sw=4 sts=4 sr noet: *}