Explorar o código

#1 - Comments.
1. Experimental layout.
2. Image uploader.

AntonLV %!s(int64=13) %!d(string=hai) anos
pai
achega
ab616c6454

+ 9 - 0
inc/classes/BxDolCmts.php

@@ -584,6 +584,15 @@ class BxDolCmts extends BxDol
         if($this->_oQuery->removeComment ($this->getId(), $aCmt['cmt_id'], $aCmt['cmt_parent_id'])) {
         	$this->_triggerComment();
 
+        	bx_import('BxDolStorage');
+			$oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
+
+			$aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $aCmt['cmt_id']);
+			foreach($aImages as $aImage)
+				$oStorage->deleteFile($aImage['image_id']);
+
+        	$this->_oQuery->deleteImages($this->_aSystem['system_id'], $aCmt['cmt_id']);
+
 	        if($aCmt['cmt_author_id'] == $iCmtAuthorId)
 				$this->isRemoveAllowed(true);
 

+ 12 - 0
inc/classes/BxDolCmtsQuery.php

@@ -193,6 +193,18 @@ class BxDolCmtsQuery extends BxDolDb
 		return (int)$this->query($sQuery) > 0;
 	}
 
+    function getImages($iSystemId, $iCmtId)
+    {
+    	$sQuery = $this->prepare("SELECT * FROM `{$this->_sTableImages2Entries}` WHERE `system_id`=? AND `cmt_id`=?", $iSystemId, $iCmtId);
+    	return $this->getAll($sQuery);
+    }
+
+	function deleteImages($iSystemId, $iCmtId)
+	{
+		$sQuery = $this->prepare("DELETE FROM `{$this->_sTableImages2Entries}` WHERE `system_id`=? AND `cmt_id`=?", $iSystemId, $iCmtId);
+    	return $this->query($sQuery);
+	}
+
     function updateRepliesCount($iCmtId, $iCount)
     {
     	$sQuery = $this->prepare("UPDATE `{$this->_sTable}` SET `cmt_replies`=`cmt_replies`+? WHERE `cmt_id`=? LIMIT 1", $iCount, $iCmtId);

+ 65 - 49
inc/js/classes/BxDolCmts.js

@@ -61,9 +61,10 @@ BxDolCmts.prototype.cmtAfterPostSubmit = function (oCmtForm, oData)
 	if(oData && oData.id != undefined) {
 		var iCmtId = parseInt(oData.id);
         if(iCmtId > 0) {
-            $(oCmtForm).find(':input:not(:button,:submit,[type = hidden],[type = radio],[type = checkbox])').val('');
-            $(oCmtForm).find('.bx-form-warn').hide().html('');
             this._getCmt(oCmtForm, iCmtId);
+            this._getForm(undefined, parseInt(oData.parent_id), function(sForm) {
+            	oCmtForm.parents('.cmt-reply:first').hide().html($(sForm).html()).show();
+            });
         }
 
         return;
@@ -282,56 +283,42 @@ BxDolCmts.prototype.showMore = function(oLink)
 
 BxDolCmts.prototype.toggleReply = function(e, iCmtParentId)
 {
+	var $this = this;
 	var sParentId = this._sRootId + ' #cmt' + iCmtParentId;
-	var sReplyId = sParentId + ' > .cmt-reply';
 
-    if ($(sReplyId).length)
+	var sReplyId = sParentId + ' > .cmt-reply';
+    if ($(sReplyId).length) {
 		$(sReplyId).bx_anim('toggle', this._sAnimationEffect, this._iAnimationSpeed);
-    else {
-        var $this = this;
-        var oData = this._getDefaultActions();
-        oData['action'] = 'GetFormPost';
-        oData['CmtType'] = 'reply';
-        oData['CmtParent'] = iCmtParentId;
-        oData['CmtBrowse'] = this._sBrowseType;
-        oData['CmtDisplay'] = this._sDisplayType;
-
-        $this._loadingInContent(e, true);
-
-        jQuery.post (
-            this._sActionsUrl,
-            oData,
-            function (s) {
-                $this._loadingInContent(e, false);
-
-                var oForm = $(s).css('display', 'none');
-                var sFormClass = oForm.attr('class');
-                var oFormSibling = $(sParentId + ' > ul.cmts:first');
-                switch($this._sPostFormPosition) {
-                	case 'top':
-                		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-' + $this._sPostFormPosition);
-                		oFormSibling.before(oForm);
-                		break;
-
-                	case 'bottom':
-                		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-' + $this._sPostFormPosition);
-                		oFormSibling.after(oForm);
-                		break;
-
-                	case 'both':
-                		var oFormClone = oForm.clone();
-
-                		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-top');
-                		oFormSibling.before(oForm);
-
-                		oFormClone.addClass('cmt-reply-margin').addClass(sFormClass + '-bottom');
-                		oFormSibling.after(oFormClone);
-                		break;
-                }
-            	$(sParentId).children('.cmt-reply').bx_anim('toggle', $this._sAnimationEffect, $this._iAnimationSpeed);
-            }
-        );
+		return;
     }
+
+	this._getForm(e, iCmtParentId, function(sForm) {
+		var oForm = $(sForm).css('display', 'none');
+        var sFormClass = oForm.attr('class');
+        var oFormSibling = $(sParentId + ' > ul.cmts:first');
+        switch($this._sPostFormPosition) {
+        	case 'top':
+        		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-' + $this._sPostFormPosition);
+        		oFormSibling.before(oForm);
+        		break;
+
+        	case 'bottom':
+        		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-' + $this._sPostFormPosition);
+        		oFormSibling.after(oForm);
+        		break;
+
+        	case 'both':
+        		var oFormClone = oForm.clone();
+
+        		oForm.addClass('cmt-reply-margin').addClass(sFormClass + '-top');
+        		oFormSibling.before(oForm);
+
+        		oFormClone.addClass('cmt-reply-margin').addClass(sFormClass + '-bottom');
+        		oFormSibling.after(oFormClone);
+        		break;
+        }
+    	$(sParentId).children('.cmt-reply').bx_anim('toggle', $this._sAnimationEffect, $this._iAnimationSpeed);    		
+	});
 };
 
 BxDolCmts.prototype.toggleManagePopup = function(oLink, iCmtId) {
@@ -360,7 +347,7 @@ BxDolCmts.prototype.togglePlusedByPopup = function(oLink, iCmtId) {
     	return;
     }
 
-	$this._loadingInContent(oLink, true);
+	this._loadingInContent(oLink, true);
 
 	jQuery.post (
 		this._sActionsUrl,
@@ -451,6 +438,35 @@ BxDolCmts.prototype._getCmts = function (e, iCmtParentId, iStart, iPerView, sBro
     );
 };
 
+BxDolCmts.prototype._getForm = function (e, iCmtParentId, onLoad)
+{
+	var $this = this;
+
+    var oData = this._getDefaultActions();
+    oData['action'] = 'GetFormPost';
+    oData['CmtType'] = 'reply';
+    oData['CmtParent'] = iCmtParentId;
+    oData['CmtBrowse'] = this._sBrowseType;
+    oData['CmtDisplay'] = this._sDisplayType;
+
+    
+    
+    if(e)
+    	this._loadingInContent(e, true);
+
+    jQuery.post (
+        this._sActionsUrl,
+        oData,
+        function (s) {
+        	if(e)
+        		$this._loadingInContent(e, false);
+
+            if(typeof onLoad == 'function')
+    			onLoad(s);
+        }
+    );	
+};
+
 BxDolCmts.prototype._cmtsAppend = function(sIdTo, sContent)
 {
 	$(sIdTo).append($(sContent).hide()).children(':hidden').bx_anim('show', this._sAnimationEffect, this._iAnimationSpeed);

+ 3 - 1
install/index.php

@@ -124,6 +124,7 @@ define('BX_DOL_INT_MAX', 2147483647);
 define('BX_DOL_TRANSCODER_OBJ_ICON_APPLE', 'sys_icon_apple');
 define('BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK', 'sys_icon_facebook');
 define('BX_DOL_TRANSCODER_OBJ_ICON_FAVICON', 'sys_icon_favicon');
+define('BX_DOL_TRANSCODER_OBJ_IMAGE_PREVIEW_CMTS', 'sys_images_cmts_preview');
 
 //--- Module types ---//
 define('BX_DOL_MODULE_TYPE_MODULE', 'module');
@@ -1203,7 +1204,8 @@ function genMainDolphinPage() {
     $aTranscoders = array(
         BX_DOL_TRANSCODER_OBJ_ICON_APPLE, 
         BX_DOL_TRANSCODER_OBJ_ICON_FACEBOOK, 
-        BX_DOL_TRANSCODER_OBJ_ICON_FAVICON
+        BX_DOL_TRANSCODER_OBJ_ICON_FAVICON,
+        BX_DOL_TRANSCODER_OBJ_IMAGE_PREVIEW_CMTS
     );
 
     bx_import('BxDolImageTranscoder');

+ 25 - 3
install/sql/v70.sql

@@ -1006,6 +1006,27 @@ CREATE TABLE IF NOT EXISTS `sys_images_cmts` (
 
 -- --------------------------------------------------------
 
+--
+-- Table structure for table `sys_images_cmts_preview`
+--
+CREATE TABLE IF NOT EXISTS `sys_images_cmts_preview` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `profile_id` int(10) unsigned NOT NULL,
+  `remote_id` varchar(255) NOT NULL,
+  `path` varchar(255) NOT NULL,
+  `file_name` varchar(255) NOT NULL,
+  `mime_type` varchar(128) NOT NULL,
+  `ext` varchar(32) NOT NULL,
+  `size` int(11) NOT NULL,
+  `added` int(11) NOT NULL,
+  `modified` int(11) NOT NULL,
+  `private` int(11) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `remote_id` (`remote_id`)
+);
+
+-- --------------------------------------------------------
+
 --
 -- Table structure for table `sys_images_cmts2entries`
 --
@@ -1301,7 +1322,8 @@ CREATE TABLE IF NOT EXISTS `sys_objects_storage` (
 
 INSERT INTO `sys_objects_storage` (`object`, `engine`, `params`, `token_life`, `cache_control`, `levels`, `table_files`, `ext_mode`, `ext_allow`, `ext_deny`, `quota_size`, `current_size`, `quota_number`, `current_number`, `max_file_size`, `ts`) VALUES
 ('sys_images', 'Local', '', 360, 2592000, 0, 'sys_images', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
-('sys_images_cmts', 'Local', '', 360, 2592000, 3, 'sys_images_cmts', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
+('sys_images_cmts', 'Local', '', 360, 2592000, 3, 'sys_images_cmts', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0),
+('sys_images_cmts_preview', 'Local', '', 360, 2592000, 3, 'sys_images_cmts_preview', 'allow-deny', 'jpg,jpeg,jpe,gif,png', '', 0, 0, 0, 0, 0, 0);
 
 CREATE TABLE IF NOT EXISTS `sys_storage_user_quotas` (
   `profile_id` int(11) NOT NULL,
@@ -2469,7 +2491,7 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('sys_comment_edit', 'cmt_id', 2147483647, 1, 4),
 ('sys_comment_edit', 'cmt_parent_id', 2147483647, 1, 5),
 ('sys_comment_edit', 'cmt_text', 2147483647, 1, 6),
-('sys_comment_edit', 'cmt_image', 2147483647, 1, 7),
+('sys_comment_edit', 'cmt_image', 2147483647, 0, 7),
 ('sys_comment_edit', 'cmt_submit', 2147483647, 1, 8);
 
 
@@ -3172,7 +3194,7 @@ INSERT INTO `sys_objects_transcoder_images` (`object`, `storage_object`, `source
 ('sys_icon_apple', 'sys_images', 'Storage', 'a:1:{s:6:"object";s:10:"sys_images";}', 'no', '0', '0', '0'),
 ('sys_icon_facebook', 'sys_images', 'Storage', 'a:1:{s:6:"object";s:10:"sys_images";}', 'no', '0', '0', '0'),
 ('sys_icon_favicon', 'sys_images', 'Storage', 'a:1:{s:6:"object";s:10:"sys_images";}', 'no', '0', '0', '0'),
-('sys_images_cmts_preview', 'sys_images_cmts', 'Storage', 'a:1:{s:6:"object";s:15:"sys_images_cmts";}', 'no', '1', '2592000', '0');
+('sys_images_cmts_preview', 'sys_images_cmts_preview', 'Storage', 'a:1:{s:6:"object";s:15:"sys_images_cmts";}', 'no', '1', '2592000', '0');
 
 
 CREATE TABLE IF NOT EXISTS `sys_transcoder_images_files` (

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

@@ -1180,6 +1180,7 @@ Please click "Continue" below to navigate to the home page of the site.]]></stri
 	<string name="_cmt_browse_connection"><![CDATA[Connection]]></string>
 	<string name="_cmt_page_view_header"><![CDATA[Comment to {0}]]></string>
 	<string name="_cmt_page_view_title"><![CDATA[Comment to <a href="{0}">{1}</a>]]></string>
+	<string name="_cmt_block_comments_title"><![CDATA[Comments ({0})]]></string>
 	<string name="_cmt_err_cannot_perform_action"><![CDATA[Cannot perform action. Please report.]]></string>
 	<string name="_Reply_to_this_comment"><![CDATA[Reply]]></string>
 	<string name="_Add Your Comment"><![CDATA[Comment]]></string>

+ 1 - 1
samples/comments.php

@@ -83,7 +83,7 @@ function PageCompMainCode() {
 	if(!$oCmts->isEnabled())
 		return '';
 
-    return DesignBoxContent("Comments",  $oCmts->getCommentsBlock(), BX_DB_PADDING_DEF);
+    return $oCmts->getCommentsBlock();
 }
 
 /** @} */

+ 9 - 0
template/comment.html

@@ -30,6 +30,15 @@
 			<div class="__style_prefix__-body bx-def-margin-thd-topbottom">
 				__text__<bx_if:show_more><span class="__style_prefix__-body-see-more">... <a class="bx-def-font-small" href="javascript:void(0)" onclick="__js_object__.showMore(this);"><bx_text:_see_more /></a></span><span style="display:none;"> __text_more__</span></bx_if:show_more>
 			</div>
+			<bx_if:show_attached>
+				<div class="__style_prefix__-attached bx-def-margin-thd-topbottom bx-clearfix">
+					<bx_repeat:attached>
+						<div class="__style_prefix__-attached-preview bx-def-thumb bx-def-margin-sec-left-auto">
+							<img src="__image__" />
+						</div>
+					</bx_repeat:attached>
+				</div>
+			</bx_if:show_attached>
 		</div>
 	</div>
 	__actions__

+ 0 - 1
template/comments_block.html

@@ -1,6 +1,5 @@
 <div id="cmts-box-__system__-__id__">
 	__post_form_top__
-	__controls__
 	<div id="cmt0" class="cmts bx-def-margin-top">
 		<ul class="cmts">
 			<bx_if:show_empty>

+ 5 - 10
template/comments_controls.html

@@ -1,10 +1,5 @@
-<div class="__style_prefix__-browse bx-def-margin-top-auto bx-clearfix">
-	<div class="__style_prefix__-browse-left bx-def-font-h3">__comments_count__</div>
-	<div class="__style_prefix__-browse-right bx-def-font-small bx-clearfix">
-		__display_switcher__
-		<bx_if:is_divider>
-			<div class="__style_prefix__-browse-type-div">|</div>
-		</bx_if:is_divider>
-		__browse_switcher__
-	</div>
-</div>
+__display_switcher__
+<bx_if:is_divider>
+	<div class="bx-def-hr bx-def-margin-sec-topbottom"></div>
+</bx_if:is_divider>
+__browse_switcher__

+ 8 - 29
template/css/cmts.css

@@ -40,35 +40,6 @@
        color: #333333;
     }
 
-	/*--- Browse Styles ---*/
-    div.cmt-browse {
-
-    }
-    div.cmt-browse-left {
-		position: relative;
-    	float: left;
-    }
-    div.cmt-browse-right {
-    	position: relative;
-    	float: right;
-	}
-	div.cmt-browse-right ul.bx-menu-inter  {
-		float: left;
-	}
-
-	div.cmt-browse-item,
-	div.cmt-browse-item-div,
-	div.cmt-browse-type-div {
-		position: relative;
-		float: left;
-	}
-	div.cmt-browse-item-div {
-		padding: 0px 3px;
-	}
-	div.cmt-browse-type-div {
-		padding: 0px 5px;
-	}
-
 	/*--- More ---*/
     li.cmt-more {}
 	li.cmt-more-root {}
@@ -181,6 +152,14 @@
 		font-weight: bold;
     }
 
+    div.cmt-attached-preview {
+		position: relative;
+    	float: left;
+
+    	width: 100px;
+    	height: 100px;
+    } 
+
     /*--- Comment Actions ---*/
 	div.cmt-actions {
 		position: relative;

+ 2 - 1
template/css/menu.css

@@ -343,7 +343,8 @@ ul.bx-menu-floating-blocks {
 
 
 /* --------------- interactive block menu */
-ul.bx-menu-inter {
+ul.bx-menu-inter,
+ul.bx-menu-inter-vert {
 	padding:0;
     margin:0;
 	list-style:none;

+ 18 - 0
template/menu_interactive_vertical.html

@@ -0,0 +1,18 @@
+<ul id="bx-menu-inter-__id__" class="bx-menu-inter-vert bx-menu-object-__object__">
+	<bx_repeat:menu_items>
+	    <li id="__id__-act" class="bx-menu-inter-act __class_wrp_act__">
+	        <span class="__class__">__title__</span>
+	    </li>
+	    <li id="__id__-pas" class="bx-menu-inter-pas __class_wrp_pas__">
+	        <a id="__id__" class="__class__" href="__link__" target="__target__" onclick="__onclick__">__title__</a>
+	    </li>
+	</bx_repeat:menu_items>
+</ul>
+<script type="text/javascript" language="javascript">
+    $(document).ready(function() {
+    	$('#bx-menu-inter-__id__').find('a').bind('click', function() {
+    		var sId = $(this).attr('id');
+			$(this).parent().siblings('.bx-menu-inter-act:visible').hide().siblings('.bx-menu-inter-pas:hidden').show().siblings('#' + sId + '-pas:visible').hide().siblings('#' + sId + '-act:hidden').show();
+    	});
+    });
+</script>

+ 56 - 30
template/scripts/BxBaseCmtsView.php

@@ -85,12 +85,13 @@ class BxBaseCmtsView extends BxDolCmts {
     /**
      * get full comments block with initializations
      */
-    function getCommentsBlock($iParentId = 0, $iVParentId = 0) {
+    function getCommentsBlock($iParentId = 0, $iVParentId = 0, $bInDesignbox = true) {
     	$aBp = array('parent_id' => $iParentId, 'vparent_id' => $iVParentId);
 
     	$sCmts = $this->getComments($aBp);
 
-    	return BxDolTemplate::getInstance()->parseHtmlByName('comments_block.html', array(
+    	$sCaption = _t('_cmt_block_comments_title', $this->_oQuery->getCommentsCount($this->_iId));
+    	$sContent = BxDolTemplate::getInstance()->parseHtmlByName('comments_block.html', array(
     		'system' => $this->_sSystem,
     		'id' => $this->getId(),
     		'bx_if:show_empty' => array(
@@ -99,12 +100,13 @@ class BxBaseCmtsView extends BxDolCmts {
 					'style_prefix' => $this->_sStylePrefix
 				)
 			),
-			'controls' => $this->_getControlsBox(),
     		'comments' => $sCmts,
     		'post_form_top' => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP)),
 			'post_form_bottom'  => $this->getFormBoxPost($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM)),
     		'script' => $this->getScript()
     	));
+
+    	return $bInDesignbox ? DesignBoxContent($sCaption, $sContent, BX_DB_PADDING_DEF, $this->_getControlsBox()) : $sContent;
     }
 
     /**
@@ -205,7 +207,20 @@ class BxBaseCmtsView extends BxDolCmts {
         		'par_cmt_author' => $sParAuthorName
         	);
 		}
- 
+
+		$aTmplImages = array();
+		$aImages = $this->_oQuery->getImages($this->_aSystem['system_id'], $r['cmt_id']);
+		if(!empty($aImages) && is_array($aImages)) {
+			bx_import('BxDolImageTranscoder');
+        	$oTranscoder = BxDolImageTranscoder::getObjectInstance($this->_sTranscoderPreview);
+
+        	foreach($aImages as $aImage)
+        		$aTmplImages[] = array(
+        			'style_prefix' => $this->_sStylePrefix,
+        			'image' => $oTranscoder->getImageUrl($aImage['image_id'])
+        		);
+		}
+
 		$sReplies = '';
 		if((int)$r['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED)
 			$sReplies = $this->getComments(array('parent_id' => $r['cmt_id'], 'vparent_id' => $r['cmt_id'], 'type' => $aBp['type']), $aDp);
@@ -264,6 +279,13 @@ class BxBaseCmtsView extends BxDolCmts {
         			'text_more' => $sTextMore
         		)
         	),
+        	'bx_if:show_attached' => array(
+        		'condition' => !empty($aTmplImages),
+        		'content' => array(
+        			'style_prefix' => $this->_sStylePrefix,
+        			'bx_repeat:attached' => $aTmplImages
+        		)
+        	),
         	'actions' => $sActions,
         	'replies' =>  $sReplies
         ));
@@ -333,7 +355,7 @@ class BxBaseCmtsView extends BxDolCmts {
 			);
 
     		bx_import('BxTemplMenuInteractive');
-			$oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive.html', 'menu_id'=> $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks));
+			$oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks));
 			$oMenu->setSelected('', $this->_sSystem . '-' . $this->_sDisplayType);
         	$sDisplay = $oMenu->getCode();
     	}
@@ -349,15 +371,12 @@ class BxBaseCmtsView extends BxDolCmts {
     		);
 
     		bx_import('BxTemplMenuInteractive');
-			$oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive.html', 'menu_id'=> $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks));
+			$oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive_vertical.html', 'menu_id'=> $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks));
 			$oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseType);
         	$sBrowse = $oMenu->getCode();
     	}
-    	
+
     	return $oTemplate->parseHtmlByName('comments_controls.html', array(
-			'js_object' => $this->_sJsObjName,
-			'style_prefix' => $this->_sStylePrefix,
-			'comments_count' => _t('_N_comments', $this->_oQuery->getCommentsCount($this->_iId)),
     		'display_switcher' => $bDisplay ? $sDisplay : '',
     		'bx_if:is_divider' => array(
     			'condition' => $bDisplay && $bBrowse,
@@ -527,9 +546,14 @@ class BxBaseCmtsView extends BxDolCmts {
 			$iCmtId = (int)$oForm->insert(array('cmt_vparent_id' => $iCmtVisualParentId, 'cmt_object_id' => $this->_iId, 'cmt_author_id' => $iCmtAuthorId, 'cmt_level' => $iLevel, 'cmt_time' => mktime()));
 			if($iCmtId != 0) {
 				$aImages = $oForm->getCleanValue('cmt_image');
-				if(!empty($aImages) || is_array($aImages))
-					foreach($aImages as $iImage)
-						$this->_oQuery->saveImages($this->_aSystem['system_id'], $iCmtId, $iImage);
+				if(!empty($aImages) || is_array($aImages)) {
+					bx_import('BxDolStorage');
+					$oStorage = BxDolStorage::getObjectInstance($this->_sStorageObject);
+
+					foreach($aImages as $iImageId)
+						if($this->_oQuery->saveImages($this->_aSystem['system_id'], $iCmtId, $iImageId))
+							$oStorage->afterUploadCleanup($iImageId, $iCmtAuthorId);
+				}
 
 				if($iCmtParentId) 
         			$this->_oQuery->updateRepliesCount($iCmtParentId, 1);
@@ -542,7 +566,7 @@ class BxBaseCmtsView extends BxDolCmts {
 		        $oZ = new BxDolAlerts($this->_sSystem, 'commentPost', $this->getId(), $iCmtAuthorId, array('comment_id' => $iCmtId, 'comment_author_id' => $iCmtAuthorId));
 		        $oZ->alert();
 
-		        return array('id' => $iCmtId);
+		        return array('id' => $iCmtId, 'parent_id' => $iCmtParentId);
 			}
 
 			return array('msg' => _t('_cmt_err_cannot_perform_action'));
@@ -603,22 +627,24 @@ class BxBaseCmtsView extends BxDolCmts {
         $oForm->aInputs['id']['value'] = $this->_iId;
         $oForm->aInputs['action']['value'] = 'Submit' . $sActionCap . 'Form';
 
-        $aFormNested = array(
-        	'params' =>array(
-        		'nested_form_template' => 'comments_uploader_nfw.html'
-        	),
-	        'inputs' => array(),
-	    );
-
-	    bx_import('BxDolFormNested');
-	    $oFormNested = new BxDolFormNested('cmt_image', $aFormNested, 'cmt_submit');
-
-        $oForm->aInputs['cmt_image']['storage_object'] = $this->_sStorageObject;
-        $oForm->aInputs['cmt_image']['images_transcoder'] = $this->_sTranscoderPreview;
-        $oForm->aInputs['cmt_image']['uploaders'] = array('sys_simple_cmts');
-        $oForm->aInputs['cmt_image']['upload_buttons_titles'] = array('Simple' => 'camera');
-        $oForm->aInputs['cmt_image']['multiple'] = true;
-        $oForm->aInputs['cmt_image']['ghost_template'] = $oFormNested;
+	    if(isset($oForm->aInputs['cmt_image'])) {
+	    	$aFormNested = array(
+	        	'params' =>array(
+	        		'nested_form_template' => 'comments_uploader_nfw.html'
+	        	),
+		        'inputs' => array(),
+		    );
+
+		    bx_import('BxDolFormNested');
+		    $oFormNested = new BxDolFormNested('cmt_image', $aFormNested, 'cmt_submit');
+	
+	        $oForm->aInputs['cmt_image']['storage_object'] = $this->_sStorageObject;
+	        $oForm->aInputs['cmt_image']['images_transcoder'] = $this->_sTranscoderPreview;
+	        $oForm->aInputs['cmt_image']['uploaders'] = array('sys_simple_cmts');
+	        $oForm->aInputs['cmt_image']['upload_buttons_titles'] = array('Simple' => 'camera');
+	        $oForm->aInputs['cmt_image']['multiple'] = true;
+	        $oForm->aInputs['cmt_image']['ghost_template'] = $oFormNested;
+	    }
 
         if(isset($oForm->aInputs['cmt_text'])) {
         	$iCmtTextMin = (int)$this->_aSystem['chars_post_min'];

+ 1 - 1
template/scripts/BxBaseFunctions.php

@@ -546,7 +546,7 @@ EOF;
 
                 bx_import('BxTemplMenu');
                 $oMenu = BxTemplMenu::getObjectInstance($mixedMenu);
-                $sMenu = $oMenu ? $oMenu->getCode () : '';
+                $sMenu = $oMenu ? $oMenu->getCode () : $mixedMenu;
 
             } elseif (is_object($mixedMenu) && is_a($mixedMenu, 'BxTemplMenu')) {