source: extensions/plugin_lang_analysis/template/main.tpl @ 23467

Last change on this file since 23467 was 23467, checked in by mistic100, 11 years ago

allow multiple language files in a plugin

File size: 8.3 KB
Line 
1{combine_css path=$PLA_PATH|@cat:"template/style.css"}
2{combine_css path=$PLA_PATH|@cat:"template/fontello/css/fontello_pla.css"}
3
4
5<div class="titrePage">
6        <h2>Plugin Language Analysis</h2>
7</div>
8
9{if isset($U_BACK)}
10<p style="text-align:left;margin-left:20px;"><a href="{$U_BACK}" class="buttonLike">{'Back'|@translate}</a></p>
11{/if}
12
13
14{* <!-- select --> *}
15{if $PLA_STEP=='select'}
16{footer_script}{literal}
17$('form#pla').submit(function() {
18  window.location.href = location.href + '&plugin_id=' + $(this).find('select').val();
19  return false;
20});
21{/literal}{/footer_script}
22
23<form method="GET" action="{$F_ACTION}" class="properties" id="pla">
24<fieldset>
25  <legend>{'How to use?'|@translate}</legend>
26
27  <p>
28    This tool analyzes each file of the selected plugin, searching for <b>l10n</b>, <b>l10n_dec</b> and <b>translate</b> functions.<br>
29    Then it compares the matched strings to the content of the plugin language file and the common and admin core language files.<br>
30    Each file of the plugin can be configured as <b>Common</b> (public) or <b>Admin</b>.<br>
31    <br>
32    When the analysis is complete, each string can have one of these three status :
33  </p>
34 
35  <dl style="margin-left:30px;">
36    <dt class="iconpla-attention">missing</dt>
37    <dd>
38      not in the plugin language file<br>
39      <b>AND</b> not in the common language file<br>
40      <b>AND</b> (<br>
41      &nbsp;&nbsp;&nbsp;&nbsp;belonging to at least one common file<br>
42      &nbsp;&nbsp;&nbsp;&nbsp;<b>OR</b> not in the admin language file<br>
43      )
44    </dd>
45 
46    <dt class="iconpla-attention-circled">useless</dt>
47    <dd>
48      in the plugin language file<br>
49      <b>AND</b> (<br>
50      &nbsp;&nbsp;&nbsp;&nbsp;in the common language file<br>
51      &nbsp;&nbsp;&nbsp;&nbsp;<b>OR</b> (<br>
52      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;not belonging to any common file<br>
53      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>AND</b> in the admin language file<br>
54      &nbsp;&nbsp;&nbsp;&nbsp;)<br>
55      )
56    </dd>
57 
58    <dt class="iconpla-ok-squared">ok</dt>
59    <dd>
60      any other case
61    </dd>
62  </dl>
63 
64  <p>
65    You can click the <span class="iconpla-plus-circled"></span> icon on the left of each string to see where it is located.
66  </p>
67</fieldset>
68
69<fieldset>
70  <legend>{'Select a plugin'|@translate}</legend>
71 
72  <select name="plugin_id">
73  {foreach from=$PLA_PLUGINS item=plugin key=plugin_id}
74    <option value="{$plugin_id}">{$plugin.name} ({$plugin.version})</option>
75  {/foreach}
76  </select>
77
78  <p class="formButtons"><input type="submit" value="{'Continue'|@translate}"></p>
79</fieldset>
80</form>
81
82{* <!-- configure --> *}
83{elseif $PLA_STEP=='config'}
84{footer_script}{literal}
85$('.switch-button.type span').click(function() {
86  $(this).siblings('span').removeClass('active');
87  $(this).addClass('active');
88 
89  if ($(this).hasClass('common')) {
90    $(this).nextAll('input').val('false');
91  }
92  else {
93    $(this).nextAll('input').val('true');
94  }
95});
96$('.switch-button.other span').click(function() {
97  if ($(this).hasClass('active')) {
98    $(this).removeClass('active');
99    $(this).next('input').val('false');
100  }
101  else {
102    $(this).addClass('active');
103    $(this).next('input').val('true');
104  }
105});
106{/literal}{/footer_script}
107
108<form method="POST" action="{$F_ACTION}" class="properties">
109<fieldset>
110  <legend>{'Select dependencies'|@translate}</legend>
111 
112  <table class="files">
113  <thead>
114    <tr>
115      <th></th>
116      <th>{'Core dependency'|@translate}</th>
117      <th>{'Local dependencies'|@translate}</th>
118    </tr>
119  </thead>
120 
121  <tbody>
122  {foreach from=$PLA_FILES item=file}
123    <tr>
124      <td>{$file.path}</td>
125      <td>
126        <div class="switch-button type">
127          <span class="item common {if not $file.is_admin}active{/if}">{'Common'|@translate}</span>
128          <span class="item admin {if $file.is_admin}active{/if}">{'Admin'|@translate}</span>
129          <input type="hidden" name="files[{$file.path}][is_admin]" value="{if $file.is_admin}true{else}false{/if}">
130        </div>
131      </td>
132      <td>
133        <div class="switch-button other">
134        {foreach from=$PLA_LANG_FILES item=path key=lang_file}
135          <span class="item other {if $lang_file|in_array:$file.lang_files}active{/if}">{$lang_file}</span>
136          <input type="hidden" name="files[{$file.path}][lang_files][{$lang_file}]" value="{if $lang_file|in_array:$file.lang_files}true{else}false{/if}">
137        {/foreach}
138        </div>
139      </td>
140    </tr>
141  {/foreach}
142  </tbody>
143  </table>
144 
145  <p class="formButtons"><input type="submit" value="{'Continue'|@translate}"></p>
146</fieldset>
147</form>
148
149{* <!-- analysis --> *}
150{elseif $PLA_STEP=='analysis'}
151{footer_script}{literal}
152$('.strings tr.string td.toggler').click(function() {
153  if ($(this).hasClass('iconpla-plus-circled')) {
154    $(this).removeClass('iconpla-plus-circled').addClass('iconpla-minus-circled');
155    $(this).parent().nextUntil('tr.string').show();
156  }
157  else {
158    $(this).removeClass('iconpla-minus-circled').addClass('iconpla-plus-circled');
159    $(this).parent().nextUntil('tr.string').hide();
160  }
161});
162
163$('.strings tr.string').hover(
164  function() {
165    $(this).addClass('hover').nextUntil('tr.string').addClass('hover');
166  },
167  function() {
168    $(this).removeClass('hover').nextUntil('tr.string').removeClass('hover');
169  }
170);
171$('.strings tr.file').hover(
172  function() {
173    $(this).prevAll('tr.string:first').addClass('hover').nextUntil('tr.string').addClass('hover');
174  },
175  function() {
176    $(this).prevAll('tr.string:first').removeClass('hover').nextUntil('tr.string').removeClass('hover');
177  }
178);
179
180$('.open-all').click(function() {
181  $('.strings tr.file').show();
182});
183$('.open-missing').click(function() {
184  $('.strings tr.file.string-missing').show();
185});
186$('.close-all').click(function() {
187  $('.strings tr.file').hide();
188});
189{/literal}{/footer_script}
190
191{html_style}
192.strings tr td:nth-last-child(-n+{math equation="2+x" x=$PLA_LANG_FILES|@count}) {ldelim}
193  text-align:center;
194}
195{/html_style}
196
197<fieldset>
198  <legend>{$PLA_PLUGIN.name}</legend>
199 
200  <p style="text-align:left;">
201    <a class="open-all">{'Expand all'|@translate}</a>
202    / <a class="open-missing">{'Expand missing'|@translate}</a>
203    / <a class="close-all">{'Collapse all'|@translate}</a>
204  </p>
205 
206  <table class="strings">
207  <thead>
208    <tr>
209      <th></th>
210      <th class="legend">
211        <span class="missing">{'Missing'|@translate}</span>
212        <span class="useless">{'Useless'|@translate}</span>
213      </th>
214      <th>{'Dependency'|@translate}</th>
215    {foreach from=$PLA_LANG_FILES item=path key=lang_file}
216      <th>{$lang_file}</th>
217    {/foreach}
218      <th>common.lang</th>
219      <th>admin.lang</th>
220    </tr>
221  </thead>
222   
223  <tbody>
224  {foreach from=$PLA_STRINGS item=data key=string}
225    <!-- begin string -->
226    <tr class="string {$data.stat}">
227      <td class="toggler iconpla-plus-circled"></td>
228      <td>{$string|htmlspecialchars}</td>
229      {if $data.is_admin}<td class="text-admin">{'Admin'|@translate}</td>
230      {else}<td class="text-common">{'Common'|@translate}</td>{/if}
231    {foreach from=$PLA_LANG_FILES item=path key=lang_file}
232      <td>{if $lang_file|in_array:$data.in_plugin}<b>{'Yes'|@translate}</b>{else}{'No'|@translate}{/if}</td>
233    {/foreach}
234      <td>{if $data.in_common}<b>{'Yes'|@translate}</b>{else}{'No'|@translate}{/if}</td>
235      <td>{if $data.in_admin}<b>{'Yes'|@translate}</b>{else}{'No'|@translate}{/if}</td>
236    </tr>
237    {foreach from=$data.files item=file_data key=file}
238      <!-- begin file -->
239      <tr class="file string-{$data.stat} {$file_data.stat}">
240        <td></td>
241        <td>{$file} <i>({', '|@implode:$file_data.lines})</i></td>
242        {if $file_data.is_admin}<td class="text-admin">{'Admin'|@translate}</td>
243        {else}<td class="text-common">{'Common'|@translate}</td>{/if}
244      {foreach from=$PLA_LANG_FILES item=path key=lang_file}
245        <td>{if $lang_file|in_array:$file_data.lang_files}<b>{'Yes'|@translate}</b>{else}{'No'|@translate}{/if}</td>
246      {/foreach}
247        <td></td>
248        <td></td>
249      </tr>
250    {/foreach} {* <!-- end file --> *}
251  {/foreach} {* <!-- end string --> *}
252  </tbody>
253 
254  <tfoot>
255    <tr>
256      <th></th>
257      <th>{'%d strings : %d missing and %d useless.'|@translate|sprintf:$PLA_COUNTS.total:$PLA_COUNTS.missing:$PLA_COUNTS.useless}</th>
258      <th></th>
259      <th></th>
260      <th></th>
261      <th></th>
262      <th></th>
263    </tr>
264  </tfoot>
265  </table>
266</fieldset>
267
268{/if}
Note: See TracBrowser for help on using the repository browser.