remove last parts of pure HTML
This commit is contained in:
parent
f5870ba80c
commit
1bcd04e3a2
@ -20,6 +20,10 @@ use dcPage;
|
|||||||
use dcThemes;
|
use dcThemes;
|
||||||
use dcNsProcess;
|
use dcNsProcess;
|
||||||
use Dotclear\Helper\File\Files;
|
use Dotclear\Helper\File\Files;
|
||||||
|
use Dotclear\Helper\Html\Form\{
|
||||||
|
Div,
|
||||||
|
Text
|
||||||
|
};
|
||||||
use Dotclear\Helper\Network\Http;
|
use Dotclear\Helper\Network\Http;
|
||||||
use Exception;
|
use Exception;
|
||||||
|
|
||||||
@ -293,9 +297,13 @@ class Manage extends dcNsProcess
|
|||||||
|
|
||||||
if (dcCore::app()->error->flag() || !$is_configured) {
|
if (dcCore::app()->error->flag() || !$is_configured) {
|
||||||
echo
|
echo
|
||||||
'<div class="warning">' . __('pacKman is not well configured.') . ' ' .
|
(new Div())
|
||||||
'<a href="' . dcCore::app()->adminurl?->get('admin.plugins', ['module' => My::id(), 'conf' => '1', 'redir' => dcCore::app()->adminurl->get('admin.plugin.' . My::id())]) . '">' . __('Configuration') . '</a>' .
|
->separator(' ')
|
||||||
'</div>';
|
->class('warning')
|
||||||
|
->items([
|
||||||
|
(new Text(null, sprintf(__('Module "%s" is not well configured.'), My::name()))),
|
||||||
|
])
|
||||||
|
->render();
|
||||||
} else {
|
} else {
|
||||||
Utils::modules(
|
Utils::modules(
|
||||||
dcCore::app()->plugins->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
dcCore::app()->plugins->getDefines((new Settings())->hide_distrib ? ['distributed' => false] : []),
|
||||||
|
218
src/Utils.php
218
src/Utils.php
@ -20,6 +20,8 @@ use Dotclear\Helper\File\Files;
|
|||||||
use Dotclear\Helper\File\Path;
|
use Dotclear\Helper\File\Path;
|
||||||
use Dotclear\Helper\Html\Form\{
|
use Dotclear\Helper\Html\Form\{
|
||||||
Checkbox,
|
Checkbox,
|
||||||
|
Div,
|
||||||
|
Form,
|
||||||
Hidden,
|
Hidden,
|
||||||
Label,
|
Label,
|
||||||
Para,
|
Para,
|
||||||
@ -101,56 +103,75 @@ class Utils
|
|||||||
|
|
||||||
$type = $type == 'themes' ? 'themes' : 'plugins';
|
$type = $type == 'themes' ? 'themes' : 'plugins';
|
||||||
|
|
||||||
echo
|
|
||||||
'<div class="multi-part" ' .
|
|
||||||
'id="packman-' . $type . '" title="' . $title . '">' .
|
|
||||||
'<h3>' . $title . '</h3>' .
|
|
||||||
'<form action="plugin.php" method="post">' .
|
|
||||||
'<table class="clear"><tr>' .
|
|
||||||
'<th class="nowrap">' . __('Id') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Version') . '</th>' .
|
|
||||||
'<th class="nowrap maximal">' . __('Name') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Root') . '</th>' .
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
$tbody = [];
|
||||||
self::sort($modules);
|
self::sort($modules);
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
echo
|
$tbody[] = (new Para(null, 'tr'))
|
||||||
'<tr class="line">' .
|
->class('line')
|
||||||
(new Para(null, 'td'))->class('nowrap')->items([
|
->items([
|
||||||
(new Checkbox(['modules[' . Html::escapeHTML($module->get('root')) . ']', 'modules_' . $type . $i], false))->value(Html::escapeHTML($module->getId())),
|
(new Para(null, 'td'))
|
||||||
(new Label(Html::escapeHTML($module->getId()), Label::OUTSIDE_LABEL_AFTER))->for('modules_' . $type . $i)->class('classic'),
|
->class('nowrap')
|
||||||
|
->items([
|
||||||
])->render() .
|
(new Checkbox(['modules[' . Html::escapeHTML($module->get('root')) . ']', 'modules_' . $type . $i], false))
|
||||||
'<td class="nowrap count">' .
|
->value(Html::escapeHTML($module->getId())),
|
||||||
Html::escapeHTML($module->get('version')) .
|
(new Label(Html::escapeHTML($module->getId()), Label::OUTSIDE_LABEL_AFTER))
|
||||||
'</td>' .
|
->class('classic')
|
||||||
'<td class="nowrap maximal">' .
|
->for('modules_' . $type . $i),
|
||||||
__(Html::escapeHTML($module->get('name'))) .
|
]),
|
||||||
'</td>' .
|
(new Text('td', Html::escapeHTML($module->get('version'))))
|
||||||
'<td class="nowrap">' .
|
->class('nowrap count'),
|
||||||
dirname((string) Path::real($module->get('root'), false)) .
|
(new Text('td', Html::escapeHTML($module->get('name'))))
|
||||||
'</td>' .
|
->class('nowrap'),
|
||||||
'</tr>';
|
(new Text('td', dirname((string) Path::real($module->get('root'), false))))
|
||||||
|
->class('nowrap maximal'),
|
||||||
|
]);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'</table>' .
|
(new Div('packman-' . $type))
|
||||||
'<p class="checkboxes-helpers"></p>' .
|
->class('multi-part')
|
||||||
(new Para())->items([
|
->title($title)
|
||||||
|
->items([
|
||||||
|
(new Text('h3', $title)),
|
||||||
|
(new Form('packman-form-' . $type))
|
||||||
|
->method('post')
|
||||||
|
->action('plugin.php')
|
||||||
|
->fields([
|
||||||
|
(new Para(null, 'table'))
|
||||||
|
->class('clear')
|
||||||
|
->items([
|
||||||
|
(new Para(null, 'tr'))
|
||||||
|
->items([
|
||||||
|
(new Text('th', Html::escapeHTML(__('Id'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Version'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Name'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Root'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
]),
|
||||||
|
(new Para(null, 'tbody'))
|
||||||
|
->items($tbody),
|
||||||
|
]),
|
||||||
|
(new Para())
|
||||||
|
->class('checkboxes-helpers'),
|
||||||
|
(new Para())
|
||||||
|
->items([
|
||||||
(new Hidden(['redir'], Html::escapeHTML($_REQUEST['redir'] ?? ''))),
|
(new Hidden(['redir'], Html::escapeHTML($_REQUEST['redir'] ?? ''))),
|
||||||
(new Hidden(['p'], My::id())),
|
(new Hidden(['p'], My::id())),
|
||||||
(new Hidden(['type'], $type)),
|
(new Hidden(['type'], $type)),
|
||||||
(new Hidden(['action'], 'packup')),
|
(new Hidden(['action'], 'packup')),
|
||||||
(new Submit(['packup']))->value(__('Pack up selected modules')),
|
(new Submit(['packup']))
|
||||||
|
->value(__('Pack up selected modules')),
|
||||||
dcCore::app()->formNonce(false),
|
dcCore::app()->formNonce(false),
|
||||||
])->render() .
|
]),
|
||||||
'</form>' .
|
]),
|
||||||
|
])
|
||||||
'</div>';
|
->render();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -164,11 +185,6 @@ class Utils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
|
||||||
'<div class="multi-part" ' .
|
|
||||||
'id="packman-repository-' . $type . '" title="' . $title . '">' .
|
|
||||||
'<h3>' . $title . '</h3>';
|
|
||||||
|
|
||||||
$combo_action = [__('delete') => 'delete'];
|
$combo_action = [__('delete') => 'delete'];
|
||||||
|
|
||||||
if ($type == 'plugins' || $type == 'themes') {
|
if ($type == 'plugins' || $type == 'themes') {
|
||||||
@ -187,17 +203,7 @@ class Utils
|
|||||||
$combo_action[sprintf(__('move to %s directory'), __('repository'))] = 'move_to_repository';
|
$combo_action[sprintf(__('move to %s directory'), __('repository'))] = 'move_to_repository';
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
$dup = $tbody = [];
|
||||||
'<form action="plugin.php" method="post">' .
|
|
||||||
'<table class="clear"><tr>' .
|
|
||||||
'<th class="nowrap">' . __('Id') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Version') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Name') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('File') . '</th>' .
|
|
||||||
'<th class="nowrap">' . __('Date') . '</th>' .
|
|
||||||
'</tr>';
|
|
||||||
|
|
||||||
$dup = [];
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
self::sort($modules);
|
self::sort($modules);
|
||||||
foreach ($modules as $module) {
|
foreach ($modules as $module) {
|
||||||
@ -207,51 +213,89 @@ class Utils
|
|||||||
|
|
||||||
$dup[$module->get('root')] = 1;
|
$dup[$module->get('root')] = 1;
|
||||||
|
|
||||||
echo
|
$tbody[] = (new Para(null, 'tr'))
|
||||||
'<tr class="line">' .
|
->class('line')
|
||||||
(new Para(null, 'td'))->class('nowrap')->items([
|
->items([
|
||||||
(new Checkbox(['modules[' . Html::escapeHTML($module->get('root')) . ']', 'r_modules_' . $type . $i], false))->value(Html::escapeHTML($module->getId())),
|
(new Para(null, 'td'))
|
||||||
(new Label(Html::escapeHTML($module->getId()), Label::OUTSIDE_LABEL_AFTER))->for('r_modules_' . $type . $i)->class('classic')->title(Html::escapeHTML($module->get('root'))),
|
->class('nowrap')
|
||||||
|
->items([
|
||||||
])->render() .
|
(new Checkbox(['modules[' . Html::escapeHTML($module->get('root')) . ']', 'r_modules_' . $type . $i], false))
|
||||||
'<td class="nowrap count">' .
|
->value(Html::escapeHTML($module->getId())),
|
||||||
Html::escapeHTML($module->get('version')) .
|
(new Label(Html::escapeHTML($module->getId()), Label::OUTSIDE_LABEL_AFTER))
|
||||||
'</td>' .
|
->class('classic')
|
||||||
'<td class="nowrap maximal">' .
|
->for('r_modules_' . $type . $i)
|
||||||
__(Html::escapeHTML($module->get('name'))) .
|
->title(Html::escapeHTML($module->get('root'))),
|
||||||
'</td>' .
|
]),
|
||||||
'<td class="nowrap">' .
|
(new Text('td', Html::escapeHTML($module->get('version'))))
|
||||||
'<a class="packman-download" href="' .
|
->class('nowrap count'),
|
||||||
dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [
|
(new Text('td', Html::escapeHTML($module->get('name'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Para(null, 'td'))
|
||||||
|
->class('nowrap')
|
||||||
|
->items([
|
||||||
|
(new Text('a', Html::escapeHTML(basename($module->get('root')))))
|
||||||
|
->class('packman-download')
|
||||||
|
->extra(
|
||||||
|
'href="' . dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [
|
||||||
'package' => basename($module->get('root')),
|
'package' => basename($module->get('root')),
|
||||||
'repo' => $type,
|
'repo' => $type,
|
||||||
]) . '" title="' . __('Download') . '">' .
|
]) . '"'
|
||||||
Html::escapeHTML(basename($module->get('root'))) . '</a>' .
|
)
|
||||||
'</td>' .
|
->title(__('Download')),
|
||||||
'<td class="nowrap">' .
|
]),
|
||||||
Html::escapeHTML(Date::str(__('%Y-%m-%d %H:%M'), (int) @filemtime($module->get('root')))) .
|
(new Text('td', Html::escapeHTML(Date::str(__('%Y-%m-%d %H:%M'), (int) @filemtime($module->get('root'))))))
|
||||||
'</td>' .
|
->class('nowrap maximal'),
|
||||||
'</tr>';
|
]);
|
||||||
|
|
||||||
$i++;
|
$i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
echo
|
echo
|
||||||
'</table>' .
|
(new Div('packman-repository-' . $type))
|
||||||
'<div class="two-cols">' .
|
->class('multi-part')
|
||||||
'<p class="col checkboxes-helpers"></p>' .
|
->title($title)
|
||||||
(new Para())->class('col right')->items([
|
->items([
|
||||||
(new Text('', __('Selected modules action:') . ' ')),
|
(new Text('h3', $title)),
|
||||||
(new Select(['action']))->items($combo_action),
|
(new Form('packman-form-repository-' . $type))
|
||||||
(new Submit(['packup']))->value(__('ok')),
|
->method('post')
|
||||||
|
->action('plugin.php')
|
||||||
|
->fields([
|
||||||
|
(new Para(null, 'table'))
|
||||||
|
->class('clear')
|
||||||
|
->items([
|
||||||
|
(new Para(null, 'tr'))
|
||||||
|
->items([
|
||||||
|
(new Text('th', Html::escapeHTML(__('Id'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Version'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Name'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('File'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
(new Text('th', Html::escapeHTML(__('Date'))))
|
||||||
|
->class('nowrap'),
|
||||||
|
]),
|
||||||
|
(new Para(null, 'tbody'))
|
||||||
|
->items($tbody),
|
||||||
|
]),
|
||||||
|
(new Para())
|
||||||
|
->class('checkboxes-helpers'),
|
||||||
|
(new Para())->class('col right')
|
||||||
|
->items([
|
||||||
|
(new Text(null, __('Selected modules action:') . ' ')),
|
||||||
|
(new Select(['action']))
|
||||||
|
->items($combo_action),
|
||||||
|
(new Submit(['packup']))
|
||||||
|
->value(__('ok')),
|
||||||
(new Hidden(['p'], My::id())),
|
(new Hidden(['p'], My::id())),
|
||||||
(new Hidden(['tab'], 'repository')),
|
(new Hidden(['tab'], 'repository')),
|
||||||
(new Hidden(['type'], $type)),
|
(new Hidden(['type'], $type)),
|
||||||
dcCore::app()->formNonce(false),
|
dcCore::app()->formNonce(false),
|
||||||
])->render() .
|
]),
|
||||||
'</div>' .
|
]),
|
||||||
'</form>' .
|
])
|
||||||
'</div>';
|
->render();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user