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

+ 1 - 1
inc/classes/BxDolTemplate.php

@@ -1657,7 +1657,7 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
      */
      */
     function _wrapInTagCssCode($sCode)
     function _wrapInTagCssCode($sCode)
     {
     {
-        return "<link rel=\"stylesheet\" type=\"text/css\">" . $sCode . "</link>";
+        return "<style>" . $sCode . "</style>";
     }
     }
     /**
     /**
      * Include CSS/JS file(s) attached to the page in its head section.
      * Include CSS/JS file(s) attached to the page in its head section.

+ 6 - 4
inc/js/jquery.webForms.js

@@ -59,9 +59,7 @@
             var fCallback = function() {
             var fCallback = function() {
 
 
                 if (eFormSection.hasClass('bx-form-collapsed')) {
                 if (eFormSection.hasClass('bx-form-collapsed')) {
-
                     // show
                     // show
-
                     eFormSection.removeClass('bx-form-collapsed');
                     eFormSection.removeClass('bx-form-collapsed');
 
 
                     if (eFormSection.hasClass('bx-form-section-hidden')) {
                     if (eFormSection.hasClass('bx-form-section-hidden')) {
@@ -71,16 +69,20 @@
 
 
                     $('.bx-form-section-content:first', eFormSection).slideDown(function () {
                     $('.bx-form-section-content:first', eFormSection).slideDown(function () {
                         eFormSection.removeClass('bx-form-section-hidden');
                         eFormSection.removeClass('bx-form-section-hidden');
+
+                        //--- fire custom event 'bx_show'
+                        eFormSection.trigger('bx_show');
                     }); 
                     }); 
 
 
                 } else {
                 } else {
-
                     // hide
                     // hide
-
                     eFormSection.addClass('bx-form-collapsed');
                     eFormSection.addClass('bx-form-collapsed');
 
 
                     $('.bx-form-section-content:first', eFormSection).slideUp(function () {                    
                     $('.bx-form-section-content:first', eFormSection).slideUp(function () {                    
                         eFormSection.addClass('bx-form-collapsed bx-form-section-hidden');
                         eFormSection.addClass('bx-form-collapsed bx-form-section-hidden');
+
+                        //--- fire custom event 'bx_hide'
+                        eFormSection.trigger('bx_hide');
                     }); 
                     }); 
                 }
                 }
 
 

+ 6 - 0
modules/boonex/protean/classes/BxProteanModule.php

@@ -17,6 +17,12 @@ class BxProteanModule extends BxBaseModTemplateModule
     {
     {
         parent::__construct($aModule);
         parent::__construct($aModule);
     }
     }
+
+	function serviceIncludeCssJs()
+    {
+    	$sCss = trim(getParam($this->_oConfig->getName() . '_styles_custom'));
+        return !empty($sCss) ? $this->_oTemplate->_wrapInTagCssCode($sCss) : '';
+    }
 }
 }
 
 
 /** @} */
 /** @} */

+ 10 - 1
modules/boonex/protean/classes/BxProteanStudioPage.php

@@ -29,6 +29,8 @@ class BxProteanStudioPage extends BxTemplStudioDesign
 
 
 	protected function getStyles($sMix = '')
 	protected function getStyles($sMix = '')
     {
     {
+    	$oTemplate = BxDolStudioTemplate::getInstance();
+
     	$sPrefix = $this->MODULE;
     	$sPrefix = $this->MODULE;
     	$aCategories = array(
     	$aCategories = array(
     		$sPrefix . '_styles_general',
     		$sPrefix . '_styles_general',
@@ -45,14 +47,21 @@ class BxProteanStudioPage extends BxTemplStudioDesign
 			$sPrefix . '_styles_large_button',
 			$sPrefix . '_styles_large_button',
 			$sPrefix . '_styles_small_button',
 			$sPrefix . '_styles_small_button',
 			$sPrefix . '_styles_font',
 			$sPrefix . '_styles_font',
+			$sPrefix . '_styles_custom',
 			$sPrefix . '_viewport_tablet',
 			$sPrefix . '_viewport_tablet',
 			$sPrefix . '_viewport_mobile'
 			$sPrefix . '_viewport_mobile'
 		);
 		);
     	$oPage = new BxTemplStudioSettings($this->sTemplate, $aCategories, $sMix);
     	$oPage = new BxTemplStudioSettings($this->sTemplate, $aCategories, $sMix);
     	$oPage->enableMixes(true);
     	$oPage->enableMixes(true);
 
 
+    	$oTemplate->addJs(array('codemirror/codemirror.min.js'));
+        $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
+
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getPageCode()
+            'content' => $oPage->getPageCode(),
+        	'js_content' => $this->getPageJsCode(array(
+				"sCodeMirror" => "textarea[name='" . $sPrefix . "_styles_custom']"
+			))
         ));
         ));
     }
     }
 }
 }

+ 3 - 0
modules/boonex/protean/install/langs/en.xml

@@ -230,6 +230,9 @@
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3"><![CDATA[H3 link font color]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3"><![CDATA[H3 link font color]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3_hover"><![CDATA[H3 on-hover link font color]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3_hover"><![CDATA[H3 on-hover link font color]]></string>
 
 
+	<string name="_bx_protean_stg_cpt_category_styles_custom"><![CDATA[Custom Styles]]></string>
+	<string name="_bx_protean_stg_cpt_option_styles_custom"><![CDATA[]]></string>
+
 	<string name="_bx_protean_stg_cpt_category_viewport_tablet"><![CDATA[Tablet Viewport]]></string>
 	<string name="_bx_protean_stg_cpt_category_viewport_tablet"><![CDATA[Tablet Viewport]]></string>
 	<string name="_bx_protean_stg_cpt_option_vpt_font_size_scale"><![CDATA[Fonts size scale]]></string>
 	<string name="_bx_protean_stg_cpt_option_vpt_font_size_scale"><![CDATA[Fonts size scale]]></string>
 
 

+ 5 - 1
modules/boonex/protean/install/sql/disable.sql

@@ -1 +1,5 @@
-SET @sName = 'bx_protean';
+SET @sName = 'bx_protean';
+
+
+-- injections
+DELETE FROM `sys_injections` WHERE `name` = @sName;

+ 6 - 1
modules/boonex/protean/install/sql/enable.sql

@@ -1 +1,6 @@
-SET @sName = 'bx_protean';
+SET @sName = 'bx_protean';
+
+
+-- injections
+INSERT INTO `sys_injections` (`name`, `page_index`, `key`, `type`, `data`, `replace`, `active`) VALUES
+(@sName, 0, 'injection_head', 'service', 'a:2:{s:6:"module";s:10:"bx_protean";s:6:"method";s:14:"include_css_js";}', 0, 1);

+ 10 - 2
modules/boonex/protean/install/sql/install.sql

@@ -317,9 +317,17 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 (@iCategoryId, CONCAT(@sName, '_font_color_link_h3'), '_bx_protean_stg_cpt_option_font_color_link_h3', 'rgba(62, 134, 133, 1)', 'rgba', '', '', '', 28),
 (@iCategoryId, CONCAT(@sName, '_font_color_link_h3'), '_bx_protean_stg_cpt_option_font_color_link_h3', 'rgba(62, 134, 133, 1)', 'rgba', '', '', '', 28),
 (@iCategoryId, CONCAT(@sName, '_font_color_link_h3_hover'), '_bx_protean_stg_cpt_option_font_color_link_h3_hover', 'rgba(62, 134, 133, 1)', 'rgba', '', '', '', 29);
 (@iCategoryId, CONCAT(@sName, '_font_color_link_h3_hover'), '_bx_protean_stg_cpt_option_font_color_link_h3_hover', 'rgba(62, 134, 133, 1)', 'rgba', '', '', '', 29);
 
 
+-- SETTINGS: Protean template Custom Styles
+INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 
+(@iTypeId, CONCAT(@sName, '_styles_custom'), '_bx_protean_stg_cpt_category_styles_custom', 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, '_styles_custom'), '_bx_protean_stg_cpt_option_styles_custom', '', 'text', '', '', '', 1);
+
 -- SETTINGS: Protean template Viewport Tablet
 -- SETTINGS: Protean template Viewport Tablet
 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 
 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 
-(@iTypeId, CONCAT(@sName, '_viewport_tablet'), '_bx_protean_stg_cpt_category_viewport_tablet', 16);
+(@iTypeId, CONCAT(@sName, '_viewport_tablet'), '_bx_protean_stg_cpt_category_viewport_tablet', 18);
 SET @iCategoryId = LAST_INSERT_ID();
 SET @iCategoryId = LAST_INSERT_ID();
 
 
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
@@ -327,7 +335,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 
 
 -- SETTINGS: Protean template Viewport Mobile
 -- SETTINGS: Protean template Viewport Mobile
 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 
 INSERT INTO `sys_options_categories`(`type_id`, `name`, `caption`, `order`) VALUES 
-(@iTypeId, CONCAT(@sName, '_viewport_mobile'), '_bx_protean_stg_cpt_category_viewport_mobile', 17);
+(@iTypeId, CONCAT(@sName, '_viewport_mobile'), '_bx_protean_stg_cpt_category_viewport_mobile', 19);
 SET @iCategoryId = LAST_INSERT_ID();
 SET @iCategoryId = LAST_INSERT_ID();
 
 
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES
 INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `extra`, `check`, `check_error`, `order`) VALUES

+ 3 - 0
modules/boonex/russian/data/langs/bx_protean/ru.xml

@@ -230,6 +230,9 @@
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3"><![CDATA[Цвет линок в тэге H3]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3"><![CDATA[Цвет линок в тэге H3]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3_hover"><![CDATA[Цвет линок в тэге H3 при наведении курсора]]></string>
 	<string name="_bx_protean_stg_cpt_option_font_color_link_h3_hover"><![CDATA[Цвет линок в тэге H3 при наведении курсора]]></string>
 
 
+	<string name="_bx_protean_stg_cpt_category_styles_custom"><![CDATA[Пользовательские стили]]></string>
+	<string name="_bx_protean_stg_cpt_option_styles_custom"><![CDATA[]]></string>
+
 	<string name="_bx_protean_stg_cpt_category_viewport_tablet"><![CDATA[Просмотр на планшете]]></string>
 	<string name="_bx_protean_stg_cpt_category_viewport_tablet"><![CDATA[Просмотр на планшете]]></string>
 	<string name="_bx_protean_stg_cpt_option_vpt_font_size_scale"><![CDATA[Масштаб размера шрифта]]></string>
 	<string name="_bx_protean_stg_cpt_option_vpt_font_size_scale"><![CDATA[Масштаб размера шрифта]]></string>
 
 

+ 31 - 0
studio/js/design.js

@@ -10,7 +10,38 @@ function BxDolStudioDesign(oOptions) {
     this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioDesign' : oOptions.sObjName;
     this.sObjName = oOptions.sObjName == undefined ? 'oBxDolStudioDesign' : oOptions.sObjName;
     this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
     this.sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
     this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
     this.iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
+    this.sCodeMirror = oOptions.sCodeMirror == undefined ? '' : oOptions.sCodeMirror;
+
+    var $this = this;
+    $(document).ready (function () {
+    	if($this.sCodeMirror != '')
+    		$this.initCodeMirror($this.sCodeMirror);
+    });
+
+    var oCollapsable = $('#adm-settings-form .bx-form-collapsable');
+    oCollapsable.on('bx_show', function() {
+    	$this.refreshCodeMirror();
+    });
 }
 }
+
+BxDolStudioDesign.prototype.initCodeMirror = function(sSelector) {
+	var oSelector = $(sSelector);
+	for(var i = 0; i < oSelector.length; i++) {
+	    var e = CodeMirror.fromTextArea(oSelector.get(i), {
+	        lineNumbers: true,
+	        mode: "htmlmixed",
+	        htmlMode: true,
+	        matchBrackets: true
+	    });
+	}
+};
+
+BxDolStudioDesign.prototype.refreshCodeMirror = function() {
+	$('.CodeMirror').each(function() {
+	    this.CodeMirror.refresh();
+	});
+};
+
 BxDolStudioDesign.prototype.activate = function(sTemplateName, oChecbox) {
 BxDolStudioDesign.prototype.activate = function(sTemplateName, oChecbox) {
 	var $this = this;
 	var $this = this;
 	var oDate = new Date();
 	var oDate = new Date();

+ 2 - 1
studio/template/design.html

@@ -1 +1,2 @@
-__content__
+__content__
+__js_content__

+ 8 - 12
studio/template/scripts/BxBaseStudioDesign.php

@@ -27,19 +27,13 @@ class BxBaseStudioDesign extends BxDolStudioDesign
     {
     {
         return array_merge(parent::getPageJs(), array('jquery.form.min.js', 'jquery.webForms.js', 'settings.js', 'design.js'));
         return array_merge(parent::getPageJs(), array('jquery.form.min.js', 'jquery.webForms.js', 'settings.js', 'design.js'));
     }
     }
-    function getPageJsObject()
+	function getPageJsClass()
     {
     {
-        return 'oBxDolStudioDesign';
+        return 'BxDolStudioDesign';
     }
     }
-    function getPageCaption()
+    function getPageJsObject()
     {
     {
-        $oTemplate = BxDolStudioTemplate::getInstance();
-
-        $aTmplVars = array(
-            'js_object' => $this->getPageJsObject(),
-            'content' => parent::getPageCaption(),
-        );
-        return $oTemplate->parseHtmlByName('dsn_page_caption.html', $aTmplVars);
+        return 'oBxDolStudioDesign';
     }
     }
     function getPageAttributes()
     function getPageAttributes()
     {
     {
@@ -81,7 +75,8 @@ class BxBaseStudioDesign extends BxDolStudioDesign
         $oPage = new BxTemplStudioSettings($this->sTemplate, $mixedCategory, $sMix);
         $oPage = new BxTemplStudioSettings($this->sTemplate, $mixedCategory, $sMix);
 
 
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
         return BxDolStudioTemplate::getInstance()->parseHtmlByName('design.html', array(
-            'content' => $oPage->getPageCode()
+            'content' => $oPage->getPageCode(),
+        	'js_content' => $this->getPageJsCode(),
         ));
         ));
     }
     }
 
 
@@ -93,7 +88,8 @@ class BxBaseStudioDesign extends BxDolStudioDesign
         $oTemplate->addJs($oPage->getPageJs());
         $oTemplate->addJs($oPage->getPageJs());
         $oTemplate->addCss($oPage->getPageCss());
         $oTemplate->addCss($oPage->getPageCss());
     	return $oTemplate->parseHtmlByName('design.html', array(
     	return $oTemplate->parseHtmlByName('design.html', array(
-            'content' => $oPage->getPageCode()
+            'content' => $oPage->getPageCode(),
+    		'js_content' => $this->getPageJsCode()
         ));
         ));
     }
     }
 }
 }

+ 3 - 4
studio/template/scripts/BxBaseStudioDesigner.php

@@ -507,10 +507,9 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 			echo $this->submitSplash($oForm);
 			echo $this->submitSplash($oForm);
 			exit;
 			exit;
 		}
 		}
-
-        $oTemplate->addJs(array('codemirror/codemirror.min.js'));
+		
+		$oTemplate->addJs(array('codemirror/codemirror.min.js'));
         $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
         $oTemplate->addCss(BX_DIRECTORY_PATH_PLUGINS_PUBLIC . 'codemirror/|codemirror.css');
-
 		return $oTemplate->parseHtmlByName('designer.html', array(
 		return $oTemplate->parseHtmlByName('designer.html', array(
 			'content' => $this->getBlockCode(array(
 			'content' => $this->getBlockCode(array(
 				'items' => $oTemplate->parseHtmlByName('dsr_splash.html', array(
 				'items' => $oTemplate->parseHtmlByName('dsr_splash.html', array(
@@ -521,7 +520,7 @@ class BxBaseStudioDesigner extends BxDolStudioDesigner
 			)),
 			)),
 			'js_content' => $this->getPageJsCode(array(
 			'js_content' => $this->getPageJsCode(array(
 				'sCodeMirror' => 'textarea[name=code]'
 				'sCodeMirror' => 'textarea[name=code]'
-			))
+			)),
 		));
 		));
     }
     }