mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
- Fix taglist account infinite loop when looking for accounts (using link title system instead of data source)
- Don't search server side if there's no query string
This commit is contained in:
parent
f337d45b29
commit
b0db615411
@ -43,11 +43,16 @@ class etemplate_widget_taglist extends etemplate_widget
|
||||
$type = $_REQUEST['type'];
|
||||
$query = $_REQUEST['query'];
|
||||
$options = array();
|
||||
$links = array();
|
||||
if ($type == "account")
|
||||
{
|
||||
// Only search if a query was provided - don't search for all accounts
|
||||
if($query)
|
||||
{
|
||||
$options['account_type'] = $_REQUEST['account_type'];
|
||||
$links = accounts::link_query($query, $options);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$links = egw_link::query($app, $query, $options);
|
||||
|
@ -254,11 +254,14 @@ var et2_taglist = et2_selectbox.extend(
|
||||
{
|
||||
source = this.egw().ajaxUrl(source);
|
||||
}
|
||||
if(this.options.autocomplete_url != source)
|
||||
{
|
||||
this.options.autocomplete_url = source;
|
||||
|
||||
// do NOT set an empty autocomplete_url, magicsuggest would use page url instead!
|
||||
if(this.taglist == null || !source) return;
|
||||
this.taglist.setData(source);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
@ -303,14 +306,14 @@ var et2_taglist = et2_selectbox.extend(
|
||||
{
|
||||
// alread in correct format
|
||||
}
|
||||
else if (typeof this.options.select_options[v] == 'undefined')
|
||||
else if (this.options.select_options && typeof this.options.select_options[v] == 'undefined')
|
||||
{
|
||||
values[i] = {
|
||||
id: v,
|
||||
label: v
|
||||
};
|
||||
}
|
||||
else
|
||||
else(this.options.select_options)
|
||||
{
|
||||
if (typeof values[i].id == 'undefined')
|
||||
{
|
||||
@ -363,6 +366,9 @@ var et2_taglist_account = et2_taglist.extend(
|
||||
{
|
||||
this._super.apply(this, arguments);
|
||||
|
||||
// Counter to prevent infinite looping while fetching account names
|
||||
this.deferred_loading = 0;
|
||||
|
||||
this.options.autocomplete_params.type = "account";
|
||||
},
|
||||
|
||||
@ -410,16 +416,22 @@ var et2_taglist_account = et2_taglist.extend(
|
||||
label: label
|
||||
};
|
||||
}
|
||||
else // call set_value again, after result has arrived from server
|
||||
else if (!this.deferred_loading) // call set_value again, after result has arrived from server
|
||||
{
|
||||
this.deferred_loading++;
|
||||
this.egw().link_title('home-accounts', v, function(label) {
|
||||
this.deferred_loading--;
|
||||
if (label) this.set_value(values);
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Don't proceed if waiting for labels
|
||||
if(this.deferred_loading <=0)
|
||||
{
|
||||
this._super.call(this, values);
|
||||
}
|
||||
}
|
||||
});
|
||||
et2_register_widget(et2_taglist_account, ["taglist-account"]);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user