Use CSR for DataTables
This commit is contained in:
parent
e708c0363e
commit
4ae8ed2d82
|
|
@ -169,21 +169,11 @@ class AdminController extends Controller
|
||||||
{
|
{
|
||||||
$users = User::select(['uid', 'email', 'nickname', 'score', 'permission', 'register_at']);
|
$users = User::select(['uid', 'email', 'nickname', 'score', 'permission', 'register_at']);
|
||||||
|
|
||||||
$permissionTextMap = [
|
|
||||||
User::BANNED => trans('admin.users.status.banned'),
|
|
||||||
User::NORMAL => trans('admin.users.status.normal'),
|
|
||||||
User::ADMIN => trans('admin.users.status.admin'),
|
|
||||||
User::SUPER_ADMIN => trans('admin.users.status.super-admin')
|
|
||||||
];
|
|
||||||
|
|
||||||
return Datatables::of($users)->editColumn('email', function ($user) {
|
return Datatables::of($users)->editColumn('email', function ($user) {
|
||||||
return $user->email ?: 'EMPTY';
|
return $user->email ?: 'EMPTY';
|
||||||
})->editColumn('permission', function ($user) use ($permissionTextMap) {
|
|
||||||
return array_get($permissionTextMap, $user->permission);
|
|
||||||
})
|
})
|
||||||
->setRowId('uid')
|
->setRowId('uid')
|
||||||
->editColumn('score', 'vendor.admin-operations.users.score')
|
->addColumn('operations', app('user.current')->getPermission())
|
||||||
->addColumn('operations', 'vendor.admin-operations.users.operations')
|
|
||||||
->make(true);
|
->make(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -202,11 +192,7 @@ class AdminController extends Controller
|
||||||
{
|
{
|
||||||
$players = Player::select(['pid', 'uid', 'player_name', 'preference', 'tid_steve', 'tid_alex', 'tid_cape', 'last_modified']);
|
$players = Player::select(['pid', 'uid', 'player_name', 'preference', 'tid_steve', 'tid_alex', 'tid_cape', 'last_modified']);
|
||||||
|
|
||||||
return Datatables::of($players)->editColumn('preference', 'vendor.admin-operations.players.preference')
|
return Datatables::of($players)->setRowId('pid')->make(true);
|
||||||
->setRowId('pid')
|
|
||||||
->addColumn('previews', 'vendor.admin-operations.players.previews')
|
|
||||||
->addColumn('operations', 'vendor.admin-operations.players.operations')
|
|
||||||
->make(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -75,13 +75,13 @@ class PluginController extends Controller
|
||||||
return trans($plugin->description);
|
return trans($plugin->description);
|
||||||
})
|
})
|
||||||
->editColumn('author', function ($plugin) {
|
->editColumn('author', function ($plugin) {
|
||||||
return "<a href='{$plugin->url}' target='_blank'>".trans($plugin->author)."</a>";
|
return ['author' => trans($plugin->author), 'url' => $plugin->url];
|
||||||
})
|
})
|
||||||
->addColumn('status', function ($plugin) {
|
->addColumn('status', function ($plugin) {
|
||||||
return trans('admin.plugins.status.'.($plugin->isEnabled() ? 'enabled' : 'disabled'));
|
return trans('admin.plugins.status.'.($plugin->isEnabled() ? 'enabled' : 'disabled'));
|
||||||
})
|
})
|
||||||
->addColumn('operations', function ($plugin) {
|
->addColumn('operations', function ($plugin) {
|
||||||
return view('vendor.admin-operations.plugins.operations', compact('plugin'));
|
return ['enabled' => $plugin->isEnabled(), 'hasConfigView' => $plugin->hasConfigView()];
|
||||||
})
|
})
|
||||||
->make(true);
|
->make(true);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,23 @@ $(document).ready(function() {
|
||||||
$('input').iCheck({
|
$('input').iCheck({
|
||||||
checkboxClass: 'icheckbox_square-blue'
|
checkboxClass: 'icheckbox_square-blue'
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$.extend(true, $.fn.dataTable.defaults, {
|
||||||
|
language: trans('vendor.datatables'),
|
||||||
|
scrollX: true,
|
||||||
|
pageLength: 25,
|
||||||
|
autoWidth: false,
|
||||||
|
processing: true,
|
||||||
|
serverSide: true
|
||||||
|
});
|
||||||
|
|
||||||
|
if (window.location.pathname.includes('admin/users')) {
|
||||||
|
initUsersTable();
|
||||||
|
} else if (window.location.pathname.includes('admin/players')) {
|
||||||
|
initPlayersTable();
|
||||||
|
} else if (window.location.pathname.includes('admin/plugins/manage')) {
|
||||||
|
initPluginsTable();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#layout-skins-list [data-skin]').click(function(e) {
|
$('#layout-skins-list [data-skin]').click(function(e) {
|
||||||
|
|
@ -191,7 +208,7 @@ $('body').on('keypress', '.score', function(event){
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$('body').on('change', '#preference', function() {
|
function changePreference() {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "./players?action=preference",
|
url: "./players?action=preference",
|
||||||
|
|
@ -206,9 +223,9 @@ $('body').on('change', '#preference', function() {
|
||||||
},
|
},
|
||||||
error: showAjaxError
|
error: showAjaxError
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
function changeTexture(pid) {
|
function changeTexture(pid, playerName) {
|
||||||
let dom = `
|
let dom = `
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="model">${trans('admin.textureType')}</label>
|
<label for="model">${trans('admin.textureType')}</label>
|
||||||
|
|
@ -223,8 +240,6 @@ function changeTexture(pid) {
|
||||||
<input id="tid" class="form-control" type="text" placeholder="${trans('admin.pidNotice')}">
|
<input id="tid" class="form-control" type="text" placeholder="${trans('admin.pidNotice')}">
|
||||||
</div>`;
|
</div>`;
|
||||||
|
|
||||||
let playerName = $('#'+pid).find('#player-name').text();
|
|
||||||
|
|
||||||
showModal(dom, trans('admin.changePlayerTexture', {'player': playerName}), 'default', {
|
showModal(dom, trans('admin.changePlayerTexture', {'player': playerName}), 'default', {
|
||||||
callback: `ajaxChangeTexture(${pid})`
|
callback: `ajaxChangeTexture(${pid})`
|
||||||
});
|
});
|
||||||
|
|
@ -453,3 +468,248 @@ function downloadUpdates() {
|
||||||
.fail(showAjaxError);
|
.fail(showAjaxError);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function initUsersTable() {
|
||||||
|
const rootPath = /(^https?:.*)\/admin\/users/.exec(window.location.href)[1];
|
||||||
|
$('#user-table').DataTable({
|
||||||
|
ajax: `${rootPath}/admin/user-data`,
|
||||||
|
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: 0,
|
||||||
|
data: 'uid',
|
||||||
|
width: '1%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 1,
|
||||||
|
data: 'email'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 2,
|
||||||
|
data: 'nickname'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 3,
|
||||||
|
data: 'score',
|
||||||
|
render: data => {
|
||||||
|
return `<input type="number" class="form-control score" value="${data}" title="${trans('admin.scoreTip')}" data-toggle="tooltip" data-placement="right">`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 4,
|
||||||
|
data: 'permission',
|
||||||
|
render: data => {
|
||||||
|
switch (data) {
|
||||||
|
case -1:
|
||||||
|
return trans('admin.banned');
|
||||||
|
case 0:
|
||||||
|
return trans('admin.normal');
|
||||||
|
case 1:
|
||||||
|
return trans('admin.admin');
|
||||||
|
case 2:
|
||||||
|
return trans('admin.superAdmin');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 5,
|
||||||
|
data: 'register_at'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 6,
|
||||||
|
data: 'operations',
|
||||||
|
searchable: false,
|
||||||
|
orderable: false,
|
||||||
|
render: (data, type, row) => {
|
||||||
|
let operationsHtml, adminOption = '', bannedOption = '', deleteUserButton;
|
||||||
|
if (row.permission !== 2) {
|
||||||
|
if (data === 2) {
|
||||||
|
if (row.permission === 1) {
|
||||||
|
adminOption = `<li class="divider"></li>
|
||||||
|
<li><a id="admin" href="javascript:changeAdminStatus(${row.uid});">${trans('admin.unsetAdmin')}</a></li>`;
|
||||||
|
} else {
|
||||||
|
adminOption = `<li class="divider"></li>
|
||||||
|
<li><a id="admin" href="javascript:changeAdminStatus(${row.uid});">${trans('admin.setAdmin')}</a></li>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (row.permission === -1) {
|
||||||
|
bannedOption = `<li class="divider"></li>
|
||||||
|
<li><a id="ban" href="javascript:changeBanStatus(${row.uid});">${trans('admin.ban')}</a></li>`;
|
||||||
|
} else {
|
||||||
|
bannedOption = `<li class="divider"></li>
|
||||||
|
<li><a id="ban" href="javascript:changeBanStatus(${row.uid});">${trans('admin.unban')}</a></li>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data === 2) {
|
||||||
|
if (row.permission === 2) {
|
||||||
|
deleteUserButton = `
|
||||||
|
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="${trans('admin.cannotDeleteSuperAdmin')}">${trans('admin.deleteUser')}</a>`;
|
||||||
|
} else {
|
||||||
|
deleteUserButton = `
|
||||||
|
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount(${row.uid});">${trans('admin.deleteUser')}</a>`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (row.permission === 1 || row.permission === 2) {
|
||||||
|
deleteUserButton = `
|
||||||
|
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="${trans('admin.cannotDeleteAdmin')}">${trans('admin.deleteUser')}</a>`;
|
||||||
|
} else {
|
||||||
|
deleteUserButton = `
|
||||||
|
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount(${row.uid});">${trans('admin.deleteUser')}</a>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return `
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
${trans('admin.operationsTitle')} <span class="caret"></span></button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="javascript:changeUserEmail(${row.uid});">${trans('admin.changeEmail')}</a></li>
|
||||||
|
<li><a href="javascript:changeUserNickName(${row.uid});">${trans('admin.changeNickName')}</a></li>
|
||||||
|
<li><a href="javascript:changeUserPwd(${row.uid});">${trans('admin.changePassword')}</a></li>
|
||||||
|
${adminOption}${bannedOption}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
${deleteUserButton}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initPlayersTable() {
|
||||||
|
const rootPath = /(^https?:.*)\/admin\/players/.exec(window.location.href)[1];
|
||||||
|
$('#player-table').DataTable({
|
||||||
|
ajax: `${rootPath}/admin/player-data`,
|
||||||
|
scrollY: ($('.content-wrapper').height() - $('.content-header').outerHeight()) * 0.7,
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: 0,
|
||||||
|
data: 'pid',
|
||||||
|
width: '1%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 1,
|
||||||
|
data: 'uid'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 2,
|
||||||
|
data: 'player_name'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 3,
|
||||||
|
data: 'preference',
|
||||||
|
render: data => {
|
||||||
|
return `
|
||||||
|
<select class="form-control" onchange="changePreference.call(this)">
|
||||||
|
<option ${(data == "default") ? 'selected=selected' : ''} value="default">Default</option>
|
||||||
|
<option ${(data == "slim") ? 'selected=selected' : ''} value="slim">Slim</option>
|
||||||
|
</select>`;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 4,
|
||||||
|
searchable: false,
|
||||||
|
orderable: false,
|
||||||
|
render: (data, type, row) => {
|
||||||
|
let html = { steve: '', alex: '', cape: '' };
|
||||||
|
['steve', 'alex', 'cape'].forEach(textureType => {
|
||||||
|
if (row['tid_' + textureType] === 0) {
|
||||||
|
html[textureType] = `<img id="${row.pid}-${row['tid_' + textureType]}" width="64" />`;
|
||||||
|
} else {
|
||||||
|
html[textureType] = `
|
||||||
|
<a href="${rootPath}/skinlib/show/${row['tid_' + textureType]}">
|
||||||
|
<img id="${row.pid}-${row['tid_' + textureType]}" width="64" src="${rootPath}/preview/64/${row['tid_' + textureType]}.png" />
|
||||||
|
</a>`;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return html.steve + html.alex + html.cape;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 5,
|
||||||
|
data: 'last_modified'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 6,
|
||||||
|
searchable: false,
|
||||||
|
orderable: false,
|
||||||
|
render: (data, type, row) => {
|
||||||
|
return `
|
||||||
|
<div class="btn-group">
|
||||||
|
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||||
|
${trans('admin.operationsTitle')} <span class="caret"></span></button>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<li><a href="javascript:changeTexture(${row.pid}, '${row.player_name}');">${trans('admin.changeTexture')}</a></li>
|
||||||
|
<li><a href="javascript:changeOwner(${row.pid});">${trans('admin.changeOwner')}</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<a class="btn btn-danger btn-sm" href="javascript:deletePlayer(${row.pid});">${trans('admin.deletePlayer')}</a>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function initPluginsTable() {
|
||||||
|
const rootPath = /(^https?:.*)\/admin\/plugins\/manage/.exec(window.location.href)[1];
|
||||||
|
$('#plugin-table').DataTable({
|
||||||
|
ajax: `${rootPath}/admin/plugins/data`,
|
||||||
|
columnDefs: [
|
||||||
|
{
|
||||||
|
targets: 0,
|
||||||
|
data: 'title'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 1,
|
||||||
|
data: 'description',
|
||||||
|
width: '35%'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 2,
|
||||||
|
data: 'author',
|
||||||
|
render: data => {
|
||||||
|
if (data.url === '' || data.url === null) {
|
||||||
|
return data.author;
|
||||||
|
} else {
|
||||||
|
return `<a href="${data.url}" target="_blank">${data.author}</a>`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 3,
|
||||||
|
data: 'version'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 4,
|
||||||
|
data: 'status'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
targets: 5,
|
||||||
|
data: 'operations',
|
||||||
|
searchable: false,
|
||||||
|
orderable: false,
|
||||||
|
render: (data, type, row) => {
|
||||||
|
let switchEnableButton, configViewButton, deletePluginButton;
|
||||||
|
if (data.enabled) {
|
||||||
|
switchEnableButton = `
|
||||||
|
<a class="btn btn-warning btn-sm" href="javascript:disablePlugin('${row.name}');">${trans('admin.disablePlugin')}</a>`;
|
||||||
|
} else {
|
||||||
|
switchEnableButton = `
|
||||||
|
<a class="btn btn-primary btn-sm" href="javascript:enablePlugin('${row.name}');">${trans('admin.enablePlugin')}</a>`;
|
||||||
|
}
|
||||||
|
if (data.enabled && data.hasConfigView) {
|
||||||
|
configViewButton = `
|
||||||
|
<a class="btn btn-default btn-sm" href="${rootPath}/admin/plugins/config/${row.name}">${trans('admin.configurePlugin')}</a>`;
|
||||||
|
} else {
|
||||||
|
configViewButton = `
|
||||||
|
<a class="btn btn-default btn-sm" disabled="disabled" title="${trans('admin.noPluginConfigNotice')}" data-toggle="tooltip" data-placement="top">${trans('admin.configurePlugin')}</a>`;
|
||||||
|
}
|
||||||
|
deletePluginButton = `
|
||||||
|
<a class="btn btn-danger btn-sm" href="javascript:deletePlugin('${row.name}');">${trans('admin.deletePlugin')}</a>`;
|
||||||
|
return switchEnableButton + configViewButton + deletePluginButton;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ users:
|
||||||
banned: Banned
|
banned: Banned
|
||||||
admin: Admin
|
admin: Admin
|
||||||
super-admin: Super Admin
|
super-admin: Super Admin
|
||||||
score:
|
|
||||||
tip: Press enter to submit new score
|
|
||||||
operations:
|
operations:
|
||||||
title: Operations
|
title: Operations
|
||||||
non-existent: No such user.
|
non-existent: No such user.
|
||||||
|
|
@ -100,12 +98,6 @@ plugins:
|
||||||
|
|
||||||
operations:
|
operations:
|
||||||
title: Operations
|
title: Operations
|
||||||
disable: Disable
|
|
||||||
enable: Enable
|
|
||||||
configure: Configure
|
|
||||||
no-config-notice: The plugin has been disabled or no configuration is provided.
|
|
||||||
delete: Delete
|
|
||||||
|
|
||||||
enabled: :plugin has been enabled.
|
enabled: :plugin has been enabled.
|
||||||
disabled: :plugin has been disabled.
|
disabled: :plugin has been disabled.
|
||||||
deleted: The plugin was deleted successfully.
|
deleted: The plugin was deleted successfully.
|
||||||
|
|
|
||||||
|
|
@ -95,38 +95,52 @@
|
||||||
emptyDeletePassword: 'Please enter the current password:'
|
emptyDeletePassword: 'Please enter the current password:'
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
// Change User Profile
|
operationsTitle: 'Operations',
|
||||||
newUserEmail: 'Please enter the new email:',
|
|
||||||
newUserNickname: 'Please enter the new nickname:',
|
|
||||||
newUserPassword: 'Please enter the new password:',
|
|
||||||
deleteUserNotice: 'Are you sure to delete this user? It\' permanent.',
|
|
||||||
changePlayerOwner: 'Please enter the id of user which this player should be transferred to:',
|
|
||||||
deletePlayerNotice: 'Are you sure to delete this player? It\' permanent.',
|
|
||||||
|
|
||||||
// Status
|
// Users
|
||||||
banned: 'Banned',
|
|
||||||
normal: 'Normal',
|
|
||||||
admin: 'Admin',
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
ban: 'Ban',
|
ban: 'Ban',
|
||||||
unban: 'Unban',
|
unban: 'Unban',
|
||||||
setAdmin: 'Set as admin',
|
setAdmin: 'Set as admin',
|
||||||
unsetAdmin: 'Remove admin',
|
unsetAdmin: 'Remove admin',
|
||||||
|
deleteUser: 'Delete User',
|
||||||
|
cannotDeleteAdmin: 'You can\'t delete admins.',
|
||||||
|
cannotDeleteSuperAdmin: 'You can\'t delete super admin in this way',
|
||||||
|
changeEmail: 'Edit Email',
|
||||||
|
changeNickName: 'Edit Nickname',
|
||||||
|
changePassword: 'Edit Password',
|
||||||
|
newUserEmail: 'Please enter the new email:',
|
||||||
|
newUserNickname: 'Please enter the new nickname:',
|
||||||
|
newUserPassword: 'Please enter the new password:',
|
||||||
|
deleteUserNotice: 'Are you sure to delete this user? It\' permanent.',
|
||||||
|
scoreTip: 'Press ENTER to submit new score',
|
||||||
|
|
||||||
// Change Player Texture
|
// Status
|
||||||
|
banned: 'Banned',
|
||||||
|
normal: 'Normal',
|
||||||
|
admin: 'Admin',
|
||||||
|
superAdmin: 'Super Admin',
|
||||||
|
|
||||||
|
// Players
|
||||||
textureType: 'Texture Type',
|
textureType: 'Texture Type',
|
||||||
skin: 'Skin (:model Model)',
|
skin: 'Skin (:model Model)',
|
||||||
cape: 'Cape',
|
cape: 'Cape',
|
||||||
pid: 'Texture ID',
|
pid: 'Texture ID',
|
||||||
pidNotice: 'Please enter the tid of texture',
|
pidNotice: 'Please enter the tid of texture',
|
||||||
changePlayerTexture: 'Change textures of :player',
|
changePlayerTexture: 'Change textures of :player',
|
||||||
|
changeTexture: 'Change Textures',
|
||||||
|
changeOwner: 'Change Owner',
|
||||||
|
deletePlayer: 'Delete',
|
||||||
|
changePlayerOwner: 'Please enter the id of user which this player should be transferred to:',
|
||||||
|
deletePlayerNotice: 'Are you sure to delete this player? It\' permanent.',
|
||||||
|
|
||||||
// Index
|
// Index
|
||||||
textureUploads: 'Texture Uploads',
|
textureUploads: 'Texture Uploads',
|
||||||
userRegistration: 'User Registration',
|
userRegistration: 'User Registration',
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
|
configurePlugin: 'Configure',
|
||||||
|
noPluginConfigNotice: 'The plugin has been disabled or no configuration is provided.',
|
||||||
|
deletePlugin: 'Delete',
|
||||||
statusEnabled: 'Enabled',
|
statusEnabled: 'Enabled',
|
||||||
statusDisabled: 'Disabled',
|
statusDisabled: 'Disabled',
|
||||||
enablePlugin: 'Enable',
|
enablePlugin: 'Enable',
|
||||||
|
|
|
||||||
|
|
@ -12,8 +12,6 @@ users:
|
||||||
banned: 封禁
|
banned: 封禁
|
||||||
admin: 管理员
|
admin: 管理员
|
||||||
super-admin: 超级管理员
|
super-admin: 超级管理员
|
||||||
score:
|
|
||||||
tip: 输入修改后的积分,回车提交
|
|
||||||
operations:
|
operations:
|
||||||
title: 更多操作
|
title: 更多操作
|
||||||
non-existent: 用户不存在
|
non-existent: 用户不存在
|
||||||
|
|
@ -100,12 +98,6 @@ plugins:
|
||||||
|
|
||||||
operations:
|
operations:
|
||||||
title: 操作
|
title: 操作
|
||||||
disable: 禁用插件
|
|
||||||
enable: 启用插件
|
|
||||||
configure: 插件配置
|
|
||||||
no-config-notice: 插件已被禁用或无配置页
|
|
||||||
delete: 删除插件
|
|
||||||
|
|
||||||
enabled: :plugin 已启用
|
enabled: :plugin 已启用
|
||||||
disabled: :plugin 已禁用
|
disabled: :plugin 已禁用
|
||||||
deleted: 插件已被成功删除
|
deleted: 插件已被成功删除
|
||||||
|
|
|
||||||
|
|
@ -95,38 +95,52 @@
|
||||||
emptyDeletePassword: '请先输入当前用户密码'
|
emptyDeletePassword: '请先输入当前用户密码'
|
||||||
},
|
},
|
||||||
admin: {
|
admin: {
|
||||||
// Change User Profile
|
operationsTitle: '更多操作',
|
||||||
newUserEmail: '请输入新邮箱:',
|
|
||||||
newUserNickname: '请输入新昵称:',
|
|
||||||
newUserPassword: '请输入新密码:',
|
|
||||||
deleteUserNotice: '真的要删除此用户吗?此操作不可恢复',
|
|
||||||
changePlayerOwner: '请输入此角色要让渡至的用户 UID:',
|
|
||||||
deletePlayerNotice: '真的要删除此角色吗?此操作不可恢复',
|
|
||||||
|
|
||||||
// Status
|
// Users
|
||||||
banned: '封禁',
|
|
||||||
normal: '正常',
|
|
||||||
admin: '管理员',
|
|
||||||
|
|
||||||
// Operations
|
|
||||||
ban: '封禁',
|
ban: '封禁',
|
||||||
unban: '解封',
|
unban: '解封',
|
||||||
setAdmin: '设为管理员',
|
setAdmin: '设为管理员',
|
||||||
unsetAdmin: '解除管理员',
|
unsetAdmin: '解除管理员',
|
||||||
|
deleteUser: '删除用户',
|
||||||
|
cannotDeleteAdmin: '你不能删除管理员账号哦',
|
||||||
|
cannotDeleteSuperAdmin: '超级管理员账号不能被这样删除的啦',
|
||||||
|
changeEmail: '修改邮箱',
|
||||||
|
changeNickName: '修改昵称',
|
||||||
|
changePassword: '更改密码',
|
||||||
|
newUserEmail: '请输入新邮箱:',
|
||||||
|
newUserNickname: '请输入新昵称:',
|
||||||
|
newUserPassword: '请输入新密码:',
|
||||||
|
deleteUserNotice: '真的要删除此用户吗?此操作不可恢复',
|
||||||
|
scoreTip: '输入修改后的积分,回车提交',
|
||||||
|
|
||||||
// Change Player Texture
|
// Status
|
||||||
|
banned: '封禁',
|
||||||
|
normal: '普通用户',
|
||||||
|
admin: '管理员',
|
||||||
|
superAdmin: '超级管理员',
|
||||||
|
|
||||||
|
// Players
|
||||||
textureType: '材质类型',
|
textureType: '材质类型',
|
||||||
skin: '皮肤(:model 模型)',
|
skin: '皮肤(:model 模型)',
|
||||||
cape: '披风',
|
cape: '披风',
|
||||||
pid: '材质 ID',
|
pid: '材质 ID',
|
||||||
pidNotice: '输入要更换的材质的 TID',
|
pidNotice: '输入要更换的材质的 TID',
|
||||||
changePlayerTexture: '更换角色 :player 的材质',
|
changePlayerTexture: '更换角色 :player 的材质',
|
||||||
|
changeTexture: '更换材质',
|
||||||
|
changeOwner: '更换角色拥有者',
|
||||||
|
deletePlayer: '删除角色',
|
||||||
|
changePlayerOwner: '请输入此角色要让渡至的用户 UID:',
|
||||||
|
deletePlayerNotice: '真的要删除此角色吗?此操作不可恢复',
|
||||||
|
|
||||||
// Index
|
// Index
|
||||||
textureUploads: '材质上传',
|
textureUploads: '材质上传',
|
||||||
userRegistration: '用户注册',
|
userRegistration: '用户注册',
|
||||||
|
|
||||||
// Plugins
|
// Plugins
|
||||||
|
configurePlugin: '插件配置',
|
||||||
|
noPluginConfigNotice: '插件已被禁用或无配置页',
|
||||||
|
deletePlugin: '删除插件',
|
||||||
statusEnabled: '已启用',
|
statusEnabled: '已启用',
|
||||||
statusDisabled: '已禁用',
|
statusDisabled: '已禁用',
|
||||||
enablePlugin: '启用插件',
|
enablePlugin: '启用插件',
|
||||||
|
|
|
||||||
|
|
@ -43,26 +43,5 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
|
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#player-table').DataTable({
|
|
||||||
language: trans('vendor.datatables'),
|
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: '{{ url("admin/player-data") }}',
|
|
||||||
createdRow: function (row, data, index) {
|
|
||||||
$('td', row).eq(2).attr('id', 'player-name');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{data: 'pid', 'width': '1%'},
|
|
||||||
{data: 'uid'},
|
|
||||||
{data: 'player_name'},
|
|
||||||
{data: 'preference'},
|
|
||||||
{data: 'previews', searchable: false, orderable: false},
|
|
||||||
{data: 'last_modified'},
|
|
||||||
{data: 'operations', searchable: false, orderable: false}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -47,32 +47,3 @@
|
||||||
</div><!-- /.content-wrapper -->
|
</div><!-- /.content-wrapper -->
|
||||||
|
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
@section('script')
|
|
||||||
<script type="text/javascript">
|
|
||||||
|
|
||||||
var table = $('#plugin-table').DataTable({
|
|
||||||
language: trans('vendor.datatables'),
|
|
||||||
scrollX: true,
|
|
||||||
pageLength: 25,
|
|
||||||
autoWidth: false,
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: '{{ url("admin/plugins/data") }}',
|
|
||||||
createdRow: function (row, data, index) {
|
|
||||||
$('td', row).eq(1).attr('id', 'description');
|
|
||||||
$('td', row).eq(2).attr('id', 'author');
|
|
||||||
$('td', row).eq(3).attr('id', 'version');
|
|
||||||
$('td', row).eq(4).attr('id', 'status');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{data: 'title'},
|
|
||||||
{data: 'description', 'width': '35%'},
|
|
||||||
{data: 'author'},
|
|
||||||
{data: 'version'},
|
|
||||||
{data: 'status'},
|
|
||||||
{data: 'operations', searchable: false, orderable: false}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
@endsection
|
|
||||||
|
|
|
||||||
|
|
@ -42,28 +42,5 @@
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
|
$('.box-body').css('min-height', $('.content-wrapper').height() - $('.content-header').outerHeight() - 120);
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#user-table').DataTable({
|
|
||||||
language: trans('vendor.datatables'),
|
|
||||||
scrollX: true,
|
|
||||||
autoWidth: false,
|
|
||||||
processing: true,
|
|
||||||
serverSide: true,
|
|
||||||
ajax: '{{ url("admin/user-data") }}',
|
|
||||||
createdRow: function (row, data, index) {
|
|
||||||
$('td', row).eq(1).attr('id', 'email');
|
|
||||||
$('td', row).eq(2).attr('id', 'nickname');
|
|
||||||
$('td', row).eq(4).attr('id', 'permission');
|
|
||||||
},
|
|
||||||
columns: [
|
|
||||||
{data: 'uid', 'width': '1%'},
|
|
||||||
{data: 'email'},
|
|
||||||
{data: 'nickname'},
|
|
||||||
{data: 'score'},
|
|
||||||
{data: 'permission'},
|
|
||||||
{data: 'register_at'},
|
|
||||||
{data: 'operations', searchable: false, orderable: false}
|
|
||||||
]
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
{{ trans('admin.players.operations.title') }} <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a href="javascript:changeTexture('{{ $pid }}');">{{ trans('admin.players.textures.change') }}</a></li>
|
|
||||||
<li><a href="javascript:changeOwner('{{ $pid }}');">{{ trans('admin.players.owner.change') }}</a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a class="btn btn-danger btn-sm" href="javascript:deletePlayer('{{ $pid }}');">{{ trans('admin.players.delete.delete') }}</a>
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
<select class="form-control" id="preference">
|
|
||||||
<option {{ ($preference == "default") ? 'selected=selected' : '' }} value="default">Default</option>
|
|
||||||
<option {{ ($preference == "slim") ? 'selected=selected' : '' }} value="slim">Slim</option>
|
|
||||||
</select>
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
@if ($tid_steve == '0')
|
|
||||||
<img id="{{ $pid }}-steve" width="64" />
|
|
||||||
@else
|
|
||||||
<a href="{{ url('skinlib/show/'.$tid_steve) }}">
|
|
||||||
<img id="{{ $pid }}-steve" width="64" src="{{ url('preview/64/'.$tid_steve) }}.png" />
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($tid_alex == '0')
|
|
||||||
<img id="{{ $pid }}-alex" width="64" />
|
|
||||||
@else
|
|
||||||
<a href="{{ url('skinlib/show/'.$tid_alex) }}">
|
|
||||||
<img id="{{ $pid }}-alex" width="64" src="{{ url('preview/64/'.$tid_alex) }}.png" />
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($tid_cape == '0')
|
|
||||||
<img id="{{ $pid }}-cape" width="64" />
|
|
||||||
@else
|
|
||||||
<a href="{{ url('skinlib/show/'.$tid_cape) }}">
|
|
||||||
<img id="{{ $pid }}-cape" width="64" src="{{ url('preview/64/'.$tid_cape) }}.png" />
|
|
||||||
</a>
|
|
||||||
@endif
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
@if ($plugin->isEnabled())
|
|
||||||
<a class="btn btn-warning btn-sm" href="javascript:disablePlugin('{{ $plugin->name }}');">{{ trans('admin.plugins.operations.disable') }}</a>
|
|
||||||
@else
|
|
||||||
<a class="btn btn-primary btn-sm" href="javascript:enablePlugin('{{ $plugin->name }}');">{{ trans('admin.plugins.operations.enable') }}</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@if ($plugin->isEnabled() && $plugin->hasConfigView())
|
|
||||||
<a class="btn btn-default btn-sm" href="{{ url('admin/plugins/config/'.$plugin->name) }}">{{ trans('admin.plugins.operations.configure') }}</a>
|
|
||||||
@else
|
|
||||||
<a class="btn btn-default btn-sm" disabled="disabled" title="{{ trans('admin.plugins.operations.no-config-notice') }}" data-toggle="tooltip" data-placement="top">{{ trans('admin.plugins.operations.configure') }}</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<a class="btn btn-danger btn-sm" href="javascript:deletePlugin('{{ $plugin->name }}');">{{ trans('admin.plugins.operations.delete') }}</a>
|
|
||||||
|
|
@ -1,50 +0,0 @@
|
||||||
<?php use App\Models\User; ?>
|
|
||||||
<div class="btn-group">
|
|
||||||
<button type="button" class="btn btn-sm btn-default dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
||||||
{{ trans('admin.users.operations.title') }} <span class="caret"></span>
|
|
||||||
</button>
|
|
||||||
<ul class="dropdown-menu">
|
|
||||||
<li><a href="javascript:changeUserEmail('{{ $uid }}');">{{ trans('admin.users.operations.email.change') }}</a></li>
|
|
||||||
<li><a href="javascript:changeUserNickName('{{ $uid }}');">{{ trans('admin.users.operations.nickname.change') }}</a></li>
|
|
||||||
<li><a href="javascript:changeUserPwd('{{ $uid }}');">{{ trans('admin.users.operations.password.change') }}</a></li>
|
|
||||||
|
|
||||||
@unless ($permission == User::SUPER_ADMIN)
|
|
||||||
<li class="divider"></li>
|
|
||||||
{{-- If current user is super admin --}}
|
|
||||||
@if (app('user.current')->getPermission() == User::SUPER_ADMIN)
|
|
||||||
@if ($permission == User::ADMIN)
|
|
||||||
<li><a id="admin" href="javascript:changeAdminStatus('{{ $uid }}');">{{ trans('admin.users.operations.admin.unset.text') }}</a></li>
|
|
||||||
@else
|
|
||||||
<li><a id="admin" href="javascript:changeAdminStatus('{{ $uid }}');">{{ trans('admin.users.operations.admin.set.text') }}</a></li>
|
|
||||||
@endif
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<li class="divider"></li>
|
|
||||||
|
|
||||||
@if ($permission == User::BANNED)
|
|
||||||
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">{{ trans('admin.users.operations.ban.unban.text') }}</a></li>
|
|
||||||
@else
|
|
||||||
<li><a id="ban" href="javascript:changeBanStatus('{{ $uid }}');">{{ trans('admin.users.operations.ban.ban.text') }}</a></li>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@endunless
|
|
||||||
</ul>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- If current user is super admin --}}
|
|
||||||
@if (app('user.current')->getPermission() == User::SUPER_ADMIN)
|
|
||||||
|
|
||||||
@if ($permission == "2")
|
|
||||||
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="{{ trans('admin.users.operations.delete.cant-super-admin') }}">{{ trans('admin.users.operations.delete.delete') }}</a>
|
|
||||||
@else
|
|
||||||
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $uid }}');">{{ trans('admin.users.operations.delete.delete') }}</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@else
|
|
||||||
@if ($permission == "1" || $permission == "2")
|
|
||||||
<a class="btn btn-danger btn-sm" disabled="disabled" data-toggle="tooltip" data-placement="bottom" title="{{ trans('admin.users.operations.delete-cant-admin') }}">{{ trans('admin.users.operations.delete.delete') }}</a>
|
|
||||||
@else
|
|
||||||
<a class="btn btn-danger btn-sm" href="javascript:deleteUserAccount('{{ $uid }}');">{{ trans('admin.users.operations.delete.delete') }}</a>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
@endif
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
<input type="text" class="form-control score" value="{{ $score }}" title="{{ trans('admin.users.score.tip') }}" data-toggle="tooltip" data-placement="right">
|
|
||||||
Loading…
Reference in New Issue
Block a user