1{* 2* 2007-2016 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-2016 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{if $show_toolbar} 26<div class="panel-footer" id="toolbar-footer"> 27 {foreach from=$toolbar_btn item=btn key=k} 28 {if $k != 'modules-list'} 29 <a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="btn btn-default{if $k=='save' || $k=='save-and-stay'} pull-right{/if}{if isset($btn.target) && $btn.target} _blank{/if}" href="{if isset($btn.href)}{$btn.href|escape:'html':'UTF-8'}{else}#{/if}"{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}> 30 <i class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}{if isset($btn.class)} {$btn.class}{/if}"></i> <span {if isset($btn.force_desc) && $btn.force_desc == true } class="locked" {/if}>{$btn.desc}</span> 31 </a> 32 {/if} 33 {/foreach} 34 35 <script type="text/javascript"> 36 //<![CDATA[ 37 var submited = false 38 39 //get reference on save link 40 btn_save = $('#desc-{$table}-save'); 41 42 //get reference on form submit button 43 btn_submit = $('#{$table}_form_submit_btn'); 44 45 if (btn_save.length > 0 && btn_submit.length > 0) 46 { 47 //get reference on save and stay link 48 btn_save_and_stay = $('#desc-{$table}-save-and-stay'); 49 50 //get reference on current save link label 51 lbl_save = $('#desc-{$table}-save'); 52 53 //override save link label with submit button value 54 if (btn_submit.html().length > 0) 55 lbl_save.find('span').html(btn_submit.html()); 56 57 if (btn_save_and_stay.length > 0) 58 { 59 //get reference on current save link label 60 lbl_save_and_stay = $('#desc-{$table}-save-and-stay'); 61 62 //override save and stay link label with submit button value 63 if (btn_submit.html().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked')) 64 lbl_save_and_stay.find('span').html(btn_submit.html() + " {l s='and stay'} "); 65 } 66 67 //hide standard submit button 68 btn_submit.hide(); 69 //bind enter key press to validate form 70 $('#{$table}_form').find('input').keypress(function (e) { 71 if (e.which == 13 && e.target.localName != 'textarea' && !$(e.target).parent().hasClass('tagify-container')) 72 $('#desc-{$table}-save').click(); 73 }); 74 //submit the form 75 {block name=formSubmit} 76 btn_save.click(function() { 77 // Avoid double click 78 if (submited) 79 return false; 80 submited = true; 81 82 if ($(this).attr('href').replace('#', '').replace(/\s/g, '') != '') 83 return true; 84 85 //add hidden input to emulate submit button click when posting the form -> field name posted 86 btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />'); 87 88 $('#{$table}_form').submit(); 89 return false; 90 }); 91 92 if (btn_save_and_stay) 93 { 94 btn_save_and_stay.click(function() { 95 if ($(this).attr('href').replace('#', '').replace(/\s/g, '') != '') 96 return true; 97 98 //add hidden input to emulate submit button click when posting the form -> field name posted 99 btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />'); 100 101 $('#{$table}_form').submit(); 102 return false; 103 }); 104 } 105 {/block} 106 } 107 //]]> 108 </script> 109</div> 110{/if} 111