use dcPage modules features
This commit is contained in:
parent
9df73d4f45
commit
37cc921b5f
1 changed files with 86 additions and 92 deletions
176
src/Manage.php
176
src/Manage.php
|
@ -74,7 +74,7 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
if (!dcCore::app()->error->flag()) {
|
if (!dcCore::app()->error->flag()) {
|
||||||
dcPage::addSuccessNotice(__('The new template has been successfully created.'));
|
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) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
@ -93,7 +93,7 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
if (!dcCore::app()->error->flag()) {
|
if (!dcCore::app()->error->flag()) {
|
||||||
dcPage::addSuccessNotice(__('The template has been successfully copied.'));
|
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) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
@ -112,7 +112,7 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
if (!dcCore::app()->error->flag()) {
|
if (!dcCore::app()->error->flag()) {
|
||||||
dcPage::addSuccessNotice(__('The template has been successfully copied.'));
|
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) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
@ -130,7 +130,7 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
if (!dcCore::app()->error->flag()) {
|
if (!dcCore::app()->error->flag()) {
|
||||||
dcPage::addSuccessNotice(__('The template has been successfully removed.'));
|
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) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
|
@ -161,13 +161,11 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
if (!$t->canUseRessources(true)) {
|
if (!$t->canUseRessources(true)) {
|
||||||
dcCore::app()->error->add(__('The plugin is unusable with your configuration. You have to change file permissions.'));
|
dcCore::app()->error->add(__('The plugin is unusable with your configuration. You have to change file permissions.'));
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id())
|
||||||
__('New template') => '',
|
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
|
@ -175,18 +173,17 @@ class Manage extends dcNsProcess
|
||||||
* Duplicate dotclear template
|
* Duplicate dotclear template
|
||||||
*/
|
*/
|
||||||
} elseif ('new' == $v->part) {
|
} elseif ('new' == $v->part) {
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('New template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'new']) . '" method="post" id="add-template">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'new']) . '" method="post" id="add-template">' .
|
||||||
'<h3>' . __('New template') . '</h3>' .
|
'<h3>' . $v->name . '</h3>' .
|
||||||
'<p><label for="filesource" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Template source:') . '</label> ' .
|
'<p><label for="filesource" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Template source:') . '</label> ' .
|
||||||
form::combo('filesource', $v->sources) . '</p>' .
|
form::combo('filesource', $v->sources) . '</p>' .
|
||||||
'<p><label for="filename" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Filename:') . '</label> ' .
|
'<p><label for="filename" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Filename:') . '</label> ' .
|
||||||
|
@ -210,18 +207,17 @@ class Manage extends dcNsProcess
|
||||||
* Copy templator template
|
* Copy templator template
|
||||||
*/
|
*/
|
||||||
} elseif ('copy' == $v->part && !empty($_REQUEST['file'])) {
|
} elseif ('copy' == $v->part && !empty($_REQUEST['file'])) {
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Copy available template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'copy']) . '" method="post">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'copy']) . '" method="post">' .
|
||||||
'<h3>' . __('Copy available template') . '</h3>' .
|
'<h3>' . $v->name . '</h3>' .
|
||||||
'<p><label for="filename" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('New filename:') . '</label> ' .
|
'<p><label for="filename" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('New filename:') . '</label> ' .
|
||||||
form::field('filename', 25, 255) . '<code>' . Html::escapeHTML('.html') . '</code></p> ' .
|
form::field('filename', 25, 255) . '<code>' . Html::escapeHTML('.html') . '</code></p> ' .
|
||||||
'<p class="form-note">' . sprintf(
|
'<p class="form-note">' . sprintf(
|
||||||
|
@ -230,7 +226,7 @@ class Manage extends dcNsProcess
|
||||||
) . '</p>' .
|
) . '</p>' .
|
||||||
'<p>' .
|
'<p>' .
|
||||||
'<input type="submit" name="submit" value="' . __('Copy') . '" /> ' .
|
'<input type="submit" name="submit" value="' . __('Copy') . '" /> ' .
|
||||||
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
form::hidden('file', Html::escapeHTML($_REQUEST['file'])) . '</p>' .
|
form::hidden('file', Html::escapeHTML($_REQUEST['file'])) . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
@ -247,18 +243,17 @@ class Manage extends dcNsProcess
|
||||||
};
|
};
|
||||||
$name = $full_name . dcCore::app()->blog->getCategory($category_id)->f('cat_title');
|
$name = $full_name . dcCore::app()->blog->getCategory($category_id)->f('cat_title');
|
||||||
|
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Copy available template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'copycat']) . '" method="post">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'copycat']) . '" method="post">' .
|
||||||
'<h3>' . __('Copy available template') . '</h3>' .
|
'<h3>' . $v->name . '</h3>' .
|
||||||
'<p><label for="filecat" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Target category:') . '</label> ' .
|
'<p><label for="filecat" class="required"><abbr title="' . __('Required field') . '">*</abbr> ' . __('Target category:') . '</label> ' .
|
||||||
form::combo('filecat', $v->categories, '') . '</p>' .
|
form::combo('filecat', $v->categories, '') . '</p>' .
|
||||||
'<p class="form-note">' . sprintf(
|
'<p class="form-note">' . sprintf(
|
||||||
|
@ -267,7 +262,7 @@ class Manage extends dcNsProcess
|
||||||
$name
|
$name
|
||||||
) . '</p>' .
|
) . '</p>' .
|
||||||
'<input type="submit" name="submit" value="' . __('Copy') . '" /> ' .
|
'<input type="submit" name="submit" value="' . __('Copy') . '" /> ' .
|
||||||
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
form::hidden('file', Html::escapeHTML($_REQUEST['file'])) . '</p>' .
|
form::hidden('file', Html::escapeHTML($_REQUEST['file'])) . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
@ -276,24 +271,23 @@ class Manage extends dcNsProcess
|
||||||
* Delete templator template
|
* Delete templator template
|
||||||
*/
|
*/
|
||||||
} elseif ('delete' == $v->part && !empty($_REQUEST['file'])) {
|
} elseif ('delete' == $v->part && !empty($_REQUEST['file'])) {
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Delete available template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'delete']) . '" method="post">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'delete']) . '" method="post">' .
|
||||||
'<h3>' . __('Delete available template') . '</h3>' .
|
'<h3>' . $v->name . '</h3>' .
|
||||||
'<p>' . sprintf(
|
'<p>' . sprintf(
|
||||||
__('Are you sure you want to remove the template "%s"?'),
|
__('Are you sure you want to remove the template "%s"?'),
|
||||||
Html::escapeHTML($_GET['file'])
|
Html::escapeHTML($_GET['file'])
|
||||||
) . '</p>' .
|
) . '</p>' .
|
||||||
'<p><input type="submit" class="delete" value="' . __('Delete') . '" /> ' .
|
'<p><input type="submit" class="delete" value="' . __('Delete') . '" /> ' .
|
||||||
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
form::hidden('file', Html::escapeHTML($_GET['file'])) . '</p>' .
|
form::hidden('file', Html::escapeHTML($_GET['file'])) . '</p>' .
|
||||||
'</form>';
|
'</form>';
|
||||||
|
@ -302,22 +296,21 @@ class Manage extends dcNsProcess
|
||||||
* List templator templates
|
* List templator templates
|
||||||
*/
|
*/
|
||||||
} elseif ('files' == $v->part) {
|
} elseif ('files' == $v->part) {
|
||||||
|
dcPage::openModule(My::name());
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Available templates') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
'<h3>' . __('Available templates') . '</h3>';
|
'<h3>' . $v->name . '</h3>';
|
||||||
|
|
||||||
if (count($v->items) == 0) {
|
if (count($v->items) == 0) {
|
||||||
echo '<p><strong>' . __('No template.') . '</strong></p>';
|
echo '<p><strong>' . __('No template.') . '</strong></p>';
|
||||||
} else {
|
} else {
|
||||||
// reuse "used templatro template" filter settings
|
// reuse "used templatro template" filter settings
|
||||||
$filter = new adminGenericFilterV2('templator');
|
$filter = new adminGenericFilterV2(My::id());
|
||||||
$filter->add(dcAdminFilters::getPageFilter());
|
$filter->add(dcAdminFilters::getPageFilter());
|
||||||
$page = is_numeric($filter->value('page')) ? (int) $filter->value('page') : 1;
|
$page = is_numeric($filter->value('page')) ? (int) $filter->value('page') : 1;
|
||||||
$nb = is_numeric($filter->value('nb')) ? (int) $filter->value('nb') : 1;
|
$nb = is_numeric($filter->value('nb')) ? (int) $filter->value('nb') : 1;
|
||||||
|
@ -370,10 +363,10 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
$cols[$col] .= '<tr class="line">' .
|
$cols[$col] .= '<tr class="line">' .
|
||||||
'<td class="maximal"><a href="' .
|
'<td class="maximal"><a href="' .
|
||||||
dcCore::app()->adminurl->get('admin.plugin.templator', [
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id(), [
|
||||||
'part' => 'posts',
|
'part' => 'posts',
|
||||||
'file' => $meta_id,
|
'file' => $meta_id,
|
||||||
'redir' => dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'used']),
|
'redir' => dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'used']),
|
||||||
]) . '">' . $meta_id . '</a> ' . $img_status . '</td>' .
|
]) . '">' . $meta_id . '</a> ' . $img_status . '</td>' .
|
||||||
'<td class="nowrap"><strong>' . $count . '</strong> ' .
|
'<td class="nowrap"><strong>' . $count . '</strong> ' .
|
||||||
(($count == 1) ? __('entry') : __('entries')) . '</td>' .
|
(($count == 1) ? __('entry') : __('entries')) . '</td>' .
|
||||||
|
@ -384,17 +377,18 @@ class Manage extends dcNsProcess
|
||||||
|
|
||||||
$table = '<div class="col"><table class="tags">%s</table></div>';
|
$table = '<div class="col"><table class="tags">%s</table></div>';
|
||||||
|
|
||||||
|
dcPage::openModule(
|
||||||
|
My::name(),
|
||||||
|
dcPage::cssModuleLoad('tags/style.css')
|
||||||
|
);
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
dcPage::cssLoad(dcPage::getPF('tags/style.css')) .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Used templates') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
'<h3>' . __('Used templates') . '</h3>';
|
'<h3>' . $v->name . '</h3>';
|
||||||
|
|
||||||
if ($cols[0]) {
|
if ($cols[0]) {
|
||||||
echo '<div class="two-cols">';
|
echo '<div class="two-cols">';
|
||||||
|
@ -443,40 +437,38 @@ class Manage extends dcNsProcess
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
$ict = dcCore::app()->auth->user_prefs->get('interface')->get('colorsyntax_theme');
|
||||||
'<html><head><title>' . __('Templator') . '</title>';
|
|
||||||
|
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')
|
||||||
|
);
|
||||||
|
|
||||||
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
|
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') .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Edit template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
if (($file['c'] !== null)) {
|
if (($file['c'] !== null)) {
|
||||||
echo
|
echo
|
||||||
'<form id="file-form" action="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'edit', 'file' => $name]) . '" method="post">' .
|
'<form id="file-form" action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'edit', 'file' => $name]) . '" method="post">' .
|
||||||
'<div><h3><label for="file_content">' . sprintf(__('Editing file %s'), '<strong>' . $name) . '</strong></label></h3>' .
|
'<div><h3><label for="file_content">' . sprintf(__('Editing file %s'), '<strong>' . $name) . '</strong></label></h3>' .
|
||||||
'<p>' . form::textarea('file_content', 72, 25, [
|
'<p>' . form::textarea('file_content', 72, 25, [
|
||||||
'default' => Html::escapeHTML($file['c']),
|
'default' => Html::escapeHTML($file['c']),
|
||||||
|
@ -487,7 +479,7 @@ class Manage extends dcNsProcess
|
||||||
if ($file['w']) {
|
if ($file['w']) {
|
||||||
echo
|
echo
|
||||||
'<p><input type="submit" name="write" value="' . __('Save') . '" accesskey="s" /> ' .
|
'<p><input type="submit" name="write" value="' . __('Save') . '" accesskey="s" /> ' .
|
||||||
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
'<a class="button" href="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'files']) . '">' . __('Cancel') . '</a>' .
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
form::hidden(['file_id'], Html::escapeHTML($file['f'])) .
|
form::hidden(['file_id'], Html::escapeHTML($file['f'])) .
|
||||||
'</p>';
|
'</p>';
|
||||||
|
@ -511,7 +503,7 @@ class Manage extends dcNsProcess
|
||||||
*/
|
*/
|
||||||
} elseif ('posts' == $v->part && (!empty($_REQUEST['file']) || $_REQUEST['file'] == '0')) {
|
} elseif ('posts' == $v->part && (!empty($_REQUEST['file']) || $_REQUEST['file'] == '0')) {
|
||||||
$file = $_REQUEST['file'];
|
$file = $_REQUEST['file'];
|
||||||
$redir = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'used']);
|
$redir = $_REQUEST['redir'] ?? dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'used']);
|
||||||
|
|
||||||
# Unselect the template
|
# Unselect the template
|
||||||
if (!empty($_POST['action']) && 'unselecttpl' == $_POST['action'] && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
if (!empty($_POST['action']) && 'unselecttpl' == $_POST['action'] && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
|
||||||
|
@ -520,7 +512,7 @@ class Manage extends dcNsProcess
|
||||||
]), dcCore::app()->blog->id)) {
|
]), dcCore::app()->blog->id)) {
|
||||||
try {
|
try {
|
||||||
dcCore::app()->meta->delMeta($file, 'template');
|
dcCore::app()->meta->delMeta($file, 'template');
|
||||||
dcCore::app()->adminurl->redirect('admin.plugin.templator', ['part' => 'posts', 'file' => $file]);
|
dcCore::app()->adminurl->redirect('admin.plugin.' . My::id(), ['part' => 'posts', 'file' => $file]);
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
@ -550,16 +542,18 @@ class Manage extends dcNsProcess
|
||||||
dcCore::app()->error->add($e->getMessage());
|
dcCore::app()->error->add($e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dcPage::openModule(
|
||||||
|
My::name(),
|
||||||
|
dcPage::jsFilterControl($filter->show()) .
|
||||||
|
dcPage::jsModuleLoad(My::id() . '/js/posts.js') .
|
||||||
|
$filter->js(dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'posts', 'file' => $file]))
|
||||||
|
);
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'<html><head><title>' . __('Templator') . '</title>' .
|
|
||||||
dcPage::jsFilterControl($filter->show()) .
|
|
||||||
dcPage::jsLoad(dcPage::getPF('templator/js/posts.js')) .
|
|
||||||
$filter->js(dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'posts', 'file' => $file])) .
|
|
||||||
'</head><body>' .
|
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => dcCore::app()->adminurl->get('admin.plugin.templator'),
|
My::name() => dcCore::app()->adminurl->get('admin.plugin.' . My::id()),
|
||||||
__('Unselect template') => '',
|
$v->name => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices() .
|
dcPage::notices() .
|
||||||
|
|
||||||
|
@ -573,14 +567,14 @@ class Manage extends dcNsProcess
|
||||||
$page = is_numeric($filter->value('page')) ? (int) $filter->value('page') : 1;
|
$page = is_numeric($filter->value('page')) ? (int) $filter->value('page') : 1;
|
||||||
$nb = is_numeric($filter->value('nb')) ? (int) $filter->value('nb') : 0;
|
$nb = is_numeric($filter->value('nb')) ? (int) $filter->value('nb') : 0;
|
||||||
$filter->display(
|
$filter->display(
|
||||||
'admin.plugin.templator',
|
'admin.plugin.' . My::id(),
|
||||||
form::hidden('p', 'templator') . form::hidden('part', 'posts') . form::hidden('file', $file)
|
form::hidden('p', 'templator') . form::hidden('part', 'posts') . form::hidden('file', $file)
|
||||||
);
|
);
|
||||||
# Show posts
|
# Show posts
|
||||||
$post_list->display(
|
$post_list->display(
|
||||||
$page,
|
$page,
|
||||||
$nb,
|
$nb,
|
||||||
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.templator') . '" method="post" id="form-entries">' .
|
'<form action="' . dcCore::app()->adminurl->get('admin.plugin.' . My::id()) . '" method="post" id="form-entries">' .
|
||||||
|
|
||||||
'%s' .
|
'%s' .
|
||||||
|
|
||||||
|
@ -590,7 +584,7 @@ class Manage extends dcNsProcess
|
||||||
'<p class="col right">' .
|
'<p class="col right">' .
|
||||||
'<input type="submit" value="' . __('Unselect template for selected entries') . '" /></p>' .
|
'<input type="submit" value="' . __('Unselect template for selected entries') . '" /></p>' .
|
||||||
form::hidden('action', 'unselecttpl') .
|
form::hidden('action', 'unselecttpl') .
|
||||||
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.templator', $filter->values()) .
|
dcCore::app()->adminurl->getHiddenFormFields('admin.plugin.' . My::id(), $filter->values()) .
|
||||||
form::hidden('redir', $redir) .
|
form::hidden('redir', $redir) .
|
||||||
dcCore::app()->formNonce() .
|
dcCore::app()->formNonce() .
|
||||||
'</div>' .
|
'</div>' .
|
||||||
|
@ -608,7 +602,7 @@ class Manage extends dcNsProcess
|
||||||
echo
|
echo
|
||||||
dcPage::breadcrumb([
|
dcPage::breadcrumb([
|
||||||
__('Plugins') => '',
|
__('Plugins') => '',
|
||||||
__('Templates engine') => '',
|
My::id() => '',
|
||||||
]) .
|
]) .
|
||||||
dcPage::notices();
|
dcPage::notices();
|
||||||
|
|
||||||
|
@ -619,17 +613,17 @@ class Manage extends dcNsProcess
|
||||||
'<h3><ul class="nice">%s</ul></h3>',
|
'<h3><ul class="nice">%s</ul></h3>',
|
||||||
sprintf(
|
sprintf(
|
||||||
$line,
|
$line,
|
||||||
dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'files']),
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'files']),
|
||||||
__('Available templates')
|
__('Available templates')
|
||||||
) .
|
) .
|
||||||
sprintf(
|
sprintf(
|
||||||
$line,
|
$line,
|
||||||
dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'used']),
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'used']),
|
||||||
__('Used templates')
|
__('Used templates')
|
||||||
) .
|
) .
|
||||||
sprintf(
|
sprintf(
|
||||||
$line,
|
$line,
|
||||||
dcCore::app()->adminurl->get('admin.plugin.templator', ['part' => 'new']),
|
dcCore::app()->adminurl->get('admin.plugin.' . My::id(), ['part' => 'new']),
|
||||||
__('New template')
|
__('New template')
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue