W.I.P. collab editor:

- Fix path indicator shows webdav.php as prefix
This commit is contained in:
Hadi Nategh 2016-08-23 15:26:59 +02:00
parent 4b880bdf89
commit 521c0e74fe
3 changed files with 10 additions and 9 deletions

View File

@ -1497,7 +1497,7 @@ class filemanager_ui
if ($file_path) if ($file_path)
{ {
$content['es_id'] = md5 ($file_path); $content['es_id'] = md5 ($file_path);
$content['file_path'] = $file_path; $content['file_path'] = $paths[1];
} }
} }

View File

@ -1017,7 +1017,7 @@ app.classes.filemanager = AppJS.extend(
* @todo: creating new empty odt file * @todo: creating new empty odt file
*/ */
editor_new: function (_egwAction) { editor_new: function (_egwAction) {
template_url = '/api/js/webodf/template.odt'; var template_url = '/api/js/webodf/template.odt';
egw.open_link(egw.link('/index.php', { egw.open_link(egw.link('/index.php', {
menuaction: 'filemanager.filemanager_ui.editor', menuaction: 'filemanager.filemanager_ui.editor',
path: template_url path: template_url

View File

@ -237,6 +237,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
widgetFilePath = this.et2.getWidgetById('file_path'), widgetFilePath = this.et2.getWidgetById('file_path'),
file_path = widgetFilePath.value; file_path = widgetFilePath.value;
if (this.editor) if (this.editor)
{ {
function saveByteArrayLocally(err, data) { function saveByteArrayLocally(err, data) {
@ -245,15 +246,14 @@ app.classes.filemanager = app.classes.filemanager.extend({
return; return;
} }
var filename = file_path.split('/webdav.php'), var blob = new Blob([data.buffer], {type: self.editor_mime});
blob = new Blob([data.buffer], {type: self.editor_mime});
self.editor_file_operation({ self.editor_file_operation({
url: egw.webserverUrl+file_path, url: egw.webserverUrl+'/webdav.php'+file_path,
method: 'PUT', method: 'PUT',
processData: false, processData: false,
success: function(data) { success: function(data) {
egw(window).message(egw.lang('Document %1 successfully has been saved.', filename[1])); egw(window).message(egw.lang('Document %1 successfully has been saved.', file_path));
self.editor.setDocumentModified(false); self.editor.setDocumentModified(false);
egw.json('filemanager.filemanager_collab.ajax_actions',[self.collab_server.es_id, 'save']).sendRequest(); egw.json('filemanager.filemanager_collab.ajax_actions',[self.collab_server.es_id, 'save']).sendRequest();
}, },
@ -281,7 +281,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
// bind change handler for setting the selected path and calling save // bind change handler for setting the selected path and calling save
jQuery(vfs_select.getDOMNode()).on('change', function (){ jQuery(vfs_select.getDOMNode()).on('change', function (){
file_path = '/webdav.php'+vfs_select.get_value(); file_path = vfs_select.get_value();
if (vfs_select.get_value()) if (vfs_select.get_value())
{ {
// Add odt extension if not exist // Add odt extension if not exist
@ -289,7 +289,8 @@ app.classes.filemanager = app.classes.filemanager.extend({
widgetFilePath.set_value(file_path); widgetFilePath.set_value(file_path);
self.editor.getDocumentAsByteArray(saveByteArrayLocally); self.editor.getDocumentAsByteArray(saveByteArrayLocally);
self.editor_leaveSession(function(){ self.editor_leaveSession(function(){
self._init_odf_collab_editor(); var path = window.location.href.split('&path=');
window.location.href = path[0]+'&path='+self.editor_getFilePath();
}); });
egw.refresh('','filemanager'); egw.refresh('','filemanager');
} }
@ -368,7 +369,7 @@ app.classes.filemanager = app.classes.filemanager.extend({
{ {
var widgetFilePath = this.et2.getWidgetById('file_path'), var widgetFilePath = this.et2.getWidgetById('file_path'),
file_path = widgetFilePath.value, file_path = widgetFilePath.value,
path = egw.webserverUrl+file_path; path = egw.webserverUrl+'/webdav.php'+file_path;
return path; return path;
}, },