From 37cc921b5f068696619767765c169597f06b4ca4 Mon Sep 17 00:00:00 2001
From: Jean-Christian Denis
Date: Tue, 9 May 2023 01:26:01 +0200
Subject: [PATCH] use dcPage modules features
---
src/Manage.php | 178 ++++++++++++++++++++++++-------------------------
1 file changed, 86 insertions(+), 92 deletions(-)
diff --git a/src/Manage.php b/src/Manage.php
index 0ffa8a8..1459b98 100644
--- a/src/Manage.php
+++ b/src/Manage.php
@@ -74,7 +74,7 @@ class Manage extends dcNsProcess
if (!dcCore::app()->error->flag()) {
dcPage::addSuccessNotice(__('The new template has been successfully created.'));
- dcCore::app()->adminurl->redirect('admin.plugin.templator');
+ dcCore::app()->adminurl->redirect('admin.plugin.' . My::id());
}
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
@@ -93,7 +93,7 @@ class Manage extends dcNsProcess
if (!dcCore::app()->error->flag()) {
dcPage::addSuccessNotice(__('The template has been successfully copied.'));
- dcCore::app()->adminurl->redirect('admin.plugin.templator', ['part' => 'files']);
+ dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['part' => 'files']);
}
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
@@ -112,7 +112,7 @@ class Manage extends dcNsProcess
if (!dcCore::app()->error->flag()) {
dcPage::addSuccessNotice(__('The template has been successfully copied.'));
- dcCore::app()->adminurl->redirect('admin.plugin.templator', ['part' => 'files']);
+ dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['part' => 'files']);
}
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
@@ -130,7 +130,7 @@ class Manage extends dcNsProcess
if (!dcCore::app()->error->flag()) {
dcPage::addSuccessNotice(__('The template has been successfully removed.'));
- dcCore::app()->adminurl->redirect('admin.plugin.templator', ['part' => 'files']);
+ dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['part' => 'files']);
}
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
@@ -161,13 +161,11 @@ class Manage extends dcNsProcess
if (!$t->canUseRessources(true)) {
dcCore::app()->error->add(__('The plugin is unusable with your configuration. You have to change file permissions.'));
+ dcPage::openModule(My::name());
echo
- '' . __('Templator') . '' .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('New template') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id())
]) .
dcPage::notices();
@@ -175,18 +173,17 @@ class Manage extends dcNsProcess
* Duplicate dotclear template
*/
} elseif ('new' == $v->part) {
+ dcPage::openModule(My::name());
echo
- '' . __('Templator') . '' .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('New template') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices() .
- '';
@@ -247,18 +243,17 @@ class Manage extends dcNsProcess
};
$name = $full_name . dcCore::app()->blog->getCategory($category_id)->f('cat_title');
+ dcPage::openModule(My::name());
echo
- '' . __('Templator') . '' .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('Copy available template') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices() .
- '
' .
'';
@@ -276,24 +271,23 @@ class Manage extends dcNsProcess
* Delete templator template
*/
} elseif ('delete' == $v->part && !empty($_REQUEST['file'])) {
+ dcPage::openModule(My::name());
echo
- '' . __('Templator') . '' .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('Delete available template') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices() .
- '';
@@ -302,22 +296,21 @@ class Manage extends dcNsProcess
* List templator templates
*/
} elseif ('files' == $v->part) {
+ dcPage::openModule(My::name());
echo
- '' . __('Templator') . '' .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('Available templates') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices() .
- '' . __('Available templates') . '
';
+ '' . $v->name . '
';
if (count($v->items) == 0) {
echo '' . __('No template.') . '
';
} else {
// reuse "used templatro template" filter settings
- $filter = new adminGenericFilterV2('templator');
+ $filter = new adminGenericFilterV2(My::id());
$filter->add(dcAdminFilters::getPageFilter());
$page = is_numeric($filter->value('page')) ? (int) $filter->value('page') : 1;
$nb = is_numeric($filter->value('nb')) ? (int) $filter->value('nb') : 1;
@@ -370,10 +363,10 @@ class Manage extends dcNsProcess
$cols[$col] .= '' .
'' . $meta_id . ' ' . $img_status . ' | ' .
'' . $count . ' ' .
(($count == 1) ? __('entry') : __('entries')) . ' | ' .
@@ -384,17 +377,18 @@ class Manage extends dcNsProcess
$table = '';
+ dcPage::openModule(
+ My::name(),
+ dcPage::cssModuleLoad('tags/style.css')
+ );
echo
- '' . __('Templator') . '' .
- dcPage::cssLoad(dcPage::getPF('tags/style.css')) .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('Used templates') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices() .
- '' . __('Used templates') . '
';
+ '' . $v->name . '
';
if ($cols[0]) {
echo '';
@@ -442,41 +436,39 @@ class Manage extends dcNsProcess
} catch (Exception $e) {
dcCore::app()->error->add($e->getMessage());
}
+
+ $ict = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme');
+
+ dcPage::openModule(
+ My::name(),
+ (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax') ?
+ dcPage::jsJson('dotclear_colorsyntax', ['colorsyntax' => dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')]) : ''
+ ) .
+ dcPage::jsJson('theme_editor_msg', [
+ 'saving_document' => __('Saving document...'),
+ 'document_saved' => __('Document saved'),
+ 'error_occurred' => __('An error occurred:'),
+ 'confirm_reset_file' => __('Are you sure you want to reset this file?'),
+ ]) .
+ dcPage::jsModuleLoad('themeEditor/js/script.js') .
+ dcPage::jsConfirmClose('file-form') .
+ (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax') ?
+ dcPage::jsLoadCodeMirror(is_string($ict) ? $ict : '') : ''
+ ) .
+ dcPage::cssModuleLoad('themeEditor/style.css')
+ );
echo
- '
' . __('Templator') . '';
-
- if (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')) {
- echo
- dcPage::jsJson('dotclear_colorsyntax', ['colorsyntax' => dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')]);
- }
- echo
- dcPage::jsJson('theme_editor_msg', [
- 'saving_document' => __('Saving document...'),
- 'document_saved' => __('Document saved'),
- 'error_occurred' => __('An error occurred:'),
- 'confirm_reset_file' => __('Are you sure you want to reset this file?'),
- ]) .
- dcPage::jsModuleLoad('themeEditor/js/script.js') .
- dcPage::jsConfirmClose('file-form');
- if (dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax')) {
- $ict = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme');
- echo
- dcPage::jsLoadCodeMirror(is_string($ict) ? $ict : '');
- }
- echo
- dcPage::cssModuleLoad('themeEditor/style.css') .
- '' .
dcPage::breadcrumb([
__('Plugins') => '',
- __('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
- __('Edit template') => '',
+ My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
+ $v->name => '',
]) .
dcPage::notices();
if (($file['c'] !== null)) {
echo
- '