first commit
This commit is contained in:
@@ -0,0 +1,158 @@
|
||||
{**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*}
|
||||
|
||||
{extends file="helpers/form/form.tpl"}
|
||||
{block name="script"}
|
||||
var ps_force_friendly_product = false;
|
||||
{/block}
|
||||
{block name="input" prepend}
|
||||
<script type="text/javascript">
|
||||
var PS_ALLOW_ACCENTED_CHARS_URL;
|
||||
{if isset($PS_ALLOW_ACCENTED_CHARS_URL) && $PS_ALLOW_ACCENTED_CHARS_URL}
|
||||
PS_ALLOW_ACCENTED_CHARS_URL = 1;
|
||||
{else}
|
||||
PS_ALLOW_ACCENTED_CHARS_URL = 0;
|
||||
{/if}
|
||||
</script>
|
||||
{/block}
|
||||
|
||||
{block name="field"}
|
||||
{if $input.type == 'file_multiple'}
|
||||
<div class="col-lg-8 {$input.class|escape:'htmlall':'UTF-8'}">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<input id="{$input.name|escape:'htmlall':'UTF-8'}" type="file" data-url="{$gallery_controller_url|escape:'html':'UTF-8'}" multiple="multiple" style="width:0px;height:0px;" />
|
||||
<button class="btn btn-default" data-style="expand-right" data-size="s" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}-add-button">
|
||||
<i class="icon-folder-open"></i> {if isset($multiple) && $multiple}{l s='Add files...' mod='higallery'}{else}{l s='Add file...' mod='higallery'}{/if}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="well" style="display:none">
|
||||
<div id="{$input.name|escape:'htmlall':'UTF-8'}-files-list"></div>
|
||||
<button class="ladda-button btn btn-primary" data-style="expand-right" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}-upload-button" style="display:none;">
|
||||
<span class="ladda-label"><i class="icon-check"></i>{l s='Upload files' mod='higallery'}</span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
function humanizeSize(bytes)
|
||||
{
|
||||
if (typeof bytes !== 'number') {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (bytes >= 1000000000) {
|
||||
return (bytes / 1000000000).toFixed(2) + ' GB';
|
||||
}
|
||||
|
||||
if (bytes >= 1000000) {
|
||||
return (bytes / 1000000).toFixed(2) + ' MB';
|
||||
}
|
||||
|
||||
return (bytes / 1000).toFixed(2) + ' KB';
|
||||
}
|
||||
|
||||
$( document ).ready(function() {
|
||||
{if isset($multiple) && isset($max_files)}
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_max_files = {$max_files - $files|count};
|
||||
{/if}
|
||||
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_upload_button = Ladda.create(document.querySelector('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button'));
|
||||
var {$input.name|escape:'htmlall':'UTF-8'}_total_files = 0;
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}').fileupload({
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
autoUpload: false,
|
||||
singleFileUploads: true,
|
||||
{if isset($post_max_size)}maxFileSize: {$post_max_size},{/if}
|
||||
{if isset($drop_zone)}dropZone: {$drop_zone},{/if}
|
||||
start: function (e) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_upload_button.start();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').unbind('click'); //Important as we bind it for every elements in add function
|
||||
},
|
||||
fail: function (e, data) {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-errors').html(data.errorThrown.message).parent().show();
|
||||
},
|
||||
done: function (e, data) {
|
||||
if (data.result.error) {
|
||||
showErrorMessage(data.result.error);
|
||||
} else {
|
||||
showSuccessMessage('Successful upload');
|
||||
$('.gallery-image-container').remove();
|
||||
$('.gallery_image_form').replaceWith(data.result.content);
|
||||
initSortableItems();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').html('').parent().hide();
|
||||
}
|
||||
},
|
||||
}).on('fileuploadalways', function (e, data) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files--;
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_max_files--;
|
||||
|
||||
if ({$input.name|escape:'htmlall':'UTF-8'}_total_files == 0) {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_upload_button.stop();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').unbind('click');
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().hide();
|
||||
}
|
||||
}).on('fileuploadadd', function(e, data) {
|
||||
data.context = $('<div/>').addClass('form-group').appendTo($('#{$input.name|escape:'htmlall':'UTF-8'}-files-list'));
|
||||
var file_name = $('<span/>').append('<strong>'+data.files[0].name+'</strong> ('+humanizeSize(data.files[0].size)+')').appendTo(data.context);
|
||||
|
||||
var button = $('<button/>').addClass('btn btn-default pull-right').prop('type', 'button').html('<i class="icon-trash"></i> Remove file').appendTo(data.context).on('click', function() {
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files--;
|
||||
data.files = null;
|
||||
|
||||
var total_elements = $(this).parent().siblings('div.form-group').length;
|
||||
$(this).parent().remove();
|
||||
|
||||
if (total_elements == 0) {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').html('').parent().hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().show();
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-upload-button').show().bind('click', function () {
|
||||
if (data.files != null)
|
||||
data.submit();
|
||||
});
|
||||
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files++;
|
||||
}).on('fileuploadprocessalways', function (e, data) {});
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-files-list').parent().hide();
|
||||
{$input.name|escape:'htmlall':'UTF-8'}_total_files = 0;
|
||||
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}-add-button').on('click', function() {
|
||||
$('#{$input.name|escape:'htmlall':'UTF-8'}').trigger('click');
|
||||
});
|
||||
});
|
||||
</script>
|
||||
{elseif $input.type == 'button'}
|
||||
<div class="col-lg-8 {$input.class|escape:'htmlall':'UTF-8'}">
|
||||
<div class="form-group">
|
||||
<div class="col-lg-12">
|
||||
<button class="btn btn-default" type="button" id="{$input.name|escape:'htmlall':'UTF-8'}">
|
||||
<i class="icon-instagram"></i> {$input.title|escape:'htmlall':'UTF-8'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
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;
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
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;
|
||||
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*/
|
||||
|
||||
|
||||
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;
|
||||
@@ -0,0 +1,19 @@
|
||||
{**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*}
|
||||
|
||||
<a href="{$href|escape:'html':'UTF-8'}" title="{$action|escape:'html':'UTF-8'}" class="delete">
|
||||
<i class="icon-trash"></i> {$action|escape:'html':'UTF-8'}
|
||||
</a>
|
||||
@@ -0,0 +1,55 @@
|
||||
{**
|
||||
* 2012 - 2020 HiPresta
|
||||
*
|
||||
* MODULE Gallery
|
||||
*
|
||||
* @author HiPresta <support@hipresta.com>
|
||||
* @copyright HiPresta 2020
|
||||
* @license Addons PrestaShop license limitation
|
||||
* @link https://hipresta.com
|
||||
*
|
||||
* NOTICE OF LICENSE
|
||||
*
|
||||
* Don't use this module on several shops. The license provided by PrestaShop Addons
|
||||
* for all its modules is valid only once for a single shop.
|
||||
*}
|
||||
|
||||
{extends file="helpers/list/list_content.tpl"}
|
||||
{block name="td_content"}
|
||||
{if $key == 'manage_image'}
|
||||
<a data-id-gallery="{$tr.id_gallery|escape:'htmlall':'UTF-8'}" class="btn btn-default gallery_manage_image"
|
||||
href="#" title="{l s='Image' mod='higallery'}">
|
||||
<i class="icon-image"></i>
|
||||
</a>
|
||||
{elseif $key == 'position'}
|
||||
{if $tr.position == 'gallery_page'}
|
||||
{l s='Gallery Page' mod='higallery'}
|
||||
{elseif $tr.position == 'single_gallery_page'}
|
||||
{l s='Single Gallery Page' mod='higallery'}
|
||||
{else}
|
||||
{$tr.position}
|
||||
{/if}
|
||||
{elseif $key == 'status'}
|
||||
{if $table == 'higallerysocialnetwork'}
|
||||
{assign var="id" value=$tr.id_higallerysocialnetwork}
|
||||
{else}
|
||||
{assign var="id" value=$tr.id_gallery}
|
||||
{/if}
|
||||
<a data-id="{$id|escape:'htmlall':'UTF-8'}" data-status="{$tr.active|escape:'htmlall':'UTF-8'}" class="status btn {if $tr.active == '0'}btn-danger{else}btn-success{/if}"
|
||||
href="#" title="{if $tr.active == '0'}{l s='Disabled' mod='higallery'}{else}{l s='Enabled' mod='higallery'}{/if}">
|
||||
<i class="{if $tr.active == '0'}icon-remove {else}icon-check{/if}"></i>
|
||||
</a>
|
||||
{elseif $key == 'custom_hook'}
|
||||
{literal}{{/literal}hook h="higallery" id="{$tr['id_gallery']|escape:'htmlall':'UTF-8'}"{literal}}{/literal}
|
||||
{elseif $key == 'custom_html'}
|
||||
<div data-toggle="tooltip" title="{l s='Add this in HTML editor or any tpl file to display the gallery'}"><div class="hi-gallery-ajax-loader" id="higallery-{$tr.id_gallery|intval}"></div></div>
|
||||
{elseif $key == 'shortcode'}
|
||||
[higallery id-gallery='{$tr.id_gallery|intval}']
|
||||
{elseif $key == 'sort'}
|
||||
<a href="#">
|
||||
<i class="icon-move"></i>
|
||||
</a>
|
||||
{else}
|
||||
{$smarty.block.parent}
|
||||
{/if}
|
||||
{/block}
|
||||
Reference in New Issue
Block a user