Quellcode durchsuchen

#3932 - Allow pass external parameters in mention request

roman.lesnikov@gmail.com vor 4 Jahren
Ursprung
Commit
f877a3c0a5

+ 8 - 3
inc/js/editor.quill.js

@@ -196,9 +196,14 @@ function bx_editor_init(oEditor, oParams){
                 dataAttributes: ['id', 'value', 'denotationChar', 'link', 'target','disabled', 'dataProfileId'], 
                 listItemClass: 'bx-menu-item bx-def-color-bg-hl-hover',
                 source: function (searchTerm, renderList, mentionChar) {
-                  $.getJSON(oParams.root_url + 'searchExtended.php?action=get_mention', $.extend({}, {symbol: mentionChar, term: searchTerm}, oParams.query_params), function(data){
-                      renderList(data, searchTerm);
-                  });
+                    var aFlds = oParams.query_params['fi'].split(",");
+                    aFlds.forEach(fld => {
+                        oParams.query_params[fld] = $('#' + oParams.query_params['f'] + ' [name="' + fld + '"]').val()
+                    });
+                        
+                    $.getJSON(oParams.root_url + 'searchExtended.php?action=get_mention', $.extend({}, {symbol: mentionChar, term: searchTerm}, oParams.query_params), function(data){
+                        renderList(data, searchTerm);
+                    });
                 },
                 renderItem: function(item, searchTerm){
                     item.id = item.url;

+ 7 - 0
modules/base/general/classes/BxBaseModGeneralFormEntry.php

@@ -602,6 +602,13 @@ class BxBaseModGeneralFormEntry extends BxTemplFormView
         if (isset($this->_iContentId) && $this->_iContentId){
             $aQueryParams['cid'] = $this->_iContentId;
         }
+        $aQueryParams['fi'] = '';
+        
+        bx_alert('system', 'editor_query_params', 0, 0, array(
+            'form' => $this,
+            'override_result' => &$aQueryParams
+        ));
+        
         return $aQueryParams;
     }
 

+ 8 - 1
template/scripts/BxBaseCmtsForm.php

@@ -48,7 +48,14 @@ class BxBaseCmtsForm extends BxTemplFormView
         if (isset($this->aInputs['id'])){
             $aQueryParams['cid'] = $this->aInputs['id']['value'];
         }
-        $aQueryParams['m'] ='sys_cmts';
+        $aQueryParams['m'] = 'sys_cmts';
+        $aQueryParams['fi'] = '';
+        
+        bx_alert('system', 'editor_query_params', 0, 0, array(
+            'form' => $this,
+            'override_result' => &$aQueryParams
+        ));
+        
         return $aQueryParams;
     }
     

+ 8 - 1
template/scripts/BxBaseFormView.php

@@ -1370,7 +1370,14 @@ BLAH;
     
     function getHtmlEditorQueryParams($aInput)
     {
-        return ['i' => $aInput['name'], 'f' => $this->aFormAttrs['id']];
+        $aQueryParams = ['i' => $aInput['name'], 'f' => $this->aFormAttrs['id'], 'fi' => ''];
+        
+        bx_alert('system', 'editor_query_params', 0, 0, array(
+            'form' => $this,
+            'override_result' => &$aQueryParams
+        ));
+        
+        return $aQueryParams;
     }
 
     /**