Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ONLYOFFICE/onlyoffice-nextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/js
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2019-09-11 12:45:37 +0300
committerSergey Linnik <sergey.linnik@onlyoffice.com>2019-09-11 12:45:37 +0300
commit5e2386f5d12265685f9b2deae35961f5537278c4 (patch)
tree6227ce733fef7b566d82e0dd6b4bb0a6e20b6cf2 /js
parent60e1bbd597dbaa53f69112f9eedc74623ca00d7d (diff)
parenteb25b05a73603e00b81cc61791df6006f704f701 (diff)
Merge remote-tracking branch 'remotes/origin/develop' into feature/watermark
# Conflicts: # controller/editorcontroller.php # css/settings.css # js/settings.js # l10n/de.js # l10n/de.json # l10n/de_DE.js # l10n/de_DE.json # l10n/es.js # l10n/es.json # l10n/pt_BR.js # l10n/pt_BR.json # l10n/ru.js # l10n/ru.json # l10n/sv.js # l10n/sv.json # templates/settings.php
Diffstat (limited to 'js')
-rw-r--r--js/desktop.js2
-rw-r--r--js/editor.js104
-rw-r--r--js/main.js2
-rw-r--r--js/settings.js19
4 files changed, 117 insertions, 10 deletions
diff --git a/js/desktop.js b/js/desktop.js
index cfed696..73efbe3 100644
--- a/js/desktop.js
+++ b/js/desktop.js
@@ -12,7 +12,7 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
- * You can contact Ascensio System SIA at 17-2 Elijas street, Riga, Latvia, EU, LV-1021.
+ * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions of the Program
* must display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
diff --git a/js/editor.js b/js/editor.js
index cdf7b2f..6024646 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -12,7 +12,7 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
- * You can contact Ascensio System SIA at 17-2 Elijas street, Riga, Latvia, EU, LV-1021.
+ * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions of the Program
* must display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
@@ -80,6 +80,10 @@
return;
}
+ if (config.editorConfig.tenant) {
+ displayError(t(OCA.Onlyoffice.AppName, "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data."));
+ }
+
var docIsChanged = null;
var docIsChangedTimeout = null;
@@ -105,16 +109,110 @@
"onDocumentStateChange": setPageTitle,
};
- var docEditor = new DocsAPI.DocEditor("iframeEditor", config);
+ if (OC.currentUser) {
+ config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs;
+ config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage;
+ config.events.onRequestMailMergeRecipients = OCA.Onlyoffice.onRequestMailMergeRecipients;
+ }
+
+ OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config);
if (config.type === "mobile" && $("#app > iframe").css("position") === "fixed") {
- $("#app > iframe").css("height", "calc(100% - 50px)")
+ $("#app > iframe").css("height", "calc(100% - 50px)");
}
}
}
});
};
+ OCA.Onlyoffice.onRequestSaveAs = function(event) {
+ var title = event.data.title;
+ var url = event.data.url;
+
+ var saveAs = function(fileDir) {
+ var saveData = {
+ name: title,
+ dir: fileDir,
+ url: url
+ };
+
+ $.post(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/save"),
+ saveData,
+ function onSuccess(response) {
+ if (response.error) {
+ OC.Notification.show(response.error, {
+ type: "error",
+ timeout: 3
+ });
+ return;
+ }
+
+ OC.Notification.show(t(OCA.Onlyoffice.AppName, "File saved") + " (" + response.name + ")", {
+ timeout: 3
+ });
+ });
+ };
+
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Save as"), saveAs, false, "httpd/unix-directory");
+ };
+
+ OCA.Onlyoffice.onRequestInsertImage = function() {
+
+ var insertImage = function(filePath) {
+ $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}",
+ {
+ filePath: filePath
+ }),
+ function onSuccess(response) {
+ if (response.error) {
+ OC.Notification.show(response.error, {
+ type: "error",
+ timeout: 3
+ });
+ return;
+ }
+
+ OCA.Onlyoffice.docEditor.insertImage(response);
+ });
+ };
+
+ var imageMimes = [
+ "image/bmp", "image/x-bmp", "image/x-bitmap", "application/bmp",
+ "image/gif",
+ "image/jpeg", "image/jpg", "application/jpg", "application/x-jpg",
+ "image/png", "image/x-png", "application/png", "application/x-png"
+ ];
+
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"), insertImage, false, imageMimes);
+ };
+
+ OCA.Onlyoffice.onRequestMailMergeRecipients = function() {
+
+ var setRecipient = function(filePath) {
+ $.get(OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/url?filePath={filePath}",
+ {
+ filePath: filePath
+ }),
+ function onSuccess(response) {
+ if (response.error) {
+ OC.Notification.show(response.error, {
+ type: "error",
+ timeout: 3
+ });
+ return;
+ }
+
+ OCA.Onlyoffice.docEditor.setMailMergeRecipients(response);
+ });
+ };
+
+ var recipientMimes = [
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
+ ];
+
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"), setRecipient, false, recipientMimes);
+ };
+
$(document).ready(OCA.Onlyoffice.InitEditor);
})(jQuery, OCA);
diff --git a/js/main.js b/js/main.js
index d964209..8db38f6 100644
--- a/js/main.js
+++ b/js/main.js
@@ -12,7 +12,7 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
- * You can contact Ascensio System SIA at 17-2 Elijas street, Riga, Latvia, EU, LV-1021.
+ * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions of the Program
* must display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
diff --git a/js/settings.js b/js/settings.js
index c3e95c4..01764ef 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -12,7 +12,7 @@
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* For details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
- * You can contact Ascensio System SIA at 17-2 Elijas street, Riga, Latvia, EU, LV-1021.
+ * You can contact Ascensio System SIA at 20A-12 Ernesta Birznieka-Upisha street, Riga, Latvia, EU, LV-1050.
*
* The interactive user interfaces in modified source and object code versions of the Program
* must display Appropriate Legal Notices, as required under Section 5 of the GNU AGPL version 3.
@@ -61,6 +61,13 @@
$("#onlyofficeGroups").click(groupListToggle);
groupListToggle();
+ var demoToggle = function() {
+ $("#onlyofficeAddrSettings input:not(#onlyofficeStorageUrl)").prop("disabled", $("#onlyofficeDemo").prop("checked"));
+ };
+
+ $("#onlyofficeDemo").click(demoToggle);
+ demoToggle();
+
var watermarkToggle = function () {
$("#onlyofficeWatermarkSettings").toggleClass("onlyoffice-hide", !$("#onlyofficeWatermark_enabled").prop("checked"));
};
@@ -94,7 +101,7 @@
multiple: true,
separator: "|",
toggleSelect: true,
- placeholder: t("systemtags_manager", "Select tag…"),
+ placeholder: t("systemtags_manager", "Select tag…"),
query: _.debounce(function(query) {
query.callback({
results: OC.SystemTags.collection.filterByName(query.term)
@@ -143,6 +150,7 @@
var onlyofficeInternalUrl = ($("#onlyofficeInternalUrl:visible").val() || "").trim();
var onlyofficeStorageUrl = ($("#onlyofficeStorageUrl:visible").val() || "").trim();
var onlyofficeSecret = $("#onlyofficeSecret:visible").val() || "";
+ var demo = $("#onlyofficeDemo").prop("checked");
$.ajax({
method: "PUT",
@@ -151,17 +159,18 @@
documentserver: onlyofficeUrl,
documentserverInternal: onlyofficeInternalUrl,
storageUrl: onlyofficeStorageUrl,
- secret: onlyofficeSecret
+ secret: onlyofficeSecret,
+ demo: demo
},
success: function onSuccess(response) {
$(".section-onlyoffice").removeClass("icon-loading");
- if (response && response.documentserver != null) {
+ if (response && (response.documentserver != null || demo)) {
$("#onlyofficeUrl").val(response.documentserver);
$("#onlyofficeInternalUrl").val(response.documentserverInternal);
$("#onlyofficeStorageUrl").val(response.storageUrl);
$("#onlyofficeSecret").val(response.secret);
- $(".section-onlyoffice-common, .section-onlyoffice-watermark").toggleClass("onlyoffice-hide", !response.documentserver.length || !!response.error.length);
+ $(".section-onlyoffice-common, .section-onlyoffice-watermark").toggleClass("onlyoffice-hide", (!response.documentserver.length && !demo) || !!response.error.length);
var message =
response.error