Open Office Editor W.I.P:

- Implement Save As action
This commit is contained in:
Hadi Nategh 2016-07-20 15:55:47 +02:00
parent ef6bc4c7ce
commit 744d0bd305
2 changed files with 12 additions and 4 deletions

View File

@ -1489,7 +1489,7 @@ class filemanager_ui
$actions = array ( $actions = array (
'save' => array( 'save' => array(
'caption' => 'Save', 'caption' => 'Save',
'icon' => 'save', 'icon' => 'apply',
'group' => ++$group, 'group' => ++$group,
'onExecute' => 'javaScript:app.filemanager.editor_save', 'onExecute' => 'javaScript:app.filemanager.editor_save',
'allowOnMultiple' => false, 'allowOnMultiple' => false,
@ -1511,6 +1511,14 @@ class filemanager_ui
'allowOnMultiple' => false, 'allowOnMultiple' => false,
'toolbarDefault' => true 'toolbarDefault' => true
), ),
'saveas' => array(
'caption' => 'Save As',
'icon' => 'save_all',
'group' => ++$group,
'onExecute' => 'javaScript:app.filemanager.editor_save',
'allowOnMultiple' => false,
'toolbarDefault' => true
),
'delete' => array( 'delete' => array(
'caption' => 'Delete', 'caption' => 'Delete',
'icon' => 'delete', 'icon' => 'delete',

View File

@ -1145,7 +1145,7 @@ app.classes.filemanager = AppJS.extend(
/** /**
* Method call for saving edited document * Method call for saving edited document
*/ */
editor_save: function () { editor_save: function (_egwAction) {
var self = this, var self = this,
widgetFilePath = this.et2.getWidgetById('file_path'), widgetFilePath = this.et2.getWidgetById('file_path'),
file_path = widgetFilePath.value; file_path = widgetFilePath.value;
@ -1176,7 +1176,7 @@ app.classes.filemanager = AppJS.extend(
} }
//existed file //existed file
if (file_path != '') { if (file_path != '' && _egwAction.id != 'saveas') {
this.editor.getDocumentAsByteArray(saveByteArrayLocally); this.editor.getDocumentAsByteArray(saveByteArrayLocally);
} }
// new file // new file
@ -1187,7 +1187,7 @@ app.classes.filemanager = AppJS.extend(
id:'savefile', id:'savefile',
mode: 'saveas', mode: 'saveas',
button_caption:"", button_caption:"",
button_label:"save", button_label:_egwAction.id == 'saveas'?"save as":"save",
value: "doc.odt" value: "doc.odt"
}, this.et2); }, this.et2);