bouffeatulm/tpl/default/edit_users.html

95 lines
5.9 KiB
HTML
Raw Normal View History

{include="header"}
{if condition="$view == 'list_users'"}
<h2>List of users</h2>
2013-08-30 20:07:52 +02:00
<p class="center">You can also <a href="?do=add_user">add a user</a>.</p>
<table id="edit_users">
<tr>
<th>Id</th>
<th>Login</th>
<th>Display Name</th>
<th>E-mail address</th>
<th>Is admin ?</th>
<th>Edit</th>
<th>Delete</th>
</tr>
{loop="users"}
<tr>
<td>{$value->getId()}</td>
<td>{$value->getLogin()}</td>
<td>{$value->getDisplayName()}</td>
<td>{$value->getEmail()}</td>
<td>{$value->getAdmin() ? "Yes" : "No"}</td>
<td><a href="index.php?do=edit_users&user_id={$value->getId()}">Edit</a></td>
<td>{if condition="$value->getId() != $current_user->getId()"}<a href="index.php?do=delete_user&amp;user_id={$value->getId()}&amp;token={$token}">Delete</a>{/if}</td>
</tr>
{/loop}
</table>
{elseif condition="$view == 'edit_user'"}
2013-08-25 23:06:47 +02:00
<h2>{$user_id != -1 ? 'Edit' : 'Add'} a user</h2>
<form method="post" action="index.php?do={$user_id != -1 ? 'edit_users' : 'add_user'}" id="edit_user_form">
<p>
2014-08-30 23:39:41 +02:00
<label for="login" class="label-block">Login: </label><input type="text" name="login" id="login" {if condition="$login_post != ''"} value="{$login_post}" {else} {$user_id != -1 ? 'value="'.$user_data->getLogin().'"' : ''} {/if}/>
</p>
<p>
2014-08-30 23:39:41 +02:00
<label for="display_name" class="label-block">Displayed name (optionnal): </label><input type="text" name="display_name" id="display_name" {if condition="$display_name_post != ''"} value="{$display_name_post}" {else} {$user_id != -1 ? 'value="'.$user_data->getDisplayName().'"' : ''} {/if}/>
</p>
<p>
2014-08-30 23:39:41 +02:00
<label for="email" class="label-block">E-mail address (optionnal): </label><input type="text" name="email" id="email" {if condition="$email_post != ''"} value="{$email_post}" {else} {$user_id != -1 ? 'value="'.$user_data->getEmail().'"' : ''} {/if}/>
</p>
<p>
<label for="notifications" class="label-block">Notifications for </label>
<select name="notifications" id="notifications">
<option value="1" {if condition="$user_id != -1 && $user_data->getNotifications() == 1"}selected="selected"{/if}>nothing.</option>
<option value="2" {if condition="$user_id != -1 && $user_data->getNotifications() == 2"}selected="selected"{/if}>global paybacks only.</option>
<option value="3" {if condition="$user_id != -1 && $user_data->getNotifications() == 3"}selected="selected"{/if}>everything involving this user.</option>
</select>
</p>
<p>
2014-08-30 23:39:41 +02:00
<label for="password" class="label-block">Password: </label><input type="password" name="password" id="password"/> <a href="" onclick="toggle_password('password'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a>
{if condition="$user_id != -1"}
2014-08-30 23:39:41 +02:00
<br/><em>Note:</em> Leave blank this field if you don't want to edit password.
{/if}
</p>
<p id="edit_user_admin_rights">
Give admin rights to this user ?<br/>
<input type="radio" id="admin_yes" value="1" name="admin" {if condition="$admin_post == 1 || ($admin_post == -1 && $user_id != -1 && $user_data->getAdmin())"} checked{/if}/><label for="admin_yes">Yes</label><br/>
<input type="radio" id="admin_no" value="0" name="admin" {if condition="$admin_post == 0 || ($admin_post == -1 && ($user_id == -1 || !$user_data->getAdmin()))"} checked{/if}/><label for="admin_no">No</label>
</p>
<p class="center">
<input type="submit" value="{$user_id != -1 ? 'Edit' : 'Add'}"/>
{if condition="$user_id != -1"}<input type="hidden" name="user_id" value="{$user_id}"/>{/if}
<input type="hidden" name="token" value="{$token}"/>
</p>
</form>
{if condition="$user_id != -1"}
<h2>Personal token for this user</h2>
2014-08-30 23:39:41 +02:00
<p>The personal token for this user to be used with the API is: {$user_data->getJsonToken()}.<br/>If you think it might be compromised, you can <a href="index.php?do=new_token&user_id={$user_data->getId()}&amp;token={$token}">generate a new one</a>.</p>
{/if}
{elseif condition="$view == 'password'"}
<h2>Edit your password</h2>
<form method="post" action="index.php?do=password" id="edit_password_form">
2014-08-30 23:39:41 +02:00
<p><label for="password" class="label-block">New password: </label><input type="password" id="password" name="password"/> <a href="" onclick="toggle_password('password'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a></p>
<p><label for="password_confirm" class="label-block">Confirm new password: </label><input type="password" id="password_confirm" name="password_confirm"/> <a href="" onclick="toggle_password('password_confirm'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a></p>
<p>
2014-08-30 23:39:41 +02:00
<label for="email" class="label-block">E-mail address: </label><input type="text" name="email" id="email" value="{$current_user->getEmail()}"/>
</p>
<p>
<label for="notifications" class="label-block">Notifications for </label>
<select name="notifications" id="notifications">
<option value="1" {if condition="$current_user->getNotifications() == 1"}selected="selected"{/if}>nothing.</option>
<option value="2" {if condition="$current_user->getNotifications() == 2"}selected="selected"{/if}>global paybacks only.</option>
<option value="3" {if condition="$current_user->getNotifications() == 3"}selected="selected"{/if}>everything involving you.</option>
</select>
</p>
2014-08-30 23:39:41 +02:00
<p><em>Note:</em> Leave blank the password fields if you don't want to edit password.</p>
<p class="center"><input type="submit" value="Update"/><input type="hidden" name="token" value="{$token}"</p>
</form>
<h2>Your personal token to use the API</h2>
2014-08-30 23:39:41 +02:00
<p>Your personal token to use the API is: {$json_token}.<br/>If you think it might be compromised, you can <a href="index.php?do=new_token&amp;token={$token}">generate a new one</a>.</p>
{/if}
{include="footer"}