SAuth/views/admin.tpl

161 lines
4.2 KiB
Smarty
Raw Permalink Normal View History

2019-01-17 18:20:13 +00:00
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="content-type">
<div id='main'>
<h2>Administration page</h2>
<p>Welcome {{user}}</p>
<div id="users">
<h4> Users </h4>
<p>Create new user:</p>
<form action="/admin/user/add" method="post">
<p><label>Username</label> <input type="text" name="username" /></p>
<p><label>Password</label> <input type="password" name="password" /></p>
<button type="submit" style="margin-left: 13em;"> OK </button>
</form>
%for u in luser:
<fieldset>
<legend><b>{{u[0]}}</b></legend>
<b>Roles : </b>
%if u[1].roles:
%for r in u[1].roles:
{{r}} (<a href="/admin/user/{{u[0]}}/del_role/{{r}}">X</a>),
%end
%end
<br/>
<a href="javascript:showhide('user_{{u[0]}}')">Details +/-</a>
<div id="user_{{u[0]}}" style="display:none;">
<!-- Add Role -->
<p>
<form action="/admin/user/{{u[0]}}/add_role" method="post">
<b>Add role : </b>
<select name="role">
<option></option>
%for r in lroles:
<option>{{r}}</option>
%end
</select>
<button type="submit">OK</button>
</form>
</p>
<!-- Change Password -->
<p>
<form action="/admin/user/{{u[0]}}/password" method="post">
<b>Change password : </b>
<input type="password" name="password" />
<button type="submit">OK</button>
</form>
</p>
<!-- Other data -->
%for i in u[1].info :
%if i not in ['password', 'roles']:
<p>
<b>{{i}} :</b> {{u[1].info[i]}}
</p>
%end
%end
<p><a href="/admin/user/{{u[0]}}/rm">Delete user</a></p>
</div>
</fieldset>
%end
<br/>
</div>
<div id='roles'>
<h4> Roles </h4>
<p>Create new role:</p>
<form action="/admin/role/add" method="post">
<p><label>Role</label> <input type="text" name="role" /></p>
<button type="submit" style="margin-left: 13em;"> OK </button>
</form>
<br />
%for r in lroles:
<fieldset>
<legend><b>{{r}}</b></legend>
%for sr in lroles[r]:
{{sr}} (<a href="/admin/role/{{r}}/del_sub/{{sr}}">X</a>),
%end
<br/>
<a href="javascript:showhide('role_{{r}}')">Details +/-</a>
<div id="role_{{r}}" style="display:none;">
<!-- Add Role -->
<p>
<form action="/admin/role/{{r}}/add_sub/" method="post">
<b>Add provided : </b>
<select name="addrole">
<option></option>
%for ri in lroles:
<option>{{ri}}</option>
%end
</select>
<button type="submit">OK</button>
</form>
</p>
<p><a href="/admin/role/{{r}}/rm/">Delete role</a></p>
</div>
</fieldset>
%end
</div>
<div class="clear"></div>
<div id="urls">
<a href="/">index</a> <a href="/logout">logout</a>
</div>
</div>
<script>
function showhide (id) {
element = document.getElementById(id)
if(element.style.display=='block'){
element.style.display = 'none';
}
else{
element.style.display = 'block';
}
}
</script>
<style>
div#roles { width: 45%; float: right}
div#users { width: 45%; float: left}
div#main {
color: #777;
margin: auto;
margin-left: 5em;
font-size: 80%;
}
input {
background: #f8f8f8;
border: 1px solid #777;
margin: auto;
}
input:hover { background: #fefefe}
label {
width: 8em;
float: left;
text-align: right;
margin-right: 0.5em;
display: block
}
div#status {
border: 1px solid #999;
padding: .5em;
margin: 2em;
width: 15em;
-moz-border-radius: 10px;
border-radius: 10px;
}
.clear { clear: both;}
div#urls {
position:absolute;
top:0;
right:1em;
}
</style>