From ef6bc4c7ce2ab017eee43c48ee96b57d852ca64f Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 20 Jul 2016 15:35:25 +0200 Subject: [PATCH] Open Office Editor W.I.P: - Implement create new document - Add select file dialog for saving a newly created doc --- api/js/webodf/template.odt | Bin 0 -> 37313 bytes filemanager/js/app.js | 112 +++++++++++++++-------- filemanager/templates/default/editor.xet | 2 +- 3 files changed, 76 insertions(+), 38 deletions(-) create mode 100644 api/js/webodf/template.odt diff --git a/api/js/webodf/template.odt b/api/js/webodf/template.odt new file mode 100644 index 0000000000000000000000000000000000000000..b1df29d552d1d44d669599a3683c7150095de39d GIT binary patch literal 37313 zcmeI5by$>J+vo=bX;A3~X=zY8rAxX)2biH5V(1h_q!FYWl+(_J4aXKFL(=%2uS>DOWwloLS{U04tw)!TH^elQ2TfZCh8 zBAW&3GQ6g^RR3pr~er*IJg@R(4nXH7-klbSrMeEitg`C(QXfg*g% ze8ZF-iYGoTtJF`6b(8z(1T%O=a0lq9C{)6i${pE8o)9JsCXGS`XGw(OLC@(NR@Lkq9{tm?IT$6~6j|kq`7brmCYaNLY)AwTp81cP zg}<82ZRqh+7}vM>atQQX)Y%M0GP%_Aj^u&)hVDiJ?+;kba>Lv*Db1hKg-UMLW`}6D z%2gj{A4zF;eV8?0_H(|W{%eQOmS^XSg%6K9UI5^>*E&NzY(dVq{b9>+I&zZl!Hq69 zr6;6_;~6z_)mS4v+EmS_X2L3ILtAEbn*8e27MPUA2Qg)jk!iaPvaz7Y%iazG zEs3;(rZYZXy{oGj&XRgCjI6!KBy%EQjINX9pSjd6Sn;20cV^3{Bfh$)meut-a7fXr z5`=z3f9+fzp%0_`WU}ww7e!;5nvES=9X3|1ukY(oBM$@7jObrhR)ZBy@O z$}_X%BwH!5%;E^;quJZ+o`{ea$nWuic`Md#HOsC%N33|?PI(>k5r|m6pyo9 zH43Q})HMMc_WCJlt-iG_;Gz}Qk|F$wa~5ER1l`S43pV=myFyfU zOoQjaJB89W72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I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I5 z0D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I5 z0D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I50D=I5!2jO_)Rd5r2>_VCRnkEI zP~N1S2m97_@9l;D->PnB1^06b_mcYeToL-#Z=>OM#m>|oXl3in z3H?2K>)Y@TDgW|C`7p#@VHNI+(hUs&!1_Z3JVpqA`X{%Wf6u5b&(0SMuWcPK;NMO8 zJvSrV2kjsJPXC?{`#d*91nx*N`tIKwy8ti$)}<>4-23I& zS}_ zx%I#NM+pCwoWFQu{%1*lMcwfWNq=}}{%0wFZP(Q=r2N@i^Izrs-Cy$`?RrA|SMSY# z9|?bV9{Wemd3c3>=}Ptw5dgrioT2_9LL1KbKe|R$Q$mH0LIB_a{HGBG0N4$?z58D~ CRG^ap literal 0 HcmV?d00001 diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 040d8fa1da..a1c433b72b 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -36,6 +36,7 @@ app.classes.filemanager = AppJS.extend( */ editor: {}, + editor_mime: RegExp(/application\/vnd\.oasis\.opendocument\.text/), /** * Constructor * @@ -1032,8 +1033,10 @@ app.classes.filemanager = AppJS.extend( */ _init_odf_editor: function () { - var file_path = this.et2.getArrayMgr('content').getEntry('file_path'); - var self = this; + var widgetFilePath = this.et2.getWidgetById('file_path'), + file_path = widgetFilePath.value, + isNew = file_path == '/api/js/webodf/template.odt'? true: false, + self = this; var onEditorCreated = function (err ,editor) { @@ -1044,10 +1047,17 @@ app.classes.filemanager = AppJS.extend( } self.editor = editor; self.editor.openDocumentFromUrl(egw.webserverUrl+file_path); + if (isNew) { + widgetFilePath.set_value(''); + } }; var editorOptions = { - allFeaturesEnabled: true + allFeaturesEnabled: true, + userData: { + fullName: egw.user('account_fullName'), + color: 'blue' + } }; var editor = this.et2.getWidgetById('odfEditor'); @@ -1062,9 +1072,11 @@ app.classes.filemanager = AppJS.extend( * * @param {object} _egwAction egw action object */ - editor_close: function (_egwAction) { - var self = this; - var action = _egwAction.id; + editor_close: function (_egwAction, _callback) { + var self = this, + action = _egwAction.id, + callback = _callback; + if (this.editor) { var closeFn = function () @@ -1075,6 +1087,7 @@ app.classes.filemanager = AppJS.extend( self.editor.destroy(function(){}); window.close(); } + callback.call(this); } // warn user about unsaved changes @@ -1109,34 +1122,33 @@ app.classes.filemanager = AppJS.extend( * @todo: creating new empty odt file */ editor_new: function (_egwAction) { - return egw(window).message('Sorry creating new odt document is not fully implemented yet. Please try later.'); - var mimeType = 'application/vnd.oasis.opendocument.text'; - var bytes = new Uint8Array(''); - var blob = new Blob([bytes.buffer], {type:mimeType}); - var egwAction = _egwAction; - var self = this; - this.editor_file_operation({ - url: egw.webserverUrl+'/webdav.php?/home/'+egw.user('account_lid')+'/'+this.et2._inst.etemplate_exec_id+'.odt', - method: 'PUT', - success: function(_data) { - egw(window).message(''); - self.editor_close(egwAction); - }, - error: function (_err) { - egw(window).message('Create new document faild because of %1', _err); - }, - data: blob, - processData: false, - mimeType: mimeType - }); + var self = this, + template_url = '/api/js/webodf/template.odt'; + + if (Object.keys(this.editor).length > 0) + { + this.editor_close(_egwAction, function(){ + self.editor.openDocumentFromUrl(egw.webserverUrl+template_url); + self.et2.getWidgetById('file_path').set_value(''); + }); + } + else + { + egw.open_link(egw.link('/index.php', { + menuaction: 'filemanager.filemanager_ui.editor', + path: template_url, + isNew: true, + }), '', '800x600'); + } }, /** * Method call for saving edited document */ editor_save: function () { - var self = this; - var file_path = this.et2.getArrayMgr('content').getEntry('file_path'); + var self = this, + widgetFilePath = this.et2.getWidgetById('file_path'), + file_path = widgetFilePath.value; if (this.editor) { @@ -1146,9 +1158,8 @@ app.classes.filemanager = AppJS.extend( return; } - var mimetype = "application/vnd.oasis.opendocument.text", - filename = file_path.split('/webdav.php'), - blob = new Blob([data.buffer], {type: mimetype}); + var filename = file_path.split('/webdav.php'), + blob = new Blob([data.buffer], {type: self.editor_mime}); self.editor_file_operation({ url: egw.webserverUrl+file_path, @@ -1157,14 +1168,40 @@ app.classes.filemanager = AppJS.extend( success: function(data) { egw(window).message(egw.lang('Document %1 successfully has been saved.', filename[1])); self.editor.setDocumentModified(false); - }, error: function () {}, data: blob, - mimeType: mimetype + mimeType: self.editor_mime }); } - this.editor.getDocumentAsByteArray(saveByteArrayLocally); + + //existed file + if (file_path != '') { + this.editor.getDocumentAsByteArray(saveByteArrayLocally); + } + // new file + else + { + // create file selector + var vfs_select = et2_createWidget('vfs-select', { + id:'savefile', + mode: 'saveas', + button_caption:"", + button_label:"save", + value: "doc.odt" + }, this.et2); + + // bind change handler for setting the selected path and calling save + jQuery(vfs_select.getDOMNode()).on('change', function (){ + file_path = '/webdav.php'+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); + }); + // start the file selector dialog + jQuery(vfs_select.getDOMNode()).click(); + } } }, @@ -1173,7 +1210,7 @@ app.classes.filemanager = AppJS.extend( * @param {type} _egwAction */ editor_delete: function (_egwAction) { - var fullpath = this.et2.getArrayMgr('content').getEntry('file_path'); + var fullpath = this.et2.getWidgetById('file_path').value; fullpath = fullpath.split('/webdav.php')[1]; var selected = fullpath.split('/'); selected.pop(); @@ -1219,8 +1256,9 @@ app.classes.filemanager = AppJS.extend( * @returns {boolean} returns true if is editable otherwise false */ isEditable: function (_egwAction, _senders) { - var data = egw.dataGetUIDdata(_senders[0].id); - var mime = this.et2._inst.widgetContainer.getWidgetById('$row'); + var data = egw.dataGetUIDdata(_senders[0].id), + mime = this.et2._inst.widgetContainer.getWidgetById('$row'); + return data.data.mime.match(mime.mime_odf_regex)?true:false; } diff --git a/filemanager/templates/default/editor.xet b/filemanager/templates/default/editor.xet index 1d8c8700c4..8be2a2dfaf 100644 --- a/filemanager/templates/default/editor.xet +++ b/filemanager/templates/default/editor.xet @@ -11,7 +11,7 @@ - +