forked from extern/egroupware
Implement editor link handler for registered filemanager editors
This commit is contained in:
parent
6a3a944828
commit
0e06fe0d64
@ -1898,8 +1898,10 @@ var et2_link_list = (function(){ "use strict"; return et2_link_string.extend(
|
|||||||
if (_link_data && (typeof _link_data.download_url != 'undefined' || _link_data.app !='egw-data'))
|
if (_link_data && (typeof _link_data.download_url != 'undefined' || _link_data.app !='egw-data'))
|
||||||
{
|
{
|
||||||
$td.click( function(){
|
$td.click( function(){
|
||||||
|
var fe_mime = egw.link_get_registry('filemanager-editor','mime');
|
||||||
// Check if the link entry is mime with media type, in order to open it in expose view
|
// Check if the link entry is mime with media type, in order to open it in expose view
|
||||||
if (typeof _link_data.type != 'undefined' && _link_data.type.match(self.mime_regexp,'ig'))
|
if (typeof _link_data.type != 'undefined' &&
|
||||||
|
(_link_data.type.match(self.mime_regexp,'ig') || (fe_mime && fe_mime[_link_data.type])))
|
||||||
{
|
{
|
||||||
var $vfs_img_node = jQuery(this).parent().find('.vfsMimeIcon');
|
var $vfs_img_node = jQuery(this).parent().find('.vfsMimeIcon');
|
||||||
if ($vfs_img_node.length > 0) $vfs_img_node.click();
|
if ($vfs_img_node.length > 0) $vfs_img_node.click();
|
||||||
|
@ -393,10 +393,11 @@ function expose (widget)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var fe = egw.link_get_registry('filemanager-editor');
|
||||||
var self=this;
|
var self=this;
|
||||||
// If the media type is not supported do not bind the click handler
|
// 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') && !_value.mime.match(mime_odf_regex,'ig')) || typeof _value.download_url == 'undefined')
|
if (!_value || typeof _value.mime != 'string' || (!_value.mime.match(mime_regex,'ig')
|
||||||
|
&& (!fe || fe.mime && !fe.mime[_value.mime])) || typeof _value.download_url == 'undefined')
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -410,9 +411,12 @@ function expose (widget)
|
|||||||
{
|
{
|
||||||
self._init_blueimp_gallery(event, _value);
|
self._init_blueimp_gallery(event, _value);
|
||||||
}
|
}
|
||||||
else if(_value.mime.match(mime_odf_regex,'ig'))
|
else if(fe && fe.mime && fe.edit && fe.mime[_value.mime])
|
||||||
{
|
{
|
||||||
self._init_odf_editor (event, _value);
|
egw.open_link(egw.link('/index.php', {
|
||||||
|
menuaction: fe.edit.menuaction,
|
||||||
|
path: _value.path
|
||||||
|
}), '', fe.edit_popup);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
event.stopImmediatePropagation();
|
event.stopImmediatePropagation();
|
||||||
@ -616,20 +620,5 @@ function expose (widget)
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
expose_onclosed: function (event){},
|
expose_onclosed: function (event){},
|
||||||
|
|
||||||
/**
|
|
||||||
* Initialise odf editor handler for expose mime type handling
|
|
||||||
*
|
|
||||||
* @param {type} _event
|
|
||||||
* @param {type} _value
|
|
||||||
* @returns {undefined}
|
|
||||||
*/
|
|
||||||
_init_odf_editor: function (_event, _value)
|
|
||||||
{
|
|
||||||
egw.open_link(egw.link('/index.php', {
|
|
||||||
menuaction: 'filemanager.filemanager_ui.editor',
|
|
||||||
path: decodeURIComponent(_value.download_url)
|
|
||||||
}), '', egw.link_get_registry('filemanager','view_popup'));
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -280,10 +280,41 @@ class filemanager_hooks
|
|||||||
'mime_url' => ''
|
'mime_url' => ''
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
'additional' => array(
|
||||||
|
'filemanager-editor' => self::getEditorLink()
|
||||||
|
),
|
||||||
'merge' => true,
|
'merge' => true,
|
||||||
'entry' => 'File',
|
'entry' => 'File',
|
||||||
'entries' => 'Files',
|
'entries' => 'Files',
|
||||||
'view_popup' => '980x750'
|
'view_popup' => '980x750'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets registered links for VFS file editor
|
||||||
|
*
|
||||||
|
* @return array links
|
||||||
|
*/
|
||||||
|
static function getEditorLink()
|
||||||
|
{
|
||||||
|
$implemented = Api\Hooks::implemented('filemanager-editor-link');
|
||||||
|
// default is CollabEditor
|
||||||
|
// TODO: CollabEditor needs to be migrated into an individual app, so its link
|
||||||
|
$link = array (
|
||||||
|
'edit' => array(
|
||||||
|
'menuaction' => 'filemanager.filemanager_ui.editor',
|
||||||
|
),
|
||||||
|
'edit_popup' => '980x750',
|
||||||
|
'mime' => array (
|
||||||
|
'application/vnd.oasis.opendocument.text' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
foreach ($implemented as $app)
|
||||||
|
{
|
||||||
|
$link = Api\Hooks::process('filemanager-editor-link', $app);
|
||||||
|
$link = $link[$app];
|
||||||
|
if ($app == 'collabora') break; // collabora is default
|
||||||
|
}
|
||||||
|
return $link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user