Przeglądaj źródła

Ticket #4023 - Pasting Twitter links in editor: Point №1.

AntonLV 4 lat temu
rodzic
commit
c4bdea777e

+ 1 - 0
install/sql/system.sql

@@ -529,6 +529,7 @@ INSERT INTO `sys_options`(`category_id`, `name`, `caption`, `value`, `type`, `ex
 
 
 (@iCategoryId, 'sys_metatags_hashtags_max', '_adm_stg_cpt_option_sys_metatags_hashtags_max', '9', 'digit', '', '', '', 30),
 (@iCategoryId, 'sys_metatags_hashtags_max', '_adm_stg_cpt_option_sys_metatags_hashtags_max', '9', 'digit', '', '', '', 30),
 (@iCategoryId, 'sys_metatags_mentions_max', '_adm_stg_cpt_option_sys_metatags_mentions_max', '9', 'digit', '', '', '', 31),
 (@iCategoryId, 'sys_metatags_mentions_max', '_adm_stg_cpt_option_sys_metatags_mentions_max', '9', 'digit', '', '', '', 31),
+(@iCategoryId, 'sys_attach_links_max', '_adm_stg_cpt_option_sys_attach_links_max', '0', 'digit', '', '', '', 35),
 
 
 (@iCategoryId, 'sys_profile_bot', '_adm_stg_cpt_option_sys_profile_bot', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:23:"get_options_profile_bot";s:5:"class";s:13:"TemplServices";}', '', '', 40),
 (@iCategoryId, 'sys_profile_bot', '_adm_stg_cpt_option_sys_profile_bot', '', 'select', 'a:3:{s:6:"module";s:6:"system";s:6:"method";s:23:"get_options_profile_bot";s:5:"class";s:13:"TemplServices";}', '', '', 40),
 
 

+ 1 - 0
modules/base/text/classes/BxBaseModTextConfig.php

@@ -59,6 +59,7 @@ class BxBaseModTextConfig extends BxBaseModGeneralConfig
             'PARAM_POLL_ANONYMOUS_VOTING' => true,
             'PARAM_POLL_ANONYMOUS_VOTING' => true,
             'PARAM_MULTICAT_ENABLED' => false,
             'PARAM_MULTICAT_ENABLED' => false,
             'PARAM_LINKS_ENABLED' => false,
             'PARAM_LINKS_ENABLED' => false,
+            'PARAM_LINKS_LIMIT' => 'sys_attach_links_max',
 
 
             // objects
             // objects
             'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
             'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',

+ 7 - 1
modules/base/text/classes/BxBaseModTextFormEntry.php

@@ -49,7 +49,13 @@ class BxBaseModTextFormEntry extends BxBaseModGeneralFormEntry
             $sInclude .= $this->_oModule->_oTemplate->addCss(array('links.css'), $bDynamicMode);
             $sInclude .= $this->_oModule->_oTemplate->addCss(array('links.css'), $bDynamicMode);
             $sInclude .= $this->_oModule->_oTemplate->addJs(array('modules/base/text/js/|links.js', 'links.js'), $bDynamicMode);
             $sInclude .= $this->_oModule->_oTemplate->addJs(array('modules/base/text/js/|links.js', 'links.js'), $bDynamicMode);
 
 
-            $sResult .= ($bDynamicMode ? $sInclude : '') . $this->_oModule->_oTemplate->getJsCode('links', ['sFormId' => $this->getId(), 'iContentId' => (int)$this->_iContentId,]);
+            $sResult .= ($bDynamicMode ? $sInclude : '') . $this->_oModule->_oTemplate->getJsCode('links', [
+                'sFormId' => $this->getId(), 
+                'iContentId' => (int)$this->_iContentId,
+                'iLimitAttachLinks' => (int)getParam($CNF['PARAM_LINKS_LIMIT']),
+                'sLimitAttachLinksErr' => bx_js_string(_t('_sys_txt_err_attach_links')),
+                'oAttachedLinks' => []
+            ]);
         }  
         }  
 
 
     	return $sResult;
     	return $sResult;

+ 2 - 0
modules/base/text/js/links.js

@@ -17,6 +17,8 @@ function BxBaseModTextLinks(oOptions) {
     this._sFormId = oOptions.sFormId == undefined ? 0 : oOptions.sFormId;
     this._sFormId = oOptions.sFormId == undefined ? 0 : oOptions.sFormId;
     this._sEditorId = oOptions.sEditorId == undefined ? '' : oOptions.sEditorId;
     this._sEditorId = oOptions.sEditorId == undefined ? '' : oOptions.sEditorId;
     this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
     this._aHtmlIds = oOptions.aHtmlIds == undefined ? {} : oOptions.aHtmlIds;
+    this._iLimitAttachLinks = oOptions.iLimitAttachLinks == undefined ? 0 : oOptions.iLimitAttachLinks;
+    this._sLimitAttachLinksErr = oOptions.sLimitAttachLinksErr == undefined ? '' : oOptions.sLimitAttachLinksErr;
     this._oAttachedLinks = oOptions.oAttachedLinks == undefined ? {} : oOptions.oAttachedLinks;
     this._oAttachedLinks = oOptions.oAttachedLinks == undefined ? {} : oOptions.oAttachedLinks;
     
     
     this._sPregTag = "(<([^>]+bx-tag[^>]+)>)";
     this._sPregTag = "(<([^>]+bx-tag[^>]+)>)";

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

@@ -1681,6 +1681,7 @@
     <string name="_adm_stg_cpt_option_sys_quill_toolbar_full"><![CDATA[Quill buttons for full editor]]></string>
     <string name="_adm_stg_cpt_option_sys_quill_toolbar_full"><![CDATA[Quill buttons for full editor]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_hashtags_max"><![CDATA[Max number of hashtags per post]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_hashtags_max"><![CDATA[Max number of hashtags per post]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_mentions_max"><![CDATA[Max number of mentions per post]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_mentions_max"><![CDATA[Max number of mentions per post]]></string>
+    <string name="_adm_stg_cpt_option_sys_attach_links_max"><![CDATA[Max number of attached links per post (0 - no limit)]]></string>
     <string name="_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy"><![CDATA[Hide post to context for modules in Privacy field]]></string>
     <string name="_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy"><![CDATA[Hide post to context for modules in Privacy field]]></string>
     <string name="_adm_stg_cpt_option_sys_search_keyword_min_len"><![CDATA[Keyword min length in site search]]></string>
     <string name="_adm_stg_cpt_option_sys_search_keyword_min_len"><![CDATA[Keyword min length in site search]]></string>
     <string name="_adm_stg_cpt_option_sys_profile_bot"><![CDATA[System bot profile]]></string>
     <string name="_adm_stg_cpt_option_sys_profile_bot"><![CDATA[System bot profile]]></string>
@@ -3538,6 +3539,7 @@ If it is not enabled then please consider implement this optimization, since it
     <string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Please enter verification code from the SMS.]]></string>
     <string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Please enter verification code from the SMS.]]></string>
 
 
     <string name="_sys_txt_create_post_placeholder"><![CDATA[Write here, {0}...]]></string>
     <string name="_sys_txt_create_post_placeholder"><![CDATA[Write here, {0}...]]></string>
+    <string name="_sys_txt_err_attach_links"><![CDATA[The maximum allowed number of attached links has been reached.]]></string>
 
 
     <string name="_sys_txt_current_picture"><![CDATA[Current Picture]]></string>
     <string name="_sys_txt_current_picture"><![CDATA[Current Picture]]></string>
     <string name="_sys_txt_data_successfully_submitted"><![CDATA[Done]]></string>
     <string name="_sys_txt_data_successfully_submitted"><![CDATA[Done]]></string>

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

@@ -1661,6 +1661,7 @@
     <string name="_adm_stg_cpt_option_sys_quill_toolbar_full"><![CDATA[Quill buttons кнопки для полного редактора]]></string>
     <string name="_adm_stg_cpt_option_sys_quill_toolbar_full"><![CDATA[Quill buttons кнопки для полного редактора]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_hashtags_max"><![CDATA[Максимальное число хэш-тагов в одной публикации]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_hashtags_max"><![CDATA[Максимальное число хэш-тагов в одной публикации]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_mentions_max"><![CDATA[Максимальное число упоминаний кого-либо в одной публикации]]></string>
     <string name="_adm_stg_cpt_option_sys_metatags_mentions_max"><![CDATA[Максимальное число упоминаний кого-либо в одной публикации]]></string>
+    <string name="_adm_stg_cpt_option_sys_attach_links_max"><![CDATA[Максимальное число присоединенных ссылок к одной публикации (0 - без ограничений)]]></string>
     <string name="_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy"><![CDATA[Скрыть из поля "Конфиденциальность" возможность добавления контента в контекст модулей]]></string>
     <string name="_adm_stg_cpt_option_sys_hide_post_to_context_for_privacy"><![CDATA[Скрыть из поля "Конфиденциальность" возможность добавления контента в контекст модулей]]></string>
     <string name="_adm_stg_cpt_option_sys_search_keyword_min_len"><![CDATA[Минимальная длина слова в поиске по сайту]]></string>
     <string name="_adm_stg_cpt_option_sys_search_keyword_min_len"><![CDATA[Минимальная длина слова в поиске по сайту]]></string>
     <string name="_adm_stg_cpt_option_sys_profile_bot"><![CDATA[Профиль системного бота]]></string>
     <string name="_adm_stg_cpt_option_sys_profile_bot"><![CDATA[Профиль системного бота]]></string>
@@ -3464,6 +3465,7 @@
     <string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Пожалуйста, введите код проверки из SMS]]></string>
     <string name="_sys_txt_confirm_phone_set_phone_desc_phone_confirmation"><![CDATA[Пожалуйста, введите код проверки из SMS]]></string>
 
 
     <string name="_sys_txt_create_post_placeholder"><![CDATA[Напишите здесь, {0}]]></string>
     <string name="_sys_txt_create_post_placeholder"><![CDATA[Напишите здесь, {0}]]></string>
+    <string name="_sys_txt_err_attach_links"><![CDATA[Достигнуто максимально допустимое количество прикрепленных ссылок.]]></string>
 
 
     <string name="_sys_txt_current_picture"><![CDATA[Текущая картинка]]></string>
     <string name="_sys_txt_current_picture"><![CDATA[Текущая картинка]]></string>
     <string name="_sys_txt_data_successfully_submitted"><![CDATA[Выполнено]]></string>
     <string name="_sys_txt_data_successfully_submitted"><![CDATA[Выполнено]]></string>