first commit

This commit is contained in:
2024-11-05 12:22:50 +01:00
commit e5682a3912
19641 changed files with 2948548 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*}
{**
* @deprecated since 1.7.6, to be removed in the next minor
*}
<div class="leadin">{block name="leadin"}{/block}</div>
<form action="{$url_submit|escape:'html':'UTF-8'}" id="{$table}_form" method="post" class="form-horizontal">
{if $display_key}
<input type="hidden" name="show_modules" value="{$display_key}" />
{/if}
<div class="panel">
<h3>
<i class="icon-paste"></i>
{l s='Transplant a module' d='Admin.Design.Feature'}
</h3>
<div class="form-group">
<label class="control-label col-lg-3 required"> {l s='Module' d='Admin.Global'}</label>
<div class="col-lg-9">
<select class="chosen" name="id_module" {if $edit_graft} disabled="disabled"{/if}>
{if !$hooks}
<option value="0" selected disabled>{l s='Please select a module' d='Admin.Design.Help'}</option>
{/if}
{foreach $modules as $module}
<option value="{$module->id|intval}"{if $id_module == $module->id || (!$id_module && $show_modules == $module->id)} selected="selected"{/if}>{$module->displayName|stripslashes}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3 required"> {l s='Transplant to' d='Admin.Design.Feature'}</label>
<div class="col-lg-9">
<select name="id_hook"{if !$hooks|@count} disabled="disabled"{/if}>
{if !$hooks|@count}
<option value="0">{l s='Select a module above before choosing from available hooks' d='Admin.Design.Help'}</option>
{/if}
<optgroup id="hooks_unregistered" label="{l s='Available hooks' d='Admin.Design.Feature'}">
{foreach $hooks as $hook}
{if !$hook['registered']}
<option value="{$hook['id_hook']}" {if $id_hook == $hook['id_hook']} selected="selected"{/if}>{$hook['name']}{if $hook['name'] != $hook['title']} ({$hook['title']}){/if}{if isset($hook['description'])} ({$hook['description']|escape:'htmlall':'UTF-8'}){/if}</option>
{/if}
{/foreach}
</optgroup>
<optgroup id="hooks_registered" label="{l s='Already registered hooks' d='Admin.Design.Feature'}" disabled>
{foreach $hooks as $hook}
{if $hook['registered']}
<option value="{$hook['id_hook']}" {if $id_hook == $hook['id_hook']} selected="selected"{/if}>{$hook['name']}{if $hook['name'] != $hook['title']} ({$hook['title']}){/if}{if isset($hook['description'])} ({$hook['description']|escape:'htmlall':'UTF-8'}){/if}</option>
{/if}
{/foreach}
</optgroup>
</select>
</div>
</div>
<div class="form-group">
<label class="control-label col-lg-3">{l s='Exceptions' d='Admin.Design.Feature'}</label>
<div class="col-lg-9">
<div class="well">
<div>
{l s='Please specify the files for which you do not want the module to be displayed.' d='Admin.Design.Help'}<br />
{l s='Please input each filename, separated by a comma (",").' d='Admin.Design.Help'}<br />
{l s='You can also click the filename in the list below, and even make a multiple selection by keeping the Ctrl key pressed while clicking, or choose a whole range of filename by keeping the Shift key pressed while clicking.' d='Admin.Design.Help'}<br />
{if !$except_diff}
{$exception_list}
{else}
{foreach $exception_list_diff as $value}
{$value}
{/foreach}
{/if}
</div>
</div>
</div>
</div>
<div class="panel-footer">
{if $edit_graft}
<input type="hidden" name="id_module" value="{$id_module}" />
<input type="hidden" name="id_hook" value="{$id_hook}" />
<input type="hidden" name="new_hook" id="new_hook" value="{$id_hook}" />
{/if}
<button type="submit" name="{if $edit_graft}submitEditGraft{else}submitAddToHook{/if}" id="{$table}_form_submit_btn" class="btn btn-default pull-right"><i class="process-icon-save"></i> {l s='Save' d='Admin.Actions'}</button>
</div>
</div>
</form>
<script type="text/javascript">
//<![CDATA
function position_exception_textchange() {
// TODO : Add & Remove automatically the "custom pages" in the "em_list_x"
var obj = $(this);
var shopID = obj.attr('id').replace(/\D/g, '');
var list = obj.closest('form').find('#em_list_' + shopID);
var values = obj.val().split(',');
var len = values.length;
list.find('option').prop('selected', false);
for (var i = 0; i < len; i++)
list.find('option[value="' + $.trim(values[i]) + '"]').prop('selected', true);
}
function position_exception_listchange() {
var obj = $(this);
var shopID = obj.attr('id').replace(/\D/g, '');
var val = obj.val();
var str = '';
if (val)
str = val.join(', ');
obj.closest('form').find('#em_text_' + shopID).val(str);
}
$(document).ready(function(){
$('form[id="hook_module_form"] input[id^="em_text_"]').each(function(){
$(this).change(position_exception_textchange).change();
});
$('form[id="hook_module_form"] select[id^="em_list_"]').each(function(){
$(this).change(position_exception_listchange);
});
$('select[name=id_hook]').on('change', function() {
$('#new_hook').attr('value', $(this).val());
});
});
//]]>
</script>

View File

@@ -0,0 +1,35 @@
<?php
/**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*/
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header('Location: ../../../../../../');
exit;

View File

@@ -0,0 +1,219 @@
{**
* Copyright since 2007 PrestaShop SA and Contributors
* PrestaShop is an International Registered Trademark & Property of PrestaShop SA
*
* NOTICE OF LICENSE
*
* This source file is subject to the Open Software License (OSL 3.0)
* that is bundled with this package in the file LICENSE.md.
* It is also available through the world-wide-web at this URL:
* https://opensource.org/licenses/OSL-3.0
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to https://devdocs.prestashop.com/ for more information.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
*}
{**
* @deprecated since 1.7.6, to be removed in the next minor
*}
<script type="text/javascript">
var come_from = 'AdminModulesPositions';
</script>
<div>{block name="leadin"}{/block}</div>
{if !$can_move}
<p class="alert alert-warning">
{l s='If you want to order/move the following data, please select a shop from the shop list.' d='Admin.Design.Notification'}
</p>
{/if}
<div class="row">
<div class="col-lg-9">
<div class="panel">
<form class="well form-horizontal" id="position_filer">
<div class="row">
<div class="form-group col-lg-6 col-sm-12">
<label class="control-label col-lg-4" style="text-align: left">{l s='Show' d='Admin.Actions'}</label>
<div class="col-lg-7">
<select id="show_modules" class="filter" style="width: 100%;">
<option value="all">{l s='All modules' d='Admin.Design.Feature'}&nbsp;</option>
{foreach $modules as $module}
<option value="{$module->id|intval}"{if $display_key == $module->id} selected="selected"{/if}>{$module->displayName|escape:'html':'UTF-8'}</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group col-lg-6 col-sm-12">
<label class="control-label col-lg-offset-1 col-lg-4" style="text-align: left">{l s='Search for a hook' d='Admin.Design.Feature'}</label>
<div class="col-lg-7">
<div class="input-group">
<div class="input-group-addon"><i class="icon icon-search"></i></div>
<input type="text" class="form-control" id="hook_search" name="hook_search" placeholder="">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-12">
<p class="checkbox">
<label class="control-label" for="hook_position">
<input type="checkbox" id="hook_position"/>
{l s='Display non-positionable hooks' d='Admin.Design.Feature'}
</label>
</p>
</div>
</div>
</form>
<div id="modulePosition">
<form method="post" action="{$url_submit|escape:'html':'UTF-8'}" >
{foreach $hooks as $hook}
<section class="hook_panel {if $hook['position'] == 0}hook_position{/if}" {if $hook['position'] == 0}style="display:none;"{/if}>
<a name="{$hook['name']}"></a>
<header class="hook_panel_header">
<span class="hook_name">{$hook['name']}</span>
<!-- <span class="hook_title">{$hook['title']}</span> -->
<span class="badge pull-right">
{if $hook['module_count'] && $can_move}
<input type="checkbox" id="Ghook{$hook['id_hook']}" onclick="hookCheckboxes({$hook['id_hook']}, 0, this)"/>
{/if}
{$hook['module_count']} {if $hook['module_count'] > 1}{l s='Modules' d='Admin.Global'}{else}{l s='Module' d='Admin.Global'}{/if}
</span>
{if !empty($hook['description'])}
<div class="hook_description">{$hook['description']}</div>
{/if}
</header>
{if $hook['module_count']}
<section class="module_list">
<ul class="list-unstyled{if $hook['modules']|count > 1} sortable{/if}">
{foreach $hook['modules'] as $position => $module}
{if isset($module['instance'])}
<li id="{$hook['id_hook']|intval}_{$module['instance']->id|intval}" class="module_position_{$module['instance']->id|intval} module_list_item{if $can_move && $hook['module_count'] >= 2} draggable{/if}">
<div class="module_col_select">
<input type="checkbox" id="mod{$hook['id_hook']|intval}_{$module['instance']->id|intval}" class="modules-position-checkbox hook{$hook['id_hook']}" onclick="hookCheckboxes({$hook['id_hook']}, 1, this)" name="unhooks[]" value="{$hook['id_hook']}_{$module['instance']->id}"/>
</div>
{if !$display_key}
<div class="module_col_position{if $can_move && $hook['module_count'] >= 2} dragHandle{/if}" id="td_{$hook['id_hook']|intval}_{$module['instance']->id}">
<span class="positions">{$module@iteration}</span>
{if $can_move}
<div class="btn-group-vertical">
<a class="btn btn-default btn-xs" href="{$current|escape:'html':'UTF-8'}&amp;id_module={$module['instance']->id|intval}&amp;id_hook={$hook['id_hook']|intval}&amp;direction=0&amp;token={$token|escape:'html':'UTF-8'}&amp;changePosition#{$hook['name']}">
<i class="icon-chevron-up"></i>
</a>
<a class="btn btn-default btn-xs" href="{$current|escape:'html':'UTF-8'}&amp;id_module={$module['instance']->id|intval}&amp;id_hook={$hook['id_hook']|intval}&amp;direction=1&amp;token={$token|escape:'html':'UTF-8'}&amp;changePosition#{$hook['name']}">
<i class="icon-chevron-down"></i>
</a>
</div>
{/if}
</div>
{/if}
<div class="module_col_icon">
<img width="57" src="../modules/{$module['instance']->name}/logo.png" alt="{$module['instance']->name|stripslashes}" />
</div>
<div class="module_col_infos">
<span class="module_name">
{$module['instance']->displayName|stripslashes} {if $module['instance']->version}
<small class="text-muted">&nbsp;-&nbsp;v{if $module['instance']->version|intval == $module['instance']->version}{sprintf('%.1f', $module['instance']->version)}{else}{$module['instance']->version|floatval}{/if}</small>{/if}
</span>
<div class="module_description">{$module['instance']->description}</div>
</div>
<div class="module_col_actions">
<!-- <div class="lab_modules_positions" for="mod{$hook['id_hook']}_{$module['instance']->id}"></div> -->
<div class="btn-group">
<a class="btn btn-default" href="{$current|escape:'html':'UTF-8'}&amp;id_module={$module['instance']->id|intval}&amp;id_hook={$hook['id_hook']}&amp;editGraft{if $display_key}&amp;show_modules={$display_key}{/if}&amp;token={$token|escape:'html':'UTF-8'}">
<i class="icon-pencil"></i>
{l s='Edit' d='Admin.Actions'}
</a>
<a class="btn btn-default dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>&nbsp;
</a>
<ul class="dropdown-menu">
<li>
<a href="{$current|escape:'html':'UTF-8'}&amp;id_module={$module['instance']->id|intval}&amp;id_hook={$hook['id_hook']}&amp;deleteGraft{if $display_key}&amp;show_modules={$display_key}{/if}&amp;token={$token|escape:'html':'UTF-8'}">
<i class="icon-minus-sign-alt"></i>
{l s='Unhook' d='Admin.Design.Feature'}
</a>
</li>
</ul>
</div>
</div>
</li>
{/if}
{/foreach}
</ul>
</section>
{else}
<!-- <p>{l s='No module was found for this hook.'}</p> -->
{/if}
</section>
{/foreach}
<div id="unhook_button_position_bottom">
<button type="submit" class="btn btn-default" name="unhookform">
<i class="icon-minus-sign-alt"></i>
{l s='Unhook the selection' d='Admin.Design.Feature'}
</button>
</div>
</form>
</div>
</div>
</div>
<div class="col-lg-3">
<div class="panel" id="modules-position-selection-panel">
<h3><i class="icon-check"></i> {l s='Selection' d='Admin.Global'}</h3>
<p>
<span id="modules-position-single-selection">{l s='1 module selected' d='Admin.Design.Feature'}</span>
<span id="modules-position-multiple-selection">
<span id="modules-position-selection-count"></span> {l s='modules selected' d='Admin.Design.Feature'}
</span>
</p>
<div class="text-center">
<button class="btn btn-default"><i class="icon-remove"></i> {l s='Unhook the selection' d='Admin.Design.Feature'}</button>
</div>
</div>
</div>
</div>
<script type="text/javascript">
$('.sortable').sortable({
forcePlaceholderSize: true
}).bind('sortupdate', function(e, ui) {
var ids = ui.item.attr('id').split('_');
var way = (ui.start_index < ui.end_index)? 1 : 0;
var data = ids[0]+'[]=';
$.each(e.target.children, function(index, element) {
data += '&'+ids[0]+'[]='+$(element).attr('id');
});
$.ajax({
type: 'POST',
headers: { "cache-control": "no-cache" },
async: false,
url: currentIndex + '&token=' + token + '&' + 'rand=' + new Date().getTime(),
data: data + '&action=updatePositions&id_hook='+ids[0]+'&id_module='+ids[1]+'&way='+way+'&ajax=1' ,
success: function(data) {
start = 0;
$.each(e.target.children, function(index, element) {
$(element).find('.positions').html(++start);
});
showSuccessMessage(update_success_msg);
}
});
});
</script>