|
|
@ -2,42 +2,58 @@ |
|
|
|
<% include header %> |
|
|
|
<% include header %> |
|
|
|
<% include monaco-editor %> |
|
|
|
<% include monaco-editor %> |
|
|
|
<div class="padding"> |
|
|
|
<div class="padding"> |
|
|
|
<div class="ui <% if (error_info === '') { %>success<% } else { %>error<% } %> message" id="error" <% if (error_info === null) { %>hidden<% } %>> |
|
|
|
<div class="ui <% if (error_info === '') { %>success<% } else { %>error<% } %> message" id="error" |
|
|
|
|
|
|
|
<% if (error_info === null) { %>hidden |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<% if (error_info !== null) { |
|
|
|
<% if (error_info !== null) { |
|
|
|
if (error_info === '') error_info = '修改成功。'; |
|
|
|
if (error_info === '') error_info = '修改成功。'; |
|
|
|
%> |
|
|
|
%> |
|
|
|
<p id="error_info"><%= error_info %></p> |
|
|
|
<p id="error_info"><%= error_info %></p> |
|
|
|
<% } %> |
|
|
|
<% } %> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<form id="form" action="<%= syzoj.utils.makeUrl(['user', edited_user.id, 'edit']) %>" method="post" onsubmit="return check()"> |
|
|
|
<form id="form" action="<%= syzoj.utils.makeUrl(['user', edited_user.id, 'edit']) %>" method="post" |
|
|
|
|
|
|
|
onsubmit="return check()"> |
|
|
|
<div class="ui form"> |
|
|
|
<div class="ui form"> |
|
|
|
<div class="field"> |
|
|
|
<div class="field"> |
|
|
|
<label for="username">用户名</label> |
|
|
|
<label for="username">用户名</label> |
|
|
|
<input type="text" id="username" name="username" value="<%= edited_user.username %>"<% if (!user.allowedManage) { %> readonly<% } %>> |
|
|
|
<input type="text" id="username" name="username" value="<%= edited_user.username %>" |
|
|
|
|
|
|
|
<% if (!user.allowedManage) { %> readonly |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="field"> |
|
|
|
<div class="field"> |
|
|
|
<label for="sex">性别</label> |
|
|
|
<label for="sex">性别</label> |
|
|
|
<select class="ui dropdown" name="sex"> |
|
|
|
<select class="ui dropdown" name="sex"> |
|
|
|
<option value="0" <%= edited_user.sex == 0 ? 'selected': '' %>>其它</option> |
|
|
|
<option value="0" <%= edited_user.sex == 0 ? 'selected' : '' %>>其它</option> |
|
|
|
<option value="1" <%= edited_user.sex == 1 ? 'selected': '' %>>男</option> |
|
|
|
<option value="1" <%= edited_user.sex == 1 ? 'selected' : '' %>>男</option> |
|
|
|
<option value="-1" <%= edited_user.sex == -1 ? 'selected': '' %>>女</option> |
|
|
|
<option value="-1" <%= edited_user.sex == -1 ? 'selected' : '' %>>女</option> |
|
|
|
</select> |
|
|
|
</select> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="field"> |
|
|
|
<div class="field"> |
|
|
|
<label for="email">Email</label> |
|
|
|
<label for="email">Email</label> |
|
|
|
<input class="font-content" type="email" id="email" name="email" value="<%= edited_user.email %>"<% if (!user.allowedManage) { %> readonly<% } %>> |
|
|
|
<input class="font-content" type="email" id="email" name="email" value="<%= edited_user.email %>" |
|
|
|
|
|
|
|
<% if (!user.allowedManage) { %> readonly |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="inline field"> |
|
|
|
<div class="inline field"> |
|
|
|
<label class="ui header">公开 Email</label> |
|
|
|
<label class="ui header">公开 Email</label> |
|
|
|
<div class="ui toggle checkbox"> |
|
|
|
<div class="ui toggle checkbox"> |
|
|
|
<input id="public_email" name="public_email" type="checkbox" <% if (edited_user.public_email) { %> checked<% } %>> |
|
|
|
<input id="public_email" name="public_email" type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.public_email) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label> </label> |
|
|
|
<label> </label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="inline field"> |
|
|
|
<div class="inline field"> |
|
|
|
<label class="ui header">默认显示格式化后的代码(如果可用)</label> |
|
|
|
<label class="ui header">默认显示格式化后的代码(如果可用)</label> |
|
|
|
<div class="ui toggle checkbox"> |
|
|
|
<div class="ui toggle checkbox"> |
|
|
|
<input id="prefer_formatted_code" name="prefer_formatted_code" type="checkbox" <% if (edited_user.prefer_formatted_code) { %> checked<% } %>> |
|
|
|
<input id="prefer_formatted_code" name="prefer_formatted_code" type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.prefer_formatted_code) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label> </label> |
|
|
|
<label> </label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
@ -52,6 +68,11 @@ |
|
|
|
<input type="hidden" name="information"> |
|
|
|
<input type="hidden" name="information"> |
|
|
|
<div class="ui form"> |
|
|
|
<div class="ui form"> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<div class="field"> |
|
|
|
|
|
|
|
<label class="ui header">昵称</label> |
|
|
|
|
|
|
|
<input type="text" placeholder="昵称" name="nickname" value="<%= edited_user.nickname %>" id="nickname"> |
|
|
|
|
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<div class="field"> |
|
|
|
<div class="field"> |
|
|
|
<label class="ui header">密码</label> |
|
|
|
<label class="ui header">密码</label> |
|
|
|
<input type="password" placeholder="原密码(留空则不修改)" name="old_password" id="old_password"> |
|
|
|
<input type="password" placeholder="原密码(留空则不修改)" name="old_password" id="old_password"> |
|
|
@ -70,44 +91,62 @@ |
|
|
|
<div class="inline field"> |
|
|
|
<div class="inline field"> |
|
|
|
<label class="ui header">权限</label> |
|
|
|
<label class="ui header">权限</label> |
|
|
|
<div class="ui toggle disabled checkbox" style="margin-right: 20px; "> |
|
|
|
<div class="ui toggle disabled checkbox" style="margin-right: 20px; "> |
|
|
|
<input disabled="disabled" type="checkbox" <% if (edited_user.is_admin) { %> checked<% } %>> |
|
|
|
<input disabled="disabled" type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.is_admin) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label>全站管理员</label> |
|
|
|
<label>全站管理员</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" data-name="manage_problem" style="margin-right: 20px; "> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" |
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox"<% if (edited_user.privileges.includes('manage_problem')) { %> checked<% } %>> |
|
|
|
data-name="manage_problem" style="margin-right: 20px; "> |
|
|
|
|
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.privileges.includes('manage_problem')) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label>管理题目</label> |
|
|
|
<label>管理题目</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" data-name="manage_problem_tag" style="margin-right: 20px; "> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" |
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox"<% if (edited_user.privileges.includes('manage_problem_tag')) { %> checked<% } %>> |
|
|
|
data-name="manage_problem_tag" style="margin-right: 20px; "> |
|
|
|
|
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.privileges.includes('manage_problem_tag')) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label>管理题目标签</label> |
|
|
|
<label>管理题目标签</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" data-name="manage_user"> |
|
|
|
<div class="ui toggle <% if (!allowedManagePrivilege) { %>disabled <% } %>checkbox checkbox_privilege" |
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox"<% if (edited_user.privileges.includes('manage_user')) { %> checked<% } %>> |
|
|
|
data-name="manage_user"> |
|
|
|
|
|
|
|
<input <% if (!allowedManagePrivilege) { %>disabled="disabled" <% } %>type="checkbox" |
|
|
|
|
|
|
|
<% if (edited_user.privileges.includes('manage_user')) { %> checked |
|
|
|
|
|
|
|
<% } %> |
|
|
|
|
|
|
|
> |
|
|
|
<label>管理用户</label> |
|
|
|
<label>管理用户</label> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<div style="text-align: center; margin-top: 30px; "> |
|
|
|
<div style="text-align: center; margin-top: 30px; "> |
|
|
|
<button id="submit_button" type="submit" class="ui disabled blue labeled icon button"><i class="ui icon edit"></i>修改</button> |
|
|
|
<button id="submit_button" type="submit" class="ui disabled blue labeled icon button"><i |
|
|
|
<a href="<%= syzoj.utils.makeUrl(['user', edited_user.id]) %>" class="ui labeled icon button"><i class="ui icon angle left"></i>返回</a> |
|
|
|
class="ui icon edit"></i>修改 |
|
|
|
|
|
|
|
</button> |
|
|
|
|
|
|
|
<a href="<%= syzoj.utils.makeUrl(['user', edited_user.id]) %>" class="ui labeled icon button"><i |
|
|
|
|
|
|
|
class="ui icon angle left"></i>返回</a> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</form> |
|
|
|
</form> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
var bakDefine = define; |
|
|
|
var bakDefine = define; |
|
|
|
define = undefined; |
|
|
|
define = undefined; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script> |
|
|
|
<script src="<%- lib('blueimp-md5/2.10.0/js/md5.min.js') %>"></script> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
define = bakDefine; |
|
|
|
define = bakDefine; |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<script type="text/javascript"> |
|
|
|
<script type="text/javascript"> |
|
|
|
var editors = { |
|
|
|
var editors = { |
|
|
|
information: { defaultValue: <%- serializejs(edited_user.information) %> }, |
|
|
|
information: {defaultValue: <%- serializejs(edited_user.information) %> }, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
window.onEditorLoaded(function () { |
|
|
|
window.onEditorLoaded(function () { |
|
|
|
for (var name in editors) { |
|
|
|
for (var name in editors) { |
|
|
|
var editor = editors[name]; |
|
|
|
var editor = editors[name]; |
|
|
|
var editorElement = document.getElementById(name); |
|
|
|
var editorElement = document.getElementById(name); |
|
|
@ -116,14 +155,15 @@ window.onEditorLoaded(function () { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$('#submit_button').removeClass('disabled'); |
|
|
|
$('#submit_button').removeClass('disabled'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
function make_md5(tag) { |
|
|
|
function make_md5(tag) { |
|
|
|
if (tag.val()) { |
|
|
|
if (tag.val()) { |
|
|
|
tag.val(md5(tag.val() + "syzoj2_xxx")); |
|
|
|
tag.val(md5(tag.val() + "syzoj2_xxx")); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
function check() { |
|
|
|
|
|
|
|
|
|
|
|
function check() { |
|
|
|
old_password = $("#old_password"); |
|
|
|
old_password = $("#old_password"); |
|
|
|
password1 = $("#password1"); |
|
|
|
password1 = $("#password1"); |
|
|
|
password2 = $("#password2"); |
|
|
|
password2 = $("#password2"); |
|
|
@ -139,7 +179,7 @@ function check() { |
|
|
|
make_md5(password1); |
|
|
|
make_md5(password1); |
|
|
|
make_md5(password2); |
|
|
|
make_md5(password2); |
|
|
|
|
|
|
|
|
|
|
|
<% if (allowedManagePrivilege) { %> |
|
|
|
<% if (allowedManagePrivilege) { %> |
|
|
|
$('.checkbox_privilege').each(function () { |
|
|
|
$('.checkbox_privilege').each(function () { |
|
|
|
if ($(this).checkbox('is checked')) { |
|
|
|
if ($(this).checkbox('is checked')) { |
|
|
|
var name = $(this).data('name'); |
|
|
|
var name = $(this).data('name'); |
|
|
@ -151,14 +191,14 @@ function check() { |
|
|
|
document.getElementById('form').appendChild(elem); |
|
|
|
document.getElementById('form').appendChild(elem); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
<% } %> |
|
|
|
<% } %> |
|
|
|
|
|
|
|
|
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<script> |
|
|
|
<script> |
|
|
|
$(function () { |
|
|
|
$(function () { |
|
|
|
$('.ui.dropdown:not(.simple)').dropdown(); |
|
|
|
$('.ui.dropdown:not(.simple)').dropdown(); |
|
|
|
}); |
|
|
|
}); |
|
|
|
</script> |
|
|
|
</script> |
|
|
|
<% include footer %> |
|
|
|
<% include footer %> |
|
|
|