mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 00:29:38 +01:00
fixed javascript error in file select dialog (notable under FireFox) caused by calling event.preventDefault() without the event
This commit is contained in:
parent
4195633c82
commit
4ba2a0ba58
@ -279,9 +279,6 @@ class filemanager_select
|
|||||||
'name' => $name,
|
'name' => $name,
|
||||||
'path' => $path,
|
'path' => $path,
|
||||||
'mime' => $mime,
|
'mime' => $mime,
|
||||||
'onclick' => $is_dir ? "return app.filemanager.select_goto('".addslashes($path)."'".($et2?',widget':'').");" :
|
|
||||||
($content['mode'] != 'open-multiple' ? "return app.filemanager.select_show('".addslashes($name)."');" :
|
|
||||||
"return app.filemanager.select_toggle('".addslashes($name)."',widget);"),
|
|
||||||
);
|
);
|
||||||
if ($is_dir && $content['mode'] == 'open-multiple')
|
if ($is_dir && $content['mode'] == 'open-multiple')
|
||||||
{
|
{
|
||||||
|
@ -687,14 +687,18 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Functions for select dialog
|
* Row or filename in select-file dialog clicked
|
||||||
*
|
*
|
||||||
* @param {string} to
|
* @param {jQuery.event} event
|
||||||
* @param {et2_widget} widget
|
* @param {et2_widget} widget
|
||||||
*/
|
*/
|
||||||
select_goto: function(to,widget)
|
select_clicked: function(event, widget)
|
||||||
{
|
{
|
||||||
if (widget)
|
if (!widget || typeof widget.value != 'object')
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (widget.value.mime == 'httpd/unix-directory')
|
||||||
{
|
{
|
||||||
var path = null;
|
var path = null;
|
||||||
// Cannot do this, there are multiple widgets named path
|
// Cannot do this, there are multiple widgets named path
|
||||||
@ -704,36 +708,21 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
},null, et2_textbox);
|
},null, et2_textbox);
|
||||||
if(path)
|
if(path)
|
||||||
{
|
{
|
||||||
path.set_value(to);
|
path.set_value(widget.value.path);
|
||||||
path.getInstanceManager().postSubmit();
|
path.getInstanceManager().postSubmit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
else if (this.et2 && this.et2.getArrayMgr('content').getEntry('mode') != 'open-multiple')
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Select given file
|
|
||||||
*
|
|
||||||
* @param {string} file
|
|
||||||
*/
|
|
||||||
select_show: function(file)
|
|
||||||
{
|
{
|
||||||
var editfield = this.et2.getWidgetById('name');
|
var editfield = this.et2.getWidgetById('name');
|
||||||
if(editfield)
|
if(editfield)
|
||||||
{
|
{
|
||||||
editfield.set_value(file);
|
editfield.set_value(widget.value.name);
|
||||||
}
|
}
|
||||||
return false;
|
}
|
||||||
},
|
else
|
||||||
|
|
||||||
/**
|
|
||||||
* Change selection of given file
|
|
||||||
*
|
|
||||||
* @param {string} file
|
|
||||||
* @param {et2_widget} widget
|
|
||||||
*/
|
|
||||||
select_toggle: function(file,widget)
|
|
||||||
{
|
{
|
||||||
|
var file = widget.value.name;
|
||||||
widget.getParent().iterateOver(function(widget)
|
widget.getParent().iterateOver(function(widget)
|
||||||
{
|
{
|
||||||
if(widget.options.selected_value == file)
|
if(widget.options.selected_value == file)
|
||||||
@ -742,6 +731,7 @@ app.classes.filemanager = AppJS.extend(
|
|||||||
}
|
}
|
||||||
}, null, et2_checkbox);
|
}, null, et2_checkbox);
|
||||||
|
|
||||||
|
}
|
||||||
// Stop event or it will toggle back off
|
// Stop event or it will toggle back off
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
<rows>
|
<rows>
|
||||||
<row class="row">
|
<row class="row">
|
||||||
<vfs-mime align="center" id="$row" options="16" class="selectIcon"/>
|
<vfs-mime align="center" id="$row" options="16" class="selectIcon"/>
|
||||||
<vfs id="$row" onclick="$row_cont[onclick]"/>
|
<vfs id="$row" onclick="app.filemanager.select_clicked"/>
|
||||||
<checkbox align="right" id="selected[]" options=""$row_cont[name]""/>
|
<checkbox align="right" id="selected[]" options=""$row_cont[name]""/>
|
||||||
</row>
|
</row>
|
||||||
</rows>
|
</rows>
|
||||||
|
Loading…
Reference in New Issue
Block a user