diff --git a/README.md b/README.md index aee1828a..e88f3adb 100644 --- a/README.md +++ b/README.md @@ -1,104 +1,45 @@ -# ![](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) +This app enables users to edit office documents from [Nextcloud](https://nextcloud.com) using ONLYOFFICE Document Server - [Community or Integration Edition](#onlyoffice-document-server-editions). -# Overview +## Features -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. -The above mentioned formats are also available for viewing together with pdf. -The edited files of the corresponding type can be converted into the Office Open XML formats: doc, docm, dot, dotx, epub, htm, html, odp, odt, pot, potm, potx, pps, ppsm, ppsx, ppt, pptm, rtf, xls, xlsm, xlsx, xlt, xltm, xltx. +The app allows to: -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 Nextcloud. +* Create and edit text documents, spreadsheets, and presentations. +* Share files to other users. +* Protect documents with watermarks. +* Co-edit documents in real-time: use two co-editing modes (Fast and Strict), Track Changes, comments, and built-in chat. Co-editing is also available between several federated Nextcloud instances connected to one Document Server. -You can also use our **[Docker installation](https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud)** to get installed and configured Document Server and Nextcloud installation with a couple of commands. +Supported formats: +* For viewing and editing: DOCX, XLSX, PPTX, CSV, TXT. +* For viewing only: PDF. +* For converting to Office Open XML formats: DOC, DOCM, DOT, DOTX, EPUB, HTM, HTML, ODP, ODT, POT, POTM, POTX, PPS, PPSM, PPSX, PPT, PPTM, RTF, XLS, XLSM, XLT, XLTM, XLTX. ## Installing ONLYOFFICE Document Server -You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from Nextcloud and any end clients (version 4.2.7 and later are supported for use with the app). -If that is not the case, use the official ONLYOFFICE Document Server documentation page: [Document Server for Linux](https://helpcenter.onlyoffice.com/server/linux/document/linux-installation.aspx). ONLYOFFICE Document Server must also be able to POST to Nextcloud directly. +You will need an instance of ONLYOFFICE Document Server that is resolvable and connectable both from Nextcloud and any end clients (version 4.2.7 and later are supported for use with the app).ONLYOFFICE Document Server must also be able to POST to Nextcloud directly. -Starting with version 4.3.0, ONLYOFFICE Document Server and Nextcloud can be installed either on different computers, or on the same machine. -In case you select the latter variant, you will need to set up a custom port for Document Server as by default both ONLYOFFICE Document Server and Nextcloud work on port 80. -Or you can use Document Server behind a proxy, please refer to [this article](https://helpcenter.onlyoffice.com/server/document/document-server-proxy.aspx) to learn how you can configure it. +Starting with version 4.3.0, ONLYOFFICE Document Server and Nextcloud can be installed either on different computers, or on the same machine. If you use one machine, set up a custom port for Document Server as by default both ONLYOFFICE Document Server and Nextcloud work on port 80. -The easiest way to start an instance of ONLYOFFICE Document Server is to use [Docker](https://github.com/ONLYOFFICE/Docker-DocumentServer). +You can install free Community version of ONLYOFFICE Document Server or scalable enterprise-level Integration Edition. -## 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) +To install free Community version, use [Docker](https://github.com/onlyoffice/Docker-DocumentServer) (recommended) or follow [these instructions](https://helpcenter.onlyoffice.com/server/linux/document/linux-installation.aspx) for Debian, Ubuntu, or derivatives. -* Integration Edition (`onlyoffice-documentserver-ie` package) +To install Integration Edition, follow instructions [here](https://helpcenter.onlyoffice.com/server/integration-edition/index.aspx). -The table below will help you to make the right choice. +Community Edition vs Integration Edition comparison can be found [here](#onlyoffice-document-server-editions). -| 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) | +To use ONLYOFFICE behind a proxy, please refer to [this article](https://helpcenter.onlyoffice.com/server/document/document-server-proxy.aspx). +You can also use our **[Docker installation](https://github.com/ONLYOFFICE/docker-onlyoffice-nextcloud)** to install pre-configured Document Server (free version) and Nextcloud with a couple of commands. -## Installing Nextcloud-ONLYOFFICE integration app +## 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**. + After that find **ONLYOFFICE** in the list of available applications and install it. If the server with the Nextcloud installed does not have an Internet access, or if you need it for some other reason, the administrator can install the application manually. @@ -108,7 +49,6 @@ To start using ONLYOFFICE Document Server with Nextcloud, the following steps mu ``` cd apps/ ``` - 2. Get the Nextcloud ONLYOFFICE integration app. There are several ways to do that: @@ -124,12 +64,10 @@ There are several ways to do that: 2. Change the owner to update the application right from Nextcloud web interface: ``` chown -R www-data:www-data onlyoffice - ``` - + ``` 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: @@ -155,7 +93,6 @@ Enable or disable the _Open file in the same tab_ setting. The **Open in ONLYOFFICE** action will be added to the file context menu. You can specify this action as default and it will be used when the file name is clicked for the selected file types. - ## How it works The ONLYOFFICE integration follows the API documented here https://api.onlyoffice.com/editors/basic: @@ -217,3 +154,72 @@ The instruction on enabling _master key_ based encryption is available in the of ) ``` This will disable the certificate verification and allow Nextcloud to establish connection with **Document Server**, but you must remember that this is a temporary insecure solution and we strongly recommend that you replace the certificate with the one issued by some CA. Once you do that, do not forget to remove the above section from Nextcloud config file. + +## 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)* | - | + | +| Mobile web editors | - | + | +| **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 | + | + | +| Adding Content control | - | + | +| Editing Content control | + | + | +| Layout tools | + | + | +| Table of contents | + | + | +| Navigation panel | + | + | +| Mail Merge | + | + | +| Comparing Documents | - | +* | +| **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) | + +\* It's possible to add documents for comparison from your local drive, from URL and from ownCloud storage. + +\** Changing style and deleting (Full support coming soon) + diff --git a/assets/bg/new.odp b/assets/bg/new.odp new file mode 100644 index 00000000..69145b6d Binary files /dev/null and b/assets/bg/new.odp differ diff --git a/assets/bg/new.ods b/assets/bg/new.ods new file mode 100644 index 00000000..1e990559 Binary files /dev/null and b/assets/bg/new.ods differ diff --git a/assets/bg/new.odt b/assets/bg/new.odt new file mode 100644 index 00000000..4a660423 Binary files /dev/null and b/assets/bg/new.odt differ diff --git a/assets/cs/new.odp b/assets/cs/new.odp new file mode 100644 index 00000000..f3856ae0 Binary files /dev/null and b/assets/cs/new.odp differ diff --git a/assets/cs/new.ods b/assets/cs/new.ods new file mode 100644 index 00000000..b6d889e3 Binary files /dev/null and b/assets/cs/new.ods differ diff --git a/assets/cs/new.odt b/assets/cs/new.odt new file mode 100644 index 00000000..3baa3386 Binary files /dev/null and b/assets/cs/new.odt differ diff --git a/assets/de/new.odp b/assets/de/new.odp new file mode 100644 index 00000000..3ec9a4b6 Binary files /dev/null and b/assets/de/new.odp differ diff --git a/assets/de/new.ods b/assets/de/new.ods new file mode 100644 index 00000000..e45d1945 Binary files /dev/null and b/assets/de/new.ods differ diff --git a/assets/de/new.odt b/assets/de/new.odt new file mode 100644 index 00000000..cbacefe2 Binary files /dev/null and b/assets/de/new.odt differ diff --git a/assets/de_DE/new.odp b/assets/de_DE/new.odp new file mode 100644 index 00000000..d6791b92 Binary files /dev/null and b/assets/de_DE/new.odp differ diff --git a/assets/de_DE/new.ods b/assets/de_DE/new.ods new file mode 100644 index 00000000..2f7d772d Binary files /dev/null and b/assets/de_DE/new.ods differ diff --git a/assets/de_DE/new.odt b/assets/de_DE/new.odt new file mode 100644 index 00000000..3a36f0d4 Binary files /dev/null and b/assets/de_DE/new.odt differ diff --git a/assets/el/new.odp b/assets/el/new.odp new file mode 100644 index 00000000..4cb1faf1 Binary files /dev/null and b/assets/el/new.odp differ diff --git a/assets/el/new.ods b/assets/el/new.ods new file mode 100644 index 00000000..0c8c9707 Binary files /dev/null and b/assets/el/new.ods differ diff --git a/assets/el/new.odt b/assets/el/new.odt new file mode 100644 index 00000000..9b1d47ac Binary files /dev/null and b/assets/el/new.odt differ diff --git a/assets/en/new.odp b/assets/en/new.odp new file mode 100644 index 00000000..bd3a29de Binary files /dev/null and b/assets/en/new.odp differ diff --git a/assets/en/new.ods b/assets/en/new.ods new file mode 100644 index 00000000..394151a7 Binary files /dev/null and b/assets/en/new.ods differ diff --git a/assets/en/new.odt b/assets/en/new.odt new file mode 100644 index 00000000..d39db3e8 Binary files /dev/null and b/assets/en/new.odt differ diff --git a/assets/en_GB/new.odp b/assets/en_GB/new.odp new file mode 100644 index 00000000..91cbfc2e Binary files /dev/null and b/assets/en_GB/new.odp differ diff --git a/assets/en_GB/new.ods b/assets/en_GB/new.ods new file mode 100644 index 00000000..e4a3ebe2 Binary files /dev/null and b/assets/en_GB/new.ods differ diff --git a/assets/en_GB/new.odt b/assets/en_GB/new.odt new file mode 100644 index 00000000..e874b044 Binary files /dev/null and b/assets/en_GB/new.odt differ diff --git a/assets/es/new.odp b/assets/es/new.odp new file mode 100644 index 00000000..93d9d364 Binary files /dev/null and b/assets/es/new.odp differ diff --git a/assets/es/new.ods b/assets/es/new.ods new file mode 100644 index 00000000..1669ad9c Binary files /dev/null and b/assets/es/new.ods differ diff --git a/assets/es/new.odt b/assets/es/new.odt new file mode 100644 index 00000000..f0a50b4e Binary files /dev/null and b/assets/es/new.odt differ diff --git a/assets/fr/new.odp b/assets/fr/new.odp new file mode 100644 index 00000000..8f28327e Binary files /dev/null and b/assets/fr/new.odp differ diff --git a/assets/fr/new.ods b/assets/fr/new.ods new file mode 100644 index 00000000..5b606567 Binary files /dev/null and b/assets/fr/new.ods differ diff --git a/assets/fr/new.odt b/assets/fr/new.odt new file mode 100644 index 00000000..fc39f6ce Binary files /dev/null and b/assets/fr/new.odt differ diff --git a/assets/it/new.odp b/assets/it/new.odp new file mode 100644 index 00000000..590a9f9f Binary files /dev/null and b/assets/it/new.odp differ diff --git a/assets/it/new.ods b/assets/it/new.ods new file mode 100644 index 00000000..1f494fc9 Binary files /dev/null and b/assets/it/new.ods differ diff --git a/assets/it/new.odt b/assets/it/new.odt new file mode 100644 index 00000000..e2c2ac16 Binary files /dev/null and b/assets/it/new.odt differ diff --git a/assets/ko/new.odp b/assets/ko/new.odp new file mode 100644 index 00000000..8a474345 Binary files /dev/null and b/assets/ko/new.odp differ diff --git a/assets/ko/new.ods b/assets/ko/new.ods new file mode 100644 index 00000000..987b2c0c Binary files /dev/null and b/assets/ko/new.ods differ diff --git a/assets/ko/new.odt b/assets/ko/new.odt new file mode 100644 index 00000000..140819d6 Binary files /dev/null and b/assets/ko/new.odt differ diff --git a/assets/nl/new.odp b/assets/nl/new.odp new file mode 100644 index 00000000..4e742250 Binary files /dev/null and b/assets/nl/new.odp differ diff --git a/assets/nl/new.ods b/assets/nl/new.ods new file mode 100644 index 00000000..f490e64c Binary files /dev/null and b/assets/nl/new.ods differ diff --git a/assets/nl/new.odt b/assets/nl/new.odt new file mode 100644 index 00000000..57f28578 Binary files /dev/null and b/assets/nl/new.odt differ diff --git a/assets/pl/new.odp b/assets/pl/new.odp new file mode 100644 index 00000000..db702ff6 Binary files /dev/null and b/assets/pl/new.odp differ diff --git a/assets/pl/new.ods b/assets/pl/new.ods new file mode 100644 index 00000000..5952a1b9 Binary files /dev/null and b/assets/pl/new.ods differ diff --git a/assets/pl/new.odt b/assets/pl/new.odt new file mode 100644 index 00000000..6fca8e0a Binary files /dev/null and b/assets/pl/new.odt differ diff --git a/assets/pt_BR/new.odp b/assets/pt_BR/new.odp new file mode 100644 index 00000000..124d9433 Binary files /dev/null and b/assets/pt_BR/new.odp differ diff --git a/assets/pt_BR/new.ods b/assets/pt_BR/new.ods new file mode 100644 index 00000000..358cd08a Binary files /dev/null and b/assets/pt_BR/new.ods differ diff --git a/assets/pt_BR/new.odt b/assets/pt_BR/new.odt new file mode 100644 index 00000000..41c85578 Binary files /dev/null and b/assets/pt_BR/new.odt differ diff --git a/assets/pt_PT/new.odp b/assets/pt_PT/new.odp new file mode 100644 index 00000000..711496f4 Binary files /dev/null and b/assets/pt_PT/new.odp differ diff --git a/assets/pt_PT/new.ods b/assets/pt_PT/new.ods new file mode 100644 index 00000000..614b94aa Binary files /dev/null and b/assets/pt_PT/new.ods differ diff --git a/assets/pt_PT/new.odt b/assets/pt_PT/new.odt new file mode 100644 index 00000000..b33754b6 Binary files /dev/null and b/assets/pt_PT/new.odt differ diff --git a/assets/ru/new.odp b/assets/ru/new.odp new file mode 100644 index 00000000..6e2fe037 Binary files /dev/null and b/assets/ru/new.odp differ diff --git a/assets/ru/new.ods b/assets/ru/new.ods new file mode 100644 index 00000000..022e4961 Binary files /dev/null and b/assets/ru/new.ods differ diff --git a/assets/ru/new.odt b/assets/ru/new.odt new file mode 100644 index 00000000..906a6fa6 Binary files /dev/null and b/assets/ru/new.odt differ diff --git a/assets/sv/new.odp b/assets/sv/new.odp new file mode 100644 index 00000000..4b95c151 Binary files /dev/null and b/assets/sv/new.odp differ diff --git a/assets/sv/new.ods b/assets/sv/new.ods new file mode 100644 index 00000000..214c96dc Binary files /dev/null and b/assets/sv/new.ods differ diff --git a/assets/sv/new.odt b/assets/sv/new.odt new file mode 100644 index 00000000..a13e4c9d Binary files /dev/null and b/assets/sv/new.odt differ diff --git a/assets/zh_CN/new.odp b/assets/zh_CN/new.odp new file mode 100644 index 00000000..0408f8ac Binary files /dev/null and b/assets/zh_CN/new.odp differ diff --git a/assets/zh_CN/new.ods b/assets/zh_CN/new.ods new file mode 100644 index 00000000..c84f97a5 Binary files /dev/null and b/assets/zh_CN/new.ods differ diff --git a/assets/zh_CN/new.odt b/assets/zh_CN/new.odt new file mode 100644 index 00000000..ddf396ee Binary files /dev/null and b/assets/zh_CN/new.odt differ diff --git a/controller/settingscontroller.php b/controller/settingscontroller.php index 7292ce6d..95f41036 100644 --- a/controller/settingscontroller.php +++ b/controller/settingscontroller.php @@ -130,7 +130,8 @@ public function index() { "toolbarNoTabs" => $this->config->GetCustomizationToolbarNoTabs(), "successful" => $this->config->SettingsAreSuccessful(), "watermark" => $this->config->GetWatermarkSettings(), - "tagsEnabled" => App::isEnabled("systemtags") + "tagsEnabled" => App::isEnabled("systemtags"), + "odf" => $this->config->GetOdfDefault(), ]; return new TemplateResponse($this->appName, "settings", $data, "blank"); } @@ -192,6 +193,7 @@ public function SaveAddress($documentserver, * @param bool $feedback - display feedback * @param bool $help - display help * @param bool $toolbarNoTabs - display toolbar tab + * @param bool $odf - create ODF files by default * * @return array */ @@ -203,7 +205,8 @@ public function SaveCommon($defFormats, $compactHeader, $feedback, $help, - $toolbarNoTabs + $toolbarNoTabs, + $odf ) { $this->config->SetDefaultFormats($defFormats); @@ -215,6 +218,7 @@ public function SaveCommon($defFormats, $this->config->SetCustomizationFeedback($feedback); $this->config->SetCustomizationHelp($help); $this->config->SetCustomizationToolbarNoTabs($toolbarNoTabs); + $this->config->SetOdfDefault($odf); return [ ]; @@ -253,7 +257,8 @@ public function SaveWatermark($settings) { public function GetSettings() { $result = [ "formats" => $this->config->FormatsSetting(), - "sameTab" => $this->config->GetSameTab() + "sameTab" => $this->config->GetSameTab(), + "odf" => $this->config->GetOdfDefault(), ]; return $result; } diff --git a/js/main.js b/js/main.js index b2c7cfeb..fd7fc90a 100644 --- a/js/main.js +++ b/js/main.js @@ -309,39 +309,43 @@ return; } - menu.addMenuEntry({ - id: "onlyofficeDocx", - displayName: t(OCA.Onlyoffice.AppName, "Document"), - templateName: t(OCA.Onlyoffice.AppName, "Document"), - iconClass: "icon-onlyoffice-new-docx", - fileType: "docx", - actionHandler: function (name) { - OCA.Onlyoffice.CreateFile(name + ".docx", fileList); - } - }); + var register = function() { + const odf = OCA.Onlyoffice.setting.odf; + menu.addMenuEntry({ + id: "onlyofficeDocx", + displayName: t(OCA.Onlyoffice.AppName, "Document"), + templateName: t(OCA.Onlyoffice.AppName, "Document"), + iconClass: "icon-onlyoffice-new-docx", + fileType: "docx", + actionHandler: function (name) { + OCA.Onlyoffice.CreateFile(name + (odf ? ".odt" : ".docx"), fileList); + } + }); - menu.addMenuEntry({ - id: "onlyofficeXlsx", - displayName: t(OCA.Onlyoffice.AppName, "Spreadsheet"), - templateName: t(OCA.Onlyoffice.AppName, "Spreadsheet"), - iconClass: "icon-onlyoffice-new-xlsx", - fileType: "xlsx", - actionHandler: function (name) { - OCA.Onlyoffice.CreateFile(name + ".xlsx", fileList); - } - }); + menu.addMenuEntry({ + id: "onlyofficeXlsx", + displayName: t(OCA.Onlyoffice.AppName, "Spreadsheet"), + templateName: t(OCA.Onlyoffice.AppName, "Spreadsheet"), + iconClass: "icon-onlyoffice-new-xlsx", + fileType: "xlsx", + actionHandler: function (name) { + OCA.Onlyoffice.CreateFile(name + (odf ? ".ods" : ".xlsx"), fileList); + } + }); - menu.addMenuEntry({ - id: "onlyofficePpts", - displayName: t(OCA.Onlyoffice.AppName, "Presentation"), - templateName: t(OCA.Onlyoffice.AppName, "Presentation"), - iconClass: "icon-onlyoffice-new-pptx", - fileType: "pptx", - actionHandler: function (name) { - OCA.Onlyoffice.CreateFile(name + ".pptx", fileList); - } - }); - } + menu.addMenuEntry({ + id: "onlyofficePpts", + displayName: t(OCA.Onlyoffice.AppName, "Presentation"), + templateName: t(OCA.Onlyoffice.AppName, "Presentation"), + iconClass: "icon-onlyoffice-new-pptx", + fileType: "pptx", + actionHandler: function (name) { + OCA.Onlyoffice.CreateFile(name + (odf ? ".odp" : ".pptx"), fileList); + } + }); + }; + OCA.Onlyoffice.GetSettings(register); + }, }; var getFileExtension = function (fileName) { diff --git a/js/settings.js b/js/settings.js index a2f36334..4670817a 100644 --- a/js/settings.js +++ b/js/settings.js @@ -208,6 +208,7 @@ var feedback = $("#onlyofficeFeedback").is(":checked"); var help = $("#onlyofficeHelp").is(":checked"); var toolbarNoTabs = !$("#onlyofficeToolbarNoTabs").is(":checked"); + var odf = $("#defaultOdf").is(":checked"); $.ajax({ method: "PUT", @@ -221,7 +222,8 @@ compactHeader: compactHeader, feedback: feedback, help: help, - toolbarNoTabs: toolbarNoTabs + toolbarNoTabs: toolbarNoTabs, + odf: odf, }, success: function onSuccess(response) { $(".section-onlyoffice").removeClass("icon-loading"); diff --git a/lib/appconfig.php b/lib/appconfig.php index 88a101ed..40ba978a 100644 --- a/lib/appconfig.php +++ b/lib/appconfig.php @@ -31,9 +31,11 @@ use \DateInterval; use \DateTime; +use \Exception; use OCP\IConfig; use OCP\ILogger; +use OCP\IUser; /** * Application configutarion @@ -154,6 +156,13 @@ class AppConfig { */ private $_customizationToolbarNoTabs = "customizationToolbarNoTabs"; + /** + * The config key for ODF being set as default + * + * @var string + */ + private $_odfDefault = "odf"; + /** * The config key for the setting limit groups * @@ -490,6 +499,29 @@ public function GetStorageUrl() { return $url; } + /** + * Set whether default file type is set to ODF + * + * @param bool $default + */ + public function SetOdfDefault($default = false) { + $this->config->setAppValue($this->appName, $this->_odfDefault, $default); + } + + /** + * Get whether default file type is set to ODF + * + * @return bool + */ + public function GetOdfDefault() { + $odfDefault = $this->GetSystemValue($this->_odfDefault); + + if (empty($odfDefault)) { + $odfDefault = $this->config->getAppValue($this->appName, $this->_odfDefault, false); + } + return $odfDefault; + } + /** * Save the document service secret key to the application configuration * diff --git a/lib/filecreator.php b/lib/filecreator.php index 31c18e8c..caca24c7 100644 --- a/lib/filecreator.php +++ b/lib/filecreator.php @@ -75,7 +75,7 @@ class FileCreator extends ACreateEmpty { * @param string $AppName - application name * @param IL10N $trans - l10n service * @param ILogger $logger - logger - * @param string $format - format for creation + * @param string $format - format for creation */ public function __construct($AppName, IL10N $trans, @@ -104,8 +104,10 @@ public function getId(): string { public function getName(): string { switch ($this->format) { case "xlsx": + case "ods": return $this->trans->t("Spreadsheet"); case "pptx": + case "odp": return $this->trans->t("Presentation"); } return $this->trans->t("Document"); @@ -131,6 +133,12 @@ public function getMimetype(): string { return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; case "pptx": return "application/vnd.openxmlformats-officedocument.presentationml.presentation"; + case "odt": + return "application/vnd.oasis.opendocument.text"; + case "ods": + return "application/vnd.oasis.opendocument.spreadsheet"; + case "odp": + return "application/vnd.oasis.opendocument.presentation"; } return "application/vnd.openxmlformats-officedocument.wordprocessingml.document"; } diff --git a/templates/settings.php b/templates/settings.php index ba816e15..a9977ad9 100644 --- a/templates/settings.php +++ b/templates/settings.php @@ -114,6 +114,13 @@
++ checked="checked" /> + +
+t("The default application for opening the format")) ?>