فهرست منبع

Merge branch 'master' of https://github.com/boonex/dolphin

Conflicts:
	modules/boonex/uni/data/template/system/css/default.less
AntonLV 10 سال پیش
والد
کامیت
56d1ae12f7

+ 90 - 0
inc/classes/BxDolCover.php

@@ -0,0 +1,90 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    TridentCore Trident Core
+ * @{
+ */
+
+/**
+ * @page objects
+ * @section cover Cover
+ * @ref BxDolCover
+ */
+
+/**
+ * Cover.
+ *
+ * It displays cover area for different pages, usually it have background image, text and some buttons on it.
+ *
+ * @section example Example of usage
+ *
+ * Setting cover:
+ *
+ * @code
+ *  $oCover = BxDolCover::getInstance(); // get object instance
+ *  if ($oCover) // check if Cover is available for using
+ *      $oCover->set ( // set cover with default template
+ *          'text' => 'Hello World!',
+ *          'image_url' => 'http://example.com/tile.png',
+ *      ); 
+ * @endcode
+ *
+ */
+class BxDolCover extends BxDol implements iBxDolSingleton
+{
+    protected $_aOptions = array();
+    protected $_sTemplateName = 'cover_short.html';
+
+    /**
+     * Constructor
+     */
+    public function __construct()
+    {
+        if (isset($GLOBALS['bxDolClasses']['BxDolCover']))
+            trigger_error ('Multiple instances are not allowed for the BxDolCover class.', E_USER_ERROR);
+
+        parent::__construct();
+    }
+
+    /**
+     * Prevent cloning the instance
+     */
+    public function __clone()
+    {
+        if (isset($GLOBALS['bxDolClasses']['BxDolCover']))
+            trigger_error('Clone is not allowed for the BxDolCover class.', E_USER_ERROR);
+    }
+
+    /**
+     * Get Cover object instance
+     * @return object instance or false on error
+     */
+    public static function getInstance($oTemplate = false)
+    {
+        if (isset($GLOBALS['bxDolClasses']['BxDolCover']))
+            return $GLOBALS['bxDolClasses']['BxDolCover'];
+
+        $o = new BxTemplCover($oTemplate);
+
+        return ($GLOBALS['bxDolClasses']['BxDolCover'] = $o);
+    }
+
+    /**
+     * Set cover options
+     * @param $aOptions - cover options, default template supports the following: image_url, menu, text
+     * @param $sTemplateName - optional template name
+     */
+    public function set ($aOptions, $sTemplateName = false)
+    {
+        $this->_aOptions = $aOptions;
+        if (false !== $sTemplateName)
+            $this->_sTemplateName = $sTemplateName;
+
+        bx_alert('system', 'set_cover', 0, false, array('options' => &$this->_aOptions, 'template_name' => &$this->_sTemplateName));
+    }
+
+}
+
+/** @} */

+ 4 - 0
inc/classes/BxDolTemplate.php

@@ -1069,6 +1069,10 @@ class BxDolTemplate extends BxDol implements iBxDolSingleton
                 $oInformer = BxDolInformer::getInstance($this);
                 $oInformer = BxDolInformer::getInstance($this);
                 $sRet = $oInformer ? $oInformer->display() : '';
                 $sRet = $oInformer ? $oInformer->display() : '';
                 break;
                 break;
+            case 'cover':
+                $oCover = BxDolCover::getInstance($this);
+                $sRet = $oCover ? $oCover->display() : '';
+                break;
             case 'dol_images':
             case 'dol_images':
                 $sRet = $this->_processJsImages();
                 $sRet = $this->_processJsImages();
                 break;
                 break;

+ 4 - 2
modules/base/profile/classes/BxBaseModProfileTemplate.php

@@ -94,7 +94,7 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
             'id' => $aData[$CNF['FIELD_ID']],
             'id' => $aData[$CNF['FIELD_ID']],
             'content_url' => $sUrl,
             'content_url' => $sUrl,
             'title' => $aData[$CNF['FIELD_NAME']],
             'title' => $aData[$CNF['FIELD_NAME']],
-            'menu' => BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_COVER'])->getCode(),
+            //'menu' => BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_SUBMENU_VIEW_ENTRY_COVER'])->getCode(), // TODO: check if menu is used somewhere
 
 
             'picture_avatar_url' => $sUrlAvatar,
             'picture_avatar_url' => $sUrlAvatar,
             'picture_popup' => $sPicturePopup,
             'picture_popup' => $sPicturePopup,
@@ -108,7 +108,9 @@ class BxBaseModProfileTemplate extends BxBaseModGeneralTemplate
             'cover_href' => !$aData[$CNF['FIELD_COVER']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData) ? $sUrlCoverChange : 'javascript:void(0);',
             'cover_href' => !$aData[$CNF['FIELD_COVER']] && CHECK_ACTION_RESULT_ALLOWED === $oModule->checkAllowedChangeCover($aData) ? $sUrlCoverChange : 'javascript:void(0);',
         );
         );
 
 
-        return $this->parseHtmlByName($sTemplateName, $aVars);
+        BxDolCover::getInstance($this)->set($aVars, $sTemplateName);
+
+        return '';//$this->parseHtmlByName($sTemplateName, $aVars); TODO: move somewhere!
     }
     }
 
 
     /**
     /**

+ 1 - 4
modules/base/profile/template/cover.html

@@ -1,5 +1,5 @@
 
 
-<div class="bx-base-pofile-cover-wrapper bx-def-round-corners">
+<div class="bx-base-pofile-cover-wrapper bx-menu-toolbar-padding">
     <div class="bx-base-pofile-cover">
     <div class="bx-base-pofile-cover">
         <a class="bx-base-pofile-cover-image bx-def-box-sizing" href="__cover_href__" onclick="$('#__cover_popup_id__').dolPopupImage('__cover_url__', this)" style="background-image:url(__cover_url__)">&nbsp;</a>
         <a class="bx-base-pofile-cover-image bx-def-box-sizing" href="__cover_href__" onclick="$('#__cover_popup_id__').dolPopupImage('__cover_url__', this)" style="background-image:url(__cover_url__)">&nbsp;</a>
         <div class="bx-base-pofile-cover-info bx-def-unit bx-def-padding">
         <div class="bx-base-pofile-cover-info bx-def-unit bx-def-padding">
@@ -7,9 +7,6 @@
             <h1 class="bx-def-unit-info bx-def-margin-sec-bottom bx-def-margin-sec-top bx-def-font-contrasted">__title__</h1>
             <h1 class="bx-def-unit-info bx-def-margin-sec-bottom bx-def-margin-sec-top bx-def-font-contrasted">__title__</h1>
         </div>
         </div>
     </div>
     </div>
-    <div class="bx-base-pofile-menu">
-        __menu__
-    </div>
 </div>
 </div>
 
 
 __cover_popup__
 __cover_popup__

+ 5 - 1
modules/boonex/air/data/template/system/_sub_header.html

@@ -34,7 +34,11 @@
 
 
 	</div>
 	</div>
 
 
-	<bx_injection:injection_between_logo_top_menu />
+	<bx_injection:injection_between_cover_logo />
+
+    __cover__
+	
+	<bx_injection:injection_between_cover_top_menu />
 	
 	
 	<div id="bx-menu-main-bar-wrapper">
 	<div id="bx-menu-main-bar-wrapper">
 	
 	

+ 0 - 6
modules/boonex/air/data/template/system/css/general.css

@@ -23,12 +23,6 @@
 	color: #01aff8;
 	color: #01aff8;
 }
 }
 
 
-/* --------------- menu bar */
-#bx-menu-main-bar-wrapper {
-    padding-top: 64px;
-    padding-top: 4rem;
-}
-
 /* --------------- content */
 /* --------------- content */
 #bx-content-wrapper {
 #bx-content-wrapper {
 	padding-bottom: 84px;
 	padding-bottom: 84px;

+ 4 - 0
modules/boonex/air/data/template/system/css/menu.css

@@ -63,6 +63,10 @@ ul.bx-menu-toolbar li a .sys-icon-a {
     margin-top: 1rem;
     margin-top: 1rem;
 }
 }
 
 
+.bx-menu-toolbar-padding {
+    padding-top: 64px;
+    padding-top: 4rem;
+}
 
 
 /* --------------- floating blocks menu */
 /* --------------- floating blocks menu */
 .bx-sliding-menu-fullheight {
 .bx-sliding-menu-fullheight {

+ 21 - 0
modules/boonex/air/data/template/system/scripts/BxTemplCover.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    TridentCore Trident Core
+ * @{
+ */
+
+/**
+ * @see BxDolCover
+ */
+class BxTemplCover extends BxBaseCover
+{
+    public function __construct ($oTemplate = false)
+    {
+        parent::__construct ($oTemplate);
+    }
+}
+
+/** @} */

+ 5 - 1
modules/boonex/ocean/data/template/system/_sub_header.html

@@ -32,7 +32,11 @@
 	
 	
 	</div>
 	</div>
 
 
-	<bx_injection:injection_between_logo_top_menu />
+	<bx_injection:injection_between_cover_logo />
+
+    __cover__
+	
+	<bx_injection:injection_between_cover_top_menu />
 	
 	
 	<div id="bx-menu-main-bar-wrapper">
 	<div id="bx-menu-main-bar-wrapper">
 	
 	

+ 1 - 7
modules/boonex/ocean/data/template/system/css/general.css

@@ -20,12 +20,6 @@
     line-height: 4rem;
     line-height: 4rem;
 }
 }
 
 
-/* --------------- menu bar */
-#bx-menu-main-bar-wrapper {
-    padding-top:64px;
-    padding-top:4rem;
-}
-
 /* --------------- content */
 /* --------------- content */
 #bx-content-wrapper {
 #bx-content-wrapper {
 	padding-bottom: 120px;
 	padding-bottom: 120px;
@@ -57,4 +51,4 @@
 }
 }
 #bx-menu-bottom {
 #bx-menu-bottom {
 	float: left;
 	float: left;
-}
+}

+ 5 - 0
modules/boonex/ocean/data/template/system/css/menu.css

@@ -34,6 +34,11 @@ ul.bx-menu-toolbar li a .sys-icon-a {
     margin-top:1rem;
     margin-top:1rem;
 }
 }
 
 
+.bx-menu-toolbar-padding {
+    padding-top: 64px;
+    padding-top: 4rem;
+}
+
 /* --------------- floating blocks menu */
 /* --------------- floating blocks menu */
 
 
 .bx-sliding-menu-fullheight {
 .bx-sliding-menu-fullheight {

+ 21 - 0
modules/boonex/ocean/data/template/system/scripts/BxTemplCover.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    TridentCore Trident Core
+ * @{
+ */
+
+/**
+ * @see BxDolCover
+ */
+class BxTemplCover extends BxBaseCover
+{
+    public function __construct ($oTemplate = false)
+    {
+        parent::__construct ($oTemplate);
+    }
+}
+
+/** @} */

+ 5 - 1
modules/boonex/uni/data/template/system/_sub_header.html

@@ -24,7 +24,11 @@
 	    </div>
 	    </div>
 	</div>
 	</div>
 	
 	
-	<bx_injection:injection_between_logo_top_menu />
+	<bx_injection:injection_between_cover_logo />
+
+    __cover__
+	
+	<bx_injection:injection_between_cover_top_menu />
 	
 	
 	<div id="bx-menu-main-bar-wrapper" class="bx-menu-main-bar-wrapper">
 	<div id="bx-menu-main-bar-wrapper" class="bx-menu-main-bar-wrapper">
 	    <div id="bx-menu-main-bar" class="bx-menu-main-bar bx-def-color-bg-sec">
 	    <div id="bx-menu-main-bar" class="bx-menu-main-bar bx-def-color-bg-sec">

+ 2 - 2
modules/boonex/uni/data/template/system/css/default.less

@@ -16,7 +16,7 @@
 .bx-header {
 .bx-header {
 	height: @bx-height-header !important;
 	height: @bx-height-header !important;
 }
 }
-.bx-menu-main-bar-wrapper {
+.bx-menu-toolbar-padding {
 	padding-top: @bx-height-header !important;
 	padding-top: @bx-height-header !important;
 }
 }
 
 
@@ -433,4 +433,4 @@ h3,
 .bx-btn.bx-btn-small:hover .sys-icon,
 .bx-btn.bx-btn-small:hover .sys-icon,
 .bx-btn.bx-btn-small:active .sys-icon {
 .bx-btn.bx-btn-small:active .sys-icon {
 	color: @bx-color-font-button-small-hover;
 	color: @bx-color-font-button-small-hover;
-}
+}

+ 21 - 0
modules/boonex/uni/data/template/system/scripts/BxTemplCover.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    TridentCore Trident Core
+ * @{
+ */
+
+/**
+ * @see BxDolCover
+ */
+class BxTemplCover extends BxBaseCover
+{
+    public function __construct ($oTemplate = false)
+    {
+        parent::__construct ($oTemplate);
+    }
+}
+
+/** @} */

+ 5 - 1
template/_sub_header.html

@@ -32,8 +32,12 @@
 	
 	
 	</div>
 	</div>
 	
 	
-	<bx_injection:injection_between_logo_top_menu />
+	<bx_injection:injection_between_cover_logo />
+
+    __cover__
 	
 	
+	<bx_injection:injection_between_cover_top_menu />
+
 	<div id="bx-menu-main-bar-wrapper">
 	<div id="bx-menu-main-bar-wrapper">
 	
 	
 	    <div id="bx-menu-main-bar" class="bx-def-color-bg-sec">
 	    <div id="bx-menu-main-bar" class="bx-def-color-bg-sec">

+ 1 - 8
template/css/general.css

@@ -88,13 +88,6 @@
     margin-top:-0.375rem;
     margin-top:-0.375rem;
 }
 }
 
 
-/* --------------- menu bar */
-
-#bx-menu-main-bar-wrapper {
-    padding-top:48px;
-    padding-top:3rem;
-}
-
 /* --------------- content */
 /* --------------- content */
 #bx-content-wrapper {
 #bx-content-wrapper {
 	padding-bottom: 100px;
 	padding-bottom: 100px;
@@ -159,4 +152,4 @@
     width: 100%;
     width: 100%;
     max-width: 450px;
     max-width: 450px;
     max-width: 28rem;
     max-width: 28rem;
-}
+}

+ 4 - 0
template/css/menu.css

@@ -302,6 +302,10 @@ ul.bx-menu-toolbar li .sys-icon {
     height:1.5rem;
     height:1.5rem;
 }
 }
 
 
+.bx-menu-toolbar-padding {
+	padding-top: 48px;
+	padding-top: 3rem;
+}
 
 
 /* --------------- floating blocks menu */
 /* --------------- floating blocks menu */
 
 

+ 56 - 0
template/scripts/BxBaseCover.php

@@ -0,0 +1,56 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    TridentCore Trident Core
+ * @{
+ */
+
+/**
+ * Cover representation.
+ * @see BxDolCover
+ */
+class BxBaseCover extends BxDolCover
+{
+    protected $_bJsCssAdded = false;
+
+    protected $_oTemplate;
+
+    public function __construct ($oTemplate)
+    {
+        parent::__construct ();
+
+        if ($oTemplate)
+            $this->_oTemplate = $oTemplate;
+        else
+            $this->_oTemplate = BxDolTemplate::getInstance();
+    }
+
+    /**
+     * Display Cover.
+     */
+    public function display ()
+    {
+        if (!$this->_aOptions || !$this->_sTemplateName)
+            return '';
+
+        $this->_addJsCss();
+
+        return $this->_oTemplate->parseHtmlByName($this->_sTemplateName, $this->_aOptions);
+    }
+
+    /**
+     * Add css/js files which are needed for display and functionality.
+     */
+    protected function _addJsCss()
+    {
+        if ($this->_bJsCssAdded)
+            return;
+
+        $this->_oTemplate->addCss(array('cover.css'));
+        $this->_bJsCssAdded = true;
+    }
+}
+
+/** @} */