Fix collab editor does not get open when triggered from infolog

This commit is contained in:
Hadi Nategh 2017-11-16 18:22:01 +01:00
parent 6d378b8e73
commit a79875a63a
2 changed files with 32 additions and 22 deletions

View File

@ -1613,8 +1613,17 @@ class filemanager_ui
function editor($content=null)
{
$tmpl = new Etemplate('filemanager.editor');
$file_path = $_GET['path'];
$paths = explode('/webdav.php', $file_path);
$path = $_GET['path'];
if (!preg_match("/\/webdav.php\//", $path))
{
$download_url = Vfs::download_url($path);
}
else
{
$download_url = $path;
$paths = explode('/webdav.php', $path);
$path = $paths[1];
}
// Include css files used by wodocollabeditor
Api\Framework::includeCSS('/api/js/webodf/collab/app/resources/app.css');
Api\Framework::includeCSS('/api/js/webodf/collab/wodocollabpane.css');
@ -1623,10 +1632,10 @@ class filemanager_ui
if (!$content)
{
if ($file_path)
if ($download_url)
{
$content['es_id'] = md5 ($file_path);
$content['file_path'] = $paths[1];
$content['es_id'] = md5 ($download_url);
$content['file_path'] = $path;
}
else
{
@ -1635,7 +1644,7 @@ class filemanager_ui
}
$actions = self::getActions_edit();
if (!Api\Vfs::check_access($paths[1], Api\Vfs::WRITABLE))
if (!Api\Vfs::check_access($path, Api\Vfs::WRITABLE))
{
unset ($actions['save']);
unset ($actions['discard']);

View File

@ -296,8 +296,12 @@ app.classes.filemanager = app.classes.filemanager.extend({
mode: 'saveas',
button_caption:"",
button_label:_egwAction.id == 'saveas'?"save as":"save",
value: "doc.odt",
onchange: function (){
value: "doc.odt"
};
// create file selector
var vfs_select = et2_createWidget('vfs-select', vfs_attrs, this.et2);
jQuery(vfs_select.getDOMNode()).on('change', function (){
file_path = vfs_select.get_value();
if (vfs_select.get_value())
{
@ -311,10 +315,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
});
egw.refresh('','filemanager');
}
}
};
// create file selector
var vfs_select = et2_createWidget('vfs-select', vfs_attrs, this.et2);
});
// start the file selector dialog
vfs_select.click();
}