mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:07 +01:00
Implement proposed filemanager mime type open handler based on user preferences
This commit is contained in:
parent
d934f33ea6
commit
8e0243294c
@ -1522,7 +1522,7 @@ var et2_link_string = (function(){ "use strict"; return expose(et2_valueWidget.e
|
||||
.appendTo(this.list)
|
||||
.addClass("et2_link loading")
|
||||
.click( function(e){
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var fe = egw_get_file_editor_prefered_mimes();
|
||||
if (self.options.expose_view && typeof _link_data.type !='undefined'
|
||||
&& _link_data.type.match(self.mime_regexp,'ig'))
|
||||
{
|
||||
|
@ -393,7 +393,7 @@ function expose (widget)
|
||||
return;
|
||||
}
|
||||
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var fe = egw_get_file_editor_prefered_mimes();
|
||||
var self=this;
|
||||
// If the media type is not supported do not bind the click handler
|
||||
if (!_value || typeof _value.mime != 'string' || (!_value.mime.match(mime_regex,'ig')
|
||||
|
@ -60,7 +60,7 @@ if (typeof window.console == 'undefined')
|
||||
|
||||
/**
|
||||
* Seperates all script tags from the given html code and returns the seperately
|
||||
*
|
||||
*
|
||||
* @param object _html object that the html code
|
||||
* from which the script should be seperated
|
||||
* The html code has to be stored in _html.html,
|
||||
@ -757,6 +757,24 @@ function addOption(id,label,value,do_onchange)
|
||||
}
|
||||
if (selectBox.onchange && do_onchange) selectBox.onchange();
|
||||
}
|
||||
|
||||
function egw_get_file_editor_prefered_mimes(_data, _params)
|
||||
{
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var ex_mimes = egw.preference('collab_excluded_mimes', 'filemanager');
|
||||
if (fe && fe.mime && ex_mimes)
|
||||
{
|
||||
ex_mimes = ex_mimes.split(',');
|
||||
for (var mime in fe.mime)
|
||||
{
|
||||
for (var i in ex_mimes)
|
||||
{
|
||||
if (ex_mimes[i] == mime) delete(fe.mime[mime]);
|
||||
}
|
||||
}
|
||||
}
|
||||
return fe && fe.mime?fe:null;
|
||||
}
|
||||
/**
|
||||
* Install click handlers for popup and multiple triggers of uiaccountselection
|
||||
*/
|
||||
|
@ -234,6 +234,7 @@ class filemanager_hooks
|
||||
'admin' => False,
|
||||
);
|
||||
}
|
||||
$editorLink = self::getEditorLink();
|
||||
|
||||
$settings += array (
|
||||
'sections.2' => array(
|
||||
@ -251,7 +252,15 @@ class filemanager_hooks
|
||||
'no_lang'=> true,
|
||||
'xmlrpc' => True,
|
||||
'admin' => False,
|
||||
)
|
||||
),
|
||||
'collab_excluded_mimes' => array(
|
||||
'type' => 'taglist',
|
||||
'label' => 'Excludes selected mime types',
|
||||
'help' => 'Excludes selected mime types from being opened by editor',
|
||||
'name' => 'collab_excluded_mimes',
|
||||
'values' => array_combine(array_keys($editorLink['mime']), array_keys($editorLink['mime'])),
|
||||
'default' => '',
|
||||
),
|
||||
);
|
||||
|
||||
return $settings;
|
||||
|
@ -783,7 +783,7 @@ app.classes.filemanager = AppJS.extend(
|
||||
var mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||
// try to get mime widget DOM node out of the row DOM
|
||||
var mime_dom = jQuery(_senders[0].iface.getDOMNode()).find("span#filemanager-index_\\$row");
|
||||
var fe = egw.link_get_registry('filemanager-editor');
|
||||
var fe = egw_get_file_editor_prefered_mimes();
|
||||
|
||||
// symlinks dont have mime 'http/unix-directory', but server marks all directories with class 'isDir'
|
||||
if (data.data.mime == 'httpd/unix-directory' || data.data['class'] && data.data['class'].split(/ +/).indexOf('isDir') != -1)
|
||||
@ -1288,7 +1288,8 @@ app.classes.filemanager = AppJS.extend(
|
||||
if (_senders.length>1) return false;
|
||||
var data = egw.dataGetUIDdata(_senders[0].id),
|
||||
mime = this.et2._inst.widgetContainer.getWidgetById('$row');
|
||||
|
||||
var fe = egw_get_file_editor_prefered_mimes();
|
||||
if (fe && fe.mime && !fe.mime[mime]) return false;
|
||||
return data.data.mime.match(mime.mime_odf_regex)?true:false;
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user