Skip to content

Commit

Permalink
Merge pull request #97 from ONLYOFFICE/develop
Browse files Browse the repository at this point in the history
Release/2.3.0
  • Loading branch information
LinneyS authored Jun 24, 2019
2 parents 28a6310 + f37f62b commit 9a81db9
Show file tree
Hide file tree
Showing 25 changed files with 641 additions and 211 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Change Log

## 2.3.0
## Added
- editor customization

## Changed
- the settings page is splitted into two sections
- support master key encryption
- fix getting domain for desktop
- title in the convertation request

## 2.1.10
## Changed
- compatible with Nextcloud 16
Expand Down
79 changes: 75 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
# ![](screenshots/icon.png) Nextcloud ONLYOFFICE integration app
# ![](screenshots/icon.png) Nextcloud-ONLYOFFICE integration app

* [Overview](#overview)
* [Installing ONLYOFFICE Document Server](#installing-onlyoffice-document-server)
* [ONLYOFFICE Document Server editions](#onlyoffice-document-server-editions)
* [Installing Nextcloud-ONLYOFFICE integration app](#installing-nextcloud-onlyoffice-integration-app)
* [Configuring Nextcloud-ONLYOFFICE integration app](#configuring-nextcloud-onlyoffice-integration-app)
* [How it works](#how-it-works)
* [Known issues](#known-issues)

# Overview

This app enables users to edit office documents from [Nextcloud](https://nextcloud.com) using ONLYOFFICE Document Server.
Currently the following document formats can be edited with this app: csv, docx, pptx, txt, xlsx.
Expand All @@ -23,8 +33,69 @@ Or you can use Document Server behind a proxy, please refer to [this article](ht

The easiest way to start an instance of ONLYOFFICE Document Server is to use [Docker](https://github.com/ONLYOFFICE/Docker-DocumentServer).


## Installing Nextcloud ONLYOFFICE integration app
## ONLYOFFICE Document Server editions

ONLYOFFICE offers different versions of its online document editors that can be deployed on your own servers.

ONLYOFFICE Document Server:
* Community Edition (`onlyoffice-documentserver` package)

* Integration Edition (`onlyoffice-documentserver-ie` package)

The table below will help you to make the right choice.

| Pricing and licensing | Community Edition | Integration Edition |
| ------------- | ------------- | ------------- |
| | [Get it now](https://www.onlyoffice.com/download.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) | [Start Free Trial](https://www.onlyoffice.com/connectors-request.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) |
| Cost | FREE | [Go to the pricing page](https://www.onlyoffice.com/integration-edition-prices.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) |
| Simultaneous connections | up to 20 maximum | As in chosen pricing plan |
| Number of users | up to 20 recommended | As in chosen pricing plan |
| License | GNU AGPL v.3 | Proprietary |
| **Support** | **Community Edition** | **Integration Edition** |
| Documentation | [Help Center](https://helpcenter.onlyoffice.com/server/docker/opensource/index.aspx) | [Help Center](https://helpcenter.onlyoffice.com/server/integration-edition/index.aspx) |
| Standard support | [GitHub](https://github.com/ONLYOFFICE/DocumentServer/issues) or paid | One year support included |
| Premium support | [Buy Now](https://www.onlyoffice.com/support.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) | [Buy Now](https://www.onlyoffice.com/support.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) |
| **Services** | **Community Edition** | **Integration Edition** |
| Conversion Service | + | + |
| Document Builder Service | - | + |
| **Interface** | **Community Edition** | **Integration Edition** |
| Tabbed interface | - | + |
| White Label | - | - |
| Integrated test example (node.js)* | - | + |
| **Plugins & Macros** | **Community Edition** | **Integration Edition** |
| Plugins | + | + |
| Macros | + | + |
| **Collaborative capabilities** | **Community Edition** | **Integration Edition** |
| Two co-editing modes | + | + |
| Comments | + | + |
| Built-in chat | + | + |
| Review and tracking changes | + | + |
| Display modes of tracking changes | - | + |
| Version history | + | + |
| **Document Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Content control | - | + |
| Layout tools | + | + |
| Table of contents | + | + |
| Navigation panel | - | + |
| Mail Merge | + | + |
| **Spreadsheet Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Functions, formulas, equations | + | + |
| Table templates | + | + |
| Pivot tables | - | +** |
| **Presentation Editor features** | **Community Edition** | **Integration Edition** |
| Font and paragraph formatting | + | + |
| Object insertion | + | + |
| Animations | + | + |
| Presenter mode | - | + |
| Notes | + | + |
| | [Get it now](https://www.onlyoffice.com/download.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) | [Start Free Trial](https://www.onlyoffice.com/connectors-request.aspx?utm_source=github&utm_medium=cpc&utm_campaign=GitHubNextcloud) |


## Installing Nextcloud-ONLYOFFICE integration app

The Nextcloud administrator can install the integration app from the in-built application market.
For that go to the user name and select **Apps**.
Expand Down Expand Up @@ -58,7 +129,7 @@ There are several ways to do that:
3. In Nextcloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.


## Configuring Nextcloud ONLYOFFICE integration app
## Configuring Nextcloud-ONLYOFFICE integration app

In Nextcloud open the `~/index.php/settings/admin/onlyoffice` page with administrative settings for **ONLYOFFICE** section.
Enter the following address to connect ONLYOFFICE Document Server:
Expand Down
4 changes: 2 additions & 2 deletions appinfo/info.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
<?xml version="1.0"?>
<info>
<id>onlyoffice</id>
<ocsid>174798</ocsid>
<name>ONLYOFFICE</name>
<summary>ONLYOFFICE connector</summary>
<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="[email protected]" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
<version>2.1.10</version>
<version>2.3.0</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
Expand All @@ -22,6 +21,7 @@
<category>office</category>
<category>tools</category>
<website>https://www.onlyoffice.com</website>
<discussion>https://dev.onlyoffice.org/</discussion>
<bugs>https://github.com/ONLYOFFICE/onlyoffice-nextcloud/issues</bugs>
<repository type="git">https://github.com/ONLYOFFICE/onlyoffice-nextcloud.git</repository>
<screenshot small-thumbnail="https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/main_small.png">https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-nextcloud/master/screenshots/main.png</screenshot>
Expand Down
3 changes: 2 additions & 1 deletion appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
["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" => "settings#save_settings", "url" => "/ajax/settings", "verb" => "PUT"],
["name" => "settings#save_address", "url" => "/ajax/settings/address", "verb" => "PUT"],
["name" => "settings#save_common", "url" => "/ajax/settings/common", "verb" => "PUT"],
["name" => "settings#get_settings", "url" => "/ajax/settings", "verb" => "GET"],
]
];
38 changes: 24 additions & 14 deletions controller/callbackcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function track($doc, $users, $key, $status, $url, $token) {

$trackerStatus = $this->_trackerStatus[$status];

$error = 1;
$result = 1;
switch ($trackerStatus) {
case "MustSave":
case "Corrupted":
Expand All @@ -373,26 +373,34 @@ public function track($doc, $users, $key, $status, $url, $token) {
}

try {
$ownerId = $hashData->ownerId;
$token = isset($hashData->token) ? $hashData->token : NULL;
if (empty($ownerId) && empty($token)) {
$this->logger->error("Track without owner: " . $fileId . " status " . $trackerStatus, array("app" => $this->appName));
return new JSONResponse(["message" => $this->trans->t("File owner is empty")], Http::STATUS_BAD_REQUEST);
}

$userId = $users[0];
$user = $this->userManager->get($userId);
if (!empty($user)) {
\OC_Util::tearDownFS();
\OC_Util::setupFS($userId);

$this->userSession->setUser($user);
} else {
$ownerId = $hashData->ownerId;
$this->logger->debug("Track by anonymous " . $userId, array("app" => $this->appName));
}

\OC_Util::tearDownFS();
if (!empty($ownerId)) {
\OC_Util::setupFS($ownerId);
}
if ($this->config->checkEncryptionModule() === "master") {
\OC_User::setIncognitoMode(true);
}

$token = isset($hashData->token) ? $hashData->token : NULL;
list ($file, $error) = empty($token) ? $this->getFile($userId, $fileId) : $this->getFileByToken($fileId, $token);
\OC_Util::tearDownFS();
if (!empty($ownerId)) {
\OC_Util::setupFS($ownerId);
}

list ($file, $error) = !empty($ownerId) ? $this->getFile($ownerId, $fileId) : $this->getFileByToken($fileId, $token);

if (isset($error)) {
$this->logger->error("track error" . $fileId ." " . $error, array("app" => $this->appName));
return $error;
}

Expand Down Expand Up @@ -430,22 +438,24 @@ public function track($doc, $users, $key, $status, $url, $token) {
}

$newData = $documentService->Request($url);

$this->logger->debug("Track put content " . $file->getPath(), array("app" => $this->appName));
$file->putContent($newData);
$error = 0;
$result = 0;
} catch (\Exception $e) {
$this->logger->error("Track " . $trackerStatus . " error: " . $e->getMessage(), array("app" => $this->appName));
}
break;

case "Editing":
case "Closed":
$error = 0;
$result = 0;
break;
}

$this->logger->debug("Track: " . $fileId . " status " . $status . " result " . $error, array("app" => $this->appName));

return new JSONResponse(["error" => $error], Http::STATUS_OK);
return new JSONResponse(["error" => $result], Http::STATUS_OK);
}


Expand Down
48 changes: 37 additions & 11 deletions controller/editorcontroller.php
Original file line number Diff line number Diff line change
Expand Up @@ -485,6 +485,7 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
"document" => [
"fileType" => $ext,
"key" => DocumentService::GenerateRevisionId($key),
"permissions" => [],
"title" => $fileName,
"url" => $fileUrl,
],
Expand All @@ -494,8 +495,9 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
]
];

if (\OC::$server->getRequest()->isUserAgent([$this::USER_AGENT_MOBILE])) {
$params["type"] = "mobile";
$permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter);
if (isset($permissions_modifyFilter)) {
$params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter;
}

$canEdit = isset($format["edit"]) && $format["edit"];
Expand All @@ -520,6 +522,10 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
$params["editorConfig"]["mode"] = "view";
}

if (\OC::$server->getRequest()->isUserAgent([$this::USER_AGENT_MOBILE])) {
$params["type"] = "mobile";
}

if (!empty($userId)) {
$params["editorConfig"]["user"] = [
"id" => $userId,
Expand All @@ -530,7 +536,7 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals
$folderLink = NULL;

if (!empty($token)) {
if (method_exists($share, getHideDownload) && $share->getHideDownload()) {
if (method_exists($share, "getHideDownload") && $share->getHideDownload()) {
$params["document"]["permissions"] = [
"download" => false,
"print" => false
Expand Down Expand Up @@ -576,14 +582,6 @@ public function config($fileId, $filePath = NULL, $token = NULL, $desktop = fals

$params = $this->setCustomization($params);

$permissions_modifyFilter = $this->config->getSystemValue($this->config->_permissions_modifyFilter);
if (isset($permissions_modifyFilter)) {
if (!array_key_exists("permissions", $params["document"])) {
$params["document"]["permissions"] = [];
}
$params["document"]["permissions"]["modifyFilter"] = $permissions_modifyFilter;
}

if (!empty($this->config->GetDocumentServerSecret())) {
$token = \Firebase\JWT\JWT::encode($params, $this->config->GetDocumentServerSecret());
$params["token"] = $token;
Expand Down Expand Up @@ -776,6 +774,34 @@ private function getUrl($fileId, $token = NULL) {
* @return array
*/
private function setCustomization($params) {
//default is true
if ($this->config->GetCustomizationChat() === false) {
$params["editorConfig"]["customization"]["chat"] = false;
}

//default is false
if ($this->config->GetCustomizationCompactHeader() === true) {
$params["editorConfig"]["customization"]["compactHeader"] = true;
}

//default is false
if ($this->config->GetCustomizationFeedback() === true) {
$params["editorConfig"]["customization"]["feedback"] = true;
}

//default is true
if ($this->config->GetCustomizationHelp() === false) {
$params["editorConfig"]["customization"]["help"] = false;
}

//default is false
if ($this->config->GetCustomizationToolbarNoTabs() === true) {
$params["editorConfig"]["customization"]["toolbarNoTabs"] = true;
}


/* from system config */

$customer = $this->config->getSystemValue($this->config->_customization_customer);
if (isset($customer)) {
$params["editorConfig"]["customization"]["customer"] = $customer;
Expand Down
Loading

0 comments on commit 9a81db9

Please sign in to comment.