mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-15 02:19:39 +01:00
Support background colors (& icon) in link search results
This commit is contained in:
parent
2bb8169ded
commit
63a8718dd8
@ -503,6 +503,15 @@ class etemplate_new extends etemplate_widget_template
|
|||||||
|
|
||||||
return $etemplate_old->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
|
return $etemplate_old->show($content,$sel_options,$readonlys,$cname,$show_c,$show_row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Avoid fatal error from addressbook
|
||||||
|
*/
|
||||||
|
public static function cats2color($cats)
|
||||||
|
{
|
||||||
|
trigger_error('Calling etemplate_old', E_USER_NOTICE);
|
||||||
|
return etemplate_old::cats2color($cats);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -394,6 +394,41 @@ var et2_link_entry = et2_inputWidget.extend({
|
|||||||
disabled: self.options.disabled
|
disabled: self.options.disabled
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Custom display (colors)
|
||||||
|
this.search.data("autocomplete")._renderItem = function(ul, item) {
|
||||||
|
var li = jQuery(document.createElement('li'))
|
||||||
|
.data("item.autocomplete", item);
|
||||||
|
var extra = {};
|
||||||
|
|
||||||
|
// Extra stuff
|
||||||
|
if(typeof item.label == 'object') {
|
||||||
|
extra = item.label;
|
||||||
|
item.label = extra.label ? extra.label : extra;
|
||||||
|
if(extra['style.backgroundColor'] || extra.color)
|
||||||
|
{
|
||||||
|
li.css('backgroundColor', extra.color ? extra.color : extra['style.backgroundColor']);
|
||||||
|
}
|
||||||
|
// Careful with this, some browsers may have trouble loading all at once, which can slow display
|
||||||
|
if(extra.icon)
|
||||||
|
{
|
||||||
|
var img = self.egw().image(extra.icon);
|
||||||
|
if(img)
|
||||||
|
{
|
||||||
|
jQuery(document.createElement("img"))
|
||||||
|
.attr("src", img)
|
||||||
|
.css("float", "right")
|
||||||
|
.appendTo(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal stuff
|
||||||
|
li.append(jQuery( "<a></a>" ).text( item.label ))
|
||||||
|
.appendTo(ul);
|
||||||
|
|
||||||
|
return li;
|
||||||
|
};
|
||||||
|
|
||||||
// Bind to enter key to start search early
|
// Bind to enter key to start search early
|
||||||
this.search.keydown(function(e) {
|
this.search.keydown(function(e) {
|
||||||
var keycode = (e.keyCode ? e.keyCode : e.which);
|
var keycode = (e.keyCode ? e.keyCode : e.which);
|
||||||
|
@ -490,7 +490,11 @@ var et2_selectAccount_ro = et2_link_string.extend([et2_IDetachedDOM], {
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_value: function(_value) {
|
set_value: function(_value) {
|
||||||
|
// Don't bother to lookup if it's not an array, or a number
|
||||||
|
if(typeof _value == 'object' || !isNaN(_value))
|
||||||
|
{
|
||||||
this._super.apply(this, arguments);
|
this._super.apply(this, arguments);
|
||||||
|
}
|
||||||
|
|
||||||
// Don't make it look like a link though
|
// Don't make it look like a link though
|
||||||
jQuery('li',this.list).removeClass("et2_link et2_link_string");
|
jQuery('li',this.list).removeClass("et2_link et2_link_string");
|
||||||
|
Loading…
Reference in New Issue
Block a user