diff --git a/CHANGELOG.md b/CHANGELOG.md
index d7c80925..f7b2767f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,15 @@
# Change Log
+## 4.1.3
+## Added
+- inline editor if using the same tab, opening the sidebar, sharing from the editor
+- setting zoom and autosave
+- selection of a file for comparison (DocumentServer 5.5 required)
+
+## Changed
+- fix file opening if master key encryption is enabled
+- fix file opening the federated file when watermark is enabled
+
## 4.0.1
## Added
- Polish translation
diff --git a/appinfo/app.php b/appinfo/app.php
index cbe84af0..1d8b32f0 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -1,7 +1,7 @@
ONLYOFFICE connector enables you to edit Office documents within ONLYOFFICE from the familiar web interface. This will create a new Open in ONLYOFFICE action within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to your file storage.
agplAscensio System SIA
- 4.0.1
+ 4.1.3Onlyoffice
diff --git a/appinfo/routes.php b/appinfo/routes.php
index dfce8621..9a9a4638 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -1,7 +1,7 @@
userId;
\OC_User::setUserId($userId);
- $user = $this->userManager->get($userId);
- if (!empty($user)) {
- \OC_Util::setupFS($userId);
+ if ($this->config->checkEncryptionModule() === "master") {
+ \OC_User::setIncognitoMode(true);
+ } else {
+ $user = $this->userManager->get($userId);
+ if (!empty($user)) {
+ \OC_Util::setupFS($userId);
+ }
}
}
@@ -399,10 +403,6 @@ public function track($doc, $users, $key, $status, $url, $token) {
}
}
- if ($this->config->checkEncryptionModule() === "master") {
- \OC_User::setIncognitoMode(true);
- }
-
// owner of file from the callback link
$ownerId = $hashData->ownerId;
$owner = $this->userManager->get($ownerId);
@@ -422,7 +422,9 @@ public function track($doc, $users, $key, $status, $url, $token) {
}
}
- if (!empty($userId)) {
+ if ($this->config->checkEncryptionModule() === "master") {
+ \OC_User::setIncognitoMode(true);
+ } else if (!empty($userId)) {
\OC_Util::setupFS($userId);
}
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index ffe413ed..d70ec3c0 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -1,7 +1,7 @@
logger->error("Can't create file: $name", array("app" => $this->appName));
return ["error" => $this->trans->t("Can't create file")];
+ } catch (ForbiddenException $e) {
+ $this->logger->error("Can't put file: $name", array("app" => $this->appName));
+ return ["error" => $this->trans->t("Can't create file")];
}
$fileInfo = $file->getFileInfo();
@@ -350,6 +354,9 @@ public function convert($fileId, $shareToken = NULL) {
} catch (NotPermittedException $e) {
$this->logger->error("Can't create file: $newFileName", array("app" => $this->appName));
return ["error" => $this->trans->t("Can't create file")];
+ } catch (ForbiddenException $e) {
+ $this->logger->error("Can't put file: $newFileName", array("app" => $this->appName));
+ return ["error" => $this->trans->t("Can't create file")];
}
$fileInfo = $file->getFileInfo();
@@ -410,6 +417,9 @@ public function save($name, $dir, $url) {
} catch (NotPermittedException $e) {
$this->logger->error("Can't save file: $name", array("app" => $this->appName));
return ["error" => $this->trans->t("Can't create file")];
+ } catch (ForbiddenException $e) {
+ $this->logger->error("Can't put file: $name", array("app" => $this->appName));
+ return ["error" => $this->trans->t("Can't create file")];
}
$fileInfo = $file->getFileInfo();
@@ -470,15 +480,16 @@ public function url($filePath) {
* Print editor section
*
* @param integer $fileId - file identifier
- * @param string $shareToken - access token
* @param string $filePath - file path
+ * @param string $shareToken - access token
+ * @param bool $inframe - open in frame
*
* @return TemplateResponse|RedirectResponse
*
* @NoAdminRequired
* @NoCSRFRequired
*/
- public function index($fileId, $shareToken = NULL, $filePath = NULL) {
+ public function index($fileId, $filePath = NULL, $shareToken = NULL, $inframe = false) {
$this->logger->debug("Open: $fileId $filePath", array("app" => $this->appName));
if (empty($shareToken) && !$this->userSession->isLoggedIn()) {
@@ -503,10 +514,16 @@ public function index($fileId, $shareToken = NULL, $filePath = NULL) {
"documentServerUrl" => $documentServerUrl,
"fileId" => $fileId,
"filePath" => $filePath,
- "shareToken" => $shareToken
+ "shareToken" => $shareToken,
+ "inframe" => false
];
- $response = new TemplateResponse($this->appName, "editor", $params);
+ if ($inframe === true) {
+ $params["inframe"] = true;
+ $response = new TemplateResponse($this->appName, "editor", $params, "plain");
+ } else {
+ $response = new TemplateResponse($this->appName, "editor", $params);
+ }
$csp = new ContentSecurityPolicy();
$csp->allowInlineScript(true);
@@ -527,6 +544,7 @@ public function index($fileId, $shareToken = NULL, $filePath = NULL) {
*
* @param integer $fileId - file identifier
* @param string $shareToken - access token
+ * @param bool $inframe - open in frame
*
* @return TemplateResponse
*
@@ -534,8 +552,8 @@ public function index($fileId, $shareToken = NULL, $filePath = NULL) {
* @NoCSRFRequired
* @PublicPage
*/
- public function PublicPage($fileId, $shareToken) {
- return $this->index($fileId, $shareToken);
+ public function PublicPage($fileId, $shareToken, $inframe = false) {
+ return $this->index($fileId, null, $shareToken, $inframe);
}
/**
@@ -544,6 +562,7 @@ public function PublicPage($fileId, $shareToken) {
* @param integer $fileId - file identifier
* @param string $filePath - file path
* @param string $shareToken - access token
+ * @param integer $inframe - open in frame. 0 - no, 1 - yes, 2 - without goback for old editor (5.4)
* @param bool $desktop - desktop label
*
* @return array
@@ -551,7 +570,7 @@ public function PublicPage($fileId, $shareToken) {
* @NoAdminRequired
* @PublicPage
*/
- public function config($fileId, $filePath = NULL, $shareToken = NULL, $desktop = false) {
+ public function config($fileId, $filePath = NULL, $shareToken = NULL, $inframe = 0, $desktop = false) {
if (empty($shareToken) && !$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
@@ -704,7 +723,7 @@ public function config($fileId, $filePath = NULL, $shareToken = NULL, $desktop =
}
}
- if ($folderLink !== NULL) {
+ if ($folderLink !== NULL && $inframe !== 2) {
$params["editorConfig"]["customization"]["goback"] = [
"url" => $folderLink
];
@@ -712,10 +731,17 @@ public function config($fileId, $filePath = NULL, $shareToken = NULL, $desktop =
if (!$desktop) {
if ($this->config->GetSameTab()) {
$params["editorConfig"]["customization"]["goback"]["blank"] = false;
+ if ($inframe === 1) {
+ $params["editorConfig"]["customization"]["goback"]["requestClose"] = true;
+ }
}
}
}
+ if ($inframe === 1) {
+ $params["_files_sharing"] = \OC::$server->getAppManager()->isEnabledForUser("files_sharing");
+ }
+
$params = $this->setCustomization($params);
if ($this->config->UseDemo()) {
@@ -878,6 +904,16 @@ private function setCustomization($params) {
$params["editorConfig"]["customization"]["logo"] = $logo;
}
+ $zoom = $this->config->GetSystemValue($this->config->_customization_zoom);
+ if (isset($zoom)) {
+ $params["editorConfig"]["customization"]["zoom"] = $zoom;
+ }
+
+ $autosave = $this->config->GetSystemValue($this->config->_customization_autosave);
+ if (isset($autosave)) {
+ $params["editorConfig"]["customization"]["autosave"] = $autosave;
+ }
+
return $params;
}
diff --git a/controller/federationcontroller.php b/controller/federationcontroller.php
index 6ce8c434..09cab301 100644
--- a/controller/federationcontroller.php
+++ b/controller/federationcontroller.php
@@ -1,7 +1,7 @@
config->SelectDemo($demo === true)) {
$error = $this->trans->t("The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server.");
}
diff --git a/css/editor.css b/css/editor.css
index 21f52fd9..38b90a5e 100644
--- a/css/editor.css
+++ b/css/editor.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -30,6 +30,9 @@
position: absolute;
vertical-align: top;
}
+#body-public #content {
+ height: 100%;
+}
.AscDesktopEditor #header {
display: none;
diff --git a/css/main.css b/css/main.css
index d08922cd..abddaaa8 100644
--- a/css/main.css
+++ b/css/main.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -40,6 +40,54 @@
background-image: url("../img/app-dark.svg");
}
+/* onlyoffice-inline */
+body.onlyoffice-inline {
+ overscroll-behavior-y: none;
+ overflow: hidden;
+}
+body.onlyoffice-inline #app-navigation,
+body.onlyoffice-inline .searchbox,
+body.onlyoffice-inline #app-content #controls {
+ display: none;
+}
+body.onlyoffice-inline #content #app-content {
+ margin-left: 0;
+}
+#onlyofficeFrame {
+ background-color: #fff;
+ width: 100%;
+ height: calc(100vh - 45px);
+ display: block;
+ position: absolute;
+ top: 0;
+ z-index: 110;
+}
+
+#onlyofficeHeader {
+ display: flex;
+ float: right;
+}
+.header-right #onlyofficeHeader {
+ float: left;
+}
+
+#onlyofficeHeader .icon {
+ display: block;
+ min-width: 50px;
+ height: 45px;
+}
+.header-right #onlyofficeHeader .icon {
+ height: 31px;
+}
+#onlyofficeHeader .icon-close {
+ background-image: url("../img/close.svg");
+}
+#onlyofficeHeader .icon-shared {
+ background-image: url("../img/shared.svg");
+ opacity: 1;
+}
+
+/* AscDesktopEditor */
.AscDesktopEditor #header {
display: none;
}
diff --git a/css/settings.css b/css/settings.css
index 2d503d8b..160b6aac 100644
--- a/css/settings.css
+++ b/css/settings.css
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/img/close.svg b/img/close.svg
new file mode 100644
index 00000000..6e9782e8
--- /dev/null
+++ b/img/close.svg
@@ -0,0 +1,3 @@
+
diff --git a/img/shared.svg b/img/shared.svg
new file mode 100644
index 00000000..d5edd210
--- /dev/null
+++ b/img/shared.svg
@@ -0,0 +1,3 @@
+
diff --git a/js/desktop.js b/js/desktop.js
index e8bc18e2..7a00b927 100644
--- a/js/desktop.js
+++ b/js/desktop.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/js/editor.js b/js/editor.js
index f1687a80..353ea889 100644
--- a/js/editor.js
+++ b/js/editor.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -29,7 +29,8 @@
(function ($, OCA) {
OCA.Onlyoffice = _.extend({
- AppName: "onlyoffice"
+ AppName: "onlyoffice",
+ inframe: false
}, OCA.Onlyoffice);
OCA.Onlyoffice.InitEditor = function () {
@@ -42,6 +43,7 @@
var fileId = $("#iframeEditor").data("id");
var filePath = $("#iframeEditor").data("path");
var shareToken = $("#iframeEditor").data("sharetoken");
+ OCA.Onlyoffice.inframe = !!$("#iframeEditor").data("inframe");
if (!fileId && !shareToken) {
displayError(t(OCA.Onlyoffice.AppName, "FileId is empty"));
return;
@@ -64,6 +66,21 @@
if (shareToken) {
params.push("shareToken=" + encodeURIComponent(shareToken));
}
+
+ if (OCA.Onlyoffice.inframe) {
+ var dsVersion = DocsAPI.DocEditor.version();
+ var versionArray = dsVersion.split(".");
+ if (versionArray[0] < 5 || versionArray[0] == 5 && versionArray[1] < 5) {
+ window.parent.postMessage({
+ method: "editorShowHeaderButton"
+ },
+ "*");
+ params.push("inframe=2");
+ } else {
+ params.push("inframe=1");
+ }
+ }
+
if (OCA.Onlyoffice.Desktop) {
params.push("desktop=true");
}
@@ -109,10 +126,19 @@
"onDocumentStateChange": setPageTitle,
};
- if (OC.currentUser) {
+ if (OCA.Onlyoffice.inframe && !shareToken
+ || OC.currentUser) {
config.events.onRequestSaveAs = OCA.Onlyoffice.onRequestSaveAs;
config.events.onRequestInsertImage = OCA.Onlyoffice.onRequestInsertImage;
config.events.onRequestMailMergeRecipients = OCA.Onlyoffice.onRequestMailMergeRecipients;
+ config.events.onRequestCompareFile = OCA.Onlyoffice.onRequestCompareFile;
+ }
+
+ if (OCA.Onlyoffice.inframe) {
+ config.events.onRequestClose = OCA.Onlyoffice.onRequestClose;
+ if (config._files_sharing && !shareToken) {
+ config.events.onRequestSharingSettings = OCA.Onlyoffice.onRequestSharingSettings;
+ }
}
OCA.Onlyoffice.docEditor = new DocsAPI.DocEditor("iframeEditor", config);
@@ -125,57 +151,48 @@
});
};
- 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
- });
- });
+ OCA.Onlyoffice.onRequestSaveAs = function (event) {
+ var saveData = {
+ name: event.data.title,
+ url: event.data.url
};
- OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Save as"), saveAs, false, "httpd/unix-directory");
+ if (OCA.Onlyoffice.inframe) {
+ window.parent.postMessage({
+ method: "editorRequestSaveAs",
+ param: saveData
+ },
+ "*");
+ } else {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Save as"),
+ function (fileDir) {
+ saveData.dir = fileDir;
+ OCA.Onlyoffice.editorSaveAs(saveData);
+ },
+ 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.editorSaveAs = function (saveData) {
+ $.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;
+ }
- OCA.Onlyoffice.docEditor.insertImage(response);
+ OC.Notification.show(t(OCA.Onlyoffice.AppName, "File saved") + " (" + response.name + ")", {
+ timeout: 3
});
- };
+ });
+ };
+ OCA.Onlyoffice.onRequestInsertImage = function () {
var imageMimes = [
"image/bmp", "image/x-bmp", "image/x-bitmap", "application/bmp",
"image/gif",
@@ -183,34 +200,115 @@
"image/png", "image/x-png", "application/png", "application/x-png"
];
- OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"), insertImage, false, imageMimes);
+ if (OCA.Onlyoffice.inframe) {
+ window.parent.postMessage({
+ method: "editorRequestInsertImage",
+ param: imageMimes
+ },
+ "*");
+ } else {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"), OCA.Onlyoffice.editorInsertImage, 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.editorInsertImage = 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);
- });
- };
+ OCA.Onlyoffice.docEditor.insertImage(response);
+ });
+ };
+ OCA.Onlyoffice.onRequestMailMergeRecipients = function () {
var recipientMimes = [
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
];
- OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"), setRecipient, false, recipientMimes);
+ if (OCA.Onlyoffice.inframe) {
+ window.parent.postMessage({
+ method: "editorRequestMailMergeRecipients",
+ param: recipientMimes
+ },
+ "*");
+ } else {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"), OCA.Onlyoffice.editorSetRecipient, false, recipientMimes);
+ }
+ };
+
+ OCA.Onlyoffice.editorSetRecipient = 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);
+ });
+ };
+
+ OCA.Onlyoffice.onRequestClose = function () {
+ window.parent.postMessage({
+ method: "editorRequestClose"
+ },
+ "*");
+ };
+
+ OCA.Onlyoffice.onRequestSharingSettings = function() {
+ window.parent.postMessage({
+ method: "editorRequestSharingSettings"
+ },
+ "*");
+ };
+
+ OCA.Onlyoffice.onRequestCompareFile = function() {
+ var revisedMimes = [
+ "application/vnd.openxmlformats-officedocument.wordprocessingml.document"
+ ];
+
+ if (OCA.Onlyoffice.inframe) {
+ window.parent.postMessage({
+ method: "editorRequestCompareFile",
+ param: revisedMimes
+ },
+ "*");
+ } else {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select file to compare"), OCA.Onlyoffice.editorSetRevised, false, revisedMimes);
+ }
+ };
+
+ OCA.Onlyoffice.editorSetRevised = 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.setRevisedFile(response);
+ });
};
$(document).ready(OCA.Onlyoffice.InitEditor);
diff --git a/js/main.js b/js/main.js
index 0d11f575..056d2f61 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
@@ -29,7 +29,9 @@
(function (OCA) {
OCA.Onlyoffice = _.extend({
- AppName: "onlyoffice"
+ AppName: "onlyoffice",
+ context: null,
+ folderUrl: null
}, OCA.Onlyoffice);
OCA.Onlyoffice.setting = {};
@@ -71,6 +73,9 @@
fileList.add(response, { animate: true });
OCA.Onlyoffice.OpenEditor(response.id, dir, response.name, winEditor);
+ OCA.Onlyoffice.context = { fileList: fileList };
+ OCA.Onlyoffice.context.fileName = response.name;
+
OC.Notification.show(t(OCA.Onlyoffice.AppName, "File created"), {
timeout: 3
});
@@ -98,14 +103,82 @@
winEditor.location.href = url;
} else if (!OCA.Onlyoffice.setting.sameTab || OCA.Onlyoffice.Desktop) {
winEditor = window.open(url, "_blank");
- } else {
+ } else if ($("#isPublic").val() === "1" && !$("#filestable").length) {
location.href = url;
+ } else {
+ var $iframe = $("");
+ if ($("#app-content").length) {
+ $("#app-content").append($iframe);
+ } else {
+ $("#preview").append($iframe);
+ }
+
+ $("body").addClass("onlyoffice-inline");
+ OC.Apps.hideAppSidebar();
+
+ $("html, body").scrollTop(0);
+
+ OCA.Onlyoffice.folderUrl = location.href;
+ window.history.pushState(null, null, url);
+ }
+ };
+
+ OCA.Onlyoffice.ShowHeaderButton = function () {
+ var wrapper = $("")
+
+ var btnClose = $("");
+ btnClose.on("click", function() {
+ OCA.Onlyoffice.CloseEditor();
+ });
+ wrapper.prepend(btnClose);
+
+ if (!$("#isPublic").val()) {
+ var btnShare = $("");
+ btnShare.on("click", function () {
+ OCA.Onlyoffice.OpenShareDialog();
+ })
+ wrapper.prepend(btnShare);
+ }
+
+ if ($("#header .header-right").length) {
+ $("#header .header-right").append(wrapper);
+ } else {
+ $("#header").append(wrapper);
+ }
+ };
+
+ OCA.Onlyoffice.CloseEditor = function () {
+ $("body").removeClass("onlyoffice-inline");
+
+ $("#onlyofficeFrame").remove();
+ $("#onlyofficeHeader").remove();
+
+ OCA.Onlyoffice.context = null;
+
+ var url = OCA.Onlyoffice.folderUrl;
+ if (!!url) {
+ window.history.pushState(null, null, url);
+ OCA.Onlyoffice.folderUrl = null;
+ }
+ };
+
+ OCA.Onlyoffice.OpenShareDialog = function () {
+ if (OCA.Onlyoffice.context) {
+ if (!$("#app-content").hasClass("with-app-sidebar")) {
+ OCA.Onlyoffice.context.fileList.showDetailsView(OCA.Onlyoffice.context.fileName, "shareTabView");
+ OC.Apps.showAppSidebar();
+ } else {
+ OC.Apps.hideAppSidebar();
+ }
}
};
OCA.Onlyoffice.FileClick = function (fileName, context) {
var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
OCA.Onlyoffice.OpenEditor(fileInfoModel.id, context.dir, fileName);
+
+ OCA.Onlyoffice.context = context;
+ OCA.Onlyoffice.context.fileName = fileName;
};
OCA.Onlyoffice.FileConvertClick = function (fileName, context) {
@@ -159,6 +232,37 @@
}
};
+ OCA.Onlyoffice.onRequestSaveAs = function (saveData) {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Save as"),
+ function (fileDir) {
+ saveData.dir = fileDir;
+ $("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorSaveAs(saveData);
+ },
+ false,
+ "httpd/unix-directory");
+ };
+
+ OCA.Onlyoffice.onRequestInsertImage = function (imageMimes) {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Insert image"),
+ $("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorInsertImage,
+ false,
+ imageMimes);
+ };
+
+ OCA.Onlyoffice.onRequestMailMergeRecipients = function (recipientMimes) {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select recipients"),
+ $("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorSetRecipient,
+ false,
+ recipientMimes);
+ };
+
+ OCA.Onlyoffice.onRequestCompareFile = function (revisedMimes) {
+ OC.dialogs.filepicker(t(OCA.Onlyoffice.AppName, "Select file to compare"),
+ $("#onlyofficeFrame")[0].contentWindow.OCA.Onlyoffice.editorSetRevised,
+ false,
+ revisedMimes);
+ };
+
OCA.Onlyoffice.FileList = {
attach: function (fileList) {
if (fileList.id == "trashbin") {
@@ -285,6 +389,36 @@
}
};
+ window.addEventListener("message", function(event) {
+ if ($("#onlyofficeFrame")[0].contentWindow !== event.source
+ || !event.data["method"]) {
+ return;
+ }
+ switch (event.data.method) {
+ case "editorRequestClose":
+ OCA.Onlyoffice.CloseEditor();
+ break;
+ case "editorRequestSharingSettings":
+ OCA.Onlyoffice.OpenShareDialog();
+ break;
+ case "editorRequestSaveAs":
+ OCA.Onlyoffice.onRequestSaveAs(event.data.param);
+ break;
+ case "editorRequestInsertImage":
+ OCA.Onlyoffice.onRequestInsertImage(event.data.param);
+ break;
+ case "editorRequestMailMergeRecipients":
+ OCA.Onlyoffice.onRequestMailMergeRecipients(event.data.param);
+ break;
+ case "editorRequestCompareFile":
+ OCA.Onlyoffice.onRequestCompareFile(event.data.param);
+ break;
+ case "editorShowHeaderButton":
+ OCA.Onlyoffice.ShowHeaderButton();
+ break;
+ }
+ }, false);
+
$(document).ready(initPage)
})(OCA);
diff --git a/js/settings.js b/js/settings.js
index fe536574..d3611559 100644
--- a/js/settings.js
+++ b/js/settings.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/js/share.js b/js/share.js
index 24aaf19b..52e8f676 100644
--- a/js/share.js
+++ b/js/share.js
@@ -1,6 +1,6 @@
/**
*
- * (c) Copyright Ascensio System SIA 2019
+ * (c) Copyright Ascensio System SIA 2020
*
* This program is a free software product.
* You can redistribute it and/or modify it under the terms of the GNU Affero General Public License
diff --git a/l10n/de.js b/l10n/de.js
index 29e5c29c..4543d760 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -66,6 +66,7 @@ OC.L10N.register(
"Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwende beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Du kannst keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten.",
+ "Select file to compare" : "Datei zum Vergleich auswählen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de.json b/l10n/de.json
index 1a5b2b48..708cbc6e 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -64,6 +64,7 @@
"Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwende beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Du kannst keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du verwendest den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutze ihn nicht zum Speichern von Deinen privaten sensiblen Daten.",
+ "Select file to compare" : "Datei zum Vergleich auswählen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/de_DE.js b/l10n/de_DE.js
index e2571095..66c812fe 100644
--- a/l10n/de_DE.js
+++ b/l10n/de_DE.js
@@ -66,6 +66,7 @@ OC.L10N.register(
"Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwenden Sie beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Sie können keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten.",
+ "Select file to compare" : "Datei zum Vergleich auswählen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index 2d298959..ce055b93 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -64,6 +64,7 @@
"Connect to demo ONLYOFFICE Document Server" : "Verbindung zu Demo ONLYOFFICE Document Server herstellen",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Dies ist ein öffentlicher Testserver. Bitte verwenden Sie beim Testen keine privaten sensiblen Daten. Der Server ist 30 Tage lang verfügbar.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Der 30-tägige Testzeitraum ist abgelaufen. Sie können keine Verbindung mehr zu Demo ONLYOFFICE Document Server herstellen.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Sie verwenden den öffentlichen Demo ONLYOFFICE Document Server. Bitte benutzen Sie ihn nicht zum Speichern von Ihren privaten sensiblen Daten.",
+ "Select file to compare" : "Datei zum Vergleich auswählen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/es.js b/l10n/es.js
index 360a775c..ee54123f 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -62,6 +62,7 @@ OC.L10N.register(
"Save as" : "Guardar como",
"File saved" : "El archivo ha sido guardado",
"Insert image" : "Insertar imagen",
- "Select recipients" : "Seleccionar destinatarios"
+ "Select recipients" : "Seleccionar destinatarios",
+ "Select file to compare" : "Seleccione un archivo para comparar"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/es.json b/l10n/es.json
index 1d48c1b2..ab05f6d2 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -60,6 +60,7 @@
"Save as" : "Guardar como",
"File saved" : "El archivo ha sido guardado",
"Insert image" : "Insertar imagen",
- "Select recipients" : "Seleccionar destinatarios"
+ "Select recipients" : "Seleccionar destinatarios",
+ "Select file to compare" : "Seleccione un archivo para comparar"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/fr.js b/l10n/fr.js
index fe0e15f6..def654e7 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -62,6 +62,7 @@ OC.L10N.register(
"Save as" : "Enregistrer sous",
"File saved" : "Le fichier a été enregistré",
"Insert image" : "Insérer une image",
- "Select recipients" : "Sélectionner les destinataires"
+ "Select recipients" : "Sélectionner les destinataires",
+ "Select file to compare" : "Sélectionner fichier à comparer"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/fr.json b/l10n/fr.json
index add34f70..99bd9654 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -60,6 +60,7 @@
"Save as" : "Enregistrer sous",
"File saved" : "Le fichier a été enregistré",
"Insert image" : "Insérer une image",
- "Select recipients" : "Sélectionner les destinataires"
+ "Select recipients" : "Sélectionner les destinataires",
+ "Select file to compare" : "Sélectionner fichier à comparer"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/pl.js b/l10n/pl.js
index 7a04645d..208e5dca 100644
--- a/l10n/pl.js
+++ b/l10n/pl.js
@@ -61,6 +61,7 @@ OC.L10N.register(
"Connect to demo ONLYOFFICE Document Server" : "Połącz się z serwerem demo ONLYOFFICE",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "To jest publiczny testowy serwer, proszę nie używać go do prywatnych danych. Serwer będzie dostępny przez 30 dni.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Upłyneło 30 dni, nie możesz się już łączyć z serwerem demo.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych.",
+ "Select tag" : "Wybierz tag"
},
"nplurals=2; plural=(n != 1);");
\ No newline at end of file
diff --git a/l10n/pl.json b/l10n/pl.json
index 72871e54..ed0ee596 100644
--- a/l10n/pl.json
+++ b/l10n/pl.json
@@ -59,6 +59,7 @@
"Connect to demo ONLYOFFICE Document Server" : "Połącz się z serwerem demo ONLYOFFICE",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "To jest publiczny testowy serwer, proszę nie używać go do prywatnych danych. Serwer będzie dostępny przez 30 dni.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "Upłyneło 30 dni, nie możesz się już łączyć z serwerem demo.",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Używasz publicznego serwera demo. Nie przechowuj tu prywatnych danych.",
+ "Select tag" : "Wybierz tag"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js
index b9974bad..bd0a26f1 100644
--- a/l10n/pt_BR.js
+++ b/l10n/pt_BR.js
@@ -63,6 +63,7 @@ OC.L10N.register(
"Save as" : "Salvar como",
"File saved" : "O arquivo foi salvo",
"Insert image" : "Inserir imagem",
- "Select recipients" : "Selecione os destinatários"
+ "Select recipients" : "Selecione os destinatários",
+ "Select file to compare" : "Selecionar arquivo para comparar"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json
index c2c7dd58..6d985c31 100644
--- a/l10n/pt_BR.json
+++ b/l10n/pt_BR.json
@@ -61,6 +61,7 @@
"Save as" : "Salvar como",
"File saved" : "O arquivo foi salvo",
"Insert image" : "Inserir imagem",
- "Select recipients" : "Selecione os destinatários"
+ "Select recipients" : "Selecione os destinatários",
+ "Select file to compare" : "Selecionar arquivo para comparar"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/ru.js b/l10n/ru.js
index c23b733d..76d16412 100644
--- a/l10n/ru.js
+++ b/l10n/ru.js
@@ -67,6 +67,7 @@ OC.L10N.register(
"Connect to demo ONLYOFFICE Document Server" : "Подключиться к демонстрационному Серверу Документов ONLYOFFICE",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Это публичный тестовый сервер, пожалуйста, не используйте его для личных конфиденциальных данных. Сервер будет доступен в течение 30 дней.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "30-дневный тестовый период закончен, вы больше не можете подключаться к демонстрационному Серверу Документов ONLYOFFICE",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные.",
+ "Select file to compare" : "Выбрать файл для сравнения"
},
"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);");
diff --git a/l10n/ru.json b/l10n/ru.json
index 63009300..1e174c23 100644
--- a/l10n/ru.json
+++ b/l10n/ru.json
@@ -65,6 +65,7 @@
"Connect to demo ONLYOFFICE Document Server" : "Подключиться к демонстрационному Серверу Документов ONLYOFFICE",
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Это публичный тестовый сервер, пожалуйста, не используйте его для личных конфиденциальных данных. Сервер будет доступен в течение 30 дней.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "30-дневный тестовый период закончен, вы больше не можете подключаться к демонстрационному Серверу Документов ONLYOFFICE",
- "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные."
+ "You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Вы используете публичный демонстрационный сервер документов ONLYOFFICE. Пожалуйста, не храните конфиденциальные данные.",
+ "Select file to compare" : "Выбрать файл для сравнения"
},"pluralForm" :"nplurals=3; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2);"
}
\ No newline at end of file
diff --git a/l10n/sv.js b/l10n/sv.js
index f7f22b0b..8d53de0f 100644
--- a/l10n/sv.js
+++ b/l10n/sv.js
@@ -66,5 +66,6 @@ OC.L10N.register(
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Detta är en offentlig testserver, använd den inte för privat känslig information. Servern kommer att finnas tillgänglig under en 30-dagarsperiod.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "När 30-dagars testperioden är över, kan du inte längre ansluta till demo ONLYOFFICE Dokumentserver.",
"You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du använder en offentlig demo ONLYOFFICE Dokumentserver. Lagra inte privat känslig information.",
+ "Select tag" : "Välj tagg"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/sv.json b/l10n/sv.json
index 67aeea77..2a033320 100644
--- a/l10n/sv.json
+++ b/l10n/sv.json
@@ -64,5 +64,6 @@
"This is a public test server, please do not use it for private sensitive data. The server will be available during a 30-day period." : "Detta är en offentlig testserver, använd den inte för privat känslig information. Servern kommer att finnas tillgänglig under en 30-dagarsperiod.",
"The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server." : "När 30-dagars testperioden är över, kan du inte längre ansluta till demo ONLYOFFICE Dokumentserver.",
"You are using public demo ONLYOFFICE Document Server. Please do not store private sensitive data." : "Du använder en offentlig demo ONLYOFFICE Dokumentserver. Lagra inte privat känslig information.",
+ "Select tag" : "Välj tagg"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
\ No newline at end of file
diff --git a/lib/adminsettings.php b/lib/adminsettings.php
index 44744e06..6995d23f 100644
--- a/lib/adminsettings.php
+++ b/lib/adminsettings.php
@@ -1,7 +1,7 @@
-