diff --git a/admin.php b/admin.php
index 79fb724e9..9b0d86879 100644
--- a/admin.php
+++ b/admin.php
@@ -261,19 +261,6 @@ if ($nb_orphans > 0)
);
}
-// +-----------------------------------------------------------------------+
-// | Plugin menu |
-// +-----------------------------------------------------------------------+
-
-$plugin_menu_links = trigger_change('get_admin_plugin_menu_links', array() );
-
-function UC_name_compare($a, $b)
-{
- return strcmp(strtolower($a['NAME']), strtolower($b['NAME']));
-}
-usort($plugin_menu_links, 'UC_name_compare');
-$template->assign('plugin_menu_items', $plugin_menu_links);
-
// +-----------------------------------------------------------------------+
// | Refresh permissions |
// +-----------------------------------------------------------------------+
diff --git a/admin/include/plugins.class.php b/admin/include/plugins.class.php
index a5c69e590..76a3b04f3 100644
--- a/admin/include/plugins.class.php
+++ b/admin/include/plugins.class.php
@@ -285,6 +285,7 @@ DELETE FROM '. PLUGINS_TABLE .'
'uri'=>'',
'description'=>'',
'author'=>'',
+ 'hasSettings'=>false,
);
$plg_data = file_get_contents($path.'/main.inc.php', null, null, 0, 2048);
@@ -316,6 +317,10 @@ DELETE FROM '. PLUGINS_TABLE .'
{
$plugin['author uri'] = trim($val[1]);
}
+ if (preg_match("/Has Settings:\\s*(true|True)/", $plg_data, $val))
+ {
+ $plugin['hasSettings'] = true;
+ }
if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid='))
{
list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']);
diff --git a/admin/plugins_installed.php b/admin/plugins_installed.php
index 9878f502d..75490e538 100644
--- a/admin/plugins_installed.php
+++ b/admin/plugins_installed.php
@@ -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,
diff --git a/admin/themes/default/template/admin.tpl b/admin/themes/default/template/admin.tpl
index a6058da19..a10b701f3 100644
--- a/admin/themes/default/template/admin.tpl
+++ b/admin/themes/default/template/admin.tpl
@@ -91,14 +91,6 @@ jQuery(document).ready(function() {
-{if !empty($plugin_menu_items)}
-
-
-{/if}
diff --git a/admin/themes/default/template/plugins_installed.tpl b/admin/themes/default/template/plugins_installed.tpl
index 9864abd9d..34a7237ef 100644
--- a/admin/themes/default/template/plugins_installed.tpl
+++ b/admin/themes/default/template/plugins_installed.tpl
@@ -5,6 +5,12 @@
var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}';
var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}';
+var showInactivePlugins = function() {
+ jQuery(".showInactivePlugins").fadeOut(complete=function(){
+ jQuery(".plugin-inactive").fadeIn();
+ })
+ }
+
/* group action */
var pwg_token = '{$PWG_TOKEN}';
var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}';
@@ -82,6 +88,76 @@ jQuery(document).ready(function() {
'keepAlive':true,
'activation':'click'
});
+ jQuery('.fullInfo').tipTip({
+ 'delay' : 500,
+ 'fadeIn' : 200,
+ 'fadeOut' : 200,
+ 'maxWidth':'300px',
+ 'keepAlive':false,
+ });
+
+ /* Add the '...' for the overflow of the description line*/
+ jQuery( document ).ready(function () {
+ jQuery('.pluginDesc').each(function () {
+ var el = jQuery(this).context;
+ var wordArray = el.innerHTML.split(' ');
+ if (el.scrollHeight > el.offsetHeight) {
+ jQuery(this).attr('title', jQuery(this).html())
+ }
+ while(el.scrollHeight > el.offsetHeight) {
+ wordArray.pop();
+ el.innerHTML = wordArray.join(' ') + '...';
+ }
+ })
+ });
+
+ /*Add the filter research*/
+ jQuery( document ).ready(function () {
+ jQuery(".pluginFilter input").on("input", function() {
+ let text = jQuery(this).val().toLowerCase();
+ var searchNumber = 0;
+ jQuery('.pluginBoxes').each(function () {
+ let searchNumberInBox = 0;
+ let pluginBoxes = jQuery(this);
+ pluginBoxes.find(".pluginMiniBox").each(function() {
+ if (text == "") {
+ jQuery(this).fadeIn()
+ searchNumberInBox++;
+ } else {
+ let name = jQuery(this).find(".pluginMiniBoxNameCell").text().toLowerCase();
+ let description = jQuery(this).find(".pluginDesc").text().toLowerCase();
+ if (name.search(text) != -1 || description.search(text) != -1){
+ jQuery(this).fadeIn()
+ searchNumberInBox++;
+ } else {
+ jQuery(this).fadeOut()
+ }
+ }
+ })
+ if (searchNumberInBox == 0) {
+ pluginBoxes.fadeOut();
+ } else {
+ if (pluginBoxes.hasClass("plugin-inactive")) {
+ showInactivePlugins()
+ } else {
+ pluginBoxes.fadeIn();
+ }
+ }
+ searchNumber += searchNumberInBox;
+ });
+ console.log(searchNumber);
+ if (searchNumber == 0) {
+ jQuery(".emptyResearch").fadeIn();
+ } else {
+ jQuery(".emptyResearch").fadeOut();
+ }
+ });
+ });
+
+ /* Show Inactive plugins or button to show them*/
+ jQuery( document ).ready(function () {
+ jQuery(".showInactivePlugins button").on('click', showInactivePlugins)
+ });
});
{/literal}
{/footer_script}
@@ -90,36 +166,45 @@ jQuery(document).ready(function() {
{'Plugins'|@translate}
-
-
{if isset($plugins)}
{assign var='field_name' value='null'} {* *}
{counter start=0 assign=i} {* *}
+
+
+
{'Filter'|@translate}
+
+
+
+ {'No plugins found'|@translate}
+
{foreach from=$plugins item=plugin name=plugins_loop}
{if $field_name != $plugin.STATE}
{if $field_name != 'null'}
- {/if}
+ {/if}
-