manager_edit.html
3.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{echo:JS::import('form');}
{echo:JS::import('date');}
{echo:JS::import('dialog?skin=brief');}
{echo:JS::import('dialogtools');}
<h1 class="page_title">管理员编辑</h1>
<div id="obj_form" class="form2">
<form action="{url:/admin/manager_save}" method="post" >
{if:isset($id)}<input type="hidden" name="id" id="objId" value="{$id}">{/if}
<dl class="lineD">
<dt><b class="red">*</b> 用户名:</dt>
<dd>
{if:isset($id) && isset($name) }
<label>{$name}</label>
{else:}
<input name="name" type="text" pattern="required" value="{$name}" alt="用户名不能为空" />
<label></label>
{/if}
</dd>
</dl>
<dl class="lineD">
<dt>角色:</dt>
<dd>
<select name="roles" id="">
<option value="administrator">超级管理员</option>
{query:name=roles}
<option value="{$item['id']}">{$item['name']}</option>
{/query}
</select>
</dd>
</dl>
{if: isset($id) && isset($password)}
<dl class="lineD">
<dt>密码:</dt>
<dd>
<label><a href="javascript:;" onclick="password_dialog()">修改密码</a></label>
</dd>
</dl>
{else:}
<dl class="lineD">
<dt><b class="red">*</b>密码:</dt>
<dd>
<input name="password" type="password" bind="repassword" pattern=".{6,}" value="" alt="密码必需大于6位">
<label></label>
</dd>
</dl><dl class="lineD">
<dt><b class="red">*</b>确认密码:</dt>
<dd>
<input name="repassword" type="password" bind="password" pattern=".{6,}" value="" alt="密码必需大于6位">
<label></label>
</dd>
</dl>
{/if}
<div style="text-align:center"><input type="submit" value="提交" class="button"> <input type="reset" value="重置" class="button"></div>
</form>
</div>
<div id="password_info" style="display: none;width:520px">
<form class="form2" callback="changePassword">
<dl class="lineD">
<dt><b class="red">*</b>密码:</dt>
<dd>
<input name="password" type="password" id="password" bind="repassword" pattern=".{6,}">
<label>密码必需大于6位</label>
</dd>
</dl><dl class="lineD">
<dt><b class="red">*</b>确认密码:</dt>
<dd>
<input name="repassword" type="password" id="repassword" bind="password" pattern=".{6,}" >
<label>密码必需大于6位</label>
</dd>
</dl>
<div style="text-align:center"><input type="submit" value="提交" class="button"> <input type="reset" value="重置" class="button"></div>
</form>
</div>
<script type="text/javascript">
var form = new Form();
form.setValue('roles','{$roles}');
function password_dialog(){
art.dialog({id:'password_dialog',title:'密码设定:',content:document.getElementById('password_info')});
}
function changePassword(e){
var password = $("#password").val();
var repassword = $("#repassword").val();
var id = $("#objId").val();
if(!e){
$.post("{url:/admin/manager_password}",{id:id,password:password,repassword:repassword},function(data){
if(data['status']=="success")
art.dialog.tips("<p class='success'>密码修改成功!</p>");
else art.dialog.tips("<p class='"+data['status']+"'>"+data['msg']+"</p>");
art.dialog({id:"password_dialog"}).close();
},"json");
}
return false;
}
</script>