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