revamp admin design
parent
d469782cfb
commit
8743445164
|
@ -1,10 +1,10 @@
|
||||||
0.7.3.1 - dev
|
0.7.3.1 - dev
|
||||||
- [ ] orphan media cleaner
|
- [ ] orphan media cleaner
|
||||||
- [ ] ajouter dossier /var dans la liste des caches
|
- [ ] ajouter dossier /var dans la liste des caches
|
||||||
- [ ] update DC official values (themes,settings,tables...)
|
- [x] update DC official values (themes,settings,tables...)
|
||||||
- [ ] fix admin design
|
- [x] fix admin design
|
||||||
- [ ] fix php7.3+ and php8.0
|
- [x] fix php7.3+ and php8.0
|
||||||
- [ ] fix PSR(1)2 coding style
|
- [x] fix PSR(1)2 coding style
|
||||||
- [ ] fix translation
|
- [ ] fix translation
|
||||||
- [x] add dcstore (pre release)
|
- [x] add dcstore (pre release)
|
||||||
- [x] update license
|
- [x] update license
|
||||||
|
|
12
_config.php
12
_config.php
|
@ -1,5 +1,15 @@
|
||||||
<?php
|
<?php
|
||||||
|
/**
|
||||||
|
* @brief dcAdvancedCleaner, a plugin for Dotclear 2
|
||||||
|
*
|
||||||
|
* @package Dotclear
|
||||||
|
* @subpackage Plugin
|
||||||
|
*
|
||||||
|
* @author Jean-Christian Denis and Contributors
|
||||||
|
*
|
||||||
|
* @copyright Jean-Christian Denis
|
||||||
|
* @copyright GPL-2.0 https://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*/
|
||||||
|
|
||||||
if (!defined('DC_CONTEXT_MODULE')) {
|
if (!defined('DC_CONTEXT_MODULE')) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -60,17 +60,16 @@ class behaviorsDcAdvancedCleaner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function dcAdvancedCleanerAdminTabs($core, $p_url)
|
public static function dcAdvancedCleanerAdminTabs($core)
|
||||||
{
|
{
|
||||||
self::modulesTabs($core,DC_PLUGINS_ROOT,$p_url.'&tab=uninstaller');
|
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, 'plugins.php?tab=uninstaller');
|
self::modulesTabs($core, DC_PLUGINS_ROOT, $core->adminurl->get('admin.plugins', ['tab' => 'uninstaller']));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Generic module tabs
|
|
||||||
public static function modulesTabs($core, $path, $redir, $title = '')
|
public static function modulesTabs($core, $path, $redir, $title = '')
|
||||||
{
|
{
|
||||||
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) {
|
if (!$core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_behavior_active) {
|
||||||
|
@ -119,13 +118,14 @@ class behaviorsDcAdvancedCleaner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
http::redirect($redir . '&msg=1');
|
dcPage::addSuccessNotice(__('Action successfuly excecuted'));
|
||||||
|
http::redirect($redir);
|
||||||
} catch(Exception $e) {
|
} catch(Exception $e) {
|
||||||
$err = $e->getMessage();
|
$err = $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '<div class="multi-part" id="uninstaller" title="' . __($title) . '">';
|
echo '<div class="multi-part" id="uninstaller" title="' . __($title) . '"><h3>' . __($title) . '</h3>';
|
||||||
|
|
||||||
if($err) {
|
if($err) {
|
||||||
echo '<p class="error">' . $err . '</p>';
|
echo '<p class="error">' . $err . '</p>';
|
||||||
|
@ -214,7 +214,8 @@ class behaviorsDcAdvancedCleaner
|
||||||
form::hidden(['action'], 'uninstall') .
|
form::hidden(['action'], 'uninstall') .
|
||||||
'<input type="submit" name="submit" value="' . __('Perform selected actions') . '" /> ' .
|
'<input type="submit" name="submit" value="' . __('Perform selected actions') . '" /> ' .
|
||||||
'</p>' .
|
'</p>' .
|
||||||
'</form>' .
|
'</form>';
|
||||||
'</div>';
|
|
||||||
|
echo '</div>';
|
||||||
}
|
}
|
||||||
}
|
}
|
249
index.php
249
index.php
|
@ -18,11 +18,53 @@ if (!$core->auth->isSuperAdmin()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
$page_title = __('Advanced cleaner');
|
# Localized l10n
|
||||||
|
__('Settings'); __('settings'); __('setting');
|
||||||
|
__('Tables'); __('tables'); __('table');
|
||||||
|
__('Plugins'); __('plugins'); __('plugin');
|
||||||
|
__('Themes'); __('themes'); __('theme');
|
||||||
|
__('Caches'); __('caches'); __('cache');
|
||||||
|
__('Versions'); __('versions'); __('version');
|
||||||
|
__('delete table');
|
||||||
|
__('delete cache files');
|
||||||
|
__('delete plugin files');
|
||||||
|
__('delete theme files');
|
||||||
|
__('delete the version number');
|
||||||
|
__('Uninstall extensions');
|
||||||
|
__('delete %s blog settings');
|
||||||
|
__('delete %s global settings');
|
||||||
|
__('delete all %s settings');
|
||||||
|
__('delete %s table');
|
||||||
|
__('delete %s version number');
|
||||||
|
__('delete %s plugin files');
|
||||||
|
__('delete %s theme file');
|
||||||
|
__('delete %s cache files');
|
||||||
|
|
||||||
# Lists
|
# vars
|
||||||
function drawDcAdvancedCleanerLists($core, $type)
|
$tab = $_REQUEST['tab'] ?? 'lists';
|
||||||
{
|
$part = $_REQUEST['part'] ?? 'caches';
|
||||||
|
$entries = $_POST['entries'] ?? [];
|
||||||
|
$action = $_POST['action'] ?? '';
|
||||||
|
$s = $core->blog->settings->dcAdvancedCleaner;
|
||||||
|
$p_url = $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => $tab, 'part' => $part]);
|
||||||
|
|
||||||
|
# Combos
|
||||||
|
$combo_title = [
|
||||||
|
'settings' => __('Settings'),
|
||||||
|
'tables' => __('Tables'),
|
||||||
|
'plugins' => __('Extensions'),
|
||||||
|
'themes' => __('Themes'),
|
||||||
|
'caches' => __('Cache'),
|
||||||
|
'versions' => __('Versions')
|
||||||
|
];
|
||||||
|
$combo_type = [
|
||||||
|
'settings' => ['delete_global', 'delete_local', 'delete_all'],
|
||||||
|
'tables' => ['empty', 'delete'],
|
||||||
|
'plugins' => ['empty', 'delete'],
|
||||||
|
'themes' => ['empty', 'delete'],
|
||||||
|
'caches' => ['empty', 'delete'],
|
||||||
|
'versions' => ['delete']
|
||||||
|
];
|
||||||
$combo_funcs = [
|
$combo_funcs = [
|
||||||
'settings' => ['dcAdvancedCleaner', 'getSettings'],
|
'settings' => ['dcAdvancedCleaner', 'getSettings'],
|
||||||
'tables' => ['dcAdvancedCleaner', 'getTables'],
|
'tables' => ['dcAdvancedCleaner', 'getTables'],
|
||||||
|
@ -66,32 +108,76 @@ function drawDcAdvancedCleanerLists($core, $type)
|
||||||
'versions' => __('Versions registered in table "version" of Dotclear')
|
'versions' => __('Versions registered in table "version" of Dotclear')
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!isset($combo_funcs[$type])) {
|
# Actions
|
||||||
return '';
|
if ($tab == 'lists'
|
||||||
|
&& !empty($entries)
|
||||||
|
&& isset($combo_type[$part])
|
||||||
|
&& in_array($action, $combo_type[$part])
|
||||||
|
) {
|
||||||
|
try {
|
||||||
|
foreach($entries as $v) {
|
||||||
|
dcAdvancedCleaner::execute($core, $part, $action, $v);
|
||||||
|
}
|
||||||
|
dcPage::addSuccessNotice(__('Action successfuly excecuted'));
|
||||||
|
$core->adminurl->redirect(
|
||||||
|
'admin.plugin.dcAdvancedCleaner',
|
||||||
|
['tab' => 'lists', 'part' => $part]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
catch(Exception $e) {
|
||||||
|
$core->error->add($e->getMessage());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$rs = call_user_func($combo_funcs[$type], $core);
|
echo '<html><head><title>' . __('Advanced cleaner') . '</title>' .
|
||||||
|
dcPage::cssLoad('index.php?pf=dcAdvancedCleaner/style.css') .
|
||||||
|
dcPage::jsPageTabs($tab);
|
||||||
|
|
||||||
echo
|
# --BEHAVIOR-- dcAdvancedCleanerAdminHeader
|
||||||
'<div class="listDcAdvancedCleaner">' .
|
$core->callBehavior('dcAdvancedCleanerAdminHeader', $core, $p_url, $tab);
|
||||||
'<p class="form-note">' . $combo_help[$type] . '</p>';
|
|
||||||
|
echo '</head><body>' .
|
||||||
|
dcPage::breadcrumb([
|
||||||
|
html::escapeHTML($core->blog->name) => '',
|
||||||
|
'<span class="page-title">' . __('Advanced cleaner') . '</span>' => ''
|
||||||
|
]) .
|
||||||
|
dcPage::notices() . '
|
||||||
|
<div class="multi-part" id="lists" title="' . __('Records and folders') . '">
|
||||||
|
<h3>'. __('Records and folders') .'</h3><p>';
|
||||||
|
|
||||||
|
foreach($combo_title as $k => $v) {
|
||||||
|
echo sprintf(
|
||||||
|
'<a class="button" href="%s">%s</a>',
|
||||||
|
$core->adminurl->get(
|
||||||
|
'admin.plugin.dcAdvancedCleaner',
|
||||||
|
['tab' => 'lists', 'part' => $k]
|
||||||
|
),
|
||||||
|
$v
|
||||||
|
);
|
||||||
|
}
|
||||||
|
echo '</p>';
|
||||||
|
|
||||||
|
if (isset($combo_funcs[$part])) {
|
||||||
|
echo '<h4>' . $combo_title[$part] . '</h4><p>' . $combo_help[$part] . '</p>';
|
||||||
|
|
||||||
|
$rs = call_user_func($combo_funcs[$part], $core);
|
||||||
|
|
||||||
if (empty($rs)) {
|
if (empty($rs)) {
|
||||||
echo
|
echo '<p>' . sprintf(__('There is no %s'), __(substr($part, 0, -1))) . '</p>';
|
||||||
'<p>' . sprintf(__('There is no %s'), __(substr($type, 0, -1))) . '</p>';
|
|
||||||
} else {
|
} else {
|
||||||
echo
|
echo
|
||||||
'<p>' . sprintf(__('There are %s %s'), count($rs), __($type)) . '</p>' .
|
'<p>' . sprintf(__('There are %s %s'), count($rs), __($part)) . '</p>' .
|
||||||
'<form method="post" action="' . $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => 'lists', 'part' => $type]) . '">' .
|
'<form method="post" action="' . $p_url . '">' .
|
||||||
'<table><thead><tr>' .
|
'<div class="table-outer">' .
|
||||||
|
'<table><caption class="hidden">' . __($part) . '</caption><thead><tr>' .
|
||||||
'<th>' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
|
'<th>' . __('Name') . '</th><th>' . __('Objects') . '</th>' .
|
||||||
'</tr></thead><tbody>';
|
'</tr></thead><tbody>';
|
||||||
|
|
||||||
$official = dcAdvancedCleaner::getOfficial($type);
|
$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 ($core->blog->settings->dcAdvancedCleaner->dcAdvancedCleaner_dcproperty_hide && $offline) {
|
if ($s->dcAdvancedCleaner_dcproperty_hide && $offline) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
|
@ -99,133 +185,38 @@ function drawDcAdvancedCleanerLists($core, $type)
|
||||||
($offline ? ' offline' : '') .
|
($offline ? ' offline' : '') .
|
||||||
'">' .
|
'">' .
|
||||||
'<td class="nowrap"><label class="classic">' .
|
'<td class="nowrap"><label class="classic">' .
|
||||||
form::checkbox(['entries[' . $k . ']'], html::escapeHTML($v['key'])) . ' ' . $v['key'] . '</label></td>' .
|
form::checkbox(
|
||||||
|
['entries[' . $k . ']'],
|
||||||
|
html::escapeHTML($v['key'])
|
||||||
|
) . ' ' . $v['key'] . '</label></td>' .
|
||||||
'<td class="nowrap">' . $v['value'] . '</td>' .
|
'<td class="nowrap">' . $v['value'] . '</td>' .
|
||||||
'</tr>';
|
'</tr>';
|
||||||
}
|
}
|
||||||
echo
|
echo
|
||||||
'</tbody></table>' .
|
'</tbody></table></div>' .
|
||||||
'<p>' . __('Action on selected rows:') . '<br />' .
|
'<p class="field">' . __('Action on selected rows:') . ' ' .
|
||||||
form::combo(['action'], $combo_actions[$type]) .
|
form::combo(['action'], $combo_actions[$part]) .
|
||||||
'<input type="submit" value="' . __('save') . '" />' .
|
'<input type="submit" value="' . __('Save') . '" />' .
|
||||||
form::hidden(['p'], 'dcAdvancedCleaner') .
|
form::hidden(['p'], 'dcAdvancedCleaner') .
|
||||||
form::hidden(['tab'], 'lists') .
|
form::hidden(['tab'], 'lists') .
|
||||||
form::hidden(['part'], $type) .
|
form::hidden(['part'], $part) .
|
||||||
form::hidden(['type'], $type) .
|
|
||||||
$core->formNonce() . '</p>' .
|
$core->formNonce() . '</p>' .
|
||||||
|
'<p class="info">' .
|
||||||
|
__('Beware: All actions done here are irreversible and are directly applied') .
|
||||||
|
'</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
}
|
}
|
||||||
echo
|
|
||||||
'<div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
# Localized l10n
|
|
||||||
__('Settings'); __('settings'); __('setting');
|
|
||||||
__('Tables'); __('tables'); __('table');
|
|
||||||
__('Plugins'); __('plugins'); __('plugin');
|
|
||||||
__('Themes'); __('themes'); __('theme');
|
|
||||||
__('Caches'); __('caches'); __('cache');
|
|
||||||
__('Versions'); __('versions'); __('version');
|
|
||||||
__('delete table');
|
|
||||||
__('delete cache files');
|
|
||||||
__('delete plugin files');
|
|
||||||
__('delete theme files');
|
|
||||||
__('delete the version number');
|
|
||||||
__('Uninstall extensions');
|
|
||||||
__('delete %s blog settings');
|
|
||||||
__('delete %s global settings');
|
|
||||||
__('delete all %s settings');
|
|
||||||
__('delete %s table');
|
|
||||||
__('delete %s version number');
|
|
||||||
__('delete %s plugin files');
|
|
||||||
__('delete %s theme file');
|
|
||||||
__('delete %s cache files');
|
|
||||||
|
|
||||||
# vars
|
|
||||||
$tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'dcac';
|
|
||||||
$part = isset($_REQUEST['part']) ? $_REQUEST['part'] : 'caches';
|
|
||||||
$entries = isset($_POST['entries']) ? $_POST['entries'] : '';
|
|
||||||
$action = isset($_POST['action']) ? $_POST['action'] : '';
|
|
||||||
$type = isset($_POST['type']) ? $_POST['type'] : '';
|
|
||||||
$s = $core->blog->settings->dcAdvancedCleaner;
|
|
||||||
|
|
||||||
# Combos
|
|
||||||
$combo_title = [
|
|
||||||
'settings' => __('Settings'),
|
|
||||||
'tables' => __('Tables'),
|
|
||||||
'plugins' => __('Extensions'),
|
|
||||||
'themes' => __('Themes'),
|
|
||||||
'caches' => __('Cache'),
|
|
||||||
'versions' => __('Versions')
|
|
||||||
];
|
|
||||||
|
|
||||||
$combo_type = [
|
|
||||||
'settings' => ['delete_global','delete_local','delete_all'],
|
|
||||||
'tables' => ['empty','delete'],
|
|
||||||
'plugins' => ['empty','delete'],
|
|
||||||
'themes' => ['empty','delete'],
|
|
||||||
'caches' => ['empty','delete'],
|
|
||||||
'versions' => ['delete']
|
|
||||||
];
|
|
||||||
|
|
||||||
# Actions
|
|
||||||
if ($tab == 'lists' && !empty($entries)
|
|
||||||
&& isset($combo_type[$type])
|
|
||||||
&& in_array($action,$combo_type[$type])) {
|
|
||||||
|
|
||||||
try {
|
|
||||||
foreach($entries as $v) {
|
|
||||||
dcAdvancedCleaner::execute($core, $type, $action, $v);
|
|
||||||
}
|
|
||||||
|
|
||||||
dcPage::addSuccessNotice(__('Action successfuly excecuted'));
|
|
||||||
$core->adminurl->redirect('admin.plugin.dcAdvancedCleaner', ['tab' => 'list', 'part' => $part]);
|
|
||||||
}
|
|
||||||
catch(Exception $e) {
|
|
||||||
$core->error->add($e->getMessage());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo '
|
|
||||||
<html><head>
|
|
||||||
<title>' . $page_title . '</title>
|
|
||||||
<link rel="stylesheet" type="text/css" href="index.php?pf=dcAdvancedCleaner/style.css" />' .
|
|
||||||
dcPage::jsToolBar() .
|
|
||||||
dcPage::jsPageTabs($tab) . '
|
|
||||||
</style>';
|
|
||||||
|
|
||||||
# --BEHAVIOR-- dcAdvancedCleanerAdminHeader
|
|
||||||
$core->callBehavior('dcAdvancedCleanerAdminHeader', $core, $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => $tab, 'part' => $part]), $tab);
|
|
||||||
|
|
||||||
echo '
|
|
||||||
</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
|
||||||
html::escapeHTML($core->blog->name) => '',
|
|
||||||
'<span class="page-title">' . $page_title . '</span>' => ''
|
|
||||||
]);
|
|
||||||
echo
|
|
||||||
'<p class="warning">' . __('Beware: All actions done here are irreversible and are directly applied') . '</p>';
|
|
||||||
|
|
||||||
echo '<div class="multi-part" id="lists" title="' . __('Records and folders') . '">' .
|
|
||||||
'<p>';
|
|
||||||
foreach($combo_title as $k => $v) {
|
|
||||||
echo '<a class="button" href="' . $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => 'lists', 'part' => $k]) . '">' . $v . '</a> ';
|
|
||||||
}
|
|
||||||
echo '</p>';
|
|
||||||
|
|
||||||
# Load "part" page
|
|
||||||
if (isset($combo_title[$part])) {
|
|
||||||
echo '<fieldset><legend>' . $combo_title[$part] . '</legend>';
|
|
||||||
drawDcAdvancedCleanerLists($core, $part);
|
|
||||||
echo '</fieldset>';
|
|
||||||
}
|
}
|
||||||
if ($s->dcAdvancedCleaner_dcproperty_hide) {
|
if ($s->dcAdvancedCleaner_dcproperty_hide) {
|
||||||
echo '<p class="info">' . __('Default values of Dotclear are hidden. You can change this in settings tab') . '</p>';
|
echo '<p class="info">' .
|
||||||
|
__('Default values of Dotclear are hidden. You can change this in settings tab') .
|
||||||
|
'</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo '</div>';
|
echo '</div>';
|
||||||
|
|
||||||
# --BEHAVIOR-- dcAdvancedCleanerAdminTabs
|
# --BEHAVIOR-- dcAdvancedCleanerAdminTabs
|
||||||
$core->callBehavior('dcAdvancedCleanerAdminTabs', $core, $core->adminurl->get('admin.plugin.dcAdvancedCleaner', ['tab' => $tab, 'part' => $part]));
|
$core->callBehavior('dcAdvancedCleanerAdminTabs', $core);
|
||||||
|
|
||||||
dcPage::helpBlock('dcAdvancedCleaner');
|
dcPage::helpBlock('dcAdvancedCleaner');
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue