AntonLV 8 лет назад
Родитель
Сommit
4bfade8110

+ 14 - 12
inc/classes/BxDolModuleQuery.php

@@ -101,6 +101,7 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton
     {
     	$aMethod = array('name' => 'getAll', 'params' => array(0 => 'query'));
         $sPostfix = $sWhereClause = $sOrderByClause = "";
+        $aBindings = array();
 
         switch($aParams['type']) {
         	case 'type':
@@ -113,39 +114,39 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton
 
             case 'modules':
                 $sPostfix .= '_modules';
-                $aMethod['params'][1] = array(
-                	'type' => BX_DOL_MODULE_TYPE_MODULE
-                );
+                $aBindings['type'] = BX_DOL_MODULE_TYPE_MODULE;
 
                 $sWhereClause .= " AND `type`=:type";
                 break;
 
             case 'languages':
                 $sPostfix .= '_languages';
-                $aMethod['params'][1] = array(
-                	'type' => BX_DOL_MODULE_TYPE_LANGUAGE
-                );
+                $aBindings['type'] = BX_DOL_MODULE_TYPE_LANGUAGE;
 
                 $sWhereClause .= " AND `type`=:type";
                 break;
 
             case 'templates':
                 $sPostfix .= '_templates';
-                $aMethod['params'][1] = array(
-                	'type' => BX_DOL_MODULE_TYPE_TEMPLATE
-                );
+                $aBindings['type'] = BX_DOL_MODULE_TYPE_TEMPLATE;
 
                 $sWhereClause .= " AND `type`=?";
                 break;
 
             case 'path_and_uri':
             	$aMethod['name'] = 'getRow';
-            	$aMethod['params'][1] = array(
+            	$aBindings = array_merge($aBindings, array(
                 	'path' => $aParams['path'],
             		'uri' => $aParams['uri']
-                );
+                ));
 
             	$sWhereClause .= " AND `path`=:path AND `uri`=:uri";
+            	break;
+
+			case 'all_pairs_name_uri':
+            	$aMethod['name'] = 'getPairs';
+            	$aMethod['params'][1] = 'name';
+            	$aMethod['params'][2] = 'uri';
             	break;
 
             case 'all':
@@ -154,7 +155,7 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton
 
         if(isset($aParams['active'])) {
             $sPostfix .= "_active";
-            $aMethod['params'][1]['enabled'] = (int)$aParams['active'];
+            $aBindings['enabled'] = (int)$aParams['active'];
 
             $sWhereClause .= " AND `enabled`=:enabled";
         }
@@ -178,6 +179,7 @@ class BxDolModuleQuery extends BxDolDb implements iBxDolSingleton
                 `enabled`
             FROM `sys_modules`
             WHERE 1 " . $sWhereClause . $sOrderByClause;
+        $aMethod['params'][] = $aBindings;
 
         if(!$bFromCache || empty($sPostfix))
         	return call_user_func_array(array($this, $aMethod['name']), $aMethod['params']);

+ 84 - 0
inc/js/classes/BxDolCreatePost.js

@@ -0,0 +1,84 @@
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaCore UNA Core
+ * @{
+ */
+
+function BxDolCreatePost(oOptions) {
+    this._sObjName = oOptions.sObjName == undefined ? 'oBxDolCreatePost' : oOptions.sObjName;
+    this._sRootUrl = oOptions.sRootUrl == undefined ? sUrlRoot : oOptions.sRootUrl;
+    this._sDefault = oOptions.sDefault == undefined ? '' : oOptions.sDefault;
+
+    this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
+    this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
+
+    this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+}
+
+BxDolCreatePost.prototype.getForm = function (sModuleName, sModuleUri,  oElement) {
+	var $this = this;
+	var oDate = new Date();
+
+	if($('.sys-cpf-form.sys-cpf-' + sModuleName + ' form').length > 0) {
+		$('.sys-cpf-form:visible').bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
+			$('.sys-cpf-form.sys-cpf-' + sModuleName).show().siblings('.sys-cpf-close:hidden').show();
+		});
+
+		return false;
+	}
+
+	this._loadingInBlock(oElement, true);
+
+	$.get(
+		this._sRootUrl + 'modules/?r=' + sModuleUri + '/get_create_post_form/', {
+			ajax_mode: true,
+			dynamic_mode: true,
+			absolute_action_url: true,
+	    	_t:oDate.getTime()
+		},
+		function(oData) {
+			$this._loadingInBlock(oElement, false);
+
+			if(!oData || !oData.content)
+				return;
+
+			$('.sys-cpf-form:visible').bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
+				var sForm = '.sys-cpf-form.sys-cpf-' + oData.module;
+				if($(sForm).length == 0)
+					$('.sys-cpf-close').before($('<div class="sys-cpf-form sys-cpf-' + oData.module + '"></div>').hide());
+
+				$(sForm).html(oData.content).show().siblings('.sys-cpf-close:hidden').show();
+			});
+		}, 
+		'json'
+	);
+
+	return false;
+};
+
+BxDolCreatePost.prototype.hideForm = function(oElement) {
+	$(oElement).parents('.sys-cpf-close:first').bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed);
+
+	var oMiActive = $('.sys-cpf-submenu li.bx-menu-inter-act:visible');
+	var sMiActive = oMiActive.attr('id').replace('-act', '');
+	if(sMiActive != this._sDefault)
+		oMiActive.hide().siblings('#' + sMiActive + '-pas').show().siblings('#' + this._sDefault + '-pas').hide().siblings('#' + this._sDefault + '-act').show();
+
+	$('.sys-cpf-form:visible').bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
+		$('.sys-cpf-form.sys-cpf-default').show();
+	});
+};
+
+BxDolCreatePost.prototype._loading = function(e, bShow) {
+	var oParent = $(e).length ? $(e) : $('body'); 
+	bx_loading(oParent, bShow);
+};
+
+BxDolCreatePost.prototype._loadingInBlock = function(e, bShow) {
+	var oParent = $(e).length ? $(e).parents('.bx-db-content:first') : $('body'); 
+	bx_loading(oParent, bShow);
+};
+
+/** @} */

+ 3 - 0
inc/js/functions.js

@@ -35,6 +35,9 @@ function processJsonData(oData) {
 	        oPopup.hide().prependTo('body').bxProcessHtml().dolPopup(oOptions);
 	    }
 
+	    if(oData && oData.form != undefined && oData.form_id != undefined)
+	    	$('form#' + oData.form_id).replaceWith(oData.form).bxProcessHtml();
+
 	    if (oData && oData.eval != undefined)
 	        eval(oData.eval);
 	};

+ 9 - 6
modules/base/files/classes/BxBaseModFilesFormsEntryHelper.php

@@ -36,26 +36,29 @@ class BxBaseModFilesFormsEntryHelper extends BxBaseModTextFormsEntryHelper
 
         // check access
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->checkAllowedAdd()))
-            return MsgBox($sMsg);
+            return $this->prepareResponse(MsgBox($sMsg), $this->_bAjaxMode, 'msg');
 
         // check and display form
         $oForm = $this->getObjectFormAdd();
         if (!$oForm)
-            return MsgBox(_t('_sys_txt_error_occured'));
+            return $this->prepareResponse(MsgBox(_t('_sys_txt_error_occured')), $this->_bAjaxMode, 'msg');
 
         $oForm->initChecker();
-
         if (!$oForm->isSubmittedAndValid())
-            return $oForm->getCode();
+            return $this->prepareResponse($oForm->getCode($this->_bDynamicMode), $this->_bAjaxMode && $oForm->isSubmitted(), 'form', array(
+            	'form_id' => $oForm->getId()
+            ));
 
         // insert data into database
         $aValsToAdd = array ();
         $aContentIds = $oForm->insert ($aValsToAdd);
         if (false === $aContentIds || !is_array($aContentIds)) {
             if (!$oForm->isValid() || !is_array($aContentIds))
-                return $oForm->getCode();
+                return $this->prepareResponse($oForm->getCode($this->_bDynamicMode), $this->_bAjaxMode, 'form', array(
+                	'form_id' => $oForm->getId()
+                ));
             else
-                return MsgBox(_t('_sys_txt_error_entry_creation'));
+                return $this->prepareResponse(MsgBox(_t('_sys_txt_error_entry_creation')), $this->_bAjaxMode, 'msg');
         }
 
         foreach ($aContentIds as $iContentId) {

+ 49 - 11
modules/base/general/classes/BxBaseModGeneralFormsEntryHelper.php

@@ -15,13 +15,27 @@
 class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
 {
     protected $_oModule;
+    protected $_bAjaxMode;
     protected $_bDynamicMode;
 
     public function __construct($oModule)
     {
         parent::__construct();
         $this->_oModule = $oModule;
+
         $this->_bDynamicMode = false;
+
+        $this->_bAjaxMode = false;
+        $mixedAjaxMode = bx_get('ajax_mode');
+        if($mixedAjaxMode !== false)
+        	$this->setAjaxMode($mixedAjaxMode);
+    }
+
+	public function setAjaxMode($bAjaxMode)
+    {
+        $this->_bAjaxMode = (bool)$bAjaxMode;
+        if($this->_bAjaxMode)
+        	$this->setDynamicMode(true);
     }
 
     public function setDynamicMode($bDynamicMode)
@@ -142,39 +156,42 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         if (CHECK_ACTION_RESULT_ALLOWED !== ($sMsg = $this->_oModule->$sCheckFunction())) {
             $oProfile = BxDolProfile::getInstance();
             if ($oProfile && ($aProfileInfo = $oProfile->getInfo()) && $aProfileInfo['type'] == 'system' && is_subclass_of($this->_oModule, 'BxBaseModProfileModule') && $this->_oModule->serviceActAsProfile()) // special check for system profile is needed, because of incorrect error message
-                return MsgBox(_t('_sys_txt_access_denied'));
+                return $this->prepareResponse(MsgBox(_t('_sys_txt_access_denied')), $this->_bAjaxMode, 'msg');
             else
-                return MsgBox($sMsg);
+                return $this->prepareResponse(MsgBox($sMsg), $this->_bAjaxMode, 'msg');
         }
 
         // check and display form
         $oForm = $this->getObjectFormAdd($sDisplay);
         if (!$oForm)
-            return MsgBox(_t('_sys_txt_error_occured'));
+            return $this->prepareResponse(MsgBox(_t('_sys_txt_error_occured')), $this->_bAjaxMode, 'msg');
 
         $oForm->initChecker();
-
         if (!$oForm->isSubmittedAndValid())
-            return $oForm->getCode($this->_bDynamicMode);
+            return $this->prepareResponse($oForm->getCode($this->_bDynamicMode), $this->_bAjaxMode && $oForm->isSubmitted(), 'form', array(
+            	'form_id' => $oForm->getId()
+            ));
 
         // insert data into database
         $aValsToAdd = array ();
         $iContentId = $oForm->insert ($aValsToAdd);
         if (!$iContentId) {
             if (!$oForm->isValid())
-                return $oForm->getCode($this->_bDynamicMode);
+                return $this->prepareResponse($oForm->getCode($this->_bDynamicMode), $this->_bAjaxMode, 'form', array(
+                	'form_id' => $oForm->getId()
+                ));
             else
-                return MsgBox(_t('_sys_txt_error_entry_creation'));
+                return $this->prepareResponse(MsgBox(_t('_sys_txt_error_entry_creation')), $this->_bAjaxMode, 'msg');
         }
 
         $sResult = $this->onDataAddAfter (getLoggedId(), $iContentId);
         if ($sResult)
-            return $sResult;
+            return $this->prepareResponse($sResult, $this->_bAjaxMode, 'msg');
 
         // process uploaded files
         if (isset($CNF['FIELD_PHOTO']))
             $oForm->processFiles ($CNF['FIELD_PHOTO'], $iContentId, true);
-        
+
         // perform action
         $this->_oModule->checkAllowedAdd(true);
 
@@ -185,8 +202,13 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
     
     public function redirectAfterAdd($aContentInfo)
     {
-        $CNF = &$this->_oModule->_oConfig->CNF;
-        $this->_redirectAndExit('page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']]);
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
+    	$sUrl = 'page.php?i=' . $CNF['URI_VIEW_ENTRY'] . '&id=' . $aContentInfo[$CNF['FIELD_ID']];
+        if($this->_bAjaxMode)
+        	$this->prepareResponse($sUrl, $this->_bAjaxMode, 'redirect');
+		else
+        	$this->_redirectAndExit($sUrl);
     }
 
     public function editDataForm ($iContentId, $sDisplay = false, $sCheckFunction = false, $bErrorMsg = true)
@@ -441,6 +463,22 @@ class BxBaseModGeneralFormsEntryHelper extends BxDolProfileForms
         
         return $s;
     }
+
+    protected function prepareResponse($mixedResponse, $bAsJson = false, $sKey = 'msg', $aAdditional = array())
+    {
+    	if(!$bAsJson)
+    		return $mixedResponse;
+
+		$aResponse = array(
+			$sKey => $mixedResponse
+		);
+
+		if(!empty($aAdditional) && is_array($aAdditional))
+			$aResponse = array_merge($aResponse, $aAdditional);
+
+		echoJson($aResponse);
+		exit;
+    }
 }
 
 /** @} */

+ 65 - 4
modules/base/general/classes/BxBaseModGeneralModule.php

@@ -18,6 +18,7 @@ class BxBaseModGeneralModule extends BxDolModule
 {
     protected $_iProfileId;
     protected $_aSearchableNamesExcept;
+    protected $_aFormParams;
 
     function __construct(&$aModule)
     {
@@ -27,6 +28,13 @@ class BxBaseModGeneralModule extends BxDolModule
         $this->_aSearchableNamesExcept = array(
             'allow_view_to'
         );
+        
+        $this->_aFormParams = array(
+        	'display' => false, 
+        	'dynamic_mode' => false, 
+        	'ajax_mode' => false, 
+        	'absolute_action_url' => false
+        );
     }
 
     // ====== ACTIONS METHODS
@@ -36,8 +44,34 @@ class BxBaseModGeneralModule extends BxDolModule
         $aArgs = func_get_args();
         $this->_rss($aArgs);
     }
+    
+    public function actionGetCreatePostForm()
+    {
+    	$aParams = bx_process_input(array_intersect_key($_GET, $this->_aFormParams));
+    	$aParams = array_merge($this->_aFormParams, $aParams);
+
+    	$sForm = $this->serviceGetCreatePostForm($aParams);
+    	if(empty($sForm))
+    		return echoJson(array());
+
+	   	return echoJson(array(
+    		'module' => $this->_oConfig->getName(),
+    		'content' => $sForm
+    	));
+    }
+
+    // ====== SERVICE METHODS
+    public function serviceGetCreatePostForm($aParams = array())
+    {
+    	$aParams = array_merge($this->_aFormParams, $aParams);
+
+    	$oForm = $this->serviceGetObjectForm('add', $aParams);
+    	if(!$oForm)
+    		return ''; 	
+
+    	return $this->serviceEntityCreate($aParams);
+    }
 
-    // ====== SERVICE METHODS    
     public function serviceGetAuthor ($iContentId)
     {
         $mixedResult = $this->_getFieldValue('FIELD_AUTHOR', $iContentId);
@@ -345,10 +379,10 @@ class BxBaseModGeneralModule extends BxDolModule
     /**
      * Get form object for add, edit, view or delete the content 
      * @param $sType 'add', 'edit', 'view' or 'delete'
-     * @param $sDisplay optional display name
+     * @param $aParams optional array with parameters(display name, etc)
      * @return form object or false on error
      */
-    public function serviceGetObjectForm ($sType, $sDisplay = false)
+    public function serviceGetObjectForm ($sType, $aParams = array())
     {
         if (!in_array($sType, array('add', 'edit', 'view', 'delete')))
             return false;
@@ -357,8 +391,23 @@ class BxBaseModGeneralModule extends BxDolModule
         $sClass = $this->_aModule['class_prefix'] . 'FormsEntryHelper';
         $oFormsHelper = new $sClass($this);
 
+        $sDisplay = !empty($aParams['display']) ? $aParams['display'] : false;
+
         $sFunc = 'getObjectForm' . ucfirst($sType);
-        return $oFormsHelper->$sFunc($sDisplay);
+        $oForm = $oFormsHelper->$sFunc($sDisplay);
+
+        $sParamsKey = 'absolute_action_url';
+        if(isset($aParams[$sParamsKey]) && (bool)$aParams[$sParamsKey] === true) {
+        	$sKeyUri = 'URI_' . strtoupper($sType) . '_ENTRY';
+        	if(!empty($this->_oConfig->CNF[$sKeyUri]))
+        		$oForm->aFormAttrs['action'] = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php?i=' . $this->_oConfig->CNF[$sKeyUri]);
+        }
+
+        $sParamsKey = 'ajax_mode';
+        if(isset($aParams[$sParamsKey]) && is_bool($aParams[$sParamsKey]))
+        	$oForm->setAjaxMode((bool)$aParams[$sParamsKey]);
+
+        return $oForm;
     }
 
     /**
@@ -1379,6 +1428,18 @@ class BxBaseModGeneralModule extends BxDolModule
 
         return $oImagesTranscoder->getFileUrl($aContentInfo[$CNF[$sField]]);
     }
+
+	protected function _prepareResponse($aResponse, $bAsJson = false, $aAdditional = array())
+    {
+    	if(!$bAsJson)
+    		return $aResponse;
+
+		if(!empty($aAdditional) && is_array($aAdditional))
+			$aResponse = array_merge($aResponse, $aAdditional);
+
+		echoJson($aResponse);
+		exit;
+    }
 }
 
 /** @} */

+ 21 - 0
modules/boonex/decorous/data/template/system/scripts/BxTemplMenuCreatePost.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplMenuCreatePost extends BxBaseMenuCreatePost
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 6 - 1
modules/boonex/english/data/langs/system/en.xml

@@ -2285,6 +2285,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_menu_template_title_icon_buttons_hor"><![CDATA[Horizontal Icon Buttons]]></string>
 	<string name="_sys_menu_template_title_inline"><![CDATA[Inline]]></string>
 	<string name="_sys_menu_template_title_inline_sbtn"><![CDATA[Inline ('special' buttons)]]></string>
+	<string name="_sys_menu_template_title_interactive"><![CDATA[Interactive Horizontal Links]]></string>
 	<string name="_sys_menu_template_title_interactive_vertical"><![CDATA[Interactive Vertical Links]]></string>
 	<string name="_sys_menu_template_title_empty"><![CDATA[Empty Menu]]></string>
 	<string name="_sys_menu_template_title_main_submenu"><![CDATA[Site Navigation Submenu]]></string>
@@ -2352,6 +2353,8 @@ If it is not enabled then please consider implement this optimization, since it
   <string name="_sys_page_block_title_confirm_email"><![CDATA[Email Confirmation]]></string>
 	<string name="_sys_page_block_title_confirm_phone"><![CDATA[Phone Confirmation]]></string>
 	<string name="_sys_page_block_title_create_account"><![CDATA[Sign up]]></string>
+	<string name="_sys_page_block_title_sys_create_post"><![CDATA[Create Post]]></string>
+	<string name="_sys_page_block_title_create_post"><![CDATA[Add new...]]></string>
 	<string name="_sys_page_block_title_dashboard"><![CDATA[Dashboard]]></string>
 	<string name="_sys_page_block_title_homepage_menu"><![CDATA[Content modules menu]]></string>
 	<string name="_sys_page_block_title_forgot_password"><![CDATA[Forgot Password]]></string>
@@ -2569,7 +2572,9 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_txt_confirm_phone_confirm_success"><![CDATA[Your phone number has been confirmed.]]></string>
 	<string name="_sys_txt_confirm_phone_set_phone_desc_set_phone"><![CDATA[Please enter a phone number for sending verification SMS.]]></string>
 	<string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Please enter verification code from the SMS.]]></string>
-	
+
+	<string name="_sys_txt_create_post_placeholder"><![CDATA[Write an article, share a link, photo or video.]]></string>
+
     <string name="_sys_txt_current_picture"><![CDATA[Current Picture]]></string>
 	<string name="_sys_txt_data_successfully_submitted"><![CDATA[Done]]></string>
     <string name="_sys_txt_delete"><![CDATA[Delete]]></string>

+ 6 - 4
modules/boonex/files/classes/BxFilesFormsEntryHelper.php

@@ -23,7 +23,6 @@ class BxFilesFormsEntryHelper extends BxBaseModFilesFormsEntryHelper
 
     public function addDataForm ($sDisplay = false, $sCheckFunction = false)
     {
-       
 		$mixedContent = $this->addDataFormAction($sDisplay, $sCheckFunction);
 		if (is_array($mixedContent) && $mixedContent['need_redirect_after_action']){
 			$CNF = &$this->_oModule->_oConfig->CNF;
@@ -31,10 +30,13 @@ class BxFilesFormsEntryHelper extends BxBaseModFilesFormsEntryHelper
 			$iContentId = array_pop($aContentIds);
 			$aContentInfo = $this->_oModule->_oDb->getContentInfoById($iContentId);
 			$oProfile = BxDolProfile::getInstance($aContentInfo[$CNF['FIELD_AUTHOR']]);
-			$sUri = $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . ($oProfile ? $oProfile->id() : bx_get_logged_profile_id());
-			$this->_redirectAndExit('page.php?i=' . $sUri);
+			$sUrl = 'page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . ($oProfile ? $oProfile->id() : bx_get_logged_profile_id());
+			if($this->_bAjaxMode)
+	        	$this->prepareResponse($sUrl, $this->_bAjaxMode, 'redirect');
+			else
+	        	$this->_redirectAndExit($sUrl);
 		}
-		else{
+		else {
 			return $mixedContent;	
 		}
     }

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

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplMenuCreatePost extends BxBaseMenuCreatePost
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 7 - 2
modules/boonex/photos/classes/BxPhotosFormsEntryHelper.php

@@ -26,9 +26,14 @@ class BxPhotosFormsEntryHelper extends BxBaseModFilesFormsEntryHelper
         $mixedContent = $this->addDataFormAction($sDisplay, $sCheckFunction);
 		if (is_array($mixedContent) && $mixedContent['need_redirect_after_action']){
 			$CNF = &$this->_oModule->_oConfig->CNF;
-        	$this->_redirectAndExit(BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . bx_get_logged_profile_id()));
+
+			$sUrl = BxDolPermalinks::getInstance()->permalink('page.php?i=' . $CNF['URI_AUTHOR_ENTRIES'] . '&profile_id=' . bx_get_logged_profile_id());
+			if($this->_bAjaxMode)
+	        	$this->prepareResponse($sUrl, $this->_bAjaxMode, 'redirect');
+			else
+	        	$this->_redirectAndExit($sUrl);
 		}
-		else{
+		else {
 			return $mixedContent;
 		}
     }

+ 10 - 2
modules/boonex/polls/classes/BxPollsFormEntry.php

@@ -32,8 +32,16 @@ class BxPollsFormEntry extends BxBaseModTextFormEntry
 
     public function getCode($bDynamicMode = false)
     {
-        $this->_oModule->_oTemplate->addJs(array('form.js'));
-        return $this->_oModule->_oTemplate->getJsCode('form') . parent::getCode($bDynamicMode);
+        $sJs = $this->_oModule->_oTemplate->addJs(array('form.js'), $bDynamicMode);
+
+        $sCode = '';
+        if($bDynamicMode)
+        	$sCode .= $sJs;
+
+		$sCode .= $this->_oModule->_oTemplate->getJsCode('form');
+		$sCode .= parent::getCode($bDynamicMode);
+
+        return $sCode;
     }
 
     function initChecker ($aValues = array (), $aSpecificValues = array())

+ 21 - 0
modules/boonex/protean/data/template/system/scripts/BxTemplMenuCreatePost.php

@@ -0,0 +1,21 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaTemplate UNA Template Classes
+ * @{
+ */
+
+/**
+ * @see BxDolMenu
+ */
+class BxTemplMenuCreatePost extends BxBaseMenuCreatePost
+{
+    public function __construct ($aObject, $oTemplate = false)
+    {
+        parent::__construct ($aObject, $oTemplate);
+    }
+}
+
+/** @} */

+ 6 - 1
modules/boonex/russian/data/langs/system/ru.xml

@@ -2284,6 +2284,7 @@
 	<string name="_sys_menu_template_title_icon_buttons_hor"><![CDATA[Горизонтальные кнопки с иконками]]></string>
 	<string name="_sys_menu_template_title_inline"><![CDATA[В тексте]]></string>
 	<string name="_sys_menu_template_title_inline_sbtn"><![CDATA[В тексте ('спец' кнопки)]]></string>
+	<string name="_sys_menu_template_title_interactive"><![CDATA[Интерактивные горизонтальные ссылки]]></string>
 	<string name="_sys_menu_template_title_interactive_vertical"><![CDATA[Интерактивные вертикальные ссылки]]></string>
 	<string name="_sys_menu_template_title_empty"><![CDATA[Пустое меню]]></string>
 	<string name="_sys_menu_template_title_main_submenu"><![CDATA[Навигация по сайту - Подменю]]></string>
@@ -2351,6 +2352,8 @@
 	<string name="_sys_page_block_title_confirm_email"><![CDATA[Имейл - Подтверждение]]></string>
 	<string name="_sys_page_block_title_confirm_phone"><![CDATA[Телефон - Подтверждение]]></string>
 	<string name="_sys_page_block_title_create_account"><![CDATA[Присоединиться]]></string>
+	<string name="_sys_page_block_title_sys_create_post"><![CDATA[Создать публикацию]]></string>
+	<string name="_sys_page_block_title_create_post"><![CDATA[Добавить...]]></string>
 	<string name="_sys_page_block_title_dashboard"><![CDATA[Панель]]></string>
     <string name="_sys_page_block_title_homepage_menu"><![CDATA[Меню модулей с содержимым]]></string>
 	<string name="_sys_page_block_title_forgot_password"><![CDATA[Забыли пароль]]></string>
@@ -2569,7 +2572,9 @@
 	<string name="_sys_txt_confirm_phone_confirm_success"><![CDATA[Ваш телефон успешно подтверждён.]]></string>
 	<string name="_sys_txt_confirm_phone_set_phone_desc_set_phone"><![CDATA[Пожалуйста, введите телефонный номер на который будет отправлено SMS с кодом подтверждения.]]></string>
 	<string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Пожалуйста, введите код проверки из SMS]]></string>
-	
+
+	<string name="_sys_txt_create_post_placeholder"><![CDATA[Написать статью, поделиться линкой, фото или видео.]]></string>
+
     <string name="_sys_txt_current_picture"><![CDATA[Текущая картинка]]></string>
 	<string name="_sys_txt_data_successfully_submitted"><![CDATA[Выполнено]]></string>
     <string name="_sys_txt_delete"><![CDATA[Удалить]]></string>

+ 1 - 1
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -377,7 +377,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         return BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->CNF['URL_HOME']);
     }
 
-    public function getItemViewUrl(&$aEvent)
+    public function getItemViewUrl($aEvent)
     {
         return BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink('page.php', array(
         	'i' => $this->CNF['URI_VIEW_ENTRY'], 

+ 95 - 7
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -427,9 +427,86 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         echo $oRss->GenRssByData($aRssData, $sRssCaption, $sRssLink);
     }
 
+
     /**
      * SERVICE METHODS
      */
+
+    /**
+     * @page service Service Calls
+     * @section bx_timeline Timeline
+     * @subsection bx_timeline-other Other
+     * @subsubsection bx_timeline-get_create_post_form get_create_post_form
+     * 
+     * @code bx_srv('bx_timeline', 'get_create_post_form', [...]); @endcode
+     * 
+     * Get form code for add content. Is needed for United Post Form.
+     * 
+     * @param $aParams optional array with parameters(display name, etc)
+     * @return form code or error
+     * 
+     * @see BxTimelineModule::serviceGetCreatePostForm
+     */
+    /** 
+     * @ref bx_timeline-get_create_post_form "get_create_post_form"
+     */
+    public function serviceGetCreatePostForm($aParams = array())
+    {
+    	$aParams = array_merge($this->_aFormParams, $aParams);
+
+    	$oForm = $this->serviceGetObjectForm('add', $aParams);
+    	if(!$oForm)
+    		return ''; 	
+
+		if(!empty($aParams['display']))
+			$aParams['form_display'] = $aParams['display'];
+
+    	$aResult = $this->getFormPost($aParams);
+    	if(!empty($aResult['form']))
+			return $aResult['form'];
+
+		if(!empty($aResult['message']))
+			return $aResult['message'];
+
+		return '';
+    }
+
+    /**
+     * @page service Service Calls
+     * @section bx_timeline Timeline
+     * @subsection bx_timeline-other Other
+     * @subsubsection bx_timeline-get_object_form get_object_form
+     * 
+     * @code bx_srv('bx_timeline', 'get_object_form', [...]); @endcode
+     * 
+     * Get form object for add, edit, view or delete the content.
+     * 
+     * @param $sType 'add' is supported only 
+     * @param $aParams optional array with parameters(display name, etc)
+     * @return form object or false on error
+     * 
+     * @see BxTimelineModule::serviceGetObjectForm
+     */
+    /** 
+     * @ref bx_timeline-get_object_form "get_object_form"
+     */
+    public function serviceGetObjectForm ($sType, $aParams = array())
+    {
+    	if (!in_array($sType, array('add')))
+            return false;
+
+		if(!empty($aParams['display']))
+			$aParams['form_display'] = $aParams['display'];
+
+		$oForm = $this->getFormPostObject($aParams);
+			
+		$sParamsKey = 'ajax_mode';
+        if(isset($aParams[$sParamsKey]) && is_bool($aParams[$sParamsKey]))
+        	$oForm->setAjaxMode((bool)$aParams[$sParamsKey]);
+
+    	return $oForm;
+    }
+
     /**
      * @page service Service Calls
      * @section bx_timeline Timeline
@@ -1602,11 +1679,12 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
     {
         $iUserId = $this->getUserId();
 
-        $sFormObject = !empty($aParams['form_object']) ? $aParams['form_object'] : 'form_post';
-        $sFormDisplay = !empty($aParams['form_display']) ? $aParams['form_display'] : 'form_display_post_add';
-        $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject($sFormObject), $this->_oConfig->getObject($sFormDisplay), $this->_oTemplate);
-
+        $oForm = $this->getFormPostObject($aParams);
         $oForm->initChecker();
+
+        $bAjaxMode = $oForm->isAjaxMode();
+        $bDynamicMode = $bAjaxMode;
+
         if($oForm->isSubmittedAndValid()) {
             list($sUserName) = $this->getUserInfo($iUserId);
 
@@ -1688,13 +1766,16 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
 
                 $this->onPost($iId);
 
-                return array('id' => $iId);
+                return $this->_prepareResponse(array('message' => _t('_bx_timeline_txt_msg_performed_action'), 'id' => $iId), $bAjaxMode, array(
+                	'message' => '',
+                	'redirect' => $this->_oConfig->getItemViewUrl(array('id' => $iId))
+                ));
             }
 
-            return array('message' => _t('_bx_timeline_txt_err_cannot_perform_action'));
+            return $this->_prepareResponse(array('message' => _t('_bx_timeline_txt_err_cannot_perform_action')), $bAjaxMode);
         }
 
-        return array('form' => $oForm->getCode(), 'form_id' => $oForm->id);
+        return $this->_prepareResponse(array('form' => $oForm->getCode($bDynamicMode), 'form_id' => $oForm->id), $bAjaxMode && $oForm->isSubmitted());
     }
 
     public function getFormEdit($iId, $aParams = array())
@@ -1786,6 +1867,13 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         );
     }
 
+    public function getFormPostObject($aParams)
+    {
+    	$sFormObject = !empty($aParams['form_object']) ? $aParams['form_object'] : 'form_post';
+        $sFormDisplay = !empty($aParams['form_display']) ? $aParams['form_display'] : 'form_display_post_add';
+        return BxDolForm::getObjectInstance($this->_oConfig->getObject($sFormObject), $this->_oConfig->getObject($sFormDisplay), $this->_oTemplate);
+    }
+
     public function getCmtsObject($sSystem, $iId)
     {
         if(empty($sSystem) || (int)$iId == 0)

+ 21 - 0
template/create_post_form.html

@@ -0,0 +1,21 @@
+<div id="sys-create-post-form" class="sys-create-post-form">
+    <div class="sys-cpf-header">
+		<div class="sys-cpf-title bx-def-padding-leftright bx-def-border-bottom bx-def-box-sizing"><bx_text:_sys_page_block_title_create_post /></div>
+	    <div class="sys-cpf-submenu">
+	        <div class="sys-cpf-submenu-cnt">__menu__</div>
+	    </div>
+    </div>
+    <div class="sys-cpf-cnt bx-def-padding">
+        <div id="sys-cpf-form">
+            <div class="sys-cpf-form sys-cpf-default">
+		        <div class="sys-cpf-user">__user_thumb__</div>
+		        <div class="sys-cpf-content bx-def-thumb-size-min-height bx-def-thumb-size-left-indent bx-def-font-grayed">
+		            <div onclick="__js_object__.getForm('__default__')"><bx_text:_sys_txt_create_post_placeholder /></div>
+		        </div>
+            </div>
+            <div class="sys-cpf-form sys-cpf-__default__" style="display:none">__form__</div>
+            <div class="sys-cpf-close"><a class="bx-btn" href="javascript:void(0)" onclick="__js_object__.hideForm(this)"><i class="sys-icon times"></i></a></div>
+        </div>
+    </div>
+</div>
+__js_content__

+ 157 - 0
template/css/general.css

@@ -178,3 +178,160 @@
 .bx-profile-stats .bx-ps-acl span {
 	text-transform: uppercase;
 }
+
+
+/* --------------- Create Post Form */
+
+.sys-create-post-form {
+	position: relative;
+}
+
+.sys-create-post-form .bx-loading-ajax {
+	display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+    -webkit-justify-content: center;
+    justify-content: center;
+
+	top: 0;
+	width: 100%;
+	height: 100%;
+}
+
+.sys-cpf-header {
+	display: -webkit-flex;
+    display: flex;
+
+	border-bottom-color: #e6f0fa;
+    border-bottom-width: 2px;
+}
+.sys-cpf-title,
+.sys-cpf-submenu {
+	-webkit-flex: 0 1 auto; 
+    -ms-flex:  0 1 auto; 
+    flex:  0 1 auto;
+    line-height: 3.125rem;
+}
+.sys-cpf-title,
+.sys-cpf-submenu-cnt {
+	height: 3.125rem;
+}
+
+.sys-cpf-title {
+    -webkit-flex-grow: 3;
+    flex-grow: 3;
+
+    border-bottom: 2px solid rgba(0,0,0,0.1);
+
+    white-space: nowrap;
+    font-size: 1rem;
+    font-weight: 400;
+    color: #102e70;
+}
+.sys-cpf-submenu {
+	overflow-x: auto;
+	overflow-y: hidden;
+
+	-webkit-overflow-scrolling: touch;
+}
+.sys-cpf-submenu::-webkit-scrollbar {
+    width: 0.5rem;
+}
+.sys-cpf-submenu::-webkit-scrollbar-track {
+    -webkit-border-radius: 0.5rem;
+    border-radius: 0.5rem;
+
+    background-color: rgba(0, 0, 0, 0.1); 
+}
+.sys-cpf-submenu::-webkit-scrollbar-thumb {
+    -webkit-border-radius: 0.5rem;
+    border-radius: 0.5rem;
+
+    background: rgba(255, 255, 255, 0.9); 
+    -webkit-box-shadow: inset 0 0 1px rgba(0, 0, 0, 0.5);
+}
+.sys-cpf-submenu::-webkit-scrollbar-thumb:window-inactive {
+    background: rgba(255, 255, 255, 0.4); 
+}
+.sys-cpf-submenu-cnt ul {
+    display: -webkit-flex;
+    display: flex;
+}
+.sys-cpf-submenu-cnt ul li {
+    -webkit-flex: 0 1 auto; 
+    -ms-flex:  0 1 auto; 
+    flex:  0 1 auto;
+    box-sizing: border-box;
+    height: 3.125rem;
+
+    border-bottom: 2px solid rgba(0,0,0,0.1);
+    border-radius: 0;
+
+    line-height: 3.125rem;
+    white-space: nowrap;
+    
+}
+.sys-cpf-submenu-cnt ul li div {
+	padding: 0 0.625rem;
+}
+.sys-cpf-submenu-cnt ul li.bx-menu-inter-act {
+    border-bottom-color: #364f6b;
+}
+.sys-cpf-submenu-cnt ul li.bx-menu-inter-act > div {
+	font-weight: bold;
+    color: #000000;
+}
+.sys-cpf-submenu-item .bx-cnc-psi-icon,
+.sys-cpf-submenu-item .bx-cnc-psi-icon img {
+    width: 1.5rem;
+    height: 1.5rem;
+}
+.sys-cpf-submenu-item .bx-cnc-psi-icon img {
+    color: #002e74;
+}
+
+.sys-cpf-submenu-item .bx-cnc-psi-icon .sys-icon {
+    vertical-align: middle;
+    font-size: 1.5rem;
+}
+.sys-cpf-submenu-item .bx-cnc-psi-title {
+	text-align: center;
+}
+.sys-cpf-submenu-item.bx-cnc-psi-main .bx-cnc-psi-title {
+    text-align: left;
+}
+.sys-cpf-form {
+	position: relative;
+}
+.sys-cpf-form .sys-cpf-user {
+	position: absolute;
+	top: 0;
+	left: 0;
+}
+.sys-cpf-form .sys-cpf-content {
+	display: -webkit-flex;
+    display: flex;
+    -webkit-align-items: center;
+    align-items: center;
+}
+.sys-cpf-form .bx-uploader-ghost .bx-base-general-icon-wrapper img {
+	max-width: 9.375rem;
+}
+.sys-cpf-close {
+	position: absolute;
+	display: none;
+
+	right: 1.25rem;
+	bottom: 1.25rem;
+}
+
+
+/*--- Phone ---*/
+@media (max-width:720px) {
+    /*--- Post Form ---*/
+    .sys-cpf-submenu .sys-cpf-submenu-item > div {
+        display: block;
+        text-align: center;
+    }
+

+ 3 - 1
template/menu_interactive.html

@@ -1,6 +1,8 @@
 <ul id="bx-menu-inter-__id__" class="bx-menu-inter bx-menu-object-__object__ bx-clearfix">
 	<bx_repeat:menu_items>
-		<li class="bx-menu-inter-div"><span>&#183;</span></li>
+		<bx_if:show_divider>
+			<li class="bx-menu-inter-div"><span>&#183;</span></li>
+		</bx_if:show_divider>
 	    <li id="__id__-act" class="bx-menu-inter-act __class_wrp_act__">
 	        <div class="bx-def-padding-right bx-def-padding-sec-left bx-def-padding-sec-topbottom __class__">__title__</div>
 	    </li>

+ 49 - 0
template/scripts/BxBaseFormView.php

@@ -51,6 +51,11 @@ class BxBaseFormView extends BxDolForm
      */
     protected $_bDynamicMode = false;
 
+    /**
+     * Form is submitted dynamically (using Ajax Submit).
+     */
+    protected $_bAjaxMode = false;
+
     /**
      * Form is displayed in view mode.
      */
@@ -91,6 +96,13 @@ class BxBaseFormView extends BxDolForm
     {
         parent::__construct($aInfo, $oTemplate);
 
+        if(isset($this->aParams['ajax_mode']))
+        	$this->setAjaxMode($this->aParams['ajax_mode']);
+
+        $mixedAjaxMode = bx_get('ajax_mode');
+        if($mixedAjaxMode !== false)
+        	$this->setAjaxMode($mixedAjaxMode);
+
         $this->_bViewMode = isset($this->aParams['view_mode']) && $this->aParams['view_mode'];
 
         if ($this->_bViewMode) {
@@ -99,6 +111,16 @@ class BxBaseFormView extends BxDolForm
         }
     }
 
+	function setAjaxMode($bAjaxMode)
+    {
+		$this->_bAjaxMode = (bool)$bAjaxMode;
+    }
+
+    function isAjaxMode()
+    {
+    	return $this->_bAjaxMode;
+    }
+
     /**
      * Return Form code
      * @param $bDynamicMode - set it to true if form is added via JS/AJAX call, for example form in AJAX popup.
@@ -139,6 +161,22 @@ BLAH;
         } else {
             $sFormAttrs = bx_convert_array2attrs($this->aFormAttrs, 'bx-form-advanced');
 
+            $sAjaxFormJs = '';
+            if($this->_bAjaxMode)
+            	$sAjaxFormJs = <<<BLAH
+	            	$("form#{$this->id}").ajaxForm({ 
+			            dataType: "json",
+			            beforeSubmit: function (formData, jqForm, options) {
+			                bx_loading($("form#{$this->id}"), true);
+			            },
+			            success: function (oData) {
+			            	bx_loading($("form#{$this->id}"), false);
+			
+			                processJsonData(oData);
+			            }
+			        });
+BLAH;
+
             $sForm = <<<BLAH
                 $sHtmlBefore
                 <form $sFormAttrs>
@@ -151,6 +189,7 @@ BLAH;
                     $(document).ready(function() {
                         $(this).addWebForms();
                     });
+                    $sAjaxFormJs
                 </script>
                 $sHtmlAfter
 BLAH;
@@ -177,6 +216,16 @@ BLAH;
             );
         }
 
+        // add 'Ajax Mode' flag
+        if($this->_bAjaxMode)
+        	$this->aInputs['ajax_mode'] = array(
+                'type' => 'hidden',
+                'name' => 'ajax_mode',
+                'value' => 1,
+                'db' => array ('pass' => 'Int'),
+                'visible_for_levels' => PHP_INT_MAX,
+            );
+
         // check if we need to generate open section clause
         $sOpenSection = '';
         foreach ($this->aInputs as $aInput) {

+ 53 - 0
template/scripts/BxBaseMenuCreatePost.php

@@ -0,0 +1,53 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) UNA, Inc - https://una.io
+ * MIT License - https://opensource.org/licenses/MIT
+ *
+ * @defgroup    UnaBaseView UNA Base Representation Classes
+ * @{
+ */
+
+/**
+ * Menu representation.
+ * @see BxDolMenu
+ */
+class BxBaseMenuCreatePost extends BxTemplMenuInteractive
+{
+	protected $_sJsObject;
+
+    public function __construct ($aObject, $oTemplate)
+    {
+        parent::__construct ($aObject);
+
+        $this->_aObject['menu_id'] = 'sys-create-post-menu';
+
+        $this->_bShowDivider = false;
+        $this->_sJsObject = 'oBxDolCreatePost';
+    }
+
+	protected function getMenuItemsRaw ()
+    {
+    	$aModules = BxDolModuleQuery::getInstance()->getModulesBy(array('type' => 'all_pairs_name_uri', 'active' => 1));
+
+    	$aMenuItems = $this->_oQuery->getMenuItems();
+    	foreach($aMenuItems as $iKey => $aMenuItem) {
+    		$sModule = $aMenuItem['module'];
+
+    		$aMenuItems[$iKey]['id'] = $sModule;
+    		$aMenuItems[$iKey]['name'] = $sModule;
+    		$aMenuItems[$iKey]['onclick'] = "return " . $this->_sJsObject . ".getForm('" . $sModule . "', '" . $aModules[$sModule] . "', this)";
+    	}
+
+        return $aMenuItems;
+    }
+
+    protected function _isVisible ($a)
+    {
+    	if(BxDolRequest::serviceExists($a['module'], 'act_as_profile'))
+			return false;
+
+		return parent::_isVisible($a);
+    }
+}
+
+/** @} */

+ 9 - 1
template/scripts/BxBaseMenuInteractive.php

@@ -14,6 +14,7 @@
 class BxBaseMenuInteractive extends BxTemplMenu
 {
     protected $_oTemplate;
+    protected $_bShowDivider;
 
     public function __construct ($aObject, $oTemplate)
     {
@@ -23,6 +24,8 @@ class BxBaseMenuInteractive extends BxTemplMenu
             $this->_oTemplate = $oTemplate;
         else
             $this->_oTemplate = BxDolTemplate::getInstance();
+
+		$this->_bShowDivider = true;
     }
 
     /**
@@ -48,7 +51,7 @@ class BxBaseMenuInteractive extends BxTemplMenu
     {
         $aRet = array();
         if (!isset($this->_aObject['menu_items']))
-            $this->_aObject['menu_items'] = $this->_oQuery->getMenuItems();
+            $this->_aObject['menu_items'] = $this->getMenuItemsRaw();
 
         foreach ($this->_aObject['menu_items'] as $a) {
             if (isset($a['active']) && !$a['active'])
@@ -61,6 +64,7 @@ class BxBaseMenuInteractive extends BxTemplMenu
 
             list ($sIcon, $sIconUrl) = $this->_getMenuIcon($a);
 
+			$a['class'] = 'bx-menu-item-inter';
             $a['class_wrp_act'] = 'bx-menu-inter-hidden';
             $a['class_wrp_pas'] = '';
             if($this->_isSelected($a)) {
@@ -70,6 +74,10 @@ class BxBaseMenuInteractive extends BxTemplMenu
 
             $a['link'] = isset($a['link']) ? $this->_oPermalinks->permalink($a['link']) : 'javascript:void(0);';
             $a['title'] = _t($a['title']);
+            $a['bx_if:show_divider'] = array (
+            	'condition' => $this->_bShowDivider,
+                'content' => array(),
+            );
             $a['bx_if:image'] = array (
                 'condition' => (bool)$sIconUrl,
                 'content' => array('icon_url' => $sIconUrl),

+ 37 - 0
template/scripts/BxBaseServices.php

@@ -98,6 +98,43 @@ class BxBaseServices extends BxDol implements iBxDolProfileService
     {
         return array();
     }
+    
+    public function serviceGetCreatePostForm($sDefault = 'bx_posts')
+    {
+    	if(!isLogged())
+    		return '';
+
+    	$oMenu = BxDolMenu::getObjectInstance('sys_create_post');
+
+    	$aMenuItems = $oMenu->getMenuItems();
+    	if(empty($aMenuItems) || !is_array($aMenuItems))
+    		return '';
+
+    	if(empty($sDefault)) {
+    		$aDefault = array_shift($aMenuItems);
+    		$sDefault = $aDefault['module'];
+    	}
+    	$oMenu->setSelected($sDefault, $sDefault);
+
+    	$oTemplate = BxDolTemplate::getInstance();
+    	$oTemplate->addJs(array('BxDolCreatePost.js'));
+
+    	$sJsObject = 'oBxDolCreatePost';
+        $sJsContent = $oTemplate->_wrapInTagJsCode("var " . $sJsObject . " = new BxDolCreatePost(" . json_encode(array(
+            'sObjName' => $sJsObject,
+            'sRootUrl' => BX_DOL_URL_ROOT,
+        	'sDefault' => $sDefault
+        )) . ");");
+
+    	return array('content' => BxDolTemplate::getInstance()->parseHtmlByName('create_post_form.html', array(
+    		'default' => $sDefault,
+            'user_thumb' => BxDolProfile::getInstance()->getUnit(0, array('template' => 'unit_wo_info')),
+    		'menu' => $oMenu->getCode(),
+            'form' => BxDolService::call($sDefault, 'get_create_post_form', array(array('ajax_mode' => true, 'absolute_action_url' => true))),
+    		'js_object' => $sJsObject,
+    		'js_content' => $sJsContent
+    	)));
+    }
 
     /**
      * @see iBxDolProfileService::serviceCheckSpacePrivacy