This commit is contained in:
2025-04-01 00:38:54 +02:00
parent d4d4c0c09d
commit 87da06293a
22351 changed files with 5168854 additions and 7538 deletions

View File

@@ -0,0 +1,30 @@
'use strict';
/**
* 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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
const renderCdcError = ((container) => {
if (container.length) {
const url = container.data('error-path')
if (url) {
$.get(url, (data) => {
container.html(data);
});
}
}
});

View File

@@ -0,0 +1,29 @@
'use strict';
/**
* 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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
(function() {
window.$(document).ready(function() {
if (typeof renderCdcError === 'function') {
window.$(document).ready(function() {
renderCdcError($('.cdc-container'));
});
}
})
})();

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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-2018 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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;

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,35 @@
<?php
/**
* 2007-2018 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 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/afl-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-2018 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 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,270 @@
/**
* 2007-2018 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:
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
(function ( $ ) {
var config = null;
var validateKeyCode = 13;
var tagsList = [];
var fullTagsString = null;
var pstaggerInput = null;
var defaultConfig = {
/* Global css config */
wrapperClassAdditional: '',
/* Tags part */
tagsWrapperClassAdditional: '',
tagClassAdditional: '',
closingCrossClassAdditionnal: '',
/* Tag Input part */
tagInputWrapperClassAdditional: '',
tagInputClassAdditional: '',
/* Global configuration */
delimiter: ' ',
inputPlaceholder: 'Add tag ...',
closingCross: true,
context: null,
clearAllBtn: false,
clearAllIconClassAdditional: '',
clearAllSpanClassAdditional: '',
/* Callbacks */
onTagsChanged: null,
onResetTags: null,
};
var immutableConfig = {
/* Global css config */
wrapperClass: 'pstaggerWrapper',
/* Tags part */
tagsWrapperClass: 'pstaggerTagsWrapper',
tagClass: 'pstaggerTag',
/* Tag Input part */
tagInputWrapperClass: 'pstaggerAddTagWrapper',
tagInputClass: 'pstaggerAddTagInput',
clearAllIconClass: '',
clearAllSpanClass: 'pstaggerResetTagsBtn',
closingCrossClass: 'pstaggerClosingCross',
};
var bindValidationInputEvent = function() {
// Validate input whenever validateKeyCode is pressed
pstaggerInput.keypress(function(event) {
if (event.keyCode == validateKeyCode) {
tagsList = [];
processInput();
}
});
// If focusout of input, display tagsWrapper if not empty or leave input as is
pstaggerInput.focusout(function(event){
// Necessarry to avoid race condition when focusout input because we want to reset :-)
if ($('.' + immutableConfig.clearAllSpanClass + ':hover').length) {
return false;
}
// Only redisplay tags on focusOut if there's something in tagsList
if (pstaggerInput.val().length) {
tagsList = [];
processInput();
}
});
};
var processInput = function() {
var fullTagsStringRaw = pstaggerInput.val();
var tagsListRaw = fullTagsStringRaw.split(config.delimiter);
// Check that's not an empty input
if (fullTagsStringRaw.length) {
// Loop over each tags we got this round
for (var key in tagsListRaw) {
var tagRaw = tagsListRaw[key];
// No empty values
if (tagRaw === '') {
continue;
}
// Add tag into persistent list
tagsList.push(tagRaw);
}
var spanTagsHtml = '';
// Create HTML dom from list of tags we have
for (key in tagsList) {
var tag = tagsList[key];
spanTagsHtml += formatSpanTag(tag);
}
// Delete previous if any, then add recreated html content
$('.' + immutableConfig.tagsWrapperClass).empty().prepend(spanTagsHtml).css('display', 'block');
// Hide input until user click on tagify_tags_wrapper
$('.' + immutableConfig.tagInputWrapperClass).css('display', 'none');
} else {
$('.' + immutableConfig.tagsWrapperClass).css('display', 'none');
$('.' + immutableConfig.tagInputWrapperClass).css('display', 'block');
pstaggerInput.focus();
}
// Call the callback ! (if one)
if (config.onTagsChanged !== null) {
config.onTagsChanged.call(config.context, tagsList);
}
};
var formatSpanTag = function(tag) {
var spanTag = '<span class="' + immutableConfig.tagClass + ' ' + config.tagClassAdditional+'">' +
'<span>' +
$('<div/>').text(tag).html() +
'</span>';
// Add closingCross if set to true
if (config.closingCross === true) {
spanTag += '<a class="' + immutableConfig.closingCrossClass + ' ' + config.closingCrossClassAdditionnal+'" href="#">x</a>';
}
spanTag += '</span>';
return spanTag;
};
var constructTagInputForm = function() {
// First hide native input
config.originalInput.css('display', 'none');
var addClearBtnHtml = '';
// If reset button required add it following user decription
if (config.clearAllBtn === true) {
addClearBtnHtml += '<span class="' + immutableConfig.clearAllSpanClass + ' ' + config.clearAllSpanClassAdditional +'">' +
'<i class="' + immutableConfig.clearAllIconClass + ' ' + config.clearAllIconClassAdditional +'">clear</i>' +
'</span>';
// Bind the click on the reset icon
bindResetTagsEvent();
}
// Add Tagify form after it
var formHtml = '<div class="' + immutableConfig.wrapperClass + ' ' + config.wrapperClassAdditional +'">' +
addClearBtnHtml +
'<div class="' + immutableConfig.tagsWrapperClass + ' ' + config.tagsWrapperClassAdditional +'"></div>' +
'<div class="' + immutableConfig.tagInputWrapperClass + ' ' + config.tagInputWrapperClassAdditional +'">' +
'<input class="' + immutableConfig.tagInputClass + ' ' + config.tagInputClassAdditional +'">' +
'</div>' +
'</div>';
// Insert form after the originalInput
config.originalInput.after(formHtml);
// Save tagify input in our object
pstaggerInput = $('.' + immutableConfig.tagInputClass);
return true;
};
var bindFocusInputEvent = function() {
// Bind click on tagsWrapper to switch and focus on input
$('.' + immutableConfig.tagsWrapperClass).on('click', function(event) {
var clickedElementClasses = event.target.className;
// Regexp to check if not clicked on closingCross to avoid focusing input if so
var checkClosingCrossRegex = new RegExp(immutableConfig.closingCrossClass, 'g');
var closingCrossClicked = clickedElementClasses.match(checkClosingCrossRegex);
if ($('.' + immutableConfig.tagInputWrapperClass).is(':hidden') && closingCrossClicked === null) {
$('.' + immutableConfig.tagsWrapperClass).css('display', 'none');
$('.' + immutableConfig.tagInputWrapperClass).css('display', 'block');
pstaggerInput.focus();
}
});
};
var bindResetTagsEvent = function() {
// Use delegate since we bind it before we insert the html in the DOM
var _this = this;
$(document).delegate('.' + immutableConfig.clearAllSpanClass, 'click', function(){
resetTags(true);
});
};
var resetTags = function(withCallback) {
// Empty tags list and tagify input
tagsList = [];
pstaggerInput.val('');
$('.' + immutableConfig.tagsWrapperClass).css('display', 'none');
$('.' + immutableConfig.tagInputWrapperClass).css('display', 'block');
pstaggerInput.focus();
// Empty existing Tags
$('.' + immutableConfig.tagClass).remove();
// Call the callback if one !
if (config.onResetTags !== null && withCallback === true) {
config.onResetTags.call(config.context);
}
}
var bindClosingCrossEvent = function() {
$(document).delegate('.' + immutableConfig.closingCrossClass, 'click', function(event){
var thisTagWrapper = $(this).parent();
var clickedTagIndex = thisTagWrapper.index();
// Iterate through tags to reconstruct new pstaggerInput value
var newInputValue = reconstructInputValFromRemovedTag(clickedTagIndex);
// Apply new input value
pstaggerInput.val(newInputValue);
thisTagWrapper.remove();
tagsList = [];
processInput();
});
};
var reconstructInputValFromRemovedTag = function(clickedTagIndex) {
var finalStr = '';
$('.' + immutableConfig.tagClass).each(function(index, value) {
// If this is the tag we want to remove then continue else add to return string val
if (clickedTagIndex == $(this).index()) {
// jQuery.each() continue;
return true;
}
// Add to return value
finalStr += ' ' + $(this).children().first().text();
});
return finalStr;
};
var getTagsListOccurencesCount = function() {
var obj = {};
for (var i = 0, j = tagsList.length; i < j; i++) {
obj[tagsList[i]] = (obj[tagsList[i]] || 0) + 1;
}
return obj;
};
var setConfig = function(givenConfig, originalObject) {
var finalConfig = {};
// Loop on each default values, check if one given by user, if so -> override default
for (var property in defaultConfig) {
if (givenConfig.hasOwnProperty(property)) {
finalConfig[property] = givenConfig[property];
} else {
finalConfig[property] = defaultConfig[property];
}
}
finalConfig.originalInput = originalObject;
return finalConfig;
};
// jQuery extends function
$.fn.pstagger = function(_config) {
config = setConfig(_config, this);
constructTagInputForm();
bindValidationInputEvent();
bindFocusInputEvent();
bindClosingCrossEvent();
return {
'resetTags': resetTags,
};
};
}(jQuery));

View File

@@ -0,0 +1,136 @@
/**
* 2007-2018 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:
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
$(document).ready(function() {
window.vApp = new Vue({
el: '#psmbo',
delimiters: ['[[', ']]'],
data: {
modules: [],
categories: [],
admin_module_ajax_url_psmbo: ''
},
methods: {
getHref: function(module_name) {
return window.vApp.admin_module_ajax_url_psmbo + '&action=GetMboModuleQuickView&module_name=' + module_name + '&ajax=1';
},
getAvgRateClass: function(avg_rate) {
return 'module-stars module-star-ranking-grid-' + Math.round(avg_rate) + ' small';
},
visibleModules: function() {
var visibleModules = 0;
if (typeof window.vApp !== 'undefined' && typeof window.vApp.modules !== 'undefined') {
$.each(window.vApp.modules, function(index, value) {
if (value.attributes.visible === true) {
visibleModules++;
}
});
}
return visibleModules;
}
}
});
$.ajax({
type: 'POST',
url: admin_module_ajax_url_psmbo,
data: {
ajax : true,
action : 'GetModulesList',
},
beforeSend: function() {
$('#psmbo .btn-primary-reverse.spinner').css({
'background-color': 'inherit'
});
$('#psmbo .btn-primary-reverse.spinner').removeClass('hide');
},
success : function(data) {
var parsedData = JSON.parse(data);
window.vApp.modules = parsedData.modules;
window.vApp.categories = parsedData.categories;
if (typeof filterCategoryTab !== 'undefined') {
// should use a promise, to improve
setTimeout(function () {
$('.module-category-menu[data-category-display-ref-menu=' + filterCategoryTab + ']').trigger('click');
}, 300);
}
$('[data-toggle="popover"]').popover();
$('#psmbo .btn-primary-reverse.spinner').addClass('hide');
},
});
window.vApp.admin_module_ajax_url_psmbo = admin_module_ajax_url_psmbo;
$('.fancybox-quick-view').fancybox({
type: 'ajax',
autoDimensions: false,
autoSize: false,
width: 600,
height: 'auto',
helpers: {
overlay: {
locked: false
}
}
});
$(document).on('click', '.module-read-more-grid-btn', function() {
var name = $(this).attr('data-module-name');
return true;
});
var urlToCall = $('#notification_count_url').val();
if (urlToCall !== '') {
var tabToUpdate = $("#subtab-AdminModulesUpdates");
if (tabToUpdate.length === 0) {
return;
}
var tabToConfigure = $("#subtab-AdminModulesNotifications");
if (tabToConfigure.length === 0) {
return;
}
$.getJSON(urlToCall, function(badge) {
tabToUpdate.append('<span class="notification-container">\
<span class="notification-counter">'+badge.to_update+'</span>\
</span>\
');
tabToConfigure.append('<span class="notification-container">\
<span class="notification-counter">'+badge.to_configure+'</span>\
</span>\
');
}).fail(function() {
console.error('Could not retrieve module notifications count.');
});
}
});

View File

@@ -0,0 +1,279 @@
/**
* 2007-2018 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:
* 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 http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2018 PrestaShop SA
* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*/
var module_card_controller = {};
$(document).ready(function () {
module_card_controller = new AdminModuleCard();
module_card_controller.init();
});
/**
* AdminModule card Controller.
* @constructor
*/
var AdminModuleCard = function () {
/* Selectors for module action links (uninstall, reset, etc...) to add a confirm popin */
// this.moduleActionMenuLinkSelector = 'button.module_action_menu_';
this.moduleActionMenuInstallLinkSelector = 'button.module_action_menu_install';
this.moduleActionMenuEnableLinkSelector = 'button.module_action_menu_enable';
this.moduleActionMenuUninstallLinkSelector = 'button.module_action_menu_uninstall';
this.moduleActionMenuDisableLinkSelector = 'button.module_action_menu_disable';
this.moduleActionMenuEnableMobileLinkSelector = 'button.module_action_menu_enable_mobile';
this.moduleActionMenuDisableMobileLinkSelector = 'button.module_action_menu_disable_mobile';
this.moduleActionMenuResetLinkSelector = 'button.module_action_menu_reset';
this.moduleActionMenuUpdateLinkSelector = 'button.module_action_menu_upgrade';
this.moduleItemListSelector = '.module-item-list';
this.moduleItemGridSelector = '.module-item-grid';
/* Selectors only for modal buttons */
this.moduleActionModalDisableLinkSelector = 'a.module_action_modal_disable';
this.moduleActionModalResetLinkSelector = 'a.module_action_modal_reset';
this.moduleActionModalUninstallLinkSelector = 'a.module_action_modal_uninstall';
this.forceDeletionOption = '#force_deletion';
/**
* Initialize all listeners and bind everything
* @method init
* @memberof AdminModuleCard
*/
this.init = function () {
this.initActionButtons();
};
this.getModuleItemSelector = function () {
if ($(this.moduleItemListSelector).length) {
return this.moduleItemListSelector;
} else {
return this.moduleItemGridSelector;
}
};
this.confirmAction = function(action, element) {
var modal = $('#' + $(element).data('confirm_modal'));
if (modal.length != 1) {
return true;
}
modal.first().modal('show');
return false; // do not allow a.href to reload the page. The confirm modal dialog will do it async if needed.
};
/**
* Update the content of a modal asking a confirmation for PrestaTrust and open it
*
* @param {array} result containing module data
* @return {void}
*/
this.confirmPrestaTrust = function confirmPrestaTrust(result) {
var that = this;
var modal = this.replacePrestaTrustPlaceholders(result);
modal.find(".pstrust-install").off('click').on('click', function() {
// Find related form, update it and submit it
var install_button = $(that.moduleActionMenuInstallLinkSelector, '.module-item[data-tech-name="' + result.module.attributes.name + '"]');
var form = install_button.parent("form");
$('<input>').attr({
type: 'hidden',
value: '1',
name: 'actionParams[confirmPrestaTrust]'
}).appendTo(form);
install_button.click();
modal.modal('hide');
});
modal.modal();
};
this.replacePrestaTrustPlaceholders = function replacePrestaTrustPlaceholders(result) {
var modal = $("#modal-prestatrust");
var module = result.module.attributes;
if (result.confirmation_subject !== 'PrestaTrust' || !modal.length) {
return;
}
var alertClass = module.prestatrust.status ? 'success' : 'warning';
if (module.prestatrust.check_list.property) {
modal.find("#pstrust-btn-property-ok").show();
modal.find("#pstrust-btn-property-nok").hide();
} else {
modal.find("#pstrust-btn-property-ok").hide();
modal.find("#pstrust-btn-property-nok").show();
modal.find("#pstrust-buy").attr("href", module.url).toggle(module.url !== null);
}
modal.find("#pstrust-img").attr({src: module.img, alt: module.name});
modal.find("#pstrust-name").text(module.displayName);
modal.find("#pstrust-author").text(module.author);
modal.find("#pstrust-label").attr("class", "text-" + alertClass).text(module.prestatrust.status ? 'OK' : 'KO');
modal.find("#pstrust-message").attr("class", "alert alert-"+alertClass);
modal.find("#pstrust-message > p").text(module.prestatrust.message);
return modal;
}
this.dispatchPreEvent = function (action, element) {
var event = jQuery.Event('module_card_action_event');
$(element).trigger(event, [action]);
if (event.isPropagationStopped() !== false || event.isImmediatePropagationStopped() !== false) {
return false; // if all handlers have not been called, then stop propagation of the click event.
}
return (event.result !== false); // explicit false must be set from handlers to stop propagation of the click event.
};
this.initActionButtons = function () {
var _this = this;
// $(document).on('click', this.forceDeletionOption, function () {
// var btn = $(_this.moduleActionModalUninstallLinkSelector, $("div.module-item-list[data-tech-name='" + $(this).attr("data-tech-name") + "']"));
// if($(this).prop('checked') === true) {
// btn.attr('data-deletion', 'true');
// }else {
// btn.removeAttr('data-deletion');
// }
// });
$(document).on('click', this.moduleActionMenuInstallLinkSelector, function () {
if ($("#modal-prestatrust").length) {
$("#modal-prestatrust").modal('hide');
}
return _this.dispatchPreEvent('install', this) && _this.confirmAction('install', this) && _this.requestToController('install', $(this));
});
$(document).on('click', this.moduleActionMenuEnableLinkSelector, function () {
return _this.dispatchPreEvent('enable', this) && _this.confirmAction('enable', this) && _this.requestToController('enable', $(this));
});
$(document).on('click', this.moduleActionMenuUninstallLinkSelector, function () {
return _this.dispatchPreEvent('uninstall', this) && _this.confirmAction('uninstall', this) && _this.requestToController('uninstall', $(this));
});
$(document).on('click', this.moduleActionMenuDisableLinkSelector, function () {
return _this.dispatchPreEvent('disable', this) && _this.confirmAction('disable', this) && _this.requestToController('disable', $(this));
});
$(document).on('click', this.moduleActionMenuEnableMobileLinkSelector, function () {
return _this.dispatchPreEvent('enable_mobile', this) && _this.confirmAction('enable_mobile', this) && _this.requestToController('enable_mobile', $(this));
});
$(document).on('click', this.moduleActionMenuDisableMobileLinkSelector, function () {
return _this.dispatchPreEvent('disable_mobile', this) && _this.confirmAction('disable_mobile', this) && _this.requestToController('disable_mobile', $(this));
});
$(document).on('click', this.moduleActionMenuResetLinkSelector, function () {
return _this.dispatchPreEvent('reset', this) && _this.confirmAction('reset', this) && _this.requestToController('reset', $(this));
});
$(document).on('click', this.moduleActionMenuUpdateLinkSelector, function () {
return _this.dispatchPreEvent('update', this) && _this.confirmAction('update', this) && _this.requestToController('update', $(this));
});
$(document).on('click', this.moduleActionModalDisableLinkSelector, function () {
return _this.requestToController('disable', $(_this.moduleActionMenuDisableLinkSelector, $("div.module-item-list[data-tech-name='" + $(this).attr("data-tech-name") + "']")));
});
$(document).on('click', this.moduleActionModalResetLinkSelector, function () {
return _this.requestToController('reset', $(_this.moduleActionMenuResetLinkSelector, $("div.module-item-list[data-tech-name='" + $(this).attr("data-tech-name") + "']")));
});
$(document).on('click', this.moduleActionModalUninstallLinkSelector, function (e) {
$(e.target).parents('.modal').on('hidden.bs.modal', function(event) {
return _this.requestToController(
'uninstall',
$(
_this.moduleActionMenuUninstallLinkSelector,
$("div.module-item-list[data-tech-name='" + $(e.target).attr("data-tech-name") + "']")
),
$(e.target).attr("data-deletion")
);
}.bind(e));
});
};
this.requestToController = function (action, element, forceDeletion) {
var _this = this;
var jqElementObj = element.closest("div.form-action-button-container");
var form = element.closest("form");
var spinnerObj = $("<button class=\"btn-primary-reverse onclick unbind spinner \"></button>");
var url = "//" + window.location.host + form.attr("action");
var actionParams = form.serializeArray();
if (forceDeletion === "true" || forceDeletion === true) {
actionParams.push({name: "actionParams[deletion]", value: true});
}
$.ajax({
url: url,
dataType: 'json',
method: 'POST',
data: actionParams,
beforeSend: function () {
jqElementObj.hide();
jqElementObj.after(spinnerObj);
}
}).done(function (result) {
if (typeof result === undefined) {
$.growl.error({message: "No answer received from server"});
} else {
var moduleTechName = Object.keys(result)[0];
if (result[moduleTechName].status === false) {
if (typeof result[moduleTechName].confirmation_subject !== 'undefined') {
_this.confirmPrestaTrust(result[moduleTechName]);
}
$.growl.error({message: result[moduleTechName].msg});
} else {
$.growl.notice({message: result[moduleTechName].msg});
var alteredSelector = null;
var mainElement = null;
if (action == "uninstall") {
jqElementObj.fadeOut(function() {
alteredSelector = _this.getModuleItemSelector().replace('.', '');
mainElement = jqElementObj.parents('.' + alteredSelector).first();
mainElement.remove();
});
} else if (action == "disable") {
alteredSelector = _this.getModuleItemSelector().replace('.', '');
mainElement = jqElementObj.parents('.' + alteredSelector).first();
mainElement.addClass(alteredSelector + '-isNotActive');
mainElement.attr('data-active', '0');
} else if (action == "enable") {
alteredSelector = _this.getModuleItemSelector().replace('.', '');
mainElement = jqElementObj.parents('.' + alteredSelector).first();
mainElement.removeClass(alteredSelector + '-isNotActive');
mainElement.attr('data-active', '1');
}
var actionsBar = $(result[moduleTechName].action_menu_html);
if (jqElementObj)
if (jqElementObj.length > 0) {
jqElementObj.html(actionsBar);
} else {
console.log('here');
console.log(element);
element.closest("div.module-actions").replaceWith(actionsBar);
}
$('#psmbo .dropdown-toggle .caret').css({'display': 'none'});
}
}
}).always(function () {
jqElementObj.fadeIn();
spinnerObj.remove();
});
return false;
};
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,28 @@
<?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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 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,475 @@
'use strict';
/**
* 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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
var mbo = {};
(function() {
var pageMapDefault = {
toolbarButtonsContainer: '#toolbar-nav',
toolbarButtons: '#toolbar-nav > li > a.toolbar_btn',
toolbarHelpButton: '#toolbar-nav li:last-of-type > a.btn-help',
toolbarLastElement: '#toolbar-nav li:last-of-type',
recommendedModulesButton: '#recommended-modules-button',
fancybox: '.fancybox-quick-view',
contentContainer: '#content',
modulesListModal: '#modules_list_container',
modulesListModalContent: '#modules_list_container_tab_modal',
modulesListLoader: '#modules_list_loader',
};
var pageMapNewTheme = {
toolbarButtonsContainer: '.toolbar-icons .wrapper',
toolbarHelpButton: '.toolbar-icons a.btn-help',
toolbarLastElement: '.toolbar-icons a:last-of-type',
recommendedModulesButton: '#recommended-modules-button',
oldButton: '#page-header-desc-configuration-modules-list',
contentContainer: '#main-div .content-div .container:last',
modulesListModal: '#modules_list_container',
modulesListModalContainer: '#main-div .content-div',
modulesListModalContent: '#modules_list_container_tab_modal',
modulesListLoader: '#modules_list_loader',
};
var decodeHTMLEntities = function(text) {
var entities = [
['amp', '&'],
['apos', '\''],
['#x27', '\''],
['#x2F', '/'],
['#39', '\''],
['#47', '/'],
['lt', '<'],
['gt', '>'],
['nbsp', ' '],
['quot', '"']
];
for (var i = 0, max = entities.length; i < max; ++i)
text = text.replace(new RegExp('&'+entities[i][0]+';', 'g'), entities[i][1]);
return text;
}
/**
* Handles page interactions
*
* @param {object} pageMap
* @constructor
*/
var Page = function(pageMap) {
/**
* Indicates if the help button is the last one in the toolbar
* @return {boolean}
*/
var lastElementIsHelpButton = function() {
return $(pageMap.toolbarHelpButton).length > 0;
};
/**
* Inserts the button before the help one
* @param {RecommendedModulesButton} button
*/
var insertItBeforeHelpButton = function(button) {
$(pageMap.toolbarLastElement).before(button.getMarkup());
};
/**
* Inserts the button as the last item in the toolbar
* @param {RecommendedModulesButton} button
*/
var insertItLastInToolbar = function(button) {
$(pageMap.toolbarButtonsContainer).append(button.getMarkup());
};
/**
* Remove core-generated "recommended module" button in PS < 1.7.6.0
* @return this
*/
this.removeOldButton = function() {
if (pageMap.toolbarButtons) {
// default theme
$(pageMap.toolbarButtons).filter(
function() {
var buttonIdPattern = /^page-header-desc-[a-z-_]+-modules-list$/;
return String($(this).attr('id'))
.match(buttonIdPattern);
}
).parent().remove();
}
if (pageMap.oldButton) {
// new theme
$(pageMap.oldButton).remove();
}
return this;
};
/**
* Inserts the provided button in the toolbar
*
* @param {RecommendedModulesButton} button
* @return this
*/
this.insertToolbarButton = function(button) {
if (lastElementIsHelpButton()) {
insertItBeforeHelpButton(button);
} else {
insertItLastInToolbar(button);
}
return this;
};
/**
* Inserts the recommended modules in the DOM
*
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
*
* @return this
*/
this.insertRecommendedModules = function(config) {
if (pageMap.contentContainer) {
var recommendedModulesRequest = $.ajax({
type: 'GET',
dataType: 'json',
url: config.recommendedModulesUrl,
});
recommendedModulesRequest.done(function(data) {
var recommendedModulesContainer = new RecommendedModulesContainer(config, data.content);
$(pageMap.contentContainer).append(recommendedModulesContainer.getMarkup());
});
recommendedModulesRequest.fail(function(jqXHR, textStatus, errorThrown) {
var recommendedModulesAlertMessage = new RecommendedModulesAlertMessage(config, 'danger', errorThrown);
var content = recommendedModulesAlertMessage.getMarkup().get(0).outerHTML;
if (undefined !== jqXHR.responseJSON && undefined !== jqXHR.responseJSON.content) {
content += jqXHR.responseJSON.content;
}
var recommendedModulesContainer = new RecommendedModulesContainer(config, content);
$(pageMap.contentContainer).append(recommendedModulesContainer.getMarkup().get(0).outerHTML);
});
}
return this;
};
};
/**
* Handles markup for the Recommended modules button
*
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
* @constructor
*/
var RecommendedModulesButton = function(config) {
var label = config.translations['Recommended Modules and Services'];
var buttonId = 'recommended-modules-button';
var $markup;
if (config.shouldUseLegacyTheme) {
$markup = $(
'<li id="recommended-modules-button-container">\n' +
' <a id="' + buttonId + '" class="toolbar_btn pointer mbo-modules-recommended-button " href="' + config.recommendedModulesUrl + '" title="' + label + '">\n' +
' <i class="material-icons mi-extension">extension</i>\n' +
' <div>' + label + '</div>\n' +
' </a>\n' +
'</li>'
);
} else {
$markup = $(
'<a class="btn btn-secondary" id="' + buttonId + '" href="' + config.recommendedModulesUrl + '" title="' + label + '">' +
'<i class="material-icons">extension</i>\n' +
label +
'</a>'
);
}
/**
* Returns the button's markup
* @return {jQuery|HTMLElement}
*/
this.getMarkup = function() {
return $markup;
}
};
/**
* Handles markup for the Recommended modules container
*
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
* @param {jQuery|HTMLElement} content
* @constructor
*/
var RecommendedModulesContainer = function(config, content) {
var containerTitle = config.translations['Recommended Modules and Services'];
var containerDescription = decodeHTMLEntities(config.translations['description']);
var containerId = 'recommended-modules-container';
var $markup;
if (config.shouldUseLegacyTheme) {
$markup = $(
'<div class="panel" id="' + containerId + '">\n' +
' <h3>\n' +
' <i class="icon-puzzle-piece"></i>\n' +
' ' + containerTitle + '\n' +
' </h3>\n' +
' <div class="recommended-modal-content-description">' + containerDescription + '</div>\n' +
' <div class="modules_list_container_tab row">\n' +
' ' + content +'\n' +
' </div>\n' +
'</div>'
);
} else {
$markup = $(
'<div class="row" id="' + containerId + '">\n' +
' <div class="col">\n' +
' <div class="card">\n' +
' <h3 class="card-header">\n' +
' <i class="material-icons">extension</i>\n' +
' ' + containerTitle + '\n' +
' </h3>\n' +
' <div class="recommended-modal-content-description">'+ containerDescription +'</div>\n'+
' <div class="card-block">\n' +
' ' + content +'\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
'</div>'
);
}
/**
* Returns the button's markup
* @return {jQuery|HTMLElement}
*/
this.getMarkup = function() {
return $markup;
}
};
/**
* Handles markup for the Recommended modules container
*
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
* @param {string} type
* @param {string} text
* @constructor
*/
var RecommendedModulesAlertMessage = function(config, type, text) {
var $markup = $(
'<div class="alert alert-' + type + '" role="alert">\n' +
' <p class="alert-text">\n' +
' ' + text + '\n' +
' </p>\n' +
'</div>'
);
/**
* Returns the button's markup
* @return {jQuery|HTMLElement}
*/
this.getMarkup = function() {
return $markup;
}
};
/**
* Handles markup for the Recommended modules container
*
* @param {object} pageMap
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
* @constructor
*/
var RecommendedModulesModal = function(pageMap, config) {
var $markup;
if (!config.shouldUseLegacyTheme) {
$markup = $(
'<div id="modules_list_container" class="modal modal-vcenter fade" role="dialog">\n' +
' <div class="modal-dialog">\n' +
' <div class="modal-content">\n' +
' <div class="modal-header">\n' +
' <h4 class="modal-title module-modal-title">\n' +
' ' + config.translations['Recommended Modules and Services'] + '\n' +
' </h4>\n' +
' <button type="button" class="close" data-dismiss="modal" aria-label="' + config.translations['Close'] + '">\n' +
' <span aria-hidden="true">&times;</span>\n' +
' </button>\n' +
' </div>\n' +
' <div class="modal-body row">\n' +
' <div id="modules_list_container_tab_modal" class="col-md-12" style="display:none;"></div>\n' +
' <div id="modules_list_loader" class="col-md-12 text-center">\n' +
' <button class="btn-primary-reverse onclick unbind spinner"></button>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
' </div>\n' +
'</div>'
);
}
/**
* Returns the button's markup
* @return {jQuery|HTMLElement}
*/
this.getMarkup = function() {
return $markup;
}
};
/**
* @param {object} pageMap
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
* @constructor
*/
var RecommendedModulesPopinHandler = function(pageMap, config) {
var initPopin = function() {
if (config.shouldUseLegacyTheme) {
$(pageMap.fancybox).fancybox({
type: 'ajax',
autoDimensions: false,
autoSize: false,
width: 600,
height: 'auto',
helpers: {
overlay: {
locked: false
}
}
});
$(pageMap.modulesListModal).find('h3.modal-title').text(config.translations['Recommended Modules and Services']);
} else {
if (!$(pageMap.modulesListModal).length) {
var modal = new RecommendedModulesModal(pageMap, config);
$(pageMap.modulesListModalContainer).append(modal.getMarkup().get(0).outerHTML);
}
}
};
var openModulesList = function() {
var recommendedModulesRequest = $.ajax({
type: 'GET',
dataType: 'json',
url: config.recommendedModulesUrl,
});
$(pageMap.modulesListModal).modal('show');
recommendedModulesRequest.done(function (data) {
var descriptionHtml = decodeHTMLEntities(config.translations['description']);
$(pageMap.modulesListModalContent).html('<div class="recommended-modal-description">' + descriptionHtml + '</div>' + data.content).slideDown();
$(pageMap.modulesListLoader).hide();
});
recommendedModulesRequest.fail(function(jqXHR, textStatus, errorThrown) {
var recommendedModulesAlertMessage = new RecommendedModulesAlertMessage(config, 'danger', errorThrown);
var content = recommendedModulesAlertMessage.getMarkup().get(0).outerHTML;
if (undefined !== jqXHR.responseJSON && undefined !== jqXHR.responseJSON.content) {
content += jqXHR.responseJSON.content;
}
$(pageMap.modulesListModalContent).html(content).slideDown();
$(pageMap.modulesListLoader).hide();
});
};
var bindButtonEvents = function() {
// wait for dom ready
$(document).on('click', pageMap.recommendedModulesButton, function(event) {
event.preventDefault();
openModulesList();
});
};
this.initialize = function() {
// wait for dom ready
$(function() {
initPopin();
bindButtonEvents();
});
};
};
/**
* Inserts the recommended modules button in the toolbar
*
* @param {object} config
* @param {array} config.translations
* @param {string} config.recommendedModulesUrl
* @param {boolean} config.shouldAttachRecommendedModulesAfterContent
* @param {boolean} config.shouldAttachRecommendedModulesButton
* @param {boolean} config.shouldUseLegacyTheme
*/
mbo.initialize = function(config) {
var pageMap = config.shouldUseLegacyTheme ? pageMapDefault : pageMapNewTheme;
var page = new Page(pageMap);
page.removeOldButton();
if (config.shouldAttachRecommendedModulesButton) {
var button = new RecommendedModulesButton(config);
var recommendedModulesPopinHandler = new RecommendedModulesPopinHandler(pageMap, config);
page.insertToolbarButton(button);
recommendedModulesPopinHandler.initialize();
}
if (config.shouldAttachRecommendedModulesAfterContent) {
page.insertRecommendedModules(config);
}
};
})();

View File

@@ -0,0 +1,31 @@
"use strict";
/**
* 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 Academic Free License version 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/AFL-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.
*
* @author PrestaShop SA and Contributors <contact@prestashop.com>
* @copyright Since 2007 PrestaShop SA and Contributors
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0
*/
(function () {
window.$(document).ready(function () {
$("#module-modal-import").on("shown.bs.modal", function () {
$("iframe").css("pointer-events", "none");
});
$("#module-modal-import").on("hidden.bs.modal", function () {
$("iframe").css("pointer-events", "");
});
});
})();

10947
modules/ps_mbo/views/js/vue.js Normal file

File diff suppressed because it is too large Load Diff

6
modules/ps_mbo/views/js/vue.min.js vendored Normal file

File diff suppressed because one or more lines are too long