mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 12:39:25 +01:00
implemented a default_src attribute, which get used if src is not found in image-cache and fixed not working detached label attribute
This commit is contained in:
parent
f2b01edbc3
commit
6d7e64037b
@ -31,6 +31,11 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM],
|
|||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Displayed image"
|
"description": "Displayed image"
|
||||||
},
|
},
|
||||||
|
default_src: {
|
||||||
|
name: "Default image",
|
||||||
|
type: "string",
|
||||||
|
description: "Image to use if src is not found"
|
||||||
|
},
|
||||||
"href": {
|
"href": {
|
||||||
"name": "Link Target",
|
"name": "Link Target",
|
||||||
"type": "string",
|
"type": "string",
|
||||||
@ -120,7 +125,7 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM],
|
|||||||
},
|
},
|
||||||
|
|
||||||
set_label: function(_value) {
|
set_label: function(_value) {
|
||||||
if(_value == this.options.label) return;
|
if(_value == this.options.label && _value == this.image.attr('title')) return;
|
||||||
this.options.label = _value;
|
this.options.label = _value;
|
||||||
// label is NOT the alt attribute in eTemplate, but the title/tooltip
|
// label is NOT the alt attribute in eTemplate, but the title/tooltip
|
||||||
this.image.attr("alt", _value).attr("title", _value);
|
this.image.attr("alt", _value).attr("title", _value);
|
||||||
@ -150,10 +155,16 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM],
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set image src
|
||||||
|
*
|
||||||
|
* @param {string} _value image, app/image or url
|
||||||
|
* @return {boolean} true if image was found, false if not (image is either not displayed or default_src is used)
|
||||||
|
*/
|
||||||
set_src: function(_value) {
|
set_src: function(_value) {
|
||||||
if(!this.isInTree())
|
if(!this.isInTree())
|
||||||
{
|
{
|
||||||
@ -174,17 +185,27 @@ var et2_image = et2_baseWidget.extend([et2_IDetachedDOM],
|
|||||||
this.image.attr('src', _value).show();
|
this.image.attr('src', _value).show();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
src = null;
|
||||||
|
if (this.options.default_src)
|
||||||
|
{
|
||||||
|
src = this.egw().image(this.options.default_src);
|
||||||
|
}
|
||||||
|
if (src)
|
||||||
|
{
|
||||||
|
this.image.attr("src", src).show();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.image.css("display","none");
|
this.image.css("display","none");
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
|
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
|
||||||
|
*
|
||||||
|
* @param {array} _attrs
|
||||||
*/
|
*/
|
||||||
|
|
||||||
getDetachedAttributes: function(_attrs) {
|
getDetachedAttributes: function(_attrs) {
|
||||||
_attrs.push("src", "label", "href");
|
_attrs.push("src", "label", "href");
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user