Skip to content

Commit

Permalink
Merge pull request #341 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/6.4.1
  • Loading branch information
LinneyS authored May 13, 2021
2 parents 416ccac + 71ccce8 commit 7b8c258
Show file tree
Hide file tree
Showing 132 changed files with 1,297 additions and 199 deletions.
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "assets"]
path = assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/new
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# Change Log

## 6.4.1
## Added
- create file from editor
- more empty files in different languages
- file templates

## Changed
- open a version from the history of supported formats only
- document server v5.5 and earlier is no longer supported
- disabled copying to clipboard if there is no download permission

## 6.3.1
## Added
- viewing a locked file
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ There are several ways to do that:

```bash
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice
cd onlyoffice
git submodule update --init --recursive
```

> ownCloud does not work with unsigned applications giving an alert, so you will need to use either option **a** or **b** to get the application.
Expand Down
2 changes: 1 addition & 1 deletion appinfo/app.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2020
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down
14 changes: 13 additions & 1 deletion appinfo/application.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2020
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -28,6 +28,7 @@
use OCA\Onlyoffice\Controller\CallbackController;
use OCA\Onlyoffice\Controller\EditorController;
use OCA\Onlyoffice\Controller\SettingsController;
use OCA\Onlyoffice\Controller\TemplateController;
use OCA\Onlyoffice\Crypt;
use OCA\Onlyoffice\Hookhandler;
use OCA\Onlyoffice\Hooks;
Expand Down Expand Up @@ -67,11 +68,13 @@ function () {
Util::addScript("onlyoffice", "desktop");
Util::addScript("onlyoffice", "main");
Util::addScript("onlyoffice", "share");
Util::addScript("onlyoffice", "template");

if ($this->appConfig->GetSameTab()) {
Util::addScript("onlyoffice", "listener");
}

Util::addStyle("onlyoffice", "template");
Util::addStyle("onlyoffice", "main");
}
});
Expand Down Expand Up @@ -164,6 +167,15 @@ function () {
);
});

$container->registerService("TemplateController", function ($c) {
return new TemplateController(
$c->query("AppName"),
$c->query("Request"),
$c->query("L10N"),
$c->query("Logger")
);
});


Hooks::connectHooks();
}
Expand Down
2 changes: 1 addition & 1 deletion 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 ownCloud 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>apl2</licence>
<author>Ascensio System SIA</author>
<version>6.3.1</version>
<version>6.4.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand Down
6 changes: 5 additions & 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 2020
* (c) Copyright Ascensio System SIA 2021
*
* 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 @@
["name" => "callback#emptyfile", "url" => "/empty", "verb" => "GET"],
["name" => "callback#track", "url" => "/track", "verb" => "POST"],
["name" => "editor#loader", "url" => "/loader", "verb" => "GET"],
["name" => "editor#create_new", "url" => "/new", "verb" => "GET"],
["name" => "editor#index", "url" => "/{fileId}", "verb" => "GET"],
["name" => "editor#public_page", "url" => "/s/{shareToken}", "verb" => "GET"],
["name" => "editor#config", "url" => "/ajax/config/{fileId}", "verb" => "GET"],
Expand All @@ -36,6 +37,9 @@
["name" => "settings#save_common", "url" => "/ajax/settings/common", "verb" => "PUT"],
["name" => "settings#get_settings", "url" => "/ajax/settings", "verb" => "GET"],
["name" => "settings#clear_history", "url" => "/ajax/settings/history", "verb" => "DELETE"],
["name" => "template#add_template", "url" => "/ajax/template", "verb" => "POST"],
["name" => "template#get_templates", "url" => "/ajax/template", "verb" => "GET"],
["name" => "template#delete_template", "url" => "/ajax/template", "verb" => "DELETE"],
],
"ocs" => [
["name" => "federation#key", "url" => "/api/v1/key", "verb" => "POST"],
Expand Down
1 change: 1 addition & 0 deletions assets
Submodule assets added at d54aff
Binary file removed assets/bg_BG/new.docx
Binary file not shown.
Binary file removed assets/bg_BG/new.pptx
Binary file not shown.
Binary file removed assets/bg_BG/new.xlsx
Binary file not shown.
Binary file removed assets/cs/new.docx
Binary file not shown.
Binary file removed assets/cs/new.pptx
Binary file not shown.
Binary file removed assets/cs/new.xlsx
Binary file not shown.
Binary file removed assets/de/new.docx
Binary file not shown.
Binary file removed assets/de/new.pptx
Binary file not shown.
Binary file removed assets/de/new.xlsx
Binary file not shown.
Binary file removed assets/de_DE/new.docx
Binary file not shown.
Binary file removed assets/de_DE/new.pptx
Binary file not shown.
Binary file removed assets/de_DE/new.xlsx
Binary file not shown.
Binary file removed assets/el/new.docx
Binary file not shown.
Binary file removed assets/el/new.pptx
Binary file not shown.
Binary file removed assets/el/new.xlsx
Binary file not shown.
Binary file removed assets/en/new.docx
Binary file not shown.
Binary file removed assets/en/new.pptx
Binary file not shown.
Binary file removed assets/en/new.xlsx
Binary file not shown.
Binary file removed assets/en_GB/new.docx
Binary file not shown.
Binary file removed assets/en_GB/new.pptx
Binary file not shown.
Binary file removed assets/en_GB/new.xlsx
Binary file not shown.
Binary file removed assets/es/new.docx
Binary file not shown.
Binary file removed assets/es/new.pptx
Binary file not shown.
Binary file removed assets/es/new.xlsx
Binary file not shown.
Binary file removed assets/fr/new.docx
Binary file not shown.
Binary file removed assets/fr/new.pptx
Binary file not shown.
Binary file removed assets/fr/new.xlsx
Binary file not shown.
Binary file removed assets/it/new.docx
Binary file not shown.
Binary file removed assets/it/new.pptx
Binary file not shown.
Binary file removed assets/it/new.xlsx
Binary file not shown.
Binary file removed assets/ja/new.docx
Binary file not shown.
Binary file removed assets/ja/new.pptx
Binary file not shown.
Binary file removed assets/ja/new.xlsx
Binary file not shown.
Binary file removed assets/ko/new.docx
Binary file not shown.
Binary file removed assets/ko/new.pptx
Binary file not shown.
Binary file removed assets/ko/new.xlsx
Binary file not shown.
Binary file removed assets/nl/new.docx
Binary file not shown.
Binary file removed assets/nl/new.pptx
Binary file not shown.
Binary file removed assets/nl/new.xlsx
Binary file not shown.
Binary file removed assets/pl/new.docx
Binary file not shown.
Binary file removed assets/pl/new.pptx
Binary file not shown.
Binary file removed assets/pl/new.xlsx
Binary file not shown.
Binary file removed assets/pt_BR/new.docx
Binary file not shown.
Binary file removed assets/pt_BR/new.pptx
Binary file not shown.
Binary file removed assets/pt_BR/new.xlsx
Binary file not shown.
Binary file removed assets/pt_PT/new.docx
Binary file not shown.
Binary file removed assets/pt_PT/new.pptx
Binary file not shown.
Binary file removed assets/pt_PT/new.xlsx
Binary file not shown.
Binary file removed assets/ru/new.docx
Binary file not shown.
Binary file removed assets/ru/new.pptx
Binary file not shown.
Binary file removed assets/ru/new.xlsx
Binary file not shown.
Binary file removed assets/sv/new.docx
Binary file not shown.
Binary file removed assets/sv/new.pptx
Binary file not shown.
Binary file removed assets/sv/new.xlsx
Binary file not shown.
Binary file removed assets/zh_CN/new.docx
Binary file not shown.
Binary file removed assets/zh_CN/new.pptx
Binary file not shown.
Binary file removed assets/zh_CN/new.xlsx
Binary file not shown.
20 changes: 12 additions & 8 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
/**
*
* (c) Copyright Ascensio System SIA 2020
* (c) Copyright Ascensio System SIA 2021
*
* 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 @@ -41,10 +41,11 @@

use OCA\Onlyoffice\AppConfig;
use OCA\Onlyoffice\Crypt;
use OCA\Onlyoffice\KeyManager;
use OCA\Onlyoffice\DocumentService;
use OCA\Onlyoffice\VersionManager;
use OCA\Onlyoffice\FileVersions;
use OCA\Onlyoffice\KeyManager;
use OCA\Onlyoffice\VersionManager;
use OCA\Onlyoffice\TemplateManager;

/**
* Callback handler for the document server.
Expand Down Expand Up @@ -191,6 +192,7 @@ public function download($doc) {
$fileId = $hashData->fileId;
$version = isset($hashData->version) ? $hashData->version : null;
$changes = isset($hashData->changes) ? $hashData->changes : false;
$template = isset($hashData->template) ? $hashData->template : false;
$this->logger->debug("Download: $fileId ($version)" . ($changes ? " changes" : ""), ["app" => $this->appName]);

if (!$this->userSession->isLoggedIn()
Expand Down Expand Up @@ -241,7 +243,7 @@ public function download($doc) {
}

$shareToken = isset($hashData->shareToken) ? $hashData->shareToken : null;
list ($file, $error) = empty($shareToken) ? $this->getFile($userId, $fileId, null, $changes ? null : $version) : $this->getFileByToken($fileId, $shareToken, $changes ? null : $version);
list ($file, $error) = empty($shareToken) ? $this->getFile($userId, $fileId, null, $changes ? null : $version, $template) : $this->getFileByToken($fileId, $shareToken, $changes ? null : $version);

if (isset($error)) {
return $error;
Expand Down Expand Up @@ -349,7 +351,7 @@ public function emptyfile($doc) {
}
}

$templatePath = dirname(__DIR__) . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . "en" . DIRECTORY_SEPARATOR . "new.docx";
$templatePath = TemplateManager::GetEmptyTemplatePath("en", ".docx");

$template = file_get_contents($templatePath);
if (!$template) {
Expand Down Expand Up @@ -587,16 +589,18 @@ public function track($doc, $users, $key, $status, $url, $token, $history, $chan
* @param integer $fileId - file identifier
* @param string $filePath - file path
* @param integer $version - file version
*
* @param bool $template - file is template
*
* @return array
*/
private function getFile($userId, $fileId, $filePath = null, $version = 0) {
private function getFile($userId, $fileId, $filePath = null, $version = 0, $template = false) {
if (empty($fileId)) {
return [null, new JSONResponse(["message" => $this->trans->t("FileId is empty")], Http::STATUS_BAD_REQUEST)];
}

try {
$files = $this->root->getUserFolder($userId)->getById($fileId);
$folder = !$template ? $this->root->getUserFolder($userId) : TemplateManager::GetGlobalTemplateDir();
$files = $folder->getById($fileId);
} catch (\Exception $e) {
$this->logger->logException($e, ["message" => "getFile: $fileId", "app" => $this->appName]);
return [null, new JSONResponse(["message" => $this->trans->t("Invalid request")], Http::STATUS_BAD_REQUEST)];
Expand Down
Loading

0 comments on commit 7b8c258

Please sign in to comment.