remove last parts of pure HTML
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] : []),
|
||||||
|
|
242
src/Utils.php
242
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
|
$i = 1;
|
||||||
'<div class="multi-part" ' .
|
$tbody = [];
|
||||||
'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;
|
|
||||||
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)
|
||||||
(new Hidden(['redir'], Html::escapeHTML($_REQUEST['redir'] ?? ''))),
|
->items([
|
||||||
(new Hidden(['p'], My::id())),
|
(new Text('h3', $title)),
|
||||||
(new Hidden(['type'], $type)),
|
(new Form('packman-form-' . $type))
|
||||||
(new Hidden(['action'], 'packup')),
|
->method('post')
|
||||||
(new Submit(['packup']))->value(__('Pack up selected modules')),
|
->action('plugin.php')
|
||||||
dcCore::app()->formNonce(false),
|
->fields([
|
||||||
])->render() .
|
(new Para(null, 'table'))
|
||||||
'</form>' .
|
->class('clear')
|
||||||
|
->items([
|
||||||
'</div>';
|
(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(['p'], My::id())),
|
||||||
|
(new Hidden(['type'], $type)),
|
||||||
|
(new Hidden(['action'], 'packup')),
|
||||||
|
(new Submit(['packup']))
|
||||||
|
->value(__('Pack up selected modules')),
|
||||||
|
dcCore::app()->formNonce(false),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->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'))))
|
||||||
'package' => basename($module->get('root')),
|
->class('nowrap'),
|
||||||
'repo' => $type,
|
(new Para(null, 'td'))
|
||||||
]) . '" title="' . __('Download') . '">' .
|
->class('nowrap')
|
||||||
Html::escapeHTML(basename($module->get('root'))) . '</a>' .
|
->items([
|
||||||
'</td>' .
|
(new Text('a', Html::escapeHTML(basename($module->get('root')))))
|
||||||
'<td class="nowrap">' .
|
->class('packman-download')
|
||||||
Html::escapeHTML(Date::str(__('%Y-%m-%d %H:%M'), (int) @filemtime($module->get('root')))) .
|
->extra(
|
||||||
'</td>' .
|
'href="' . dcCore::app()->adminurl?->get('admin.plugin.' . My::id(), [
|
||||||
'</tr>';
|
'package' => basename($module->get('root')),
|
||||||
|
'repo' => $type,
|
||||||
|
]) . '"'
|
||||||
|
)
|
||||||
|
->title(__('Download')),
|
||||||
|
]),
|
||||||
|
(new Text('td', Html::escapeHTML(Date::str(__('%Y-%m-%d %H:%M'), (int) @filemtime($module->get('root'))))))
|
||||||
|
->class('nowrap maximal'),
|
||||||
|
]);
|
||||||
|
|
||||||
$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')
|
||||||
(new Hidden(['p'], My::id())),
|
->action('plugin.php')
|
||||||
(new Hidden(['tab'], 'repository')),
|
->fields([
|
||||||
(new Hidden(['type'], $type)),
|
(new Para(null, 'table'))
|
||||||
dcCore::app()->formNonce(false),
|
->class('clear')
|
||||||
])->render() .
|
->items([
|
||||||
'</div>' .
|
(new Para(null, 'tr'))
|
||||||
'</form>' .
|
->items([
|
||||||
'</div>';
|
(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(['tab'], 'repository')),
|
||||||
|
(new Hidden(['type'], $type)),
|
||||||
|
dcCore::app()->formNonce(false),
|
||||||
|
]),
|
||||||
|
]),
|
||||||
|
])
|
||||||
|
->render();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue