refactor(web/super_manage): super_manage v2 (#7)
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-10-20 21:34:00 +08:00 committed by GitHub
commit a256309d5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1183 additions and 838 deletions

View File

@ -11,5 +11,5 @@
become404Page(); become404Page();
} }
redirectTo(HTML::blog_url($blog['poster'], '/post/'.$_GET['id'])); redirectTo(HTML::blog_url($blog['poster'], '/post/'.$_GET['id'] . ($_GET['sub'] ?: '')));
?> ?>

File diff suppressed because it is too large Load Diff

View File

@ -341,7 +341,7 @@ EOD);
</div> </div>
<?php if (isSuperUser($myUser) && $user['username'] != $myUser['username']): ?> <?php if (isSuperUser($myUser) && $user['username'] != $myUser['username']): ?>
<div class="alert alert-warning mb-0" role="alert"> <div class="alert alert-warning mb-0" role="alert">
如需重置其他用户的密码,请前往 <a href="/super-manage/users" class="alert-link">系统管理</a> 页面操作。 如需重置其他用户的密码,请前往 <a href="/super_manage/users" class="alert-link">系统管理</a> 页面操作。
</div> </div>
<?php endif ?> <?php endif ?>
@ -410,6 +410,20 @@ EOD);
<?php else: ?> <?php else: ?>
<fieldset disabled> <fieldset disabled>
<?php endif ?> <?php endif ?>
<div class="mb-3">
<span>
<?= UOJLocale::get('user::user group') ?>
</span>
<span class="d-inline-block ms-3">
<?php if ($user['usergroup'] == 'S'): ?>
<?= UOJLocale::get('user::super user') ?>
<?php elseif ($user['usergroup'] == 'B'): ?>
<?= UOJLocale::get('user::banned user') ?>
<?php else: ?>
<?= UOJLocale::get('user::normal user') ?>
<?php endif ?>
</span>
</div>
<div class="input-group mb-3"> <div class="input-group mb-3">
<label for="input-user_type" class="form-label"> <label for="input-user_type" class="form-label">
<?= UOJLocale::get('user::user type') ?> <?= UOJLocale::get('user::user type') ?>

View File

@ -111,7 +111,7 @@ EOD;
<label for="input-$name" class="col-sm-2 control-label">$label_text</label> <label for="input-$name" class="col-sm-2 control-label">$label_text</label>
<div class="col-sm-3"> <div class="col-sm-3">
<input type="$type" class="form-control" name="$name" id="input-$name" value="$default_value" /> <input type="$type" class="form-control" name="$name" id="input-$name" value="$default_value" />
<span class="help-block" id="help-$name"></span> <span class="help-block invalid-feedback" id="help-$name"></span>
</div> </div>
</div> </div>
EOD; EOD;
@ -197,7 +197,7 @@ EOD;
<label for="input-$name" class="col-sm-2 control-label">$label_text</label> <label for="input-$name" class="col-sm-2 control-label">$label_text</label>
<div class="col-sm-10"> <div class="col-sm-10">
<textarea class="form-control" name="$name" id="input-$name">$default_value</textarea> <textarea class="form-control" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span> <span class="help-block invalid-feedback" id="help-$name"></span>
</div> </div>
</div> </div>
EOD; EOD;
@ -210,7 +210,7 @@ EOD;
<div id="div-$name" class="form-group"> <div id="div-$name" class="form-group">
<label for="input-$name" class="control-label">$label_text</label> <label for="input-$name" class="control-label">$label_text</label>
<textarea class="form-control" name="$name" id="input-$name">$default_value</textarea> <textarea class="form-control" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span> <span class="help-block invalid-feedback" id="help-$name"></span>
</div> </div>
EOD; EOD;
$this->add($name, $html, $validator_php, $validator_js, $no_val); $this->add($name, $html, $validator_php, $validator_js, $no_val);
@ -270,7 +270,7 @@ EOD;
<div id="div-$name"> <div id="div-$name">
<label for="input-$name" class="control-label">$label_text</label> <label for="input-$name" class="control-label">$label_text</label>
<textarea class="ckeditor" name="$name" id="input-$name">$default_value</textarea> <textarea class="ckeditor" name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span> <span class="help-block invalid-feedback" id="help-$name"></span>
</div> </div>
EOD; EOD;
$this->add($name, $html, $validator_php, $validator_js); $this->add($name, $html, $validator_php, $validator_js);
@ -333,7 +333,7 @@ EOD
<div id="div-$name"> <div id="div-$name">
<label for="input-$name" class="control-label">$label_text</label> <label for="input-$name" class="control-label">$label_text</label>
<textarea name="$name" id="input-$name">$default_value</textarea> <textarea name="$name" id="input-$name">$default_value</textarea>
<span class="help-block" id="help-$name"></span> <span class="help-block invalid-feedback" id="help-$name"></span>
</div> </div>
<script type="text/javascript"> <script type="text/javascript">
$('#input-$name').slide_editor(); $('#input-$name').slide_editor();
@ -794,7 +794,7 @@ EOD;
<button type="button" class="btn btn-primary" style="width:100px; !important" onclick="$('#input-{$name}').click();"><span class="glyphicon glyphicon-folder-open"></span> $browse_text</button> <button type="button" class="btn btn-primary" style="width:100px; !important" onclick="$('#input-{$name}').click();"><span class="glyphicon glyphicon-folder-open"></span> $browse_text</button>
</span> </span>
</div> </div>
<span class="help-block" id="help-{$name}"></span> <span class="help-block invalid-feedback" id="help-{$name}"></span>
</div> </div>
EOD; EOD;

View File

@ -88,7 +88,7 @@ function getUserLink($username) {
if ($realname == "") { if ($realname == "") {
return '<span class="uoj-username">'.$username.'</span>'; return '<span class="uoj-username">'.$username.'</span>';
} else { } else {
return '<span class="uoj-username" data-realname="'.$realname.'">'.$username.'</span>'; return '<span class="uoj-username" data-realname="'.HTML::escape($realname).'">'.$username.'</span>';
} }
} else { } else {
$esc_username = HTML::escape($username); $esc_username = HTML::escape($username);

View File

@ -1,5 +1,9 @@
<?php <?php
return [ return [
'user group' => 'User Group',
'super user' => 'Super User',
'normal user' => 'Normal User',
'banned user' => 'Banned User',
'real name' => 'Real name', 'real name' => 'Real name',
'belongs to these groups' => 'Belongs to these groups:', 'belongs to these groups' => 'Belongs to these groups:',
'avatar source' => 'Avatar source', 'avatar source' => 'Avatar source',

View File

@ -1,5 +1,9 @@
<?php <?php
return [ return [
'user group' => '用户类别',
'super user' => '超级用户',
'normal user' => '普通用户',
'banned user' => '封禁用户',
'real name' => '真实姓名', 'real name' => '真实姓名',
'belongs to these groups' => '属于这些小组:', 'belongs to these groups' => '属于这些小组:',
'avatar source' => '头像来源', 'avatar source' => '头像来源',

View File

@ -58,6 +58,7 @@ Route::group([
} }
Route::any('/blogs/{id}', '/blog_show.php'); Route::any('/blogs/{id}', '/blog_show.php');
Route::any('/post/{id}', '/blog_show.php'); Route::any('/post/{id}', '/blog_show.php');
Route::any('/post/{id}/write', '/blog_show.php?sub=%2Fwrite');
Route::any('/announcements', '/announcements.php'); Route::any('/announcements', '/announcements.php');
@ -76,7 +77,7 @@ Route::group([
Route::any('/user_msg', '/user_msg.php'); Route::any('/user_msg', '/user_msg.php');
Route::any('/user/{username}/system_msg', '/user_system_msg.php'); Route::any('/user/{username}/system_msg', '/user_system_msg.php');
Route::any('/super-manage(?:/{tab})?', '/super_manage.php'); Route::any('/super_manage(?:/{tab})?', '/super_manage.php');
Route::any('/download.php', '/download.php'); Route::any('/download.php', '/download.php');

View File

@ -145,7 +145,7 @@ mb-4" role="navigation">
</li> </li>
<?php if (isSuperUser(Auth::user())): ?> <?php if (isSuperUser(Auth::user())): ?>
<li> <li>
<a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>"> <a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>">
<?= UOJLocale::get('system manage') ?> <?= UOJLocale::get('system manage') ?>
</a> </a>
</li> </li>

View File

@ -212,7 +212,7 @@ mb-4" role="navigation">
</li> </li>
<?php if (isSuperUser(Auth::user())): ?> <?php if (isSuperUser(Auth::user())): ?>
<li> <li>
<a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>"> <a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>">
<?= UOJLocale::get('system manage') ?> <?= UOJLocale::get('system manage') ?>
</a> </a>
</li> </li>

View File

@ -265,7 +265,7 @@
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user_msg') ?>"><?= UOJLocale::get('private message') ?>&nbsp;&nbsp;<?= $new_user_msg_num_html ?></a></li> <li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user_msg') ?>"><?= UOJLocale::get('private message') ?>&nbsp;&nbsp;<?= $new_user_msg_num_html ?></a></li>
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user/'.Auth::id().'/system_msg') ?>"><?= UOJLocale::get('system message') ?>&nbsp;&nbsp;<?= $new_system_msg_num_html ?></a></li> <li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/user/'.Auth::id().'/system_msg') ?>"><?= UOJLocale::get('system message') ?>&nbsp;&nbsp;<?= $new_system_msg_num_html ?></a></li>
<?php if (isSuperUser(Auth::user())): ?> <?php if (isSuperUser(Auth::user())): ?>
<li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/super-manage') ?>"><?= UOJLocale::get('system manage') ?></a></li> <li role="presentation"><a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>"><?= UOJLocale::get('system manage') ?></a></li>
<?php endif ?> <?php endif ?>
</ul> </ul>
</li> </li>

View File

@ -576,19 +576,39 @@ $.fn.long_table = function(data, cur_page, header_row, get_row_str, config) {
if (n_pages > 1) { if (n_pages > 1) {
var pagination = $('<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center"></ul>'); var pagination = $('<ul class="pagination top-buffer-no bot-buffer-sm justify-content-center"></ul>');
if (cur_page > 1) { if (cur_page > 1) {
if (isBootstrap5Page) {
pagination.append(get_page_li(1, '<i class="bi bi-chevron-double-left"></i>'));
pagination.append(get_page_li(cur_page - 1, '<i class="bi bi-chevron-left"></i>'));
} else {
pagination.append(get_page_li(cur_page - 1, '<span class="glyphicon glyphicon glyphicon-backward"></span>')); pagination.append(get_page_li(cur_page - 1, '<span class="glyphicon glyphicon glyphicon-backward"></span>'));
}
} else {
if (isBootstrap5Page) {
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-double-left"></i>'));
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-left"></i>'));
} else { } else {
pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-backward"></span>')); pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-backward"></span>'));
} }
}
var max_extend = config.max_extend != undefined ? config.max_extend : 5; var max_extend = config.max_extend != undefined ? config.max_extend : 5;
for (var i = Math.max(cur_page - max_extend, 1); i <= Math.min(cur_page + max_extend, n_pages); i++) { for (var i = Math.max(cur_page - max_extend, 1); i <= Math.min(cur_page + max_extend, n_pages); i++) {
pagination.append(get_page_li(i, i.toString())); pagination.append(get_page_li(i, i.toString()));
} }
if (cur_page < n_pages) { if (cur_page < n_pages) {
if (isBootstrap5Page) {
pagination.append(get_page_li(cur_page + 1, '<i class="bi bi-chevron-right"></i>'));
pagination.append(get_page_li(n_pages, '<i class="bi bi-chevron-double-right"></i>'));
} else {
pagination.append(get_page_li(cur_page + 1, '<span class="glyphicon glyphicon glyphicon-forward"></span>')); pagination.append(get_page_li(cur_page + 1, '<span class="glyphicon glyphicon glyphicon-forward"></span>'));
}
} else {
if (isBootstrap5Page) {
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-right"></i>'));
pagination.append(get_page_li(-1, '<i class="bi bi-chevron-double-right"></i>'));
} else { } else {
pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-forward"></span>')); pagination.append(get_page_li(-1, '<span class="glyphicon glyphicon glyphicon-forward"></span>'));
} }
}
$(table_div).append($('<div class="text-center"></div>').append(pagination)); $(table_div).append($('<div class="text-center"></div>').append(pagination));
} }
}); });