AntonLV 9 лет назад
Родитель
Сommit
f1b488acac

+ 3 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -54,6 +54,9 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         	'FIELD_TEXT' => 'description',
         	'FIELD_LOCATION_PREFIX' => 'location',
 
+            // page URIs
+        	'URL_HOME' => 'page.php?i=timeline-view-home',
+
         	// objects
         	'OBJECT_METATAGS' => $this->_sName,
             'OBJECT_COMMENTS' => $this->_sName,

+ 9 - 1
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -160,12 +160,20 @@ class BxTimelineTemplate extends BxBaseModNotificationsTemplate
         if($oMetatags)
             $oMetatags->metaAdd($aEvent[$CNF['FIELD_ID']]);
 
+        $sReferrer = '';
+        if(isset($_SERVER['HTTP_REFERER']) && mb_stripos($_SERVER['HTTP_REFERER'], BX_DOL_URL_ROOT) === 0)
+            $sReferrer = $_SERVER['HTTP_REFERER'];
+        else 
+            $sReferrer = BX_DOL_URL_ROOT . BxDolPermalinks::getInstance()->permalink($this->_oConfig->CNF['URL_HOME']);
+
         return array('content' => $this->parseHtmlByName('block_item.html', array(
             'style_prefix' => $this->_oConfig->getPrefix('style'),
         	'html_id' => $this->_oConfig->getHtmlIds('view', 'main_item'),
         	'content' => $sContent,
         	'view_image_popup' => $this->_getImagePopup($aParams),
-            'js_content' => $this->getJsCode('view') . $this->getJsCode('repost')
+            'js_content' => $this->getJsCode('view', array(
+                'sReferrer' => $sReferrer
+            )) . $this->getJsCode('repost')
         )));
     }
 

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

@@ -13,6 +13,7 @@ function BxTimelineView(oOptions) {
     this._sActionsUrl = oOptions.sActionUrl;
     this._sObjName = oOptions.sObjName == undefined ? 'oTimelineView' : oOptions.sObjName;
     this._iOwnerId = oOptions.iOwnerId == undefined ? 0 : oOptions.iOwnerId;
+    this._sReferrer = oOptions.sReferrer == undefined ? '' : oOptions.sReferrer;
     this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'slide' : oOptions.sAnimationEffect;
     this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
     this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
@@ -290,7 +291,7 @@ BxTimelineView.prototype.deletePost = function(oLink, iId) {
 BxTimelineView.prototype.onDeletePost = function(oData) {
 	var $this = this;
 
-	//--- Delete from Timeline (if available)
+	//--- Delete from 'Timeline' (if available)
 	if(this.bViewTimeline) {
 		$(this.sIdItemTimeline + oData.id).bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
 	        $(this).remove();
@@ -301,9 +302,11 @@ BxTimelineView.prototype.onDeletePost = function(oData) {
 	        	$this.oViewTimeline.find('.' + $this.sSP + '-empty').show();
 	        }
 	    });
+
+		return;
 	}
 
-	//--- Delete from Outline (if available)
+	//--- Delete from 'Outline' (if available)
 	if(this.bViewOutline) {
 		$(this.sIdItemOutline + oData.id).bx_anim('hide', this._sAnimationEffect, this._iAnimationSpeed, function() {
 	        $(this).remove();
@@ -317,7 +320,13 @@ BxTimelineView.prototype.onDeletePost = function(oData) {
 	        else
 	        	$this.reloadMasonry();
 	    });
+
+		return;
 	}
+
+	//--- Delete from 'View Item' page.
+	if(this._sReferrer.length != 0)
+		document.location = this._sReferrer;
 };
 
 BxTimelineView.prototype._getPosts = function(oElement, onComplete) {