mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-24 23:58:54 +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
@ -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')
|
||||
{
|
||||
|
@ -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();
|
||||
|
@ -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=""$row_cont[name]""/>
|
||||
</row>
|
||||
</rows>
|
||||
|
Loading…
Reference in New Issue
Block a user