Hi,
recently encountered that the images in et2 do not support the onclick
event at the moment. This is needed, e.g. for addressbook image
uploading. I enabled it by doing so:
+++ etemplate/js/et2_widget_image.js (working copy)
@@ -54,19 +54,28 @@
"name": "Label",
"type": "string",
"description": "Label for image"
- }
+ },
+ "onclick": {
+ "name": "onclick",
+ "type": "string",
+ "description": "JS code which gets executed when the image is clicked"
+ },
},
legacyOptions: ["href", "extra_link_target", "imagemap",
"extra_link_popup", "id"],
init: function() {
this._super.apply(this, arguments);
// Create the image or a/image tag
this.image = $j(document.createElement("img"));
if (this.options.label)
{
this.image.attr("alt", this.options.label).attr("title",
this.options.label);
}
+ if(this.options.onclick)
+ {
+ this.image.attr('onclick', this.options.onclick);
+ }
if (this.options.href)
{
this.image.addClass('et2_clickable');
Is this the right way? I saw a "click()" method in the base widget which
executes the "onclick()" method for the widget if present. Seems to me
that the plan for clicking a widget is another one than just setting the
onclick attribute like I did it now.
Thanks.
Bye
Christian
|