Refactor CMS page template for improved readability and consistency

- Adjusted indentation and spacing for better code structure in page.tpl
- Ensured consistent use of block syntax and formatting
- Maintained functionality of the Paypo iframe integration and CMS content display
This commit is contained in:
2025-04-09 23:17:52 +02:00
parent 9a626b304e
commit 709798f77c
17 changed files with 4489 additions and 4486 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -2687,7 +2687,7 @@ class AdminControllerCore extends Controller
$this->addJqueryPlugin(['scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox']); $this->addJqueryPlugin(['scrollTo', 'alerts', 'chosen', 'autosize', 'fancybox']);
$this->addJqueryPlugin('growl', null, false); $this->addJqueryPlugin('growl', null, false);
$this->addJqueryUI(['ui.slider', 'ui.datepicker']); $this->addJqueryUI(['ui.core', 'ui.widget', 'ui.mouse', 'ui.draggable', 'ui.sortable','ui.datepicker','ui.slider']);
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/bootstrap.min.js'); $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/bootstrap.min.js');
$this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/modernizr.min.js'); $this->addJS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/js/vendor/modernizr.min.js');
@@ -2717,6 +2717,10 @@ class AdminControllerCore extends Controller
// Specific Admin Theme // Specific Admin Theme
$this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX); $this->addCSS(__PS_BASE_URI__ . $this->admin_webpath . '/themes/' . $this->bo_theme . '/css/overrides.css', 'all', PHP_INT_MAX);
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
} }
$this->addJS([ $this->addJS([

View File

@@ -235,7 +235,7 @@ define('_PS_SMARTY_CONSOLE_OPEN_BY_URL_', 1);
define('_PS_SMARTY_CONSOLE_OPEN_', 2); define('_PS_SMARTY_CONSOLE_OPEN_', 2);
if (!defined('_PS_JQUERY_VERSION_')) { if (!defined('_PS_JQUERY_VERSION_')) {
define('_PS_JQUERY_VERSION_', '3.4.1'); define('_PS_JQUERY_VERSION_', '1.12.4');
} }
define('_PS_CACHE_CA_CERT_FILE_', _PS_CACHE_DIR_.'cacert.pem'); define('_PS_CACHE_CA_CERT_FILE_', _PS_CACHE_DIR_.'cacert.pem');

View File

@@ -38,7 +38,7 @@ class APPageBuilder extends Module
protected $product_active; protected $product_active;
protected $backup_dir; protected $backup_dir;
protected $header_content; protected $header_content;
protected $_confirmations = array(); protected $_confirmations = array();
protected $_errors = array(); protected $_errors = array();
protected $_warnings = array(); protected $_warnings = array();
@@ -56,7 +56,7 @@ class APPageBuilder extends Module
$this->secure_key = Tools::encrypt($this->name); $this->secure_key = Tools::encrypt($this->name);
$this->bootstrap = true; $this->bootstrap = true;
parent::__construct(); parent::__construct();
$this->displayName = $this->l('Apollo Page Builder'); $this->displayName = $this->l('Apollo Page Builder');
$this->description = $this->l('Apollo Page Builder build content for your site.'); $this->description = $this->l('Apollo Page Builder build content for your site.');
$this->theme_name = _THEME_NAME_; $this->theme_name = _THEME_NAME_;
@@ -66,7 +66,7 @@ class APPageBuilder extends Module
$this->templateFile = 'module:appagebuilder/views/templates/hook/appagebuilder.tpl'; $this->templateFile = 'module:appagebuilder/views/templates/hook/appagebuilder.tpl';
$this->redirectFriendUrl(); $this->redirectFriendUrl();
} }
public function redirectFriendUrl() public function redirectFriendUrl()
{ {
// if (Context::getContext()->controller === null || (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront')))) { // if (Context::getContext()->controller === null || (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront')))) {
@@ -80,19 +80,19 @@ class APPageBuilder extends Module
if (isset($profile_data['friendly_url']) && !empty($profile_data['friendly_url'])) { if (isset($profile_data['friendly_url']) && !empty($profile_data['friendly_url'])) {
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoFriendlyUrl.php'); require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoFriendlyUrl.php');
$leo_friendly_url = LeoFriendlyUrl::getInstance(); $leo_friendly_url = LeoFriendlyUrl::getInstance();
$link = Context::getContext()->link; $link = Context::getContext()->link;
$idLang = Context::getContext()->language->id; $idLang = Context::getContext()->language->id;
$idShop = null; $idShop = null;
$relativeProtocol = false; $relativeProtocol = false;
$url = $link->getBaseLink($idShop, null, $relativeProtocol).$leo_friendly_url->getLangLink($idLang, null, $idShop).$profile_data['friendly_url'].'.html'; $url = $link->getBaseLink($idShop, null, $relativeProtocol).$leo_friendly_url->getLangLink($idLang, null, $idShop).$profile_data['friendly_url'].'.html';
$leo_friendly_url->canonicalRedirection($url); $leo_friendly_url->canonicalRedirection($url);
} }
} }
} }
} }
public static function getInstance() public static function getInstance()
{ {
static $_instance; static $_instance;
@@ -105,20 +105,20 @@ class APPageBuilder extends Module
public function install() public function install()
{ {
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php'); require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
//DONGND:: build shortcode, create folder for override //DONGND:: build shortcode, create folder for override
apPageHelper::createShortCode(); apPageHelper::createShortCode();
if (!parent::install() || !ApPageSetup::installConfiguration() || !ApPageSetup::createTables() || !ApPageSetup::installModuleTab() || !$this->registerLeoHook()) { if (!parent::install() || !ApPageSetup::installConfiguration() || !ApPageSetup::createTables() || !ApPageSetup::installModuleTab() || !$this->registerLeoHook()) {
return false; return false;
} }
# NOT LOAD DATASAMPLE AGAIN # NOT LOAD DATASAMPLE AGAIN
Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '1'); Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '1');
# REMOVE FILE INDEX.PHP FOR TRANSLATE # REMOVE FILE INDEX.PHP FOR TRANSLATE
ApPageSetup::processTranslateTheme(); ApPageSetup::processTranslateTheme();
Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 1); Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 1);
return true; return true;
@@ -127,21 +127,21 @@ class APPageBuilder extends Module
public function uninstall() public function uninstall()
{ {
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php'); require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
//DONGND:: rollback default file config for tinymce //DONGND:: rollback default file config for tinymce
Tools::copy(_PS_MODULE_DIR_.$this->name.'/views/js/shortcode/backup/tinymce.inc.js', _PS_ROOT_DIR_.'/js/admin/tinymce.inc.js'); Tools::copy(_PS_MODULE_DIR_.$this->name.'/views/js/shortcode/backup/tinymce.inc.js', _PS_ROOT_DIR_.'/js/admin/tinymce.inc.js');
if (!parent::uninstall()|| !ApPageSetup::uninstallModuleTab() || !ApPageSetup::deleteTables() || !ApPageSetup::uninstallConfiguration()) { if (!parent::uninstall()|| !ApPageSetup::uninstallModuleTab() || !ApPageSetup::deleteTables() || !ApPageSetup::uninstallConfiguration()) {
return false; return false;
} }
//DONGND:: remove overrider folder //DONGND:: remove overrider folder
// $this->uninstallOverrides(); // $this->uninstallOverrides();
Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 0); Configuration::updateValue('APPAGEBUILDER_OVERRIDED', 0);
return true; return true;
} }
public function hookActionModuleRegisterHookAfter($params) public function hookActionModuleRegisterHookAfter($params)
{ {
if (isset($params['hook_name']) && ($params['hook_name'] == 'header' || $params['hook_name']=='displayheader')) { if (isset($params['hook_name']) && ($params['hook_name'] == 'header' || $params['hook_name']=='displayheader')) {
@@ -150,7 +150,7 @@ class APPageBuilder extends Module
$id_hook = Hook::getIdByName($hook_name); $id_hook = Hook::getIdByName($hook_name);
$id_module = $this->id; $id_module = $this->id;
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
// Get module position in hook // Get module position in hook
$sql = 'SELECT MAX(`position`) AS position $sql = 'SELECT MAX(`position`) AS position
FROM `'._DB_PREFIX_.'hook_module` FROM `'._DB_PREFIX_.'hook_module`
@@ -167,13 +167,13 @@ class APPageBuilder extends Module
} }
} }
} }
public function postProcess() public function postProcess()
{ {
if (count($this->errors) > 0) { if (count($this->errors) > 0) {
return; return;
} }
if (Tools::isSubmit('installdemo')) { if (Tools::isSubmit('installdemo')) {
require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php'); require_once(_PS_MODULE_DIR_.$this->name.'/libs/setup.php');
ApPageSetup::installSample(); ApPageSetup::installSample();
@@ -242,12 +242,12 @@ class APPageBuilder extends Module
$this->errors[] = $this->trans('You do not have permission to configure this.', array(), 'Admin.Notifications.Error'); $this->errors[] = $this->trans('You do not have permission to configure this.', array(), 'Admin.Notifications.Error');
$this->context->smarty->assign('errors', $this->errors); $this->context->smarty->assign('errors', $this->errors);
} }
$this->postProcess(); $this->postProcess();
$output = ''; $output = '';
$this->backup_dir = str_replace('\\', '/', _PS_CACHE_DIR_.'backup/modules/appagebuilder/'); $this->backup_dir = str_replace('\\', '/', _PS_CACHE_DIR_.'backup/modules/appagebuilder/');
$create_profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles').'&addappagebuilder_profiles'; $create_profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles').'&addappagebuilder_profiles';
$profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles'); $profile_link = $this->context->link->getAdminLink('AdminApPageBuilderProfiles');
$position_link = $this->context->link->getAdminLink('AdminApPageBuilderPositions'); $position_link = $this->context->link->getAdminLink('AdminApPageBuilderPositions');
@@ -283,7 +283,7 @@ class APPageBuilder extends Module
foreach ($field_text as $k => $v) { foreach ($field_text as $k => $v) {
// validate module // validate module
unset($k); unset($k);
$v = str_replace(' ', '_', trim($v)); $v = str_replace(' ', '_', trim($v));
$v = preg_replace('/[^A-Za-z0-9\_]/', '', $v); $v = preg_replace('/[^A-Za-z0-9\_]/', '', $v);
if ($v && !in_array($v, $field_default)) { if ($v && !in_array($v, $field_default)) {
@@ -299,14 +299,14 @@ class APPageBuilder extends Module
foreach ($field_editor as $k => $v) { foreach ($field_editor as $k => $v) {
// validate module // validate module
unset($k); unset($k);
$v = str_replace(' ', '_', trim($v)); $v = str_replace(' ', '_', trim($v));
$v = preg_replace('/[^A-Za-z0-9\_]/', '', $v); $v = preg_replace('/[^A-Za-z0-9\_]/', '', $v);
if ($v && !in_array($v, $field_text) && !in_array($v, $field_default)) { if ($v && !in_array($v, $field_text) && !in_array($v, $field_default)) {
$field_editor_valid[] = $v; $field_editor_valid[] = $v;
} }
} }
Configuration::updateValue($fe, implode(',', $field_editor_valid)); Configuration::updateValue($fe, implode(',', $field_editor_valid));
$this->processExtrafield($field_editor_valid, $type, 'text'); $this->processExtrafield($field_editor_valid, $type, 'text');
} }
@@ -440,7 +440,7 @@ class APPageBuilder extends Module
public function processBackup() public function processBackup()
{ {
$install_folder = $this->backup_dir; $install_folder = $this->backup_dir;
if (!is_dir($install_folder)) { if (!is_dir($install_folder)) {
mkdir($install_folder, 0755, true); mkdir($install_folder, 0755, true);
} }
@@ -576,7 +576,7 @@ class APPageBuilder extends Module
} }
fclose($fp); fclose($fp);
} }
/** /**
* sub function of back-up database * sub function of back-up database
*/ */
@@ -934,7 +934,7 @@ class APPageBuilder extends Module
'title' => $this->l('Save'), 'title' => $this->l('Save'),
) )
); );
$form_extrafield = array( $form_extrafield = array(
'legend' => array( 'legend' => array(
@@ -1168,7 +1168,7 @@ class APPageBuilder extends Module
{ {
$this->context->controller->addCss(apPageHelper::getCssDir().'style.css'); $this->context->controller->addCss(apPageHelper::getCssDir().'style.css');
$result = array(); $result = array();
foreach ($form_general['input'] as $form) { foreach ($form_general['input'] as $form) {
//$form['name'] = isset($form['name']) ? $form['name'] : ''; //$form['name'] = isset($form['name']) ? $form['name'] : '';
if (Configuration::hasKey($form['name'])) { if (Configuration::hasKey($form['name'])) {
@@ -1177,7 +1177,7 @@ class APPageBuilder extends Module
$result[$form['name']] = Tools::getValue($form['name'], isset($form['default']) ? $form['default'] : ''); $result[$form['name']] = Tools::getValue($form['name'], isset($form['default']) ? $form['default'] : '');
} }
} }
foreach ($form_extrafield['input'] as $form) { foreach ($form_extrafield['input'] as $form) {
//$form['name'] = isset($form['name']) ? $form['name'] : ''; //$form['name'] = isset($form['name']) ? $form['name'] : '';
if (Configuration::hasKey($form['name'])) { if (Configuration::hasKey($form['name'])) {
@@ -1239,7 +1239,7 @@ class APPageBuilder extends Module
$assign['apLiveEdit'] .= '" target="_blank"><i class="icon-pencil"></i> <span>Edit</span></a>'; $assign['apLiveEdit'] .= '" target="_blank"><i class="icon-pencil"></i> <span>Edit</span></a>';
$assign['apLiveEditEnd'] = '</div>'; $assign['apLiveEditEnd'] = '</div>';
} }
if ($assign) { if ($assign) {
foreach ($assign as $key => $ass) { foreach ($assign as $key => $ass) {
$this->smarty->assign(array($key => $ass)); $this->smarty->assign(array($key => $ass));
@@ -1315,12 +1315,12 @@ class APPageBuilder extends Module
if ($value_by_categories) { if ($value_by_categories) {
$id_categories = isset($params['categorybox']) ? $params['categorybox'] : ''; $id_categories = isset($params['categorybox']) ? $params['categorybox'] : '';
$id_categories = apPageHelper::addonValidInt( $id_categories ); # We validate id_categories in apPageHelper::addonValidInt function . This function is used at any where $id_categories = apPageHelper::addonValidInt( $id_categories ); # We validate id_categories in apPageHelper::addonValidInt function . This function is used at any where
if (isset($params['category_type']) && $params['category_type'] == 'default') { if (isset($params['category_type']) && $params['category_type'] == 'default') {
$where .= ' AND product_shop.`id_category_default` IN ('.pSQL($id_categories).')'; $where .= ' AND product_shop.`id_category_default` IN ('.pSQL($id_categories).')';
} else { } else {
$sql_join .= ' INNER JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product= p.`id_product` )'; $sql_join .= ' INNER JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product= p.`id_product` )';
$where .= ' AND cp.`id_category` IN ('.pSQL($id_categories).')'; $where .= ' AND cp.`id_category` IN ('.pSQL($id_categories).')';
$sql_group = ' GROUP BY p.id_product'; $sql_group = ' GROUP BY p.id_product';
} }
@@ -1384,7 +1384,7 @@ class APPageBuilder extends Module
} }
$where .= ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')'; $where .= ' AND p.`id_product` IN ('.((is_array($tab_id_product) && count($tab_id_product)) ? implode(', ', $tab_id_product) : 0).')';
} }
$sql = 'SELECT p.*, product_shop.*, p.`reference`, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, $sql = 'SELECT p.*, product_shop.*, p.`reference`, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity,
product_attribute_shop.id_product_attribute, product_attribute_shop.id_product_attribute,
product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity, product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity,
@@ -1402,7 +1402,7 @@ class APPageBuilder extends Module
} else { } else {
$sql .= ' FROM `'._DB_PREFIX_.'product` p'; $sql .= ' FROM `'._DB_PREFIX_.'product` p';
} }
$sql .= ' INNER JOIN '._DB_PREFIX_.'product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = '.(int)$context->shop->id.') $sql .= ' INNER JOIN '._DB_PREFIX_.'product_shop product_shop ON (product_shop.id_product = p.id_product AND product_shop.id_shop = '.(int)$context->shop->id.')
LEFT JOIN '._DB_PREFIX_.'product_attribute_shop product_attribute_shop ON p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.' LEFT JOIN '._DB_PREFIX_.'product_attribute_shop product_attribute_shop ON p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.'
'.ProductCore::sqlStock('p', 'product_attribute_shop', false, $context->shop).' '.ProductCore::sqlStock('p', 'product_attribute_shop', false, $context->shop).'
@@ -1452,14 +1452,14 @@ class APPageBuilder extends Module
) )
); );
Configuration::updateValue('shortcode_url_add', $this->context->link->getAdminLink('AdminApPageBuilderShortcode')); Configuration::updateValue('shortcode_url_add', $this->context->link->getAdminLink('AdminApPageBuilderShortcode'));
$this->autoRestoreSampleData(); $this->autoRestoreSampleData();
} }
public function hookdisplayHeader() public function hookdisplayHeader()
{ {
apPageHelper::autoUpdateModule(); apPageHelper::autoUpdateModule();
if ( Tools::getIsset('leo_support_team') && (int)Tools::getValue('leo_support_team') == 1) { if ( Tools::getIsset('leo_support_team') && (int)Tools::getValue('leo_support_team') == 1) {
Configuration::updateValue('LEO_SUPPORT_TEAM', '1'); Configuration::updateValue('LEO_SUPPORT_TEAM', '1');
die('update'); die('update');
@@ -1467,7 +1467,7 @@ class APPageBuilder extends Module
Configuration::updateValue('LEO_SUPPORT_TEAM', '0'); Configuration::updateValue('LEO_SUPPORT_TEAM', '0');
die('update'); die('update');
} }
if (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront'))) { if (isset(Context::getContext()->controller->controller_type) && in_array(Context::getContext()->controller->controller_type, array('front', 'modulefront'))) {
# WORK AT FRONTEND # WORK AT FRONTEND
apPageHelper::loadShortCode(_PS_THEME_DIR_); apPageHelper::loadShortCode(_PS_THEME_DIR_);
@@ -1479,12 +1479,12 @@ class APPageBuilder extends Module
# FIX 1.7 # FIX 1.7
apPageHelper::setGlobalVariable($this->context); apPageHelper::setGlobalVariable($this->context);
} }
if (Configuration::get('APPAGEBUILDER_LOAD_WAYPOINTS')) { if (Configuration::get('APPAGEBUILDER_LOAD_WAYPOINTS')) {
$uri = apPageHelper::getCssDir().'animate.css'; $uri = apPageHelper::getCssDir().'animate.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'waypoints.min.js'; $uri = apPageHelper::getJsDir().'waypoints.min.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1501,7 +1501,7 @@ class APPageBuilder extends Module
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getCssDir().'owl.theme.css'; $uri = apPageHelper::getCssDir().'owl.theme.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'owl.carousel.js'; $uri = apPageHelper::getJsDir().'owl.carousel.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1509,7 +1509,7 @@ class APPageBuilder extends Module
if (Configuration::get('APPAGEBUILDER_LOAD_SWIPER')) { if (Configuration::get('APPAGEBUILDER_LOAD_SWIPER')) {
$uri = apPageHelper::getCssDir().'swiper.min.css'; $uri = apPageHelper::getCssDir().'swiper.min.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'swiper.min.js'; $uri = apPageHelper::getJsDir().'swiper.min.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1557,12 +1557,12 @@ class APPageBuilder extends Module
if ($product_list_image) { if ($product_list_image) {
$this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll')); $this->context->controller->addJqueryPlugin(array('scrollTo', 'serialScroll'));
} }
// add js for html5 youtube video // add js for html5 youtube video
if (Configuration::get('APPAGEBUILDER_LOAD_HTML5VIDEO')) { if (Configuration::get('APPAGEBUILDER_LOAD_HTML5VIDEO')) {
$uri = apPageHelper::getCssDir().'mediaelementplayer.min.css'; $uri = apPageHelper::getCssDir().'mediaelementplayer.min.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'mediaelement-and-player.js'; $uri = apPageHelper::getJsDir().'mediaelement-and-player.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1570,7 +1570,7 @@ class APPageBuilder extends Module
if (Configuration::get('APPAGEBUILDER_LOAD_FULLPAGEJS')) { if (Configuration::get('APPAGEBUILDER_LOAD_FULLPAGEJS')) {
$uri = apPageHelper::getCssDir().'jquery.fullPage.css'; $uri = apPageHelper::getCssDir().'jquery.fullPage.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'jquery.fullPage.js'; $uri = apPageHelper::getJsDir().'jquery.fullPage.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1578,7 +1578,7 @@ class APPageBuilder extends Module
if (Configuration::get('APPAGEBUILDER_LOAD_IMAGE360')) { if (Configuration::get('APPAGEBUILDER_LOAD_IMAGE360')) {
$uri = apPageHelper::getCssDir().'ApImage360.css'; $uri = apPageHelper::getCssDir().'ApImage360.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'ApImage360.js'; $uri = apPageHelper::getJsDir().'ApImage360.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
$this->context->controller->addJqueryUI('ui.slider'); $this->context->controller->addJqueryUI('ui.slider');
@@ -1587,7 +1587,7 @@ class APPageBuilder extends Module
if (Configuration::get('APPAGEBUILDER_LOAD_IMAGEHOTPOT')) { if (Configuration::get('APPAGEBUILDER_LOAD_IMAGEHOTPOT')) {
$uri = apPageHelper::getCssDir().'ApImageHotspot.css'; $uri = apPageHelper::getCssDir().'ApImageHotspot.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'ApImageHotspot.js'; $uri = apPageHelper::getJsDir().'ApImageHotspot.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -1598,20 +1598,20 @@ class APPageBuilder extends Module
$uri = apPageHelper::getCssDir().'styles.css'; $uri = apPageHelper::getCssDir().'styles.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
//DONGND:: add unique css file, css of module for all theme, no need override //DONGND:: add unique css file, css of module for all theme, no need override
$uri = apPageHelper::getCssDir().'unique.css'; $uri = apPageHelper::getCssDir().'unique.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'script.js'; $uri = apPageHelper::getJsDir().'script.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
if (!$this->product_active) { if (!$this->product_active) {
$this->product_active = ApPageBuilderProductsModel::getActive(); $this->product_active = ApPageBuilderProductsModel::getActive();
} }
$this->smarty->smarty->assign(array('productClassWidget' => $this->product_active['class'])); $this->smarty->smarty->assign(array('productClassWidget' => $this->product_active['class']));
$tpl_file = apPageHelper::getConfigDir('theme_profiles') . $this->product_active['plist_key'].'.tpl'; $tpl_file = apPageHelper::getConfigDir('theme_profiles') . $this->product_active['plist_key'].'.tpl';
if (is_file($tpl_file)) { if (is_file($tpl_file)) {
$this->smarty->smarty->assign(array('productProfileDefault' => $this->product_active['plist_key'])); $this->smarty->smarty->assign(array('productProfileDefault' => $this->product_active['plist_key']));
} }
@@ -1626,7 +1626,7 @@ class APPageBuilder extends Module
'mediumSize' => Image::getSize(ImageType::getFormattedName('medium')) 'mediumSize' => Image::getSize(ImageType::getFormattedName('medium'))
)); ));
} }
# LEOTEMCP # LEOTEMCP
$isRTL = $this->context->language->is_rtl; $isRTL = $this->context->language->is_rtl;
$leoRTL = $this->context->language->is_rtl; $leoRTL = $this->context->language->is_rtl;
@@ -1640,7 +1640,7 @@ class APPageBuilder extends Module
break; break;
} }
} }
if ($rtl_file) { if ($rtl_file) {
$leoRTL = false; // to remove class RTL $leoRTL = false; // to remove class RTL
// $this->context->controller->unregisterStylesheet('theme-rtl'); // $this->context->controller->unregisterStylesheet('theme-rtl');
@@ -1650,11 +1650,11 @@ class APPageBuilder extends Module
} }
// $id_shop = $this->context->shop->id; // $id_shop = $this->context->shop->id;
// $helper = LeoFrameworkHelper::getInstance(); // $helper = LeoFrameworkHelper::getInstance();
$this->themeCookieName = $this->getConfigName('PANEL_CONFIG'); $this->themeCookieName = $this->getConfigName('PANEL_CONFIG');
$panelTool = $this->getConfig('PANELTOOL'); $panelTool = $this->getConfig('PANELTOOL');
$backGroundValue = ''; $backGroundValue = '';
//DONGND:: get product detail layout //DONGND:: get product detail layout
$list_productdetail_layout = array(); $list_productdetail_layout = array();
@@ -1664,17 +1664,17 @@ class APPageBuilder extends Module
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getCssDir().'paneltool.css'; $uri = apPageHelper::getCssDir().'paneltool.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'colorpicker/js/colorpicker.js'; $uri = apPageHelper::getJsDir().'colorpicker/js/colorpicker.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'paneltool.js'; $uri = apPageHelper::getJsDir().'paneltool.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
$this->context->controller->addJqueryPlugin('cooki-plugin'); $this->context->controller->addJqueryPlugin('cooki-plugin');
$skin = $this->getPanelConfig('default_skin'); $skin = $this->getPanelConfig('default_skin');
$layout_mode = $this->getPanelConfig('layout_mode'); $layout_mode = $this->getPanelConfig('layout_mode');
$enable_fheader = (int)$this->getPanelConfig('enable_fheader'); $enable_fheader = (int)$this->getPanelConfig('enable_fheader');
$backGroundValue = array( $backGroundValue = array(
'attachment' => array('scroll', 'fixed', 'local', 'initial', 'inherit'), 'attachment' => array('scroll', 'fixed', 'local', 'initial', 'inherit'),
'repeat' => array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'), 'repeat' => array('repeat', 'repeat-x', 'repeat-y', 'no-repeat', 'initial', 'inherit'),
@@ -1720,7 +1720,7 @@ class APPageBuilder extends Module
$this->context->controller->addJqueryPlugin('cooki-plugin'); $this->context->controller->addJqueryPlugin('cooki-plugin');
} }
} }
// if ($this->getConfig('ENABLE_CUSTOMFONT')) { // if ($this->getConfig('ENABLE_CUSTOMFONT')) {
// # CUSTOM FONT // # CUSTOM FONT
// $uri = apPageHelper::getCssDir().'fonts-cuttom.css'; // $uri = apPageHelper::getCssDir().'fonts-cuttom.css';
@@ -1731,7 +1731,7 @@ class APPageBuilder extends Module
$uri = apPageHelper::getCssDir().'fonts-cuttom2.css'; $uri = apPageHelper::getCssDir().'fonts-cuttom2.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
} }
$layout_width_val = ''; $layout_width_val = '';
$layout_width = $this->getConfig('layout_width'); $layout_width = $this->getConfig('layout_width');
if (trim($layout_width) != 'auto' && trim($layout_width) != '') { if (trim($layout_width) != 'auto' && trim($layout_width) != '') {
@@ -1742,7 +1742,7 @@ class APPageBuilder extends Module
$layout_width_val .= '<script type="text/javascript">layout_width = '.$layout_width.';</script>'; $layout_width_val .= '<script type="text/javascript">layout_width = '.$layout_width.';</script>';
} }
} }
$load_css_type = $this->getConfig('load_css_type'); $load_css_type = $this->getConfig('load_css_type');
$css_skin = array(); $css_skin = array();
$css_custom = array(); $css_custom = array();
@@ -1752,19 +1752,19 @@ class APPageBuilder extends Module
$uri = apPageHelper::getCssDir().'non-responsive.css'; $uri = apPageHelper::getCssDir().'non-responsive.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
} }
# LOAD SKIN CSS IN MODULE # LOAD SKIN CSS IN MODULE
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css'; $uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/custom-rtl.css'; $uri = apPageHelper::getCssDir().'skins/'.$skin.'/custom-rtl.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
# LOAD CUSTOM CSS # LOAD CUSTOM CSS
if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) { if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) {
$uri = apPageHelper::getCssDir().'mobile.css'; $uri = apPageHelper::getCssDir().'mobile.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
} }
# LOAD POSITIONS AND PROFILES # LOAD POSITIONS AND PROFILES
$this->loadResouceForProfile(); $this->loadResouceForProfile();
@@ -1782,7 +1782,7 @@ class APPageBuilder extends Module
$css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />'; $css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
} }
} }
# LOAD SKIN CSS IN TPL # LOAD SKIN CSS IN TPL
$uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css'; $uri = apPageHelper::getCssDir().'skins/'.$skin.'/skin.css';
$skinFileUrl = apPageHelper::getFullPathCss($uri); $skinFileUrl = apPageHelper::getFullPathCss($uri);
@@ -1794,7 +1794,7 @@ class APPageBuilder extends Module
if ($leoRTL && $skinFileUrl !== false) { if ($leoRTL && $skinFileUrl !== false) {
$css_skin[] = '<link rel="stylesheet" id="leo-dynamic-skin-css-rtl" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />'; $css_skin[] = '<link rel="stylesheet" id="leo-dynamic-skin-css-rtl" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
} }
# LOAD CUSTOM CSS # LOAD CUSTOM CSS
if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) { if ($this->context->getMobileDevice() != false && !$this->getConfig('enable_responsive')) {
$uri = apPageHelper::getCssDir().'mobile.css'; $uri = apPageHelper::getCssDir().'mobile.css';
@@ -1803,10 +1803,10 @@ class APPageBuilder extends Module
$css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />'; $css_skin[] = '<link rel="stylesheet" href="'.apPageHelper::getUriFromPath($skinFileUrl).'" type="text/css" media="all" />';
} }
} }
# LOAD POSITIONS AND PROFILES # LOAD POSITIONS AND PROFILES
$this->loadResouceForProfile(); $this->loadResouceForProfile();
# LOAD PATTERN # LOAD PATTERN
if ($profile = $this->getConfig('c_profile')) { if ($profile = $this->getConfig('c_profile')) {
$uri = apPageHelper::getCssDir().'patterns/'.$profile.'.css'; $uri = apPageHelper::getCssDir().'patterns/'.$profile.'.css';
@@ -1816,7 +1816,7 @@ class APPageBuilder extends Module
} }
} }
} }
if ($this->context->language->is_rtl) { if ($this->context->language->is_rtl) {
# OVERRIDE CORE, LOAD RTL.CSS FILE AT BOTTOM # OVERRIDE CORE, LOAD RTL.CSS FILE AT BOTTOM
$this->context->controller->registerStylesheet('theme-rtl', '/assets/css/rtl.css', ['media' => 'all', 'priority' => 9000]); $this->context->controller->registerStylesheet('theme-rtl', '/assets/css/rtl.css', ['media' => 'all', 'priority' => 9000]);
@@ -1926,24 +1926,25 @@ class APPageBuilder extends Module
$cache_id = $this->getCacheId('apshortcode', $shortcode_key); $cache_id = $this->getCacheId('apshortcode', $shortcode_key);
if ($disable_cache || !$this->isCached($this->templateFile, $cache_id)) { if ($disable_cache || !$this->isCached($this->templateFile, $cache_id)) {
$shortcode_html = ''; $shortcode_html = '';
$shortcode_obj = ApPageBuilderShortcodeModel::getShortCode($shortcode_key); $shortcode_obj = ApPageBuilderShortcodeModel::getShortCode($shortcode_key);
if (isset($shortcode_obj['id_appagebuilder']) && $shortcode_obj['id_appagebuilder'] != '' && $shortcode_obj['id_appagebuilder'] != 0) { if (isset($shortcode_obj['id_appagebuilder']) && $shortcode_obj['id_appagebuilder'] != '' && $shortcode_obj['id_appagebuilder'] != 0) {
$shortcode_code = ApPageBuilderShortcodeModel::getAllItems($shortcode_obj['id_appagebuilder'], 1); $shortcode_code = ApPageBuilderShortcodeModel::getAllItems($shortcode_obj['id_appagebuilder'], 1);
if (!empty($shortcode_code)) { if (!empty($shortcode_code)) {
if (empty(ApShortCodesBuilder::$shortcode_tags)) { if (empty(ApShortCodesBuilder::$shortcode_tags)) {
apPageHelper::loadShortCode(_PS_THEME_DIR_); apPageHelper::loadShortCode(_PS_THEME_DIR_);
} }
apPageHelper::setGlobalVariable($this->context); apPageHelper::setGlobalVariable($this->context);
// ApShortCodesBuilder::$is_front_office = 1; // ApShortCodesBuilder::$is_front_office = 1;
// ApShortCodesBuilder::$is_gen_html = 1; // ApShortCodesBuilder::$is_gen_html = 1;
// ApShortCodesBuilder::$profile_param = array(); // ApShortCodesBuilder::$profile_param = array();
$ap_helper = new ApShortCodesBuilder(); $ap_helper = new ApShortCodesBuilder();
// ApShortCodesBuilder::$hook_name = 'apshortcode'; // ApShortCodesBuilder::$hook_name = 'apshortcode';
$shortcode_html = $ap_helper->parse($shortcode_code['apshortcode']); $shortcode_html = $ap_helper->parse($shortcode_code['apshortcode']);
} }
} }
@@ -2005,7 +2006,7 @@ class APPageBuilder extends Module
} }
return $cover_hook_live.$this->fetch( $this->templateFile, $cache_id); return $cover_hook_live.$this->fetch( $this->templateFile, $cache_id);
} }
public function hookDisplayBanner($params) public function hookDisplayBanner($params)
{ {
return $this->processHook('displayBanner', $params); return $this->processHook('displayBanner', $params);
@@ -2080,23 +2081,23 @@ class APPageBuilder extends Module
{ {
return $this->processHook('displayLeftColumnProduct', $params); return $this->processHook('displayLeftColumnProduct', $params);
} }
public function hookdisplayProductButtons($params) public function hookdisplayProductButtons($params)
{ {
return $this->processHook('displayProductButtons', $params); return $this->processHook('displayProductButtons', $params);
} }
public function hookDisplayReassurance($params) public function hookDisplayReassurance($params)
{ {
return $this->processHook('displayReassurance', $params); return $this->processHook('displayReassurance', $params);
} }
public function hookDisplayLeoProfileProduct($params) public function hookDisplayLeoProfileProduct($params)
{ {
apPageHelper::setGlobalVariable($this->context); apPageHelper::setGlobalVariable($this->context);
$html = ''; $html = '';
$tpl_file = ''; $tpl_file = '';
if (isset($params['ony_global_variable'])) { if (isset($params['ony_global_variable'])) {
# {hook h='displayLeoProfileProduct' ony_global_variable=true} # {hook h='displayLeoProfileProduct' ony_global_variable=true}
return $html; return $html;
@@ -2148,7 +2149,7 @@ class APPageBuilder extends Module
// $this->unregisterExceptions((int)$row['id_hook']); // $this->unregisterExceptions((int)$row['id_hook']);
// } // }
} }
/** /**
* FIX BUG 1.7.3.3 : install theme lose hook displayHome, displayLeoProfileProduct * FIX BUG 1.7.3.3 : install theme lose hook displayHome, displayLeoProfileProduct
* because ajax not run hookActionAdminBefore(); * because ajax not run hookActionAdminBefore();
@@ -2163,7 +2164,7 @@ class APPageBuilder extends Module
)); ));
} }
} }
/** /**
* Run only one when install/change Theme_of_Leo * Run only one when install/change Theme_of_Leo
*/ */
@@ -2176,8 +2177,8 @@ class APPageBuilder extends Module
// Other module call this hook -> duplicate data // Other module call this hook -> duplicate data
return; return;
} }
# FIX : update Prestashop by 1-Click module -> NOT NEED RESTORE DATABASE # FIX : update Prestashop by 1-Click module -> NOT NEED RESTORE DATABASE
$ap_version = Configuration::get('AP_CURRENT_VERSION'); $ap_version = Configuration::get('AP_CURRENT_VERSION');
if ($ap_version != false) { if ($ap_version != false) {
@@ -2189,8 +2190,8 @@ class APPageBuilder extends Module
return; return;
} }
} }
# WHENE INSTALL THEME, INSERT HOOK FROM DATASAMPLE IN THEME # WHENE INSTALL THEME, INSERT HOOK FROM DATASAMPLE IN THEME
$hook_from_theme = false; $hook_from_theme = false;
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) { if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
@@ -2200,36 +2201,36 @@ class APPageBuilder extends Module
$hook_from_theme = true; $hook_from_theme = true;
}; };
} }
# INSERT HOOK FROM MODULE_DATASAMPLE # INSERT HOOK FROM MODULE_DATASAMPLE
if ($hook_from_theme == false) { if ($hook_from_theme == false) {
$this->registerLeoHook(); $this->registerLeoHook();
} }
# WHEN INSTALL MODULE, NOT NEED RESTORE DATABASE IN THEME # WHEN INSTALL MODULE, NOT NEED RESTORE DATABASE IN THEME
$install_module = (int)Configuration::get('AP_INSTALLED_APPAGEBUILDER', 0); $install_module = (int)Configuration::get('AP_INSTALLED_APPAGEBUILDER', 0);
if ($install_module) { if ($install_module) {
Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '0'); // next : allow restore sample Configuration::updateValue('AP_INSTALLED_APPAGEBUILDER', '0'); // next : allow restore sample
return; return;
} }
# INSERT DATABASE FROM THEME_DATASAMPLE # INSERT DATABASE FROM THEME_DATASAMPLE
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) { if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php'); require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php');
$sample = new Datasample(); $sample = new Datasample();
$sample->processImport($this->name); $sample->processImport($this->name);
} }
# REMOVE FILE INDEX.PHP FOR TRANSLATE # REMOVE FILE INDEX.PHP FOR TRANSLATE
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php')) { if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php')) {
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php'); require_once(_PS_MODULE_DIR_.'appagebuilder/libs/setup.php');
ApPageSetup::processTranslateTheme(); ApPageSetup::processTranslateTheme();
} }
# REMOVE SUPPORT TEAM FIX LINK CSS, JS # REMOVE SUPPORT TEAM FIX LINK CSS, JS
Configuration::updateValue('LEO_SUPPORT_TEAM', '0'); Configuration::updateValue('LEO_SUPPORT_TEAM', '0');
} }
protected function getCacheId($hook_name = null, $shortcode_key = null) protected function getCacheId($hook_name = null, $shortcode_key = null)
{ {
$cache_array = array(); $cache_array = array();
@@ -2287,12 +2288,12 @@ class APPageBuilder extends Module
if (Tools::getValue('footer') && Tools::getIsset('leopanelchange') && (in_array($hook_name, ApPageSetting::getHook('footer')) || $hook_name == 'pagebuilderConfig|footer')) { if (Tools::getValue('footer') && Tools::getIsset('leopanelchange') && (in_array($hook_name, ApPageSetting::getHook('footer')) || $hook_name == 'pagebuilderConfig|footer')) {
$cache_array[] = 'footer_'.Tools::getValue('footer'); $cache_array[] = 'footer_'.Tools::getValue('footer');
} }
//DONGND:: update cache for shortcode //DONGND:: update cache for shortcode
if ($shortcode_key) { if ($shortcode_key) {
$cache_array[] = 'shortcodekey_'.$shortcode_key; $cache_array[] = 'shortcodekey_'.$shortcode_key;
} }
return implode('|', $cache_array); return implode('|', $cache_array);
} }
@@ -2372,12 +2373,12 @@ class APPageBuilder extends Module
// $this->_clearCache('appagebuilder.tpl', $this->name); // $this->_clearCache('appagebuilder.tpl', $this->name);
$this->_clearCache($this->templateFile); # CLEAR CACHE ALL HOOKS $this->_clearCache($this->templateFile); # CLEAR CACHE ALL HOOKS
} }
//DONGND:: add clear cache for shortcode //DONGND:: add clear cache for shortcode
public function clearShortCodeCache($shortcode_key) public function clearShortCodeCache($shortcode_key)
{ {
$cache_id = $this->getCacheId('apshortcode', $shortcode_key); $cache_id = $this->getCacheId('apshortcode', $shortcode_key);
$this->_clearCache('appagebuilder.tpl', $cache_id); $this->_clearCache('appagebuilder.tpl', $cache_id);
} }
@@ -2457,19 +2458,19 @@ class APPageBuilder extends Module
if ($list_positions) { if ($list_positions) {
foreach ($list_positions as $item) { foreach ($list_positions as $item) {
$name = $item['position'].$item['position_key']; $name = $item['position'].$item['position_key'];
$uri = apPageHelper::getCssDir().'positions/'.$name.'.css'; $uri = apPageHelper::getCssDir().'positions/'.$name.'.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'positions/'.$name.'.js'; $uri = apPageHelper::getJsDir().'positions/'.$name.'.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
} }
} }
$uri = apPageHelper::getCssDir().'profiles/'.$profile['profile_key'].'.css'; $uri = apPageHelper::getCssDir().'profiles/'.$profile['profile_key'].'.css';
$this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000)); $this->context->controller->registerStylesheet(sha1($uri), $uri, array('media' => 'all', 'priority' => 8000));
$uri = apPageHelper::getJsDir().'profiles/'.$profile['profile_key'].'.js'; $uri = apPageHelper::getJsDir().'profiles/'.$profile['profile_key'].'.js';
$this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000)); $this->context->controller->registerJavascript(sha1($uri), $uri, array('position' => 'bottom', 'priority' => 8000));
} }
@@ -2662,7 +2663,7 @@ class APPageBuilder extends Module
} }
return $obj; return $obj;
} }
public function hookModuleRoutes($params) public function hookModuleRoutes($params)
{ {
$routes = array(); $routes = array();
@@ -2834,7 +2835,7 @@ class APPageBuilder extends Module
$return .= '</div>'; $return .= '</div>';
return $return; return $return;
} }
/** /**
* alias from apPageHelper::getConfig() * alias from apPageHelper::getConfig()
*/ */
@@ -2842,7 +2843,7 @@ class APPageBuilder extends Module
{ {
return apPageHelper::getConfigName($name); return apPageHelper::getConfigName($name);
} }
/** /**
* alias from apPageHelper::getConfig() * alias from apPageHelper::getConfig()
*/ */
@@ -2850,7 +2851,7 @@ class APPageBuilder extends Module
{ {
return apPageHelper::getConfig($name); return apPageHelper::getConfig($name);
} }
/** /**
* get Value of configuration based on actived theme * get Value of configuration based on actived theme
*/ */
@@ -2862,7 +2863,7 @@ class APPageBuilder extends Module
} }
$cookie = LeoFrameworkHelper::getCookie(); $cookie = LeoFrameworkHelper::getCookie();
if (isset($cookie[$this->themeCookieName.'_'.$key])) { if (isset($cookie[$this->themeCookieName.'_'.$key])) {
return $cookie[$this->themeCookieName.'_'.$key]; return $cookie[$this->themeCookieName.'_'.$key];
} }
@@ -2904,16 +2905,16 @@ class APPageBuilder extends Module
} }
# register hook to show when paging # register hook to show when paging
$this->registerHook('pagebuilderConfig'); $this->registerHook('pagebuilderConfig');
# register hook to show category and tags of product # register hook to show category and tags of product
$this->registerHook('displayProductInformation'); $this->registerHook('displayProductInformation');
# register hook again to after install/change theme # register hook again to after install/change theme
$this->registerHook('actionObjectShopUpdateAfter'); $this->registerHook('actionObjectShopUpdateAfter');
# Multishop create new shop # Multishop create new shop
$this->registerHook('actionAdminShopControllerSaveAfter'); $this->registerHook('actionAdminShopControllerSaveAfter');
$this->registerHook('displayProductButtons'); $this->registerHook('displayProductButtons');
$this->registerHook('displayReassurance'); $this->registerHook('displayReassurance');
$this->registerHook('displayLeoProfileProduct'); $this->registerHook('displayLeoProfileProduct');
@@ -2931,7 +2932,7 @@ class APPageBuilder extends Module
$this->registerHook('actionAdminControllerSetMedia'); $this->registerHook('actionAdminControllerSetMedia');
return $res; return $res;
} }
/** /**
* @Action Create new shop, choose theme then auto restore datasample. * @Action Create new shop, choose theme then auto restore datasample.
*/ */
@@ -2941,7 +2942,7 @@ class APPageBuilder extends Module
&& Tools::getIsset('submitAddshop') !== false && Tools::getValue('submitAddshop') && Tools::getIsset('submitAddshop') !== false && Tools::getValue('submitAddshop')
&& Tools::getIsset('theme_name') !== false && Tools::getValue('theme_name')) { && Tools::getIsset('theme_name') !== false && Tools::getValue('theme_name')) {
$shop = $param['return']; $shop = $param['return'];
if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) { if (file_exists(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php')) {
require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php'); require_once(_PS_MODULE_DIR_.'appagebuilder/libs/LeoDataSample.php');
$sample = new Datasample(); $sample = new Datasample();
@@ -2954,16 +2955,16 @@ class APPageBuilder extends Module
public function hookDisplayBackOfficeCategory($params) public function hookDisplayBackOfficeCategory($params)
{ {
if (Validate::isLoadedObject($category = new Category((int)Tools::getValue('id_category')))) { if (Validate::isLoadedObject($category = new Category((int)Tools::getValue('id_category')))) {
// validate module // validate module
unset($category); unset($category);
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$category_layouts = array(); $category_layouts = array();
$id_category = Tools::getValue('id_category'); $id_category = Tools::getValue('id_category');
if (is_dir(apPageHelper::getConfigDir('theme_profiles'))) { if (is_dir(apPageHelper::getConfigDir('theme_profiles'))) {
//DONGND:: fix get list product list via database //DONGND:: fix get list product list via database
$sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_products p $sql = 'SELECT * FROM '._DB_PREFIX_.'appagebuilder_products p
@@ -3012,7 +3013,7 @@ class APPageBuilder extends Module
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$sql = 'SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' AND id_shop = \''.(int)$id_shop.'\''; $sql = 'SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' AND id_shop = \''.(int)$id_shop.'\'';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($result) { if ($result) {
if ($aplayout == 'default') { if ($aplayout == 'default') {
Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' and id_shop=\''.(int)$id_shop.'\''); Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` where id_category = \''.(int)$id_category.'\' and id_shop=\''.(int)$id_shop.'\'');
@@ -3095,7 +3096,7 @@ class APPageBuilder extends Module
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$sql = 'SELECT * from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' AND id_shop = '.(int)$id_shop; $sql = 'SELECT * from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' AND id_shop = '.(int)$id_shop;
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql);
if ($result) { if ($result) {
if ($aplayout == 'default') { if ($aplayout == 'default') {
Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' and id_shop='.(int)$id_shop); Db::getInstance()->execute('DELETE from `'._DB_PREFIX_.'appagebuilder_page` WHERE id_product = '.(int)$id_product.' and id_shop='.(int)$id_shop);
@@ -3107,7 +3108,7 @@ class APPageBuilder extends Module
Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'appagebuilder_page` (`id_product`,`id_category`,`page`,`id_shop`) VALUES ('.(int)$id_product.',0,\''.pSQL($aplayout).'\','.(int)$id_shop.')'); Db::getInstance()->execute('INSERT INTO `'._DB_PREFIX_.'appagebuilder_page` (`id_product`,`id_category`,`page`,`id_shop`) VALUES ('.(int)$id_product.',0,\''.pSQL($aplayout).'\','.(int)$id_shop.')');
} }
} }
if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) { if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) {
//save for extrafield //save for extrafield
$sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`'; $sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`';
@@ -3151,7 +3152,7 @@ class APPageBuilder extends Module
if (Validate::isLoadedObject($product = new Product((int)$params['id_product']))) { if (Validate::isLoadedObject($product = new Product((int)$params['id_product']))) {
// validate module // validate module
unset($product); unset($product);
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$extrafied = array(); $extrafied = array();
$data_fields = array(); $data_fields = array();
@@ -3159,7 +3160,7 @@ class APPageBuilder extends Module
if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) { if (Configuration::get('APPAGEBUILDER_PRODUCT_TEXTEXTRA') || Configuration::get('APPAGEBUILDER_PRODUCT_EDITOREXTRA')) {
$sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`'; $sql = 'SHOW FIELDS FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'`';
$result = Db::getInstance()->executeS($sql); $result = Db::getInstance()->executeS($sql);
$rows = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'` WHERE id_product="'.(int)$params['id_product'].'" AND id_shop="'.(int)$id_shop.'"'); $rows = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'appagebuilder_extrapro' .'` WHERE id_product="'.(int)$params['id_product'].'" AND id_shop="'.(int)$id_shop.'"');
foreach ($result as $value) { foreach ($result as $value) {
@@ -3185,7 +3186,7 @@ class APPageBuilder extends Module
'default_language' => $this->default_language, 'default_language' => $this->default_language,
'current_layout' => Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_product = \''.(int)$params['id_product'].'\' AND id_shop = \''.(int)$id_shop.'\'') 'current_layout' => Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('SELECT page from `'._DB_PREFIX_.'appagebuilder_page` where id_product = \''.(int)$params['id_product'].'\' AND id_shop = \''.(int)$id_shop.'\'')
)); ));
return $this->display(__FILE__, 'productExtra.tpl'); return $this->display(__FILE__, 'productExtra.tpl');
} }
} }
@@ -3227,7 +3228,7 @@ class APPageBuilder extends Module
return $params; return $params;
} }
/** /**
* PERMISSION ACCOUNT demo@demo.com * PERMISSION ACCOUNT demo@demo.com
*/ */
@@ -3240,10 +3241,10 @@ class APPageBuilder extends Module
$view = Module::getPermissionStatic($this->id, 'view', $employee); $view = Module::getPermissionStatic($this->id, 'view', $employee);
return ($configure || $view); return ($configure || $view);
} }
return Module::getPermissionStatic($this->id, $variable, $employee); return Module::getPermissionStatic($this->id, $variable, $employee);
} }
/** /**
* PERMISSION ACCOUNT demo@demo.com * PERMISSION ACCOUNT demo@demo.com
*/ */

View File

@@ -37,46 +37,46 @@ class ApPageBuilderShortcodeModel extends ObjectModel
'fields' => array( 'fields' => array(
'shortcode_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255), 'shortcode_key' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255),
// 'id_appagebuilder' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), // 'id_appagebuilder' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
'shortcode_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true, 'required' => true), 'shortcode_name' => array('type' => self::TYPE_STRING, 'validate' => 'isString', 'size' => 255, 'lang' => true, 'required' => true),
'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'), 'active' => array('type' => self::TYPE_BOOL, 'shop' => true, 'validate' => 'isBool'),
) )
); );
public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null) public function __construct($id = null, $id_lang = null, $id_shop = null, Context $context = null)
{ {
// validate module // validate module
unset($context); unset($context);
parent::__construct($id, $id_lang, $id_shop); parent::__construct($id, $id_lang, $id_shop);
} }
public function add($autodate = true, $null_values = false) public function add($autodate = true, $null_values = false)
{ {
$id_shop = apPageHelper::getIDShop(); $id_shop = apPageHelper::getIDShop();
$res = parent::add($autodate, $null_values); $res = parent::add($autodate, $null_values);
$res &= Db::getInstance()->execute(' $res &= Db::getInstance()->execute('
INSERT INTO `'._DB_PREFIX_.'appagebuilder_shortcode_shop` (`id_shop`, `id_appagebuilder_shortcode`, `active`) INSERT INTO `'._DB_PREFIX_.'appagebuilder_shortcode_shop` (`id_shop`, `id_appagebuilder_shortcode`, `active`)
VALUES('.(int)$id_shop.', '.(int)$this->id.', '.(int)$this->active.')'); VALUES('.(int)$id_shop.', '.(int)$this->id.', '.(int)$this->active.')');
return $res; return $res;
} }
public function update($nullValues = false) public function update($nullValues = false)
{ {
$id_shop = apPageHelper::getIDShop(); $id_shop = apPageHelper::getIDShop();
$res = parent::update($nullValues); $res = parent::update($nullValues);
$res &= Db::getInstance()->execute(' $res &= Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps set ps.active = '.(int)$this->active.' WHERE ps.id_shop='.(int)$id_shop.' AND ps.id_appagebuilder_shortcode = '.(int)$this->id); UPDATE `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps set ps.active = '.(int)$this->active.' WHERE ps.id_shop='.(int)$id_shop.' AND ps.id_appagebuilder_shortcode = '.(int)$this->id);
return $res; return $res;
} }
public function delete() public function delete()
{ {
$result = parent::delete(); $result = parent::delete();
if ($result) { if ($result) {
if (isset($this->def['multishop']) && $this->def['multishop'] == true) { if (isset($this->def['multishop']) && $this->def['multishop'] == true) {
# DELETE RECORD FORM TABLE _SHOP # DELETE RECORD FORM TABLE _SHOP
@@ -90,25 +90,25 @@ class ApPageBuilderShortcodeModel extends ObjectModel
Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='. Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.
(int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')'); (int)$this->id.' AND id_shop IN ('.pSQL(implode(', ', $id_shop_list)).')');
} }
//DONGND:: delete appagebuilder related shortcode //DONGND:: delete appagebuilder related shortcode
$id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode((int)$this->id); $id_appagebuilder = ApPageBuilderModel::getIdByIdShortCode((int)$this->id);
if ($id_appagebuilder) { if ($id_appagebuilder) {
$obj = new ApPageBuilderModel($id_appagebuilder); $obj = new ApPageBuilderModel($id_appagebuilder);
$obj->delete(); $obj->delete();
} }
} }
return $result; return $result;
} }
public function getShortCodeContent($id_appagebuilder = 0, $is_font = 0, $id_lang = 0) public function getShortCodeContent($id_appagebuilder = 0, $is_font = 0, $id_lang = 0)
{ {
$context = Context::getContext(); $context = Context::getContext();
$id_shop = (int)$context->shop->id; $id_shop = (int)$context->shop->id;
$where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder='.(int)$id_appagebuilder; $where = ' WHERE ps.id_shop='.(int)$id_shop.' AND p.id_appagebuilder='.(int)$id_appagebuilder;
if ($id_lang) { if ($id_lang) {
$where .= ' AND pl.id_lang = '.(int)$id_lang; $where .= ' AND pl.id_lang = '.(int)$id_lang;
} else { } else {
@@ -119,10 +119,10 @@ class ApPageBuilderShortcodeModel extends ObjectModel
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shop` ps ON (ps.id_appagebuilder = p.id_appagebuilder) LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shop` ps ON (ps.id_appagebuilder = p.id_appagebuilder)
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_lang` pl ON (pl.id_appagebuilder = p.id_appagebuilder) LEFT JOIN `'._DB_PREFIX_.'appagebuilder_lang` pl ON (pl.id_appagebuilder = p.id_appagebuilder)
LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shortcode` pp ON (p.id_appagebuilder_shortcode = pp.id_appagebuilder_shortcode) LEFT JOIN `'._DB_PREFIX_.'appagebuilder_shortcode` pp ON (p.id_appagebuilder_shortcode = pp.id_appagebuilder_shortcode)
'.pSql($where).' ORDER BY p.id_appagebuilder'; '.pSql($where).' ORDER BY p.id_appagebuilder';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
// echo '<pre>'; // echo '<pre>';
// print_r($result);die(); // print_r($result);die();
$id_langs = Language::getLanguages(true, false, true); $id_langs = Language::getLanguages(true, false, true);
@@ -132,7 +132,7 @@ class ApPageBuilderShortcodeModel extends ObjectModel
unset($result[$key]); unset($result[$key]);
} }
} }
$data_lang = array(); $data_lang = array();
if ($is_font) { if ($is_font) {
foreach ($result as $row) { foreach ($result as $row) {
@@ -177,10 +177,10 @@ class ApPageBuilderShortcodeModel extends ObjectModel
} }
$data_hook[$row['hook_name']] = $row; $data_hook[$row['hook_name']] = $row;
} }
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form); return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
} }
/** /**
* Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end * Get all items - datas of all hooks by shop Id, lang Id for front-end or back-end
* @param type $id_profiles * @param type $id_profiles
@@ -248,24 +248,24 @@ class ApPageBuilderShortcodeModel extends ObjectModel
return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form); return array('content' => $data_hook, 'dataForm' => ApShortCodesBuilder::$data_form);
} }
public static function getShortCode($shortcode_key) public static function getShortCode($shortcode_key)
{ {
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$sql = 'SELECT p.*, pp.`id_appagebuilder` FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p $sql = 'SELECT p.*, pp.`id_appagebuilder` FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`) INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
INNER JOIN `'._DB_PREFIX_.'appagebuilder` pp on(p.`id_appagebuilder_shortcode` = pp.`id_appagebuilder_shortcode`) WHERE INNER JOIN `'._DB_PREFIX_.'appagebuilder` pp on(p.`id_appagebuilder_shortcode` = pp.`id_appagebuilder_shortcode`) WHERE
p.`shortcode_key` = "'.pSQL($shortcode_key).'" AND ps.`active`= 1 AND ps.`id_shop` = '.(int)$id_shop; p.`shortcode_key` = "'.pSQL($shortcode_key).'" AND ps.`active`= 1 AND ps.`id_shop` = '.(int)$id_shop;
return Db::getInstance()->getRow($sql); return Db::getInstance()->getRow($sql);
} }
public static function getListShortCode() public static function getListShortCode()
{ {
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$id_lang = Context::getContext()->language->id; $id_lang = Context::getContext()->language->id;
$sql = 'SELECT p.*, ps.*, pl.* FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p $sql = 'SELECT p.*, ps.*, pl.* FROM `'._DB_PREFIX_.'appagebuilder_shortcode` p
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`) INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_shop` ps on(p.`id_appagebuilder_shortcode` = ps.`id_appagebuilder_shortcode`)
INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_lang` pl on(p.`id_appagebuilder_shortcode` = pl.`id_appagebuilder_shortcode`) WHERE INNER JOIN `'._DB_PREFIX_.'appagebuilder_shortcode_lang` pl on(p.`id_appagebuilder_shortcode` = pl.`id_appagebuilder_shortcode`) WHERE

View File

@@ -121,11 +121,11 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
public function postProcess() public function postProcess()
{ {
parent::postProcess(); parent::postProcess();
if (count($this->errors) > 0) { if (count($this->errors) > 0) {
return; return;
} }
if (Tools::getIsset('duplicateappagebuilder_products')) { if (Tools::getIsset('duplicateappagebuilder_products')) {
$id = Tools::getValue('id_appagebuilder_products'); $id = Tools::getValue('id_appagebuilder_products');
$model = new ApPageBuilderProductsModel($id); $model = new ApPageBuilderProductsModel($id);
@@ -147,8 +147,8 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
Tools::displayError('Can not duplicate Profiles'); Tools::displayError('Can not duplicate Profiles');
} }
} }
if (Tools::isSubmit('saveELement')) { if (Tools::isSubmit('saveELement')) {
$filecontent = Tools::getValue('filecontent'); $filecontent = Tools::getValue('filecontent');
$fileName = Tools::getValue('fileName'); $fileName = Tools::getValue('fileName');
@@ -442,7 +442,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
} }
return $object; return $object;
} }
public function displayDuplicateLink($token = null, $id = null, $name = null) public function displayDuplicateLink($token = null, $id = null, $name = null)
{ {
$controller = 'AdminApPageBuilderProducts'; $controller = 'AdminApPageBuilderProducts';
@@ -450,13 +450,13 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
$html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Product List ID '.$id.'. If you wish to proceed, click &quot;Yes&quot;. If not, click &quot;No&quot;.\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&amp;id_appagebuilder_products='.$id.'&amp;duplicateappagebuilder_products&amp;token='.$token.'\', \'#\')"> $html = '<a href="#" title="Duplicate" onclick="confirm_link(\'\', \'Duplicate Product List ID '.$id.'. If you wish to proceed, click &quot;Yes&quot;. If not, click &quot;No&quot;.\', \'Yes\', \'No\', \'index.php?controller='.$controller.'&amp;id_appagebuilder_products='.$id.'&amp;duplicateappagebuilder_products&amp;token='.$token.'\', \'#\')">
<i class="icon-copy"></i> Duplicate <i class="icon-copy"></i> Duplicate
</a>'; </a>';
// validate module // validate module
unset($name); unset($name);
return $html; return $html;
} }
/** /**
* PERMISSION ACCOUNT demo@demo.com * PERMISSION ACCOUNT demo@demo.com
* OVERRIDE CORE * OVERRIDE CORE
@@ -469,7 +469,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
} }
return parent::access($action, $disable); return parent::access($action, $disable);
} }
/** /**
* PERMISSION ACCOUNT demo@demo.com * PERMISSION ACCOUNT demo@demo.com
* OVERRIDE CORE * OVERRIDE CORE
@@ -477,7 +477,7 @@ class AdminApPageBuilderProductsController extends ModuleAdminControllerCore
public function initProcess() public function initProcess()
{ {
parent::initProcess(); parent::initProcess();
if (count($this->errors) <= 0) { if (count($this->errors) <= 0) {
if( Tools::isSubmit('duplicate'.$this->table) ) { if( Tools::isSubmit('duplicate'.$this->table) ) {
if ($this->id_object) { if ($this->id_object) {

View File

@@ -112,7 +112,6 @@ class AdminApPageBuilderProfilesController extends ModuleAdminControllerCore
public function initPageHeaderToolbar() public function initPageHeaderToolbar()
{ {
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
$this->page_header_toolbar_btn['SaveAndStay'] = array( $this->page_header_toolbar_btn['SaveAndStay'] = array(
'href' => 'javascript:void(0);', 'href' => 'javascript:void(0);',

View File

@@ -35,17 +35,17 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
public $module_path; public $module_path;
public $tpl_path; public $tpl_path;
public $theme_dir; public $theme_dir;
/** /**
* @var Array $overrideHooks * @var Array $overrideHooks
*/ */
protected $themeName; protected $themeName;
/** /**
* @var Array $overrideHooks * @var Array $overrideHooks
*/ */
protected $themePath = ''; protected $themePath = '';
/** /**
* save config * save config
*/ */
@@ -70,7 +70,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
// $this->module_path_resource = $this->module_path.'views/'; // $this->module_path_resource = $this->module_path.'views/';
$this->themePath = _PS_ALL_THEMES_DIR_.$this->themeName.'/'; $this->themePath = _PS_ALL_THEMES_DIR_.$this->themeName.'/';
} }
public function initPageHeaderToolbar() public function initPageHeaderToolbar()
{ {
$this->context->controller->addJquery(); $this->context->controller->addJquery();
@@ -78,17 +78,17 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$this->context->controller->addJqueryUI('ui.draggable'); // FILE FORM.js required this $this->context->controller->addJqueryUI('ui.draggable'); // FILE FORM.js required this
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js'); $this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/form.js');
$this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/home.js'); $this->context->controller->addJs(apPageHelper::getJsAdminDir().'admin/home.js');
Context::getContext()->controller->addJqueryPlugin('colorpicker'); Context::getContext()->controller->addJqueryPlugin('colorpicker');
Media::addJsDef(array( Media::addJsDef(array(
'ap_controller' => 'AdminApPageBuilderThemeConfigurationController', 'ap_controller' => 'AdminApPageBuilderThemeConfigurationController',
)); ));
$this->context->controller->addCss(__PS_BASE_URI__.str_replace('//', '/', 'modules/appagebuilder').'/css/admin/style_AdminApPageBuilderThemeConfiguration.css', 'all'); $this->context->controller->addCss(__PS_BASE_URI__.str_replace('//', '/', 'modules/appagebuilder').'/css/admin/style_AdminApPageBuilderThemeConfiguration.css', 'all');
parent::initPageHeaderToolbar(); parent::initPageHeaderToolbar();
} }
/** /**
* OVERRIDE ROOT\classes\controller\AdminController.php * OVERRIDE ROOT\classes\controller\AdminController.php
* Assign smarty variables for all default views, list and form, then call other init functions * Assign smarty variables for all default views, list and form, then call other init functions
@@ -104,7 +104,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$this->initToolbar(); $this->initToolbar();
$this->initTabModuleList(); $this->initTabModuleList();
$this->initPageHeaderToolbar(); $this->initPageHeaderToolbar();
$this->content .= $this->renderForm(); $this->content .= $this->renderForm();
// FIXME: Sorry. I'm not very proud of this, but no choice... Please wait sf refactoring to solve this. // FIXME: Sorry. I'm not very proud of this, but no choice... Please wait sf refactoring to solve this.
if (get_class($this) != 'AdminCarriersController') { if (get_class($this) != 'AdminCarriersController') {
@@ -147,10 +147,10 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'label' => $this->l('Disabled'), 'label' => $this->l('Disabled'),
) )
); );
$tskins = LeoFrameworkHelper::getSkins($this->themeName); $tskins = LeoFrameworkHelper::getSkins($this->themeName);
// $directions = LeoFrameworkHelper::getLayoutDirections($this->themeName); // $directions = LeoFrameworkHelper::getLayoutDirections($this->themeName);
$this->lang = true; $this->lang = true;
$skins = array(); $skins = array();
$skins[] = array('name' => $this->l('Default'), 'id' => 'default'); $skins[] = array('name' => $this->l('Default'), 'id' => 'default');
@@ -158,10 +158,10 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$this->initToolbar(); $this->initToolbar();
$this->context->controller->addJqueryUI('ui.sortable'); $this->context->controller->addJqueryUI('ui.sortable');
$sample = new Datasample(); $sample = new Datasample();
$moduleList = $sample->getModuleList(); $moduleList = $sample->getModuleList();
$fields_form = array( $fields_form = array(
// 'legend' => array( // 'legend' => array(
// 'title' => $this->l('Ap Theme Configuration'), // 'title' => $this->l('Ap Theme Configuration'),
@@ -398,7 +398,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'desc' => $this->l('How many column display in grid mode of product list.'), 'desc' => $this->l('How many column display in grid mode of product list.'),
'form_group_class' => 'aprow_pages', 'form_group_class' => 'aprow_pages',
), ),
array( array(
'type' => 'select', 'type' => 'select',
'label' => $this->l('Product Detail Tab Type'), 'label' => $this->l('Product Detail Tab Type'),
@@ -1133,10 +1133,10 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'title' => $this->l('Save'), 'title' => $this->l('Save'),
), ),
); );
if (version_compare(Configuration::get('PS_VERSION_DB'), '1.7.3.0', '>=')) { if (version_compare(Configuration::get('PS_VERSION_DB'), '1.7.3.0', '>=')) {
$fields_form['input']['config']['values']['aprow_rtl'] = $this->l('Righ to Left'); $fields_form['input']['config']['values']['aprow_rtl'] = $this->l('Righ to Left');
$fields_form['input'][] = $fields_form['input'][] =
array( array(
'type' => 'html', 'type' => 'html',
@@ -1144,7 +1144,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'html_content' => '<button class="button btn btn-danger" name="submit_rtl_prestashop" id="submit_rtl_prestashop" type="submit">1. Generate RTL stylesheet</button>', 'html_content' => '<button class="button btn btn-danger" name="submit_rtl_prestashop" id="submit_rtl_prestashop" type="submit">1. Generate RTL stylesheet</button>',
'form_group_class' => 'aprow_rtl', 'form_group_class' => 'aprow_rtl',
); );
$fields_form['input'][] = $fields_form['input'][] =
array( array(
'type' => 'html', 'type' => 'html',
@@ -1152,7 +1152,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'html_content' => '<button class="button btn btn-success" name="submit_rtl_leo" id="submit_rtl_leo" type="submit">2. Use class RTL of theme</button>', 'html_content' => '<button class="button btn btn-success" name="submit_rtl_leo" id="submit_rtl_leo" type="submit">2. Use class RTL of theme</button>',
'form_group_class' => 'aprow_rtl', 'form_group_class' => 'aprow_rtl',
); );
$fields_form['input'][] = $fields_form['input'][] =
array( array(
'type' => 'html', 'type' => 'html',
@@ -1162,7 +1162,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
'form_group_class' => 'aprow_rtl', 'form_group_class' => 'aprow_rtl',
); );
} }
$theme_customizations = LeoFrameworkHelper::getLayoutSettingByTheme($this->themeName); $theme_customizations = LeoFrameworkHelper::getLayoutSettingByTheme($this->themeName);
if (isset($theme_customizations['layout'])) { if (isset($theme_customizations['layout'])) {
foreach ($theme_customizations['layout'] as $key => $value) { foreach ($theme_customizations['layout'] as $key => $value) {
@@ -1182,10 +1182,10 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
array_push($fields_form['input'], $o); array_push($fields_form['input'], $o);
} }
} }
$this->fields_form = $fields_form; $this->fields_form = $fields_form;
$this->tpl_form_vars['backup_dir'] = $sample->backup_dir; $this->tpl_form_vars['backup_dir'] = $sample->backup_dir;
if ($this->submitSaveSetting && Tools::isSubmit('submitAddconfiguration')) { if ($this->submitSaveSetting && Tools::isSubmit('submitAddconfiguration')) {
# SAVING CONFIGURATION # SAVING CONFIGURATION
$this->saveThemeConfigs(); $this->saveThemeConfigs();
@@ -1193,7 +1193,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
} }
return parent::renderForm(); return parent::renderForm();
} }
public function postProcess() public function postProcess()
{ {
if (count($this->errors) > 0) { if (count($this->errors) > 0) {
@@ -1233,7 +1233,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$this->submitSaveSetting = true; $this->submitSaveSetting = true;
} }
} }
public function generateRTL() public function generateRTL()
{ {
$theme_name = apPageHelper::getThemeName(); $theme_name = apPageHelper::getThemeName();
@@ -1242,7 +1242,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
->setRegenerate(true) ->setRegenerate(true)
->process(); ->process();
} }
public function removeRTL() public function removeRTL()
{ {
$directory = _PS_ALL_THEMES_DIR_._THEME_NAME_; $directory = _PS_ALL_THEMES_DIR_._THEME_NAME_;
@@ -1258,11 +1258,11 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
unlink($directory . DIRECTORY_SEPARATOR . $file); unlink($directory . DIRECTORY_SEPARATOR . $file);
} }
} }
public function saveThemeConfigsBefore() public function saveThemeConfigsBefore()
{ {
//$helper = LeoFrameworkHelper::getInstance(); //$helper = LeoFrameworkHelper::getInstance();
// SET COOKIE AGAIN // SET COOKIE AGAIN
$theme_cookie_name = $this->getConfigName('PANEL_CONFIG'); $theme_cookie_name = $this->getConfigName('PANEL_CONFIG');
$arrayConfig = array('default_skin', 'layout_mode', 'header_style', 'enable_fheader', 'sidebarmenu'); $arrayConfig = array('default_skin', 'layout_mode', 'header_style', 'enable_fheader', 'sidebarmenu');
@@ -1271,7 +1271,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
unset($_COOKIE[$theme_cookie_name.'_'.$value]); unset($_COOKIE[$theme_cookie_name.'_'.$value]);
setcookie($theme_cookie_name.'_'.$value, '', 0, '/'); setcookie($theme_cookie_name.'_'.$value, '', 0, '/');
} }
# WRITE LOAD GOOGLE FONT # WRITE LOAD GOOGLE FONT
if (apPageHelper::getPostConfig('enable_loadfont') == 1) { if (apPageHelper::getPostConfig('enable_loadfont') == 1) {
$content_font = ''; $content_font = '';
@@ -1315,7 +1315,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$content_font .= $this->renderCSSFont('span'); $content_font .= $this->renderCSSFont('span');
LeoFrameworkHelper::writeToCache($this->themePath.apPageHelper::getCssDir(), 'fonts-cuttom2', $content_font, 'css'); LeoFrameworkHelper::writeToCache($this->themePath.apPageHelper::getCssDir(), 'fonts-cuttom2', $content_font, 'css');
} }
# SAVING GOOGLE FONT # SAVING GOOGLE FONT
$gfont_items = Tools::getValue('gfont_items'); $gfont_items = Tools::getValue('gfont_items');
if ($gfont_items) { if ($gfont_items) {
@@ -1324,7 +1324,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
} else { } else {
Configuration::updateValue($this->getConfigName('google_font'), ''); Configuration::updateValue($this->getConfigName('google_font'), '');
} }
# SAVING SUBSET # SAVING SUBSET
$gfonts_subsets = Tools::getValue('gfonts_subsets'); $gfonts_subsets = Tools::getValue('gfonts_subsets');
if ($gfonts_subsets) { if ($gfonts_subsets) {
@@ -1334,7 +1334,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
Configuration::updateValue($this->getConfigName('google_subset'), ''); Configuration::updateValue($this->getConfigName('google_subset'), '');
} }
} }
/** /**
* alias from apPageHelper::getConfigName() * alias from apPageHelper::getConfigName()
*/ */
@@ -1342,7 +1342,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
{ {
return apPageHelper::getConfigName($name); return apPageHelper::getConfigName($name);
} }
/** /**
* Update Theme Configurations * Update Theme Configurations
*/ */
@@ -1352,7 +1352,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$content_setting = ''; $content_setting = '';
//$content_font = ''; //$content_font = '';
//$helper = LeoFrameworkHelper::getInstance(); //$helper = LeoFrameworkHelper::getInstance();
foreach ($this->fields_form['input'] as $input) { foreach ($this->fields_form['input'] as $input) {
if (isset($input['lang'])) { if (isset($input['lang'])) {
$data = array(); $data = array();
@@ -1381,7 +1381,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$value = Tools::getValue($input['name'], Configuration::get($input['name'])); $value = Tools::getValue($input['name'], Configuration::get($input['name']));
$input['default'] = isset($input['default']) ? $input['default'] : ''; $input['default'] = isset($input['default']) ? $input['default'] : '';
$dataSave = $value ? $value : $input['default']; $dataSave = $value ? $value : $input['default'];
if (isset($input['save']) && $input['save']== false) { if (isset($input['save']) && $input['save']== false) {
// NOT SAVE // NOT SAVE
} else if ($input['type'] == 'font_h') { } else if ($input['type'] == 'font_h') {
@@ -1438,14 +1438,14 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
} }
} }
} }
$folder = $this->themePath.'templates/layouts/'; $folder = $this->themePath.'templates/layouts/';
if (!is_dir($folder)) { if (!is_dir($folder)) {
mkdir($folder, 0755, true); mkdir($folder, 0755, true);
} }
LeoFrameworkHelper::writeToCache($this->themePath.'templates/layouts/', 'setting', $content_setting, 'tpl'); LeoFrameworkHelper::writeToCache($this->themePath.'templates/layouts/', 'setting', $content_setting, 'tpl');
} }
public function renderGoogleLinkFont($gfont_name, $attribute) public function renderGoogleLinkFont($gfont_name, $attribute)
{ {
$output = ''; $output = '';
@@ -1455,15 +1455,15 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$str_att .= ','.$value; $str_att .= ','.$value;
} }
$str_att = trim($str_att, ','); $str_att = trim($str_att, ',');
$output = $gfont_name . ':' . $str_att; $output = $gfont_name . ':' . $str_att;
} else { } else {
$output = $gfont_name; $output = $gfont_name;
} }
return $output; return $output;
} }
public function renderCSSFont($tag) public function renderCSSFont($tag)
{ {
$html = ''; $html = '';
@@ -1482,21 +1482,21 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
if (apPageHelper::getPostConfig($tag . '_font_style')) { if (apPageHelper::getPostConfig($tag . '_font_style')) {
$html .= ' font-style:' . apPageHelper::getPostConfig($tag . '_font_style') . ';'; $html .= ' font-style:' . apPageHelper::getPostConfig($tag . '_font_style') . ';';
} }
$output = ''; $output = '';
if (!empty($html)) { if (!empty($html)) {
$output = $tag . ' {'.$html.' }'."\n"; $output = $tag . ' {'.$html.' }'."\n";
} }
return $output; return $output;
} }
public function getFieldsValue($obj) public function getFieldsValue($obj)
{ {
unset($obj); unset($obj);
$languages = Language::getLanguages(false); $languages = Language::getLanguages(false);
$fields_values = array(); $fields_values = array();
foreach ($this->fields_form as $f) { foreach ($this->fields_form as $f) {
foreach ($f['form']['input'] as $input) { foreach ($f['form']['input'] as $input) {
if (isset($input['lang'])) { if (isset($input['lang'])) {
@@ -1525,7 +1525,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
} }
// Font setup : list fonts in google // Font setup : list fonts in google
$fields_values['gfont_api'] = Tools::jsonEncode(GoogleFont::getAllGoogleFonts()); $fields_values['gfont_api'] = Tools::jsonEncode(GoogleFont::getAllGoogleFonts());
// Font setup : list fonts in database // Font setup : list fonts in database
$google_font_cfg = Configuration::get($this->getConfigName('google_font')); $google_font_cfg = Configuration::get($this->getConfigName('google_font'));
$fields_values['gfont_list_ori'] = '[]'; $fields_values['gfont_list_ori'] = '[]';
@@ -1537,7 +1537,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$fields_values['gfont_list'] = $google_fonts; $fields_values['gfont_list'] = $google_fonts;
$fields_values['gfont_list_ori'] = Tools::jsonEncode($google_fonts); $fields_values['gfont_list_ori'] = Tools::jsonEncode($google_fonts);
} }
// Font setup : list subset in database // Font setup : list subset in database
$google_subset_cfg = Configuration::get($this->getConfigName('google_subset')); $google_subset_cfg = Configuration::get($this->getConfigName('google_subset'));
$fields_values['gfont_subset'] = '[]'; $fields_values['gfont_subset'] = '[]';
@@ -1545,15 +1545,15 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
$google_subset = explode(',', $google_subset_cfg); $google_subset = explode(',', $google_subset_cfg);
$fields_values['gfont_subset'] = Tools::jsonEncode($google_subset); $fields_values['gfont_subset'] = Tools::jsonEncode($google_subset);
} }
return $fields_values; return $fields_values;
} }
public function getGoogleFont() public function getGoogleFont()
{ {
return array_keys(GoogleFont::getAllGoogleFonts()); return array_keys(GoogleFont::getAllGoogleFonts());
} }
public function getFontWeight($default = false) public function getFontWeight($default = false)
{ {
if ($default == 'default') { if ($default == 'default') {
@@ -1573,7 +1573,7 @@ class AdminApPageBuilderThemeConfigurationController extends ModuleAdminControll
); );
return $result; return $result;
} }
public function getFontStyle($default = false) public function getFontStyle($default = false)
{ {
if ($default == 'default') { if ($default == 'default') {

View File

@@ -72,7 +72,7 @@ class CmsController extends CmsControllerCore
$this->setTemplate('cms/category'); $this->setTemplate('cms/category');
} }
FrontController::initContent(); FrontController::initContent();
// validate module // validate module
unset($id_module); unset($id_module);
unset($array_return); unset($array_return);

View File

@@ -2,7 +2,7 @@
* @Website: apollotheme.com - prestashop template provider * @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com> * @author Apollotheme <apollotheme@gmail.com>
* @copyright 2007-2018 Apollotheme * @copyright 2007-2018 Apollotheme
* @description: * @description:
*/ */
imgId = null; // using for store object image select a source in function select image imgId = null; // using for store object image select a source in function select image
function log(message) { function log(message) {
@@ -70,25 +70,25 @@ function htmlentitiesDecode(str) {
$('.' + key).data('form', dataObj[key]); $('.' + key).data('form', dataObj[key]);
//DONGND:: install data animation for column and group //DONGND:: install data animation for column and group
if (typeof dataObj[key].animation != 'undefined') if (typeof dataObj[key].animation != 'undefined')
{ {
if ($('.' + key).find('.animation-button').first().length) if ($('.' + key).find('.animation-button').first().length)
{ {
var animation_bt = $('.' + key).find('.animation-button').first(); var animation_bt = $('.' + key).find('.animation-button').first();
var animation_type = dataObj[key].animation ? dataObj[key].animation : 'none'; var animation_type = dataObj[key].animation ? dataObj[key].animation : 'none';
var animation_delay = dataObj[key].animation_delay ? dataObj[key].animation_delay : 1; var animation_delay = dataObj[key].animation_delay ? dataObj[key].animation_delay : 1;
var animation_duration = dataObj[key].animation_duration ? dataObj[key].animation_duration : 1; var animation_duration = dataObj[key].animation_duration ? dataObj[key].animation_duration : 1;
var animation_iteration_count = dataObj[key].animation_iteration_count ? dataObj[key].animation_iteration_count : 1; var animation_iteration_count = dataObj[key].animation_iteration_count ? dataObj[key].animation_iteration_count : 1;
var animation_infinite = dataObj[key].animation_infinite ? dataObj[key].animation_infinite : 0; var animation_infinite = dataObj[key].animation_infinite ? dataObj[key].animation_infinite : 0;
$globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite); $globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite);
} }
} }
}); });
//DONGND:: fix can't click tab 1 when create new widget tab //DONGND:: fix can't click tab 1 when create new widget tab
$('.ApTabs:not(#default_ApTabs)').each(function(){ $('.ApTabs:not(#default_ApTabs)').each(function(){
var activeTabId = $(this).data('form').active_tab; var activeTabId = $(this).data('form').active_tab;
if (activeTabId != '' && parseInt(activeTabId)) if (activeTabId != '' && parseInt(activeTabId))
{ {
$(this).find('.nav-tabs a').eq(parseInt(activeTabId)-1).tab('show'); $(this).find('.nav-tabs a').eq(parseInt(activeTabId)-1).tab('show');
@@ -149,7 +149,7 @@ function htmlentitiesDecode(str) {
handle: ".waction-drag" handle: ".waction-drag"
}); });
// $( ".widget-row" ).addClass( $globalthis.classWidget ) // $( ".widget-row" ).addClass( $globalthis.classWidget )
// .find( ".waction-drag" ).addClass( $globalthis.classWidgetHeader ); // .find( ".waction-drag" ).addClass( $globalthis.classWidgetHeader );
}; };
this.downloadFile = function (filename, result) { this.downloadFile = function (filename, result) {
@@ -185,7 +185,7 @@ function htmlentitiesDecode(str) {
cls = cls.replace("col-sp-12", "col-sp-" + realValue); cls = cls.replace("col-sp-12", "col-sp-" + realValue);
$(column).attr("class", cls); $(column).attr("class", cls);
objColumn = {form_id: "form_" + $globalthis.getRandomNumber()}; objColumn = {form_id: "form_" + $globalthis.getRandomNumber()};
objColumn.sm = widthCol; objColumn.sm = widthCol;
objColumn.xs = widthCol; objColumn.xs = widthCol;
objColumn.sp = widthCol; objColumn.sp = widthCol;
@@ -317,7 +317,7 @@ function htmlentitiesDecode(str) {
btnElement = $(this); btnElement = $(this);
$('.btn-fwidth').removeClass('active'); $('.btn-fwidth').removeClass('active');
$(this).addClass('active'); $(this).addClass('active');
//reset //reset
if ($(this).hasClass('width-default')) { if ($(this).hasClass('width-default')) {
$globalthis.windowWidth = $(window).width(); $globalthis.windowWidth = $(window).width();
$('#home_wrapper').attr('class', 'default'); $('#home_wrapper').attr('class', 'default');
@@ -506,10 +506,9 @@ function htmlentitiesDecode(str) {
//edit group //edit group
$(document).on("click", ".btn-edit", function () { $(document).on("click", ".btn-edit", function () {
if ($(this).data('type' == undefined) && $(this).data('type') == undefined) { var type = $(this).data('type') !== undefined
var type = $(this).closest('.widget-row').data("type"); ? $(this).data('type')
} else : $(this).closest('.widget-row').data('type');
var type = $(this).data("type");
if (type.indexOf("apSub") == 0) { if (type.indexOf("apSub") == 0) {
if (type == "apSubAccordions") { if (type == "apSubAccordions") {
@@ -569,7 +568,7 @@ function htmlentitiesDecode(str) {
$('#modal_form .modal-footer').show(); $('#modal_form .modal-footer').show();
$('#modal_form .modal-body').html(data); $('#modal_form .modal-body').html(data);
$('#modal_form').removeClass('modal-new').addClass('modal-edit'); $('#modal_form').removeClass('modal-new').addClass('modal-edit');
// FIX BUG : ApCategory khong save duoc icon cu, khi thay icon cho 1 category khac // FIX BUG : ApCategory khong save duoc icon cu, khi thay icon cho 1 category khac
// resetSelectedImage(); // resetSelectedImage();
@@ -582,7 +581,7 @@ function htmlentitiesDecode(str) {
initFullSlider("edit"); initFullSlider("edit");
} }
hideFormLevel2(); hideFormLevel2();
$globalthis.setFormAction(); $globalthis.setFormAction();
}, },
error: function (XMLHttpRequest, textStatus, errorThrown) { error: function (XMLHttpRequest, textStatus, errorThrown) {
@@ -591,7 +590,7 @@ function htmlentitiesDecode(str) {
} }
}); });
}); });
$(document).on("click", ".btn-new-widget", function () { $(document).on("click", ".btn-new-widget", function () {
var url = $globalthis.ajaxHomeUrl + '&ajax=1&action=renderList'; var url = $globalthis.ajaxHomeUrl + '&ajax=1&action=renderList';
if ($(this).hasClass('tabcontent-action')) if ($(this).hasClass('tabcontent-action'))
@@ -917,7 +916,7 @@ function htmlentitiesDecode(str) {
$(this).closest('.translatable-field').find('.img-thumbnail').hide(); $(this).closest('.translatable-field').find('.img-thumbnail').hide();
return false; return false;
}); });
$(document).on("click", ".image-manager .img-link", function (e) { $(document).on("click", ".image-manager .img-link", function (e) {
e.stopPropagation(); e.stopPropagation();
var img = $(this).find("img"); var img = $(this).find("img");
@@ -927,7 +926,7 @@ function htmlentitiesDecode(str) {
var div = $(imgId).closest("div"); var div = $(imgId).closest("div");
imgDest = $(div).find("img"); imgDest = $(div).find("img");
var widget = $(img).attr("data-widget"); var widget = $(img).attr("data-widget");
if(widget == "ApImage360") if(widget == "ApImage360")
{ {
@@ -990,17 +989,17 @@ function htmlentitiesDecode(str) {
$(document).on("click", ".animation-button", function (e) { $(document).on("click", ".animation-button", function (e) {
var animation_wrapper = $(this).siblings('.animation-wrapper'); var animation_wrapper = $(this).siblings('.animation-wrapper');
if (!$(this).hasClass('active')) if (!$(this).hasClass('active'))
{ {
$(".animation-button.active").siblings('.animation-wrapper').hide(); $(".animation-button.active").siblings('.animation-wrapper').hide();
$(".animation-button.active").removeClass('active'); $(".animation-button.active").removeClass('active');
//DONGND:: load config by data //DONGND:: load config by data
$(this).addClass('active'); $(this).addClass('active');
var animation_type = $(this).data('animation-type'); var animation_type = $(this).data('animation-type');
var animation_delay = $(this).data('animation-delay'); var animation_delay = $(this).data('animation-delay');
var animation_duration = $(this).data('animation-duration'); var animation_duration = $(this).data('animation-duration');
var animation_iteration_count = $(this).data('animation-iteration-count'); var animation_iteration_count = $(this).data('animation-iteration-count');
var animation_infinite = $(this).data('animation-infinite'); var animation_infinite = $(this).data('animation-infinite');
if (typeof animation_delay != 'undefined') if (typeof animation_delay != 'undefined')
{ {
animation_wrapper.find('.animation_delay').val(animation_delay); animation_wrapper.find('.animation_delay').val(animation_delay);
@@ -1009,7 +1008,7 @@ function htmlentitiesDecode(str) {
{ {
animation_wrapper.find('.animation_delay').val(1); animation_wrapper.find('.animation_delay').val(1);
} }
if (typeof animation_duration != 'undefined') if (typeof animation_duration != 'undefined')
{ {
animation_wrapper.find('.animation_duration').val(animation_duration); animation_wrapper.find('.animation_duration').val(animation_duration);
@@ -1018,7 +1017,7 @@ function htmlentitiesDecode(str) {
{ {
animation_wrapper.find('.animation_duration').val(1); animation_wrapper.find('.animation_duration').val(1);
} }
if (typeof animation_iteration_count != 'undefined') if (typeof animation_iteration_count != 'undefined')
{ {
animation_wrapper.find('.animation_iteration_count').val(animation_iteration_count); animation_wrapper.find('.animation_iteration_count').val(animation_iteration_count);
@@ -1027,7 +1026,7 @@ function htmlentitiesDecode(str) {
{ {
animation_wrapper.find('.animation_iteration_count').val(1); animation_wrapper.find('.animation_iteration_count').val(1);
} }
if (animation_infinite == 1) if (animation_infinite == 1)
{ {
animation_wrapper.find('.animation_infinite').attr( 'checked', 'checked' ); animation_wrapper.find('.animation_infinite').attr( 'checked', 'checked' );
@@ -1036,24 +1035,24 @@ function htmlentitiesDecode(str) {
{ {
animation_wrapper.removeAttr('checked'); animation_wrapper.removeAttr('checked');
} }
//DONGND:: change offset to right with column small //DONGND:: change offset to right with column small
if ($(window).width()-$(this).offset().left < animation_wrapper.width()) if ($(window).width()-$(this).offset().left < animation_wrapper.width())
{ {
animation_wrapper.addClass('offset-right'); animation_wrapper.addClass('offset-right');
} }
animation_wrapper.show(); animation_wrapper.show();
if (typeof animation_type != 'undefined') if (typeof animation_type != 'undefined')
{ {
animation_wrapper.find('.animation_select').val(animation_type).trigger('change'); animation_wrapper.find('.animation_select').val(animation_type).trigger('change');
} }
else else
{ {
animation_wrapper.find('.animation_select').val('none').trigger('change'); animation_wrapper.find('.animation_select').val('none').trigger('change');
} }
// animation_wrapper.find('.animate-it').trigger('click'); // animation_wrapper.find('.animate-it').trigger('click');
} }
else else
{ {
@@ -1062,9 +1061,9 @@ function htmlentitiesDecode(str) {
animation_wrapper.removeClass('offset-right'); animation_wrapper.removeClass('offset-right');
animation_wrapper.find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox'); animation_wrapper.find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox');
} }
}); });
//DONGND:: save config of animation to data form of column/group //DONGND:: save config of animation to data form of column/group
$(document).on("click", ".btn-save-animation", function (e) { $(document).on("click", ".btn-save-animation", function (e) {
var obj_parent = $(this).parents('.animation-wrapper'); var obj_parent = $(this).parents('.animation-wrapper');
@@ -1074,17 +1073,17 @@ function htmlentitiesDecode(str) {
var animation_duration = obj_parent.find('.animation_duration').val(); var animation_duration = obj_parent.find('.animation_duration').val();
var animation_iteration_count = obj_parent.find('.animation_iteration_count').val(); var animation_iteration_count = obj_parent.find('.animation_iteration_count').val();
var animation_infinite = obj_parent.find('.animation_infinite').is(':checked')? 1 : 0; var animation_infinite = obj_parent.find('.animation_infinite').is(':checked')? 1 : 0;
$globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite); $globalthis.assignConfigAnimation(animation_bt, animation_type, animation_delay, animation_duration, animation_iteration_count, animation_infinite);
//DONGND:: update data form for group/column //DONGND:: update data form for group/column
if (obj_parent.hasClass('column-animation-wrapper')) if (obj_parent.hasClass('column-animation-wrapper'))
{ {
var main_obj = obj_parent.parents('.column-row'); var main_obj = obj_parent.parents('.column-row');
} }
if (obj_parent.hasClass('group-animation-wrapper')) if (obj_parent.hasClass('group-animation-wrapper'))
{ {
var main_obj = obj_parent.parents('.group-row'); var main_obj = obj_parent.parents('.group-row');
} }
if (typeof main_obj != 'undefined') if (typeof main_obj != 'undefined')
@@ -1095,10 +1094,10 @@ function htmlentitiesDecode(str) {
main_obj.data('form').animation_iteration_count = animation_iteration_count; main_obj.data('form').animation_iteration_count = animation_iteration_count;
main_obj.data('form').animation_infinite = animation_infinite; main_obj.data('form').animation_infinite = animation_infinite;
} }
animation_bt.trigger('click'); animation_bt.trigger('click');
}); });
//DONGND:: hide section select animation for column and group when click out //DONGND:: hide section select animation for column and group when click out
$(document).on("click", function (e) { $(document).on("click", function (e) {
if ($('.animation-button.active').length) if ($('.animation-button.active').length)
@@ -1106,16 +1105,16 @@ function htmlentitiesDecode(str) {
e.stopPropagation(); e.stopPropagation();
var container = $('.animation-wrapper'); var container = $('.animation-wrapper');
var container2 = $('.animation-button'); var container2 = $('.animation-button');
if (container.length && container.has(e.target).length === 0 && container2.has(e.target).length === 0 && !$(e.target).hasClass('animation-button') && !$(e.target).hasClass('animation-wrapper')) { if (container.length && container.has(e.target).length === 0 && container2.has(e.target).length === 0 && !$(e.target).hasClass('animation-button') && !$(e.target).hasClass('animation-wrapper')) {
// container.hide(); // container.hide();
// $('.animation-button.active').siblings('.animation-wrapper').find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox'); // $('.animation-button.active').siblings('.animation-wrapper').find('.animationSandbox').removeClass().removeAttr('style').addClass('animationSandbox');
// $('.animation-button.active').removeClass('active'); // $('.animation-button.active').removeClass('active');
$('.animation-button.active').trigger('click'); $('.animation-button.active').trigger('click');
} }
} }
}); });
//DONGND:: active button for section select animation for column and group //DONGND:: active button for section select animation for column and group
$(document).on("change", '.animation_select', function (e) { $(document).on("change", '.animation_select', function (e) {
var wrapper_obj = $(this).parents('.animation-wrapper'); var wrapper_obj = $(this).parents('.animation-wrapper');
@@ -1132,24 +1131,24 @@ function htmlentitiesDecode(str) {
else else
{ {
var iteration_number = wrapper_obj.find('.animation_iteration_count').val(); var iteration_number = wrapper_obj.find('.animation_iteration_count').val();
} }
wrapper_obj.find('.animationSandbox').removeClass().removeAttr('style').attr('style','animation-duration: '+duration_time+'s; animation-delay: '+delay_time+'s; animation-iteration-count: '+iteration_number).addClass($(this).val() + ' animated animationSandbox').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () { wrapper_obj.find('.animationSandbox').removeClass().removeAttr('style').attr('style','animation-duration: '+duration_time+'s; animation-delay: '+delay_time+'s; animation-iteration-count: '+iteration_number).addClass($(this).val() + ' animated animationSandbox').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function () {
$(this).removeClass().removeAttr('style').addClass('animationSandbox'); $(this).removeClass().removeAttr('style').addClass('animationSandbox');
}); });
} }
}); });
//DONGND:: run demo with current config //DONGND:: run demo with current config
$(document).on("click", '.animate-it', function (e) { $(document).on("click", '.animate-it', function (e) {
var wrapper_obj = $(this).parents('.animation-wrapper'); var wrapper_obj = $(this).parents('.animation-wrapper');
wrapper_obj.find('.animation_select').trigger('change'); wrapper_obj.find('.animation_select').trigger('change');
}); });
//DONGND:: copy to clipboard //DONGND:: copy to clipboard
$(document).on("click", '.bt_copy_clipboard', function (e) { $(document).on("click", '.bt_copy_clipboard', function (e) {
var text_copy = ''; var text_copy = '';
if ($(this).hasClass('shortcode_key')) if ($(this).hasClass('shortcode_key'))
{ {
text_copy = $('#shortcode_key').val(); text_copy = $('#shortcode_key').val();
@@ -1162,22 +1161,22 @@ function htmlentitiesDecode(str) {
{ {
text_copy = $('#shortcode_embedded_code').val(); text_copy = $('#shortcode_embedded_code').val();
}; };
if (text_copy != '') if (text_copy != '')
{ {
var $temp = $("<input>"); var $temp = $("<input>");
$("body").append($temp); $("body").append($temp);
$temp.val(text_copy).select(); $temp.val(text_copy).select();
document.execCommand("copy"); document.execCommand("copy");
showSuccessMessage('Copy successful'); showSuccessMessage('Copy successful');
$temp.remove(); $temp.remove();
} }
}); });
}; };
//DONGND:: assign config to data form column/group //DONGND:: assign config to data form column/group
this.assignConfigAnimation = function (obj_bt, data_type, data_delay, data_duration, data_iteration, data_infinite) { this.assignConfigAnimation = function (obj_bt, data_type, data_delay, data_duration, data_iteration, data_infinite) {
obj_bt.data('animation-type', data_type); obj_bt.data('animation-type', data_type);
obj_bt.data('animation-delay', data_delay); obj_bt.data('animation-delay', data_delay);
obj_bt.data('animation-duration', data_duration); obj_bt.data('animation-duration', data_duration);
@@ -1185,8 +1184,8 @@ function htmlentitiesDecode(str) {
obj_bt.data('animation-infinite', data_infinite); obj_bt.data('animation-infinite', data_infinite);
var txt_default = obj_bt.find('.animation-status').data('text-default'); var txt_default = obj_bt.find('.animation-status').data('text-default');
if (data_type != 'none') if (data_type != 'none')
{ {
obj_bt.addClass('btn-success'); obj_bt.addClass('btn-success');
var txt_infinite = obj_bt.find('.animation-status').data('text-infinite'); var txt_infinite = obj_bt.find('.animation-status').data('text-infinite');
obj_bt.find('.animation-status').text(data_type + (data_infinite == 1 ? ' ('+txt_infinite+')' : '')); obj_bt.find('.animation-status').text(data_type + (data_infinite == 1 ? ' ('+txt_infinite+')' : ''));
} }
@@ -1344,46 +1343,46 @@ function htmlentitiesDecode(str) {
}; };
// AJAX LOAD FORM, LOAD WIDGET // AJAX LOAD FORM, LOAD WIDGET
this.setFormAction = function () { this.setFormAction = function () {
var $globalthis = this; var $globalthis = this;
//DONGND:: slick custom enable/disable //DONGND:: slick custom enable/disable
$('#slick_custom_status').change(function(){ $('#slick_custom_status').change(function(){
if($(this).val() == 1) if($(this).val() == 1)
{ {
$('#slick_custom').parents('.form-group').show(); $('#slick_custom').parents('.form-group').show();
} }
else else
{ {
$('#slick_custom').parents('.form-group').hide(); $('#slick_custom').parents('.form-group').hide();
} }
}); });
//DONGND:: slick center mode enable/disable //DONGND:: slick center mode enable/disable
$('#slick_centermode').change(function(){ $('#slick_centermode').change(function(){
if($(this).val() == 1) if($(this).val() == 1)
{ {
$('#slick_centerpadding').parents('.form-group').show(); $('#slick_centerpadding').parents('.form-group').show();
} }
else else
{ {
$('#slick_centerpadding').parents('.form-group').hide(); $('#slick_centerpadding').parents('.form-group').hide();
} }
}); });
$('.form-action').change(function () { $('.form-action').change(function () {
var elementName = $(this).attr('name'); var elementName = $(this).attr('name');
$('.' + elementName + '_sub').hide(); $('.' + elementName + '_sub').hide();
$('.' + elementName + '-' + $(this).val()).show(); $('.' + elementName + '-' + $(this).val()).show();
//DONGND:: special fields of slick carousel //DONGND:: special fields of slick carousel
if ($(this).val() == 'slickcarousel') if ($(this).val() == 'slickcarousel')
{ {
$('#slick_custom_status').trigger('change'); $('#slick_custom_status').trigger('change');
$('#slick_centermode').trigger('change'); $('#slick_centermode').trigger('change');
} }
}); });
// Show tool tip, hint of label // Show tool tip, hint of label
$("#modal_form .label-tooltip").tooltip(); $("#modal_form .label-tooltip").tooltip();
@@ -1541,7 +1540,7 @@ function htmlentitiesDecode(str) {
if ($(".select-class").length) { if ($(".select-class").length) {
$(".select-class").click(function () { $(".select-class").click(function () {
if ($(this).is(':checked')) { if ($(this).is(':checked')) {
$('.select-class').each(function() { $('.select-class').each(function() {
// REMOVE ALL CHECKBOX VALUE IN TEXT // REMOVE ALL CHECKBOX VALUE IN TEXT
var classChk = $(this).data("value"); var classChk = $(this).data("value");
@@ -1565,9 +1564,9 @@ function htmlentitiesDecode(str) {
$(elementText).val(classChk); $(elementText).val(classChk);
} }
} }
} }
}); });
$(".chk-row").click(function () { $(".chk-row").click(function () {
var classChk = $(this).data("value"); var classChk = $(this).data("value");
var elementText = $(this).closest('.well').find('.element_class').first(); var elementText = $(this).closest('.well').find('.element_class').first();
@@ -1749,7 +1748,7 @@ function htmlentitiesDecode(str) {
// Reinit // Reinit
var container = (currentTab === "widget" ? $containerWidget : $containerModule); var container = (currentTab === "widget" ? $containerWidget : $containerModule);
// Priority is action search, in the case text search is not empty // Priority is action search, in the case text search is not empty
// will search and reset sub category is Show all // will search and reset sub category is Show all
if (filterValue !== "*") { if (filterValue !== "*") {
$(".for-" + currentTab + " .btn").removeClass("is-checked"); $(".for-" + currentTab + " .btn").removeClass("is-checked");
@@ -1837,14 +1836,14 @@ function htmlentitiesDecode(str) {
contentHtml = ""; contentHtml = "";
widgetType = ''; widgetType = '';
// FIX : widget AP_RAW_HTML always get content of AP_HTML which created before // FIX : widget AP_RAW_HTML always get content of AP_HTML which created before
$($("#configuration_form").serializeArray()).each(function (i, field) { $($("#configuration_form").serializeArray()).each(function (i, field) {
if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') { if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') {
widgetType = field.name; widgetType = field.name;
} }
}); });
if (typeof tinyMCE != "undefined" && widgetType != 'ApRawHtml') { if (typeof tinyMCE != "undefined" && widgetType != 'ApRawHtml') {
tinyMCE.triggerSave(); tinyMCE.triggerSave();
//var mce = tinyMCE.activeEditor.getContent(); //var mce = tinyMCE.activeEditor.getContent();
@@ -1863,13 +1862,13 @@ function htmlentitiesDecode(str) {
}); });
$($("#configuration_form").serializeArray()).each(function (i, field) { $($("#configuration_form").serializeArray()).each(function (i, field) {
// SET EMPTY VALUE AFTER UPDATE LANGUAGE FOR OTHER FIELD // SET EMPTY VALUE AFTER UPDATE LANGUAGE FOR OTHER FIELD
if( field.value == '_JS_EMPTY_VALUE_') if( field.value == '_JS_EMPTY_VALUE_')
{ {
field.value = ''; field.value = '';
} }
if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') { if (field.name.substring(0, 2).toLowerCase() == 'ap' && field.value == '1') {
widgetType = field.name; widgetType = field.name;
} else { } else {
@@ -1935,10 +1934,10 @@ function htmlentitiesDecode(str) {
$(currentE).attr("href", "#" + ObjectForm.id); $(currentE).attr("href", "#" + ObjectForm.id);
} }
if (type == "update") { if (type == "update") {
// SAVE ACTIVE // SAVE ACTIVE
//DONGND:: fix can't save tab after update //DONGND:: fix can't save tab after update
if (widgetType != "ap_sub_tabs") if (widgetType != "ap_sub_tabs")
{ {
if ($(currentE).find('.btn-status').first().hasClass("deactive")) { if ($(currentE).find('.btn-status').first().hasClass("deactive")) {
ObjectForm.active = 0; ObjectForm.active = 0;
} else { } else {
@@ -1958,13 +1957,13 @@ function htmlentitiesDecode(str) {
} else { } else {
$(currentE).data("form", ObjectForm); $(currentE).data("form", ObjectForm);
} }
//DONGND:: update name of tab after change //DONGND:: update name of tab after change
if (widgetType == "ap_sub_tabs") if (widgetType == "ap_sub_tabs")
{ {
$(currentE).text(ObjectForm['title_' + $globalthis.lang_id]); $(currentE).text(ObjectForm['title_' + $globalthis.lang_id]);
} }
//console.log(ObjectForm); //console.log(ObjectForm);
$(".label-tooltip").tooltip(); $(".label-tooltip").tooltip();
return true; return true;
@@ -2095,7 +2094,7 @@ function htmlentitiesDecode(str) {
continue; continue;
} }
//default xs = 6-> 2 cols.but we set 2 cols, we have to assign again //default xs = 6-> 2 cols.but we set 2 cols, we have to assign again
if (startSet && ((12 / parseInt(colDefault[$globalthis.arrayCol[j]])) < colNumber)) { if (startSet && ((12 / parseInt(colDefault[$globalthis.arrayCol[j]])) < colNumber)) {
colDefault[$globalthis.arrayCol[j]] = finalVal; colDefault[$globalthis.arrayCol[j]] = finalVal;
} }
@@ -2204,12 +2203,12 @@ function htmlentitiesDecode(str) {
//set hook to object //set hook to object
objects[iHook] = objHook; objects[iHook] = objHook;
}); });
//DONGND: enable save multithreading //DONGND: enable save multithreading
if(checkSaveMultithreading == 1) if(checkSaveMultithreading == 1)
{ {
var i = 0; var i = 0;
doLoop(isValid); doLoop(isValid);
} }
else else
{ {
@@ -2243,22 +2242,22 @@ function htmlentitiesDecode(str) {
} }
}); });
}; };
//DONGND: function run save multithreading //DONGND: function run save multithreading
function doLoop(isValid) { function doLoop(isValid) {
var temp_obj = new Object(); var temp_obj = new Object();
temp_obj[i] = objects[i]; temp_obj[i] = objects[i];
data = 'dataForm=' + JSON.stringify(temp_obj); data = 'dataForm=' + JSON.stringify(temp_obj);
if(i+1 == Object.keys(objects).length) if(i+1 == Object.keys(objects).length)
{ {
data += '&dataLast=1'; data += '&dataLast=1';
}; };
if(i==0) if(i==0)
{ {
data += '&dataFirst=1'; data += '&dataFirst=1';
}; };
$.ajax({ $.ajax({
type: "POST", type: "POST",
headers: {"cache-control": "no-cache"}, headers: {"cache-control": "no-cache"},
@@ -2293,7 +2292,7 @@ function htmlentitiesDecode(str) {
$("#ap_loading").hide(); $("#ap_loading").hide();
alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus); alert("TECHNICAL ERROR: \n\nDetails:\nError thrown: " + XMLHttpRequest + "\n" + 'Text status: ' + textStatus);
} }
}); });
}; };
return false; return false;
}); });
@@ -2329,7 +2328,7 @@ function htmlentitiesDecode(str) {
//console.log(objects); //console.log(objects);
$('#data_profile').val(JSON.stringify(objects)); $('#data_profile').val(JSON.stringify(objects));
$('#data_id_profile').val($('#current_profile').data('id')); $('#data_id_profile').val($('#current_profile').data('id'));
if($globalthis.isValid == true) if($globalthis.isValid == true)
{ {
$("#form_data_profile button").click(); $("#form_data_profile button").click();
@@ -2338,10 +2337,10 @@ function htmlentitiesDecode(str) {
} }
}); });
}; };
//DONGND:: submit shortcode //DONGND:: submit shortcode
$(document).on("click", ".shortcode_save_btn, .shortcode_save_stay_btn", function () { $(document).on("click", ".shortcode_save_btn, .shortcode_save_stay_btn", function () {
if ($(this).hasClass('shortcode_save_stay_btn')) if ($(this).hasClass('shortcode_save_stay_btn'))
{ {
$('#stay_page').val(1); $('#stay_page').val(1);
@@ -2356,16 +2355,16 @@ function htmlentitiesDecode(str) {
objHook.groups = {}; objHook.groups = {};
// console.log($('.group-row')); // console.log($('.group-row'));
$('.hook-wrapper .group-row').each(function (iGroup) { $('.hook-wrapper .group-row').each(function (iGroup) {
objHook.groups[iGroup] = $globalthis.getHookSubmit(this, true); objHook.groups[iGroup] = $globalthis.getHookSubmit(this, true);
}); });
// console.log(objHook); // console.log(objHook);
$('#shortcode_content').val(JSON.stringify(objHook)); $('#shortcode_content').val(JSON.stringify(objHook));
$('#appagebuilder_shortcode_form').submit(); $('#appagebuilder_shortcode_form').submit();
return false; return false;
}); });
$(document).on("click", ".position-cover .list-position .position-name", function () { $(document).on("click", ".position-cover .list-position .position-name", function () {
var select = $(this).closest("ul"); var select = $(this).closest("ul");
var isRunning = (typeof $(select).attr("isRunning") != "undefined") ? $(select).attr("isRunning") : ""; var isRunning = (typeof $(select).attr("isRunning") != "undefined") ? $(select).attr("isRunning") : "";

View File

@@ -1,4 +1,4 @@
{* {*
* @Module Name: AP Page Builder * @Module Name: AP Page Builder
* @Website: apollotheme.com - prestashop template provider * @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com> * @author Apollotheme <apollotheme@gmail.com>
@@ -26,7 +26,7 @@
<input type="text" name="bg_img" id="bg_img" value="" class=""><a href="javascript:void(0)" class="select-img">{l s='Select image ' mod='appagebuilder'}</a> <input type="text" name="bg_img" id="bg_img" value="" class=""><a href="javascript:void(0)" class="select-img">{l s='Select image ' mod='appagebuilder'}</a>
<p class="help-block">{l s='Please put image link or select image' mod='appagebuilder'}</p> <p class="help-block">{l s='Please put image link or select image' mod='appagebuilder'}</p>
</div> </div>
{/if} {/if}
{if $input.type == 'apExceptions'} {if $input.type == 'apExceptions'}
<div class="well"> <div class="well">
<div> <div>
@@ -41,7 +41,7 @@
<div class=""> <div class="">
<div class="well"> <div class="well">
<div class="row"> <div class="row">
{if $input.type == 'ApRowclass'} {if $input.type == 'ApRowclass'}
<label class="choise-class col-lg-12"><input type="checkbox" class="chk-row" data-value="row" value="1"> {l s='Use class row' mod='appagebuilder'}</label> <label class="choise-class col-lg-12"><input type="checkbox" class="chk-row" data-value="row" value="1"> {l s='Use class row' mod='appagebuilder'}</label>
{/if} {/if}
<label class="control-label col-lg-1">{$input.leolabel}</label> <label class="control-label col-lg-1">{$input.leolabel}</label>
@@ -56,7 +56,7 @@
<li> <li>
<label class="choise-class"><input class="select-class" type="checkbox" data-value="hidden-md" value="1"> {l s='Hidden in Medium devices' mod='appagebuilder'}</label> <label class="choise-class"><input class="select-class" type="checkbox" data-value="hidden-md" value="1"> {l s='Hidden in Medium devices' mod='appagebuilder'}</label>
</li> </li>
<li> <li>
<label class="choise-class"><input class="select-class" type="checkbox" data-value="hidden-sm" value="1"> {l s='Hidden in Small devices' mod='appagebuilder'}</label> <label class="choise-class"><input class="select-class" type="checkbox" data-value="hidden-sm" value="1"> {l s='Hidden in Small devices' mod='appagebuilder'}</label>
</li> </li>
<li> <li>
@@ -70,7 +70,7 @@
</div> </div>
</div> </div>
{/if} {/if}
{if $input.type == 'bg_select'} {if $input.type == 'bg_select'}
{$image_uploader}{* HTML form , no escape necessary *} {$image_uploader}{* HTML form , no escape necessary *}
{/if} {/if}
@@ -100,7 +100,7 @@
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{foreach from=$widthList item=itemWidth} {foreach from=$widthList item=itemWidth}
<li> <li>
<a class="width-select" href="javascript:void(0);" tabindex="-1"> <a class="width-select" href="javascript:void(0);" tabindex="-1">
<span data-width="{$itemWidth|escape:'html':'UTF-8'}" class="width-val ap-w-{if $itemWidth|strpos:"."|escape:'html':'UTF-8'}{$itemWidth|replace:'.':'-'|escape:'html':'UTF-8'}{else}{$itemWidth|escape:'html':'UTF-8'}{/if}">{$itemWidth|escape:'html':'UTF-8'}/12 - ( {math equation="x/y*100" x=$itemWidth y=12 format="%.2f"} % )</span> <span data-width="{$itemWidth|escape:'html':'UTF-8'}" class="width-val ap-w-{if $itemWidth|strpos:"."|escape:'html':'UTF-8'}{$itemWidth|replace:'.':'-'|escape:'html':'UTF-8'}{else}{$itemWidth|escape:'html':'UTF-8'}{/if}">{$itemWidth|escape:'html':'UTF-8'}/12 - ( {math equation="x/y*100" x=$itemWidth y=12 format="%.2f"} % )</span>
</a> </a>
</li> </li>

View File

@@ -1,4 +1,4 @@
{* {*
* @Module Name: AP Page Builder * @Module Name: AP Page Builder
* @Website: apollotheme.com - prestashop template provider * @Website: apollotheme.com - prestashop template provider
* @author Apollotheme <apollotheme@gmail.com> * @author Apollotheme <apollotheme@gmail.com>

View File

@@ -23,7 +23,7 @@
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*/ */
$(document).ready(function () { $(document).ready(function () {
$('.block_newsletter form').on('submit', function () { $('.my_row.newsletter form').on('submit', function () {
var psemailsubscriptionForm = $(this); var psemailsubscriptionForm = $(this);
if (typeof psemailsubscription_subscription === 'undefined') { if (typeof psemailsubscription_subscription === 'undefined') {
return true; return true;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -22,49 +22,49 @@
* @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0) * @license https://opensource.org/licenses/AFL-3.0 Academic Free License 3.0 (AFL-3.0)
* International Registered Trademark & Property of PrestaShop SA * International Registered Trademark & Property of PrestaShop SA
*} *}
{extends file='page.tpl'} {extends file='page.tpl'}
{block name='page_title'} {block name='page_title'}
{$cms.meta_title} {$cms.meta_title}
{/block} {/block}
{block name='page_content_container'} {block name='page_content_container'}
<section id="content" class="page-content page-cms page-cms-{$cms.id}"> <section id="content" class="page-content page-cms page-cms-{$cms.id}">
{if $cms.id == 61} {if $cms.id == 61}
<iframe id="paypoIframe" src="https://start.paypo.pl" width="100%" frameborder="no"></iframe> <iframe id="paypoIframe" src="https://start.paypo.pl" width="100%" frameborder="no"></iframe>
{literal} {literal}
<script type="module"> <script type="module">
window.addEventListener('message', event => { window.addEventListener('message', event => {
const paypoIframe = document.querySelector('#paypoIframe'); const paypoIframe = document.querySelector('#paypoIframe');
const eventData = JSON.parse(event.data); const eventData = JSON.parse(event.data);
let isPageHeightSet = false; let isPageHeightSet = false;
if (typeof eventData === "object") { if (typeof eventData === "object") {
if ('pageBodyHeight' in eventData) { if ('pageBodyHeight' in eventData) {
paypoIframe.style.height = eventData.pageBodyHeight + 'px'; paypoIframe.style.height = eventData.pageBodyHeight + 'px';
isPageHeightSet = true; isPageHeightSet = true;
} else { } else {
isPageHeightSet || (paypoIframe.style.height = '5200px'); isPageHeightSet || (paypoIframe.style.height = '5200px');
} }
} }
}); });
</script> </script>
{/literal} {/literal}
{/if} {/if}
{block name='cms_content'} {block name='cms_content'}
{$cms.content nofilter} {$cms.content nofilter}
{/block} {/block}
{block name='hook_cms_dispute_information'} {block name='hook_cms_dispute_information'}
{hook h='displayCMSDisputeInformation'} {hook h='displayCMSDisputeInformation'}
{/block} {/block}
{block name='hook_cms_print_button'} {block name='hook_cms_print_button'}
{hook h='displayCMSPrintButton'} {hook h='displayCMSPrintButton'}
{/block} {/block}
</section> </section>
{/block} {/block}