diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index e839dbadfd..daa9ab839b 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -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']); diff --git a/filemanager/js/collab.js b/filemanager/js/collab.js index 6b70ad4720..81cdc790e8 100644 --- a/filemanager/js/collab.js +++ b/filemanager/js/collab.js @@ -296,25 +296,26 @@ app.classes.filemanager = app.classes.filemanager.extend({ mode: 'saveas', button_caption:"", button_label:_egwAction.id == 'saveas'?"save as":"save", - value: "doc.odt", - onchange: function (){ - file_path = vfs_select.get_value(); - if (vfs_select.get_value()) - { - // Add odt extension if not exist - if (!file_path.match(/\.odt$/,'ig')) file_path += '.odt'; - widgetFilePath.set_value(file_path); - self.editor.getDocumentAsByteArray(saveByteArrayLocally); - self.editor_leaveSession(function(){ - var path = window.location.href.split('&path='); - window.location.href = path[0]+'&path='+self.editor_getFilePath(); - }); - egw.refresh('','filemanager'); - } - } + 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()) + { + // Add odt extension if not exist + if (!file_path.match(/\.odt$/,'ig')) file_path += '.odt'; + widgetFilePath.set_value(file_path); + self.editor.getDocumentAsByteArray(saveByteArrayLocally); + self.editor_leaveSession(function(){ + var path = window.location.href.split('&path='); + window.location.href = path[0]+'&path='+self.editor_getFilePath(); + }); + egw.refresh('','filemanager'); + } + }); // start the file selector dialog vfs_select.click(); }