diff --git a/admin-dev/themes/default/template/controllers/modules/configure.tpl b/admin-dev/themes/default/template/controllers/modules/configure.tpl index a8941f8ee..a2a011fbe 100644 --- a/admin-dev/themes/default/template/controllers/modules/configure.tpl +++ b/admin-dev/themes/default/template/controllers/modules/configure.tpl @@ -48,6 +48,14 @@
{l s='Reset'}
+ {if isset($module_update_link)} +
  • + + +
    {l s='Update'}
    +
    +
  • + {/if}
  • diff --git a/admin-dev/themes/default/template/helpers/form/form.tpl b/admin-dev/themes/default/template/helpers/form/form.tpl index d9ef5e964..1cf88291c 100644 --- a/admin-dev/themes/default/template/helpers/form/form.tpl +++ b/admin-dev/themes/default/template/helpers/form/form.tpl @@ -437,7 +437,7 @@ {/foreach} {else} - + {/if} {elseif $input.type == 'checkbox'} diff --git a/controllers/admin/AdminModulesController.php b/controllers/admin/AdminModulesController.php index a3d79b831..34ca493ff 100644 --- a/controllers/admin/AdminModulesController.php +++ b/controllers/admin/AdminModulesController.php @@ -705,6 +705,7 @@ class AdminModulesControllerCore extends AdminController $disable_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&enable=0&tab_module='.$module->tab; $uninstall_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&uninstall='.$module->name.'&tab_module='.$module->tab; $reset_link = $this->context->link->getAdminLink('AdminModules').'&module_name='.$module->name.'&reset&tab_module='.$module->tab; + $update_link = $this->context->link->getAdminLink('AdminModules').'&check_and_update='.$module->name.'&module_name='.$module->name.'&reset&tab_module='.$module->tab; $this->context->smarty->assign(array( 'module_name' => $module->name, @@ -714,6 +715,7 @@ class AdminModulesControllerCore extends AdminController 'module_disable_link' => $disable_link, 'module_uninstall_link' => $uninstall_link, 'module_reset_link' => $reset_link, + 'module_update_link' => (Module::needUpgrade($module) ? $update_link : null), 'trad_link' => $trad_link, 'module_languages' => Language::getLanguages(false), 'theme_language_dir' => _THEME_LANG_DIR_ @@ -790,8 +792,13 @@ class AdminModulesControllerCore extends AdminController Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params); } - if (isset($_GET['update'])) + if (Tools::getValue('update')) Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor='.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '')); + + if (Tools::getValue('check_and_update')) + { + //TODO + } } public function postProcess() diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index d274cbec7..388a552c2 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -2488,15 +2488,6 @@ class AdminProductsControllerCore extends AdminController $this->context->smarty->assign('toolbar_btn', $this->toolbar_btn); } - public function initToolbarTitle() - { - parent::initToolbarTitle(); - - if ($this->display != 'list') - if (($product = $this->loadObject(true)) && Validate::isLoadedObject($product)) - $this->toolbar_title[] = Tools::htmlentitiesUTF8($product->name[$this->context->employee->id_lang]); - } - /** * renderForm contains all necessary initialization needed for all tabs * diff --git a/install-dev/classes/controllerHttp.php b/install-dev/classes/controllerHttp.php index 8a83a4526..53bc10f39 100644 --- a/install-dev/classes/controllerHttp.php +++ b/install-dev/classes/controllerHttp.php @@ -321,13 +321,16 @@ abstract class InstallControllerHttp */ public function getPhone() { + if (InstallSession::getInstance()->support_phone != null) + return InstallSession::getInstance()->support_phone; if ($this->phone === null) { $this->phone = $this->language->getInformation('phone', false); - if ($iframe = Tools::file_get_contents('http://api.prestashop.com/iframe/install.php?lang='.$this->language->getLanguageIso())) + if ($iframe = Tools::file_get_contents('http://api.prestashop.com/iframe/install.php?lang='.$this->language->getLanguageIso(), false, null, 3)) if (preg_match('//Ui', $iframe, $matches) && isset($matches[1])) $this->phone = $matches[1]; } + InstallSession::getInstance()->support_phone = $this->phone; return $this->phone; } diff --git a/install-dev/data/xml/configuration.xml b/install-dev/data/xml/configuration.xml index 57ae25ae3..4e8fd7658 100644 --- a/install-dev/data/xml/configuration.xml +++ b/install-dev/data/xml/configuration.xml @@ -781,5 +781,11 @@ Country - + + 40 + + + 1 + diff --git a/install-dev/theme/js/configure.js b/install-dev/theme/js/configure.js index 98a647702..77b83ba14 100644 --- a/install-dev/theme/js/configure.js +++ b/install-dev/theme/js/configure.js @@ -1,3 +1,27 @@ +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + $(document).ready(function() { // Change logo diff --git a/install-dev/theme/js/database.js b/install-dev/theme/js/database.js index f19e8f651..25aa056c4 100644 --- a/install-dev/theme/js/database.js +++ b/install-dev/theme/js/database.js @@ -1,3 +1,27 @@ +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + $(document).ready(function() { // Check database configuration diff --git a/install-dev/theme/js/install.js b/install-dev/theme/js/install.js index e5d753eb2..1ea1114d8 100644 --- a/install-dev/theme/js/install.js +++ b/install-dev/theme/js/install.js @@ -1,3 +1,27 @@ +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + $(document).ready(function() { $('#mainForm').submit(function() diff --git a/install-dev/theme/js/license.js b/install-dev/theme/js/license.js index 74371fa93..dc0b2e81c 100644 --- a/install-dev/theme/js/license.js +++ b/install-dev/theme/js/license.js @@ -1,3 +1,27 @@ +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + $(document).ready(function() { // Desactivate next button if licence checkbox is not checked diff --git a/install-dev/theme/js/process.js b/install-dev/theme/js/process.js index 22d66d9c4..6e523dcfc 100644 --- a/install-dev/theme/js/process.js +++ b/install-dev/theme/js/process.js @@ -1,3 +1,27 @@ +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + var is_installing = false; $(document).ready(function() { diff --git a/install-dev/theme/js/welcome.js b/install-dev/theme/js/welcome.js index 48cc69dfa..90976346b 100644 --- a/install-dev/theme/js/welcome.js +++ b/install-dev/theme/js/welcome.js @@ -1,10 +1,29 @@ -$(document).ready(function() -{ - // Submit change of language - $('#langList').change(function() - { - var form = $('#mainForm'); - form.attr('action', form.attr('action')+'#licenses-agreement'); - form.submit(); +/* +* +* NOTICE OF LICENSE +* +* This source file is subject to the Open Software License (OSL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/osl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +$(document).ready(function() { + $('#langList').change(function() { + $('#mainForm').submit(); }); }); \ No newline at end of file diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index 67669e8a5..69851cd19 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -217,7 +217,7 @@ class BlockCategories extends Module $resultIds[$row['id_category']] = &$row; } - $blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category && (!isset($params['is_top_menu']) || !$params['is_top_menu']) ? $category->id : null)); + $blockCategTree = $this->getTree($resultParents, $resultIds, $maxdepth, ($category ? $category->id : null)); $this->smarty->assign('blockCategTree', $blockCategTree); if ($category) diff --git a/modules/themeconfigurator/css/index.php b/modules/themeconfigurator/css/index.php new file mode 100644 index 000000000..69b76d92d --- /dev/null +++ b/modules/themeconfigurator/css/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/modules/themeconfigurator/css/live_configurator.css b/modules/themeconfigurator/css/live_configurator.css new file mode 100644 index 000000000..f7cd40dc2 --- /dev/null +++ b/modules/themeconfigurator/css/live_configurator.css @@ -0,0 +1,183 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +#gear-right{ + background: #333333; + display: block; + height: 50px; + left: 215px; + position: fixed; + top: 90px; + width: 50px; + z-index: 20; +} + +#gear-right i{ + display: block; + padding-top: 10px; + text-align: center; +} + +#tool_customization{ + position: fixed; + left: 0; + top: 90px; + z-index: 20; + height: auto; + width: 215px; + background: #333333 +} + +#tool_customization p{ + padding: 15px; + color:#ffffff; + font-size: 13px; + text-shadow: 0.1em 0.1em 0.05em #000000 +} + +#tool_customization p span{ + color:#8d8c8c; + font-size: 11px; +} + +#tool_customization .list-tools{ + background: #484848; + border:1px solid #595959; + border-left: none; + border-right:none; + height:50px; +} + +#tool_customization .list-tools p{font-weight: bold;} + +#tool_customization .list-tools i{padding-top: 3px} + +#tool_customization #color-box{padding: 15px} + +#tool_customization #color-box ul li{ + display: inline-block; + border: 1px solid #595959; + height:27px; + width: 27px; + margin:5px 5px 5px 0; +} + +#tool_customization #color-box .color-theme1{ + display:block; + width:0px; + height:0px; + border-left-color:transparent !important; + border-top-color:transparent !important; + position: relative; + z-index: 1 +} + +#tool_customization #color-box .color-theme2{ + display:block; + width:25px; + height:25px; + position: relative; + top: -26px; +} + +#tool_customization #color-box .theme1 .color1{border:13px solid #ffffff;} +#tool_customization #color-box .theme1 .color2{background: #484848;} + +#tool_customization #color-box .theme2 .color1{border:13px solid #f6f6f6;} +#tool_customization #color-box .theme2 .color2{background: #f2404e;} + +#tool_customization #color-box .theme3 .color1{border:13px solid #333333;} +#tool_customization #color-box .theme3 .color2{background: #545454;} + +#tool_customization #color-box .theme4 .color1{border:13px solid #272727;} +#tool_customization #color-box .theme4 .color2{background: #eac22d;} + +#tool_customization #color-box .theme5 .color1{border:13px solid #ffffff;} +#tool_customization #color-box .theme5 .color2{background: #729f42;} + +#tool_customization #color-box .theme6 .color1{border:13px solid #f5f1e8;} +#tool_customization #color-box .theme6 .color2{background: #b04444;} + +#tool_customization #color-box .theme7 .color1{border:13px solid #f1f1f1;} +#tool_customization #color-box .theme7 .color2{background: #317081;} + +#tool_customization #color-box .theme8 .color1{border:13px solid #fcfcfc;} +#tool_customization #color-box .theme8 .color2{background: #43bebc;} + +#tool_customization #color-box .theme9 .color1{border:13px solid #f9f6ed;} +#tool_customization #color-box .theme9 .color2{background: #eea200;} + +#tool_customization #font-box{padding:0 15px 15px;} +#tool_customization #font-box p{ + padding:0; + margin: 15px 0 5px; + color:#9c9b9b; +} + +#tool_customization #font-box .font-list{ + background: #484848; + border:1px solid #595959; + height:30px; + width:180px; + color:#ffffff; +} + +#tool_customization #font-box .font-list li{clear:both;padding-right: 10px;} + +#tool_customization #font-box .font-list li p{ + display: inline-block; + margin: 0; + padding: 5px 15px; + color:#9c9b9b; + text-shadow: 0 0 0 transparent; +} + +#tool_customization #font-box .font-list li i{padding-top: 6px} + + +#tool_customization .btn-tools{ + background: #484848; + border:1px solid #595959; + border-left: none; + border-right:none; + height: 56px; + padding: 10px 15px; +} + +#tool_customization .btn{font-weight: bold;} + +#tool_customization .btn-1{ + background: #727171; + color: #ffffff; + text-shadow: 0.1em 0.1em 0.05em #000000 +} +#tool_customization .btn-2{ + background: #ffffff; + color: #3a3939; +} + +#tool_customization #block-advertisement{ + padding: 15px +} \ No newline at end of file diff --git a/modules/themeconfigurator/img/en/advertisement.png b/modules/themeconfigurator/img/en/advertisement.png new file mode 100644 index 000000000..0fc600890 Binary files /dev/null and b/modules/themeconfigurator/img/en/advertisement.png differ diff --git a/modules/themeconfigurator/img/en/index.php b/modules/themeconfigurator/img/en/index.php new file mode 100644 index 000000000..54b3024eb --- /dev/null +++ b/modules/themeconfigurator/img/en/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../'); +exit; \ No newline at end of file diff --git a/modules/themeconfigurator/img/index.php b/modules/themeconfigurator/img/index.php new file mode 100644 index 000000000..69b76d92d --- /dev/null +++ b/modules/themeconfigurator/img/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/modules/themeconfigurator/js/live_configurator.js b/modules/themeconfigurator/js/live_configurator.js new file mode 100644 index 000000000..83a073d80 --- /dev/null +++ b/modules/themeconfigurator/js/live_configurator.js @@ -0,0 +1,36 @@ +/* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +$(document).ready( + function () + { + $('#color-box').find('li').click( + function() + { + $('#theme').val($(this).attr('class')); + } + ); + } +); \ No newline at end of file diff --git a/modules/themeconfigurator/themeconfigurator.php b/modules/themeconfigurator/themeconfigurator.php index 6d2bf81bb..ca1f0def3 100644 --- a/modules/themeconfigurator/themeconfigurator.php +++ b/modules/themeconfigurator/themeconfigurator.php @@ -26,279 +26,67 @@ if (!defined('_PS_VERSION_')) exit; - + class ThemeConfigurator extends Module { - protected $max_image_size = 1048576; - protected $default_language; - protected $languages; - public function __construct() { $this->name = 'themeconfigurator'; $this->tab = 'front_office_features'; $this->version = '0.1'; - $this->bootstrap = true; - - $this->secure_key = Tools::encrypt($this->name); - $this->default_language = Language::getLanguage(Configuration::get('PS_LANG_DEFAULT')); - $this->languages = Language::getLanguages(); - parent::__construct(); $this->displayName = $this->l('Theme configurator'); $this->description = $this->l('Configure elements of your theme'); - - $this->module_path = _PS_MODULE_DIR_.$this->name.'/'; - $this->uploads_path = _PS_MODULE_DIR_.$this->name.'/images/'; - $this->admin_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/admin/'; - $this->hooks_tpl_path = _PS_MODULE_DIR_.$this->name.'/views/templates/hooks/'; - + $this->bootstrap = true; } - - public function install() + + public function install() { - if (!parent::install() || - !$this->installDB() || - !$this->registerHook('displayHeader') || - !$this->registerHook('displayTop') || - !$this->registerHook('displayLeftColumn') || - !$this->registerHook('displayRightColumn') || - !$this->registerHook('displayHome') || - !$this->registerHook('displayFooter') || - !$this->registerHook('displayBackOfficeHeader')) - return false; - - return true; - } - - private function installDB() - { - return ( - Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'themeconfigurator`') && - Db::getInstance()->Execute(' - CREATE TABLE `'._DB_PREFIX_.'themeconfigurator` ( - `id_item` int(10) unsigned NOT NULL AUTO_INCREMENT, - `id_shop` int(10) unsigned NOT NULL, - `id_lang` int(10) unsigned NOT NULL, - `item_order` int(10) unsigned NOT NULL, - `title` VARCHAR(100), - `title_use` tinyint(1) unsigned NOT NULL DEFAULT \'0\', - `hook` VARCHAR(100), - `url` VARCHAR(100), - `target` tinyint(1) unsigned NOT NULL DEFAULT \'0\', - `image` VARCHAR(100), - `image_w` VARCHAR(10), - `image_h` VARCHAR(10), - `html` TEXT, - `active` tinyint(1) unsigned NOT NULL DEFAULT \'1\', - PRIMARY KEY (`id_item`) - ) ENGINE = '._MYSQL_ENGINE_.' DEFAULT CHARSET=UTF8;') + $themes_colors = array('theme1', 'theme2', 'theme3', 'theme4', 'theme5', 'theme6', 'theme7', 'theme8', 'theme9'); + $themes_fonts = array( + 'Georgia, serif', + '"Palatino Linotype", "Book Antiqua", Palatino, serif', + '"Times New Roman", Times, serif', + 'Arial, Helvetica, sans-serif', + '"Arial Black", Gadget, sans-serif', + 'Impact, Charcoal, sans-serif', + '"Lucida Sans Unicode", "Lucida Grande", sans-serif', + 'Tahoma, Geneva, sans-serif', + '"Trebuchet MS", Helvetica, sans-serif', + 'Verdana, Geneva, sans-serif', + '"Courier New", Courier, monospace', + '"Lucida Console", Monaco, monospace' ); - return true; + return (parent::install() + && $this->registerHook('top') + && Configuration::updateValue('PS_TC_THEMES', serialize($themes_colors)) + && Configuration::updateValue('PS_TC_THEMES_FONTS', serialize($themes_fonts))); } - public function uninstall() + public function hookTop($params) { - $images = Db::getInstance()->executeS('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator`'); - foreach ($images as $image) - $this->deleteImage($image['image']); - - if (!Db::getInstance()->Execute('DROP TABLE IF EXISTS `'._DB_PREFIX_.'themeconfigurator`') || - !parent::uninstall()) - return false; - - return true; - } - - public function hookDisplayBackOfficeHeader() - { - if (Tools::getValue('configure') != $this->name) - return; - $this->context->controller->addCSS($this->_path.'views/css/admin.css'); - $this->context->controller->addJquery(); - $this->context->controller->addJS($this->_path.'views/js/admin.js'); - } - - public function hookdisplayHeader($params) - { - $this->context->controller->addCss($this->_path.'views/css/hooks.css', 'all'); - } - - public function hookDisplayTop() - { - $this->context->smarty->assign(array( - 'htmlitems'=> $this->getItemsFromHook('top'), - 'hook' => 'top' - )); - return $this->display(__FILE__, 'views/templates/hooks/hook.tpl'); - } - - public function hookDisplayHome() - { - $this->context->smarty->assign(array( - 'htmlitems'=> $this->getItemsFromHook('home'), - 'hook' => 'home' - )); - return $this->display(__FILE__, 'views/templates/hooks/hook.tpl'); - } - - public function hookDisplayLeftColumn() - { - $this->context->smarty->assign(array( - 'htmlitems'=> $this->getItemsFromHook('left'), - 'hook' => 'left' - )); - return $this->display(__FILE__, 'views/templates/hooks/hook.tpl'); - } - - public function hookDisplayRightColumn() - { - $this->context->smarty->assign(array( - 'htmlitems'=> $this->getItemsFromHook('right'), - 'hook' => 'right' - )); - return $this->display(__FILE__, 'views/templates/hooks/hook.tpl'); - } - - public function hookDisplayFooter() - { - $this->context->smarty->assign(array( - 'htmlitems'=> $this->getItemsFromHook('footer'), - 'hook' => 'footer' - )); - return $this->display(__FILE__, 'views/templates/hooks/hook.tpl'); - } - - protected function getItemsFromHook($hook) - { - if (!$hook) - return false; - - return Db::getInstance()->ExecuteS(' - SELECT * - FROM `'._DB_PREFIX_.'themeconfigurator` - WHERE id_shop = '.(int)$this->context->shop->id.' AND id_lang = '.(int)$this->context->language->id.' AND hook = \''.pSQL($hook).'\' AND active = 1 - ORDER BY item_order ASC' - ); - } - - protected function deleteImage($image) - { - $file_name = $this->uploads_path.$image; - if (realpath(dirname($file_name)) != $this->uploads_path) - die; - - if ($image != '' && is_file($file_name)) - unlink($file_name); - } - - protected function removeItem() - { - $id_item = (int)Tools::getValue('item_id'); - - if ($image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)$id_item)) - $this->deleteImage($image); - - Db::getInstance()->delete(_DB_PREFIX_.'themeconfigurator', 'id_item = '.(int)$id_item); - - if (Db::getInstance()->Affected_Rows() == 1) + if ((int)Tools::getValue('live_configurator', 0) == 1) { - Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'themeconfigurator` - SET item_order = item_order-1 - WHERE ( - item_order > '.(int)Tools::getValue('item_order').' AND - id_shop = '.(int)$this->context->shop->id.' AND - hook = \''.pSQL(Tools::getValue('item_hook')).'\') - '); - - $this->context->smarty->assign('confirmation', $this->l('Successful deletion.')); + if (Tools::isSubmit('submitLiveConfigurator')) + { + Configuration::updateValue('PS_TC_THEME', Tools::getValue('theme')); + Configuration::updateValue('PS_TC_TEXT_PAGE_FONT', Tools::getValue('text-page-font')); + Configuration::updateValue('PS_TC_TEXT_MENU_FONT', Tools::getValue('text-menu-font')); + Configuration::updateValue('PS_TC_PRODUCT_NAME_FONT', Tools::getValue('product-name-font')); + } + + $this->context->controller->addCSS($this->_path.'css/live_configurator.css'); + $this->context->controller->addJS($this->_path.'js/live_configurator.js'); + + $this->smarty->assign(array( + 'themes_colors' => unserialize(Configuration::get('PS_TC_THEMES_COLORS')), + 'themes_fonts' => unserialize(Configuration::get('PS_TC_THEMES_FONTS')), + 'advertisement_image' => $this->_path.'/img/'.$this->context->language->iso_code.'/advertisement.png', + 'advertisement_text' => $this->l('Over 500+ PrestaShop Premium Templates! Browse Now!') + )); + return $this->display(__FILE__, 'live_configurator.tpl'); } - else - $this->context->smarty->assign('error', $this->l('Can\'t delete the slide.')); - } - - protected function updateItem() - { - $id_item = (int)Tools::getValue('item_id'); - - $title = Tools::getValue('item_title'); - $content = Tools::getValue('item_html'); - if (!Validate::isCleanHtml($title, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')) || !Validate::isCleanHtml($content,(int)Configuration::get('PS_ALLOW_HTML_IFRAME'))) - { - $this->context->smarty->assign('error', $this->l('Invalid content')); - return false; - } - - $new_image = ''; - $image_w = (is_numeric(Tools::getValue('item_img_w'))) ? (int)Tools::getValue('item_img_w') : ''; - $image_h = (is_numeric(Tools::getValue('item_img_h'))) ? (int)Tools::getValue('item_img_h') : ''; - - if(!empty($_FILES['item_img']['name'])) - { - if ($old_image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)$id_item)) - $this->_deleteImages($old_image); - - if (!$image = $this->uploadImage($_FILES['item_img'], $image_w, $image_h)) - return false; - - $new_image = 'image = \''.pSQL($image).'\','; - } - else - { - $image_w = ''; - $image_h = ''; - } - - if (!Db::getInstance()->execute(' - UPDATE `'._DB_PREFIX_.'themeconfigurator` SET - title = \''.pSQL($title).'\', - title_use = '.(int)Tools::getValue('item_title_use').', - hook = \''.pSQL(Tools::getValue('item_hook')).'\', - url = \''.pSQL(Tools::getValue('item_url')).'\', - target = '.(int)Tools::getValue('item_target').', - '.$new_image.' - image_w = '.(int)$image_w.', - image_h = '.(int)$image_h.', - active = '.(int)Tools::getValue('item_active').', - html = \''.pSQL($content).'\' - WHERE id_item = '.(int)Tools::getValue('item_id') - )) - { - if ($image = Db::getInstance()->getValue('SELECT image FROM `'._DB_PREFIX_.'themeconfigurator` WHERE id_item = '.(int)Tools::getValue('item_id'))) - $this->deleteImage($image); - - $this->context->smarty->assign('error', $this->l('An error occured while saving data.')); - return false; - } - $this->context->smarty->assign('confirmation', $this->l('Successfully updated.')); - return true; - - } - - protected function uploadImage($image, $image_w = '', $image_h = '') - { - $res = false; - if (is_array($image) && (ImageManager::validateUpload($image, $this->max_image_size) === false) && ($tmp_name = tempnam(_PS_TMP_IMG_DIR_, 'PS')) && move_uploaded_file($image['tmp_name'], $tmp_name)) - { - $type = Tools::strtolower(Tools::substr(strrchr($image['name'], '.'), 1)); - $img_name = Tools::encrypt($image['name'].sha1(microtime())).'.'.$type; - Configuration::set('PS_IMAGE_QUALITY','png_all'); - if (ImageManager::resize($tmp_name, dirname(__FILE__).'/images/'.$img_name, $image_w, $image_h)) - $res = true; - - } - - if (isset($temp_name)) - @unlink($tmp_name); - if (!$res) - { - $this->context->smarty->assign('error', $this->l('An error occurred during the image upload.')); - return false; - } - - return $img_name; } public function getContent() @@ -331,107 +119,18 @@ class ThemeConfigurator extends Module $module_instance->install(); } } - - if (Tools::isSubmit('newItem')) - $this->addItem(); - elseif (Tools::isSubmit('updateItem')) - $this->updateItem(); - elseif (Tools::isSubmit('removeItem')) - $this->removeItem(); - - $html = $this->renderConfigurationForm(); - $html .= $this->renderThemeConfiguratorForm(); - - return $html; + return $this->renderForm(); } - protected function addItem() - { - $title = Tools::getValue('item_title'); - $content = Tools::getValue('item_html'); - if (!Validate::isCleanHtml($title, (int)Configuration::get('PS_ALLOW_HTML_IFRAME')) || !Validate::isCleanHtml($content, (int)Configuration::get('PS_ALLOW_HTML_IFRAME'))) - { - $this->context->smarty->assign('error', $this->l('Invalid content')); - return false; - } - - - if (!$current_order = (int)Db::getInstance()->getValue(' - SELECT item_order + 1 - FROM `'._DB_PREFIX_.'themeconfigurator` - WHERE - id_shop = '.(int)$this->context->shop->id.' - AND id_lang = '.(int)Tools::getValue('id_lang').' - AND hook = \''.pSQL(Tools::getValue('item_hook')).'\' - ORDER BY item_order DESC' - )) - $current_order = 1; - - $image_w = is_numeric(Tools::getValue('item_img_w')) ? (int)Tools::getValue('item_img_w') : ''; - $image_h = is_numeric(Tools::getValue('item_img_h')) ? (int)Tools::getValue('item_img_h') : ''; - - if(!empty($_FILES['item_img']['name'])) - { - if (!$image = $this->uploadImage($_FILES['item_img'], $image_w, $image_h)) - return false; - } - else - { - $image = ''; - $image_w = ''; - $image_h = ''; - } - - if (!Db::getInstance()->Execute(' - INSERT INTO `'._DB_PREFIX_.'themeconfigurator` ( - `id_shop`, `id_lang`, `item_order`, `title`, `title_use`, `hook`, `url`, `target`, `image`, `image_w`, `image_h`, `html`, `active` - ) VALUES ( - \''.(int)$this->context->shop->id.'\', - \''.(int)Tools::getValue('id_lang').'\', - \''.(int)$current_order.'\', - \''.pSQL($title).'\', - \''.(int)Tools::getValue('item_title_use').'\', - \''.pSQL(Tools::getValue('item_hook')).'\', - \''.pSQL(Tools::getValue('item_url')).'\', - \''.(int)Tools::getValue('item_target').'\', - \''.pSQL($image).'\', - \''.pSQL($image_w).'\', - \''.pSQL($image_h).'\', - \''.pSQL($content).'\', - 1) - ')) - { - if (!Tools::isEmpty($image)) - $this->deleteImage($image); - - $this->context->smarty->assign('error', $this->l('An error occured while saving data.')); - return false; - } - - $this->context->smarty->assign('confirmation', $this->l('New item added successfull.')); - return true; - } - - public function renderConfigurationForm() + public function renderForm() { $inputs = array(); foreach ($this->getConfigurableModules() as $module) - { - $desc = ''; - if (isset($module['is_module']) && $module['is_module']) - { - $module_instance = Module::getInstanceByName($module['name']); - if (Validate::isLoadedObject($module_instance) && method_exists($module_instance, 'getContent')) - $desc = ''.$this->l('Configure').''; - } - if (!$desc && isset($module['desc']) && $module['desc']) - $desc = $module['desc']; - $inputs[] = array( 'type' => 'switch', 'label' => $module['label'], 'name' => $module['name'], - 'desc' => $desc, + 'desc' => (isset($module['desc']) ? $module['desc'] : ''), 'values' => array( array( 'id' => 'active_on', @@ -445,7 +144,6 @@ class ThemeConfigurator extends Module ) ), ); - } $fields_form = array( 'form' => array( @@ -456,7 +154,7 @@ class ThemeConfigurator extends Module 'input' => $inputs, 'submit' => array( 'title' => $this->l('Save'), - 'class' => 'btn btn-primary') + 'class' => 'btn btn-default') ), ); @@ -480,52 +178,6 @@ class ThemeConfigurator extends Module return $helper->generateForm(array($fields_form)); } - - protected function renderThemeConfiguratorForm() - { - $id_shop = (int)$this->context->shop->id; - $items = array(); - - $this->context->smarty->assign('htmlcontent', array( - 'admin_tpl_path' => $this->admin_tpl_path, - 'hooks_tpl_path' => $this->hooks_tpl_path, - - 'info' => array( - 'module' => $this->name, - 'name' => $this->displayName, - 'version' => $this->version, - 'psVersion' => _PS_VERSION_, - 'context' => (Configuration::get('PS_MULTISHOP_FEATURE_ACTIVE') == 0) ? 1 : ($this->context->shop->getTotalShops() != 1) ? $this->context->shop->getContext() : 1 - ) - )); - - foreach ($this->languages as $language) { - $hooks[$language['id_lang']] = array('home', 'top', 'left', 'right', 'footer'); - - foreach ($hooks[$language['id_lang']] as $hook) - $items[$language['id_lang']][$hook] = Db::getInstance()->ExecuteS(' - SELECT * FROM `'._DB_PREFIX_.'themeconfigurator` - WHERE id_shop = '.(int)$id_shop.' - AND id_lang = '.(int)$language['id_lang'].' - AND hook = \''.pSQL($hook).'\' - ORDER BY item_order ASC' - ); - } - - $this->context->smarty->assign('htmlitems', array( - 'items' => $items, - 'lang' => array( - 'default' => $this->default_language, - 'all' => $this->languages, - 'lang_dir' => _THEME_LANG_DIR_, - 'user' => $this->context->language->id - ), - 'postAction' => 'index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminTokenLite('AdminModules').'&tab_module=other&module_name='.$this->name.'', - 'id_shop' => $id_shop - )); - - return $this->display(__FILE__, 'views/templates/admin/admin.tpl'); - } protected function getConfigurableModules() { @@ -533,39 +185,52 @@ class ThemeConfigurator extends Module array( 'label' => $this->l('Display the reinsurance block'), 'name' => 'blockreinsurance', + 'desc' => ''.$this->l('Configure the reinsurance block').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockreinsurance')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Display the social following links'), 'name' => 'blocksocial', + 'desc' => ''.$this->l('Configure the social following links').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blocksocial')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Display contact information'), 'name' => 'blockcontactinfos', + 'desc' => ''.$this->l('Configure the contact information of your store').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockcontactinfos')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Display social buttons on the products page'), 'name' => 'addsharethis', + 'desc' => ''.$this->l('Configure').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('addsharethis')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Display facebook block on the home page'), 'name' => 'blockfacebook', + 'desc' => ''.$this->l('Configure').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockfacebook')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Customer cms information block'), 'name' => 'blockcmsinfo', + 'desc' => ''.$this->l('Configure').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockcmsinfo')) && $module->active), 'is_module' => true, ), + array( + 'label' => $this->l('Customer banner information block'), + 'name' => 'tmhtmlcontent', + 'desc' => ''.$this->l('Configure').'', + 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('tmhtmlcontent')) && $module->active), + 'is_module' => true, + ), array( 'label' => $this->l('Enable Quick view'), 'name' => 'quick_view', @@ -574,12 +239,14 @@ class ThemeConfigurator extends Module array( 'label' => $this->l('Enable top banner'), 'name' => 'blockbanner', + 'desc' => ''.$this->l('Configure').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockbanner')) && $module->active), 'is_module' => true, ), array( 'label' => $this->l('Enable product payment logos'), 'name' => 'productpaymentlogos', + 'desc' => ''.$this->l('Configure').'', 'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('productpaymentlogos')) && $module->active), 'is_module' => true, ) @@ -593,5 +260,5 @@ class ThemeConfigurator extends Module $values[$module['name']] = $module['value']; return $values; - } -} \ No newline at end of file + } +} diff --git a/modules/themeconfigurator/views/index.php b/modules/themeconfigurator/views/index.php new file mode 100644 index 000000000..69b76d92d --- /dev/null +++ b/modules/themeconfigurator/views/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../'); +exit; \ No newline at end of file diff --git a/modules/themeconfigurator/views/templates/hook/index.php b/modules/themeconfigurator/views/templates/hook/index.php new file mode 100644 index 000000000..422fa9d45 --- /dev/null +++ b/modules/themeconfigurator/views/templates/hook/index.php @@ -0,0 +1,36 @@ + +* @copyright 2007-2013 PrestaShop SA + +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); +header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT'); + +header('Cache-Control: no-store, no-cache, must-revalidate'); +header('Cache-Control: post-check=0, pre-check=0', false); +header('Pragma: no-cache'); + +header('Location: ../../../../../'); +exit; \ No newline at end of file diff --git a/modules/themeconfigurator/views/templates/hook/live_configurator.tpl b/modules/themeconfigurator/views/templates/hook/live_configurator.tpl new file mode 100644 index 000000000..06e8b9e63 --- /dev/null +++ b/modules/themeconfigurator/views/templates/hook/live_configurator.tpl @@ -0,0 +1,90 @@ +{* +* 2007-2013 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author PrestaShop SA +* @copyright 2007-2013 PrestaShop SA +* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +
    + +
    +
    + +
    +

    + {l s='The customization tool allows you to make color and font changes in your theme.' mod='themeconfigurator'}

    + + {l s='Only you, as a merchant can see this tool (as you are currently logged in your Back-office), your visitors will not see this tool.' mod='themeconfigurator'} + +

    +
    +

    + {l s='Color theme' mod='themeconfigurator'} + +

    +
    + {if isset($themes_colors)} +
    +
      + {foreach $themes_colors as $theme} +
    • +
      +
      +
    • + {/foreach} +
    +
    + {/if} +
    +

    + {l s='Font' mod='themeconfigurator'} + +

    +
    +
    +

    {l s='Text page' mod='themeconfigurator'}

    + +

    {l s='Text menu parrent normal' mod='themeconfigurator'}

    + +

    {l s='Product name' mod='themeconfigurator'}

    + +
    +
    + + +
    +
    + {$advertisement_text} +
    +
    +
    \ No newline at end of file