From f5c5a1b9b2c9fe711193ec6c3ac79fd06239a182 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Tue, 12 Apr 2011 00:30:28 +0000 Subject: new plugins manager, update TipTip in v1.3 git-svn-id: http://piwigo.org/svn/trunk@10305 68402e56-0260-453c-a942-63ccdbb3a9ee --- admin/themes/default/template/plugins_list.tpl | 244 +++++++++++++++++++------ 1 file changed, 185 insertions(+), 59 deletions(-) (limited to 'admin/themes/default/template/plugins_list.tpl') diff --git a/admin/themes/default/template/plugins_list.tpl b/admin/themes/default/template/plugins_list.tpl index 101227231..39b1725bd 100644 --- a/admin/themes/default/template/plugins_list.tpl +++ b/admin/themes/default/template/plugins_list.tpl @@ -1,92 +1,218 @@ -{footer_script} +{combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' } + +{footer_script require='jquery.ajaxmanager'} +/* incompatible message */ var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; incompatible_msg += '\n'; incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; +/* group action */ +var pwg_token = '{$PWG_TOKEN}'; +var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; {literal} +var queuedManager = jQuery.manageAjax.create('queued', { + queue: true, + maxRequests: 1, + complete: function() { location.reload(); } +}); + jQuery(document).ready(function() { - jQuery('.incompatible').click(function() { + /* group action */ + jQuery('a.deactivate_all').click(function() { + if (confirm(confirmMsg)) { + jQuery('div.active').each(function() { + performPluginAction(jQuery(this).attr('id'), 'deactivate'); + }); + } + }); + jQuery('a.activate_all').click(function() { + if (confirm(confirmMsg)) { + jQuery('div.inactive').each(function() { + performPluginAction(jQuery(this).attr('id'), 'activate'); + }); + } + }); + function performPluginAction(id, action) { + queuedManager.add({ + type: 'GET', + dataType: 'json', + url: 'ws.php', + data: { method: 'pwg.plugins.performAction', action: action, plugin: id, pwg_token: pwg_token, format: 'json' }, + success: function(data) { + if (data['stat'] == 'ok') { + if (action == 'deactivate') + jQuery("#"+id).removeClass('active').addClass('inactive'); + else + jQuery("#"+id).removeClass('inactive').addClass('active'); + } + } + }); + }; + + /* incompatible message */ + jQuery('.incompatible a.incompatible').click(function() { return confirm(incompatible_msg); }); + + /* TipTips */ jQuery('.warning').tipTip({ 'delay' : 0, 'fadeIn' : 200, - 'fadeOut' : 200 + 'fadeOut' : 200, + 'maxWidth':'250px' + }).click(function(){ + return false; + }); + jQuery('.pluginMiniBoxDesc').tipTip({ + 'delay' : 0, + 'fadeIn' : 200, + 'fadeOut' : 200, + 'maxWidth':'300px', /* not effective, TipTip bug */ + 'keepAlive':true + }).click(function(){ + return false; }); }); -{/literal}{/footer_script} +{/literal} +{/footer_script}
+ +
+ + {'Sort order'|@translate} : + +   |   + {'Display'|@translate} : + +   |   + {'Deactivate'|@translate} {'all'|@translate} + {*   |   + {'Activate'|@translate} {'all'|@translate} *} +
+

{'Plugins'|@translate}

{if isset($plugins)} -{foreach from=$plugin_states item=plugin_state} -
- - {if $plugin_state == 'active'} - {'Active Plugins'|@translate} - - {elseif $plugin_state == 'inactive'} - {'Inactive Plugins'|@translate} +{assign var='field_name' value='null'} +{foreach from=$plugins item=plugin name=plugins_loop} + +{if $plugin_order == 'state' AND $field_name != $plugin.STATE} + {if $field_name != 'null'}
{/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} + + {assign var='field_name' value=$plugin.STATE} - {elseif $plugin_state == 'missing'} - {'Missing Plugins'|@translate} +{elseif $field_name == 'null'} +
+ {assign var='field_name' value='not_null'} - {elseif $plugin_state == 'merged'} - {'Obsolete Plugins'|@translate} +{/if} + {if not empty($plugin.AUTHOR)} + {if not empty($plugin.AUTHOR_URL)} + {assign var='author' value="%s"|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} + {else} + {assign var='author' value=''|cat:$plugin.AUTHOR|cat:''} + {/if} {/if} - - {foreach from=$plugins item=plugin name=plugins_loop} - {if $plugin.STATE == $plugin_state} -
- - - - - - - - -
- {$plugin.NAME} - {$plugin.DESC}
- {if $plugin.STATE == 'active'} - {'Deactivate'|@translate} - | {'Restore'|@translate} + + {if $plugin_display == 'complete'} +
+ + + + + + + - + + +
+ {if $plugin.INCOMPATIBLE}{/if} + {$plugin.NAME} + {$plugin.DESC}
+ {if $plugin.STATE == 'active'} + {'Deactivate'|@translate} + | {'Restore'|@translate} - {elseif $plugin_state == 'inactive'} - {'Activate'|@translate} - | {'Delete'|@translate} + {elseif $plugin.STATE == 'inactive'} + {'Activate'|@translate} + | {'Delete'|@translate} - {elseif $plugin_state == 'missing'} - {'Uninstall'|@translate} + {elseif $plugin.STATE == 'missing'} + {'Uninstall'|@translate} - {elseif $plugin_state == 'merged'} - {'Delete'|@translate} - {/if} - - {'Version'|@translate} {$plugin.VERSION} - {if not empty($plugin.AUTHOR)} - {if not empty($plugin.AUTHOR_URL)} - {assign var='author' value='%s'|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} - {else} - {assign var='author' value=$plugin.AUTHOR} - {/if} - | {'By %s'|@translate|@sprintf:$author} - {/if} + {elseif $plugin.STATE == 'merged'} + {'Delete'|@translate} + {/if} + + {'Version'|@translate} {$plugin.VERSION} + + {if not empty($author)} + | {'By %s'|@translate|@sprintf:$author} + {/if} + {if not empty($plugin.VISIT_URL)} + | {'Visit plugin site'|@translate} + {/if} +
+
{**} + + {elseif $plugin_display == 'compact'} {if not empty($plugin.VISIT_URL)} - | {'Visit plugin site'|@translate} - {/if} -
-
+ {assign var='version' value=""|cat:$plugin.VERSION|cat:""} + {else + {assign var='version' value=$plugin.VERSION} {/if} - {/foreach} -
+ +
+
+ {if $plugin.INCOMPATIBLE}{/if} + {$plugin.NAME} + +
+
+
+ {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} +
+
+
{**} + + {/if} + {/foreach} +
{/if} -- cgit v1.2.3