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

@ -113,7 +113,7 @@ class filemanager_select
$sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')';
}
}
list($content['mime']) = each($sel_options['mime']);
error_log(array2string($content['options-mime']));
}
@ -218,7 +218,7 @@ class filemanager_select
}
common::egw_exit();
}
$sel_options['mime'] = $content['options-mime'];
}
elseif(isset($content['apps']))
@ -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,44 +708,30 @@ 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)
{
var editfield = this.et2.getWidgetById('name');
if(editfield)
else if (this.et2 && this.et2.getArrayMgr('content').getEntry('mode') != 'open-multiple')
{
editfield.set_value(file);
}
return false;
},
/**
* Change selection of given file
*
* @param {string} file
* @param {et2_widget} widget
*/
select_toggle: function(file,widget)
{
widget.getParent().iterateOver(function(widget)
{
if(widget.options.selected_value == file)
var editfield = this.et2.getWidgetById('name');
if(editfield)
{
widget.set_value(widget.get_value() == file ? widget.options.unselected_value : file);
editfield.set_value(widget.value.name);
}
}, null, et2_checkbox);
}
else
{
var file = widget.value.name;
widget.getParent().iterateOver(function(widget)
{
if(widget.options.selected_value == file)
{
widget.set_value(widget.get_value() == file ? widget.options.unselected_value : file);
}
}, 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>