using egw.image(), thought there are some problems:

- src attribute get never translated: fixed
- label is in etemplate not the alt attribute, it is a title / tooltip (probably ok as alt too)
- egw.image should be called with appname part of template
- if image is not found, etemplate should render an empty widget, not a broken one
This commit is contained in:
Ralf Becker 2011-08-31 06:29:51 +00:00
parent 1e7b17203f
commit 499726cb23

View File

@ -26,8 +26,7 @@ var et2_image = et2_baseWidget.extend({
"src": { "src": {
"name": "Image", "name": "Image",
"type": "string", "type": "string",
"description": "Displayed image", "description": "Displayed image"
"translate": "!no_lang"
}, },
"link": { "link": {
}, },
@ -57,13 +56,14 @@ var et2_image = et2_baseWidget.extend({
set_label: function(_value) { set_label: function(_value) {
if(_value == this.options.label) return; if(_value == this.options.label) return;
this.options.label = _value; this.options.label = _value;
// label is NOT the alt attribute in eTemplate, but the title/tooltip
this.image.attr("alt", _value); this.image.attr("alt", _value);
}, },
set_src: function(_value) { set_src: function(_value) {
console.log("IMAGE ", _value);
this.options.src = _value; this.options.src = _value;
this.image.attr("src", _value); // using current app (default) is not exactly right, it should be the app of the template, eg. "addressbook" for "addressbook.edit"
this.image.attr("src", egw.image(_value, egw_appName) || _value);
} }
}); });