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 $show_details} - {'hide details'|@translate} - {else} - {'show details'|@translate} - {/if} -
- {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} -
+
8}style="display:none"{/if}{/if}> - {if $plugin.STATE == 'active'} - {'Active Plugins'|@translate} - {elseif $plugin.STATE == 'inactive'} - {'Inactive Plugins'|@translate} - {elseif $plugin.STATE == 'missing'} - {'Missing Plugins'|@translate} - {elseif $plugin.STATE == 'merged'} - {'Obsolete Plugins'|@translate} - {/if} +
+

+ {if $plugin.STATE == 'active'} + {'Active Plugins'|@translate} + {elseif $plugin.STATE == 'inactive'} + {'Inactive Plugins'|@translate} + {elseif $plugin.STATE == 'missing'} + {'Missing Plugins'|@translate} + {elseif $plugin.STATE == 'merged'} + {'Obsolete Plugins'|@translate} + {/if} +

+
{$count_types_plugins[$plugin.STATE]}
+
+ + {if $plugin.STATE == 'active'} + + {/if}
{assign var='field_name' value=$plugin.STATE} {/if} @@ -131,91 +216,62 @@ jQuery(document).ready(function() { {assign var='author' value=''|cat:$plugin.AUTHOR|cat:''} {/if} {/if} - - {if $show_details} -
- - - - - - - - - -
- {$plugin.NAME} - {$plugin.DESC}
- {if $plugin.STATE == 'active'} - {'Deactivate'|@translate} - | {'Restore'|@translate} - {elseif $plugin.STATE == 'inactive'} - {'Activate'|@translate} - | {'Delete'|@translate} - - {elseif $plugin.STATE == 'missing'} - {'Uninstall'|@translate} - - {elseif $plugin.STATE == 'merged'} - {'Delete'|@translate} - {/if} - - {'Version'|@translate} {$plugin.VERSION} - - {if not empty($author)} - | {'By %s'|@translate:$author} - {/if} - - {if not empty($plugin.VISIT_URL)} - | {'Visit plugin site'|@translate} - {/if} -
-
{**} - + {if not empty($plugin.VISIT_URL)} + {assign var='version' value=""|cat:$plugin.VERSION|cat:""} {else} - {if not empty($plugin.VISIT_URL)} - {assign var='version' value=""|cat:$plugin.VERSION|cat:""} - {else} - {assign var='version' value=$plugin.VERSION} - {/if} - -
+ {assign var='version' value=$plugin.VERSION} + {/if} + +
+
+
+
{$plugin.NAME} - +
+
+ {$plugin.DESC}
-
{if $plugin.STATE == 'active'} - {'Deactivate'|@translate} - | {'Restore'|@translate} - + {if $plugin.SETTINGS_URL != ''} + {'Settings'|@translate} + {else} +
{'Settings'|@translate}
+ {/if} + {'Deactivate'|@translate} + {'Restore'|@translate} + {elseif $plugin.STATE == 'inactive'} - {'Activate'|@translate} - | {'Delete'|@translate} - +
+ {'Activate'|@translate} + {'Delete'|@translate} {elseif $plugin.STATE == 'missing'} - {'Uninstall'|@translate} +
+
+ {'Uninstall'|@translate} {elseif $plugin.STATE == 'merged'} - {'Delete'|@translate} - {/if} -
+
+
+ {'Delete'|@translate} + {/if}
-
{**} +
+
{**} - {/if} - -{if $plugin.STATE == 'active'} - {counter} - {if $active_plugins == $i} - - {counter} - {/if} -{/if} - -{/foreach} + + + {/foreach}
+
+
+ {assign var='badge_inactive' value='%s'|@sprintf:$count_types_plugins["inactive"]} +
{'You have %s inactive plugins'|translate:$badge_inactive}
+
+ +
+ {/if} diff --git a/admin/themes/default/theme.css b/admin/themes/default/theme.css index 570e57e5d..af4dcc33c 100644 --- a/admin/themes/default/theme.css +++ b/admin/themes/default/theme.css @@ -1076,8 +1076,36 @@ h2:lang(en) { text-transform:capitalize; } .checkActions {text-align:left;padding:0;margin:0;} .pluginBoxes { + border: none; text-align:left; position:relative; + display: flex; + flex-wrap: wrap; + justify-content: left; + padding: 0; + min-height: 271px; +} + +.pluginBoxesTitle {font-size: 16px;} +.pluginBoxesTitle p {margin-right: 10px;} + + +.pluginFilter,.pluginBoxesTitle {display: flex;align-items: center} +.pluginFilter p{margin-right: 10px} +.pluginFilter input {padding: 3px} +.pluginFilter {justify-content: end;position: absolute;right: 20px} + +.pluginBoxesCount { + background-color: rgb(150, 150, 150); + color: white; + border-radius: 30%; + text-align: center; + padding-left: 3px; + padding-right: 3px; + height: 20px; + font-weight: bold; + font-size: 14px; + width: 25px; } .pluginBox { @@ -1092,28 +1120,70 @@ h2:lang(en) { text-transform:capitalize; } .pluginBox td.pluginDesc img {vertical-align:middle;} .pluginBoxNameCell {width:180px; vertical-align:top;} .pluginBoxes .inactive, .pluginBoxes .uninstalled {opacity:0.8;filter:alpha(opacity=80);} +.emptyResearch {opacity: 0.3;text-align: center;left: 45%;font-weight: bold;font-size: 30px; position: absolute; display: none;} .pluginMiniBox { - display:inline-table; - text-align:center; - width:250px; - height:40px; - margin:5px; - border-width:1px; - border-style:solid; - border-radius:5px; - -moz-border-radius:5px; + display:flex; + box-shadow: 1px 1px 1px 1px #d7d7d7; + width:260px; + height:205px; + margin:10px; + border-radius:2px; + -moz-border-radius:2px; overflow:hidden; } -.pluginMiniBoxNameCell {font-size:1.05em; margin:5px 0;position:relative;} -.pluginActions {display: table-row; font-size:0.95em; color:#777;} -.pluginActions DIV {display: table-cell; vertical-align: middle; line-height:18px; } -.pluginMiniBox .showInfo, .themeBox .showInfo { display:block;position:absolute;top:0;right:5px;width:15px; } + + .pluginBar {width: 1.5%;} + + .pluginContent { + width: 98.5%; + text-align: left; + background-color: #fafafa; + padding: 7px; + padding-top: 10px; + padding-left: 10px; + overflow: hidden; + position: relative; +} + +.pluginMiniBoxNameCell { + font-size: 14px; + font-weight: bold; +} + +.pluginDesc { + margin-top: 5px; + font-size: 12px; + color: grey; + line-height: 1.5em; + height: 3em; + position: relative; + overflow: hidden; +} + +.pluginActions {display: flex; font-size:11px; justify-content: space-between; margin-top: 1; bottom: 4px;position: absolute;flex-direction: column; align-items: center; width: 240px;} +.pluginActions > * {padding: 8px; text-align: center; padding-left: 4px; padding-right: 4px; width: 96%; margin: 4px} +.pluginEmptyInput {width: 90px;} +.pluginUnavailableAction {opacity: 0.5;} +.pluginActionLevel1 {background-color: #ffc17e; font-weight: bold;} +.pluginActionLevel1:hover {background-color: #ff7700; color: white; text-decoration: none;} +.pluginActionLevel2 {background-color: #ececec; font-weight: bold;} +.pluginActionLevel2:hover {background-color: #8b8b8b; color: white; text-decoration: none; } +.pluginActionLevel3 {padding-left: 10px; opacity: 0.9;} +.pluginBarActive {background-color: #ffc17e} +.pluginBarInactive {background-color: #8b8b8b} + +.pluginMiniBox .showInfo, .themeBox .showInfo { display:block;position:absolute;top:0;right:5px;width:15px; padding: 10px;} .warning:before {content:url(icon/warning.png);vertical-align:top;} -.deactivate_all {text-align:right;font-size:0.95em;} +.deactivate_all {font-size: 11px;font-weight: normal; margin-top: -5px; margin-bottom: 5px; font-weight: bold;opacity: 0.6;} .showDetails {text-align:right; margin-bottom:-15px; margin-top:-10px; padding-right:1em;} +.showInactivePlugins {margin-bottom: 40px;} +.showInactivePluginsInfo {display: flex;justify-content: center;align-items: center; font-size: 18px;} +.showInactivePluginsInfo > * {margin: 5px;} +.showInactivePlugins button {font-size: 16px;} + .languageBoxes {min-height:0;text-align:left;} .languageBox {display:inline-table; text-align:center; width:200px; height:40px; margin:5px; -moz-border-radius:5px;border-radius:5px; overflow:hidden; } .languageName {font-size:1.1em; margin:5px 0;} diff --git a/admin/themes/roma/theme.css b/admin/themes/roma/theme.css index a3ad051e3..f7ac8aa5a 100644 --- a/admin/themes/roma/theme.css +++ b/admin/themes/roma/theme.css @@ -72,7 +72,7 @@ h1 { .content dl, dd { margin:5px; } -UL.thumbnails span.wrap2:hover { background-color#7CBA0F; color:#666; } +UL.thumbnails span.wrap2:hover { background-color: #7CBA0F; color:#666; } UL.thumbnails span.wrap2 { background-color:#333; } @@ -259,10 +259,14 @@ a.stat-box:hover { #helpContent, #pLoaderPage, #ftpPage, #ftpPage LEGEND {color:#aaa;} -.pluginBox, .pluginMiniBox, .groups li {background-color:#333;color:#999;border-color:#333;} +.pluginBox, .pluginContent, .pluginMiniBox, .groups li {background-color:#333;color:#999;border-color:#333; box-shadow: none;} .pluginBoxNameCell, .pluginMiniBoxNameCell {color:#ddd;} .pluginBox.incompatible, .pluginMiniBox.incompatible {border-color:#800 !important;} .pluginBoxes .merged, .pluginBoxes .missing {background-color:#422;border:1px solid #800;} +.pluginActionLevel1, .pluginActionLevel2 {color: #333;} +.pluginActionLevel2 {background-color: #bbbbbb;} +.pluginFilter {color: #c1c1c1;} +.pluginFilter input {border-color: #c1c1c1;} .languageBox {background-color:#333;} .languageName {color:#ccc;} .languageDefault {background-color:#555; color:#aaa;}