From edf6e169967566fca0c0e2c6689767bfdcf2501e Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Tue, 26 Sep 2017 16:57:45 +0200 Subject: [PATCH] * Addressbook: Add searching feature for distribution list filter --- addressbook/inc/class.addressbook_ui.inc.php | 1 + api/js/etemplate/et2_extension_nextmatch.js | 29 +++++++++++--------- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/addressbook/inc/class.addressbook_ui.inc.php b/addressbook/inc/class.addressbook_ui.inc.php index 17a2eebc8b..cfdae71b8c 100644 --- a/addressbook/inc/class.addressbook_ui.inc.php +++ b/addressbook/inc/class.addressbook_ui.inc.php @@ -243,6 +243,7 @@ class addressbook_ui extends addressbook_bo /* old negative list 'default_cols' => '!cat_id,contact_created_contact_modified,distribution_list,contact_id,owner,room',*/ 'filter2_onchange' => "return app.addressbook.filter2_onchange();", + 'filter2_tags' => true, 'manual' => $do_email ? ' ' : false, // space for the manual icon //'actions' => $this->get_actions(), // set on each request, as it depends on some filters 'row_id' => 'id', diff --git a/api/js/etemplate/et2_extension_nextmatch.js b/api/js/etemplate/et2_extension_nextmatch.js index 40179d5148..70f88c5b84 100644 --- a/api/js/etemplate/et2_extension_nextmatch.js +++ b/api/js/etemplate/et2_extension_nextmatch.js @@ -2487,7 +2487,12 @@ var et2_nextmatch_header_bar = (function(){ "use strict"; return et2_DOMWidget.e // Add category if(!settings.no_cat) { if (typeof settings.cat_id_label == 'undefined') settings.cat_id_label = ''; - this.category = this._build_select('cat_id', settings.cat_is_select ? 'select' : 'select-cat', settings.cat_id, settings.cat_is_select !== true); + this.category = this._build_select('cat_id', settings.cat_is_select ? + 'select' : 'select-cat', settings.cat_id, settings.cat_is_select !== true, { + multiple: false, + tags: true, + class: "select-cat" + }); } // Filter 1 @@ -2497,7 +2502,12 @@ var et2_nextmatch_header_bar = (function(){ "use strict"; return et2_DOMWidget.e // Filter 2 if(!settings.no_filter2) { - this.filter2 = this._build_select('filter2', 'select', settings.filter2, settings.filter2_no_lang); + this.filter2 = this._build_select('filter2', 'select', settings.filter2, + settings.filter2_no_lang, { + multiple: false, + tags: settings.filter2_tags, + class: "select-cat" + }); } // Other stuff @@ -2639,14 +2649,15 @@ var et2_nextmatch_header_bar = (function(){ "use strict"; return et2_DOMWidget.e * @param {string} type * @param {string} value * @param {string} lang + * @param {object} extra */ - _build_select: function(name, type, value, lang) { - var widget_options = { + _build_select: function(name, type, value, lang, extra) { + var widget_options = jQuery.extend({ "id": name, "label": this.nextmatch.options.settings[name+"_label"], "no_lang": lang, "disabled": this.nextmatch.options['no_'+name] - }; + }, extra); // Set select options // Check in content for options- @@ -2681,14 +2692,6 @@ var et2_nextmatch_header_bar = (function(){ "use strict"; return et2_DOMWidget.e this.egw().debug('warn', 'Nextmatch filter options in a weird place - "%s". Should be in sel_options[%s].',row_id,name); } } - if (name == 'cat_id') - { - jQuery.extend(widget_options, { - multiple: false, - tags: true, - class: "select-cat" - }); - } // Legacy: Add in 'All' option for cat_id, if not provided. if(name == 'cat_id' && options != null && (typeof options[''] == 'undefined' && typeof options[0] != 'undefined' && options[0].value != '')) {