Skip to content

Commit

Permalink
Merge pull request #596 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/7.3.2
  • Loading branch information
LinneyS authored Mar 4, 2022
2 parents 9806407 + 11e73ae commit e0c50a5
Show file tree
Hide file tree
Showing 72 changed files with 251 additions and 235 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Change Log

## 7.3.2
## Changed
- Nextcloud v20 is no longer supported
- fixed link in mention notifications
- title for new file
- fix editing after desktop sync

## 7.3.0
## Added
- support docxf and oform formats
Expand Down
12 changes: 6 additions & 6 deletions appinfo/application.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -222,6 +222,8 @@ public function register(IRegistrationContext $context): void {
$detector->getAllMappings();
$detector->registerType("docxf", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.docxf");
$detector->registerType("oform", "application/vnd.openxmlformats-officedocument.wordprocessingml.document.oform");

Hooks::connectHooks();
}

public function boot(IBootContext $context): void {
Expand Down Expand Up @@ -254,23 +256,23 @@ function (FileCreatedFromTemplateEvent $event) {
&& $this->appConfig->isUserAllowedToUse()) {

$templateManager->registerTemplateFileCreator(function () use ($appName, $trans) {
$wordTemplate = new TemplateFileCreator($appName, $trans->t("Document"), ".docx");
$wordTemplate = new TemplateFileCreator($appName, $trans->t("New document"), ".docx");
$wordTemplate->addMimetype("application/vnd.openxmlformats-officedocument.wordprocessingml.document");
$wordTemplate->setIconClass("icon-onlyoffice-new-docx");
$wordTemplate->setRatio(21/29.7);
return $wordTemplate;
});

$templateManager->registerTemplateFileCreator(function () use ($appName, $trans) {
$cellTemplate = new TemplateFileCreator($appName, $trans->t("Spreadsheet"), ".xlsx");
$cellTemplate = new TemplateFileCreator($appName, $trans->t("New spreadsheet"), ".xlsx");
$cellTemplate->addMimetype("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
$cellTemplate->setIconClass("icon-onlyoffice-new-xlsx");
$cellTemplate->setRatio(21/29.7);
return $cellTemplate;
});

$templateManager->registerTemplateFileCreator(function () use ($appName, $trans) {
$slideTemplate = new TemplateFileCreator($appName, $trans->t("Presentation"), ".pptx");
$slideTemplate = new TemplateFileCreator($appName, $trans->t("New presentation"), ".pptx");
$slideTemplate->addMimetype("application/vnd.openxmlformats-officedocument.presentationml.presentation");
$slideTemplate->setIconClass("icon-onlyoffice-new-pptx");
$slideTemplate->setRatio(16/9);
Expand All @@ -279,7 +281,5 @@ function (FileCreatedFromTemplateEvent $event) {
}
});
}

Hooks::connectHooks();
}
}
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<description>ONLYOFFICE connector allows you to view, edit and collaborate on text documents, spreadsheets and presentations within Nextcloud using ONLYOFFICE Docs. This will create a new Edit in ONLYOFFICE action within the document library for Office documents. This allows multiple users to co-author documents in real time from the familiar web interface and save the changes back to your file storage.</description>
<licence>apache</licence>
<author mail="dev@onlyoffice.com" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
<version>7.3.0</version>
<version>7.3.2</version>
<namespace>Onlyoffice</namespace>
<types>
<prevent_group_restriction/>
Expand All @@ -29,7 +29,7 @@
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/new.png</screenshot>
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/open.png</screenshot>
<dependencies>
<nextcloud min-version="20" max-version="23"/>
<nextcloud min-version="21" max-version="23"/>
</dependencies>
<settings>
<admin>OCA\Onlyoffice\AdminSettings</admin>
Expand Down
2 changes: 1 addition & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion assets
Submodule assets updated 1 files
+0 −1 README.md
10 changes: 7 additions & 3 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\DataDownloadResponse;
use OCP\AppFramework\Http\JSONResponse;
use OCP\AppFramework\Http\StreamResponse;
use OCP\AppFramework\QueryException;
use OCP\Files\File;
use OCP\Files\Folder;
Expand Down Expand Up @@ -177,7 +178,7 @@ public function __construct($AppName,
*
* @param string $doc - verification token with the file identifier
*
* @return DataDownloadResponse|JSONResponse
* @return StreamResponse|JSONResponse
*
* @NoAdminRequired
* @NoCSRFRequired
Expand Down Expand Up @@ -294,7 +295,10 @@ public function download($doc) {
}

try {
return new DataDownloadResponse($file->getContent(), $file->getName(), $file->getMimeType());
$response = new StreamResponse($file->fopen('rb'));
$response->addHeader('Content-Disposition', 'attachment; filename="' . rawurldecode($file->getName()) . '"');
$response->addHeader('Content-Type', $file->getMimeType());
return $response;
} catch (NotPermittedException $e) {
$this->logger->logException($e, ["message" => "Download Not permitted: $fileId ($version)", "app" => $this->appName]);
return new JSONResponse(["message" => $this->trans->t("Not permitted")], Http::STATUS_FORBIDDEN);
Expand Down
14 changes: 7 additions & 7 deletions controller/editorapicontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -294,8 +294,8 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok
],
"documentType" => $format["type"],
"editorConfig" => [
"lang" => str_replace("_", "-", \OC::$server->getL10NFactory("")->get("")->getLanguageCode()),
"region" => str_replace("_", "-", \OC::$server->getL10NFactory("")->findLocale())
"lang" => str_replace("_", "-", \OC::$server->getL10NFactory()->get("onlyoffice")->getLanguageCode()),
"region" => str_replace("_", "-", \OC::$server->getL10NFactory()->get("onlyoffice")->getLocaleCode())
]
];

Expand Down Expand Up @@ -396,13 +396,13 @@ public function config($fileId, $filePath = null, $shareToken = null, $directTok

switch ($params["documentType"]) {
case "word":
$createName = $this->trans->t("Document") . ".docx";
$createName = $this->trans->t("New document") . ".docx";
break;
case "cell":
$createName = $this->trans->t("Spreadsheet") . ".xlsx";
$createName = $this->trans->t("New spreadsheet") . ".xlsx";
break;
case "slide":
$createName = $this->trans->t("Presentation") . ".pptx";
$createName = $this->trans->t("New presentation") . ".pptx";
break;
}

Expand Down Expand Up @@ -814,4 +814,4 @@ private function isFavorite($fileId, $userId = null) {

return false;
}
}
}
40 changes: 19 additions & 21 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -268,9 +268,10 @@ public function create($name, $dir, $templateId = null, $targetId = 0, $shareTok
$fileUrl = $this->getUrl($targetFile, $user, $shareToken);

$ext = strtolower(pathinfo($name, PATHINFO_EXTENSION));
$region = str_replace("_", "-", \OC::$server->getL10NFactory()->get($this->appName)->getLocaleCode());
$documentService = new DocumentService($this->trans, $this->config);
try {
$newFileUri = $documentService->GetConvertedUri($fileUrl, $targetExt, $ext, $targetKey);
$newFileUri = $documentService->GetConvertedUri($fileUrl, $targetExt, $ext, $targetKey, $region);
} catch (\Exception $e) {
$this->logger->logException($e, ["message" => "GetConvertedUri: " . $targetFile->getId(), "app" => $this->appName]);
return ["error" => $e->getMessage()];
Expand Down Expand Up @@ -591,8 +592,9 @@ public function convert($fileId, $shareToken = null) {
$documentService = new DocumentService($this->trans, $this->config);
$key = $this->fileUtility->getKey($file);
$fileUrl = $this->getUrl($file, $user, $shareToken);
$region = str_replace("_", "-", \OC::$server->getL10NFactory()->get($this->appName)->getLocaleCode());
try {
$newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $internalExtension, $key);
$newFileUri = $documentService->GetConvertedUri($fileUrl, $ext, $internalExtension, $key, $region);
} catch (\Exception $e) {
$this->logger->logException($e, ["message" => "GetConvertedUri: " . $file->getId(), "app" => $this->appName]);
return ["error" => $e->getMessage()];
Expand Down Expand Up @@ -691,16 +693,15 @@ public function save($name, $dir, $url) {
* Get versions history for file
*
* @param integer $fileId - file identifier
* @param string $shareToken - access token
*
* @return array
*
* @NoAdminRequired
*/
public function history($fileId, $shareToken = null) {
public function history($fileId) {
$this->logger->debug("Request history for: $fileId", ["app" => $this->appName]);

if (empty($shareToken) && !$this->config->isUserAllowedToUse()) {
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}

Expand All @@ -712,7 +713,7 @@ public function history($fileId, $shareToken = null) {
$userId = $user->getUID();
}

list ($file, $error, $share) = empty($shareToken) ? $this->getFile($userId, $fileId) : $this->fileUtility->getFileByToken($fileId, $shareToken);
list ($file, $error, $share) = $this->getFile($userId, $fileId);

if (isset($error)) {
$this->logger->error("History: $fileId $error", ["app" => $this->appName]);
Expand Down Expand Up @@ -811,16 +812,15 @@ public function history($fileId, $shareToken = null) {
*
* @param integer $fileId - file identifier
* @param integer $version - file version
* @param string $shareToken - access token
*
* @return array
*
* @NoAdminRequired
*/
public function version($fileId, $version, $shareToken = null) {
public function version($fileId, $version) {
$this->logger->debug("Request version for: $fileId ($version)", ["app" => $this->appName]);

if (empty($shareToken) && !$this->config->isUserAllowedToUse()) {
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}

Expand All @@ -832,7 +832,7 @@ public function version($fileId, $version, $shareToken = null) {
$userId = $user->getUID();
}

list ($file, $error, $share) = empty($shareToken) ? $this->getFile($userId, $fileId) : $this->fileUtility->getFileByToken($fileId, $shareToken);
list ($file, $error, $share) = $this->getFile($userId, $fileId);

if (isset($error)) {
$this->logger->error("History: $fileId $error", ["app" => $this->appName]);
Expand Down Expand Up @@ -861,14 +861,14 @@ public function version($fileId, $version, $shareToken = null) {
$key = $this->fileUtility->getKey($file, true);
$versionId = $file->getFileInfo()->getMtime();

$fileUrl = $this->getUrl($file, $user, $shareToken);
$fileUrl = $this->getUrl($file, $user);
} else {
$fileVersion = array_values($versions)[$version - 1];

$key = $this->fileUtility->getVersionKey($fileVersion);
$versionId = $fileVersion->getRevisionId();

$fileUrl = $this->getUrl($file, $user, $shareToken, $version);
$fileUrl = $this->getUrl($file, $user, null, $version);
}
$key = DocumentService::GenerateRevisionId($key);

Expand All @@ -882,14 +882,14 @@ public function version($fileId, $version, $shareToken = null) {
&& count($versions) >= $version - 1
&& FileVersions::hasChanges($ownerId, $fileId, $versionId)) {

$changesUrl = $this->getUrl($file, $user, $shareToken, $version, true);
$changesUrl = $this->getUrl($file, $user, null, $version, true);
$result["changesUrl"] = $changesUrl;

$prevVersion = array_values($versions)[$version - 2];
$prevVersionKey = $this->fileUtility->getVersionKey($prevVersion);
$prevVersionKey = DocumentService::GenerateRevisionId($prevVersionKey);

$prevVersionUrl = $this->getUrl($file, $user, $shareToken, $version - 1);
$prevVersionUrl = $this->getUrl($file, $user, null, $version - 1);

$result["previous"] = [
"key" => $prevVersionKey,
Expand All @@ -910,17 +910,15 @@ public function version($fileId, $version, $shareToken = null) {
*
* @param integer $fileId - file identifier
* @param integer $version - file version
* @param string $shareToken - access token
*
* @return array
*
* @NoAdminRequired
* @PublicPage
*/
public function restore($fileId, $version, $shareToken = null) {
public function restore($fileId, $version) {
$this->logger->debug("Request restore version for: $fileId ($version)", ["app" => $this->appName]);

if (empty($shareToken) && !$this->config->isUserAllowedToUse()) {
if (!$this->config->isUserAllowedToUse()) {
return ["error" => $this->trans->t("Not permitted")];
}

Expand All @@ -932,7 +930,7 @@ public function restore($fileId, $version, $shareToken = null) {
$userId = $user->getUID();
}

list ($file, $error, $share) = empty($shareToken) ? $this->getFile($userId, $fileId) : $this->fileUtility->getFileByToken($fileId, $shareToken);
list ($file, $error, $share) = $this->getFile($userId, $fileId);

if (isset($error)) {
$this->logger->error("Restore: $fileId $error", ["app" => $this->appName]);
Expand All @@ -957,7 +955,7 @@ public function restore($fileId, $version, $shareToken = null) {
}
}

return $this->history($fileId, $shareToken);
return $this->history($fileId);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion controller/federationcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion controller/settingscontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion controller/templatecontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/editor.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/main.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/settings.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion css/template.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
* (c) Copyright Ascensio System SIA 2022
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
Loading

0 comments on commit e0c50a5

Please sign in to comment.