Skip to content

Commit

Permalink
Merge pull request #448 from ONLYOFFICE/feature/select-document-to-co…
Browse files Browse the repository at this point in the history
…mbine-from-storage

Feature/select document to combine from storage
LinneyS authored Jan 26, 2024
2 parents afccca9 + 94a2c8b commit 43752d1
Showing 5 changed files with 36 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@

## Added
- reference data from coediting
- selecting a document to combine from the storage

## 8.2.3
## Added
26 changes: 18 additions & 8 deletions js/editor.js
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@
config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs;
config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage;
config.events.onRequestMailMergeRecipients = OCA.Onlyoffice.onRequestMailMergeRecipients;
config.events.onRequestCompareFile = OCA.Onlyoffice.onRequestCompareFile;
config.events.onRequestSelectDocument = OCA.Onlyoffice.onRequestSelectDocument;
config.events.onRequestSendNotify = OCA.Onlyoffice.onRequestSendNotify;
config.events.onRequestReferenceData = OCA.Onlyoffice.onRequestReferenceData;
config.events.onMetaChange = OCA.Onlyoffice.onMetaChange;
@@ -417,27 +417,36 @@
"*");
};

OCA.Onlyoffice.onRequestCompareFile = function () {
OCA.Onlyoffice.onRequestSelectDocument = function (event) {
var revisedMimes = [
"application/vnd.openxmlformats-officedocument.wordprocessingml.document"
];

if (OCA.Onlyoffice.inframe) {
window.parent.postMessage({
method: "editorRequestCompareFile",
param: revisedMimes
method: "editorRequestSelectDocument",
param: revisedMimes,
documentSelectionType: event.data.c
},
"*");
} else {
OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select file to compare"),
OCA.Onlyoffice.editorSetRevised,
let title;
switch (event.data.c) {
case "combine":
title = t(OCA.Onlyoffice.AppName, "Select file to combine");
break;
default:
title = t(OCA.Onlyoffice.AppName, "Select file to compare");
}
OC.dialogs.filepicker(title,
OCA.Onlyoffice.editorSetRequested.bind({documentSelectionType: event.data.c}),
false,
revisedMimes,
true);
}
};

OCA.Onlyoffice.editorSetRevised = function (filePath) {
OCA.Onlyoffice.editorSetRequested = function (filePath) {
$.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}",
{
filePath: filePath
@@ -450,8 +459,9 @@
});
return;
}
response.c = documentSelectionType;

OCA.Onlyoffice.docEditor.setRevisedFile(response);
OCA.Onlyoffice.docEditor.setRequestedDocument(response);
});
};

18 changes: 13 additions & 5 deletions js/listener.js
Original file line number Diff line number Diff line change
@@ -56,9 +56,17 @@
true);
};

OCA.Onlyoffice.onRequestCompareFile = function (revisedMimes) {
OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select file to compare"),
$("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorSetRevised,
OCA.Onlyoffice.onRequestSelectDocument = function (revisedMimes, documentSelectionType) {
let title;
switch (documentSelectionType) {
case "combine":
title = t(OCA.Onlyoffice.AppName, "Select file to combine");
break;
default:
title = t(OCA.Onlyoffice.AppName, "Select file to compare");
}
OC.dialogs.filepicker(title,
$("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorSetRequested.bind({documentSelectionType: documentSelectionType}),
false,
revisedMimes,
true);
@@ -110,8 +118,8 @@
case "editorRequestMailMergeRecipients":
OCA.Onlyoffice.onRequestMailMergeRecipients(event.data.param);
break;
case "editorRequestCompareFile":
OCA.Onlyoffice.onRequestCompareFile(event.data.param);
case "editorRequestSelectDocument":
OCA.Onlyoffice.onRequestSelectDocument(event.data.param, event.data.documentSelectionType);
break;
case "onDocumentReady":
OCA.Onlyoffice.onDocumentReady(event.data.param);
3 changes: 2 additions & 1 deletion l10n/ru.js
Original file line number Diff line number Diff line change
@@ -123,6 +123,7 @@ OC.L10N.register(
"View settings": "Посмотреть настройки",
"ONLYOFFICE Docs Cloud": "ONLYOFFICE Docs Cloud",
"Easily launch the editors in the cloud without downloading and installation": "Легко запускайте редакторы в облаке без скачивания и установки",
"Get Now": "Получить сейчас"
"Get Now": "Получить сейчас",
"Select file to combine" : "Выбрать файл для объединения"
},
"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);");
3 changes: 2 additions & 1 deletion l10n/ru.json
Original file line number Diff line number Diff line change
@@ -121,6 +121,7 @@
"View settings": "Посмотреть настройки",
"ONLYOFFICE Docs Cloud": "ONLYOFFICE Docs Cloud",
"Easily launch the editors in the cloud without downloading and installation": "Легко запускайте редакторы в облаке без скачивания и установки",
"Get Now": "Получить сейчас"
"Get Now": "Получить сейчас",
"Select file to combine" : "Выбрать файл для объединения"
},"pluralForm" :"nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);"
}

0 comments on commit 43752d1

Please sign in to comment.