Selaa lähdekoodia

Tickets #2764 - points 1-4.

AntonLV 6 vuotta sitten
vanhempi
sitoutus
20a55fc809

+ 3 - 2
inc/js/classes/BxDolCmts.js

@@ -186,10 +186,11 @@ BxDolCmts.prototype.cmtAfterEditSubmit = function (oCmtForm, oData, onComplete)
         fContinue();
 };
 
-BxDolCmts.prototype.cmtEdit = function(oLink, iCmtId) {
+BxDolCmts.prototype.cmtEdit = function(oLink, iCmtId, bHideMenu) {
     var $this = this;
 
-    $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide();
+    if(bHideMenu == undefined || bHideMenu)
+        $(oLink).parents('.bx-popup-applied:first:visible').dolPopupHide();
 
     var sContentId = this._sRootId + ' #cmt' + iCmtId + ' .cmt-cont-cnt:first';
     if ($(sContentId + ' > form').length) {

+ 9 - 1
inc/js/functions.js

@@ -712,7 +712,15 @@ function bx_get_notes(oSource,  sModule, iContentId, oOptions, oVars) {
     var oOptions = oOptions || {};
     var oVars = oVars || {};
 
-    var oOptions = $.extend({}, $.fn.dolPopupDefaultOptions, {id: sModule + '_notes_' + iContentId, url: bx_append_url_params('modules/?r=' + sModule + '/get_notes/', $.extend({content_id: iContentId}, oVars))}, oOptions);
+    var oOptions = $.extend({}, $.fn.dolPopupDefaultOptions, {
+        id: sModule + '_notes_' + iContentId, 
+        url: bx_append_url_params('modules/?r=' + sModule + '/get_notes/', $.extend({content_id: iContentId}, oVars)),
+        closeOnOuterClick: false,
+        removeOnClose: true,
+        onBeforeShow: function(oPopup) {
+            $(oPopup).find('.bx-popup-close-wrapper').removeClass('bx-def-media-desktop-hide bx-def-media-tablet-hide');
+        }
+    }, oOptions);
 
     $(window).dolPopupAjax(oOptions);
 }

+ 5 - 1
install/sql/system.sql

@@ -3227,6 +3227,8 @@ INSERT INTO `sys_form_inputs` (`object`, `module`, `name`, `value`, `values`, `c
 ('sys_comment', 'system', 'cmt_text', '', '', 0, 'textarea', '_sys_form_comment_input_caption_system_cmt_text', '', '', 0, 0, 3, 'a:1:{s:12:"autocomplete";s:3:"off";}', '', '', 'Length', 'a:2:{s:3:"min";i:1;s:3:"max";i:5000;}', '_Please enter n1-n2 characters', 'XssHtml', '', 1, 0),
 ('sys_comment', 'system', 'cmt_anonymous', '', '', 0, 'switcher', '_sys_form_input_sys_anonymous', '_sys_form_input_anonymous', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
 ('sys_comment', 'system', 'cmt_image', 'a:1:{i:0;s:15:"sys_cmts_simple";}', 'a:1:{s:15:"sys_cmts_simple";s:26:"_sys_uploader_simple_title";}', 0, 'files', '_sys_form_comment_input_caption_system_cmt_image', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 1, 0),
+('sys_comment', 'system', 'cmt_controls', '', 'cmt_submit,cmt_cancel', 0, 'input_set', '', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
+('sys_comment', 'system', 'cmt_cancel', '_sys_form_comment_input_cancel', '', 0, 'button', '_sys_form_comment_input_caption_system_cmt_cancel', '', '', 0, 0, 0, 'a:1:{s:5:"class";s:22:"bx-def-margin-sec-left";}', '', '', '', '', '', '', '', 0, 0),
 ('sys_comment', 'system', 'cmt_submit', '_sys_form_comment_input_submit', '', 0, 'submit', '_sys_form_comment_input_caption_system_cmt_submit', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
 
 ('sys_review', 'system', 'sys', '', '', 0, 'hidden', '_sys_form_review_input_caption_system_sys', '', '', 0, 0, 0, '', '', '', '', '', '', '', '', 0, 0),
@@ -3372,7 +3374,9 @@ INSERT INTO `sys_form_display_inputs` (`display_name`, `input_name`, `visible_fo
 ('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_submit', 2147483647, 1, 8),
+('sys_comment_edit', 'controls', 2147483647, 1, 8),
+('sys_comment_edit', 'cmt_cancel', 2147483647, 1, 9),
+('sys_comment_edit', 'cmt_submit', 2147483647, 1, 10),
 
 ('sys_review_post', 'sys', 2147483647, 1, 1),
 ('sys_review_post', 'id', 2147483647, 1, 2),

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

@@ -2150,6 +2150,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_form_comment_input_caption_cmt_text"><![CDATA[Text]]></string>
 	<string name="_sys_form_comment_input_caption_system_action"><![CDATA[Action]]></string>
         <string name="_sys_form_comment_input_caption_system_cmt_author_id"><![CDATA[Author]]></string>
+        <string name="_sys_form_comment_input_caption_system_cmt_cancel"><![CDATA[Cancel]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_id"><![CDATA[Comment ID]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_image"><![CDATA[Image]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_parent_id"><![CDATA[Parent ID]]></string>
@@ -2157,6 +2158,7 @@ If it is not enabled then please consider implement this optimization, since it
 	<string name="_sys_form_comment_input_caption_system_cmt_text"><![CDATA[Text]]></string>
 	<string name="_sys_form_comment_input_caption_system_id"><![CDATA[Object ID]]></string>
 	<string name="_sys_form_comment_input_caption_system_sys"><![CDATA[Object Type]]></string>
+        <string name="_sys_form_comment_input_cancel"><![CDATA[Cancel]]></string>
 	<string name="_sys_form_comment_input_submit"><![CDATA[Post]]></string>
 	<string name="_sys_form_confirm_email"><![CDATA[Email Confirmation]]></string>
 	<string name="_sys_form_confirm_email_input_caption_system_code"><![CDATA[Verification Code]]></string>

+ 2 - 0
modules/boonex/russian/data/langs/system/ru.xml

@@ -2139,6 +2139,7 @@
 	<string name="_sys_form_comment_input_caption_cmt_text"><![CDATA[Текст]]></string>
 	<string name="_sys_form_comment_input_caption_system_action"><![CDATA[Действие]]></string>
         <string name="_sys_form_comment_input_caption_system_cmt_author_id"><![CDATA[Автор]]></string>
+        <string name="_sys_form_comment_input_caption_system_cmt_cancel"><![CDATA[Отменить]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_id"><![CDATA[Комментировать ID]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_image"><![CDATA[Изображение]]></string>
 	<string name="_sys_form_comment_input_caption_system_cmt_parent_id"><![CDATA[Родительский ID]]></string>
@@ -2146,6 +2147,7 @@
 	<string name="_sys_form_comment_input_caption_system_cmt_text"><![CDATA[Текст]]></string>
 	<string name="_sys_form_comment_input_caption_system_id"><![CDATA[ID объекта]]></string>
 	<string name="_sys_form_comment_input_caption_system_sys"><![CDATA[Тип объекта]]></string>
+        <string name="_sys_form_comment_input_cancel"><![CDATA[Отменить]]></string>
 	<string name="_sys_form_comment_input_submit"><![CDATA[Отправить]]></string>
 	<string name="_sys_form_confirm_email"><![CDATA[Подтверждение email-а]]></string>
 	<string name="_sys_form_confirm_email_input_caption_system_code"><![CDATA[Код верификации]]></string>

+ 1 - 2
template/css/cmts.css

@@ -79,8 +79,7 @@
 		font-size: 3.75rem;
     }
     div.cmt-info {
-    	position: realtive;
-    	overflow: hidden;
+    	position: relative;
     }
     div.cmt-blink-plate {
         position: absolute;

+ 11 - 0
template/scripts/BxBaseCmts.php

@@ -1092,6 +1092,17 @@ class BxBaseCmts extends BxDolCmts
             $oForm->aInputs['cmt_text']['checker']['error'] = _t('_Please enter n1-n2 characters', $iCmtTextMin, $iCmtTextMax);
         }
 
+        if($sAction == BX_CMT_ACTION_EDIT && isset($oForm->aInputs['cmt_controls']))
+            foreach($oForm->aInputs['cmt_controls'] as $mixedKey => $mixedValue) {
+                if(!is_numeric($mixedKey) || empty($mixedValue['name']) || $mixedValue['name'] != 'cmt_cancel')
+                    continue;
+
+                if(!isset($oForm->aInputs['cmt_controls'][$mixedKey]['attrs']))
+                    $oForm->aInputs['cmt_controls'][$mixedKey]['attrs'] = array();
+
+                $oForm->aInputs['cmt_controls'][$mixedKey]['attrs']['onclick'] = $this->_sJsObjName . '.cmtEdit(this, ' . $iId . ', false)';
+            }
+
         return $oForm;
     }