pass event as 1. parameter to click handlers to be able to call preventDefault() or stopPropagation()

This commit is contained in:
Ralf Becker 2014-02-10 18:25:02 +00:00
parent 795cfe3e6f
commit 4195633c82
2 changed files with 60 additions and 49 deletions

View File

@ -202,7 +202,7 @@ var et2_baseWidget = et2_DOMWidget.extend(et2_IAligned,
if (this.node)
{
$j(this.node).bind("click.et2_baseWidget", this, function(e) {
return e.data.click.call(e.data, this);
return e.data.click.call(e.data, e, this);
});
if (typeof this.onclick == 'function') $j(this.node).addClass('et2_clickable');
}

View File

@ -116,7 +116,7 @@ var et2_vfs = et2_valueWidget.extend([et2_IDetachedDOM],
if(!self.onclick) {
e.data.egw.open(e.data.data, "file");
}
else if (self.click())
else if (self.click(e))
{
e.data.egw.open(e.data.data, "file");
}
@ -127,6 +127,8 @@ var et2_vfs = et2_valueWidget.extend([et2_IDetachedDOM],
/**
* Code for implementing et2_IDetachedDOM (data grid)
*
* @param {array} _attrs array of attribute-names to push further names onto
*/
getDetachedAttributes: function(_attrs)
{
@ -299,6 +301,8 @@ var et2_vfsMime = et2_valueWidget.extend([et2_IDetachedDOM],
/**
* Implementation of "et2_IDetachedDOM" for fast viewing in gridview
* Override to add needed attributes
*
* @param {array} _attrs array of attribute-names to push further names onto
*/
getDetachedAttributes: function(_attrs) {
_attrs.push("value", "class");
@ -330,7 +334,7 @@ et2_register_widget(et2_vfsMime, ["vfs-mime"]);
var et2_vfsSize = et2_description.extend({
attributes: {
"value": {
"type": "integer",
"type": "integer"
}
},
/**
@ -422,6 +426,8 @@ var et2_vfsMode = et2_description.extend({
* Get text for file stuff
* Result will be like -rwxr--r--. First char is type, then read, write, execute (or other bits) for
* user, group, world
*
* @param {number} _value vfs mode
*/
text_mode: function(_value) {
var text = [];
@ -618,7 +624,7 @@ var et2_vfsSelect = et2_inputWidget.extend(
this.button = $j(document.createElement("img"))
.attr("src", this.egw().image("filemanager/navbar"))
.attr("title", this.egw().lang("Select file(s) from VFS"))
.addClass("et2_button et2_button_icon")
.addClass("et2_button et2_button_icon");
this.setDOMNode(egw.userData.apps.filemanager ? this.button[0]:document.createElement('span'));
},
@ -679,6 +685,7 @@ var et2_vfsSelect = et2_inputWidget.extend(
* Set the dialog's mode.
* Valid options are in et2_vfsSelect.modes
*
* @param {string} mode 'open', 'open-multiple', 'saveas' or 'select-dir'
*/
set_mode: function(mode) {
// Check mode
@ -692,6 +699,8 @@ var et2_vfsSelect = et2_inputWidget.extend(
/**
* Set the label on the dialog's OK button.
*
* @param {string} label
*/
set_button_label: function(label)
{
@ -700,6 +709,8 @@ var et2_vfsSelect = et2_inputWidget.extend(
/**
* Set the ID passed to the server side callback
*
* @param {string} id
*/
set_method_id: function(id) {
this.options.method_id = id;