1 | {combine_script id='jquery.ajaxmanager' load='footer' require='jquery' path='themes/default/js/plugins/jquery.ajaxmanager.js' } |
---|
2 | |
---|
3 | {footer_script require='jquery.ajaxmanager'} |
---|
4 | /* incompatible message */ |
---|
5 | var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; |
---|
6 | incompatible_msg += '\n'; |
---|
7 | incompatible_msg += '{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; |
---|
8 | |
---|
9 | /* group action */ |
---|
10 | var pwg_token = '{$PWG_TOKEN}'; |
---|
11 | var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; |
---|
12 | {literal} |
---|
13 | var queuedManager = jQuery.manageAjax.create('queued', { |
---|
14 | queue: true, |
---|
15 | maxRequests: 1, |
---|
16 | complete: function() { location.reload(); } |
---|
17 | }); |
---|
18 | |
---|
19 | jQuery(document).ready(function() { |
---|
20 | /* group action */ |
---|
21 | jQuery('a.deactivate_all').click(function() { |
---|
22 | if (confirm(confirmMsg)) { |
---|
23 | jQuery('div.active').each(function() { |
---|
24 | performPluginAction(jQuery(this).attr('id'), 'deactivate'); |
---|
25 | }); |
---|
26 | } |
---|
27 | }); |
---|
28 | jQuery('a.activate_all').click(function() { |
---|
29 | if (confirm(confirmMsg)) { |
---|
30 | jQuery('div.inactive').each(function() { |
---|
31 | performPluginAction(jQuery(this).attr('id'), 'activate'); |
---|
32 | }); |
---|
33 | } |
---|
34 | }); |
---|
35 | function performPluginAction(id, action) { |
---|
36 | queuedManager.add({ |
---|
37 | type: 'GET', |
---|
38 | dataType: 'json', |
---|
39 | url: 'ws.php', |
---|
40 | data: { method: 'pwg.plugins.performAction', action: action, plugin: id, pwg_token: pwg_token, format: 'json' }, |
---|
41 | success: function(data) { |
---|
42 | if (data['stat'] == 'ok') { |
---|
43 | if (action == 'deactivate') |
---|
44 | jQuery("#"+id).removeClass('active').addClass('inactive'); |
---|
45 | else |
---|
46 | jQuery("#"+id).removeClass('inactive').addClass('active'); |
---|
47 | } |
---|
48 | } |
---|
49 | }); |
---|
50 | }; |
---|
51 | |
---|
52 | /* incompatible message */ |
---|
53 | jQuery('.incompatible a.incompatible').click(function() { |
---|
54 | return confirm(incompatible_msg); |
---|
55 | }); |
---|
56 | |
---|
57 | /* TipTips */ |
---|
58 | jQuery('.warning').tipTip({ |
---|
59 | 'delay' : 0, |
---|
60 | 'fadeIn' : 200, |
---|
61 | 'fadeOut' : 200, |
---|
62 | 'maxWidth':'250px' |
---|
63 | }).click(function(){ |
---|
64 | return false; |
---|
65 | }); |
---|
66 | jQuery('.pluginMiniBoxDesc').tipTip({ |
---|
67 | 'delay' : 0, |
---|
68 | 'fadeIn' : 200, |
---|
69 | 'fadeOut' : 200, |
---|
70 | 'maxWidth':'300px', /* not effective, TipTip bug */ |
---|
71 | 'keepAlive':true |
---|
72 | }).click(function(){ |
---|
73 | return false; |
---|
74 | }); |
---|
75 | }); |
---|
76 | {/literal} |
---|
77 | {/footer_script} |
---|
78 | |
---|
79 | <div class="titrePage"> |
---|
80 | <span class="sort"> |
---|
81 | <form action="" method="get" name="change_order"> |
---|
82 | <input type="hidden" name="page" value="plugins_list"/> |
---|
83 | {'Sort order'|@translate} : |
---|
84 | <select name="plugin_order" onchange="this.form.submit();"> |
---|
85 | <option value="status" {if $plugin_order=='state'}selected="selected"{/if}>{'Status'|@translate}</option> |
---|
86 | <option value="name" {if $plugin_order=='name'}selected="selected"{/if}>{'Name'|@translate}</option> |
---|
87 | </select> |
---|
88 | | |
---|
89 | {'Display'|@translate} : |
---|
90 | <select name="plugin_display" onchange="this.form.submit();"> |
---|
91 | <option value="compact" {if $plugin_diplay=='compact'}selected="selected"{/if}>{'Compact'|@translate}</option> |
---|
92 | <option value="complete" {if $plugin_display=='complete'}selected="selected"{/if}>{'Complete'|@translate}</option> |
---|
93 | </select> |
---|
94 | | |
---|
95 | <a class="deactivate_all">{'Deactivate'|@translate} {'all'|@translate}</a> |
---|
96 | {* | |
---|
97 | <a class="activate_all">{'Activate'|@translate} {'all'|@translate}</a> *} |
---|
98 | </form> |
---|
99 | </span> |
---|
100 | <h2>{'Plugins'|@translate}</h2> |
---|
101 | </div> |
---|
102 | |
---|
103 | {if isset($plugins)} |
---|
104 | |
---|
105 | {assign var='field_name' value='null'} |
---|
106 | {foreach from=$plugins item=plugin name=plugins_loop} |
---|
107 | |
---|
108 | {if $plugin_order == 'state' AND $field_name != $plugin.STATE} |
---|
109 | {if $field_name != 'null'}</fieldset>{/if} |
---|
110 | <fieldset class="pluginBoxes pluginsByState"> |
---|
111 | <legend> |
---|
112 | {if $plugin.STATE == 'active'} |
---|
113 | {'Active Plugins'|@translate} |
---|
114 | {elseif $plugin.STATE == 'inactive'} |
---|
115 | {'Inactive Plugins'|@translate} |
---|
116 | {elseif $plugin.STATE == 'missing'} |
---|
117 | {'Missing Plugins'|@translate} |
---|
118 | {elseif $plugin.STATE == 'merged'} |
---|
119 | {'Obsolete Plugins'|@translate} |
---|
120 | {/if} |
---|
121 | </legend> |
---|
122 | {assign var='field_name' value=$plugin.STATE} |
---|
123 | |
---|
124 | {elseif $field_name == 'null'} |
---|
125 | <fieldset class="pluginBoxes pluginsByName"> |
---|
126 | {assign var='field_name' value='not_null'} |
---|
127 | |
---|
128 | {/if} |
---|
129 | |
---|
130 | {if not empty($plugin.AUTHOR)} |
---|
131 | {if not empty($plugin.AUTHOR_URL)} |
---|
132 | {assign var='author' value="<a href='%s'>%s</a>"|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} |
---|
133 | {else} |
---|
134 | {assign var='author' value='<u>'|cat:$plugin.AUTHOR|cat:'</u>'} |
---|
135 | {/if} |
---|
136 | {/if} |
---|
137 | |
---|
138 | {if $plugin_display == 'complete'} |
---|
139 | <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> |
---|
140 | <table> |
---|
141 | <tr> |
---|
142 | <td class="pluginBoxNameCell"> |
---|
143 | {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if} |
---|
144 | {$plugin.NAME} |
---|
145 | </td> |
---|
146 | <td>{$plugin.DESC}</td> |
---|
147 | </tr> |
---|
148 | <tr> |
---|
149 | <td> |
---|
150 | {if $plugin.STATE == 'active'} |
---|
151 | <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> |
---|
152 | | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> |
---|
153 | |
---|
154 | {elseif $plugin.STATE == 'inactive'} |
---|
155 | <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> |
---|
156 | | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> |
---|
157 | |
---|
158 | {elseif $plugin.STATE == 'missing'} |
---|
159 | <a href="{$plugin.U_ACTION}&action=uninstall" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> |
---|
160 | |
---|
161 | {elseif $plugin.STATE == 'merged'} |
---|
162 | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete">{'Delete'|@translate}</a> |
---|
163 | {/if} |
---|
164 | </td> |
---|
165 | <td> |
---|
166 | {'Version'|@translate} {$plugin.VERSION} |
---|
167 | |
---|
168 | {if not empty($author)} |
---|
169 | | {'By %s'|@translate|@sprintf:$author} |
---|
170 | {/if} |
---|
171 | |
---|
172 | {if not empty($plugin.VISIT_URL)} |
---|
173 | | <a class="externalLink" href="{$plugin.VISIT_URL}">{'Visit plugin site'|@translate}</a> |
---|
174 | {/if} |
---|
175 | </td> |
---|
176 | </tr> |
---|
177 | </table> |
---|
178 | </div> {*<!-- pluginBox -->*} |
---|
179 | |
---|
180 | {elseif $plugin_display == 'compact'} |
---|
181 | {if not empty($plugin.VISIT_URL)} |
---|
182 | {assign var='version' value="<a class='externalLink' href='"|cat:$plugin.VISIT_URL|cat:"'>"|cat:$plugin.VERSION|cat:"</a>"} |
---|
183 | {else |
---|
184 | {assign var='version' value=$plugin.VERSION} |
---|
185 | {/if} |
---|
186 | |
---|
187 | <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}{if $plugin.INCOMPATIBLE} incompatible{/if}"> |
---|
188 | <div class="pluginMiniBoxNameCell"> |
---|
189 | {if $plugin.INCOMPATIBLE}<a class="warning" title="{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'html'}"></a>{/if} |
---|
190 | {$plugin.NAME} |
---|
191 | <a class="pluginMiniBoxDesc" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}"></a> |
---|
192 | </div> |
---|
193 | <div class="pluginActions"> |
---|
194 | <div> |
---|
195 | {if $plugin.STATE == 'active'} |
---|
196 | <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> |
---|
197 | | <a href="{$plugin.U_ACTION}&action=restore" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Restore'|@translate}</a> |
---|
198 | |
---|
199 | {elseif $plugin.STATE == 'inactive'} |
---|
200 | <a href="{$plugin.U_ACTION}&action=activate" {if $plugin.INCOMPATIBLE}class="incompatible"{/if}>{'Activate'|@translate}</a> |
---|
201 | | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete"onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Delete'|@translate}</a> |
---|
202 | |
---|
203 | {elseif $plugin.STATE == 'missing'} |
---|
204 | <a href="{$plugin.U_ACTION}&action=uninstall" class="plugin-delete" onclick="return confirm('{'Are you sure?'|@translate|@escape:'javascript'}');">{'Uninstall'|@translate}</a> |
---|
205 | |
---|
206 | {elseif $plugin.STATE == 'merged'} |
---|
207 | <a href="{$plugin.U_ACTION}&action=delete" class="plugin-delete">{'Delete'|@translate}</a> |
---|
208 | {/if} |
---|
209 | </div> |
---|
210 | </div> |
---|
211 | </div> {*<!-- pluginMiniBox -->*} |
---|
212 | |
---|
213 | {/if} |
---|
214 | |
---|
215 | {/foreach} |
---|
216 | </fieldset> |
---|
217 | |
---|
218 | {/if} |
---|