AntonLV 8 lat temu
rodzic
commit
1ce17483b4

+ 4 - 3
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -99,7 +99,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         if($mixedAllowed !== true)
             return echoJson(array('message' => strip_tags($mixedAllowed)));
 
-        echoJson($this->getFormEdit($iId));
+        echoJson($this->getFormEdit($iId, array('dynamic_mode' => true)));
     }
 
 	function actionPin()
@@ -292,7 +292,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
     {
         $this->_iOwnerId = bx_process_input(bx_get('owner_id'), BX_DATA_INT);
 
-        echoJson($this->getFormEdit($iId));
+        echoJson($this->getFormEdit($iId, array('dynamic_mode' => true)));
     }
 
     public function actionGetComments()
@@ -1802,6 +1802,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
         if(is_array($aContent) && !empty($aContent['text']))
             $aEvent['text'] = $aContent['text'];
 
+		$bDynamicMode = isset($aParams['dynamic_mode']) ? (bool)$aParams['dynamic_mode'] : false;
         $sFormObject = !empty($aParams['form_object']) ? $aParams['form_object'] : 'form_post';
         $sFormDisplay = !empty($aParams['form_display']) ? $aParams['form_display'] : 'form_display_post_edit';
         $oForm = BxDolForm::getObjectInstance($this->_oConfig->getObject($sFormObject), $this->_oConfig->getObject($sFormDisplay), $this->_oTemplate);
@@ -1873,7 +1874,7 @@ class BxTimelineModule extends BxBaseModNotificationsModule implements iBxDolCon
 
         return array(
             'id' => $iId, 
-        	'form' => $oForm->getCode(), 
+        	'form' => $oForm->getCode($bDynamicMode), 
         	'form_id' => $oForm->id,
         	'eval' => $this->_oConfig->getJsObject('view') . '.onEditPost(oData)'
         );

+ 4 - 0
modules/boonex/timeline/js/main.js

@@ -17,6 +17,7 @@ function BxTimelineMain() {
 	this.sIdItem = '#bx-timeline-item-';
 	this.sIdItemTimeline = '#bx-timeline-item-timeline-';
 	this.sIdItemOutline = '#bx-timeline-item-outline-';
+	this.sIdItemItem = '#bx-timeline-item-item-';
 
 	this.sSP = 'bx-tl';
 	this.sClassView = this.sSP + '-view';
@@ -35,6 +36,9 @@ function BxTimelineMain() {
 
 	this.oViewOutline = null;
 	this.bViewOutline = false;
+
+	this.oViewItem = null;
+	this.bViewItem = false;
 }
 
 BxTimelineMain.prototype.initVideos = function(oParent) {

+ 9 - 2
modules/boonex/timeline/js/view.js

@@ -48,7 +48,10 @@ BxTimelineView.prototype.init = function() {
 	this.bViewTimeline = this.oViewTimeline.length > 0;
 
 	this.oViewOutline = $('#' + this._aHtmlIds['main_outline']);
-	this.bViewOutline = this.oViewOutline.length > 0;	
+	this.bViewOutline = this.oViewOutline.length > 0;
+
+	this.oViewItem = $('#' + this._aHtmlIds['main_item']);
+	this.bViewItem = this.oViewItem.length > 0;	
 
 	if(this.bViewTimeline) {
 		this._oRequestParams['timeline'] = jQuery.extend({}, this._oRequestParams['general']);
@@ -468,9 +471,10 @@ BxTimelineView.prototype.editPost = function(oLink, iId) {
     var oItem = null;
     if(this.bViewTimeline)
     	oItem = $(this.sIdItemTimeline + iId);
-
     if(this.bViewOutline)
     	oItem = $(this.sIdItemOutline + iId);
+    if(this.bViewItem)
+    	oItem = $(this.sIdItemItem + iId);
 
     var oContent = oItem.find('.' + this.sClassItemContent);
     if(oContent.find('form').length) {
@@ -505,10 +509,13 @@ BxTimelineView.prototype.onEditPost = function(oData) {
 		oItem = $(this.sIdItemTimeline + oData.id);
     if(this.bViewOutline)
     	oItem = $(this.sIdItemOutline + oData.id);
+    if(this.bViewItem)
+    	oItem = $(this.sIdItemItem + oData.id);
 
     this.loadingInItem(oItem, false);
 
 	if(oData && oData.form != undefined && oData.form_id != undefined) {
+		console.log(oItem, oItem.find('.' + this.sClassItemContent));
 		oItem.find('.' + this.sClassItemContent).bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
             $(this).html(oData.form).bx_anim('show', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
             	$this.initFormEdit(oData.form_id);