AntonLV 10 лет назад
Родитель
Сommit
bf215f8e0e

+ 30 - 28
modules/boonex/uni/data/template/system/scripts/BxTemplConfig.php

@@ -13,16 +13,17 @@ class BxTemplConfig extends BxBaseConfig
     {
         parent::__construct();
 
-        $sPrefix = 'bx_uni';
+        $sName = 'bx_uni';
+        $bAvailable = BxDolModuleQuery::getInstance()->isModuleByName($sName);
 
         //--- Images
         $oStorage = BxDolStorage::getObjectInstance('sys_images_custom');
-        
+
         $aImageKeys = array(
-        	'bx-image-bg-header' => $sPrefix . '_header_bg_image',
-        	'bx-image-bg-page' => $sPrefix . '_site_bg_image',
-        	'bx-image-bg-footer' => $sPrefix . '_footer_bg_image',
-        	'bx-image-bg-block' => $sPrefix . '_block_bg_image'
+        	'bx-image-bg-header' => $sName . '_header_bg_image',
+        	'bx-image-bg-page' => $sName . '_site_bg_image',
+        	'bx-image-bg-footer' => $sName . '_footer_bg_image',
+        	'bx-image-bg-block' => $sName . '_block_bg_image'
         );
         foreach($aImageKeys as $sKey => $sParam) {
         	$this->_aConfig['aLessConfig'][$sKey] = ""; 
@@ -38,36 +39,37 @@ class BxTemplConfig extends BxBaseConfig
         	$this->_aConfig['aLessConfig'][$sKey] = "'" . $sImageUrl . "'";
         }
 
-
         //--- Colors
-        $this->_aConfig['aLessConfig']['bx-color-header'] = getParam($sPrefix . '_header_bg_color');
-        $this->_aConfig['aLessConfig']['bx-color-page'] = getParam($sPrefix . '_site_bg_color');
-        $this->_aConfig['aLessConfig']['bx-color-footer'] = getParam($sPrefix . '_footer_bg_color');
-        $this->_aConfig['aLessConfig']['bx-color-block'] = getParam($sPrefix . '_block_bg_color');
-
+        $this->_aConfig['aLessConfig']['bx-color-header'] = $bAvailable ? getParam($sName . '_header_bg_color') : 'rgba(59, 134, 134, 1)';
+        $this->_aConfig['aLessConfig']['bx-color-page'] = $bAvailable ? getParam($sName . '_site_bg_color') : 'rgb(255, 255, 255)';
+        $this->_aConfig['aLessConfig']['bx-color-footer'] = $bAvailable ? getParam($sName . '_footer_bg_color') : 'rgb(255, 255, 255, 1)';
+        $this->_aConfig['aLessConfig']['bx-color-block'] = $bAvailable ? getParam($sName . '_block_bg_color') : 'rgb(255, 255, 255, 1)';
 
         //--- Borders
-        $this->_aConfig['aLessConfig']['bx-border-color-header'] = getParam($sPrefix . '_header_border_color');
-        $this->_aConfig['aLessConfig']['bx-border-color-footer'] = getParam($sPrefix . '_footer_border_color');
-        $this->_aConfig['aLessConfig']['bx-border-color-block'] = getParam($sPrefix . '_block_border_color');
+        $this->_aConfig['aLessConfig']['bx-border-color-header'] = $bAvailable ? getParam($sName . '_header_border_color') : 'rgb(208, 208, 208, 1)';
+        $this->_aConfig['aLessConfig']['bx-border-color-footer'] = $bAvailable ? getParam($sName . '_footer_border_color') : 'rgb(208, 208, 208, 1)';
+        $this->_aConfig['aLessConfig']['bx-border-color-block'] = $bAvailable ? getParam($sName . '_block_border_color') : 'rgba(208, 208, 208, 1)';
 
-        $this->_aConfig['aLessConfig']['bx-border-width-header'] = getParam($sPrefix . '_header_border_size');
-        $this->_aConfig['aLessConfig']['bx-border-width-footer'] = getParam($sPrefix . '_footer_border_size');
-        $this->_aConfig['aLessConfig']['bx-border-width-block'] = getParam($sPrefix . '_block_border_size');
+        $this->_aConfig['aLessConfig']['bx-border-width-header'] = $bAvailable ? getParam($sName . '_header_border_size') : '0px';
+        $this->_aConfig['aLessConfig']['bx-border-width-footer'] = $bAvailable ? getParam($sName . '_footer_border_size') : '1px';
+        $this->_aConfig['aLessConfig']['bx-border-width-block'] = $bAvailable ? getParam($sName . '_block_border_size') : '0px';
 
-        $this->_aConfig['aLessConfig']['bx-border-radius-block'] = getParam($sPrefix . '_block_border_radius');
+        $this->_aConfig['aLessConfig']['bx-border-radius-block'] = $bAvailable ? getParam($sName . '_block_border_radius') : '0px';
 
 		//--- Fonts
-        $this->_aConfig['aLessConfig']['bx-font-family'] = getParam($sPrefix . '_font_family');
-        $this->_aConfig['aLessConfig']['bx-font-size-default'] = getParam($sPrefix . '_font_size_default');
-        $this->_aConfig['aLessConfig']['bx-font-size-small'] = getParam($sPrefix . '_font_size_small');
-        $this->_aConfig['aLessConfig']['bx-font-size-middle'] = getParam($sPrefix . '_font_size_middle');
-        $this->_aConfig['aLessConfig']['bx-font-size-large'] = getParam($sPrefix . '_font_size_large');
-        $this->_aConfig['aLessConfig']['bx-font-size-h1'] = getParam($sPrefix . '_font_size_h1');
-        $this->_aConfig['aLessConfig']['bx-font-size-h2'] = getParam($sPrefix . '_font_size_h2');
-        $this->_aConfig['aLessConfig']['bx-font-size-h3'] = getParam($sPrefix . '_font_size_h3');
+		if($bAvailable) {
+	        $this->_aConfig['aLessConfig']['bx-font-family'] = getParam($sName . '_font_family');
+	        $this->_aConfig['aLessConfig']['bx-font-size-default'] = getParam($sName . '_font_size_default');
+	        $this->_aConfig['aLessConfig']['bx-font-size-small'] = getParam($sName . '_font_size_small');
+	        $this->_aConfig['aLessConfig']['bx-font-size-middle'] = getParam($sName . '_font_size_middle');
+	        $this->_aConfig['aLessConfig']['bx-font-size-large'] = getParam($sName . '_font_size_large');
+	        $this->_aConfig['aLessConfig']['bx-font-size-h1'] = getParam($sName . '_font_size_h1');
+	        $this->_aConfig['aLessConfig']['bx-font-size-h2'] = getParam($sName . '_font_size_h2');
+	        $this->_aConfig['aLessConfig']['bx-font-size-h3'] = getParam($sName . '_font_size_h3');
+		}
 
-        $this->setPageWidth('bx_uni_page_width');
+		if($bAvailable)
+        	$this->setPageWidth('bx_uni_page_width');
     }
 }
 

+ 5 - 5
modules/boonex/uni/install/sql/install.sql

@@ -23,17 +23,17 @@ SET @iCategoryId = LAST_INSERT_ID();
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 (@iCategoryId, CONCAT(@sName, '_header_bg_color'), '_bx_uni_stg_cpt_option_header_bg_color', 'rgba(59, 134, 134, 1)', 'rgba', '', '', '', 1),
 (@iCategoryId, CONCAT(@sName, '_header_bg_image'), '_bx_uni_stg_cpt_option_header_bg_image', '', 'image', '', '', '', 2),
-(@iCategoryId, CONCAT(@sName, '_header_border_color'), '_bx_uni_stg_cpt_option_header_border_color', 'rgb(208, 208, 208)', 'rgb', '', '', '', 3),
+(@iCategoryId, CONCAT(@sName, '_header_border_color'), '_bx_uni_stg_cpt_option_header_border_color', 'rgba(208, 208, 208, 1)', 'rgba', '', '', '', 3),
 (@iCategoryId, CONCAT(@sName, '_header_border_size'), '_bx_uni_stg_cpt_option_header_border_size', '0px', 'digit', '', '', '', 4),
 (@iCategoryId, CONCAT(@sName, '_site_bg_color'), '_bx_uni_stg_cpt_option_site_bg_color', 'rgb(255, 255, 255)', 'rgb', '', '', '', 11),
 (@iCategoryId, CONCAT(@sName, '_site_bg_image'), '_bx_uni_stg_cpt_option_site_bg_image', '', 'image', '', '', '', 12),
-(@iCategoryId, CONCAT(@sName, '_footer_bg_color'), '_bx_uni_stg_cpt_option_footer_bg_color', 'rgb(255, 255, 255, 1)', 'rgba', '', '', '', 21),
+(@iCategoryId, CONCAT(@sName, '_footer_bg_color'), '_bx_uni_stg_cpt_option_footer_bg_color', 'rgba(255, 255, 255, 1)', 'rgba', '', '', '', 21),
 (@iCategoryId, CONCAT(@sName, '_footer_bg_image'), '_bx_uni_stg_cpt_option_footer_bg_image', '', 'image', '', '', '', 22),
-(@iCategoryId, CONCAT(@sName, '_footer_border_color'), '_bx_uni_stg_cpt_option_footer_border_color', 'rgb(208, 208, 208)', 'rgb', '', '', '', 23),
+(@iCategoryId, CONCAT(@sName, '_footer_border_color'), '_bx_uni_stg_cpt_option_footer_border_color', 'rgba(208, 208, 208, 1)', 'rgba', '', '', '', 23),
 (@iCategoryId, CONCAT(@sName, '_footer_border_size'), '_bx_uni_stg_cpt_option_footer_border_size', '1px', 'digit', '', '', '', 24),
-(@iCategoryId, CONCAT(@sName, '_block_bg_color'), '_bx_uni_stg_cpt_option_block_bg_color', 'rgb(255, 255, 255, 1)', 'rgba', '', '', '', 31),
+(@iCategoryId, CONCAT(@sName, '_block_bg_color'), '_bx_uni_stg_cpt_option_block_bg_color', 'rgba(255, 255, 255, 1)', 'rgba', '', '', '', 31),
 (@iCategoryId, CONCAT(@sName, '_block_bg_image'), '_bx_uni_stg_cpt_option_block_bg_image', '', 'image', '', '', '', 32),
-(@iCategoryId, CONCAT(@sName, '_block_border_color'), '_bx_uni_stg_cpt_option_block_border_color', 'rgb(208, 208, 208)', 'rgb', '', '', '', 33),
+(@iCategoryId, CONCAT(@sName, '_block_border_color'), '_bx_uni_stg_cpt_option_block_border_color', 'rgba(208, 208, 208, 1)', 'rgba', '', '', '', 33),
 (@iCategoryId, CONCAT(@sName, '_block_border_size'), '_bx_uni_stg_cpt_option_block_border_size', '0px', 'digit', '', '', '', 34),
 (@iCategoryId, CONCAT(@sName, '_block_border_radius'), '_bx_uni_stg_cpt_option_block_border_radius', '0px', 'digit', '', '', '', 35),
 (@iCategoryId, CONCAT(@sName, '_font_family'), '_bx_uni_stg_cpt_option_font_family', '"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif', 'digit', '', '', '', 41),