[10305] | 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 */ |
---|
[10098] | 5 | var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}'; |
---|
[11047] | 6 | var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}'; |
---|
[10098] | 7 | |
---|
[10305] | 8 | /* group action */ |
---|
| 9 | var pwg_token = '{$PWG_TOKEN}'; |
---|
| 10 | var confirmMsg = '{'Are you sure?'|@translate|@escape:'javascript'}'; |
---|
[10098] | 11 | {literal} |
---|
[10305] | 12 | var queuedManager = jQuery.manageAjax.create('queued', { |
---|
| 13 | queue: true, |
---|
[11184] | 14 | maxRequests: 1 |
---|
[10305] | 15 | }); |
---|
[11184] | 16 | var nb_plugins = jQuery('div.active').size(); |
---|
| 17 | var done = 0; |
---|
[10305] | 18 | |
---|
[10098] | 19 | jQuery(document).ready(function() { |
---|
[10305] | 20 | /* group action */ |
---|
[11012] | 21 | jQuery('div.deactivate_all a').click(function() { |
---|
[10305] | 22 | if (confirm(confirmMsg)) { |
---|
| 23 | jQuery('div.active').each(function() { |
---|
[11010] | 24 | performPluginDeactivate(jQuery(this).attr('id')); |
---|
[10305] | 25 | }); |
---|
| 26 | } |
---|
| 27 | }); |
---|
[11010] | 28 | function performPluginDeactivate(id) { |
---|
[10305] | 29 | queuedManager.add({ |
---|
| 30 | type: 'GET', |
---|
| 31 | dataType: 'json', |
---|
| 32 | url: 'ws.php', |
---|
[11010] | 33 | data: { method: 'pwg.plugins.performAction', action: 'deactivate', plugin: id, pwg_token: pwg_token, format: 'json' }, |
---|
[10305] | 34 | success: function(data) { |
---|
[11184] | 35 | if (data['stat'] == 'ok') jQuery("#"+id).removeClass('active').addClass('inactive'); |
---|
| 36 | done++; |
---|
| 37 | if (done == nb_plugins) location.reload(); |
---|
[10305] | 38 | } |
---|
| 39 | }); |
---|
| 40 | }; |
---|
| 41 | |
---|
[11047] | 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} |
---|
[12029] | 52 | {if $show_details} |
---|
[11047] | 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 | }); |
---|
[10098] | 69 | }); |
---|
[10305] | 70 | |
---|
| 71 | /* TipTips */ |
---|
[10378] | 72 | jQuery('.plugin-restore').tipTip({ |
---|
| 73 | 'delay' : 0, |
---|
| 74 | 'fadeIn' : 200, |
---|
| 75 | 'fadeOut' : 200 |
---|
| 76 | }); |
---|
[11011] | 77 | jQuery('.showInfo').tipTip({ |
---|
[10305] | 78 | 'delay' : 0, |
---|
| 79 | 'fadeIn' : 200, |
---|
| 80 | 'fadeOut' : 200, |
---|
[11209] | 81 | 'maxWidth':'300px', |
---|
[11011] | 82 | 'keepAlive':true, |
---|
| 83 | 'activation':'click' |
---|
[10305] | 84 | }); |
---|
[10098] | 85 | }); |
---|
[10305] | 86 | {/literal} |
---|
| 87 | {/footer_script} |
---|
[10098] | 88 | |
---|
[2531] | 89 | <div class="titrePage"> |
---|
| 90 | <h2>{'Plugins'|@translate}</h2> |
---|
| 91 | </div> |
---|
| 92 | |
---|
[12029] | 93 | <div class="showDetails"> |
---|
| 94 | {if $show_details} |
---|
| 95 | <a href="{$base_url}&show_details=0">{'hide details'|@translate}</a> |
---|
| 96 | {else} |
---|
| 97 | <a href="{$base_url}&show_details=1">{'show details'|@translate}</a> |
---|
| 98 | {/if} |
---|
| 99 | </div> |
---|
| 100 | |
---|
[2531] | 101 | {if isset($plugins)} |
---|
[2619] | 102 | |
---|
[11227] | 103 | {assign var='field_name' value='null'} {* <!-- 'counter' for fieldset management --> *} |
---|
| 104 | {counter start=0 assign=i} {* <!-- counter for 'deactivate all' link --> *} |
---|
[10305] | 105 | {foreach from=$plugins item=plugin name=plugins_loop} |
---|
| 106 | |
---|
[11010] | 107 | {if $field_name != $plugin.STATE} |
---|
[11012] | 108 | {if $field_name != 'null'} |
---|
| 109 | </fieldset> |
---|
| 110 | {/if} |
---|
| 111 | |
---|
[11010] | 112 | <fieldset class="pluginBoxes"> |
---|
[10305] | 113 | <legend> |
---|
| 114 | {if $plugin.STATE == 'active'} |
---|
| 115 | {'Active Plugins'|@translate} |
---|
| 116 | {elseif $plugin.STATE == 'inactive'} |
---|
| 117 | {'Inactive Plugins'|@translate} |
---|
| 118 | {elseif $plugin.STATE == 'missing'} |
---|
| 119 | {'Missing Plugins'|@translate} |
---|
| 120 | {elseif $plugin.STATE == 'merged'} |
---|
| 121 | {'Obsolete Plugins'|@translate} |
---|
| 122 | {/if} |
---|
| 123 | </legend> |
---|
| 124 | {assign var='field_name' value=$plugin.STATE} |
---|
| 125 | {/if} |
---|
[11227] | 126 | |
---|
[10305] | 127 | {if not empty($plugin.AUTHOR)} |
---|
| 128 | {if not empty($plugin.AUTHOR_URL)} |
---|
| 129 | {assign var='author' value="<a href='%s'>%s</a>"|@sprintf:$plugin.AUTHOR_URL:$plugin.AUTHOR} |
---|
| 130 | {else} |
---|
| 131 | {assign var='author' value='<u>'|cat:$plugin.AUTHOR|cat:'</u>'} |
---|
| 132 | {/if} |
---|
| 133 | {/if} |
---|
| 134 | |
---|
[12029] | 135 | {if $show_details} |
---|
[11184] | 136 | <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}"> |
---|
[10305] | 137 | <table> |
---|
| 138 | <tr> |
---|
| 139 | <td class="pluginBoxNameCell"> |
---|
| 140 | {$plugin.NAME} |
---|
| 141 | </td> |
---|
| 142 | <td>{$plugin.DESC}</td> |
---|
| 143 | </tr> |
---|
[11010] | 144 | <tr class="pluginActions"> |
---|
[10305] | 145 | <td> |
---|
| 146 | {if $plugin.STATE == 'active'} |
---|
| 147 | <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> |
---|
[11838] | 148 | | <a href="{$plugin.U_ACTION}&action=restore" class="plugin-restore" title="{'Restore default configuration. You will lose your plugin settings!'|@translate}" onclick="return confirm(confirmMsg);">{'Restore'|@translate}</a> |
---|
[10098] | 149 | |
---|
[10305] | 150 | {elseif $plugin.STATE == 'inactive'} |
---|
[11047] | 151 | <a href="{$plugin.U_ACTION}&action=activate" class="activate">{'Activate'|@translate}</a> |
---|
[11227] | 152 | | <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm(confirmMsg);">{'Delete'|@translate}</a> |
---|
[10305] | 153 | |
---|
| 154 | {elseif $plugin.STATE == 'missing'} |
---|
[11227] | 155 | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm(confirmMsg);">{'Uninstall'|@translate}</a> |
---|
[10305] | 156 | |
---|
| 157 | {elseif $plugin.STATE == 'merged'} |
---|
[11010] | 158 | <a href="{$plugin.U_ACTION}&action=delete">{'Delete'|@translate}</a> |
---|
[10305] | 159 | {/if} |
---|
| 160 | </td> |
---|
| 161 | <td> |
---|
| 162 | {'Version'|@translate} {$plugin.VERSION} |
---|
| 163 | |
---|
| 164 | {if not empty($author)} |
---|
| 165 | | {'By %s'|@translate|@sprintf:$author} |
---|
| 166 | {/if} |
---|
| 167 | |
---|
| 168 | {if not empty($plugin.VISIT_URL)} |
---|
| 169 | | <a class="externalLink" href="{$plugin.VISIT_URL}">{'Visit plugin site'|@translate}</a> |
---|
| 170 | {/if} |
---|
| 171 | </td> |
---|
| 172 | </tr> |
---|
| 173 | </table> |
---|
| 174 | </div> {*<!-- pluginBox -->*} |
---|
| 175 | |
---|
[12029] | 176 | {else} |
---|
[10305] | 177 | {if not empty($plugin.VISIT_URL)} |
---|
| 178 | {assign var='version' value="<a class='externalLink' href='"|cat:$plugin.VISIT_URL|cat:"'>"|cat:$plugin.VERSION|cat:"</a>"} |
---|
[11227] | 179 | {else} |
---|
[10305] | 180 | {assign var='version' value=$plugin.VERSION} |
---|
| 181 | {/if} |
---|
| 182 | |
---|
[11184] | 183 | <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}"> |
---|
[10305] | 184 | <div class="pluginMiniBoxNameCell"> |
---|
[11011] | 185 | {$plugin.NAME} |
---|
| 186 | <a class="showInfo" title="{if !empty($author)}{'By %s'|@translate|@sprintf:$author} | {/if}{'Version'|@translate} {$version}<br/>{$plugin.DESC|@escape:'html'}">i</a> |
---|
[10305] | 187 | </div> |
---|
| 188 | <div class="pluginActions"> |
---|
| 189 | <div> |
---|
| 190 | {if $plugin.STATE == 'active'} |
---|
[5474] | 191 | <a href="{$plugin.U_ACTION}&action=deactivate">{'Deactivate'|@translate}</a> |
---|
[11838] | 192 | | <a href="{$plugin.U_ACTION}&action=restore" class="plugin-restore" title="{'Restore default configuration. You will lose your plugin settings!'|@translate}" onclick="return confirm(confirmMsg);">{'Restore'|@translate}</a> |
---|
[5474] | 193 | |
---|
[10305] | 194 | {elseif $plugin.STATE == 'inactive'} |
---|
[11047] | 195 | <a href="{$plugin.U_ACTION}&action=activate" class="activate">{'Activate'|@translate}</a> |
---|
[11227] | 196 | | <a href="{$plugin.U_ACTION}&action=delete" onclick="return confirm(confirmMsg);">{'Delete'|@translate}</a> |
---|
[5474] | 197 | |
---|
[10305] | 198 | {elseif $plugin.STATE == 'missing'} |
---|
[11227] | 199 | <a href="{$plugin.U_ACTION}&action=uninstall" onclick="return confirm(confirmMsg);">{'Uninstall'|@translate}</a> |
---|
[5474] | 200 | |
---|
[10305] | 201 | {elseif $plugin.STATE == 'merged'} |
---|
[11010] | 202 | <a href="{$plugin.U_ACTION}&action=delete">{'Delete'|@translate}</a> |
---|
[10305] | 203 | {/if} |
---|
| 204 | </div> |
---|
| 205 | </div> |
---|
| 206 | </div> {*<!-- pluginMiniBox -->*} |
---|
| 207 | |
---|
| 208 | {/if} |
---|
| 209 | |
---|
[11228] | 210 | {if $plugin.STATE == 'active'} |
---|
| 211 | {counter} |
---|
[11227] | 212 | {if $active_plugins == $i} |
---|
| 213 | <div class="deactivate_all"><a>{'Deactivate all'|@translate}</a></div> |
---|
| 214 | {counter} |
---|
| 215 | {/if} |
---|
[11228] | 216 | {/if} |
---|
[11227] | 217 | |
---|
[2531] | 218 | {/foreach} |
---|
[10305] | 219 | </fieldset> |
---|
[5474] | 220 | |
---|
[2531] | 221 | {/if} |
---|