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>2017-03-03 11:34:09 +0300
committerGitHub <noreply@github.com>2017-03-03 11:34:09 +0300
commit0a38a6a2f12716f08a66b84130b73a261bfbc33f (patch)
tree16cca576fb3a379666b6638df9c3cd481c780061
parentae7434a6357c43d69cf1886163618fda3215e0d3 (diff)
parent9fc0b0dddf45565319160f9d8365da67e5d4f807 (diff)
Merge pull request #11 from ONLYOFFICE/release/1.0.1v1.0.1
Release/1.0.1
-rw-r--r--CHANGELOG.md10
-rw-r--r--README.md34
-rw-r--r--appinfo/info.xml10
-rw-r--r--controller/editorcontroller.php8
-rw-r--r--controller/settingscontroller.php4
-rw-r--r--css/main.css6
-rw-r--r--js/main.js16
-rw-r--r--lib/adminsettings.php70
-rw-r--r--lib/appconfig.php13
-rw-r--r--settings.php2
-rw-r--r--templates/editor.php3
11 files changed, 131 insertions, 45 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 973cf37..e0cc51d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,2 +1,8 @@
-owncloud-onlyoffice (1.0.0)
-* Initial release \ No newline at end of file
+## 1.0.1
+- fix exception when versions app is disabled
+- adding protocol to document server url
+- onlyofficeOpen is default action
+- Nextcloud 11 compatibility
+
+## 1.0.0
+- Initial release \ No newline at end of file
diff --git a/README.md b/README.md
index 09c45b0..f00249e 100644
--- a/README.md
+++ b/README.md
@@ -1,36 +1,36 @@
-# ![](screenshots/icon.png) OwnCloud ONLYOFFICE integration app
+# ![](screenshots/icon.png) ownCloud/Nextcloud ONLYOFFICE integration app
-This app enables users to edit office documents from [ownCloud](https://owncloud.com) using ONLYOFFICE Document Server. Currently the following document formats can be edited with this app: DOCX, XLSX, PPTX, TXT. The above mentioned formats are also available for viewing together with PDF and CSV. The edited files of the corresponding type can be converted into the Office Open XML formats: ODT, ODS, ODP, DOC, XLS, PPT, PPS, EPUB, RTF, HTML, HTM.
+This app enables users to edit office documents from [ownCloud](https://owncloud.com)/[Nextcloud](https://nextcloud.com) using ONLYOFFICE Document Server. Currently the following document formats can be edited with this app: DOCX, XLSX, PPTX, TXT. The above mentioned formats are also available for viewing together with PDF and CSV. The edited files of the corresponding type can be converted into the Office Open XML formats: ODT, ODS, ODP, DOC, XLS, PPT, PPS, EPUB, RTF, HTML, HTM.
-The app will create an item in the `new` (+) menu to create **Document**, **Spreadsheet**, **Presentation**. It will also create a new **Open in ONLYOFFICE** menu option within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to ownCloud.
+The app will create an item in the `new` (+) menu to create **Document**, **Spreadsheet**, **Presentation**. It will also create a new **Open in ONLYOFFICE** menu option within the document library for Office documents. This allows multiple users to collaborate in real time and to save back those changes to ownCloud/Nextcloud.
## Installing ONLYOFFICE Document Server
-You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from ownCloud and any end clients (version 3.0 and later are supported for use with the app). If that is not the case, use the official ONLYOFFICE Document Server documetnations page: [Document Server for Linux](http://helpcenter.onlyoffice.com/server/linux/document/linux-installation.aspx). ONLYOFFICE Document Server must also be able to POST to ownCloud directly.
+You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from ownCloud/Nextcloud and any end clients (version 3.0 and later are supported for use with the app). If that is not the case, use the official ONLYOFFICE Document Server documetnations page: [Document Server for Linux](http://helpcenter.onlyoffice.com/server/linux/document/linux-installation.aspx). ONLYOFFICE Document Server must also be able to POST to ownCloud directly.
The easiest way to start an instance of ONLYOFFICE Document Server is to use [Docker](https://github.com/ONLYOFFICE/Docker-DocumentServer).
-## Installing ownCloud ONLYOFFICE integration app
+## Installing ownCloud/Nextcloud ONLYOFFICE integration app
-To start using ONLYOFFICE Document Server with ownCloud, the following steps must be performed:
+To start using ONLYOFFICE Document Server with ownCloud/Nextcloud, the following steps must be performed:
-1. Place ownCloud ONLYOFFICE integration app to your ownCloud server into the _/apps_ (or some other) directory, [used](https://doc.owncloud.org/server/9.0/admin_manual/installation/apps_management_installation.html#using-custom-app-directories) to connect applications:
+1. Place ownCloud/Nextcloud ONLYOFFICE integration app to your ownCloud/Nextcloud server into the _/apps_ (or some other) directory, [used](https://doc.owncloud.org/server/9.0/admin_manual/installation/apps_management_installation.html#using-custom-app-directories) to connect applications:
```
cd apps/
git clone https://github.com/ONLYOFFICE/onlyoffice-owncloud.git onlyoffice
```
-2. In ownCloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.
+2. In ownCloud/Nextcloud open the `~/index.php/settings/apps?category=disabled` page with _Not enabled_ apps by administrator and click _Enable_ for the **ONLYOFFICE** application.
-## Configuring ownCloud ONLYOFFICE integration app
+## Configuring ownCloud/Nextcloud ONLYOFFICE integration app
-In ownCloud open the `~/index.php/settings/admin#onlyoffice` page with administrative settings for **ONLYOFFICE** section and enter the address
+In ownCloud/Nextcloud open the `~/index.php/settings/admin#onlyoffice` page with administrative settings for **ONLYOFFICE** section and enter the address
```
https://<documentserver>
@@ -44,11 +44,11 @@ Where the **documentserver** is the name of the server with the ONLYOFFICE Docum
The ONLYOFFICE integration follows the API documented here https://api.onlyoffice.com/editors/basic:
-* When creating a new file, the user navigates to a document folder within ownCloud and clicks the **Document**, **Spreadsheet** or **Presentation* item in the _new_ (+) menu.
+* When creating a new file, the user navigates to a document folder within ownCloud/Nextcloud and clicks the **Document**, **Spreadsheet** or **Presentation* item in the _new_ (+) menu.
* The browser invokes the `create` method in the `/lib/Controller/EditorController.php` controller. This method adds the copy of the file from the assets folder to the folder the user is currently in.
-* Or, when opening an existing file, the user navigates to it within ownCloud and selects the **Open in ONLYOFFICE** menu option.
+* Or, when opening an existing file, the user navigates to it within ownCloud/Nextcloud and selects the **Open in ONLYOFFICE** menu option.
* A new browser tab is opened and the `index` method of the `/lib/Controller/EditorController.php` controller is invoked.
@@ -62,16 +62,16 @@ The ONLYOFFICE integration follows the API documented here https://api.onlyoffic
* **userId** - the identification of the user;
* **userName** - the name of the user.
-* ownCloud takes this object and constructs a page from `templates/editor.php` template, filling in all of those values so that the client browser can load up the editor.
+* ownCloud/Nextcloud takes this object and constructs a page from `templates/editor.php` template, filling in all of those values so that the client browser can load up the editor.
* The client browser makes a request for the javascript library from ONLYOFFICE Document Server and sends ONLYOFFICE Document Server the DocEditor configuration with the above properties.
-* Then ONLYOFFICE Document Server downloads the document from ownCloud and the user begins editing.
+* Then ONLYOFFICE Document Server downloads the document from ownCloud/Nextcloud and the user begins editing.
-* ONLYOFFICE Document Server sends a POST request to the _callback_ URL to inform ownCloud that a user is editing the document.
+* ONLYOFFICE Document Server sends a POST request to the _callback_ URL to inform ownCloud/Nextcloud that a user is editing the document.
* When all users and client browsers are done with editing, they close the editing window.
-* After 10 seconds of inactivity, ONLYOFFICE Document Server sends a POST to the _callback_ URL letting ownCloud know that the clients have finished editing the document and closed it.
+* After 10 seconds of inactivity, ONLYOFFICE Document Server sends a POST to the _callback_ URL letting ownCloud/Nextcloud know that the clients have finished editing the document and closed it.
-* ownCloud downloads the new version of the document, replacing the old one.
+* ownCloud/Nextcloud downloads the new version of the document, replacing the old one.
diff --git a/appinfo/info.xml b/appinfo/info.xml
index 4545a21..212e1c1 100644
--- a/appinfo/info.xml
+++ b/appinfo/info.xml
@@ -6,8 +6,8 @@
<summary>ownCloud ONLYOFFICE integration app</summary>
<description>ONLYOFFICE integration app enables users to edit Office documents within ONLYOFFICE from OwnCloud. 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 OwnCloud.</description>
<licence>AGPL</licence>
- <author>Ascensio System SIA</author>
- <version>1.0.0</version>
+ <author mail="dev@onlyoffice.com" homepage="https://www.onlyoffice.com/">Ascensio System SIA</author>
+ <version>1.0.1</version>
<namespace>Onlyoffice</namespace>
<types>
<filesystem/>
@@ -24,6 +24,10 @@
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-owncloud/master/screenshots/open.png</screenshot>
<screenshot>https://raw.githubusercontent.com/ONLYOFFICE/onlyoffice-owncloud/master/screenshots/settings.png</screenshot>
<dependencies>
- <owncloud min-version="9.0" max-version="9.1" />
+ <owncloud min-version="9.0" max-version="9.2" />
+ <nextcloud min-version="11" max-version="11"/>
</dependencies>
+ <settings>
+ <admin>OCA\Onlyoffice\AdminSettings</admin>
+ </settings>
</info> \ No newline at end of file
diff --git a/controller/editorcontroller.php b/controller/editorcontroller.php
index 33e290b..5828e6d 100644
--- a/controller/editorcontroller.php
+++ b/controller/editorcontroller.php
@@ -26,6 +26,7 @@
namespace OCA\Onlyoffice\Controller;
+use OCP\App;
use OCP\AppFramework\Http\TemplateResponse;
use OCP\AppFramework\Http\ContentSecurityPolicy;
use OCP\AppFramework\Controller;
@@ -379,12 +380,11 @@ class EditorController extends Controller {
$key = $fileId . $file->getMtime();
- $ownerView = new View('/'.$ownerId.'/files');
+ $ownerView = new View("/" . $ownerId . "/files");
$filePath = $ownerView->getPath($fileId);
- $versions = "";
- try {
+ $versions = [];
+ if (App::isEnabled("files_versions")) {
$versions = Storage::getVersions($ownerId, $filePath);
- } catch (AutoloadNotAllowedException $e) {
}
$countVersions = count($versions);
diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php
index dcdf7b5..84a70e9 100644
--- a/controller/settingscontroller.php
+++ b/controller/settingscontroller.php
@@ -64,7 +64,7 @@ class SettingsController extends Controller {
* @return TemplateResponse
*/
public function index() {
- $data = [ "documentserver" => $this->config->GetDocumentServerUrl()];
+ $data = ["documentserver" => $this->config->GetDocumentServerUrl()];
return new TemplateResponse($this->appName, "settings", $data, "blank");
}
@@ -77,7 +77,7 @@ class SettingsController extends Controller {
*/
public function settings($documentserver) {
$this->config->SetDocumentServerUrl($documentserver);
- return [ "documentserver" => $this->config->GetDocumentServerUrl()];
+ return ["documentserver" => $this->config->GetDocumentServerUrl()];
}
/**
diff --git a/css/main.css b/css/main.css
index 34c3f68..7cdda33 100644
--- a/css/main.css
+++ b/css/main.css
@@ -23,12 +23,12 @@
*
*/
-.onlyoffice-new-docx {
+.icon-onlyoffice-new-docx {
background-image: url("../img/new-docx.svg");
}
-.onlyoffice-new-xlsx {
+.icon-onlyoffice-new-xlsx {
background-image: url("../img/new-xlsx.svg");
}
-.onlyoffice-new-pptx {
+.icon-onlyoffice-new-pptx {
background-image: url("../img/new-pptx.svg");
} \ No newline at end of file
diff --git a/js/main.js b/js/main.js
index 14dcf2d..7f506e9 100644
--- a/js/main.js
+++ b/js/main.js
@@ -80,8 +80,8 @@
}
};
- OCA.Onlyoffice.FileClick = function (context, attr) {
- var fileInfoModel = context.fileInfoModel;
+ OCA.Onlyoffice.FileClick = function (fileName, context, attr) {
+ var fileInfoModel = context.fileInfoModel || context.fileList.getModelForFile(fileName);
var fileList = context.fileList;
if (!attr.conv) {
OCA.Onlyoffice.OpenEditor(fileInfoModel.id);
@@ -140,9 +140,13 @@
return OC.imagePath(OCA.Onlyoffice.AppName, "btn-edit");
},
actionHandler: function (fileName, context) {
- OCA.Onlyoffice.FileClick(context, attr);
+ OCA.Onlyoffice.FileClick(fileName, context, attr);
}
});
+
+ if (attr.def && !fileList.fileActions.getDefaultFileAction(attr.mime, "file", OC.PERMISSION_READ)) {
+ fileList.fileActions.setDefault(attr.mime, "onlyofficeOpen");
+ }
});
}
);
@@ -160,7 +164,7 @@
menu.addMenuEntry({
id: "onlyofficeDocx",
displayName: t(OCA.Onlyoffice.AppName, "Document"),
- iconClass: "onlyoffice-new-docx",
+ iconClass: "icon-onlyoffice-new-docx",
fileType: "docx",
actionHandler: function (name) {
OCA.Onlyoffice.CreateFile(name + ".docx", fileList);
@@ -170,7 +174,7 @@
menu.addMenuEntry({
id: "onlyofficeXlsx",
displayName: t(OCA.Onlyoffice.AppName, "Spreadsheet"),
- iconClass: "onlyoffice-new-xlsx",
+ iconClass: "icon-onlyoffice-new-xlsx",
fileType: "xlsx",
actionHandler: function (name) {
OCA.Onlyoffice.CreateFile(name + ".xlsx", fileList);
@@ -180,7 +184,7 @@
menu.addMenuEntry({
id: "onlyofficePpts",
displayName: t(OCA.Onlyoffice.AppName, "Presentation"),
- iconClass: "onlyoffice-new-pptx",
+ iconClass: "icon-onlyoffice-new-pptx",
fileType: "pptx",
actionHandler: function (name) {
OCA.Onlyoffice.CreateFile(name + ".pptx", fileList);
diff --git a/lib/adminsettings.php b/lib/adminsettings.php
new file mode 100644
index 0000000..7497e75
--- /dev/null
+++ b/lib/adminsettings.php
@@ -0,0 +1,70 @@
+<?php
+/**
+ *
+ * (c) Copyright Ascensio System Limited 2010-2017
+ *
+ * This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
+ * General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
+ * In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
+ * Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
+ *
+ * THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
+ * FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
+ *
+ * You can contact Ascensio System SIA by email at sales@onlyoffice.com
+ *
+ * The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
+ * Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
+ *
+ * Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
+ * relevant author attributions when distributing the software. If the display of the logo in its graphic
+ * form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
+ * in every copy of the program you distribute.
+ * Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
+ *
+*/
+
+namespace OCA\Onlyoffice;
+
+use OCP\Settings\ISettings;
+
+use OCA\Onlyoffice\AppInfo\Application;
+
+/**
+ * Settings controller for the administration page
+ */
+class AdminSettings implements ISettings {
+
+ public function __construct() {
+ }
+
+ /**
+ * Print config section
+ *
+ * @return TemplateResponse
+ */
+ public function getForm() {
+ $app = new Application();
+ $container = $app->getContainer();
+ $response = $container->query("\OCA\Onlyoffice\Controller\SettingsController")->index();
+ return $response;
+ }
+
+ /**
+ * Get section ID
+ *
+ * @return string
+ */
+ public function getSection() {
+ return "server";
+ }
+
+ /**
+ * Get priority order
+ *
+ * @return int
+ */
+ public function getPriority() {
+ return 50;
+ }
+}
diff --git a/lib/appconfig.php b/lib/appconfig.php
index 1d34fbe..b97cfc9 100644
--- a/lib/appconfig.php
+++ b/lib/appconfig.php
@@ -78,7 +78,10 @@ class AppConfig {
* @param string $documentServer - document service address
*/
public function SetDocumentServerUrl($documentServer) {
- $documentServer = rtrim(trim($documentServer), "/");
+ $documentServer = strtolower(rtrim(trim($documentServer), "/"));
+ if (strlen($documentServer) > 0 && !preg_match("/^https?:\/\//i", $documentServer)) {
+ $documentServer = "http://" . $documentServer;
+ }
$this->config->setAppValue($this->appName, $this->_documentserver, $documentServer);
$this->DropSKey();
}
@@ -126,10 +129,10 @@ class AppConfig {
* @var array
*/
public $formats = [
- "docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true ],
- "xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true ],
- "pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true ],
- "ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "edit" => true ],
+ "docx" => [ "mime" => "application/vnd.openxmlformats-officedocument.wordprocessingml.document", "type" => "text", "edit" => true, "def" => true ],
+ "xlsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "type" => "spreadsheet", "edit" => true, "def" => true ],
+ "pptx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.presentation", "type" => "presentation", "edit" => true, "def" => true ],
+ "ppsx" => [ "mime" => "application/vnd.openxmlformats-officedocument.presentationml.slideshow", "type" => "presentation", "edit" => true, "def" => true ],
"txt" => [ "mime" => "text/plain", "type" => "text", "edit" => true ],
"csv" => [ "mime" => "text/csv", "type" => "spreadsheet"/*, "edit" => true*/ ],
"odt" => [ "mime" => "application/vnd.oasis.opendocument.text", "type" => "text", "conv" => true ],
diff --git a/settings.php b/settings.php
index a43e2a6..93e11b2 100644
--- a/settings.php
+++ b/settings.php
@@ -23,7 +23,7 @@
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
*
*/
-
+
namespace OCA\Onlyoffice;
use OCP\User;
diff --git a/templates/editor.php b/templates/editor.php
index a76de16..371cf55 100644
--- a/templates/editor.php
+++ b/templates/editor.php
@@ -37,9 +37,8 @@
p($_["documentServerUrl"]) .
print_unescaped("/web-apps/apps/api/documents/api.js\" type=\"text/javascript\"></script>");
} ?>
-
- <script type="text/javascript">
+ <script type="text/javascript" nonce="<?php p(base64_encode($_["requesttoken"])) ?>">
OCA.Onlyoffice.OpenEditor ({
error: "<?php empty($_["error"]) ? "" : p($_["error"]) ?>",