first commit

This commit is contained in:
2024-10-25 14:16:28 +02:00
commit 925276dbb2
33795 changed files with 4780077 additions and 0 deletions

View File

@@ -0,0 +1,6 @@
{if $map_button && (!isset($input.is_ambiguous_input) || !$input.is_ambiguous_input)}
<button class="btn btn-default xallegro-fieldMap" data-id="{$input.map_id}" {if !$form_id}disabled="disabled"{/if} title="{$input.map_count_title}">
<i class="icon-asterisk"></i>&nbsp;{l s='Mapuj pole' mod='x13allegro'}
<span class="badge badge-info">{if $input.map_count > 0}{$input.map_count}{/if}</span>
</button>
{/if}

View File

@@ -0,0 +1,5 @@
{if $input.restrictions.string_length}
<p class="help-block category-field-text-counter {if isset($iterator) && $iterator == 1 && empty($fields_value[$input.name])}hidefix{elseif empty($fields_value[$input.name])}hide{/if}">
<span class="counter">{$fields_value[$input.name]|count_characters:true}</span>/{$input.restrictions.string_length}
</p>
{/if}

View File

@@ -0,0 +1,27 @@
{assign var='value_text' value=$fields_value[$input.name]}
{if isset($input.prefix) || isset($input.suffix)}
<div class="input-group{if isset($input.class)} {$input.class}{/if}">
{/if}
{if isset($input.prefix)}
<span class="input-group-addon">
{$input.prefix}
</span>
{/if}
<input type="text"
name="{$input.name}"
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
class="{if isset($input.class)}{$input.class}{/if}"
value="{if isset($input.string_format) && $input.string_format}{$value_text|default|string_format:$input.string_format|escape:'html':'UTF-8'}{else}{$value_text|default|escape:'html':'UTF-8'}{/if}"
data-id="{$input.map_id}"
{if isset($input.is_ambiguous_input) && $input.is_ambiguous_input}data-ambiguous-input="{$input.map_id}"{/if}
{if isset($input.readonly) && $input.readonly}readonly="readonly"{/if}
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if}>
{if isset($input.suffix)}
<span class="input-group-addon">
{$input.suffix}
</span>
{/if}
{if isset($input.prefix) || isset($input.suffix)}
</div>
{/if}

View File

@@ -0,0 +1,88 @@
{extends file="helpers/form/form.tpl"}
{block name="input"}
{if $input.type == 'checkbox'}
<div class="x13allegro-list-checkbox" data-id="{$input.map_id}">
{foreach $input.values.query as $value}
<div class="checkbox x13allegro-checkbox">
{strip}
<label for="{$input.name}[{$value[$input.values.id]}]">
<input type="checkbox"
name="{$input.name}[{$value[$input.values.id]}]"
id="{$input.name}[{$value[$input.values.id]}]"
class="{if isset($input.class)}{$input.class}{/if}"
data-id="{$input.map_id}"
data-value="{$value[$input.values.id]}"
{if isset($value.val)}value="{$value.val|escape:'html':'UTF-8'}"{/if}
{if isset($fields_value[$input.name][$value[$input.values.id]])}checked="checked"{/if}>
<span class="checkmark"></span>
{$value[$input.values.name]}
</label>
{/strip}
</div>
{/foreach}
</div>
{include './category-parameters-map-button.tpl'}
{elseif $input.type == 'select'}
<select name="{$input.name}"
id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}"
class="{if isset($input.class)}{$input.class}{/if}"
data-id="{$input.map_id}"
data-ambiguous-value="{$input.ambiguous_value}"
{if isset($input.disabled) && $input.disabled}disabled="disabled"{/if}>
{foreach $input.options.query as $option}
<option value="{$option[$input.options.id]}"
{*data-value="{$option[$input.options.id]}"*}
{if $fields_value[$input.name] == $option[$input.options.id]}selected="selected"{/if}>
{$option[$input.options.name]}
</option>
{/foreach}
</select>
{include './category-parameters-map-button.tpl'}
{elseif $input.type == 'text'}
{assign var='baseInputId' value=$input.id}
{assign var='baseInputName' value=$input.name}
{if $input.restrictions.range}
<div class="range-values-list" data-id="{$input.map_id}">
{$input.id = "{$baseInputId}_0"}
{$input.name = "{$baseInputName}[0]"}
{include './category-parameters-text-input.tpl'}
<div class="allegro-feature-inline"><span style="line-height: 2;padding: 0 8px;">_</span></div>
{$input.id = "{$baseInputId}_1"}
{$input.name = "{$baseInputName}[1]"}
{include './category-parameters-text-input.tpl'}
</div>
{include './category-parameters-map-button.tpl'}
{elseif $input.restrictions.number_of_values > 1}
{assign var='inputShownNb' value=$input.restrictions.number_of_values}
<div class="multiple-values-list" data-id="{$input.map_id}">
{for $iterator = 1 to $input.restrictions.number_of_values}
{if !empty($fields_value[$input.name])}
{$inputShownNb = $inputShownNb -1}
{/if}
{$input.id = "{$baseInputId}_{$iterator-1}"}
{$input.name = "{$baseInputName}[{$iterator-1}]"}
<div class="multiple-values-group {if empty($fields_value[$input.name]) && $iterator > 1}hide{/if}">
{include './category-parameters-text-input.tpl'}
{include './category-parameters-text-counter.tpl'}
<a href="#" class="multiple-values-delete" style="display: none;"><i class="icon-times"></i></a>
</div>
{/for}
</div>
{include './category-parameters-map-button.tpl'}
<a href="#" class="multiple-values-show" {if $inputShownNb <= 0}style="display: none;"{/if}>{l s='Dodaj kolejną wartość' mod='x13allegro'}</a>
{else}
{include './category-parameters-text-input.tpl'}
{include './category-parameters-map-button.tpl'}
{include './category-parameters-text-counter.tpl'}
{/if}
{else}
{$smarty.block.parent}
{include './category-parameters-map-button.tpl'}
{/if}
{/block}

View File

@@ -0,0 +1,11 @@
<?php
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,11 @@
<?php
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,41 @@
{if $map.parameter_input.type == 'text'}
{if isset($map.parameter_input.maxchar) || isset($map.parameter_input.prefix) || isset($map.parameter_input.suffix)}
<div class="input-group{if isset($map.parameter_input.class)} {$map.parameter_input.class}{/if}">
{/if}
{if isset($map.parameter_input.prefix)}
<span class="input-group-addon">{$map.parameter_input.prefix}</span>
{/if}
<input type="text"
id="{$inputId}"
name="{$inputName}"
class="{if isset($map.parameter_input.class)}{$map.parameter_input.class}{/if}"
value="{$inputValue}"
{if isset($map.parameter_input.size)} size="{$map.parameter_input.size}"{/if}
{if isset($map.parameter_input.maxchar) && $map.parameter_input.maxchar} data-maxchar="{$map.parameter_input.maxchar|intval}"{/if}
{if isset($map.parameter_input.maxlength) && $map.parameter_input.maxlength} maxlength="{$map.parameter_input.maxlength|intval}"{/if}
{if isset($map.parameter_input.readonly) && $map.parameter_input.readonly} readonly="readonly"{/if}
{if isset($map.parameter_input.disabled) && $map.parameter_input.disabled} disabled="disabled"{/if}
{if isset($map.parameter_input.autocomplete) && !$map.parameter_input.autocomplete} autocomplete="off"{/if}
{if isset($map.parameter_input.placeholder) && $map.parameter_input.placeholder} placeholder="{$map.parameter_input.placeholder}"{/if} />
{if isset($map.parameter_input.suffix)}
<span class="input-group-addon">{$map.parameter_input.suffix}</span>
{/if}
{if isset($map.parameter_input.maxchar) || isset($map.parameter_input.prefix) || isset($map.parameter_input.suffix)}
</div>
{/if}
{elseif $map.parameter_input.type == 'select'}
<select name="{$map.parameter_input.name}"
class="{if isset($map.parameter_input.class)}{$map.parameter_input.class}{/if} fixed-width-xl field-map-default"
id="{if isset($map.parameter_input.id)}{$map.parameter_input.id}{else}{$map.parameter_input.name}{/if}"
{if isset($map.parameter_input.disabled) && $map.parameter_input.disabled} disabled="disabled"{/if}>
{foreach $map.parameter_input.options.query as $option}
<option value="{$option[$map.parameter_input.options.id]}"
{if $option[$map.parameter_input.options.id] == $inputValue}selected="selected"{/if}
>{$option[$map.parameter_input.options.name]}</option>
{/foreach}
</select>
{/if}

View File

@@ -0,0 +1,91 @@
<option value="">--</option>
{if $map.parameter_input.type != 'select' && $map.parameter_input.type != 'checkbox'}
<optgroup label="{l s='Wartości produktu' mod='x13allegro'}">
<option value="product_reference" {if $parameter_map_value == 'product_reference'}selected="selected"{/if}>{l s='Kod referencyjny (indeks)' mod='x13allegro'}</option>
<option value="product_ean" {if $parameter_map_value == 'product_ean'}selected="selected"{/if}>{l s='Kod EAN13' mod='x13allegro'}</option>
<option value="product_name" {if $parameter_map_value == 'product_name'}selected="selected"{/if}>{l s='Nazwa produktu' mod='x13allegro'}</option>
{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<option value="product_isbn" {if $parameter_map_value == 'product_isbn'}selected="selected"{/if}>{l s='Kod ISBN' mod='x13allegro'}</option>{/if}
<option value="product_weight" {if $parameter_map_value == 'product_weight'}selected="selected"{/if}>{l s='Waga opakowania' mod='x13allegro'}</option>
<option value="product_manufacturer" {if $parameter_map_value == 'product_manufacturer'}selected="selected"{/if}>{l s='Producent' mod='x13allegro'}</option>
</optgroup>
{/if}
{if $map.parameter_input.type == 'select' && $map.parameter_input.label == 'Stan'}
<optgroup label="{l s='Wartości produktu' mod='x13allegro'}">
<option value="product_condition_new" {if $parameter_map_value == 'product_condition_new'}selected="selected"{/if}>
{l s='Stan produktu: Nowy' mod='x13allegro'}
</option>
<option value="product_condition_used" {if $parameter_map_value == 'product_condition_used'}selected="selected"{/if}>
{l s='Stan produktu: Używany' mod='x13allegro'}
</option>
<option value="product_condition_refurbished" {if $parameter_map_value == 'product_condition_refurbished'}selected="selected"{/if}>
{l s='Stan produktu: Odnowiony' mod='x13allegro'}
</option>
</optgroup>
{/if}
<optgroup label="{l s='Producenci' mod='x13allegro'}">
{foreach $map.manufacturers as $manufacturer}
{capture name="manufacturer_id"}manufacturer_{$manufacturer.id_manufacturer}{/capture}
{if $preload && $parameter_map_value == $smarty.capture.manufacturer_id}
<option value="{$smarty.capture.manufacturer_id}" selected="selected">{$manufacturer.name}</option>
{elseif !$preload}
<option value="{$smarty.capture.manufacturer_id}">{$manufacturer.name}</option>
{/if}
{/foreach}
</optgroup>
{if !empty($map.attributes) || !empty($map.attributes_groups)}
<optgroup label="{l s='Atrybuty' mod='x13allegro'}">
{if $map.parameter_input.type != 'select' && $map.parameter_input.type != 'checkbox' && !empty($map.attributes_groups)}
{foreach $map.attributes_groups as $attribute_group}
{capture name="attribute_group_id"}attribute_group_{$attribute_group.id_attribute_group}{/capture}
{if $preload && $parameter_map_value == $smarty.capture.attribute_group_id}
<option value="attribute_group_{$attribute_group.id_attribute_group}" selected="selected">{$attribute_group.name}</option>
{elseif !$preload}
<option value="attribute_group_{$attribute_group.id_attribute_group}">{$attribute_group.name}</option>
{/if}
{/foreach}
{/if}
{if !empty($map.attributes)}
{foreach $map.attributes as $attribute}
{capture name="attribute_id"}attribute_{$attribute.id_attribute}{/capture}
{if $preload && $parameter_map_value == $smarty.capture.attribute_id}
<option value="attribute_{$attribute.id_attribute}" selected="selected">{$attribute.public_name}: {$attribute.name}</option>
{elseif !$preload}
<option value="attribute_{$attribute.id_attribute}">{$attribute.public_name}: {$attribute.name}</option>
{/if}
{/foreach}
{/if}
</optgroup>
{/if}
{if !empty($map.features) || !empty($map.features_values)}
<optgroup label="{l s='Cechy' mod='x13allegro'}">
{if $map.parameter_input.type != 'select' && $map.parameter_input.type != 'checkbox' && !empty($map.features)}
{foreach $map.features as $feature}
{capture name="feature_id"}feature_{$feature.id_feature}{/capture}
{if $preload && $parameter_map_value == $smarty.capture.feature_id}
<option value="feature_{$feature.id_feature}" selected="selected">{$feature.name}</option>
{elseif !$preload}
<option value="feature_{$feature.id_feature}">{$feature.name}</option>
{/if}
{/foreach}
{/if}
{if !empty($map.features_values)}
{foreach $map.features_values as $feature_value}
{capture name="feature_value_id"}feature_value_{$feature_value.id_feature_value}{/capture}
{if $preload && $parameter_map_value == $smarty.capture.feature_value_id}
<option value="feature_value_{$feature_value.id_feature_value}" selected="selected">{$feature_value.name}</option>
{elseif !$preload}
<option value="feature_value_{$feature_value.id_feature_value}">{$feature_value.name}</option>
{/if}
{/foreach}
{/if}
</optgroup>
{/if}

View File

@@ -0,0 +1,11 @@
<tr>
<td>{$parameterName}</td>
<td>
<div class="fields-map-container">
<select id="{$inputId}" class="fields-map-select" name="{$inputName}">
{include file="./parameters-map-select.tpl" parameter_map_value=$inputValue preload=true}
</select>
<div class="field-map-loader"><div></div><div></div><div></div></div>
</div>
</td>
</tr>

View File

@@ -0,0 +1,105 @@
<form id="content" class="bootstrap xallegro-map-form" action="" method="post">
<div class="row form-horizontal">
<div class="panel col-lg-12">
<fieldset>
<div class="panel-heading">{l s='Mapowanie parametru' mod='x13allegro'}: "{$map.parameter.name}"</div>
{if isset($map.parameter_input) && $map.parameter_input.type != 'checkbox'}
<div class="form-wrapper">
<div class="form-group">
<label class="control-label col-lg-4">{$map.parameter_input.label}</label>
<div class="col-lg-8">
{if $map.parameter_input.restrictions.number_of_values > 1 || $map.parameter_input.restrictions.range}
{assign var='iteratorMax' value=$map.parameter_input.restrictions.number_of_values}
{if $map.parameter_input.restrictions.range}{assign var='iteratorMax' value=2}{/if}
{for $iterator = 1 to $iteratorMax}
{include './parameters-map-default.tpl'
inputId="{$map.parameter_input.id}_{$iterator-1}"
inputName="{$map.parameter_input.name}[{$iterator-1}]"
inputValue=$map.parameter_value[$iterator-1]}
{if $map.parameter_input.restrictions.range && $iterator == 1}
<div class="allegro-feature-inline"><span style="font-size: 16px; padding: 0 5px;">-</span></div>
{/if}
{/for}
{else}
{include './parameters-map-default.tpl'
inputId="{$map.parameter_input.id}"
inputName="{$map.parameter_input.name}"
inputValue=$map.parameter_value}
{/if}
<p class="help-block pull-left">{l s='Ustaw domyślną wartość parametru' mod='x13allegro'}</p>
</div>
</div>
</div>
{/if}
<table id="fields_map" class="table shipments-table" cellspacing="0" cellpadding="0" style="width: 100%">
<thead>
<tr>
<th width="40%"><strong>{l s='Wartość Allegro' mod='x13allegro'}</strong></th>
<th width="60%"><strong>{l s='Atrybut/Cecha/Producent' mod='x13allegro'}</strong></th>
</tr>
</thead>
<tbody>
{* checkbox, select *}
{if isset($map.parameter_map) && count($map.parameter_map) > 1}
{foreach $map.parameter_map as $parameter_map}
{include './parameters-map-table-line.tpl'
parameterName=$parameter_map.name
inputId="fields_map_{$map.parameter.id}_{$parameter_map.id}"
inputName="fields_map[{$map.parameter.id}][{$parameter_map.id}]"
inputValue=$parameter_map.value}
{/foreach}
{else} {* text *}
{if $map.parameter_input.restrictions.number_of_values > 1 || $map.parameter_input.restrictions.range}
{assign var='iteratorMax' value=$map.parameter_input.restrictions.number_of_values}
{if $map.parameter_input.restrictions.range}{assign var='iteratorMax' value=2}{/if}
{for $iterator = 1 to $iteratorMax}
{assign var='inputValue' value=null}
{assign var='parameterNameAdditional' value=''}
{if isset($map.parameter_map.value[$iterator-1])}{assign var='inputValue' value=$map.parameter_map.value[$iterator-1]}{/if}
{if $map.parameter_input.restrictions.range}
{if $iterator == 1}
{assign var='parameterNameAdditional' value='- od'}
{else}
{assign var='parameterNameAdditional' value='- do'}
{/if}
{/if}
{include './parameters-map-table-line.tpl'
parameterName="{$map.parameter.name} $parameterNameAdditional"
inputId="fields_map_{$map.parameter.id}_{$iterator-1}"
inputName="fields_map[{$map.parameter.id}][{$iterator-1}]"
inputValue=$inputValue}
{/for}
{else}
{for $iterator = 1 to $map.parameter_input.restrictions.number_of_values}
{include './parameters-map-table-line.tpl'
parameterName=$map.parameter.name
inputId="fields_map_{$map.parameter.id}"
inputName="fields_map[{$map.parameter.id}]"
inputValue=$map.parameter_map.value}
{/for}
{/if}
{/if}
</tbody>
</table>
<div id="fields_map_cache" style="display: none">
{include file="./parameters-map-select.tpl" parameter_map_value=0 preload=false}
</div>
<div class="panel-footer">
<a href="#" onclick="jQuery.fancybox.close()" class="btn btn-default"><i class="process-icon-cancel"></i> {l s='Cancel'}</a>
<button type="submit" name="xAllegroSubmitCategoryMap" class="btn btn-default pull-right"><i class="process-icon-save"></i> {l s='Save'}</button>
</div>
</fieldset>
</div>
</div>
</form>

View File

@@ -0,0 +1,116 @@
<script type="text/javascript">
if (typeof XAllegroCustomPrices === 'undefined') {
var XAllegroCustomPrices = new X13Allegro();
XAllegroCustomPrices.ajaxUrl = "{$custom_prices_ajax_url}";
XAllegroCustomPrices.ajaxToken = "{$custom_prices_token}";
XAllegroCustomPrices.presta17 = {$custom_prices_is_17|intval};
XAllegroCustomPrices.customPricesInit({$productId|intval});
}
var XAllegroCustomPricesConfirmChangePrice = "{l s='Czy na pewno chcesz zmienić cenę kombinacji? Usunie to wpływ na główną cenę produktu przy zapisie' js=1}";
var XAllegroCustomPricesConfirmChangePriceFlat = "{l s='Czy na pewno chcesz zmienić cenę podstawową produktu? Usunie to wpływ na kombinacje produktu przy zapisie' js=1}";
var XAllegroCustomPricesConfirmChangeAccount = "{l s='Zmiana konta spowoduje anulowanie niezapisanych zmian cen, kontynuować?' js=1}";
var XAllegroCustomPricesConfirmDelete = "{l s='Czy na pewno usunąć wszystkie ceny dedykowane dla Allegro tego produktu? Ta operacja jest nieodwracalna.' js=1}";
var XAllegroCustomPricesAccountId = {$current_account};
</script>
<div class="form-group clearfix">
<input type="hidden" name="xallegro_custom_price_product" value="{$productId|intval}">
<label for="xallegro_custom_price_account" class="control-label form-control-label col-lg-3">
<span>{l s='Konto Allegro' mod='x13allegro'}</span>
</label>
<div class="col-lg-3">
<select class="custom-select" name="xallegro_custom_price_account" id="xallegro_custom_price_account">
<option value="0" {if $current_account == 0}selected="selected"{/if}>{l s='-- wszystkie konta --' mod='x13allegro'}</option>
{foreach $accounts as $account}
<option value="{$account->id}" {if $current_account == $account->id}selected="selected"{/if}>
{$account->username} {if $account->sandbox}(sandbox){/if}
</option>
{/foreach}
</select>
</div>
</div>
<div class="form-group clearfix">
<div class="col-lg-7">
<table class="table">
<thead>
<tr>
<th scope="col"></th>
<th scope="col" style="width: 100px;">{l s='Cena/wpływ' mod='x13allegro'}</th>
<th scope="col" style="width: 225px;">{l s='Typ modyfikacji' mod='x13allegro'}</th>
</tr>
</thead>
<tbody>
{foreach $custom_prices as $row}
<tr>
<td>
{if !$row.id_product_attribute}
<a
title="{l s='Zmiana ceny dla produktu głównego spowodouje narzucenie wpływu na wszystkie jego kombinacji (jeśli istnieją)' mod='x13allegro'}"
class="xallegro-custom-price-helper">
{if $custom_prices_is_17}
<i class="material-icons">
help_outline
</i>
{else}
<i class="icon icon-question-circle" aria-hidden="true"></i>
{/if}
</a>
{/if}
{$row.label}
{if !$row.id_product_attribute}
(produkt główny)
{/if}
</td>
<td>
<input
{if $row.disabled}readonly{/if}
type="text"
class="form-control width-xs{if $row.id_product_attribute} with-combinations{else} wo-combinations{/if}"
placeholder="0.00"
name="custom_price[{$row.id_product_attribute}][value]" value="{$row.value}">
</td>
<td>
<select
{if $row.disabled}readonly{/if}
name="custom_price[{$row.id_product_attribute}][method]"
class="form-control{if $row.id_product_attribute} with-combinations{else} wo-combinations{/if}">
<option
{if $row.method == $method_price}selected{/if}
value="{$method_price}">
{l s='Cena końcowa' mod='x13allegro'}
</option>
<option
{if $row.method == $method_amount}selected{/if}
value="{$method_amount}">
{l s='Wpływ na cenę (wartość)' mod='x13allegro'}
</option>
<option
{if $row.method == $method_percentage}selected{/if}
value="{$method_percentage}">
{l s='Wpływ na cenę (procent)' mod='x13allegro'}
</option>
</select>
</td>
</tr>
{/foreach}
</tbody>
</table>
<p class="text-muted">
<a href="#" id="custom_prices_delete">
{l s='Usuń wszystkie ceny dedykowane dla Allegro tego produktu' mod='x13allegro'}
</a>
</p>
</div>
</div>
<style>
.xallegro-custom-price-helper i {
background: #25b9d7;
color: white;
border-radius: 50%;
margin-right: 3px; margin-top: -2px;
font-size: 15px;
cursor: pointer;
}
</style>

View File

@@ -0,0 +1,36 @@
<?php
/*
* 2007-2015 PrestaShop
*
* 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.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,36 @@
<?php
/*
* 2007-2015 PrestaShop
*
* 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.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/osl-3.0.php
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2015 PrestaShop SA
* @version Release: $Revision$
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
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,17 @@
<div class="form-group {if isset($additionDescriptionHidden) && $additionDescriptionHidden}hidden{/if}" {if isset($additionDescriptionHidden) && $additionDescriptionHidden}style="display: none;"{/if}>
<div class="xallegro-description-additional-wrapper">
<label for="xallegro_description_additional_{$additionDescriptionKey}">
<a class="btn xallegro-description-additional-move">{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<i class="material-icons">drag_indicator</i>{else}<i class="icon-bars"></i>{/if}</a>
<span class="xallegro-description-additional-tag">{literal}{{/literal}product_description_additional_{$additionDescriptionKey + 1}{literal}}{/literal}</span>
<a class="btn xallegro-description-additional-delete">{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<i class="material-icons">delete</i>{else}<i class="icon-trash"></i>{/if}</a>
</label>
<div class="xallegro-description-additional-inner">
<textarea
id="xallegro_description_additional_{$additionDescriptionKey}"
name="xallegro_description_additional[]"
class="textarea-autosize xallegro_description_additional_{$additionDescriptionKey}" style="width: 100%;"
>{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}{$additionDescriptionValue nofilter}{else}{$additionDescriptionValue}{/if}</textarea>
</div>
</div>
</div>

View File

@@ -0,0 +1,16 @@
<div class="form-group clearfix">
<div class="xallegro-image-additional-wrapper clearfix">
<img src="{$additionalImage}" alt="" class="imgm img-thumbnail">
<span class="img-description">
<strong>{l s='Dodatkowe zdjęcie' mod='x13allegro'} {$additionalImageKey}</strong><br>
{l s='wymiary' mod='x13allegro'}: {$additionalImageWidth}x{$additionalImageHeight}<br>
{l s='rozmiar' mod='x13allegro'}: {$additionalImageSize} MB
</span>
<a class="btn xallegro-image-additional-delete" data-name="{$additionalImageName}">
{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<i class="material-icons">delete</i>{else}<i class="icon-trash"></i>{/if}
</a>
<a class="btn xallegro-image-additional-update" data-name="{$additionalImageName}">
{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<i class="material-icons">edit</i>{else}<i class="icon-edit"></i>{/if}
</a>
</div>
</div>

View File

@@ -0,0 +1,66 @@
<div class="form-group clearfix">
<label for="xallegro_sync_price" class="control-label form-control-label col-lg-3">
<span>{l s='Aktualizuj cenę na Allegro' mod='x13allegro'}</span>
</label>
<div class="col-lg-3">
<select class="custom-select" name="xallegro_sync_price" id="xallegro_sync_price">
<option value="" {if $syncPrice === null}selected="selected"{/if}>{l s='użyj ustawienia z wszystkich kont (jeśli istnieje) lub globalnej opcji konta' mod='x13allegro'}</option>
{foreach $syncPriceList as $key => $value}
<option value="{$value.id}" {if $syncPrice !== null && $syncPrice == $value.id}selected="selected"{/if}>{$value.name}</option>
{/foreach}
</select>
<div class="help-block form-text">
{l s='Domyśle ustawienie dla wybranego konta' mod='x13allegro'}: {$syncPriceList[$syncPriceDefault]['name']}
</div>
</div>
</div>
<div class="form-group clearfix">
<div class="col-lg-7">
<table class="table">
<thead>
<tr>
<th scope="col">{l s='Ceny indywidualne' mod='x13allegro'}</th>
<th scope="col" style="width: 100px;">{l s='Cena/wpływ' mod='x13allegro'}</th>
<th scope="col" style="width: 225px;">{l s='Typ modyfikacji' mod='x13allegro'}</th>
</tr>
</thead>
<tbody>
{foreach $prices as $row}
<tr>
<td>
{if !$row.id_product_attribute}
<a title="{l s='Zmiana ceny dla produktu głównego spowoduje narzucenie wpływu na wszystkie jego kombinacje (jeśli istnieją)' mod='x13allegro'}" class="xallegro-custom-price-helper">
{if version_compare($smarty.const._PS_VERSION_, '1.7.0.0', '>=')}<i class="material-icons">help_outline</i>{else}<i class="icon icon-question-circle" aria-hidden="true"></i>{/if}
</a>
{/if}
{$row.label}
{if !$row.id_product_attribute}
(produkt główny)
{/if}
</td>
<td>
<input {if $row.disabled}readonly{/if} type="text" class="form-control width-xs allegro-price-input{if $row.id_product_attribute} with-combinations{else} wo-combinations{/if}" name="xallegro_custom_price[{$row.id_product_attribute}][value]" value="{$row.value}" data-cast="float" data-cast-unsigned="{if $row.method == $impactMethodPrice}false{else}true{/if}">
</td>
<td>
<select name="xallegro_custom_price[{$row.id_product_attribute}][method]" class="form-control allegro-price-method{if $row.id_product_attribute} with-combinations{else} wo-combinations{/if} {if $row.disabled}readonly{/if}">
<option {if $row.method == $impactMethodPrice}selected{/if} value="{$impactMethodPrice}">{l s='Cena końcowa' mod='x13allegro'}</option>
<option {if $row.method == $impactMethodAmount}selected{/if} value="{$impactMethodAmount}">{l s='Wpływ na cenę (wartość)' mod='x13allegro'}</option>
<option {if $row.method == $impactMethodPercentage}selected{/if} value="{$impactMethodPercentage}">{l s='Wpływ na cenę (procent)' mod='x13allegro'}</option>
</select>
</td>
</tr>
{/foreach}
</tbody>
</table>
<p class="text-muted">
<button class="btn btn-default" id="xallegro_custom_prices_delete">
{l s='Usuń wszystkie ceny indywidualne dla tego produktu' mod='x13allegro'}
</button>
</p>
</div>
</div>

View File

@@ -0,0 +1,33 @@
<div class="form-group clearfix">
<label for="xallegro_sync_quantity_allegro" class="control-label form-control-label col-lg-3">
<span>{l s='Aktualizuj stany magazynowe w Allegro' mod='x13allegro'}</span>
</label>
<div class="col-lg-3">
<select class="custom-select" name="xallegro_sync_quantity_allegro" id="xallegro_sync_quantity_allegro">
<option value="" {if $syncQuantityAllegro === null}selected="selected"{/if}>{l s='użyj ustawienia z wszystkich kont (jeśli istnieje) lub globalnej opcji konta' mod='x13allegro'}</option>
<option value="1" {if $syncQuantityAllegro !== null && $syncQuantityAllegro == '1'}selected="selected"{/if}>{l s='Tak' mod='x13allegro'}</option>
<option value="0" {if $syncQuantityAllegro !== null && $syncQuantityAllegro == '0'}selected="selected"{/if}>{l s='Nie' mod='x13allegro'}</option>
</select>
<div class="help-block form-text">
{l s='Domyśle ustawienie dla wybranego konta' mod='x13allegro'}: {if $syncQuantityAllegroDefault}{l s='Tak' mod='x13allegro'}{else}{l s='Nie' mod='x13allegro'}{/if}
</div>
</div>
</div>
<div class="form-group clearfix">
<label for="xallegro_auto_renew" class="control-label form-control-label col-lg-3">
<span>{l s='Włącz auto wznawianie ofert' mod='x13allegro'}</span>
</label>
<div class="col-lg-3">
<select class="custom-select" name="xallegro_auto_renew" id="xallegro_auto_renew">
<option value="" {if $autoRenew === null}selected="selected"{/if}>{l s='użyj ustawienia z wszystkich kont (jeśli istnieje) lub globalnej opcji konta' mod='x13allegro'}</option>
<option value="1" {if $autoRenew !== null && $autoRenew == '1'}selected="selected"{/if}>{l s='Tak' mod='x13allegro'}</option>
<option value="0" {if $autoRenew !== null && $autoRenew == '0'}selected="selected"{/if}>{l s='Nie' mod='x13allegro'}</option>
</select>
<div class="help-block form-text">
{l s='Domyśle ustawienie dla wybranego konta' mod='x13allegro'}: {if $autoRenewDefault}{l s='Tak' mod='x13allegro'}{else}{l s='Nie' mod='x13allegro'}{/if}
</div>
</div>
</div>

View File

@@ -0,0 +1,36 @@
<div class="form-group clearfix">
<label for="xallegro_auction_title" class="control-label form-control-label col-lg-3">
<span>{l s='Tytuł oferty' mod='x13allegro'}</span>
</label>
<div class="col-lg-9">
<input id="xallegro_auction_title" type="text" name="xallegro_auction_title" class="form-control" value="{$titlePattern|escape}">
</div>
<div class="col-lg-9 col-lg-offset-3">
<div id="xallegro_title_count" class="help-block form-text" {if $titleCount === false}style="display: none;"{/if}>
<p>{l s='Ilość znaków' mod='x13allegro'}: <strong><span class="xallegro_title_counter">{$titleCount|intval}</span>/{$titleMaxSize|intval}</strong></p>
</div>
<div class="help-block form-text">
{l s='Domyślny tytuł oferty' mod='x13allegro'}: <b>{$titlePatternDefault}</b><br>
</div>
<div class="help-block form-text">
<a href="#" id="xallegro_show_title_pattens">{l s='Pokaż dostępne znaczniki' mod='x13allegro'}</a>
</div>
<div id="xallegro_title_patterns" class="help-block form-text" style="display: none;">
<span class="x13allegro_black" style="color:#222">{l s='{product_id}' mod='x13allegro'}</span> - ID produktu<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_name}' mod='x13allegro'}</span> - Nazwa produktu<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_name_attribute}' mod='x13allegro'}</span> - Nazwa atrybutu<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_short_desc}' mod='x13allegro'}</span> - Krótki opis<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_reference}' mod='x13allegro'}</span> - Kod referencyjny (indeks) produktu<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_ean13}' mod='x13allegro'}</span> - Kod EAN13<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_weight}' mod='x13allegro'}</span> - Waga produktu<br>
<span class="x13allegro_black" style="color:#222">{l s='{product_price}' mod='x13allegro'}</span> - Cena produktu<br>
<span class="x13allegro_black" style="color:#222">{l s='{manufacturer_name}' mod='x13allegro'}</span> - Nazwa producenta<br>
<span class="x13allegro_black" style="color:#222">{l s='{attribute_group_X}' mod='x13allegro'}</span> - Nazwa i wartość grupy atrybutów X (grupa atrybutów musi być przypisana do kombinacji produktu)<br>
<span class="x13allegro_black" style="color:#222">{l s='{attribute_group_value_X}' mod='x13allegro'}</span> - Wartość grupy atrybutów X (grupa atrybutów musi być przypisana do kombinacji produktu)<br>
<span class="x13allegro_black" style="color:#222">{l s='{feature_X}' mod='x13allegro'}</span> - Nazwa i wartość cechy X (cecha musi być przypisana do produktu)<br>
<span class="x13allegro_black" style="color:#222">{l s='{feature_value_X}' mod='x13allegro'}</span> - Wartość cechy X (cecha musi być przypisana do produktu)<br>
</div>
</div>
</div>

View File

@@ -0,0 +1,11 @@
<?php
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,58 @@
<table class="table xallegro-tags-table" data-id="{$user_id}" cellspacing="0" cellpadding="0" style="width: 100%; display: none;">
<thead>
<tr>
<th style="width: 20px;"></th>
<th colspan="2"></th>
</tr>
</thead>
<tbody>
{if isset($tags->tags) && !empty($tags->tags)}
{foreach $tags->tags as $tag}
<tr data-id="{$tag->id}" data-hidden="{$tag->hidden|intval}">
<td><input type="checkbox" name="xallegro_tag[{$user_id}][{$tag->id}]" value="1" class="xallegro-tag-map" {if isset($tag_manager_map[$user_id][$tag->id])}checked="checked"{/if}></td>
<td class="form-inline" style="flex: 1 1 auto;">
<span class="xallegro-tag-view">{$tag->name}</span>
{if $tag_manager_editable}
<a class="btn btn-primary xallegro-tag-save {if $tag_manager_17 && $tag_manager_map_type == 'product'}btn-sm{/if}" title="{l s='Zapisz' mod='x13allegro'}" style="margin-left: 5px; display: none;">
{if $tag_manager_17 && $tag_manager_map_type == 'product'}
<i class="material-icons">save</i>
{elseif version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
<img src="../img/admin/enabled.gif" alt="{l s='Zapisz' mod='x13allegro'}">
{else}
<i class="icon-save"></i>
{/if}
</a>
{/if}
</td>
<td style="text-align: right;">
{if $tag_manager_editable}
<a data-tag-name="{$tag->name}" data-tag-id="{$tag->id}" href="#" class="xallegro-tag-edit btn btn-sm" style="padding: 0;" title="{l s='Edytuj' mod='x13allegro'}">
{if $tag_manager_17 && $tag_manager_map_type == 'product'}
<i class="material-icons">edit</i>
{elseif version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
<img src="../img/admin/edit.gif" alt="{l s='Edytuj' mod='x13allegro'}">
{else}
<i class="icon-edit"></i>
{/if}
</a>&nbsp;&nbsp;
<a href="#" class="xallegro-tag-delete btn btn-sm" style="padding: 0;" title="{l s='Usuń' mod='x13allegro'}">
{if $tag_manager_17 && $tag_manager_map_type == 'product'}
<i class="material-icons">delete</i>
{elseif version_compare($smarty.const._PS_VERSION_, '1.6', '<')}
<img src="../img/admin/delete.gif" alt="{l s='Usuń' mod='x13allegro'}">
{else}
<i class="icon-trash"></i>
{/if}
</a>
{/if}
</td>
</tr>
{/foreach}
{else}
<tr>
<td colspan="3" style="text-align: center;">{l s='Brak tagów' mod='x13allegro'}</td>
</tr>
{/if}
</tbody>
</table>

View File

@@ -0,0 +1,97 @@
{if !empty($tag_manager.users)}
{if $tag_manager_user_change}
<div class="form-group clearfix">
<label for="xallegro_tags_account" class="control-label form-control-label col-lg-3">
<span>{l s='Konto Allegro' mod='x13allegro'}</span>
</label>
<div class="col-lg-3">
<select id="xallegro_tags_account" name="xallegro_tags_account" class="custom-select">
{foreach $tag_manager.users as $user}
<option value="{$user.id}" {if !$user.enabled}disabled="disabled"{/if}>{$user.username}</option>
{/foreach}
</select>
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block form-text">{l s='Tagi ofertowe są dostępne tylko dla kont korzystających z abonamentu Allegro.' mod='x13allegro'}</div>
</div>
</div>
{else}
<input type="hidden" id="xallegro_tags_account" name="xallegro_tags_account" value="{$user_id}">
{/if}
<div class="form-group clearfix">
<label for="" class="control-label form-control-label col-lg-3">
<span>{l s='Tagi' mod='x13allegro'}</span>
</label>
<div class="col-lg-{if $tag_manager_map_type == 'auction'}9{else}5{/if}">
<div class="{if $tag_manager_editable}{/if}">
{foreach $tag_manager.tags as $user_id => $tags}
{include file="./tag-manager-table.tpl"}
{/foreach}
</div>
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block form-text">
{if $tag_manager_map_type == 'product'}
{l s='Aby przypisać tag do produktu zaznacz checkbox i zapisz produkt.' mod='x13allegro'}<br>
{elseif $tag_manager_map_type == 'category'}
{l s='Aby przypisać tag do kategorii zaznacz checkbox i zapisz powiązanie.' mod='x13allegro'}<br>
{elseif $tag_manager_map_type == 'manufacturer'}
{l s='Aby przypisać tag do producenta zaznacz checkbox i zapisz powiązanie.' mod='x13allegro'}<br>
{/if}
{l s='Możesz przypisać maksymalnie %d tagów do jednej oferty.' sprintf=[$tag_manager_auction_limit] mod='x13allegro'}
</div>
</div>
</div>
<div class="form-group clearfix">
<label for="xallegro_tag_new" class="control-label form-control-label col-lg-3">
<span>{l s='Dodaj nowy tag' mod='x13allegro'}</span>
</label>
<div class="col-lg-{if $tag_manager_map_type == 'auction'}9{else}5{/if} form-inline">
<input id="xallegro_tag_new" type="text" name="xallegro_tag_new" class="fixed-width-xxl pull-left form-control" value="" size="{$tag_manager_max_chars}">
<button class="btn btn-default btn-secondary xallegro-tag-new" style="margin-left: 10px;">{if $tag_manager_17 && $tag_manager_map_type == 'product'}<i class="material-icons">add_circle</i>{else}<i class="icon-plus-sign"></i>{/if}&nbsp;{l s='Dodaj' mod='x13allegro'}</button>
</div>
<div class="col-lg-9 col-lg-offset-3">
<div class="help-block form-text">{l s='Maksymalna ilość znaków: %d' sprintf=[$tag_manager_max_chars] mod='x13allegro'}</div>
</div>
</div>
{else}
{l s='Brak zautoryzowanego konta Allegro' mod='x13allegro'}
{/if}
<script type="text/javascript">
if (typeof XAllegroTagManager === 'undefined') {
var XAllegroTagManager = new X13Allegro();
XAllegroTagManager.ajaxUrl = "{$tag_manager_url}";
XAllegroTagManager.ajaxToken = "{$tag_manager_token}";
XAllegroTagManager.presta17 = {$tag_manager_17|intval};
XAllegroTagManager.tagManager(document.getElementById('{$tag_manager_container}'), '{$tag_manager_map_type}', {$tag_manager_auction_limit});
}
else {
XAllegroTagManager.tagManagerRefresh();
}
</script>
<style>
.scroll-tags-table {
position: relative;
height: 300px;
padding: 0;
}
.scroll-tags-table table tbody {
position: absolute;
height: 285px;
width: 100%;
overflow: auto;
}
.scroll-tags-table table tbody tr {
display: flex;
}
</style>

View File

@@ -0,0 +1,11 @@
<?php
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,124 @@
{if isset($files) && $files|count > 0}
{assign var='show_thumbnail' value=false}
{foreach $files as $file}
{if isset($file.image) && $file.type == 'image'}
{assign var='show_thumbnail' value=true}
{/if}
{/foreach}
{if $show_thumbnail}
<div class="form-group clearfix">
<div class="col-lg-12" id="{$id|escape:'html':'UTF-8'}-images-thumbnails">
{foreach $files as $file}
{if isset($file.image) && $file.type == 'image'}
<div>
{$file.image}
{if isset($file.delete_url)}
<span style="display: inline-block; margin-left: 6px;">
{if isset($file.size)}{l s='File size'}: {$file.size} MB<br>{/if}
<a class="xallegro-delete-image btn btn-default btn-outline-secondary{if version_compare($smarty.const._PS_VERSION_, '1.7', '>=')} btn-sm{/if} {if isset($file.delete_class)}{$file.delete_class}{/if}" href="{$file.delete_url}" data-id="{$id|escape:'html':'UTF-8'}" style="margin-top: 6px">
{if version_compare($smarty.const._PS_VERSION_, '1.7', '>=')}<i class="material-icons">delete</i>{else}<i class="icon-trash"></i>{/if} {l s='Delete' d='Admin.Actions'}
</a>
</span>
{/if}
</div>
{/if}
{/foreach}
</div>
</div>
{/if}
{/if}
{if isset($max_files) && $files|count >= $max_files}
<div class="row">
<div class="alert alert-warning">{l s='You have reached the limit (%s) of files to upload, please remove files to continue uploading' sprintf=[$max_files]}</div>
</div>
{else}
<div class="form-group clearfix{if $files|count == 0} hidden{/if}" {if $files|count == 0}style="display:none;" {/if}>
{if isset($title)}
<label class="control-label col-lg-3">{$title|escape:'html':'UTF-8'}</label>
{/if}
<div class="col-sm-6">
<input id="{$id|escape:'html':'UTF-8'}" type="file" name="{$name|escape:'html':'UTF-8'}{if isset ($multiple) && $multiple}[]{/if}"{if isset($multiple) && $multiple} multiple="multiple"{/if} class="hide" />
<div class="dummyfile input-group">
{if version_compare($smarty.const._PS_VERSION_, '1.7', '>=')}
<span class="input-group-text"><i class="material-icons">image</i></span>
{else}
<span class="input-group-addon"><i class="icon-image"></i></span>
{/if}
<input id="{$id|escape:'html':'UTF-8'}-name" class="form-control" type="text" name="{$name|escape:'html':'UTF-8'}" readonly />
<span class="input-group-btn">
<button id="{$id|escape:'html':'UTF-8'}-selectbutton" type="button" name="submitAddAttachments" class="btn btn-default btn-secondary">
{if version_compare($smarty.const._PS_VERSION_, '1.7', '>=')}<i class="material-icons">folder_open</i>{else}<i class="icon-folder-open"></i>{/if} {if isset($multiple) && $multiple}{l s='Add files'}{else}{l s='Add file'}{/if}
</button>
{if (!isset($multiple) || !$multiple) && isset($files) && $files|count == 1 && isset($files[0].download_url)}
<a href="{$files[0].download_url|escape:'html':'UTF-8'}" class="btn btn-default">
<i class="icon-cloud-download"></i>
{if isset($size)}{l s='Download current file (%skb)' sprintf=[$size]}{else}{l s='Download current file'}{/if}
</a>
{/if}
</span>
</div>
</div>
</div>
<script type="text/javascript">
{if isset($multiple) && isset($max_files)}
var {$id|escape:'html':'UTF-8'}_max_files = {$max_files - ($files|count)};
{/if}
$(document).ready(function(){
$('#{$id|escape:'html':'UTF-8'}-selectbutton').click(function(e) {
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
$('#{$id|escape:'html':'UTF-8'}-name').click(function(e) {
$('#{$id|escape:'html':'UTF-8'}').trigger('click');
});
$('#{$id|escape:'html':'UTF-8'}-name').on('dragenter', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#{$id|escape:'html':'UTF-8'}-name').on('dragover', function(e) {
e.stopPropagation();
e.preventDefault();
});
$('#{$id|escape:'html':'UTF-8'}-name').on('drop', function(e) {
e.preventDefault();
var files = e.originalEvent.dataTransfer.files;
$('#{$id|escape:'html':'UTF-8'}')[0].files = files;
$(this).val(files[0].name);
});
$('#{$id|escape:'html':'UTF-8'}').change(function(e) {
if ($(this)[0].files !== undefined)
{
var files = $(this)[0].files;
var name = '';
$.each(files, function(index, value) {
name += value.name+', ';
});
$('#{$id|escape:'html':'UTF-8'}-name').val(name.slice(0, -2));
}
else // Internet Explorer 9 Compatibility
{
var name = $(this).val().split(/[\\/]/);
$('#{$id|escape:'html':'UTF-8'}-name').val(name[name.length-1]);
}
});
if (typeof {$id|escape:'html':'UTF-8'}_max_files !== 'undefined')
{
$('#{$id|escape:'html':'UTF-8'}').closest('form').on('submit', function(e) {
if ($('#{$id|escape:'html':'UTF-8'}')[0].files.length > {$id|escape:'html':'UTF-8'}_max_files) {
e.preventDefault();
alert('{l s='You can upload a maximum of %s files' sprintf=[$max_files]}');
}
});
}
});
</script>
{/if}