From 40f3dce568d6e5679b7e6f8b9b698edc532c5739 Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Wed, 20 Jul 2016 10:34:52 +0200 Subject: [PATCH] Open Office Editor W.I.P: - Add Edit option in filemanager's contextmenu --- filemanager/inc/class.filemanager_ui.inc.php | 7 +++++++ filemanager/js/app.js | 18 ++++++++++++++++++ filemanager/templates/default/app.css | 9 ++++++++- filemanager/templates/default/editor.xet | 6 +++--- filemanager/templates/mobile/app.css | 6 ++++++ filemanager/templates/pixelegg/app.css | 6 ++++++ 6 files changed, 48 insertions(+), 4 deletions(-) diff --git a/filemanager/inc/class.filemanager_ui.inc.php b/filemanager/inc/class.filemanager_ui.inc.php index 46787a0f4c..17ccbf3cd3 100644 --- a/filemanager/inc/class.filemanager_ui.inc.php +++ b/filemanager/inc/class.filemanager_ui.inc.php @@ -131,6 +131,13 @@ class filemanager_ui 'onExecute' => 'javaScript:app.filemanager.open', 'default' => true ), + 'modify' => array( + 'caption' => lang('Edit'), + 'group' => $group, + 'icon' => 'edit', + 'onExecute' => 'javaScript:app.filemanager.open', + 'enabled' => 'javaScript:app.filemanager.isEditable', + ), 'saveas' => array( 'caption' => lang('Save as'), 'group' => $group, diff --git a/filemanager/js/app.js b/filemanager/js/app.js index 4fe347df60..040d8fa1da 100644 --- a/filemanager/js/app.js +++ b/filemanager/js/app.js @@ -781,6 +781,13 @@ app.classes.filemanager = AppJS.extend( { mime_dom.click(); } + else if (_action.id == 'modify' && mime && data.data.mime.match(mime.mime_odf_regex)) + { + egw.open_link(egw.link('/index.php', { + menuaction: 'filemanager.filemanager_ui.editor', + path: data.data.download_url + }), '', '800x600'); + } else { // Build ViewerJS url @@ -1204,6 +1211,17 @@ app.classes.filemanager = AppJS.extend( break; } jQuery.ajax(ajaxObj); + }, + + /** + * Function to check wheter selected file is editable. ATM only .odt is supported. + * + * @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'); + return data.data.mime.match(mime.mime_odf_regex)?true:false; } }); diff --git a/filemanager/templates/default/app.css b/filemanager/templates/default/app.css index d59e473362..506a188e0c 100644 --- a/filemanager/templates/default/app.css +++ b/filemanager/templates/default/app.css @@ -120,4 +120,11 @@ table.egwGridView_grid .tile .file_tile { } .mimeIcon {width:65px;} -.previewImage {width:100%;} \ No newline at end of file +.previewImage {width:100%;} + +#filemanager-editor_file_path { + font-size: 11pt; + display: inline-block; + margin-top: 5px; + margin-left: 10px; +} \ No newline at end of file diff --git a/filemanager/templates/default/editor.xet b/filemanager/templates/default/editor.xet index df1691f242..1d8c8700c4 100644 --- a/filemanager/templates/default/editor.xet +++ b/filemanager/templates/default/editor.xet @@ -6,12 +6,12 @@ - - - + + + diff --git a/filemanager/templates/mobile/app.css b/filemanager/templates/mobile/app.css index 76d1017a66..db6d0524af 100644 --- a/filemanager/templates/mobile/app.css +++ b/filemanager/templates/mobile/app.css @@ -165,6 +165,12 @@ input.displayNone { .previewImage { width: 100%; } +#filemanager-editor_file_path { + font-size: 11pt; + display: inline-block; + margin-top: 5px; + margin-left: 10px; +} /*/***************************************************************** // sidebar diff --git a/filemanager/templates/pixelegg/app.css b/filemanager/templates/pixelegg/app.css index 40c61b7918..1aae7846ba 100755 --- a/filemanager/templates/pixelegg/app.css +++ b/filemanager/templates/pixelegg/app.css @@ -153,6 +153,12 @@ input.displayNone { .previewImage { width: 100%; } +#filemanager-editor_file_path { + font-size: 11pt; + display: inline-block; + margin-top: 5px; + margin-left: 10px; +} /*/***************************************************************** // sidebar