mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-25 16:19:00 +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.')';
|
$sel_options['mime'][$key] = lang('%1 files',strtoupper($value)).' ('.$key.')';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list($content['mime']) = each($sel_options['mime']);
|
list($content['mime']) = each($sel_options['mime']);
|
||||||
error_log(array2string($content['options-mime']));
|
error_log(array2string($content['options-mime']));
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ class filemanager_select
|
|||||||
}
|
}
|
||||||
common::egw_exit();
|
common::egw_exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
$sel_options['mime'] = $content['options-mime'];
|
$sel_options['mime'] = $content['options-mime'];
|
||||||
}
|
}
|
||||||
elseif(isset($content['apps']))
|
elseif(isset($content['apps']))
|
||||||
@ -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,44 +708,30 @@ 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');
|
|
||||||
if(editfield)
|
|
||||||
{
|
{
|
||||||
editfield.set_value(file);
|
var editfield = this.et2.getWidgetById('name');
|
||||||
}
|
if(editfield)
|
||||||
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)
|
|
||||||
{
|
{
|
||||||
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
|
// 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