PageRenderTime 26ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/admin3120tsmcd/themes/default/template/controllers/performance/helpers/form/form.tpl

https://gitlab.com/elasa/shop2.elasa.ir
Smarty Template | 231 lines | 186 code | 21 blank | 24 comment | 40 complexity | 7199239bd700f58e58acc179a7030549 MD5 | raw file
  1. {*
  2. * 2007-2015 PrestaShop
  3. *
  4. * NOTICE OF LICENSE
  5. *
  6. * This source file is subject to the Academic Free License (AFL 3.0)
  7. * that is bundled with this package in the file LICENSE.txt.
  8. * It is also available through the world-wide-web at this URL:
  9. * http://opensource.org/licenses/afl-3.0.php
  10. * If you did not receive a copy of the license and are unable to
  11. * obtain it through the world-wide-web, please send an email
  12. * to license@prestashop.com so we can send you a copy immediately.
  13. *
  14. * DISCLAIMER
  15. *
  16. * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
  17. * versions in the future. If you wish to customize PrestaShop for your
  18. * needs please refer to http://www.prestashop.com for more information.
  19. *
  20. * @author PrestaShop SA <contact@prestashop.com>
  21. * @copyright 2007-2015 PrestaShop SA
  22. * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
  23. * International Registered Trademark & Property of PrestaShop SA
  24. *}
  25. {extends file="helpers/form/form.tpl"}
  26. {block name="input_row"}
  27. {if $input.name == 'caching_system'}<div id="{$input.name}_wrapper"{if isset($_PS_CACHE_ENABLED_) && !$_PS_CACHE_ENABLED_} style="display:none"{/if}>{/if}
  28. {if $input.name == 'smarty_caching_type' || $input.name == 'smarty_clear_cache'}<div id="{$input.name}_wrapper"{if isset($fields_value.smarty_cache) && !$fields_value.smarty_cache} style="display:none"{/if}>{/if}
  29. {$smarty.block.parent}
  30. {if $input.name == 'caching_system' || $input.name == 'smarty_caching_type' || $input.name == 'smarty_clear_cache'}</div>{/if}
  31. {/block}
  32. {block name="input"}
  33. {if $input.type == 'radio' && $input.name == 'combination' && $input.disabled}
  34. <div class="alert alert-warning">
  35. {l s='This feature cannot be disabled because it is currently in use.'}
  36. </div>
  37. {/if}
  38. {$smarty.block.parent}
  39. {/block}
  40. {block name="description"}
  41. {$smarty.block.parent}
  42. {if $input.type == 'radio' && $input.name == 'combination'}
  43. <ul>
  44. <li>{l s='Combinations tab on product page'}</li>
  45. <li>{l s='Value'}</li>
  46. <li>{l s='Attribute'}</li>
  47. </ul>
  48. {elseif $input.type == 'radio' && $input.name == 'feature'}
  49. <ul>
  50. <li>{l s='Features tab on product page'}</li>
  51. <li>{l s='Feature'}</li>
  52. <li>{l s='Feature value'}</li>
  53. </ul>
  54. {/if}
  55. {/block}
  56. {block name="other_input"}
  57. {if $key == 'memcachedServers'}
  58. <div id="memcachedServers">
  59. <div class="form-group">
  60. <div class="col-lg-9 col-lg-push-3">
  61. <button id="addMemcachedServer" class="btn btn-default" type="button" >
  62. <i class="icon-plus-sign-alt"></i>&nbsp;{l s='Add server'}
  63. </button>
  64. </div>
  65. </div>
  66. <div id="formMemcachedServer" style="display:none;">
  67. <div class="form-group">
  68. <label class="control-label col-lg-3">{l s='IP Address'} </label>
  69. <div class="col-lg-9">
  70. <input class="form-control" type="text" name="memcachedIp" />
  71. </div>
  72. </div>
  73. <div class="form-group">
  74. <label class="control-label col-lg-3">{l s='Port'} </label>
  75. <div class="col-lg-9">
  76. <input class="form-control" type="text" name="memcachedPort" value="11211" />
  77. </div>
  78. </div>
  79. <div class="form-group">
  80. <label class="control-label col-lg-3">{l s='Weight'} </label>
  81. <div class="col-lg-9">
  82. <input class="form-control" type="text" name="memcachedWeight" value="1" />
  83. </div>
  84. </div>
  85. <div class="form-group">
  86. <div class="col-lg-9 col-lg-push-3">
  87. <input type="submit" value="{l s='Add Server'}" name="submitAddServer" class="btn btn-default" />
  88. <input type="button" value="{l s='Test Server'}" id="testMemcachedServer" class="btn btn-default" />
  89. </div>
  90. </div>
  91. </div>
  92. {if $servers}
  93. <div class="form-group">
  94. <table class="table">
  95. <thead>
  96. <tr>
  97. <th class="fixed-width-xs"><span class="title_box">{l s='ID'}</span></th>
  98. <th><span class="title_box">{l s='IP address'}</span></th>
  99. <th class="fixed-width-xs"><span class="title_box">{l s='Port'}</span></th>
  100. <th class="fixed-width-xs"><span class="title_box">{l s='Weight'}</span></th>
  101. <th>&nbsp;</th>
  102. </tr>
  103. </thead>
  104. <tbody>
  105. {foreach $servers AS $server}
  106. <tr>
  107. <td>{$server.id_memcached_server}</td>
  108. <td>{$server.ip}</td>
  109. <td>{$server.port}</td>
  110. <td>{$server.weight}</td>
  111. <td>
  112. <a class="btn btn-default" href="{$currentIndex|escape:'html':'UTF-8'}&amp;token={$token|escape:'html':'UTF-8'}&amp;deleteMemcachedServer={$server.id_memcached_server}" onclick="if (!confirm('{l s='Do you really want to remove the server %s:%s' sprintf=[$server.ip, $server.port] js=1}')) return false;"><i class="icon-minus-sign-alt"></i> {l s='Remove'}</a>
  113. </td>
  114. </tr>
  115. {/foreach}
  116. </tbody>
  117. </table>
  118. </div>
  119. {/if}
  120. </div>
  121. {/if}
  122. {/block}
  123. {block name="script"}
  124. function showMemcached() {
  125. if ($('input[name="caching_system"]:radio:checked').val() == 'CacheMemcache') {
  126. $('#memcachedServers').css('display', $('#cache_active_on').is(':checked') ? 'block' : 'none');
  127. $('#ps_cache_fs_directory_depth').closest('.form-group').hide();
  128. }
  129. else if ($('input[name="caching_system"]:radio:checked').val() == 'CacheFs') {
  130. $('#memcachedServers').hide();
  131. $('#ps_cache_fs_directory_depth').closest('.form-group').css('display', $('#cache_active_on').is(':checked') ? 'block' : 'none');
  132. }
  133. else {
  134. $('#memcachedServers').hide();
  135. $('#ps_cache_fs_directory_depth').closest('.form-group').hide();
  136. }
  137. }
  138. $(document).ready(function() {
  139. showMemcached();
  140. $('input[name="cache_active"]').change(function() {
  141. $('#caching_system_wrapper').css('display', ($(this).val() == 1) ? 'block' : 'none');
  142. showMemcached();
  143. if ($('input[name="caching_system"]:radio:checked').val() == 'CacheFs')
  144. $('#ps_cache_fs_directory_depth').focus();
  145. });
  146. $('input[name="caching_system"]').change(function() {
  147. $('#cache_up').val(1);
  148. showMemcached();
  149. if ($('input[name="caching_system"]:radio:checked').val() == 'CacheFs')
  150. $('#ps_cache_fs_directory_depth').focus();
  151. });
  152. $('input[name="smarty_cache"]').change(function() {
  153. $('#smarty_caching_type_wrapper').css('display', ($(this).val() == 1) ? 'block' : 'none');
  154. $('#smarty_clear_cache_wrapper').css('display', ($(this).val() == 1) ? 'block' : 'none');
  155. });
  156. $('#addMemcachedServer').click(function() {
  157. $('#formMemcachedServer').show();
  158. return false;
  159. });
  160. $('#testMemcachedServer').click(function() {
  161. var host = $('input:text[name=memcachedIp]').val();
  162. var port = $('input:text[name=memcachedPort]').val();
  163. if (host && port)
  164. {
  165. $.ajax({
  166. url: 'index.php',
  167. data:
  168. {
  169. controller: 'adminperformance',
  170. token: '{$token|escape:'html':'UTF-8'}',
  171. action: 'test_server',
  172. sHost: host,
  173. sPort: port,
  174. ajax: true
  175. },
  176. context: document.body,
  177. dataType: 'json',
  178. context: this,
  179. async: false,
  180. success: function(data)
  181. {
  182. if (data && $.isArray(data))
  183. {
  184. var color = data[0] != 0 ? 'green' : 'red';
  185. $('#formMemcachedServerStatus').show();
  186. $('input:text[name=memcachedIp]').css('background', color);
  187. $('input:text[name=memcachedPort]').css('background', color);
  188. }
  189. }
  190. });
  191. }
  192. return false;
  193. });
  194. $('input[name="smarty_force_compile"], input[name="smarty_cache"], input[name="smarty_clear_cache"], input[name="smarty_caching_type"], input[name="smarty_console"], input[name="smarty_console_key"]').change(function(){
  195. $('#smarty_up').val(1);
  196. });
  197. $('input[name="combination"], input[name="feature"], input[name="customer_group"]').change(function(){
  198. $('#features_detachables_up').val(1);
  199. });
  200. $('input[name="_MEDIA_SERVER_1_"], input[name="_MEDIA_SERVER_2_"], input[name="_MEDIA_SERVER_3_"]').change(function(){
  201. $('#media_server_up').val(1);
  202. });
  203. $('input[name="PS_CIPHER_ALGORITHM"]').change(function(){
  204. $('#ciphering_up').val(1);
  205. });
  206. $('input[name="cache_active"]').change(function(){
  207. $('#cache_up').val(1);
  208. });
  209. });
  210. {/block}