change again ui: use table and add option for details

This commit is contained in:
Jean-Christian Denis 2021-11-06 13:58:43 +01:00
parent a2c3f05c36
commit 707176433b
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
3 changed files with 59 additions and 31 deletions

View file

@ -35,7 +35,8 @@ if (!empty($_POST['save'])) {
$pdisabled = implode(';', $_POST['disabled']); $pdisabled = implode(';', $_POST['disabled']);
} }
$core->blog->settings->improve->put('disabled', $pdisabled); $core->blog->settings->improve->put('disabled', $pdisabled);
dcPage::addSuccessNotice(__('Configuration successfully updated.')); $core->blog->settings->improve->put('nodetails', !empty($_POST['nodetails']));
dcPage::addSuccessNotice(__('Configuration successfully updated'));
$core->adminurl->redirect( $core->adminurl->redirect(
'admin.plugins', 'admin.plugins',
@ -54,4 +55,9 @@ foreach ($combo_actions as $name => $id) {
form::checkbox(['disabled[]'], $id, ['checked' => isset($disabled[$id])]) . form::checkbox(['disabled[]'], $id, ['checked' => isset($disabled[$id])]) .
__($name) . '</label></p>'; __($name) . '</label></p>';
} }
echo '</div>'; echo
'</div><div class="fieldset"><h4>' . __('Options') . '</h4>' .
'<p><label class="classic">' .
form::checkbox('nodetails', '1', ['checked' => $core->blog->settings->improve->nodetails]) .
__('Hide details of rendered actions') . '</label></p>' .
'</div>';

View file

@ -111,6 +111,8 @@ if (!empty($_REQUEST['config'])) {
if (null !== ($action = $improve->module($_REQUEST['config']))) { if (null !== ($action = $improve->module($_REQUEST['config']))) {
$header = $action->header(); $header = $action->header();
} }
} else {
$breadcrumb[$type == 'theme' ? __('Themes actions') : __('Plugins actions')] = '';
} }
# display header # display header
@ -153,27 +155,30 @@ if (!empty($_REQUEST['config'])) {
form::hidden('config', $action->id) . form::hidden('config', $action->id) .
form::hidden('redir', $redir) . form::hidden('redir', $redir) .
$core->formNonce() . '</p>' . $core->formNonce() . '</p>' .
'<form>'; '</form>';
} else { } else {
echo ' echo '
<p class="warning">' . __('Unknow module') . '</p> <p class="warning">' . __('Unknow module') . '</p>
<p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>'; <p><a class="back" href="' . $back_url . '">' . __('Back') . '</a></p>';
} }
} else { } else {
echo '<h3>' . ($type == 'plugin' ? __('Plugins') : __('Themes')) . '</h3>';
if (count($combo_modules) == 1) { if (count($combo_modules) == 1) {
echo '<p class="message">' . __('No module to manage') . '</p>'; echo '<p class="message">' . __('No module to manage') . '</p>';
} else { } else {
echo '<form action="' . $core->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">'; echo '<form action="' . $core->adminurl->get('admin.plugin.improve') . '" method="post" id="form-actions">' .
'<table><caption class="hidden">' . __('Actions') . '</caption><thead><tr>' .
'<th colspan="2" class="first">' . __('Action') . '</td>' .
'<th scope="col">' . __('Description') . '</td>' .
'<th scope="col">' . __('Configuration') . '</td>' .
(DC_DEBUG ? '<th scope="col">' . __('Priority') . '</td>' : '') .
'</tr></thead><tbody>';
foreach ($improve->modules() as $action) { foreach ($improve->modules() as $action) {
if (!in_array($type, $action->types)) { if (!in_array($type, $action->types)) {
continue; continue;
} }
$p = DC_DEBUG ? '<span class="debug">' . $action->priority . '</span> ' : '';
echo echo
'<p class="modules">' . $p . '<label for="action_' . $action->id . '" class="classic">' . '<tr class="line' . ($action->isConfigured() ? '' : ' offline') . '">' .
form::checkbox( '<td class="minimal">' . form::checkbox(
['actions[]', ['actions[]',
'action_' . $action->id], 'action_' . $action->id],
$action->id, $action->id,
@ -181,28 +186,29 @@ if (!empty($_REQUEST['config'])) {
'', '',
'', '',
!$action->isConfigured() !$action->isConfigured()
) . ) . '</td>' .
$action->name . '</label>'; '<td class="minimal nowrap">' .
'<label for="action_' . $action->id . '" class="classic">' . html::escapeHTML($action->name) . '</label>' .
if (false !== $action->config) { '</td>' .
echo '<td class="maximal">' . $action->desc . '</td>' .
' - <a class="module-config" href="' . '<td class="minimal nowrap modules">' . (
false === $action->config ? '' :
'<a class="module-config" href="' .
(true === $action->config ? $core->adminurl->get('admin.plugin.improve', ['type' => $type, 'config' => $action->id]) : $action->config) . (true === $action->config ? $core->adminurl->get('admin.plugin.improve', ['type' => $type, 'config' => $action->id]) : $action->config) .
'" title="' . sprintf(__("Configure action '%s'"), $action->name) . '">' . __('Configure module') . '</a>'; '" title="' . sprintf(__("Configure action '%s'"), $action->name) . '">' . __('Configure') . '</a>'
} ) . '</td>' .
echo '</p>'; (DC_DEBUG ? '<td class="minimal"><span class="debug">' . $action->priority . '</span></td>' : '') .
'</tr>';
} }
echo ' echo '</tbody></table>
<div> <div class="two-cols">
<hr /> <p class="col left"><label for="save_preferences" class="classic">' .
<p><label for="save_preferences" class="classic">' .
form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) . form::checkbox('save_preferences', 1, !empty($_POST['save_preferences'])) .
__('Save fields selection as preference') . '</label></p> __('Save fields selection as preference') . '</label></p>
<p class="field"><label for="module" class="classic">' . __('Select a module:') . '</label>' . <p class="col right"><label for="module" class="classic">' . __('Select a module:') . ' </label>' .
form::combo('module', $combo_modules, $module) . ' form::combo('module', $combo_modules, $module) .
</p></p> ' <input type="submit" name="fix" value="' . __('Fix it') . '" />' .
<input type="submit" name="fix" value="' . __('Fix it') . '" />' .
form::hidden(['type'], $type) . form::hidden(['type'], $type) .
$core->formNonce() . ' $core->formNonce() . '
</p> </p>
@ -210,9 +216,7 @@ if (!empty($_REQUEST['config'])) {
<br class="clear" /> <br class="clear" />
</form>'; </form>';
$logs = $lines = []; if (!empty($_REQUEST['upd']) && !$core->blog->settings->improve->nodetails) {
if (!empty($_REQUEST['upd'])) {
$logs = $improve->parseLogs($_REQUEST['upd']); $logs = $improve->parseLogs($_REQUEST['upd']);
if (!empty($logs)) { if (!empty($logs)) {

View file

@ -1,15 +1,21 @@
msgid "" msgid ""
msgstr "" msgstr ""
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: improve 0.3\n" "Project-Id-Version: improve 0.5\n"
"POT-Creation-Date: \n" "POT-Creation-Date: \n"
"PO-Revision-Date: 2021-11-02T09:13:41+00:00\n" "PO-Revision-Date: 2021-11-06T12:55:33+00:00\n"
"Last-Translator: Jean-Christian Denis\n" "Last-Translator: Jean-Christian Denis\n"
"Language-Team: \n" "Language-Team: \n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n"
msgid "List of disabled actions:"
msgstr "Listes des actions désactivées :"
msgid "Hide details of rendered actions"
msgstr "Ne pas afficher le détail des actions effectuées"
msgid "Begin" msgid "Begin"
msgstr "Début" msgstr "Début"
@ -217,6 +223,9 @@ msgstr "Chemin complet du répertoire de l'exécutable PHP :"
msgid "If this module does not work you can try to put here directory to php executable (without executable file name)." msgid "If this module does not work you can try to put here directory to php executable (without executable file name)."
msgstr "Si ce module ne fonctionne pas vous pouvez tenter de mettre ici le chemin complet du répertoire de l'exécutable PHP (sans le nom de fichier exécutable)." msgstr "Si ce module ne fonctionne pas vous pouvez tenter de mettre ici le chemin complet du répertoire de l'exécutable PHP (sans le nom de fichier exécutable)."
msgid "PHP CS Fixer configuration file:"
msgstr "Fichier de configuration de PHP CS Fixer :"
msgid "Failed to run php-cs-fixer" msgid "Failed to run php-cs-fixer"
msgstr "Impossible d'exécuter php-cs-fixer" msgstr "Impossible d'exécuter php-cs-fixer"
@ -352,6 +361,12 @@ msgstr "Fixe de \"%s\" complété en %s secondes sans message"
msgid "Configure module" msgid "Configure module"
msgstr "Configurer le module" msgstr "Configurer le module"
msgid "Themes actions"
msgstr "Actions sur les thèmes"
msgid "Plugins actions"
msgstr "Actions sur les plugins"
msgid "Themes" msgid "Themes"
msgstr "Thèmes" msgstr "Thèmes"
@ -367,6 +382,9 @@ msgstr "Module inconnu"
msgid "No module to manage" msgid "No module to manage"
msgstr "Aucun module à gérer" msgstr "Aucun module à gérer"
msgid "Priority"
msgstr "Priorité"
msgid "Configure action '%s'" msgid "Configure action '%s'"
msgstr "Configurer l'action \"%s\"" msgstr "Configurer l'action \"%s\""