Merge branch 'bootstrap' of https://github.com/PrestaShop/PrestaShop into bootstrap

Conflicts:
	admin-dev/themes/default/template/controllers/modules/configure.tpl
This commit is contained in:
Kevin Granger
2013-11-18 15:13:04 +01:00
23 changed files with 727 additions and 417 deletions
@@ -48,6 +48,14 @@
<div>{l s='Reset'}</div>
</a>
</li>
{if isset($module_update_link)}
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_update_link}" title="{l s='Update'}">
<i class="process-icon-refresh"></i>
<div>{l s='Update'}</div>
</a>
</li>
{/if}
<li>
<a id="desc-module-hook" class="toolbar_btn" href="{$module_hook_link}" title="{l s='Manage hooks'}">
<i class="process-icon-anchor"></i>
@@ -437,7 +437,7 @@
{/foreach}
{else}
<textarea name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" cols="{$input.cols}" rows="{$input.rows}" class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte {if isset($input.class)}{$input.class}{/if}{else}textarea-autosize{/if}">{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
<textarea name="{$input.name}" id="{if isset($input.id)}{$input.id}{else}{$input.name}{/if}" {if isset($input.cols)}cols="{$input.cols}"{/if} {if isset($input.rows)}rows="{$input.rows}"{/if} class="{if isset($input.autoload_rte) && $input.autoload_rte}rte autoload_rte {if isset($input.class)}{$input.class}{/if}{else}textarea-autosize{/if}">{$fields_value[$input.name]|escape:'htmlall':'UTF-8'}</textarea>
{/if}
{elseif $input.type == 'checkbox'}
+8 -1
View File
@@ -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()
@@ -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
*
+4 -1
View File
@@ -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('/<img.+alt="([^"]+)".*>/Ui', $iframe, $matches) && isset($matches[1]))
$this->phone = $matches[1];
}
InstallSession::getInstance()->support_phone = $this->phone;
return $this->phone;
}
+6
View File
@@ -781,5 +781,11 @@ Country</value>
<configuration id="PS_ATTRIBUTE_ANCHOR_SEPARATOR" name="PS_ATTRIBUTE_ANCHOR_SEPARATOR">
<value>-</value>
</configuration>
<configuration id="CONF_AVERAGE_PRODUCT_MARGIN" name="CONF_AVERAGE_PRODUCT_MARGIN">
<value>40</value>
</configuration>
<configuration id="PS_DASHBOARD_SIMULATION" name="PS_DASHBOARD_SIMULATION">
<value>1</value>
</configuration>
</entities>
</entity_configuration>
+24
View File
@@ -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 <contact@prestashop.com>
* @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
+24
View File
@@ -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 <contact@prestashop.com>
* @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
+24
View File
@@ -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 <contact@prestashop.com>
* @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()
+24
View File
@@ -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 <contact@prestashop.com>
* @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
+24
View File
@@ -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 <contact@prestashop.com>
* @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()
{
+27 -8
View File
@@ -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 <contact@prestashop.com>
* @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();
});
});
+1 -1
View File
@@ -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)
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 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 <contact@prestashop.com>
* @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;
@@ -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 <contact@prestashop.com>
* @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
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

@@ -0,0 +1,36 @@
<?php
/*
* 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 <contact@prestashop.com>
* @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;
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 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 <contact@prestashop.com>
* @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;
@@ -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 <contact@prestashop.com>
* @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'));
}
);
}
);
+63 -396
View File
@@ -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 = '<a href="'.$this->context->link->getAdminLink('AdminModules', true).'&configure='.urlencode($module_instance->name).'&tab_module='.$module_instance->tab.'&module_name='.urlencode($module_instance->name).'">'.$this->l('Configure').'</a>';
}
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' => '<a href="#">'.$this->l('Configure the reinsurance block').'</a>',
'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' => '<a href="#">'.$this->l('Configure the social following links').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blocksocial')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Display contact information'),
'name' => 'blockcontactinfos',
'desc' => '<a href="#">'.$this->l('Configure the contact information of your store').'</a>',
'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' => '<a href="#">'.$this->l('Configure').'</a>',
'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' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockfacebook')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Customer cms information block'),
'name' => 'blockcmsinfo',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockcmsinfo')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Customer banner information block'),
'name' => 'tmhtmlcontent',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'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' => '<a href="#">'.$this->l('Configure').'</a>',
'value' => (int)(Validate::isLoadedObject($module = Module::getInstanceByName('blockbanner')) && $module->active),
'is_module' => true,
),
array(
'label' => $this->l('Enable product payment logos'),
'name' => 'productpaymentlogos',
'desc' => '<a href="#">'.$this->l('Configure').'</a>',
'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;
}
}
}
}
+36
View File
@@ -0,0 +1,36 @@
<?php
/*
* 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 <contact@prestashop.com>
* @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;
@@ -0,0 +1,36 @@
<?php
/*
* 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 <contact@prestashop.com>
* @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;
@@ -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 <contact@prestashop.com>
* @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
*}
<div id="gear-right">
<i class="icon-cogs icon-2x icon-light"></i>
</div>
<form action="" method="post">
<input type="hidden" name="theme" id="theme" />
<div id="tool_customization">
<p>
{l s='The customization tool allows you to make color and font changes in your theme.' mod='themeconfigurator'}<br /><br />
<span>
{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'}
</span>
</p>
<div class="list-tools">
<p>
{l s='Color theme' mod='themeconfigurator'}
<i class="icon-caret-down pull-right"></i>
</p>
</div>
{if isset($themes_colors)}
<div id="color-box">
<ul>
{foreach $themes_colors as $theme}
<li class="{$theme}">
<div class="color-theme1 color1"></div>
<div class="color-theme2 color2"> </div>
</li>
{/foreach}
</ul>
</div>
{/if}
<div class="list-tools">
<p>
{l s='Font' mod='themeconfigurator'}
<i class="icon-caret-down pull-right"></i>
</p>
</div>
<div id="font-box">
<p>{l s='Text page' mod='themeconfigurator'}</p>
<select name="text-page-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
<p>{l s='Text menu parrent normal' mod='themeconfigurator'}</p>
<select name="text-menu-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
<p>{l s='Product name' mod='themeconfigurator'}</p>
<select name="product-name-font" class="font-list">
{foreach $themes_fonts as $key => $font}
<option value="{$key}">{$font}</option>
{/foreach}
</select>
</div>
<div class="btn-tools">
<button type="reset" class="btn btn-1">{l s='Reset' mod='themeconfigurator'}</button>
<button type="submit" class="btn btn-2" name="submitLiveConfigurator">{l s='Save' mod='themeconfigurator'}</button>
</div>
<div id="block-advertisement">
<img src="{$advertisement_image}" alt="{$advertisement_text}" />
</div>
</div>
</form>