source: trunk/admin/themes/default/template/plugins_installed.tpl @ 12029

Last change on this file since 12029 was 12029, checked in by plg, 9 years ago

plugin manager: replace the top left "Display Compact/Complete" select box by a
simpler link "show details" or "hide details" on top right.

  • Property svn:eol-style set to LF
File size: 7.5 KB
Line 
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 */
5var incompatible_msg = '{'WARNING! This plugin does not seem to be compatible with this version of Piwigo.'|@translate|@escape:'javascript'}';
6var activate_msg = '\n{'Do you want to activate anyway?'|@translate|@escape:'javascript'}';
7
8/* group action */
9var pwg_token = '{$PWG_TOKEN}';
10var confirmMsg  = '{'Are you sure?'|@translate|@escape:'javascript'}';
11{literal}
12var queuedManager = jQuery.manageAjax.create('queued', {
13  queue: true, 
14  maxRequests: 1
15});
16var nb_plugins = jQuery('div.active').size();
17var done = 0;
18
19jQuery(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 $show_details}
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  <h2>{'Plugins'|@translate}</h2>
91</div>
92
93<div class="showDetails">
94  {if $show_details}
95  <a href="{$base_url}&amp;show_details=0">{'hide details'|@translate}</a>
96  {else}
97  <a href="{$base_url}&amp;show_details=1">{'show details'|@translate}</a>
98  {/if}
99</div>
100
101{if isset($plugins)}
102
103{assign var='field_name' value='null'} {* <!-- 'counter' for fieldset management --> *}
104{counter start=0 assign=i} {* <!-- counter for 'deactivate all' link --> *}
105{foreach from=$plugins item=plugin name=plugins_loop}
106   
107{if $field_name != $plugin.STATE}
108  {if $field_name != 'null'}
109  </fieldset>
110  {/if}
111 
112  <fieldset class="pluginBoxes">
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}
126 
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   
135  {if $show_details}
136    <div id="{$plugin.ID}" class="pluginBox {$plugin.STATE}">
137      <table>
138        <tr>
139          <td class="pluginBoxNameCell">
140            {$plugin.NAME}
141          </td>
142          <td>{$plugin.DESC}</td>
143        </tr>
144        <tr class="pluginActions">
145          <td>
146          {if $plugin.STATE == 'active'}
147            <a href="{$plugin.U_ACTION}&amp;action=deactivate">{'Deactivate'|@translate}</a>
148            | <a href="{$plugin.U_ACTION}&amp;action=restore" class="plugin-restore" title="{'Restore default configuration. You will lose your plugin settings!'|@translate}" onclick="return confirm(confirmMsg);">{'Restore'|@translate}</a>
149
150          {elseif $plugin.STATE == 'inactive'}
151            <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a>
152            | <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm(confirmMsg);">{'Delete'|@translate}</a>
153
154          {elseif $plugin.STATE == 'missing'}
155            <a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm(confirmMsg);">{'Uninstall'|@translate}</a>
156
157          {elseif $plugin.STATE == 'merged'}
158            <a href="{$plugin.U_ACTION}&amp;action=delete">{'Delete'|@translate}</a>
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   
176  {else}
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>"}
179    {else}
180      {assign var='version' value=$plugin.VERSION}
181    {/if}
182         
183    <div id="{$plugin.ID}" class="pluginMiniBox {$plugin.STATE}">
184      <div class="pluginMiniBoxNameCell">
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>
187      </div>
188      <div class="pluginActions">
189        <div>
190        {if $plugin.STATE == 'active'}
191          <a href="{$plugin.U_ACTION}&amp;action=deactivate">{'Deactivate'|@translate}</a>
192          | <a href="{$plugin.U_ACTION}&amp;action=restore" class="plugin-restore" title="{'Restore default configuration. You will lose your plugin settings!'|@translate}" onclick="return confirm(confirmMsg);">{'Restore'|@translate}</a>
193
194        {elseif $plugin.STATE == 'inactive'}
195          <a href="{$plugin.U_ACTION}&amp;action=activate" class="activate">{'Activate'|@translate}</a>
196          | <a href="{$plugin.U_ACTION}&amp;action=delete" onclick="return confirm(confirmMsg);">{'Delete'|@translate}</a>
197
198        {elseif $plugin.STATE == 'missing'}
199          <a href="{$plugin.U_ACTION}&amp;action=uninstall" onclick="return confirm(confirmMsg);">{'Uninstall'|@translate}</a>
200
201        {elseif $plugin.STATE == 'merged'}
202          <a href="{$plugin.U_ACTION}&amp;action=delete">{'Delete'|@translate}</a>
203        {/if}
204        </div>
205      </div>
206    </div> {*<!-- pluginMiniBox -->*}
207   
208  {/if}
209 
210{if $plugin.STATE == 'active'}
211  {counter}
212  {if $active_plugins == $i}
213    <div class="deactivate_all"><a>{'Deactivate all'|@translate}</a></div>
214    {counter}
215  {/if}
216{/if}
217 
218{/foreach}
219  </fieldset>
220
221{/if}
Note: See TracBrowser for help on using the repository browser.