1{**
2 * Copyright since 2007 PrestaShop SA and Contributors
3 * PrestaShop is an International Registered Trademark & Property of PrestaShop SA
4 *
5 * NOTICE OF LICENSE
6 *
7 * This source file is subject to the Open Software License (OSL 3.0)
8 * that is bundled with this package in the file LICENSE.md.
9 * It is also available through the world-wide-web at this URL:
10 * https://opensource.org/licenses/OSL-3.0
11 * If you did not receive a copy of the license and are unable to
12 * obtain it through the world-wide-web, please send an email
13 * to license@prestashop.com so we can send you a copy immediately.
14 *
15 * DISCLAIMER
16 *
17 * Do not edit or add to this file if you wish to upgrade PrestaShop to newer
18 * versions in the future. If you wish to customize PrestaShop for your
19 * needs please refer to https://devdocs.prestashop.com/ for more information.
20 *
21 * @author    PrestaShop SA and Contributors <contact@prestashop.com>
22 * @copyright Since 2007 PrestaShop SA and Contributors
23 * @license   https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
24 *}
25
26<div id="{$table}_toolbar" class="toolbar-placeholder">
27	<div class="toolbarBox {if $toolbar_scroll}toolbarHead{/if}">
28		{block name=toolbarBox}
29			<ul>
30				{foreach from=$toolbar_btn item=btn key=k}
31					<li>
32						<a id="desc-{$table}-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}" class="toolbar_btn{if isset($btn.target) && $btn.target} _blank{/if}"{if isset($btn.href)} href="{$btn.href}"{/if} title="{$btn.desc}"{if isset($btn.js) && $btn.js} onclick="{$btn.js}"{/if}>
33							<span class="process-icon-{if isset($btn.imgclass)}{$btn.imgclass}{else}{$k}{/if}{if isset($btn.class)} {$btn.class}{/if}"></span>
34							<div{if isset($btn.force_desc) && $btn.force_desc == true } class="locked"{/if}>{$btn.desc}</div>
35						</a>
36						{if $k == 'modules-list'}
37							<div id="modules_list_container" style="display:none">
38							<div style="float:right;margin:5px">
39								<a href="#" onclick="$('#modules_list_container').slideUp();return false;"><img alt="X" src="../img/admin/close.png" /></a>
40							</div>
41							<div id="modules_list_loader"><img src="../img/loader.gif" alt="" border="0" /></div>
42							<div id="modules_list_container_tab_modal" style="display:none;"></div>
43							</div>
44						{/if}
45					</li>
46				{/foreach}
47			</ul>
48
49			<script type="text/javascript">
50			//<![CDATA[
51				var submited = false
52				var modules_list_loaded = false;
53				$(function() {
54					//get reference on save link
55					btn_save = $('#{$table}_toolbar span[class~="process-icon-save"]').parent();
56
57					//get reference on form submit button
58					btn_submit = $('#{$table}_form_submit_btn');
59
60					if (btn_save.length > 0 && btn_submit.length > 0)
61					{
62						//get reference on save and stay link
63						btn_save_and_stay = $('span[class~="process-icon-save-and-stay"]').parent();
64
65						//get reference on current save link label
66						lbl_save = $('#desc-{$table}-save div');
67
68						//override save link label with submit button value
69						if (btn_submit.val().length > 0)
70							lbl_save.html(btn_submit.attr("value"));
71
72						if (btn_save_and_stay.length > 0)
73						{
74							//get reference on current save link label
75							lbl_save_and_stay = $('#desc-{$table}-save-and-stay div');
76
77							//override save and stay link label with submit button value
78							if (btn_submit.val().length > 0 && lbl_save_and_stay && !lbl_save_and_stay.hasClass('locked'))
79								lbl_save_and_stay.html(btn_submit.val() + " {l s='and stay'} ");
80						}
81
82						//hide standard submit button
83						btn_submit.hide();
84						//bind enter key press to validate form
85						$('#{$table}_form').keypress(function (e) {
86							if (e.which == 13 && e.target.localName != 'textarea' && !e.target.hasClass('tagify'))
87								$('#desc-{$table}-save').click();
88						});
89						//submit the form
90						{block name=formSubmit}
91							btn_save.click(function() {
92								// Vars
93								var btn_submit = $('#{$table}_form_submit_btn');
94
95								// Avoid double click
96								if (submited)
97									return false;
98								submited = true;
99
100								//add hidden input to emulate submit button click when posting the form -> field name posted
101								btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'" value="1" />');
102
103								$('#{$table}_form').submit();
104								return false;
105							});
106
107							if (btn_save_and_stay)
108							{
109								btn_save_and_stay.click(function() {
110									//add hidden input to emulate submit button click when posting the form -> field name posted
111									btn_submit.before('<input type="hidden" name="'+btn_submit.attr("name")+'AndStay" value="1" />');
112
113									$('#{$table}_form').submit();
114									return false;
115								});
116							}
117						{/block}
118					}
119					{if isset($tab_modules_open) && $tab_modules_open}
120						$('#modules_list_container').slideDown();
121						openModulesList();
122					{/if}
123				});
124				{if isset($tab_modules_list) && $tab_modules_list}
125					$('.process-icon-modules-list').parent('a').unbind().bind('click', function (){
126						$('#modules_list_container').slideDown();
127						openModulesList();
128					});
129				{/if}
130			//]]>
131			</script>
132		{/block}
133		<div class="pageTitle">
134			<h3>{block name=pageTitle}
135				<span id="current_obj" style="font-weight: normal;">
136					{if $title}
137						{foreach $title as $key => $item name=title}
138							{* Use strip_tags because if the string already has been through htmlentities using escape will break it *}
139							<span class="breadcrumb item-{$key} ">{$item|strip_tags}
140								{if !$smarty.foreach.title.last}
141									<img alt="&gt;" style="margin-right:5px" src="../img/admin/separator_breadcrumb.png" />
142								{/if}
143							</span>
144						{/foreach}
145					{else}
146						&nbsp;
147					{/if}
148				</span>
149				{/block}
150			</h3>
151		</div>
152	</div>
153</div>
154