Browse Source

#24 - Usage of dolPopupImage instead of custom popup.

AntonLV 12 years ago
parent
commit
6c25ff57c8

+ 0 - 15
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -203,21 +203,6 @@ class BxTimelineModule extends BxDolModule
         echo $this->_oTemplate->getViewItemPopup($iItemId);
     }
 
-    /*
-	TODO: Remove if it's not needed.
-
-    public function actionGetPhotoPopup()
-    {
-        $iEventId = bx_process_input(bx_get('event_id'), BX_DATA_INT);
-        $iStart = bx_process_input(bx_get('start'), BX_DATA_INT);
-
-        if(!$iEventId)
-            return;
-
-        echo $this->_oTemplate->getPhotoPopup($iEventId, $iStart);
-    }
-    */
-
     public function actionAddAttachLink()
     {
         $aResult = $this->getFormAttachLink();

+ 13 - 63
modules/boonex/timeline/classes/BxTimelineTemplate.php

@@ -90,18 +90,12 @@ class BxTimelineTemplate extends BxDolModuleTemplate
     {
         list($sContent, $sLoadMore, $sBack) = $this->getPosts($aParams);
 
-        $sViewImagePopupId = $this->_oConfig->getHtmlIds('view', 'photo_popup');
-        $sViewImagePopupContent = $this->parseHtmlByName('popup_image.html', array(
-    		'image_url' => ''
-    	));
-
-    	bx_import('BxTemplFunctions');
         return $this->parseHtmlByName('block_view.html', array(
             'style_prefix' => $this->_oConfig->getPrefix('style'),
             'back' => $sBack,
             'content' => $sContent,
             'load_more' =>  $sLoadMore,
-        	'view_image_popup' => BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true),
+        	'view_image_popup' => $this->_getImagePopup(),
             'js_content' => $this->getJsCode('view', array(
                 'type' => $aParams['type'],
                 'owner_id' => $aParams['owner_id'],
@@ -122,6 +116,8 @@ class BxTimelineTemplate extends BxDolModuleTemplate
 
         $sContent = $this->getJsCode('view');
         $sContent .= $this->getPost($aEvent, array('type' => BX_TIMELINE_TYPE_ITEM));
+        $sContent .= $this->_getImagePopup();
+
         return $sContent;
     }
 
@@ -130,47 +126,6 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $this->getItemBlock($iId);
     }
 
-    /*
-	TODO: Remove if it's not needed. Including HTML template.
-
-    public function getPhotoPopup($iEventId, $iStart)
-    {
-        $sStylePrefix = $this->_oConfig->getPrefix('style');
-        $sJsObject = $this->_oConfig->getJsObject('view');
-
-        $aPhotos = $this->_oDb->getPhotos($iEventId);
-        $iPhotos = count($aPhotos);
-
-        if(empty($aPhotos[$iStart]))
-            return MsgBox(_t('_Empty'));
-
-        $sPaginate = '';
-        if($iPhotos > 1) {
-            bx_import('BxTemplPaginate');
-            $oPaginate = new BxTemplPaginate(array(
-                'start' => $iStart,
-                'num' => (isset($aPhotos[$iStart + 1]) ? 2 : 1),
-                'per_page' => 1,
-                'on_change_page' => $sJsObject . '.showPhoto(this, ' . $iEventId . ', {start})'
-            ));
-
-            $sPaginate = $oPaginate->getSimplePaginate();
-        }
-
-        return $this->parseHtmlByName('attach_photo_popup.html', array(
-            'style_prefix' => $sStylePrefix,
-            'photo' => $this->_getPhoto($aPhotos[$iStart]),
-            'bx_if:show_paginate' => array(
-                'condition' => !empty($sPaginate),
-                'content' => array(
-                    'style_prefix' => $sStylePrefix,
-                    'paginate' => $sPaginate
-                )
-            )
-        ));
-    }
-    */
-
     public function getPost(&$aEvent, $aBrowseParams = array())
     {
         $aResult = $this->_oConfig->isSystem($aEvent['type'], $aEvent['action']) ? $this->_getSystemData($aEvent) : $this->_getCommonData($aEvent);
@@ -560,7 +515,8 @@ class BxTimelineTemplate extends BxDolModuleTemplate
                 'content' => $aTmplVarsMenuItemActions
             ),
             'comments' => $bBrowseItem ? $this->_getComments($aEvent['comments']) : '',
-            'votes' => $this->_getVotes($aEvent['votes'])
+            'votes' => $this->_getVotes($aEvent['votes']),
+            'view_image_popup' => $bBrowseItem ? $this->_getComments($aEvent['comments']) : '',
         );
 
         return $this->parseHtmlByName('item.html', $aTmplVars);
@@ -602,21 +558,15 @@ class BxTimelineTemplate extends BxDolModuleTemplate
         return $oVote->getJsScript();
     }
 
-    protected function _getPhoto($iPhotoId)
+    protected function _getImagePopup()
     {
-        $sStylePrefix = $this->_oConfig->getPrefix('style');
-        $sJsObject = $this->_oConfig->getJsObject('view');
-
-        bx_import('BxDolStorage');
-        $oStorage = BxDolStorage::getObjectInstance($this->_oConfig->getObject('storage'));
+        $sViewImagePopupId = $this->_oConfig->getHtmlIds('view', 'photo_popup');
+        $sViewImagePopupContent = $this->parseHtmlByName('popup_image.html', array(
+    		'image_url' => ''
+    	));
 
-        return $this->parsePageByName('bx_img.html', array(
-            'src' => $oStorage->getFileUrlById($iPhotoId),
-            'bx_repeat:attrs' => array(
-                array('key' => 'onclick', 'value' => $sJsObject . '.hidePhoto(this)'),
-                array('key' => 'class', 'value' => $sStylePrefix . '-attached-image')
-            ),
-        ));
+    	bx_import('BxTemplFunctions');
+    	return BxTemplFunctions::getInstance()->transBox($sViewImagePopupId, $sViewImagePopupContent, true);
     }
 
     protected function _getTmplVarsMenuItemManage(&$aEvent)
@@ -914,7 +864,7 @@ class BxTimelineTemplate extends BxDolModuleTemplate
                             'src' => $oTranscoder->getImageUrl($iPhotoId),
                             'src_orig' => $sPhotoSrcOrig,
                             'title' => '',
-                            'onclick' => $sJsObject . '.showPhoto(this, \'' . $sPhotoSrcOrig . '\')' //TODO: Remove if it's not needed. $sJsObject . '.showPhoto(this, ' . $aEvent['id'] . ', ' . $iPhotoIndex . ')'
+                            'onclick' => $sJsObject . '.showPhoto(this, \'' . $sPhotoSrcOrig . '\')'
                         );
                     }
                 }

+ 0 - 27
modules/boonex/timeline/js/view.js

@@ -107,33 +107,6 @@ BxTimelineView.prototype.showPhoto = function(oLink, sUrl) {
 	$('#' + this._aHtmlIds['photo_popup']).dolPopupImage(sUrl);
 };
 
-/*
-TODO: Remove if it's not needed.
-
-BxTimelineView.prototype.showPhoto = function(oLink, iEventId, iStart) {
-    var oData = this._getDefaultData();
-    oData['event_id'] = iEventId;
-    oData['start'] = iStart;
-
-    var sId = this._aHtmlIds['photo_popup'] + iEventId;
-    if($('#' + sId).length != 0)
-    	$('#' + sId).bx_anim('hide', this._sAnimationEffect, 0, function() {
-    		$(this).remove();    		
-    	});
-
-    $(window).dolPopupAjax({
-		id: {value: this._aHtmlIds['photo_popup'] + iEventId, force: true},
-		url: bx_append_url_params(this._sActionsUri + 'get_photo_popup/', oData)
-	});
-
-	return false;
-};
-
-BxTimelineView.prototype.hidePhoto = function(oLink) {
-	$(".bx-popup-applied:visible").dolPopupHide();
-};
-*/
-
 BxTimelineView.prototype.commentItem = function(oLink, sSystem, iId) {
 	var $this = this;
 

+ 0 - 6
modules/boonex/timeline/template/attach_photo_popup.html

@@ -1,6 +0,0 @@
-<div class="__style_prefix__-attach-photo-popup">
-	__photo__
-	<bx_if:show_paginate>
-	<div class="__style_prefix__-paginate bx-def-margin-top bx-clearfix">__paginate__</div>
-	</bx_if:show_paginate>
-</div>

+ 0 - 15
modules/boonex/timeline/template/css/view.css

@@ -120,21 +120,6 @@ div.bx-tl-shared div.bx-tl-content {
 div.bx-tl-item-actions {}
 
 
-/*--- View Image Style ---*/
-div.bx-tl-attach-photo-popup {}
-div.bx-tl-paginate div.bx-paginate {
-	position: relative;
-	float: right;
-}
-img.bx-tl-attached-image {
-	max-width: 640px;
-	max-width: 40rem;
-
-	max-height: 640px;
-	max-height: 40rem;
-}
-
-
 /*--- Empty Style ---*/
 div.bx-tl-empty div.bx-msg-box-container {
 	margin-top: 0px;

+ 1 - 0
modules/boonex/timeline/template/item.html

@@ -44,3 +44,4 @@
 		</div>
 	</div>
 </div>
+__view_image_popup__