issue #1175 redesign plugin manager

* design based on Samuel's mockup + Hannah's adaptations
* on each plugin actions shown as buttons in a single column (better compatibility with verbose languages such as German)
* description always shown (no more need of the "show details" action)
* filter based on plugin title/description (javascript, no page reload)
* hide inactive plugins if they are 8 or more
* plugins no longer shown in the admin left menu, they instead get a "settings" action if relevant. Compatible with the old trigger get_admin_plugin_menu_links but new method is to simply add a "Has Setting : true" in the main.inc.php header
This commit is contained in:
Zacharieg
2020-04-22 14:41:52 +02:00
committed by GitHub
parent 669f3ff864
commit 0a268bcce1
7 changed files with 268 additions and 134 deletions

View File

@@ -83,6 +83,21 @@ if (isset($_GET['incompatible_plugins']))
exit;
}
//--------------------------------------------------------Get the menu with the depreciated version
$plugin_menu_links_deprec = trigger_change('get_admin_plugin_menu_links', array());
$settings_url_for_plugin_deprec = array();
foreach ($plugin_menu_links_deprec as $value)
{
if (preg_match('/^admin\.php\?page=plugin-(.*)$/', $value["URL"], $matches)) {
$settings_url_for_plugin_deprec[$matches[1]] = $value["URL"];
} elseif (preg_match('/^.*section=(.*)[\/&%].*$/', $value["URL"], $matches)) {
$settings_url_for_plugin_deprec[$matches[1]] = $value["URL"];
}
}
// +-----------------------------------------------------------------------+
// | start template output |
// +-----------------------------------------------------------------------+
@@ -91,7 +106,7 @@ $plugins->sort_fs_plugins('name');
$merged_extensions = $plugins->get_merged_extensions();
$merged_plugins = false;
$tpl_plugins = array();
$active_plugins = 0;
$count_types_plugins = array("active"=>0, "inactive"=>0, "missing"=>0, "merged"=>0);
foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
{
@@ -102,6 +117,13 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
unset($_SESSION['incompatible_plugins']);
}
$setting_url = '';
if (isset($settings_url_for_plugin_deprec[$plugin_id])) { //old version
$setting_url = $settings_url_for_plugin_deprec[$plugin_id];
} else if ($fs_plugin['hasSettings']) { // new version
$setting_url = "admin.php?page=plugin-".$plugin_id;
}
$tpl_plugin = array(
'ID' => $plugin_id,
'NAME' => $fs_plugin['name'],
@@ -111,6 +133,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
'AUTHOR' => $fs_plugin['author'],
'AUTHOR_URL' => @$fs_plugin['author uri'],
'U_ACTION' => sprintf($action_url, $plugin_id),
'SETTINGS_URL' => $setting_url,
);
if (isset($plugins->db_plugins_by_id[$plugin_id]))
@@ -133,10 +156,7 @@ foreach($plugins->fs_plugins as $plugin_id => $fs_plugin)
$merged_plugins = true;
}
if ($tpl_plugin['STATE'] == 'active')
{
$active_plugins++;
}
$count_types_plugins[$tpl_plugin['STATE']]++;
$tpl_plugins[] = $tpl_plugin;
}
@@ -184,7 +204,7 @@ usort($tpl_plugins, 'cmp');
$template->assign(
array(
'plugins' => $tpl_plugins,
'active_plugins' => $active_plugins,
'count_types_plugins' => $count_types_plugins,
'PWG_TOKEN' => $pwg_token,
'base_url' => $base_url,
'show_details' => $show_details,