lighter interface
This commit is contained in:
parent
58ed7adfb3
commit
1449dac9dd
4 changed files with 70 additions and 87 deletions
|
@ -30,8 +30,6 @@ $core->addBehavior('pluginsBeforeDelete',
|
||||||
['behaviorsDcAdvancedCleaner', 'pluginsBeforeDelete']);
|
['behaviorsDcAdvancedCleaner', 'pluginsBeforeDelete']);
|
||||||
$core->addBehavior('themeBeforeDelete',
|
$core->addBehavior('themeBeforeDelete',
|
||||||
['behaviorsDcAdvancedCleaner', 'themeBeforeDelete']);
|
['behaviorsDcAdvancedCleaner', 'themeBeforeDelete']);
|
||||||
$core->addBehavior('dcAdvancedCleanerAdminTabs',
|
|
||||||
['behaviorsDcAdvancedCleaner', 'dcAdvancedCleanerAdminTabs']);
|
|
||||||
|
|
||||||
if (defined('ACTIVITY_REPORT')) {
|
if (defined('ACTIVITY_REPORT')) {
|
||||||
dcAdvancedCleanerActivityReportBehaviors::add($core);
|
dcAdvancedCleanerActivityReportBehaviors::add($core);
|
||||||
|
|
|
@ -60,11 +60,6 @@ class behaviorsDcAdvancedCleaner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dcAdvancedCleanerAdminTabs($core)
|
|
||||||
{
|
|
||||||
self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => 'uninstaller']));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function pluginsToolsTabs($core)
|
public static function pluginsToolsTabs($core)
|
||||||
{
|
{
|
||||||
self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugins', ['tab' => 'uninstaller']));
|
self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugins', ['tab' => 'uninstaller']));
|
||||||
|
|
142
index.php
142
index.php
|
@ -14,9 +14,8 @@
|
||||||
if (!defined('DC_CONTEXT_ADMIN')) {
|
if (!defined('DC_CONTEXT_ADMIN')) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (!$core->auth->isSuperAdmin()) {
|
|
||||||
return null;
|
dcPage::checkSuper();
|
||||||
}
|
|
||||||
|
|
||||||
# Localized l10n
|
# Localized l10n
|
||||||
__('Settings'); __('settings'); __('setting');
|
__('Settings'); __('settings'); __('setting');
|
||||||
|
@ -41,59 +40,56 @@ __('delete %s theme file');
|
||||||
__('delete %s cache files');
|
__('delete %s cache files');
|
||||||
|
|
||||||
# vars
|
# vars
|
||||||
$tab = $_REQUEST['tab'] ?? 'lists';
|
$part = $_REQUEST['part'] ?? 'caches';
|
||||||
$part = $_REQUEST['part'] ?? 'caches';
|
|
||||||
$entries = $_POST['entries'] ?? [];
|
$entries = $_POST['entries'] ?? [];
|
||||||
$action = $_POST['action'] ?? '';
|
$action = $_POST['action'] ?? '';
|
||||||
$s = $core->blog->settings->dcAdvancedCleaner;
|
|
||||||
$p_url = $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => $tab, 'part' => $part]);
|
|
||||||
|
|
||||||
# Combos
|
# Combos
|
||||||
$combo_title = [
|
$combo_title = [
|
||||||
'settings' => __('Settings'),
|
'settings' => __('Settings'),
|
||||||
'tables' => __('Tables'),
|
'tables' => __('Tables'),
|
||||||
'plugins' => __('Extensions'),
|
'plugins' => __('Extensions'),
|
||||||
'themes' => __('Themes'),
|
'themes' => __('Themes'),
|
||||||
'caches' => __('Cache'),
|
'caches' => __('Cache'),
|
||||||
'versions' => __('Versions')
|
'versions' => __('Versions')
|
||||||
];
|
];
|
||||||
$combo_type = [
|
$combo_type = [
|
||||||
'settings' => ['delete_global', 'delete_local', 'delete_all'],
|
'settings' => ['delete_global', 'delete_local', 'delete_all'],
|
||||||
'tables' => ['empty', 'delete'],
|
'tables' => ['empty', 'delete'],
|
||||||
'plugins' => ['empty', 'delete'],
|
'plugins' => ['empty', 'delete'],
|
||||||
'themes' => ['empty', 'delete'],
|
'themes' => ['empty', 'delete'],
|
||||||
'caches' => ['empty', 'delete'],
|
'caches' => ['empty', 'delete'],
|
||||||
'versions' => ['delete']
|
'versions' => ['delete']
|
||||||
];
|
];
|
||||||
$combo_funcs = [
|
$combo_funcs = [
|
||||||
'settings' => ['dcAdvancedCleaner', 'getSettings'],
|
'settings' => ['dcAdvancedCleaner', 'getSettings'],
|
||||||
'tables' => ['dcAdvancedCleaner', 'getTables'],
|
'tables' => ['dcAdvancedCleaner', 'getTables'],
|
||||||
'plugins' => ['dcAdvancedCleaner', 'getPlugins'],
|
'plugins' => ['dcAdvancedCleaner', 'getPlugins'],
|
||||||
'themes' => ['dcAdvancedCleaner', 'getThemes'],
|
'themes' => ['dcAdvancedCleaner', 'getThemes'],
|
||||||
'caches' => ['dcAdvancedCleaner', 'getCaches'],
|
'caches' => ['dcAdvancedCleaner', 'getCaches'],
|
||||||
'versions' => ['dcAdvancedCleaner', 'getVersions']
|
'versions' => ['dcAdvancedCleaner', 'getVersions']
|
||||||
];
|
];
|
||||||
$combo_actions = [
|
$combo_actions = [
|
||||||
'settings' => [
|
'settings' => [
|
||||||
__('delete global settings') => 'delete_global',
|
__('delete global settings') => 'delete_global',
|
||||||
__('delete blog settings') => 'delete_local',
|
__('delete blog settings') => 'delete_local',
|
||||||
__('delete all settings') =>'delete_all'
|
__('delete all settings') =>'delete_all'
|
||||||
],
|
],
|
||||||
'tables' => [
|
'tables' => [
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
],
|
],
|
||||||
'plugins' => [
|
'plugins' => [
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
],
|
],
|
||||||
'themes' => [
|
'themes' => [
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
],
|
],
|
||||||
'caches' => [
|
'caches' => [
|
||||||
__('delete') => 'delete',
|
__('delete') => 'delete',
|
||||||
__('empty') => 'empty'
|
__('empty') => 'empty'
|
||||||
],
|
],
|
||||||
'versions' => [
|
'versions' => [
|
||||||
__('delete') => 'delete'
|
__('delete') => 'delete'
|
||||||
|
@ -101,16 +97,15 @@ $combo_actions = [
|
||||||
];
|
];
|
||||||
$combo_help = [
|
$combo_help = [
|
||||||
'settings' => __('Namespaces registered in dcSettings'),
|
'settings' => __('Namespaces registered in dcSettings'),
|
||||||
'tables' => __('All database tables of Dotclear'),
|
'tables' => __('All database tables of Dotclear'),
|
||||||
'plugins' => __('Folders from plugins directories'),
|
'plugins' => __('Folders from plugins directories'),
|
||||||
'themes' => __('Folders from blog themes directory'),
|
'themes' => __('Folders from blog themes directory'),
|
||||||
'caches' => __('Folders from cache directory'),
|
'caches' => __('Folders from cache directory'),
|
||||||
'versions' => __('Versions registered in table "version" of Dotclear')
|
'versions' => __('Versions registered in table "version" of Dotclear')
|
||||||
];
|
];
|
||||||
|
|
||||||
# Actions
|
# Actions
|
||||||
if ($tab == 'lists'
|
if (!empty($entries)
|
||||||
&& !empty($entries)
|
|
||||||
&& isset($combo_type[$part])
|
&& isset($combo_type[$part])
|
||||||
&& in_array($action, $combo_type[$part])
|
&& in_array($action, $combo_type[$part])
|
||||||
) {
|
) {
|
||||||
|
@ -121,7 +116,7 @@ if ($tab == 'lists'
|
||||||
dcPage::addSuccessNotice(__('Action successfuly excecuted'));
|
dcPage::addSuccessNotice(__('Action successfuly excecuted'));
|
||||||
$core->adminurl->redirect(
|
$core->adminurl->redirect(
|
||||||
'admin.plugin.dcAdvancedCleaner',
|
'admin.plugin.dcAdvancedCleaner',
|
||||||
['tab' => 'lists', 'part' => $part]
|
['part' => $part]
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
catch(Exception $e) {
|
catch(Exception $e) {
|
||||||
|
@ -130,35 +125,30 @@ if ($tab == 'lists'
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<html><head><title>' . __('Advanced cleaner') . '</title>' .
|
echo '<html><head><title>' . __('Advanced cleaner') . '</title>' .
|
||||||
dcPage::cssLoad('index.php?pf=dcAdvancedCleaner/style.css') .
|
dcPage::cssLoad(dcPage::getPF('dcAdvancedCleaner/style.css')) .
|
||||||
dcPage::jsPageTabs($tab);
|
dcPage::jsLoad(dcPage::getPF('dcAdvancedCleaner/js/index.js'));
|
||||||
|
|
||||||
# --BEHAVIOR-- dcAdvancedCleanerAdminHeader
|
# --BEHAVIOR-- dcAdvancedCleanerAdminHeader
|
||||||
$core->callBehavior('dcAdvancedCleanerAdminHeader', $core, $p_url, $tab);
|
$core->callBehavior('dcAdvancedCleanerAdminHeader', $core);
|
||||||
|
|
||||||
echo '</head><body>' .
|
echo '</head><body>' .
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
html::escapeHTML($core->blog->name) => '',
|
__('Plugins') => '',
|
||||||
'<span class="page-title">' . __('Advanced cleaner') . '</span>' => ''
|
__('Advanced cleaner') => ''
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() . '
|
dcPage::notices();
|
||||||
<div class="multi-part" id="lists" title="' . __('Records and folders') . '">
|
|
||||||
<h3>'. __('Records and folders') .'</h3><p>';
|
|
||||||
|
|
||||||
foreach($combo_title as $k => $v) {
|
# select menu list
|
||||||
echo sprintf(
|
echo
|
||||||
'<a class="button" href="%s">%s</a>',
|
'<form method="get" action="' . $core->adminurl->get('admin.plugin.dcAdvancedCleaner') . '" id="parts_menu">' .
|
||||||
$core->adminurl->get(
|
'<p class="anchor-nav"><label for="part" class="classic">' . __('Goto:') . ' </label>' .
|
||||||
'admin.plugin.dcAdvancedCleaner',
|
form::combo('part', array_flip($combo_title), $part) . ' ' .
|
||||||
['tab' => 'lists', 'part' => $k]
|
'<input type="submit" value="' . __('Ok') . '" />' .
|
||||||
),
|
form::hidden('p', 'dcAdvancedCleaner') . '</p>' .
|
||||||
$v
|
'</form>';
|
||||||
);
|
|
||||||
}
|
|
||||||
echo '</p>';
|
|
||||||
|
|
||||||
if (isset($combo_funcs[$part])) {
|
if (isset($combo_funcs[$part])) {
|
||||||
echo '<h4>' . $combo_title[$part] . '</h4><p>' . $combo_help[$part] . '</p>';
|
echo '<h3>' . $combo_title[$part] . '</h3><p>' . $combo_help[$part] . '</p>';
|
||||||
|
|
||||||
$rs = call_user_func($combo_funcs[$part], $core);
|
$rs = call_user_func($combo_funcs[$part], $core);
|
||||||
|
|
||||||
|
@ -166,39 +156,36 @@ if (isset($combo_funcs[$part])) {
|
||||||
echo '<p>' . sprintf(__('There is no %s'), __(substr($part, 0, -1))) . '</p>';
|
echo '<p>' . sprintf(__('There is no %s'), __(substr($part, 0, -1))) . '</p>';
|
||||||
} else {
|
} else {
|
||||||
echo
|
echo
|
||||||
'<p>' . sprintf(__('There are %s %s'), count($rs), __($part)) . '</p>' .
|
'<form method="post" action="' . $core->adminurl->get('admin.plugin.dcAdvancedCleaner') . '" id="form-funcs">' .
|
||||||
'<form method="post" action="' . $p_url . '">' .
|
|
||||||
'<div class="table-outer">' .
|
'<div class="table-outer">' .
|
||||||
'<table><caption class="hidden">' . __($part) . '</caption><thead><tr>' .
|
'<table><caption>' . sprintf(__('There are %s %s'), count($rs), __($part)) . '</caption><thead><tr>' .
|
||||||
'<th>' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
|
'<th colspan="2">' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
|
||||||
'</tr></thead><tbody>';
|
'</tr></thead><tbody>';
|
||||||
|
|
||||||
$official = dcAdvancedCleaner::getOfficial($part);
|
$official = dcAdvancedCleaner::getOfficial($part);
|
||||||
foreach($rs as $k => $v) {
|
foreach($rs as $k => $v) {
|
||||||
$offline = in_array($v['key'], $official);
|
$offline = in_array($v['key'], $official);
|
||||||
|
|
||||||
if ($s->dcAdvancedCleaner_dcproperty_hide && $offline) {
|
if ($offline && $core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'<tr class="line' .
|
'<tr class="line' . ($offline ? ' offline' : '') . '">' .
|
||||||
($offline ? ' offline' : '') .
|
'<td class="nowrap">' .
|
||||||
'">' .
|
form::checkbox(
|
||||||
'<td class="nowrap"><label class="classic">' .
|
['entries[' . $k . ']', 'entries_' . $k],
|
||||||
form::checkbox(
|
html::escapeHTML($v['key'])
|
||||||
['entries[' . $k . ']'],
|
) . '</td> ' .
|
||||||
html::escapeHTML($v['key'])
|
'<td class="nowrap"><label for="entries_' . $k . '" class="classic">' . $v['key'] . '</label></td>' .
|
||||||
) . ' ' . $v['key'] . '</label></td>' .
|
'<td class="nowrap maximal">' . $v['value'] . '</td>' .
|
||||||
'<td class="nowrap">' . $v['value'] . '</td>' .
|
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'</tbody></table></div>' .
|
'</tbody></table></div>' .
|
||||||
'<p class="field">' . __('Action on selected rows:') . ' ' .
|
'<p class="field">' . __('Action on selected rows:') . ' ' .
|
||||||
form::combo(['action'], $combo_actions[$part]) .
|
form::combo(['action'], $combo_actions[$part]) .
|
||||||
'<input type="submit" value="' . __('Save') . '" />' .
|
'<input id="do-action" type="submit" value="' . __('ok') . '" />' .
|
||||||
form::hidden(['p'], 'dcAdvancedCleaner') .
|
form::hidden(['p'], 'dcAdvancedCleaner') .
|
||||||
form::hidden(['tab'], 'lists') .
|
|
||||||
form::hidden(['part'], $part) .
|
form::hidden(['part'], $part) .
|
||||||
$core->formNonce() . '</p>' .
|
$core->formNonce() . '</p>' .
|
||||||
'<p class="info">' .
|
'<p class="info">' .
|
||||||
|
@ -207,17 +194,12 @@ if (isset($combo_funcs[$part])) {
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($s->dcAdvancedCleaner_dcproperty_hide) {
|
if ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide) {
|
||||||
echo '<p class="info">' .
|
echo '<p class="info">' .
|
||||||
__('Default values of Dotclear are hidden. You can change this in settings tab') .
|
__('Default values of Dotclear are hidden. You can change this in settings') .
|
||||||
'</p>';
|
'</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
|
||||||
|
|
||||||
# --BEHAVIOR-- dcAdvancedCleanerAdminTabs
|
|
||||||
$core->callBehavior('dcAdvancedCleanerAdminTabs', $core);
|
|
||||||
|
|
||||||
dcPage::helpBlock('dcAdvancedCleaner');
|
dcPage::helpBlock('dcAdvancedCleaner');
|
||||||
|
|
||||||
echo '</body></html>';
|
echo '</body></html>';
|
8
js/index.js
Normal file
8
js/index.js
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
/*global $, dotclear */
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
$(function () {
|
||||||
|
$('#parts_menu input[type=submit]').hide();
|
||||||
|
$('#parts_menu #part').on('change', function () {this.form.submit();});
|
||||||
|
dotclear.condSubmit('#form-funcs td input[type=checkbox]', '#form-funcs #do-action');
|
||||||
|
});
|
Loading…
Reference in a new issue