fixed javascript error in file select dialog (notable under FireFox) caused by calling event.preventDefault() without the event

This commit is contained in:
Ralf Becker 2014-02-10 18:37:51 +00:00
parent 4195633c82
commit 4ba2a0ba58
3 changed files with 28 additions and 41 deletions

View File

@ -279,9 +279,6 @@ class filemanager_select
'name' => $name,
'path' => $path,
'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')
{

View File

@ -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
*/
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;
// Cannot do this, there are multiple widgets named path
@ -704,36 +708,21 @@ app.classes.filemanager = AppJS.extend(
},null, et2_textbox);
if(path)
{
path.set_value(to);
path.set_value(widget.value.path);
path.getInstanceManager().postSubmit();
}
}
return false;
},
/**
* Select given file
*
* @param {string} file
*/
select_show: function(file)
else if (this.et2 && this.et2.getArrayMgr('content').getEntry('mode') != 'open-multiple')
{
var editfield = this.et2.getWidgetById('name');
if(editfield)
{
editfield.set_value(file);
editfield.set_value(widget.value.name);
}
return false;
},
/**
* Change selection of given file
*
* @param {string} file
* @param {et2_widget} widget
*/
select_toggle: function(file,widget)
}
else
{
var file = widget.value.name;
widget.getParent().iterateOver(function(widget)
{
if(widget.options.selected_value == file)
@ -742,6 +731,7 @@ app.classes.filemanager = AppJS.extend(
}
}, null, et2_checkbox);
}
// Stop event or it will toggle back off
event.preventDefault();
event.stopPropagation();

View File

@ -49,7 +49,7 @@
<rows>
<row class="row">
<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="&quot;$row_cont[name]&quot;"/>
</row>
</rows>