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
diff options
context:
space:
mode:
authorSergey Linnik <sergey.linnik@onlyoffice.com>2019-09-11 15:45:27 +0300
committerGitHub <noreply@github.com>2019-09-11 15:45:27 +0300
commitd890a58c3d08a91eeb64c5bcdfbe909c67da6a77 (patch)
tree92d6aac7db73defb9979eeec84db1ab0a71c17da
parent55fc8efa711298c18876a75f50a1348326a9c269 (diff)
parent406968196d11b15703bb6d176d1c8e3eb3212fad (diff)
Merge pull request #134 from ONLYOFFICE/developv3.0.0
Release/3.0.0
-rw-r--r--CHANGELOG.md11
-rw-r--r--appinfo/app.php2
-rw-r--r--appinfo/application.php2
-rw-r--r--appinfo/info.xml2
-rw-r--r--appinfo/routes.php5
-rw-r--r--assets/bg/new.docxbin6701 -> 6742 bytes
-rw-r--r--assets/bg/new.pptxbin28341 -> 28968 bytes
-rw-r--r--assets/bg/new.xlsxbin5655 -> 5609 bytes
-rw-r--r--assets/cs/new.docxbin7040 -> 7000 bytes
-rw-r--r--assets/cs/new.pptxbin34054 -> 33038 bytes
-rw-r--r--assets/de/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/de/new.pptxbin33551 -> 33054 bytes
-rw-r--r--assets/de_DE/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/de_DE/new.pptxbin33551 -> 33054 bytes
-rw-r--r--assets/el/new.docxbin7037 -> 6997 bytes
-rw-r--r--assets/el/new.pptxbin35679 -> 32997 bytes
-rw-r--r--assets/en/new.docxbin7034 -> 6994 bytes
-rw-r--r--assets/en/new.pptxbin33814 -> 32731 bytes
-rw-r--r--assets/en/new.xlsxbin6427 -> 5862 bytes
-rw-r--r--assets/es/new.docxbin7037 -> 6997 bytes
-rw-r--r--assets/es/new.pptxbin35670 -> 32727 bytes
-rw-r--r--assets/fr/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/fr/new.pptxbin35673 -> 32728 bytes
-rw-r--r--assets/it/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/it/new.pptxbin35675 -> 32729 bytes
-rw-r--r--assets/ko/new.docxbin7031 -> 6991 bytes
-rw-r--r--assets/ko/new.pptxbin35688 -> 32744 bytes
-rw-r--r--assets/nl/new.docxbin7042 -> 6998 bytes
-rw-r--r--assets/nl/new.pptxbin35675 -> 32731 bytes
-rw-r--r--assets/nl/new.xlsxbin14809 -> 5607 bytes
-rw-r--r--assets/pl/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/pl/new.pptxbin33811 -> 32730 bytes
-rw-r--r--assets/pt_BR/new.docxbin8551 -> 8508 bytes
-rw-r--r--assets/pt_BR/new.pptxbin30742 -> 32727 bytes
-rw-r--r--assets/pt_PT/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/pt_PT/new.pptxbin35671 -> 32730 bytes
-rw-r--r--assets/ru/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/ru/new.pptxbin34591 -> 33511 bytes
-rw-r--r--assets/sv/new.docxbin7920 -> 7880 bytes
-rw-r--r--assets/sv/new.pptxbin27401 -> 27325 bytes
-rw-r--r--assets/sv/new.xlsxbin5741 -> 5701 bytes
-rw-r--r--assets/zh_CN/new.docxbin7038 -> 6998 bytes
-rw-r--r--assets/zh_CN/new.pptxbin35683 -> 32736 bytes
-rw-r--r--controller/callbackcontroller.php19
-rw-r--r--controller/editorcontroller.php249
-rw-r--r--controller/settingscontroller.php64
-rw-r--r--css/editor.css2
-rw-r--r--css/main.css2
-rw-r--r--css/settings.css16
-rw-r--r--js/desktop.js2
-rw-r--r--js/editor.js106
-rw-r--r--js/main.js2
-rw-r--r--js/settings.js143
-rw-r--r--l10n/bg.js6
-rw-r--r--l10n/bg.json6
-rw-r--r--l10n/de.js25
-rw-r--r--l10n/de.json25
-rw-r--r--l10n/de_DE.js25
-rw-r--r--l10n/de_DE.json25
-rw-r--r--l10n/es.js8
-rw-r--r--l10n/es.json8
-rw-r--r--l10n/fr.js6
-rw-r--r--l10n/fr.json6
-rw-r--r--l10n/pt_BR.js8
-rw-r--r--l10n/pt_BR.json8
-rw-r--r--l10n/ru.js25
-rw-r--r--l10n/ru.json25
-rw-r--r--l10n/sv.js8
-rw-r--r--l10n/sv.json8
-rw-r--r--lib/adminsection.php2
-rw-r--r--lib/adminsettings.php2
-rw-r--r--lib/appconfig.php252
-rw-r--r--lib/crypt.php14
-rw-r--r--lib/documentservice.php12
-rw-r--r--templates/editor.php2
-rw-r--r--templates/settings.php157
76 files changed, 1157 insertions, 133 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d85a10c..5ed0dcd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,16 @@
# Change Log
+## 3.0.0
+## Added
+- "save as" to the folder
+- inserting images from the folder
+- Mail Merge
+- connection to the demo server
+- embedding a watermark
+
+## Changed
+- updated files for compatibility with MS Office v2016
+
## 2.4.0
## Added
- compatibility with encryption
diff --git a/appinfo/app.php b/appinfo/app.php
index e7d2480..767f25d 100644
--- a/appinfo/app.php
+++ b/appinfo/app.php
@@ -13,7 +13,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/appinfo/application.php b/appinfo/application.php
index d0a92fd..850ca6e 100644
--- a/appinfo/application.php
+++ b/appinfo/application.php
@@ -13,7 +13,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/appinfo/info.xml b/appinfo/info.xml
index e74f472..01d48e2 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -6,7 +6,7 @@
<description>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.</description>
<licence>agpl</licence>
<author mail="dev@onlyoffice.com" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
- <version>2.4.0</version>
+ <version>3.0.0</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
diff --git a/appinfo/routes.php b/appinfo/routes.php
index c5d16c1..e67f92f 100644
--- a/appinfo/routes.php
+++ b/appinfo/routes.php
@@ -13,7 +13,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.
@@ -37,8 +37,11 @@ return [
["name" => "editor#config", "url" => "/ajax/config/{fileId}", "verb" => "GET"],
["name" => "editor#create", "url" => "/ajax/new", "verb" => "POST"],
["name" => "editor#convert", "url" => "/ajax/convert", "verb" => "POST"],
+ ["name" => "editor#save", "url" => "/ajax/save", "verb" => "POST"],
+ ["name" => "editor#url", "url" => "/ajax/url", "verb" => "GET"],
["name" => "settings#save_address", "url" => "/ajax/settings/address", "verb" => "PUT"],
["name" => "settings#save_common", "url" => "/ajax/settings/common", "verb" => "PUT"],
+ ["name" => "settings#save_watermark", "url" => "/ajax/settings/watermark", "verb" => "PUT"],
["name" => "settings#get_settings", "url" => "/ajax/settings", "verb" => "GET"],
]
]; \ No newline at end of file
diff --git a/assets/bg/new.docx b/assets/bg/new.docx
index b26d321..c528e52 100644
--- a/assets/bg/new.docx
+++ b/assets/bg/new.docx
Binary files differ
diff --git a/assets/bg/new.pptx b/assets/bg/new.pptx
index 5bf9f50..d6273ae 100644
--- a/assets/bg/new.pptx
+++ b/assets/bg/new.pptx
Binary files differ
diff --git a/assets/bg/new.xlsx b/assets/bg/new.xlsx
index 79d0e09..43095f3 100644
--- a/assets/bg/new.xlsx
+++ b/assets/bg/new.xlsx
Binary files differ
diff --git a/assets/cs/new.docx b/assets/cs/new.docx
index 863bb2e..cd19d53 100644
--- a/assets/cs/new.docx
+++ b/assets/cs/new.docx
Binary files differ
diff --git a/assets/cs/new.pptx b/assets/cs/new.pptx
index 7e678b4..58b2f27 100644
--- a/assets/cs/new.pptx
+++ b/assets/cs/new.pptx
Binary files differ
diff --git a/assets/de/new.docx b/assets/de/new.docx
index 7697bab..c5c6daa 100644
--- a/assets/de/new.docx
+++ b/assets/de/new.docx
Binary files differ
diff --git a/assets/de/new.pptx b/assets/de/new.pptx
index a44d78a..44206d1 100644
--- a/assets/de/new.pptx
+++ b/assets/de/new.pptx
Binary files differ
diff --git a/assets/de_DE/new.docx b/assets/de_DE/new.docx
index 7697bab..c5c6daa 100644
--- a/assets/de_DE/new.docx
+++ b/assets/de_DE/new.docx
Binary files differ
diff --git a/assets/de_DE/new.pptx b/assets/de_DE/new.pptx
index a44d78a..44206d1 100644
--- a/assets/de_DE/new.pptx
+++ b/assets/de_DE/new.pptx
Binary files differ
diff --git a/assets/el/new.docx b/assets/el/new.docx
index b697181..ba5d6f1 100644
--- a/assets/el/new.docx
+++ b/assets/el/new.docx
Binary files differ
diff --git a/assets/el/new.pptx b/assets/el/new.pptx
index eaca76f..99e52bb 100644
--- a/assets/el/new.pptx
+++ b/assets/el/new.pptx
Binary files differ
diff --git a/assets/en/new.docx b/assets/en/new.docx
index 3433b6e..99c1e6e 100644
--- a/assets/en/new.docx
+++ b/assets/en/new.docx
Binary files differ
diff --git a/assets/en/new.pptx b/assets/en/new.pptx
index 904db46..f4e4bdf 100644
--- a/assets/en/new.pptx
+++ b/assets/en/new.pptx
Binary files differ
diff --git a/assets/en/new.xlsx b/assets/en/new.xlsx
index ab1038c..4bc868d 100644
--- a/assets/en/new.xlsx
+++ b/assets/en/new.xlsx
Binary files differ
diff --git a/assets/es/new.docx b/assets/es/new.docx
index 5354fac..40a6fb6 100644
--- a/assets/es/new.docx
+++ b/assets/es/new.docx
Binary files differ
diff --git a/assets/es/new.pptx b/assets/es/new.pptx
index ce9934e..7aa064e 100644
--- a/assets/es/new.pptx
+++ b/assets/es/new.pptx
Binary files differ
diff --git a/assets/fr/new.docx b/assets/fr/new.docx
index 04cf5f9..865113e 100644
--- a/assets/fr/new.docx
+++ b/assets/fr/new.docx
Binary files differ
diff --git a/assets/fr/new.pptx b/assets/fr/new.pptx
index 6eaf4e0..c60475d 100644
--- a/assets/fr/new.pptx
+++ b/assets/fr/new.pptx
Binary files differ
diff --git a/assets/it/new.docx b/assets/it/new.docx
index e84d795..c40e445 100644
--- a/assets/it/new.docx
+++ b/assets/it/new.docx
Binary files differ
diff --git a/assets/it/new.pptx b/assets/it/new.pptx
index 457b1a1..739b1e8 100644
--- a/assets/it/new.pptx
+++ b/assets/it/new.pptx
Binary files differ
diff --git a/assets/ko/new.docx b/assets/ko/new.docx
index 6f331d4..bfbe091 100644
--- a/assets/ko/new.docx
+++ b/assets/ko/new.docx
Binary files differ
diff --git a/assets/ko/new.pptx b/assets/ko/new.pptx
index 5b4ac96..d4ce762 100644
--- a/assets/ko/new.pptx
+++ b/assets/ko/new.pptx
Binary files differ
diff --git a/assets/nl/new.docx b/assets/nl/new.docx
index c0e4917..dc35bd3 100644
--- a/assets/nl/new.docx
+++ b/assets/nl/new.docx
Binary files differ
diff --git a/assets/nl/new.pptx b/assets/nl/new.pptx
index b28324c..d85f561 100644
--- a/assets/nl/new.pptx
+++ b/assets/nl/new.pptx
Binary files differ
diff --git a/assets/nl/new.xlsx b/assets/nl/new.xlsx
index 3472c3b..a2c3891 100644
--- a/assets/nl/new.xlsx
+++ b/assets/nl/new.xlsx
Binary files differ
diff --git a/assets/pl/new.docx b/assets/pl/new.docx
index e97de5c..9964336 100644
--- a/assets/pl/new.docx
+++ b/assets/pl/new.docx
Binary files differ
diff --git a/assets/pl/new.pptx b/assets/pl/new.pptx
index 1686a4f..1f543d4 100644
--- a/assets/pl/new.pptx
+++ b/assets/pl/new.pptx
Binary files differ
diff --git a/assets/pt_BR/new.docx b/assets/pt_BR/new.docx
index a924ff6..70554fd 100644
--- a/assets/pt_BR/new.docx
+++ b/assets/pt_BR/new.docx
Binary files differ
diff --git a/assets/pt_BR/new.pptx b/assets/pt_BR/new.pptx
index 2656449..73a85ae 100644
--- a/assets/pt_BR/new.pptx
+++ b/assets/pt_BR/new.pptx
Binary files differ
diff --git a/assets/pt_PT/new.docx b/assets/pt_PT/new.docx
index 700f7e3..ebe556f 100644
--- a/assets/pt_PT/new.docx
+++ b/assets/pt_PT/new.docx
Binary files differ
diff --git a/assets/pt_PT/new.pptx b/assets/pt_PT/new.pptx
index 0f18234..7395b3b 100644
--- a/assets/pt_PT/new.pptx
+++ b/assets/pt_PT/new.pptx
Binary files differ
diff --git a/assets/ru/new.docx b/assets/ru/new.docx
index 875dad5..ab7bd1c 100644
--- a/assets/ru/new.docx
+++ b/assets/ru/new.docx
Binary files differ
diff --git a/assets/ru/new.pptx b/assets/ru/new.pptx
index 0848cb7..868a23c 100644
--- a/assets/ru/new.pptx
+++ b/assets/ru/new.pptx
Binary files differ
diff --git a/assets/sv/new.docx b/assets/sv/new.docx
index 84a1020..b341ecc 100644
--- a/assets/sv/new.docx
+++ b/assets/sv/new.docx
Binary files differ
diff --git a/assets/sv/new.pptx b/assets/sv/new.pptx
index f59d9bd..55b1a81 100644
--- a/assets/sv/new.pptx
+++ b/assets/sv/new.pptx
Binary files differ
diff --git a/assets/sv/new.xlsx b/assets/sv/new.xlsx
index 3a4fac6..ce7c1b4 100644
--- a/assets/sv/new.xlsx
+++ b/assets/sv/new.xlsx
Binary files differ
diff --git a/assets/zh_CN/new.docx b/assets/zh_CN/new.docx
index d0262e2..f74a729 100644
--- a/assets/zh_CN/new.docx
+++ b/assets/zh_CN/new.docx
Binary files differ
diff --git a/assets/zh_CN/new.pptx b/assets/zh_CN/new.pptx
index d4b5985..4ab6f7e 100644
--- a/assets/zh_CN/new.pptx
+++ b/assets/zh_CN/new.pptx
Binary files differ
diff --git a/controller/callbackcontroller.php b/controller/callbackcontroller.php
index 73ffe3a..476d841 100644
--- a/controller/callbackcontroller.php
+++ b/controller/callbackcontroller.php
@@ -13,7 +13,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.
@@ -346,7 +346,6 @@ class CallbackController extends Controller {
try {
$decodedHeader = \Firebase\JWT\JWT::decode($header, $this->config->GetDocumentServerSecret(), array("HS256"));
- $this->logger->debug("Track HEADER : " . json_encode($decodedHeader), array("app" => $this->appName));
$payload = $decodedHeader->payload;
} catch (\UnexpectedValueException $e) {
@@ -400,21 +399,7 @@ class CallbackController extends Controller {
return $error;
}
- $documentServerUrl = $this->config->GetDocumentServerInternalUrl(true);
- if (!empty($documentServerUrl)) {
- $from = $this->config->GetDocumentServerUrl();
-
- if (!preg_match("/^https?:\/\//i", $from)) {
- $parsedUrl = parse_url($url);
- $from = $parsedUrl["scheme"] . "://" . $parsedUrl["host"] . (array_key_exists("port", $parsedUrl) ? (":" . $parsedUrl["port"]) : "") . $from;
- }
-
- if ($from !== $documentServerUrl)
- {
- $this->logger->debug("Replace in track from " . $from . " to " . $documentServerUrl, array("app" => $this->appName));
- $url = str_replace($from, $documentServerUrl, $url);
- }
- }
+ $url = $this->config->ReplaceDocumentServerUrlToInternal($url);
$fileName = $file->getName();
$curExt = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index 4c0c9ac..01f0e91 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -13,7 +13,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.
@@ -221,7 +221,7 @@ class EditorController extends Controller {
$ext = strtolower("." . pathinfo($name, PATHINFO_EXTENSION));
- $lang = \OC::$server->getL10NFactory("")->get("")->getLanguageCode();
+ $lang = $this->trans->getLanguageCode();
$templatePath = $this->getTemplatePath($lang, $ext);
if (!file_exists($templatePath)) {
@@ -366,6 +366,113 @@ class EditorController extends Controller {
}
/**
+ * Save file to folder
+ *
+ * @param string $name - file name
+ * @param string $dir - folder path
+ * @param string $url - file url
+ *
+ * @return array
+ *
+ * @NoAdminRequired
+ */
+ public function save($name, $dir, $url) {
+ $this->logger->debug("Save: " . $name, array("app" => $this->appName));
+
+ if (!$this->config->isUserAllowedToUse()) {
+ return ["error" => $this->trans->t("Not permitted")];
+ }
+
+ $userId = $this->userSession->getUser()->getUID();
+ $userFolder = $this->root->getUserFolder($userId);
+
+ $folder = $userFolder->get($dir);
+
+ if ($folder === NULL) {
+ $this->logger->error("Folder for saving file was not found: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("The required folder was not found")];
+ }
+ if (!$folder->isCreatable()) {
+ $this->logger->error("Folder for saving file without permission: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("You don't have enough permission to create")];
+ }
+
+ $url = $this->config->ReplaceDocumentServerUrlToInternal($url);
+
+ try {
+ $documentService = new DocumentService($this->trans, $this->config);
+ $newData = $documentService->Request($url);
+ } catch (\Exception $e) {
+ $this->logger->error("Failed to download file for saving: " . $url . " " . $e->getMessage(), array("app" => $this->appName));
+ return ["error" => $this->trans->t("Download failed")];
+ }
+
+ $name = $folder->getNonExistingName($name);
+
+ try {
+ $file = $folder->newFile($name);
+
+ $file->putContent($newData);
+ } catch (NotPermittedException $e) {
+ $this->logger->error("Can't save file: " . $name, array("app" => $this->appName));
+ return ["error" => $this->trans->t("Can't create file")];
+ }
+
+ $fileInfo = $file->getFileInfo();
+
+ $result = Helper::formatFileInfo($fileInfo);
+ return $result;
+ }
+
+ /**
+ * Get presigned url to file
+ *
+ * @param string $filePath - file path
+ *
+ * @return array
+ *
+ * @NoAdminRequired
+ */
+ public function url($filePath) {
+ $this->logger->debug("Save: " . $name, array("app" => $this->appName));
+
+ if (!$this->config->isUserAllowedToUse()) {
+ return ["error" => $this->trans->t("Not permitted")];
+ }
+
+ $userId = $this->userSession->getUser()->getUID();
+ $userFolder = $this->root->getUserFolder($userId);
+
+ $file = $userFolder->get($filePath);
+
+ if ($file === NULL) {
+ $this->logger->error("File for generate presigned url was not found: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("File not found")];
+ }
+ if (!$file->isReadable()) {
+ $this->logger->error("Folder for saving file without permission: " . $dir, array("app" => $this->appName));
+ return ["error" => $this->trans->t("You do not have enough permissions to view the file")];
+ }
+
+ $fileName = $file->getName();
+ $ext = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
+ $fileId = $file->getId();
+ $fileUrl = $this->getUrl($fileId);
+
+ $result = [
+ "fileType" => $ext,
+ "url" => $fileUrl
+ ];
+
+ if (!empty($this->config->GetDocumentServerSecret())) {
+ $token = \Firebase\JWT\JWT::encode($result, $this->config->GetDocumentServerSecret());
+ $result["token"] = $token;
+ }
+
+ return $result;
+ }
+
+ /**
* Print editor section
*
* @param integer $fileId - file identifier
@@ -491,11 +598,12 @@ class EditorController extends Controller {
],
"documentType" => $format["type"],
"editorConfig" => [
- "lang" => str_replace("_", "-", \OC::$server->getL10NFactory("")->get("")->getLanguageCode())
+ "lang" => str_replace("_", "-", $this->trans->getLanguageCode()),
+ "region" => str_replace("_", "-", \OC::$server->getL10NFactory("")->findLocale())
]
];
- $permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter);
+ $permissions_modifyFilter = $this->config->GetSystemValue($this->config->_permissions_modifyFilter);
if (isset($permissions_modifyFilter)) {
$params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter;
}
@@ -503,6 +611,7 @@ class EditorController extends Controller {
$canEdit = isset($format["edit"]) && $format["edit"];
$editable = $file->isUpdateable()
&& (empty($token) || ($share->getPermissions() & Constants::PERMISSION_UPDATE) === Constants::PERMISSION_UPDATE);
+ $params["document"]["permissions"]["edit"] = $editable;
if ($editable && $canEdit) {
$ownerId = NULL;
$owner = $file->getOwner();
@@ -537,10 +646,8 @@ class EditorController extends Controller {
if (!empty($token)) {
if (method_exists($share, "getHideDownload") && $share->getHideDownload()) {
- $params["document"]["permissions"] = [
- "download" => false,
- "print" => false
- ];
+ $params["document"]["permissions"]["download"] = false;
+ $params["document"]["permissions"]["print"] = false;
}
$node = $share->getNode();
@@ -582,6 +689,12 @@ class EditorController extends Controller {
$params = $this->setCustomization($params);
+ $params = $this->setWatermark($params, !empty($token), $userId, $fileId);
+
+ if ($this->config->UseDemo()) {
+ $params["editorConfig"]["tenant"] = $this->config->GetSystemValue("instanceid", true);
+ }
+
if (!empty($this->config->GetDocumentServerSecret())) {
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
$params["token"] = $token;
@@ -730,7 +843,7 @@ class EditorController extends Controller {
* @return string
*/
private function getKey($file) {
- $instanceId = $this->config->getSystemValue("instanceid", true);
+ $instanceId = $this->config->GetSystemValue("instanceid", true);
$fileId = $file->getId();
@@ -802,27 +915,27 @@ class EditorController extends Controller {
/* from system config */
- $customer = $this->config->getSystemValue($this->config->_customization_customer);
+ $customer = $this->config->GetSystemValue($this->config->_customization_customer);
if (isset($customer)) {
$params["editorConfig"]["customization"]["customer"] = $customer;
}
- $feedback = $this->config->getSystemValue($this->config->_customization_feedback);
+ $feedback = $this->config->GetSystemValue($this->config->_customization_feedback);
if (isset($feedback)) {
$params["editorConfig"]["customization"]["feedback"] = $feedback;
}
- $loaderLogo = $this->config->getSystemValue($this->config->_customization_loaderLogo);
+ $loaderLogo = $this->config->GetSystemValue($this->config->_customization_loaderLogo);
if (isset($loaderLogo)) {
$params["editorConfig"]["customization"]["loaderLogo"] = $loaderLogo;
}
- $loaderName = $this->config->getSystemValue($this->config->_customization_loaderName);
+ $loaderName = $this->config->GetSystemValue($this->config->_customization_loaderName);
if (isset($loaderName)) {
$params["editorConfig"]["customization"]["loaderName"] = $loaderName;
}
- $logo = $this->config->getSystemValue($this->config->_customization_logo);
+ $logo = $this->config->GetSystemValue($this->config->_customization_logo);
if (isset($logo)) {
$params["editorConfig"]["customization"]["logo"] = $logo;
}
@@ -831,6 +944,114 @@ class EditorController extends Controller {
}
/**
+ * Set watermark parameters
+ *
+ * @param array params - file parameters
+ * @param bool isPublic - with access token
+ * @param string userId - user identifier
+ * @param string fileId - file identifier
+ *
+ * @return array
+ */
+ private function setWatermark($params, $isPublic, $userId, $fileId) {
+ $watermarkTemplate = $this->getWatermarkText($isPublic, $userId, $fileId,
+ $params["document"]["permissions"]["edit"] !== false,
+ $params["document"]["permissions"]["download"] !== false);
+
+ if ($watermarkTemplate !== false) {
+ $replacements = [
+ "userId" => $userId,
+ "date" => (new \DateTime())->format("Y-m-d H:i:s"),
+ "themingName" => \OC::$server->getThemingDefaults()->getName()
+ ];
+ $watermarkTemplate = preg_replace_callback("/{(.+?)}/", function($matches) use ($replacements)
+ {
+ return $replacements[$matches[1]];
+ }, $watermarkTemplate);
+
+ $params["document"]["options"] = [
+ "watermark_on_draw" => [
+ "align" => 1,
+ "height" => 100,
+ "paragraphs" => array([
+ "align" => 2,
+ "runs" => array([
+ "fill" => [182, 182, 182],
+ "font-size" => 70,
+ "text" => $watermarkTemplate,
+ ])
+ ]),
+ "rotate" => -45,
+ "width" => 250,
+ ]
+ ];
+ }
+
+ return $params;
+ }
+
+ /**
+ * Should watermark
+ *
+ * @return bool|string
+ */
+ private function getWatermarkText($isPublic, $userId, $fileId, $canEdit, $canDownload) {
+ $watermarkSettings = $this->config->GetWatermarkSettings();
+ if (!$watermarkSettings["enabled"]) {
+ return false;
+ }
+
+ $watermarkText = $watermarkSettings["text"];
+
+ if ($isPublic) {
+ if ($watermarkSettings["linkAll"]) {
+ return $watermarkText;
+ }
+ if ($watermarkSettings["linkRead"] && !$canEdit) {
+ return $watermarkText;
+ }
+ if ($watermarkSettings["linkSecure"] && !$canDownload) {
+ return $watermarkText;
+ }
+ if ($watermarkSettings["linkTags"]) {
+ $tags = $watermarkSettings["linkTagsList"];
+ $fileTags = \OC::$server->getSystemTagObjectMapper()->getTagIdsForObjects([$fileId], "files")[$fileId];
+ foreach ($fileTags as $tagId) {
+ if (in_array($tagId, $tags, true)) {
+ return $watermarkText;
+ }
+ }
+ }
+ } else {
+ if ($watermarkSettings["shareAll"]) {
+ return $watermarkText;
+ }
+ if ($watermarkSettings["shareRead"] && !$canEdit) {
+ return $watermarkText;
+ }
+ }
+ if ($watermarkSettings["allGroups"]) {
+ $groups = $watermarkSettings["allGroupsList"];
+ foreach ($groups as $group) {
+ if (\OC::$server->getGroupManager()->isInGroup($userId, $group)) {
+ return $watermarkText;
+ }
+ }
+ }
+ if ($watermarkSettings["allTags"]) {
+ $tags = $watermarkSettings["allTagsList"];
+ $fileTags = \OC::$server->getSystemTagObjectMapper()->getTagIdsForObjects([$fileId], "files")[$fileId];
+ foreach ($fileTags as $tagId) {
+ if (in_array($tagId, $tags, true)) {
+ return $watermarkText;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
* Print error page
*
* @param string $error - error message
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php
index 6d1954d..cc95930 100644
--- a/controller/settingscontroller.php
+++ b/controller/settingscontroller.php
@@ -13,7 +13,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.
@@ -29,6 +29,7 @@
namespace OCA\Onlyoffice\Controller;
+use OCP\App;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\IL10N;
@@ -113,10 +114,11 @@ class SettingsController extends Controller {
*/
public function index() {
$data = [
- "documentserver" => $this->config->GetDocumentServerUrl(),
+ "documentserver" => $this->config->GetDocumentServerUrl(true),
"documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true),
"storageUrl" => $this->config->GetStorageUrl(),
- "secret" => $this->config->GetDocumentServerSecret(),
+ "secret" => $this->config->GetDocumentServerSecret(true),
+ "demo" => $this->config->GetDemoData(),
"currentServer" => $this->urlGenerator->getAbsoluteURL("/"),
"formats" => $this->config->FormatsSetting(),
"sameTab" => $this->config->GetSameTab(),
@@ -126,7 +128,9 @@ class SettingsController extends Controller {
"feedback" => $this->config->GetCustomizationFeedback(),
"help" => $this->config->GetCustomizationHelp(),
"toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(),
- "successful" => $this->config->SettingsAreSuccessful()
+ "successful" => $this->config->SettingsAreSuccessful(),
+ "watermark" => $this->config->GetWatermarkSettings(),
+ "tagsEnabled" => App::isEnabled("systemtags")
];
return new TemplateResponse($this->appName, "settings", $data, "blank");
}
@@ -138,31 +142,39 @@ class SettingsController extends Controller {
* @param string $documentserverInternal - document service address available from Nextcloud
* @param string $storageUrl - Nextcloud address available from document server
* @param string $secret - secret key for signature
+ * @param bool $demo - use demo server
*
* @return array
*/
public function SaveAddress($documentserver,
$documentserverInternal,
$storageUrl,
- $secret
+ $secret,
+ $demo
) {
- $this->config->SetDocumentServerUrl($documentserver);
- $this->config->SetDocumentServerInternalUrl($documentserverInternal);
+ if (!$this->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.");
+ }
+ if ($demo !== true) {
+ $this->config->SetDocumentServerUrl($documentserver);
+ $this->config->SetDocumentServerInternalUrl($documentserverInternal);
+ $this->config->SetDocumentServerSecret($secret);
+ }
$this->config->SetStorageUrl($storageUrl);
- $this->config->SetDocumentServerSecret($secret);
- $documentserver = $this->config->GetDocumentServerUrl();
- $error = NULL;
- if (!empty($documentserver)) {
- $error = $this->checkDocServiceUrl();
- $this->config->SetSettingsError($error);
+ if (empty($error)) {
+ $documentserver = $this->config->GetDocumentServerUrl();
+ if (!empty($documentserver)) {
+ $error = $this->checkDocServiceUrl();
+ $this->config->SetSettingsError($error);
+ }
}
return [
- "documentserver" => $this->config->GetDocumentServerUrl(),
+ "documentserver" => $this->config->GetDocumentServerUrl(true),
"documentserverInternal" => $this->config->GetDocumentServerInternalUrl(true),
"storageUrl" => $this->config->GetStorageUrl(),
- "secret" => $this->config->GetDocumentServerSecret(),
+ "secret" => $this->config->GetDocumentServerSecret(true),
"error" => $error
];
}
@@ -208,6 +220,28 @@ class SettingsController extends Controller {
}
/**
+ * Save watermark settings
+ *
+ * @param array $settings - watermark settings
+ *
+ * @return array
+ */
+ public function SaveWatermark($settings) {
+
+ if ($settings["enabled"] === "true") {
+ $settings["text"] = ($settings["text"]).trim();
+ if (empty($settings["text"])) {
+ $settings["text"] = $this->trans->t("DO NOT SHARE THIS") . " {userId} {date}";
+ }
+ }
+
+ $this->config->SetWatermarkSettings($settings);
+
+ return [
+ ];
+ }
+
+ /**
* Get app settings
*
* @return array
diff --git a/css/editor.css b/css/editor.css
index 69f82c7..7cfebd3 100644
--- a/css/editor.css
+++ b/css/editor.css
@@ -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/css/main.css b/css/main.css
index b8adbeb..513c9a8 100644
--- a/css/main.css
+++ b/css/main.css
@@ -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/css/settings.css b/css/settings.css
index bec6706..9960534 100644
--- a/css/settings.css
+++ b/css/settings.css
@@ -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.
@@ -49,8 +49,20 @@
display: inline-block;
margin-bottom: -3px;
}
-#s2id_onlyofficeLimitGroups {
+#onlyofficeAddrSave {
+ float: left;
+}
+.onlyoffice-demo {
+ margin-left: 90px;
+}
+#s2id_onlyofficeLimitGroups,
+#s2id_onlyofficeWatermark_allGroupsList,
+#s2id_onlyofficeWatermark_allTagsList,
+#s2id_onlyofficeWatermark_linkTagsList {
margin-bottom: 16px;
+ margin-left: 18px;
+ margin-top: 6px;
+ width: 250px;
}
.onlyoffice-exts {
column-width: 100px;
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 bc10d1e..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;
@@ -92,7 +96,7 @@
docIsChanged = event.data;
};
- if (event.data) {
+ if (event === false || event.data) {
titleChange();
} else {
docIsChangedTimeout = setTimeout(titleChange, 500);
@@ -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 052a321..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.
@@ -46,13 +46,11 @@
advToogle();
}
- $("#onlyofficeAdv").click(function () {
- advToogle();
- });
+ $("#onlyofficeAdv").click(advToogle);
$("#onlyofficeGroups").prop("checked", $("#onlyofficeLimitGroups").val() != "");
- var groupListToggle = function() {
+ var groupListToggle = function () {
if ($("#onlyofficeGroups").prop("checked")) {
OC.Settings.setupGroupsSelect($("#onlyofficeLimitGroups"));
} else {
@@ -63,6 +61,83 @@
$("#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"));
+ };
+
+ $("#onlyofficeWatermark_enabled").click(watermarkToggle)
+
+ $("#onlyofficeWatermark_shareAll").click(function () {
+ $("#onlyofficeWatermark_shareRead").parent().toggleClass("onlyoffice-hide");
+ });
+
+ $("#onlyofficeWatermark_linkAll").click(function () {
+ $("#onlyofficeWatermark_link_sensitive").toggleClass("onlyoffice-hide");
+ });
+
+ var watermarkLists = [
+ "allGroups",
+ "allTags",
+ "linkTags",
+ ];
+ $.each(watermarkLists, function(i, watermarkList) {
+ var watermarkListToggle = function() {
+ if ($("#onlyofficeWatermark_" + watermarkList).prop("checked")) {
+ if (watermarkList.indexOf("Group") >= 0) {
+ OC.Settings.setupGroupsSelect($("#onlyofficeWatermark_" + watermarkList + "List"));
+ } else {
+ OC.SystemTags.collection.fetch({
+ success: function() {
+ $("#onlyofficeWatermark_" + watermarkList + "List").select2({
+ allowClear: true,
+ closeOnSelect: false,
+ multiple: true,
+ separator: "|",
+ toggleSelect: true,
+ placeholder: t("systemtags_manager", "Select tag"),
+ query: _.debounce(function(query) {
+ query.callback({
+ results: OC.SystemTags.collection.filterByName(query.term)
+ });
+ }, 100, true),
+ initSelection: function(element, callback) {
+ var selection = ($(element).val() || []).split("|").map(function(tagId){
+ return OC.SystemTags.collection.get(tagId);
+ });
+ callback(selection);
+ },
+ formatResult: function (tag) {
+ return OC.SystemTags.getDescriptiveTag(tag);
+ },
+ formatSelection: function (tag) {
+ return tag.get("name");
+ },
+ sortResults: function(results) {
+ results.sort(function(a, b) {
+ return OC.Util.naturalSortCompare(a.get("name"), b.get("name"));
+ });
+ return results;
+ }
+ });
+ }
+ });
+ }
+ } else {
+ $("#onlyofficeWatermark_" + watermarkList + "List").select2("destroy");
+ }
+ };
+
+ $("#onlyofficeWatermark_" + watermarkList).click(watermarkListToggle);
+ watermarkListToggle();
+ });
+
$("#onlyofficeAddrSave").click(function () {
$(".section-onlyoffice").addClass("icon-loading");
@@ -75,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",
@@ -83,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-2").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
@@ -158,7 +235,55 @@
});
});
- $(".section-onlyoffice input").keypress(function (e) {
+ $("#onlyofficeWatermarkSave").click(function () {
+ $(".section-onlyoffice").addClass("icon-loading");
+
+ var watermarkSettings = {
+ enabled: $("#onlyofficeWatermark_enabled").is(":checked")
+ };
+ if (watermarkSettings.enabled) {
+ watermarkSettings.text = ($("#onlyofficeWatermark_text").val() || "").trim();
+
+ var watermarkLabels = [
+ "allGroups",
+ "allTags",
+ "linkAll",
+ "linkRead",
+ "linkSecure",
+ "linkTags",
+ "shareAll",
+ "shareRead"
+ ];
+ $.each(watermarkLabels, function (i, watermarkLabel) {
+ watermarkSettings[watermarkLabel] = $("#onlyofficeWatermark_" + watermarkLabel).is(":checked");
+ });
+
+ $.each(watermarkLists, function (i, watermarkList) {
+ var list = $("#onlyofficeWatermark_" + watermarkList).is(":checked") ? $("#onlyofficeWatermark_" + watermarkList + "List").val() : "";
+ watermarkSettings[watermarkList + "List"] = list ? list.split("|") : [];
+ });
+
+ }
+
+ $.ajax({
+ method: "PUT",
+ url: OC.generateUrl("apps/" + OCA.Onlyoffice.AppName + "/ajax/settings/watermark"),
+ data: {
+ settings: watermarkSettings
+ },
+ success: function onSuccess(response) {
+ $(".section-onlyoffice").removeClass("icon-loading");
+ if (response) {
+ var message = t(OCA.Onlyoffice.AppName, "Settings have been successfully updated");
+ OC.Notification.show(message, {
+ timeout: 3
+ });
+ }
+ }
+ });
+ });
+
+ $(".section-onlyoffice-addr input").keypress(function (e) {
var code = e.keyCode || e.which;
if (code === 13) {
$("#onlyofficeAddrSave").click();
diff --git a/l10n/bg.js b/l10n/bg.js
index 95437bd..d583834 100644
--- a/l10n/bg.js
+++ b/l10n/bg.js
@@ -44,6 +44,10 @@ OC.L10N.register(
"View details" : "Виж детайли",
"Save" : "Запази",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
- "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи"
+ "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи",
+ "Save as" : "Запази като",
+ "File saved" : "Файлът е запазен",
+ "Insert image" : "Вмъкване на изображение",
+ "Select recipients" : "Изберете получатели"
},
"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/bg.json b/l10n/bg.json
index 85412b0..925e0ba 100644
--- a/l10n/bg.json
+++ b/l10n/bg.json
@@ -42,6 +42,10 @@
"View details" : "Виж детайли",
"Save" : "Запази",
"Mixed Active Content is not allowed. HTTPS address for Document Server is required." : "Смесеното активно съдържание е недопустимо. За услугата за редактиране на документи е необходимо използването на HTTPS-адрес.",
- "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи"
+ "Restrict access to editors to following groups" : "Разреши достъп до редакторите само за тези групи",
+ "Save as" : "Запази като",
+ "File saved" : "Файлът е запазен",
+ "Insert image" : "Вмъкване на изображение",
+ "Select recipients" : "Изберете получатели"
},"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/de.js b/l10n/de.js
index 118a77b..1fcb97c 100644
--- a/l10n/de.js
+++ b/l10n/de.js
@@ -53,6 +53,29 @@ OC.L10N.register(
"Display the header more compact" : "Kompakten Header anzeigen",
"Display Feedback & Support menu button" : "Feedback-& Support-Taste anzeigen",
"Display Help menu button" : "Hilfetaste anzeigen",
- "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen"
+ "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
+ "Save as" : "Speichern als",
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen",
+ "Select recipients" : "Empfänger auswählen",
+ "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.",
+ "Secure view settings" : "Einstellungen für Sichere Ansicht",
+ "Secure view enables you to secure documents by embedding a watermark" : "Sichere Ansicht ermöglicht Dir Dokumente durch Einbettung eines Wasserzeichens abzusichern",
+ "Enable watermarking" : "Wasserzeichenmarkierung aktivieren",
+ "Watermark text" : "Wasserzeichen-Text",
+ "DO NOT SHARE THIS" : "NICHT TEILEN",
+ "Show watermark on tagged files" : "Wasserzeichen auf getaggten Dateien anzeigen",
+ "Show watermark for users of groups" : "Wasserzeichen für Benutzer der angegebenen Gruppen anzeigen",
+ "Supported placeholders" : "Unterstützte Platzhalter",
+ "Show watermark for all shares" : "Wasserzeichen auf allen Freigaben anzeigen",
+ "Show watermark for read only shares" : "Wasserzeichen auf schreibgeschützten Freigaben anzeigen",
+ "Link shares" : "Link-Freigaben",
+ "Show watermark for all link shares" : "Wasserzeichen auf allen Link-Freigaben anzeigen",
+ "Show watermark for download hidden shares" : "Wasserzeichen auf ‘Download verbergen’ Freigaben anzeigen",
+ "Show watermark for read only link shares" : "Wasserzeichen auf schreibgeschützten Link-Freigaben anzeigen",
+ "Show watermark on link shares with specific system tags" : "Wasserzeichen auf Link-Freigaben mit bestimmten System-Tags anzeigen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de.json b/l10n/de.json
index f3454c6..2391914 100644
--- a/l10n/de.json
+++ b/l10n/de.json
@@ -51,6 +51,29 @@
"Display the header more compact" : "Kompakten Header anzeigen",
"Display Feedback & Support menu button" : "Feedback-& Support-Taste anzeigen",
"Display Help menu button" : "Hilfetaste anzeigen",
- "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen"
+ "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
+ "Save as" : "Speichern als",
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen",
+ "Select recipients" : "Empfänger auswählen",
+ "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.",
+ "Secure view settings" : "Einstellungen für Sichere Ansicht",
+ "Secure view enables you to secure documents by embedding a watermark" : "Sichere Ansicht ermöglicht Dir Dokumente durch Einbettung eines Wasserzeichens abzusichern",
+ "Enable watermarking" : "Wasserzeichenmarkierung aktivieren",
+ "Watermark text" : "Wasserzeichen-Text",
+ "DO NOT SHARE THIS" : "NICHT TEILEN",
+ "Show watermark on tagged files" : "Wasserzeichen auf getaggten Dateien anzeigen",
+ "Show watermark for users of groups" : "Wasserzeichen für Benutzer der angegebenen Gruppen anzeigen",
+ "Supported placeholders" : "Unterstützte Platzhalter",
+ "Show watermark for all shares" : "Wasserzeichen auf allen Freigaben anzeigen",
+ "Show watermark for read only shares" : "Wasserzeichen auf schreibgeschützten Freigaben anzeigen",
+ "Link shares" : "Link-Freigaben",
+ "Show watermark for all link shares" : "Wasserzeichen auf allen Link-Freigaben anzeigen",
+ "Show watermark for download hidden shares" : "Wasserzeichen auf ‘Download verbergen’ Freigaben anzeigen",
+ "Show watermark for read only link shares" : "Wasserzeichen auf schreibgeschützten Link-Freigaben anzeigen",
+ "Show watermark on link shares with specific system tags" : "Wasserzeichen auf Link-Freigaben mit bestimmten System-Tags anzeigen"
},"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 103a2fc..fae5de4 100644
--- a/l10n/de_DE.js
+++ b/l10n/de_DE.js
@@ -53,6 +53,29 @@ OC.L10N.register(
"Display the header more compact" : "Kompakten Header anzeigen",
"Display Feedback & Support menu button" : "Feedback-& Support-Taste anzeigen",
"Display Help menu button" : "Hilfetaste anzeigen",
- "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen"
+ "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
+ "Save as" : "Speichern als",
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen",
+ "Select recipients" : "Empfänger auswählen",
+ "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.",
+ "Secure view settings" : "Einstellungen für Sichere Ansicht",
+ "Secure view enables you to secure documents by embedding a watermark" : "Sichere Ansicht ermöglicht Ihnen Dokumente durch Einbettung eines Wasserzeichens abzusichern",
+ "Enable watermarking" : "Wasserzeichenmarkierung aktivieren",
+ "Watermark text" : "Wasserzeichen-Text",
+ "DO NOT SHARE THIS" : "NICHT TEILEN ",
+ "Show watermark on tagged files" : "Wasserzeichen auf getaggten Dateien anzeigen",
+ "Show watermark for users of groups" : "Wasserzeichen für Benutzer der angegebenen Gruppen anzeigen",
+ "Supported placeholders" : "Unterstützte Platzhalter",
+ "Show watermark for all shares" : "Wasserzeichen auf allen Freigaben anzeigen",
+ "Show watermark for read only shares" : "Wasserzeichen auf schreibgeschützten Freigaben anzeigen",
+ "Link shares" : "Link-Freigaben",
+ "Show watermark for all link shares" : "Wasserzeichen auf allen Link-Freigaben anzeigen",
+ "Show watermark for download hidden shares" : "Wasserzeichen auf ‘Download verbergen’ Freigaben anzeigen",
+ "Show watermark for read only link shares" : "Wasserzeichen auf schreibgeschützten Link-Freigaben anzeigen",
+ "Show watermark on link shares with specific system tags" : "Wasserzeichen auf Link-Freigaben mit bestimmten System-Tags anzeigen"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/de_DE.json b/l10n/de_DE.json
index fe02df9..1903bf7 100644
--- a/l10n/de_DE.json
+++ b/l10n/de_DE.json
@@ -51,6 +51,29 @@
"Display the header more compact" : "Kompakten Header anzeigen",
"Display Feedback & Support menu button" : "Feedback-& Support-Taste anzeigen",
"Display Help menu button" : "Hilfetaste anzeigen",
- "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen"
+ "Display toolbar tabs" : "Symbolleiste-Registerkarten anzeigen",
+ "Save as" : "Speichern als",
+ "File saved" : "Datei wurde gespeichert",
+ "Insert image" : "Bild einfügen",
+ "Select recipients" : "Empfänger auswählen",
+ "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.",
+ "Secure view settings" : "Einstellungen für Sichere Ansicht",
+ "Secure view enables you to secure documents by embedding a watermark" : "Sichere Ansicht ermöglicht Ihnen Dokumente durch Einbettung eines Wasserzeichens abzusichern",
+ "Enable watermarking" : "Wasserzeichenmarkierung aktivieren",
+ "Watermark text" : "Wasserzeichen-Text",
+ "DO NOT SHARE THIS" : "NICHT TEILEN ",
+ "Show watermark on tagged files" : "Wasserzeichen auf getaggten Dateien anzeigen",
+ "Show watermark for users of groups" : "Wasserzeichen für Benutzer der angegebenen Gruppen anzeigen",
+ "Supported placeholders" : "Unterstützte Platzhalter",
+ "Show watermark for all shares" : "Wasserzeichen auf allen Freigaben anzeigen",
+ "Show watermark for read only shares" : "Wasserzeichen auf schreibgeschützten Freigaben anzeigen",
+ "Link shares" : "Link-Freigaben",
+ "Show watermark for all link shares" : "Wasserzeichen auf allen Link-Freigaben anzeigen",
+ "Show watermark for download hidden shares" : "Wasserzeichen auf ‘Download verbergen’ Freigaben anzeigen",
+ "Show watermark for read only link shares" : "Wasserzeichen auf schreibgeschützten Link-Freigaben anzeigen",
+ "Show watermark on link shares with specific system tags" : "Wasserzeichen auf Link-Freigaben mit bestimmten System-Tags anzeigen"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/l10n/es.js b/l10n/es.js
index d3031f8..a87062b 100644
--- a/l10n/es.js
+++ b/l10n/es.js
@@ -53,6 +53,12 @@ OC.L10N.register(
"Display the header more compact" : "Mostrar el encabezado más compacto",
"Display Feedback & Support menu button" : "Mostrar el botón de Feedback y Soporte",
"Display Help menu button" : "Mostrar el botón de Ayuda",
- "Display toolbar tabs" : "Mostrar pestañas de barra de herramientas"
+ "Display toolbar tabs" : "Mostrar pestañas de barra de herramientas",
+ "Save as" : "Guardar como",
+ "File saved" : "El archivo ha sido guardado",
+ "Insert image" : "Insertar imagen",
+ "Select recipients" : "Seleccionar destinatarios",
+ "Secure view enables you to secure documents by embedding a watermark" : "La vista segura permite asegurar documentos mediante la inserción de una marca de agua en ellos",
+ "Supported placeholders" : "Marcadores soportados"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/es.json b/l10n/es.json
index 67a8b4c..76cc28a 100644
--- a/l10n/es.json
+++ b/l10n/es.json
@@ -51,6 +51,12 @@
"Display the header more compact" : "Mostrar el encabezado más compacto",
"Display Feedback & Support menu button" : "Mostrar el botón de Feedback y Soporte",
"Display Help menu button" : "Mostrar el botón de Ayuda",
- "Display toolbar tabs" : "Mostrar pestañas de barra de herramientas"
+ "Display toolbar tabs" : "Mostrar pestañas de barra de herramientas",
+ "Save as" : "Guardar como",
+ "File saved" : "El archivo ha sido guardado",
+ "Insert image" : "Insertar imagen",
+ "Select recipients" : "Seleccionar destinatarios",
+ "Secure view enables you to secure documents by embedding a watermark" : "La vista segura permite asegurar documentos mediante la inserción de una marca de agua en ellos",
+ "Supported placeholders" : "Marcadores soportados"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/l10n/fr.js b/l10n/fr.js
index 2fd2d33..8dbf4aa 100644
--- a/l10n/fr.js
+++ b/l10n/fr.js
@@ -53,6 +53,10 @@ OC.L10N.register(
"Display the header more compact" : "Afficher l'en-tête plus compact",
"Display Feedback & Support menu button" : "Afficher le bouton du menu 'Feedback & Support'",
"Display Help menu button" : "Afficher le bouton du menu 'Aide'",
- "Display toolbar tabs" : "Afficher les onglets de la barre d'outils"
+ "Display toolbar tabs" : "Afficher les onglets de la barre d'outils",
+ "Save as" : "Enregistrer sous",
+ "File saved" : "Le fichier a été enregistré",
+ "Insert image" : "Insérer une image",
+ "Select recipients" : "Sélectionner les destinataires"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/fr.json b/l10n/fr.json
index 2a97d10..0d3e653 100644
--- a/l10n/fr.json
+++ b/l10n/fr.json
@@ -51,6 +51,10 @@
"Display the header more compact" : "Afficher l'en-tête plus compact",
"Display Feedback & Support menu button" : "Afficher le bouton du menu 'Feedback & Support'",
"Display Help menu button" : "Afficher le bouton du menu 'Aide'",
- "Display toolbar tabs" : "Afficher les onglets de la barre d'outils"
+ "Display toolbar tabs" : "Afficher les onglets de la barre d'outils",
+ "Save as" : "Enregistrer sous",
+ "File saved" : "Le fichier a été enregistré",
+ "Insert image" : "Insérer une image",
+ "Select recipients" : "Sélectionner les destinataires"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/pt_BR.js b/l10n/pt_BR.js
index 97ea5b9..8757b72 100644
--- a/l10n/pt_BR.js
+++ b/l10n/pt_BR.js
@@ -53,6 +53,12 @@ OC.L10N.register(
"Display the header more compact" : "Exibir o cabeçalho mais compacto",
"Display Feedback & Support menu button" : "Exibir o botão do menu de feedback e suporte",
"Display Help menu button" : "Exibir o botão do menu Ajuda",
- "Display toolbar tabs" : "Exibir guias da barra de ferramentas"
+ "Display toolbar tabs" : "Exibir guias da barra de ferramentas",
+ "Save as" : "Salvar como",
+ "File saved" : "O arquivo foi salvo",
+ "Insert image" : "Inserir imagem",
+ "Select recipients" : "Selecione os destinatários",
+ "Secure view enables you to secure documents by embedding a watermark" : "A visualização segura permite proteger documentos incorporando uma marca d'água",
+ "Supported placeholders" : "Espaços reservados suportados"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/pt_BR.json b/l10n/pt_BR.json
index 0abf97d..f000005 100644
--- a/l10n/pt_BR.json
+++ b/l10n/pt_BR.json
@@ -51,6 +51,12 @@
"Display the header more compact" : "Exibir o cabeçalho mais compacto",
"Display Feedback & Support menu button" : "Exibir o botão do menu de feedback e suporte",
"Display Help menu button" : "Exibir o botão do menu Ajuda",
- "Display toolbar tabs" : "Exibir guias da barra de ferramentas"
+ "Display toolbar tabs" : "Exibir guias da barra de ferramentas",
+ "Save as" : "Salvar como",
+ "File saved" : "O arquivo foi salvo",
+ "Insert image" : "Inserir imagem",
+ "Select recipients" : "Selecione os destinatários",
+ "Secure view enables you to secure documents by embedding a watermark" : "A visualização segura permite proteger documentos incorporando uma marca d'água",
+ "Supported placeholders" : "Espaços reservados suportados"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
}
diff --git a/l10n/ru.js b/l10n/ru.js
index ccd800a..555cc40 100644
--- a/l10n/ru.js
+++ b/l10n/ru.js
@@ -53,6 +53,29 @@ OC.L10N.register(
"Display the header more compact" : "Отображать заголовок компактным",
"Display Feedback & Support menu button" : "Отображать кнопку Обратной связи и поддержки",
"Display Help menu button" : "Отображать кнопку справки",
- "Display toolbar tabs" : "Отображать вкладки панели инструментов"
+ "Display toolbar tabs" : "Отображать вкладки панели инструментов",
+ "Save as" : "Сохранить как",
+ "File saved" : "Файл сохранён",
+ "Insert image" : "Вставить изображение",
+ "Select recipients" : "Выберите получателей",
+ "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. Пожалуйста, не храните конфиденциальные данные.",
+ "Secure view settings" : "Настройки безопасного просмотра",
+ "Secure view enables you to secure documents by embedding a watermark" : "Безопасный просмотр позволяет защищать ваши документы путем встраивания водяного знака",
+ "Enable watermarking" : "Включить водяной знак",
+ "Watermark text" : "Текст водяного знака",
+ "DO NOT SHARE THIS" : "НЕ РАСПРОСТРАНЯЙ ЭТО",
+ "Show watermark on tagged files" : "Отображать водяной знак для помеченных файлов",
+ "Show watermark for users of groups" : "Отображать водяной знак для пользователей групп",
+ "Supported placeholders" : "Поддерживаемые подстановки",
+ "Show watermark for all shares" : "Отображать водяной знак для всех с доступом",
+ "Show watermark for read only shares" : "Отображать водяной знак при доступе только на чтение",
+ "Link shares" : "Доступ по ссылке",
+ "Show watermark for all link shares" : "Отображать водяной знак при доступе по ссылке",
+ "Show watermark for download hidden shares" : "Отображать водяной знак при доступе без скачивания",
+ "Show watermark for read only link shares" : "Отображать водяной знак при доступе только на чтение по ссылке",
+ "Show watermark on link shares with specific system tags" : "Отображать водяной знак при доступе по ссылке с определенными системными метками"
},
"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 492c0e0..f5ffd27 100644
--- a/l10n/ru.json
+++ b/l10n/ru.json
@@ -51,6 +51,29 @@
"Display the header more compact" : "Отображать заголовок компактным",
"Display Feedback & Support menu button" : "Отображать кнопку Обратной связи и поддержки",
"Display Help menu button" : "Отображать кнопку справки",
- "Display toolbar tabs" : "Отображать вкладки панели инструментов"
+ "Display toolbar tabs" : "Отображать вкладки панели инструментов",
+ "Save as" : "Сохранить как",
+ "File saved" : "Файл сохранён",
+ "Insert image" : "Вставить изображение",
+ "Select recipients" : "Выберите получателей",
+ "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. Пожалуйста, не храните конфиденциальные данные.",
+ "Secure view settings" : "Настройки безопасного просмотра",
+ "Secure view enables you to secure documents by embedding a watermark" : "Безопасный просмотр позволяет защищать ваши документы путем встраивания водяного знака",
+ "Enable watermarking" : "Включить водяной знак",
+ "Watermark text" : "Текст водяного знака",
+ "DO NOT SHARE THIS" : "НЕ РАСПРОСТРАНЯЙ ЭТО",
+ "Show watermark on tagged files" : "Отображать водяной знак для помеченных файлов",
+ "Show watermark for users of groups" : "Отображать водяной знак для пользователей групп",
+ "Supported placeholders" : "Поддерживаемые подстановки",
+ "Show watermark for all shares" : "Отображать водяной знак для всех с доступом",
+ "Show watermark for read only shares" : "Отображать водяной знак при доступе только на чтение",
+ "Link shares" : "Доступ по ссылке",
+ "Show watermark for all link shares" : "Отображать водяной знак при доступе по ссылке",
+ "Show watermark for download hidden shares" : "Отображать водяной знак при доступе без скачивания",
+ "Show watermark for read only link shares" : "Отображать водяной знак при доступе только на чтение по ссылке",
+ "Show watermark on link shares with specific system tags" : "Отображать водяной знак при доступе по ссылке с определенными системными метками"
},"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 840b72a..245b142 100644
--- a/l10n/sv.js
+++ b/l10n/sv.js
@@ -53,6 +53,12 @@ OC.L10N.register(
"Display the header more compact" : "Visa kompakt sidhuvud",
"Display Feedback & Support menu button" : "Visa Feedback & Support i menyn",
"Display Help menu button" : "Visa hjälp i menyn",
- "Display toolbar tabs" : "Visa flikar i verktygsfältet"
+ "Display toolbar tabs" : "Visa flikar i verktygsfältet",
+ "Save as" : "Spara som",
+ "File saved" : "Filen har sparats",
+ "Insert image" : "Infoga bild",
+ "Select recipients" : "Välj mottagare",
+ "Secure view enables you to secure documents by embedding a watermark" : "Med säker vy kan du säkra dokument genom att bädda in ett vattenstämpel",
+ "Supported placeholders" : "Platshållare som stöds"
},
"nplurals=2; plural=(n != 1);");
diff --git a/l10n/sv.json b/l10n/sv.json
index 3ef4e16..e73f2f5 100644
--- a/l10n/sv.json
+++ b/l10n/sv.json
@@ -51,6 +51,12 @@
"Display the header more compact" : "Visa kompakt sidhuvud",
"Display Feedback & Support menu button" : "Visa Feedback & Support i menyn",
"Display Help menu button" : "Visa hjälp i menyn",
- "Display toolbar tabs" : "Visa flikar i verktygsfältet"
+ "Display toolbar tabs" : "Visa flikar i verktygsfältet",
+ "Save as" : "Spara som",
+ "File saved" : "Filen har sparats",
+ "Insert image" : "Infoga bild",
+ "Select recipients" : "Välj mottagare",
+ "Secure view enables you to secure documents by embedding a watermark" : "Med säker vy kan du säkra dokument genom att bädda in ett vattenstämpel",
+ "Supported placeholders" : "Platshållare som stöds"
},"pluralForm" :"nplurals=2; plural=(n != 1);"
} \ No newline at end of file
diff --git a/lib/adminsection.php b/lib/adminsection.php
index 6a6ff2d..9156b1e 100644
--- a/lib/adminsection.php
+++ b/lib/adminsection.php
@@ -13,7 +13,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/lib/adminsettings.php b/lib/adminsettings.php
index 32b112b..6473df5 100644
--- a/lib/adminsettings.php
+++ b/lib/adminsettings.php
@@ -13,7 +13,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/lib/appconfig.php b/lib/appconfig.php
index 3bbd2cd..4e949ea 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -13,7 +13,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.
@@ -29,6 +29,9 @@
namespace OCA\Onlyoffice;
+use \DateInterval;
+use \DateTime;
+
use OCP\IConfig;
use OCP\ILogger;
@@ -61,6 +64,13 @@ class AppConfig {
private $logger;
/**
+ * The config key for the demo server
+ *
+ * @var string
+ */
+ private $_demo = "demo";
+
+ /**
* The config key for the document server address
*
* @var string
@@ -180,6 +190,13 @@ class AppConfig {
private $_settingsError = "settings_error";
/**
+ * Application name for watermark settings
+ *
+ * @var string
+ */
+ const WATERMARK_APP_NAMESPACE = "files";
+
+ /**
* The config key for the modifyFilter
*
* @var string
@@ -252,6 +269,70 @@ class AppConfig {
}
/**
+ * Switch on demo server
+ *
+ * @param bool $value - select demo
+ *
+ * @return bool
+ */
+ public function SelectDemo($value) {
+ $this->logger->info("Select demo: " . json_encode($value), array("app" => $this->appName));
+
+ $data = $this->GetDemoData();
+
+ if ($value === true && !$data["available"]) {
+ $this->logger->info("Trial demo is overdue: " . json_encode($data), array("app" => $this->appName));
+ return false;
+ }
+
+ $data["enabled"] = $value === true;
+ if (!isset($data["start"])) {
+ $data["start"] = new DateTime();
+ }
+
+ $this->config->setAppValue($this->appName, $this->_demo, json_encode($data));
+ return true;
+ }
+
+ /**
+ * Get demo data
+ *
+ * @return array
+ */
+ public function GetDemoData() {
+ $data = $this->config->getAppValue($this->appName, $this->_demo, "");
+
+ if (empty($data)) {
+ return [
+ "available" => true,
+ "enabled" => false
+ ];
+ }
+ $data = json_decode($data, true);
+
+ $overdue = new DateTime(isset($data["start"]) ? $data["start"]["date"] : NULL);
+ $overdue->add(new DateInterval("P" . $this->DEMO_PARAM["TRIAL"] . "D"));
+ if ($overdue > new DateTime()) {
+ $data["available"] = true;
+ $data["enabled"] = $data["enabled"] === true;
+ } else {
+ $data["available"] = false;
+ $data["enabled"] = false;
+ }
+
+ return $data;
+ }
+
+ /**
+ * Get status of demo server
+ *
+ * @return bool
+ */
+ public function UseDemo() {
+ return $this->GetDemoData()["enabled"] === true;
+ }
+
+ /**
* Save the document service address to the application configuration
*
* @param string $documentServer - document service address
@@ -273,12 +354,18 @@ class AppConfig {
/**
* Get the document service address from the application configuration
*
+ * @param bool $origin - take origin
+ *
* @return string
*/
- public function GetDocumentServerUrl() {
+ public function GetDocumentServerUrl($origin = false) {
+ if (!$origin && $this->UseDemo()) {
+ return $this->DEMO_PARAM["ADDR"];
+ }
+
$url = $this->config->getAppValue($this->appName, $this->_documentserver, "");
if (empty($url)) {
- $url = $this->getSystemValue($this->_documentserver);
+ $url = $this->GetSystemValue($this->_documentserver);
}
if ($url !== "/") {
$url = rtrim($url, "/");
@@ -292,7 +379,7 @@ class AppConfig {
/**
* Save the document service address available from Nextcloud to the application configuration
*
- * @param string $documentServer - document service address
+ * @param string $documentServerInternal - document service address
*/
public function SetDocumentServerInternalUrl($documentServerInternal) {
$documentServerInternal = rtrim(trim($documentServerInternal), "/");
@@ -315,10 +402,14 @@ class AppConfig {
*
* @return string
*/
- public function GetDocumentServerInternalUrl($origin) {
+ public function GetDocumentServerInternalUrl($origin = false) {
+ if (!$origin && $this->UseDemo()) {
+ return $this->GetDocumentServerUrl();
+ }
+
$url = $this->config->getAppValue($this->appName, $this->_documentserverInternal, "");
if (empty($url)) {
- $url = $this->getSystemValue($this->_documentserverInternal);
+ $url = $this->GetSystemValue($this->_documentserverInternal);
}
if (!$origin && empty($url)) {
$url = $this->GetDocumentServerUrl();
@@ -327,6 +418,33 @@ class AppConfig {
}
/**
+ * Replace domain in document server url with internal address from configuration
+ *
+ * @param string $url - document server url
+ *
+ * @return string
+ */
+ public function ReplaceDocumentServerUrlToInternal($url) {
+ $documentServerUrl = $this->GetDocumentServerInternalUrl();
+ if (!empty($documentServerUrl)) {
+ $from = $this->GetDocumentServerUrl();
+
+ if (!preg_match("/^https?:\/\//i", $from)) {
+ $parsedUrl = parse_url($url);
+ $from = $parsedUrl["scheme"] . "://" . $parsedUrl["host"] . (array_key_exists("port", $parsedUrl) ? (":" . $parsedUrl["port"]) : "") . $from;
+ }
+
+ if ($from !== $documentServerUrl)
+ {
+ $this->logger->debug("Replace url from " . $from . " to " . $documentServerUrl, array("app" => $this->appName));
+ $url = str_replace($from, $documentServerUrl, $url);
+ }
+ }
+
+ return $url;
+ }
+
+ /**
* Save the Nextcloud address available from document server to the application configuration
*
* @param string $documentServer - document service address
@@ -353,7 +471,7 @@ class AppConfig {
public function GetStorageUrl() {
$url = $this->config->getAppValue($this->appName, $this->_storageUrl, "");
if (empty($url)) {
- $url = $this->getSystemValue($this->_storageUrl);
+ $url = $this->GetSystemValue($this->_storageUrl);
}
return $url;
}
@@ -376,12 +494,18 @@ class AppConfig {
/**
* Get the document service secret key from the application configuration
*
+ * @param bool $origin - take origin
+ *
* @return string
*/
- public function GetDocumentServerSecret() {
+ public function GetDocumentServerSecret($origin = false) {
+ if (!$origin && $this->UseDemo()) {
+ return $this->DEMO_PARAM["SECRET"];
+ }
+
$secret = $this->config->getAppValue($this->appName, $this->_jwtSecret, "");
if (empty($secret)) {
- $secret = $this->getSystemValue($this->_jwtSecret);
+ $secret = $this->GetSystemValue($this->_jwtSecret);
}
return $secret;
}
@@ -392,7 +516,11 @@ class AppConfig {
* @return string
*/
public function GetSKey() {
- return $this->config->getSystemValue($this->_cryptSecret, true);
+ $secret = $this->GetDocumentServerSecret();
+ if (empty($secret)) {
+ $secret = $this->GetSystemValue($this->_cryptSecret, true);
+ }
+ return $secret;
}
/**
@@ -566,6 +694,92 @@ class AppConfig {
}
/**
+ * Save watermark settings
+ *
+ * @param array $settings - watermark settings
+ */
+ public function SetWatermarkSettings($settings) {
+ if ($settings["enabled"] !== "true") {
+ $this->config->setAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_enabled", "no");
+ return;
+ }
+
+ $this->config->setAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_text", trim($settings["text"]));
+
+ $watermarkLabels = [
+ "allGroups",
+ "allTags",
+ "linkAll",
+ "linkRead",
+ "linkSecure",
+ "linkTags",
+ "enabled",
+ "shareAll",
+ "shareRead",
+ ];
+ foreach ($watermarkLabels as $key) {
+ if ($settings[$key] !== null) {
+ $value = $settings[$key] === "true" ? "yes" : "no";
+ $this->config->setAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_" . $key, $value);
+ }
+ }
+
+ $watermarkLists = [
+ "allGroupsList",
+ "allTagsList",
+ "linkTagsList",
+ ];
+ foreach ($watermarkLists as $key) {
+ if ($settings[$key] !== null) {
+ $value = implode(",", $settings[$key]);
+ $this->config->setAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_" . $key, $value);
+ }
+ }
+ }
+
+ /**
+ * Get watermark settings
+ *
+ * @return bool|array
+ */
+ public function GetWatermarkSettings() {
+ $result = [
+ "text" => $this->config->getAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_text", "{userId}"),
+ ];
+
+ $watermarkLabels = [
+ "allGroups",
+ "allTags",
+ "linkAll",
+ "linkRead",
+ "linkSecure",
+ "linkTags",
+ "enabled",
+ "shareAll",
+ "shareRead",
+ ];
+
+ $trueResult = array("on", "yes", "true");
+ foreach ($watermarkLabels as $key) {
+ $value = $this->config->getAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_" . $key, "no");
+ $result[$key] = in_array($value, $trueResult);
+ }
+
+ $watermarkLists = [
+ "allGroupsList",
+ "allTagsList",
+ "linkTagsList",
+ ];
+
+ foreach ($watermarkLists as $key) {
+ $value = $this->config->getAppValue(AppConfig::WATERMARK_APP_NAMESPACE, "watermark_" . $key, []);
+ $result[$key] = $value !== "" ? explode(",", $value) : [];
+ }
+
+ return $result;
+ }
+
+ /**
* Save the list of groups
*
* @param array $groups - the list of groups
@@ -638,7 +852,7 @@ class AppConfig {
* @return bool
*/
public function TurnOffVerification() {
- $turnOff = $this->getSystemValue($this->_verification);
+ $turnOff = $this->GetSystemValue($this->_verification);
return $turnOff === true;
}
@@ -648,7 +862,11 @@ class AppConfig {
* @return string
*/
public function JwtHeader() {
- $header = $this->getSystemValue($this->_jwtHeader);
+ if ($this->UseDemo()) {
+ return $this->DEMO_PARAM["HEADER"];
+ }
+
+ $header = $this->GetSystemValue($this->_jwtHeader);
if (empty($header)) {
$header = "Authorization";
}
@@ -738,4 +956,14 @@ class AppConfig {
"xltm" => [ "mime" => "application/vnd.ms-excel.template.macroEnabled.12", "type" => "spreadsheet", "conv" => true ],
"xltx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.template", "type" => "spreadsheet", "conv" => true ]
];
+
+ /**
+ * DEMO DATA
+ */
+ private $DEMO_PARAM = [
+ "ADDR" => "https://onlinedocs.onlyoffice.com/",
+ "HEADER" => "AuthorizationJWT",
+ "SECRET" => "sn2puSUF7muF5Jas",
+ "TRIAL" => 30
+ ];
}
diff --git a/lib/crypt.php b/lib/crypt.php
index ec37a12..5ee6fe2 100644
--- a/lib/crypt.php
+++ b/lib/crypt.php
@@ -13,7 +13,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.
@@ -39,17 +39,17 @@ use OCA\Onlyoffice\AppConfig;
class Crypt {
/**
- * The secret key from the application configuration
+ * Application configuration
*
- * @var string
+ * @var OCA\Onlyoffice\AppConfig
*/
- private $skey;
+ private $config;
/**
* @param OCA\Onlyoffice\AppConfig $config - application configutarion
*/
public function __construct(AppConfig $appConfig) {
- $this->skey = $appConfig->GetSKey();
+ $this->config = $appConfig;
}
/**
@@ -60,7 +60,7 @@ class Crypt {
* @return string
*/
public function GetHash($object) {
- return \Firebase\JWT\JWT::encode($object, $this->skey);
+ return \Firebase\JWT\JWT::encode($object, $this->config->GetSKey());
}
/**
@@ -77,7 +77,7 @@ class Crypt {
return [$result, "token is empty"];
}
try {
- $result = \Firebase\JWT\JWT::decode($token, $this->skey, array("HS256"));
+ $result = \Firebase\JWT\JWT::decode($token, $this->config->GetSKey(), array("HS256"));
} catch (\UnexpectedValueException $e) {
$error = $e->getMessage();
}
diff --git a/lib/documentservice.php b/lib/documentservice.php
index ba9507a..bef5c04 100644
--- a/lib/documentservice.php
+++ b/lib/documentservice.php
@@ -13,7 +13,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.
@@ -118,7 +118,7 @@ class DocumentService {
* @return array
*/
function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async) {
- $documentServerUrl = $this->config->GetDocumentServerInternalUrl(false);
+ $documentServerUrl = $this->config->GetDocumentServerInternalUrl();
if (empty($documentServerUrl)) {
throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin"));
@@ -147,6 +147,10 @@ class DocumentService {
"key" => $document_revision_id
];
+ if ($this->config->UseDemo()) {
+ $data["tenant"] = $this->config->GetSystemValue("instanceid", true);
+ }
+
$opts = array(
"timeout" => "120",
"headers" => [
@@ -241,7 +245,7 @@ class DocumentService {
*/
function HealthcheckRequest() {
- $documentServerUrl = $this->config->GetDocumentServerInternalUrl(false);
+ $documentServerUrl = $this->config->GetDocumentServerInternalUrl();
if (empty($documentServerUrl)) {
throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin"));
@@ -263,7 +267,7 @@ class DocumentService {
*/
function CommandRequest($method) {
- $documentServerUrl = $this->config->GetDocumentServerInternalUrl(false);
+ $documentServerUrl = $this->config->GetDocumentServerInternalUrl();
if (empty($documentServerUrl)) {
throw new \Exception($this->trans->t("ONLYOFFICE app is not configured. Please contact admin"));
diff --git a/templates/editor.php b/templates/editor.php
index 38deacc..f20186d 100644
--- a/templates/editor.php
+++ b/templates/editor.php
@@ -13,7 +13,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/templates/settings.php b/templates/settings.php
index 98b9eb0..5b10ddb 100644
--- a/templates/settings.php
+++ b/templates/settings.php
@@ -13,7 +13,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.
@@ -29,8 +29,19 @@
style("onlyoffice", "settings");
script("onlyoffice", "settings");
+
+ if ($_["tagsEnabled"]) {
+ script("core", [
+ "oc-backbone-webdav",
+ "systemtags/systemtags",
+ "systemtags/systemtagmodel",
+ "systemtags/systemtagsmappingcollection",
+ "systemtags/systemtagscollection",
+ "systemtags/systemtagsinputfield",
+ ]);
+ }
?>
-<div class="section section-onlyoffice">
+<div class="section section-onlyoffice section-onlyoffice-addr">
<h2>
ONLYOFFICE
<a target="_blank" class="icon-info svg" title="" href="https://api.onlyoffice.com/editors/nextcloud" data-original-title="<?php p($l->t("Documentation")) ?>"></a>
@@ -38,41 +49,59 @@
<h3><?php p($l->t("Server settings")) ?></h3>
- <p class="settings-hint"><?php p($l->t("ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '<documentserver>' for the server address in the below line.")) ?></p>
+ <div id="onlyofficeAddrSettings">
+ <p class="settings-hint"><?php p($l->t("ONLYOFFICE Document Service Location specifies the address of the server with the document services installed. Please change the '<documentserver>' for the server address in the below line.")) ?></p>
- <p><?php p($l->t("Document Editing Service address")) ?></p>
- <p><input id="onlyofficeUrl" value="<?php p($_["documentserver"]) ?>" placeholder="https://<documentserver>/" type="text"></p>
+ <p><?php p($l->t("Document Editing Service address")) ?></p>
+ <p><input id="onlyofficeUrl" value="<?php p($_["documentserver"]) ?>" placeholder="https://<documentserver>/" type="text"></p>
- <p class="onlyoffice-header"><?php p($l->t("Secret key (leave blank to disable)")) ?></p>
- <p><input id="onlyofficeSecret" value="<?php p($_["secret"]) ?>" placeholder="secret" type="text"></p>
+ <p class="onlyoffice-header"><?php p($l->t("Secret key (leave blank to disable)")) ?></p>
+ <p><input id="onlyofficeSecret" value="<?php p($_["secret"]) ?>" placeholder="secret" type="text"></p>
- <p>
- <a id="onlyofficeAdv" class="onlyoffice-header">
- <?php p($l->t("Advanced server settings")) ?>
- <span class="icon icon-triangle-s"></span>
- </a>
- </p>
- <div id="onlyofficeSecretPanel" class="onlyoffice-hide">
- <p class="onlyoffice-header"><?php p($l->t("Document Editing Service address for internal requests from the server")) ?></p>
- <p><input id="onlyofficeInternalUrl" value="<?php p($_["documentserverInternal"]) ?>" placeholder="https://<documentserver>/" type="text"></p>
+ <p>
+ <a id="onlyofficeAdv" class="onlyoffice-header">
+ <?php p($l->t("Advanced server settings")) ?>
+ <span class="icon icon-triangle-s"></span>
+ </a>
+ </p>
+ <div id="onlyofficeSecretPanel" class="onlyoffice-hide">
+ <p class="onlyoffice-header"><?php p($l->t("Document Editing Service address for internal requests from the server")) ?></p>
+ <p><input id="onlyofficeInternalUrl" value="<?php p($_["documentserverInternal"]) ?>" placeholder="https://<documentserver>/" type="text"></p>
- <p class="onlyoffice-header"><?php p($l->t("Server address for internal requests from the Document Editing Service")) ?></p>
- <p><input id="onlyofficeStorageUrl" value="<?php p($_["storageUrl"]) ?>" placeholder="<?php p($_["currentServer"]) ?>" type="text"></p>
+ <p class="onlyoffice-header"><?php p($l->t("Server address for internal requests from the Document Editing Service")) ?></p>
+ <p><input id="onlyofficeStorageUrl" value="<?php p($_["storageUrl"]) ?>" placeholder="<?php p($_["currentServer"]) ?>" type="text"></p>
+ </div>
</div>
+
<br />
+ <div>
+ <button id="onlyofficeAddrSave" class="button"><?php p($l->t("Save")) ?></button>
- <p><button id="onlyofficeAddrSave" class="button"><?php p($l->t("Save")) ?></button></p>
+ <div class="onlyoffice-demo">
+ <input type="checkbox" class="checkbox" id="onlyofficeDemo"
+ <?php if ($_["demo"]["enabled"]) { ?>checked="checked"<?php } ?>
+ <?php if (!$_["demo"]["available"]) { ?>disabled="disabled"<?php } ?> />
+ <label for="onlyofficeDemo"><?php p($l->t("Connect to demo ONLYOFFICE Document Server")) ?></label>
+
+ <br />
+ <?php if ($_["demo"]["available"]) { ?>
+ <em><?php p($l->t("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.")) ?></em>
+ <?php } else { ?>
+ <em><?php p($l->t("The 30-day test period is over, you can no longer connect to demo ONLYOFFICE Document Server.")) ?></em>
+ <?php } ?>
+ </div>
+ </div>
</div>
-<div class="section section-onlyoffice section-onlyoffice-2 <?php if (empty($_["documentserver"]) || !$_["successful"]) { ?>onlyoffice-hide<?php } ?>">
+<div class="section section-onlyoffice section-onlyoffice-common <?php if (empty($_["documentserver"]) && !$_["demo"]["enabled"] || !$_["successful"]) { ?>onlyoffice-hide<?php } ?>">
<h3><?php p($l->t("Common settings")) ?></h3>
<p>
<input type="checkbox" class="checkbox" id="onlyofficeGroups"
<?php if (count($_["limitGroups"]) > 0) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeGroups"><?php p($l->t("Restrict access to editors to following groups")) ?></label>
- <input type="hidden" id="onlyofficeLimitGroups" value="<?php p(implode("|", $_["limitGroups"])) ?>" style="display: block; margin-top: 6px; width: 250px;" />
+ <input type="hidden" id="onlyofficeLimitGroups" value="<?php p(implode("|", $_["limitGroups"])) ?>" style="display: block" />
</p>
<p>
@@ -151,7 +180,91 @@
<?php if (!$_["toolbarNoTabs"]) { ?>checked="checked"<?php } ?> />
<label for="onlyofficeToolbarNoTabs"><?php p($l->t("Display toolbar tabs")) ?></label>
</p>
- <br />
+ <br />
<p><button id="onlyofficeSave" class="button"><?php p($l->t("Save")) ?></button></p>
+</div>
+
+<div class="section section-onlyoffice section-onlyoffice-watermark <?php if (empty($_["documentserver"]) && !$_["demo"]["enabled"] || !$_["successful"]) { ?>onlyoffice-hide<?php } ?>">
+ <h3><?php p($l->t("Secure view settings")) ?></h3>
+
+ <p class="settings-hint"><?php p($l->t("Secure view enables you to secure documents by embedding a watermark")) ?></p>
+
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_enabled"
+ <?php if ($_["watermark"]["enabled"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_enabled"><?php p($l->t("Enable watermarking")) ?></label>
+ </p>
+
+ <div id="onlyofficeWatermarkSettings" <?php if (!$_["watermark"]["enabled"]) { ?>class="onlyoffice-hide"<?php } ?> >
+ <br />
+ <p><?php p($l->t("Watermark text")) ?></p>
+ <br />
+ <p class="settings-hint"><?php p($l->t("Supported placeholders")) ?>: {userId}, {date}</p>
+ <p><input id="onlyofficeWatermark_text" value="<?php p($_["watermark"]["text"]) ?>" placeholder="<?php p($l->t("DO NOT SHARE THIS")) ?> {userId} {date}" type="text"></p>
+
+ <br />
+ <?php if ($_["tagsEnabled"]) { ?>
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_allTags"
+ <?php if ($_["watermark"]["allTags"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_allTags"><?php p($l->t("Show watermark on tagged files")) ?></label>
+ <input type="hidden" id="onlyofficeWatermark_allTagsList" value="<?php p(implode("|", $_["watermark"]["allTagsList"])) ?>" style="display: block" />
+ </p>
+ <?php } ?>
+
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_allGroups"
+ <?php if ($_["watermark"]["allGroups"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_allGroups"><?php p($l->t("Show watermark for users of groups")) ?></label>
+ <input type="hidden" id="onlyofficeWatermark_allGroupsList" value="<?php p(implode("|", $_["watermark"]["allGroupsList"])) ?>" style="display: block" />
+ </p>
+
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_shareAll"
+ <?php if ($_["watermark"]["shareAll"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_shareAll"><?php p($l->t("Show watermark for all shares")) ?></label>
+ </p>
+
+ <p <?php if ($_["watermark"]["shareAll"]) { ?>class="onlyoffice-hide"<?php } ?> >
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_shareRead"
+ <?php if ($_["watermark"]["shareRead"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_shareRead"><?php p($l->t("Show watermark for read only shares")) ?></label>
+ </p>
+
+ <br />
+ <p><?php p($l->t("Link shares")) ?></p>
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_linkAll"
+ <?php if ($_["watermark"]["linkAll"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_linkAll"><?php p($l->t("Show watermark for all link shares")) ?></label>
+ </p>
+
+ <div id="onlyofficeWatermark_link_sensitive" <?php if ($_["watermark"]["linkAll"]) { ?>class="onlyoffice-hide"<?php } ?> >
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_linkSecure"
+ <?php if ($_["watermark"]["linkSecure"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_linkSecure"><?php p($l->t("Show watermark for download hidden shares")) ?></label>
+ </p>
+
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_linkRead"
+ <?php if ($_["watermark"]["linkRead"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_linkRead"><?php p($l->t("Show watermark for read only link shares")) ?></label>
+ </p>
+
+ <?php if ($_["tagsEnabled"]) { ?>
+ <p>
+ <input type="checkbox" class="checkbox" id="onlyofficeWatermark_linkTags"
+ <?php if ($_["watermark"]["linkTags"]) { ?>checked="checked"<?php } ?> />
+ <label for="onlyofficeWatermark_linkTags"><?php p($l->t("Show watermark on link shares with specific system tags")) ?></label>
+ <input type="hidden" id="onlyofficeWatermark_linkTagsList" value="<?php p(implode("|", $_["watermark"]["linkTagsList"])) ?>" style="display: block" />
+ </p>
+ <?php } ?>
+ </div>
+ </div>
+
+ <br />
+ <p><button id="onlyofficeWatermarkSave" class="button"><?php p($l->t("Save")) ?></button></p>
+
</div> \ No newline at end of file