minor fix from latest dotclear 2.27-dev features

This commit is contained in:
Jean-Christian Paul Denis 2023-07-28 22:29:42 +02:00
parent f76b356bea
commit 29e91917b2
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
2 changed files with 14 additions and 15 deletions

View File

@ -57,13 +57,9 @@ class Backend extends Process
self::moduleBeforeDelete($define); self::moduleBeforeDelete($define);
}, },
// add js to hide delete button when uninstaller exists // add js to hide delete button when uninstaller exists
'pluginsToolsHeadersV2' => function (): string { 'pluginsToolsHeadersV2' => fn (): string => self::modulesToolsHeader(),
return self::modulesToolsHeader();
},
// add js to hide delete button when uninstaller exists // add js to hide delete button when uninstaller exists
'themesToolsHeadersV2' => function (): string { 'themesToolsHeadersV2' => fn (): string => self::modulesToolsHeader(),
return self::modulesToolsHeader();
},
]); ]);
return true; return true;
@ -111,9 +107,9 @@ class Backend extends Process
array_unshift($done, __('Plugin has been successfully uninstalled.')); array_unshift($done, __('Plugin has been successfully uninstalled.'));
Page::addSuccessNotice(implode('<br />', $done)); Page::addSuccessNotice(implode('<br />', $done));
if ($define->get('type') == 'theme') { if ($define->get('type') == 'theme') {
dcCore::app()->adminurl?->redirect('admin.blog.theme', [], '#themes'); dcCore::app()->admin->url->redirect('admin.blog.theme', [], '#themes');
} else { } else {
dcCore::app()->adminurl?->redirect('admin.plugins', [], '#plugins'); dcCore::app()->admin->url->redirect('admin.plugins', [], '#plugins');
} }
} }
} catch (Exception $e) { } catch (Exception $e) {

View File

@ -18,7 +18,10 @@ use dcCore;
use dcModuleDefine; use dcModuleDefine;
use dcThemes; use dcThemes;
use Dotclear\Core\Process; use Dotclear\Core\Process;
use Dotclear\Core\Backend\Page; use Dotclear\Core\Backend\{
Notices,
Page
};
use Dotclear\Helper\Html\Form\{ use Dotclear\Helper\Html\Form\{
Checkbox, Checkbox,
Div, Div,
@ -93,9 +96,9 @@ class Manage extends Process
// list success actions // list success actions
if (!empty($done)) { if (!empty($done)) {
array_unshift($done, __('Uninstall action successfuly excecuted')); array_unshift($done, __('Uninstall action successfuly excecuted'));
Page::addSuccessNotice(implode('<br />', $done)); Notices::addSuccessNotice(implode('<br />', $done));
} else { } else {
Page::addWarningNotice(__('No uninstall action done')); Notices::addWarningNotice(__('No uninstall action done'));
} }
self::doRedirect(); self::doRedirect();
} catch (Exception $e) { } catch (Exception $e) {
@ -135,7 +138,7 @@ class Manage extends Process
__('System') => '', __('System') => '',
My::name() => '', My::name() => '',
]) . ]) .
Page::notices(); Notices::getNotices();
// user actions form fields // user actions form fields
foreach ($uninstaller->getUserActions($define->getId()) as $cleaner => $stack) { foreach ($uninstaller->getUserActions($define->getId()) as $cleaner => $stack) {
@ -160,7 +163,7 @@ class Manage extends Process
echo (new Div())->items([ echo (new Div())->items([
(new Text('h3', sprintf((self::getType() == 'theme' ? __('Uninstall theme "%s"') : __('Uninstall plugin "%s"')), __($define->get('name'))))), (new Text('h3', sprintf((self::getType() == 'theme' ? __('Uninstall theme "%s"') : __('Uninstall plugin "%s"')), __($define->get('name'))))),
(new Text('p', sprintf(__('The module "%s %s" offers advanced unsintall process:'), $define->getId(), $define->get('version')))), (new Text('p', sprintf(__('The module "%s %s" offers advanced unsintall process:'), $define->getId(), $define->get('version')))),
(new Form('uninstall-form'))->method('post')->action(dcCore::app()->adminurl?->get('admin.plugin.' . My::id()))->fields($fields), (new Form('uninstall-form'))->method('post')->action(dcCore::app()->admin->url->get('admin.plugin.' . My::id()))->fields($fields),
])->render(); ])->render();
Page::closeModule(); Page::closeModule();
@ -178,11 +181,11 @@ class Manage extends Process
private static function getRedirect(): string private static function getRedirect(): string
{ {
return (string) dcCore::app()->adminurl?->get(self::getRedir()) . '#' . self::getType() . 's'; return (string) dcCore::app()->admin->url->get(self::getRedir()) . '#' . self::getType() . 's';
} }
private static function doRedirect(): void private static function doRedirect(): void
{ {
dcCore::app()->adminurl?->redirect(self::getRedir(), [], '#' . self::getType() . 's'); dcCore::app()->admin->url->redirect(self::getRedir(), [], '#' . self::getType() . 's');
} }
} }