Compare commits

..

10 Commits

235 changed files with 2209 additions and 3031 deletions

View File

@ -25,7 +25,7 @@ jobs:
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp MVC) Example'
rm -rf ./deploy/'DotNet (Csharp MVC) Example'/assets/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: DotNet.Csharp.MVC.Example
path: ${{ github.workspace }}/web/documentserver-example/csharp-mvc/deploy

View File

@ -24,7 +24,7 @@ jobs:
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp) Example'
rm -rf ./deploy/'DotNet (Csharp) Example'/assets/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: DotNet.Csharp.Example
path: ${{ github.workspace }}/web/documentserver-example/csharp/deploy

View File

@ -25,7 +25,7 @@ jobs:
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-formats/.git
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Java.Example
path: ${{ github.workspace }}/web/documentserver-example/java/deploy

View File

@ -25,7 +25,7 @@ jobs:
rm -rf ./deploy/'Node.js Example'/public/assets/document-formats/.git
rm -rf ./deploy/'Node.js Example'/public/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Node.js.Example
path: ${{ github.workspace }}/web/documentserver-example/nodejs/deploy

View File

@ -25,7 +25,7 @@ jobs:
rm -rf ./deploy/'PHP Example'/assets/document-formats/.git
rm -rf ./deploy/'PHP Example'/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: PHP.Example
path: ${{ github.workspace }}/web/documentserver-example/php/deploy

View File

@ -25,7 +25,7 @@ jobs:
rm -rf ./deploy/'Python Example'/assets/document-formats/.git
rm -rf ./deploy/'Python Example'/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Python.Example
path: ${{ github.workspace }}/web/documentserver-example/python/deploy

View File

@ -25,7 +25,7 @@ jobs:
rm -rf ./deploy/'Ruby Example'/public/assets/document-formats/.git
rm -rf ./deploy/'Ruby Example'/public/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Ruby.Example
path: ${{ github.workspace }}/web/documentserver-example/ruby/deploy

View File

@ -26,7 +26,7 @@ jobs:
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-formats/.git
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-templates/.git
- name: Upload Artifact
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v3
with:
name: Java.Spring.Example
path: ${{ github.workspace }}/web/documentserver-example/java-spring/deploy

View File

@ -1,27 +0,0 @@
name: Create Tag
on:
push:
branches: [master]
paths-ignore:
- '.github/**'
- '**/AUTHORS.md'
- '**/LICENSE'
- '**/README.md'
jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Get Info
run: |
echo "version=$(grep -Eo '[0-9]+(\.[0-9]+)+' CHANGELOG.md | head -n 1)" >> $GITHUB_OUTPUT
id: info
- name: Create Tag
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
git tag -a 'v${{ steps.info.outputs.version }}' -m 'Release/v${{ steps.info.outputs.version }}'
git push origin 'v${{ steps.info.outputs.version }}'

View File

@ -2,8 +2,7 @@ name: Release
on:
push:
tags:
- 'v*'
branches: [master]
permissions:
contents: write

28
.gitmodules vendored
View File

@ -1,64 +1,72 @@
[submodule "web/documentserver-example/nodejs/public/assets/document-templates"]
path = web/documentserver-example/nodejs/public/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/nodejs/public/assets/document-formats"]
path = web/documentserver-example/nodejs/public/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/csharp-mvc/assets/document-templates"]
path = web/documentserver-example/csharp-mvc/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/csharp-mvc/assets/document-formats"]
path = web/documentserver-example/csharp-mvc/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/php/assets/document-templates"]
path = web/documentserver-example/php/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/php/assets/document-formats"]
path = web/documentserver-example/php/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/python/assets/document-templates"]
path = web/documentserver-example/python/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/java/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/ruby/assets/document-templates"]
path = web/documentserver-example/ruby/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/java-spring/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java-spring/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/go/static/assets/document-templates"]
path = web/documentserver-example/go/static/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/go/static/assets/document-formats"]
path = web/documentserver-example/go/static/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/python/assets/document-formats"]
path = web/documentserver-example/python/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/ruby/assets/document-formats"]
path = web/documentserver-example/ruby/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/java/src/main/resources/assets/document-formats"]
path = web/documentserver-example/java/src/main/resources/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/csharp/assets/document-templates"]
path = web/documentserver-example/csharp/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master
[submodule "web/documentserver-example/csharp/assets/document-formats"]
path = web/documentserver-example/csharp/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = feature/diagram
[submodule "web/documentserver-example/php-laravel/public/assets/document-templates"]
path = web/documentserver-example/php-laravel/public/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/default
branch = master

View File

@ -361,41 +361,6 @@ License: MIT
License File: serializer.license
web/documentserver-example/php-laravel
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.FileUpload.license
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
JWT - PHP package for JWT (https://github.com/firebase/php-jwt/blob/main/LICENSE)
License: BSD-3-Clause
License File: jwt.license
Laravel - Laravel is a web application framework with expressive, elegant syntax. Weve already laid the foundation for your next big idea — freeing you to create without sweating the small things. (https://github.com/laravel/framework/blob/master/LICENSE.md)
License - MIT
License File - laravel.license
web/documentserver-example/python
django-stubs - PEP-484 stubs for Django. (https://github.com/typeddjango/django-stubs/blob/master/LICENSE.md)

View File

@ -1,33 +1,20 @@
# Change Log
- update demo files
- set users by parts
- open the conversion dialog box with a gray check mark on the type selection step
- preload frame moved from uploading popap
- change tab title on rename
- change uploaded file name in popap if converted
- php-laravel: fix custom jwt header
- features tips for anonymous
- view odg, md
- edit xlsb
- java-spring: new document in selected language
- php-laravel: new document in selected language
- php: new document in selected language
- ruby: new document in selected language
- python: new document in selected language
- java: new document in selected language
- golang: new document in selected language
- csharp-mvc: new document in selected language
- csharp: new document in selected language
- nodejs: new document in selected language
- support vsdx in diagram editor
## 1.14.0
- nodejs: set users by parts
- nodejs: preload frame moved from uploading popap
- nodejs: view odg, md
- nodejs: edit xlsb
- nodejs: support vsdx in diagram editor
- nodejs: fix wopi verification
- nodejs: user role
- nodejs: start filling
- ur skin language
- change preload.html address
## 1.13.0
- nodejs: rename in wopi
- nodejs: using faviconUrl from WOPI discovery
- nodejs: wopi proof key verification
- golang: new integration example
- golang: upload files to the server
- golang: create blank files and files with sample content
@ -43,7 +30,6 @@
- php-laravel: show forgotten files on a seperate page
- php-laravel: fetch files
- php-laravel: integrate sdk
- jwt token lifetime from config
- onUserActionRequired
- support pages, numbers, key formats
- support hwp, hwpx formats

View File

@ -5,7 +5,7 @@ Do NOT use these integration examples on your own server without proper code mod
In case you enabled any of the test examples, disable it before going for production.
These examples show the way to integrate [ONLYOFFICE Docs][2] into your own website or application using one of the programming languages.
The package contains examples written in .Net (C# MVC), .Net (C#), Go, Java, Java Spring, Node.js, PHP, PHP (Laravel), Python and Ruby.
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Java Spring, Node.js, PHP, Python and Ruby.
You should change `http://documentserver` to your server address in these files:
* [.Net (C# MVC)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp-mvc) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
@ -15,11 +15,10 @@ You should change `http://documentserver` to your server address in these files:
* [Java Spring](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java-spring) - `web/documentserver-example/java-spring/src/main/resources/application.properties`
* [Node.js](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/nodejs) - `web/documentserver-example/nodejs/config/default.json`
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/src/configuration/ConfigurationManager.php`
* [PHP (Laravel)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php-laravel) - `web/documentserver-example/php-laravel/.env.example`
* [Python](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/python) - `web/documentserver-example/python/src/configuration/configuration.py`
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/app/configuration/configuration.rb`
More information on how to use these examples can be found here: [https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/)
More information on how to use these examples can be found here: [http://api.onlyoffice.com/editors/demopreview](http://api.onlyoffice.com/editors/demopreview "http://api.onlyoffice.com/editors/demopreview")
## API methods for test examples

View File

@ -146,7 +146,7 @@ header a {
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
.center, .table-main {
width: 100%;
}

View File

@ -639,7 +639,7 @@
}
}
@media (max-width: 420px) {
@media (max-width: 420px) and (min-width: 320px) {
.tableRow,
menu.links {
width: 25%;
@ -715,7 +715,7 @@
max-width: 45%;
}
}
@media (max-width: 600px) {
@media (max-width: 600px) and (min-width: 320px) {
.main-panel{
display: flex;
flex-direction: column;
@ -742,7 +742,7 @@
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
body.menu-open {
overflow: hidden;
}

View File

@ -511,6 +511,10 @@ label .checkbox {
line-height: 150%;
}
#loadScripts {
display: none;
}
#iframeScripts {
position: absolute;
visibility: hidden;

View File

@ -89,9 +89,9 @@ namespace OnlineEditorsExampleMVC.Controllers
}
// creating a sample document
public ActionResult Sample(string fileExt, bool? sample)
public ActionResult Sample(string fileExt, string lang, bool? sample)
{
var fileName = DocManagerHelper.CreateDemo(fileExt, sample ?? false); // create a sample document
var fileName = DocManagerHelper.CreateDemo(fileExt, sample ?? false, lang); // create a sample document
var id = Request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
DocManagerHelper.CreateMeta(fileName, user.id, user.name); // create meta information for the sample document

View File

@ -217,18 +217,17 @@ namespace OnlineEditorsExampleMVC.Helpers
var directoryInfo = new DirectoryInfo(directory);
// take files from the root directory
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
.OrderByDescending(f => f.LastWriteTimeUtc)
.ToList();
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
return storedFiles;
}
// create demo document
public static string CreateDemo(string fileExt, bool withContent)
public static string CreateDemo(string fileExt, bool withContent, string lang)
{
var langPath = lang.Contains("-") ? lang : "default";
var demoName = (withContent ? "sample." : "new.") + fileExt; // create sample or new template file with the necessary extension
var demoPath = "assets\\document-templates\\" + (withContent ? "sample\\" : "new\\"); // get the path to the sample document
var demoPath = "assets\\document-templates\\" + (withContent ? "sample\\" : "new\\" + langPath + "\\"); // get the path to the sample document
var fileName = GetCorrectName(demoName); // get a file name with an index if the file with such a name already exists

View File

@ -83,8 +83,7 @@ namespace OnlineEditorsExampleMVC.Helpers
bool isAsync,
out Dictionary<string, string> convertedDocumentData,
string filePass = null,
string lang = null,
string fileName = null)
string lang = null)
{
convertedDocumentData = new Dictionary<string, string>();
@ -92,7 +91,7 @@ namespace OnlineEditorsExampleMVC.Helpers
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
// check if the file name parameter is defined; if not, get random uuid for this file
var title = string.IsNullOrEmpty(fileName) ? Path.GetFileName(documentUri) : fileName;
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
// get document key

View File

@ -20,7 +20,6 @@ using JWT;
using JWT.Algorithms;
using JWT.Builder;
using JWT.Serializers;
using System;
using System.Collections.Generic;
using System.Web.Configuration;
@ -31,25 +30,17 @@ namespace OnlineEditorsExampleMVC.Helpers
private static readonly string Secret;
public static readonly bool Enabled;
public static readonly bool SignatureUseForRequest;
public static readonly int ExpiresIn;
static JwtManager()
{
Secret = WebConfigurationManager.AppSettings["files.docservice.secret"] ?? ""; // get token secret from the config parameters
Enabled = !string.IsNullOrEmpty(Secret); // check if the token is enabled
ExpiresIn = int.Parse(WebConfigurationManager.AppSettings["files.docservice.token.expires-in"]);
SignatureUseForRequest = bool.Parse(WebConfigurationManager.AppSettings["files.docservice.token.useforrequest"]);
}
// encode a payload object into a token using a secret key
public static string Encode(IDictionary<string, object> payload)
{
var now = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
var expires = now + ExpiresIn * 60;
payload["iat"] = now;
payload["exp"] = expires;
var encoder = new JwtEncoder(new HMACSHA256Algorithm(),
new JsonNetSerializer(),
new JwtBase64UrlEncoder());

View File

@ -26,12 +26,12 @@ namespace OnlineEditorsExampleMVC.Helpers
static List<string> descr_user_1 = new List<string>()
{
"File author by default",
"Doesn't belong to any group",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can see the information about all users",
"This file isn't marked as favorite",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"Has an avatar",
"Can submit forms"
};
@ -41,11 +41,11 @@ namespace OnlineEditorsExampleMVC.Helpers
"Belongs to Group2",
"Can review only his own changes or changes made by users with no group",
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
"Can see the information about users from Group2 and users who don't belong to any group",
"This file is marked as favorite",
"Can create new files from the editor",
"Can see the information about users from Group2 and users who dont belong to any group",
"Has an avatar",
"Can't submit forms"
"Cant submit forms"
};
static List<string> descr_user_3 = new List<string>()
@ -53,13 +53,13 @@ namespace OnlineEditorsExampleMVC.Helpers
"Belongs to Group3",
"Can review changes made by Group2 users",
"Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users",
"Can see the information about Group2 users",
"The file favorite state is undefined",
"Can't copy data from the file to clipboard",
"Can't download the file",
"Can't print the file",
"This file isnt marked as favorite",
"Cant copy data from the file to clipboard",
"Cant download the file",
"Cant print the file",
"Can create new files from the editor",
"Can't submit forms",
"Can see the information about Group2 users",
"Cant submit forms",
"Can't close history",
"Can't restore the file version"
};
@ -67,20 +67,19 @@ namespace OnlineEditorsExampleMVC.Helpers
static List<string> descr_user_0 = new List<string>()
{
"The name is requested when the editor is opened",
"Doesn't belong to any group",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can't see anyone's information",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
"Cant submit forms",
"Cant refresh outdated file"
};
private static List<User> users = new List<User>() {
@ -92,7 +91,7 @@ namespace OnlineEditorsExampleMVC.Helpers
null,
new Dictionary<string, object>(),
null,
false,
null,
new List<string>(),
descr_user_1,
true,
@ -134,7 +133,7 @@ namespace OnlineEditorsExampleMVC.Helpers
{ "remove", new List<string>() { } }
},
new List<string>() { "group-2" },
null,
false,
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,

View File

@ -227,12 +227,6 @@ namespace OnlineEditorsExampleMVC.Models
{ "text", user.close.text },
{ "visible", user.close. visible }
} : new Dictionary<string, object>{}
},
{
"features", new Dictionary<string, object>
{
{ "featuresTips", user.id.Equals("uid-0") }
}
}
}
}
@ -386,7 +380,7 @@ namespace OnlineEditorsExampleMVC.Models
var jss = new JavaScriptSerializer();
var id = request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
usersForMentions = jss.Serialize(!user.id.Equals("uid-0") ? Users.getUsersForMentions(user.id) : null);
usersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(Users.getUsersForMentions(user.id)) : null;
}
public void GetUsersInfo(HttpRequest request, out string usersInfo)
@ -403,7 +397,7 @@ namespace OnlineEditorsExampleMVC.Models
var jss = new JavaScriptSerializer();
var id = request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
usersForProtect = jss.Serialize(!user.id.Equals("uid-0") ? Users.getUsersForProtect(user.id) : null);
usersForProtect = !user.id.Equals("uid-0") ? jss.Serialize(Users.getUsersForProtect(user.id)) : null;
}
}
}

View File

@ -12,7 +12,7 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
## Step 2. Download the .Net (C# MVC) code for the editors integration
Download the [.Net (C# MVC) example](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/) from our site.
Download the [.Net (C# MVC) example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *web.appsettings.config* file:
```
@ -21,7 +21,7 @@ To connect the editors to your website, specify the path to the editors installa
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-path** is the path where files will be created and stored. You can set an absolute path.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/docs/docs-api/usage-api/advanced-parameters/) in the *DocEditor.aspx* file.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *DocEditor.aspx* file.
## Step 3. Install the prerequisites
Сheck if your system meets the system requirements:

View File

@ -126,7 +126,7 @@ if (typeof jQuery != "undefined") {
if (!formatManager.isAutoConvertible(posExt)) {
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
return;
}
@ -182,16 +182,36 @@ if (typeof jQuery != "undefined") {
if (response.step && response.step < 100) {
checkConvert(filePass, fileType);
} else {
jq("#uploadFileName").text(response.filename);
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
}
}
});
}, 1000);
};
var onuploaded = function () {
var loadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("current");
if (jq("#loadScripts").is(":empty")) {
var urlScripts = jq("#loadScripts").attr("data-docs");
var frame = '<iframe id="iframeScripts" width=1 height=1 style="position: absolute; visibility: hidden;" ></iframe>';
jq("#loadScripts").html(frame);
document.getElementById("iframeScripts").onload = onloadScripts;
jq("#loadScripts iframe").attr("src", urlScripts);
} else {
onloadScripts();
}
};
var onloadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("done").removeClass("current");
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
@ -253,7 +273,7 @@ if (typeof jQuery != "undefined") {
jq(document).on("click", "#skipPass", function () {
jq("#blockPassword").hide();
onuploaded();
loadScripts();
});
jq(document).on("click", "#beginEdit:not(.disable)", function () {
@ -334,7 +354,7 @@ if (typeof jQuery != "undefined") {
}
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("error");
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
@ -344,7 +364,6 @@ if (typeof jQuery != "undefined") {
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep1").removeClass("error").addClass("done");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
@ -396,12 +415,14 @@ if (typeof jQuery != "undefined") {
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
jq("#hiddenFileName").attr("data",response.filename);
if (response.error !== "FileTypeIsNotSupported") {
jq("#hiddenFileName").attr("data",response.filename);
jq("#beginEditConverted").removeClass("disable");
jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage");
} else {
let newFilename = fileName.split('.').slice(0,-1).join('.')
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter");
}
jq("td[name='convertingTypeButton']").removeClass("disable orange");
@ -423,6 +444,7 @@ if (typeof jQuery != "undefined") {
jq(document).on("click", ".try-editor", function (e) {
var url = jq(".try-editor-list")[0].attributes["data-link"].value;
url += "?fileExt=" + e.target.attributes["data-type"].value;
url += "&lang=" + jq("#language").val();
if (jq("#createSample").is(":checked")) {
url += "&sample=true";
}

View File

@ -117,10 +117,6 @@
// the meta information of the document is changed via the meta command
var onMetaChange = function (event) {
if (event.data.title !== undefined) {
document.title = event.data.title + " - ONLYOFFICE";
}
if (event.data.favorite !== undefined) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
@ -362,33 +358,10 @@
default:
users = <%= usersForMentions %>;
}
if ((c === "protect" || c === "mention") && users && event.data.count) {
let from = event.data.from;
let count = event.data.count;
let search = event.data.search;
if (from != 0) users = [];
var resultCount = 234;
for (var i = Math.max(users.length, from); i < Math.min(from + count, resultCount); i++){
users.push({
email: "test@test.test" + (i + 1),
id: "id" + (i + 1),
name: "test_" + search + (i + 1)
});
}
}
var result = {
docEditor.setUsers({
"c": c,
"users": users,
};
if (resultCount) {
// support v9.0
result.total = 1 + (!event.data.count || users.length < event.data.count ? 0 : (event.data.from + event.data.count));
// since v9.0.1
result.isPaginated = true;
}
docEditor.setUsers(result);
});
};
var onRequestSendNotify = function (event) {

View File

@ -125,7 +125,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -362,7 +362,10 @@
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<div class="error-message">
@ -407,7 +410,7 @@
</div>
</div>
<iframe id="iframeScripts" src="<%= WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.preloader"] %>" width=1 height=1 style="position: absolute; visibility: hidden; top: 0;" ></iframe>
<span id="loadScripts" data-docs="<%= WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.preloader"] %>"></span>
<footer>
<div class="center">
@ -415,7 +418,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -280,7 +280,7 @@ namespace OnlineEditorsExampleMVC
// get the url and file type of the converted file
Dictionary<string, string> newFileData;
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang, fileName);
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang);
if (result != 100)
{
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
@ -990,7 +990,7 @@ namespace OnlineEditorsExampleMVC
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
var changesArray = (ArrayList)changes["changes"];
var change = changesArray.Count > 0
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
? (Dictionary<string, object>)changesArray[0]
: new Dictionary<string, object>();
// write information about changes to the object

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<appSettings>
<clear />
<add key="version" value="1.14.0"/>
<add key="version" value="1.13.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>
@ -13,17 +13,16 @@
<add key="files.docservice.header" value="Authorization" />
<add key="files.docservice.token.useforrequest" value="true" />
<add key="files.docservice.token.expires-in" value="5"/>
<add key="files.docservice.verify-peer-off" value="true"/>
<add key="files.docservice.languages" value="en:English|sq-AL:Albanian (Albania)|ar:Arabic|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs:Czech|da:Danish|nl:Dutch|en-GB:English (United Kingdom)|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lo:Lao|lv:Latvian|ms:Malay (Malaysia)|no:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|ur:Urdu|vi:Vietnamese|aa-AA:Test Language"/>
<add key="files.docservice.languages" value="en:English|sq-AL:Albanian (Albania)|ar-SA:Arabic|hy-AM:Armenian|az-Latn-AZ:Azerbaijani|eu-ES:Basque|be:Belarusian|bg-BG:Bulgarian|ca:Catalan|zh-CN:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs-CZ:Czech|da:Danish|nl-NL:Dutch|en-GB:English (United Kingdom)|fi-FI:Finnish|fr-FR:French|gl-ES:Galego|de-DE:German|el-GR:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it-IT:Italian|ja-JP:Japanese|ko-KR:Korean|lo:Lao|lv-LV:Latvian|ms-MY:Malay (Malaysia)|no:Norwegian|pl-PL:Polish|pt-BR:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru-RU:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si-LK:Sinhala (Sri Lanka)|sk-SK:Slovak|sl-SI:Slovenian|es-ES:Spanish|sv-SE:Swedish|tr-TR:Turkish|uk-UK:Ukrainian|vi-VN:Vietnamese|aa-AA:Test Language"/>
<add key="files.docservice.url.site" value="http://documentserver/"/>
<add key="files.docservice.url.converter" value="converter"/>
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/preload.html"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.command" value="command"/>
<add key="files.docservice.url.example" value=""/>

View File

@ -146,7 +146,7 @@ header a {
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
.center, .table-main {
width: 100%;
}

View File

@ -639,7 +639,7 @@
}
}
@media (max-width: 420px) {
@media (max-width: 420px) and (min-width: 320px) {
.tableRow,
menu.links {
width: 25%;
@ -715,7 +715,7 @@
max-width: 45%;
}
}
@media (max-width: 600px) {
@media (max-width: 600px) and (min-width: 320px) {
.main-panel{
display: flex;
flex-direction: column;
@ -742,7 +742,7 @@
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
body.menu-open {
overflow: hidden;
}

View File

@ -511,6 +511,10 @@ label .checkbox {
line-height: 150%;
}
#loadScripts {
display: none;
}
#iframeScripts {
position: absolute;
visibility: hidden;

View File

@ -364,7 +364,10 @@
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<div class="error-message">
@ -409,7 +412,7 @@
</div>
</div>
<iframe id="iframeScripts" src="<%= UrlPreloadScripts %>" width=1 height=1 style="position: absolute; visibility: hidden; top: 0;" ></iframe>
<span id="loadScripts" data-docs="<%= UrlPreloadScripts %>"></span>
<footer>
<div class="center">
@ -417,7 +420,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -470,7 +470,7 @@ namespace OnlineEditorsExample
// get the url and file type of the converted file
Dictionary<string, string> newFileData;
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang, _fileName);
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang);
if (result != 100)
{
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
@ -563,10 +563,7 @@ namespace OnlineEditorsExample
var directoryInfo = new DirectoryInfo(directory); // read the user host directory contents
// get the list of stored files from the host directory
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
storedFiles.Sort((a, b) => b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc)); // sort files by the modification date
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
return storedFiles;
}

View File

@ -135,10 +135,6 @@
// the meta information of the document is changed via the meta command
var onMetaChange = function (event) {
if (event.data.title !== undefined) {
document.title = event.data.title + " - ONLYOFFICE";
}
if (event.data.favorite !== undefined) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
@ -327,33 +323,10 @@
default:
users = <%= UsersForMentions %>;
}
if ((c === "protect" || c === "mention") && users && event.data.count) {
let from = event.data.from;
let count = event.data.count;
let search = event.data.search;
if (from != 0) users = [];
var resultCount = 234;
for (var i = Math.max(users.length, from); i < Math.min(from + count, resultCount); i++){
users.push({
email: "test@test.test" + (i + 1),
id: "id" + (i + 1),
name: "test_" + search + (i + 1)
});
}
}
var result = {
docEditor.setUsers({
"c": c,
"users": users,
};
if (resultCount) {
// support v9.0
result.total = 1 + (!event.data.count || users.length < event.data.count ? 0 : (event.data.from + event.data.count));
// since v9.0.1
result.isPaginated = true;
}
docEditor.setUsers(result);
});
};
var onRequestSendNotify = function (event) {

View File

@ -294,12 +294,6 @@ namespace OnlineEditorsExample
{ "visible", user.close.visible },
{ "text", user.close.text }
} : new Dictionary<string, object>{}
},
{
"features", new Dictionary<string, object>
{
{ "featuresTips", user.id.Equals("uid-0") }
}
}
}
}
@ -333,14 +327,14 @@ namespace OnlineEditorsExample
// get users for mentions
List<Dictionary<string, object>> usersData = Users.getUsersForMentions(user.id);
UsersForMentions = jss.Serialize(!user.id.Equals("uid-0") ? usersData : null);
UsersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(usersData) : null;
List<Dictionary<string, object>> usersInfo = Users.getUsersInfo(user.id);
UsersInfo = jss.Serialize(usersData);
// get users for protect
List<Dictionary<string, object>> usersProtectData = Users.getUsersForProtect(user.id);
UsersForProtect = jss.Serialize(!user.id.Equals("uid-0") ? usersProtectData : null);
UsersForProtect = !user.id.Equals("uid-0") ? jss.Serialize(usersProtectData) : null;
}
catch { }
}
@ -507,8 +501,10 @@ namespace OnlineEditorsExample
default:
return;
}
var lang = request.Cookies.GetOrDefault("ulang", "en");
var demoLang = lang.Contains("-") ? lang : "default";
var demoName = (string.IsNullOrEmpty(sample) ? "new" : "sample") + ext; // create demo document name with the necessary extension
var demoPath = "assets\\document-templates\\" + (string.IsNullOrEmpty(sample) ? "new\\" : "sample\\"); // and put this file into the assets directory
var demoPath = "assets\\document-templates\\" + (string.IsNullOrEmpty(sample) ? "new\\" + demoLang + "\\" : "sample\\"); // and put this file into the assets directory
FileName = _Default.GetCorrectName(demoName); // get file name with an index if such a file name already exists

View File

@ -85,8 +85,7 @@ namespace ASC.Api.DocumentConverter
bool isAsync,
out Dictionary<string, string> convertedDocumentData,
string filePass = null,
string lang = null,
string filename = null)
string lang = null)
{
convertedDocumentData = new Dictionary<string, string>();
@ -94,7 +93,7 @@ namespace ASC.Api.DocumentConverter
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
// check if the file name parameter is defined; if not, get random uuid for this file
var title = string.IsNullOrEmpty(filename) ? Path.GetFileName(documentUri) : filename;
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
// get document key

View File

@ -126,7 +126,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -20,7 +20,6 @@ using JWT;
using JWT.Algorithms;
using JWT.Builder;
using JWT.Serializers;
using System;
using System.Collections.Generic;
using System.Web.Configuration;
@ -29,7 +28,6 @@ namespace OnlineEditorsExample
public static class JwtManager
{
private static readonly string Secret;
private static readonly int ExpiresIn;
public static readonly bool Enabled;
public static readonly bool SignatureUseForRequest;
@ -37,19 +35,12 @@ namespace OnlineEditorsExample
{
Secret = WebConfigurationManager.AppSettings["files.docservice.secret"] ?? ""; // get token secret from the config parameters
Enabled = !string.IsNullOrEmpty(Secret); // check if the token is enabled
ExpiresIn = int.Parse(WebConfigurationManager.AppSettings["files.docservice.token.expires-in"]);
SignatureUseForRequest = bool.Parse(WebConfigurationManager.AppSettings["files.docservice.token.useforrequest"]);
}
// encode a payload object into a token using a secret key
public static string Encode(IDictionary<string, object> payload)
{
var now = (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
var expires = now + ExpiresIn * 60;
payload["iat"] = now;
payload["exp"] = expires;
var encoder = new JwtEncoder(new HMACSHA256Algorithm(),
new JsonNetSerializer(),
new JwtBase64UrlEncoder());

View File

@ -12,7 +12,7 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
## Step 2. Download the .Net (C#) code for the editors integration
Download the [.Net (C#) example](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/) from our site.
Download the [.Net (C#) example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *settings.config* file:
```
@ -21,7 +21,7 @@ To connect the editors to your website, specify the path to the editors installa
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-path** is the path where files will be created and stored. You can set an absolute path.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/docs/docs-api/usage-api/advanced-parameters/) in the *DocEditor.aspx* file.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *DocEditor.aspx* file.
## Step 3. Install the prerequisites

View File

@ -25,12 +25,12 @@ namespace OnlineEditorsExample
static List<string> descr_user_1 = new List<string>()
{
"File author by default",
"Doesn't belong to any group",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can see the information about all users",
"This file isn't marked as favorite",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"Has an avatar",
"Can submit forms"
};
@ -40,11 +40,11 @@ namespace OnlineEditorsExample
"Belongs to Group2",
"Can review only his own changes or changes made by users with no group",
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
"Can see the information about users from Group2 and users who don't belong to any group",
"This file is marked as favorite",
"Can create new files from the editor",
"Can see the information about users from Group2 and users who dont belong to any group",
"Has an avatar",
"Can't submit forms"
"Cant submit forms"
};
static List<string> descr_user_3 = new List<string>()
@ -52,34 +52,33 @@ namespace OnlineEditorsExample
"Belongs to Group3",
"Can review changes made by Group2 users",
"Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users",
"Can see the information about Group2 users",
"The file favorite state is undefined",
"Can't copy data from the file to clipboard",
"Can't download the file",
"Can't print the file",
"This file isnt marked as favorite",
"Cant copy data from the file to clipboard",
"Cant download the file",
"Cant print the file",
"Can create new files from the editor",
"Can see the information about Group2 users",
"Cant submit forms",
"Can't close history",
"Can't restore the file version",
"Can't submit forms"
"Can't restore the file version"
};
static List<string> descr_user_0 = new List<string>()
{
"The name is requested when the editor is opened",
"Doesn't belong to any group",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can't see anyone's information",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
"Cant submit forms",
"Cant refresh outdated file"
};
private static List<User> users = new List<User>() {
@ -91,7 +90,7 @@ namespace OnlineEditorsExample
null,
new Dictionary<string, object>(),
null,
false,
null,
new List<string>(),
descr_user_1,
true,
@ -133,7 +132,7 @@ namespace OnlineEditorsExample
{ "remove", new List<string>() { } }
},
new List<string>() { "group-2" },
null,
false,
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,

View File

@ -778,7 +778,7 @@ namespace OnlineEditorsExample
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
var changesArray = (ArrayList)changes["changes"];
var change = changesArray.Count > 0
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
? (Dictionary<string, object>)changesArray[0]
: new Dictionary<string, object>();
// write information about changes to the object

View File

@ -126,7 +126,7 @@ if (typeof jQuery != "undefined") {
if (!formatManager.isAutoConvertible(posExt)) {
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
return;
}
@ -182,16 +182,36 @@ if (typeof jQuery != "undefined") {
if (response.step && response.step < 100) {
checkConvert(filePass, fileType);
} else {
jq("#uploadFileName").text(response.filename);
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
}
}
});
}, 1000);
};
var onuploaded = function () {
var loadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("current");
if (jq("#loadScripts").is(":empty")) {
var urlScripts = jq("#loadScripts").attr("data-docs");
var frame = '<iframe id="iframeScripts" width=1 height=1 style="position: absolute; visibility: hidden;" ></iframe>';
jq("#loadScripts").html(frame);
document.getElementById("iframeScripts").onload = onloadScripts;
jq("#loadScripts iframe").attr("src", urlScripts);
} else {
onloadScripts();
}
};
var onloadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("done").removeClass("current");
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
@ -253,7 +273,7 @@ if (typeof jQuery != "undefined") {
jq(document).on("click", "#skipPass", function () {
jq("#blockPassword").hide();
onuploaded();
loadScripts();
});
jq(document).on("click", "#beginEdit:not(.disable)", function () {
@ -334,7 +354,7 @@ if (typeof jQuery != "undefined") {
}
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("error");
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
@ -344,7 +364,6 @@ if (typeof jQuery != "undefined") {
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep1").removeClass("error").addClass("done");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
@ -396,12 +415,14 @@ if (typeof jQuery != "undefined") {
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
jq("#hiddenFileName").attr("data",response.filename);
if (response.error !== "FileTypeIsNotSupported") {
jq("#hiddenFileName").attr("data",response.filename);
jq("#beginEditConverted").removeClass("disable");
jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage");
} else {
let newFilename = fileName.split('.').slice(0,-1).join('.')
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter");
}
jq("td[name='convertingTypeButton']").removeClass("disable orange");

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<clear />
<add key="version" value="1.14.0"/>
<add key="version" value="1.13.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>
@ -14,15 +14,14 @@
<add key="files.docservice.verify-peer-off" value="true"/>
<add key="files.docservice.token.useforrequest" value="true" />
<add key="files.docservice.token.expires-in" value="5"/>
<add key="files.docservice.languages" value="en:English|sq-AL:Albanian (Albania)|ar:Arabic|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs:Czech|da:Danish|nl:Dutch|en-GB:English (United Kingdom)|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lo:Lao|lv:Latvian|ms:Malay (Malaysia)|no:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|ur:Urdu|vi:Vietnamese|aa-AA: Test Language"/>
<add key="files.docservice.languages" value="en:English|sq-AL:Albanian (Albania)|ar-SA:Arabic|hy-AM:Armenian|az-Latn-AZ:Azerbaijani|eu-ES:Basque|be:Belarusian|bg-BG:Bulgarian|ca:Catalan|zh-CN:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs-CZ:Czech|da:Danish|nl-NL:Dutch|en-GB:English (United Kingdom)|fi-FI:Finnish|fr-FR:French|gl-ES:Galego|de-DE:German|el-GR:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it-IT:Italian|ja-JP:Japanese|ko-KR:Korean|lo:Lao|lv-LV:Latvian|ms-MY:Malay (Malaysia)|no:Norwegian|pl-PL:Polish|pt-BR:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru-RU:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si-LK:Sinhala (Sri Lanka)|sk-SK:Slovak|sl-SI:Slovenian|es-ES:Spanish|sv-SE:Swedish|tr-TR:Turkish|uk-UK:Ukrainian|vi-VN:Vietnamese|aa-AA:Test Language"/>
<add key="files.docservice.url.site" value="http://documentserver/"/>
<add key="files.docservice.url.converter" value="converter"/>
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/preload.html"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.command" value="command"/>
<add key="files.docservice.url.example" value=""/>

View File

@ -4,7 +4,6 @@ linters:
- cyclop
- depguard
- dogsled
- durationcheck
- err113
- errchkjson
- execinquery

View File

@ -13,7 +13,7 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
### Step 2. Download the Go code for the editors integration
Download the [Go example](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/) from our site.
Download the [Go example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation, server protocol, address and port in the *configuration.env* file:
@ -31,7 +31,7 @@ JWT_HEADER=Authorization
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
**address** is the address of the server, **port** is the server port.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/docs/docs-api/usage-api/advanced-parameters/) it the *templates/editor.html* file.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *templates/editor.html* file.
### Step 3. Install the prerequisites
To run the Go example code, install the Go compiler:

View File

@ -1,5 +1,5 @@
{
"VERSION": "1.14.0",
"VERSION": "1.13.0",
"SERVER_ADDRESS" : "",
"SERVER_PORT" : 3000,
@ -7,11 +7,10 @@
"DOC_SERVER_HOST" : "http://documentserver/",
"DOC_SERVER_CONVERTER_URL" : "converter",
"DOC_SERVER_API_URL" : "web-apps/apps/api/documents/api.js",
"DOC_SERVER_PRELOADER_URL" : "web-apps/apps/api/documents/preload.html",
"DOC_SERVER_PRELOADER_URL" : "web-apps/apps/api/documents/cache-scripts.html",
"DOC_SERVER_COMMAND_URL" : "command",
"JWT_IS_ENABLED" : false,
"JWT_EXPIRES_IN" : 5,
"JWT_SECRET" : "secret",
"JWT_HEADER" : "Authorization",
@ -25,50 +24,49 @@
"LANGUAGES": {
"en": "English",
"sq-AL": "Albanian (Albania)",
"ar": "Arabic",
"hy": "Armenian",
"az": "Azerbaijani",
"eu": "Basque",
"ar-SA": "Arabic",
"hy-AM": "Armenian",
"az-Latn-AZ": "Azerbaijani",
"eu-ES": "Basque",
"be": "Belarusian",
"bg": "Bulgarian",
"bg-BG": "Bulgarian",
"ca": "Catalan",
"zh": "Chinese (Simplified)",
"zh-CN": "Chinese (Simplified)",
"zh-TW": "Chinese (Traditional)",
"cs": "Czech",
"cs-CZ": "Czech",
"da": "Danish",
"nl": "Dutch",
"nl-NL": "Dutch",
"en-GB": "English (United Kingdom)",
"fi": "Finnish",
"fr": "French",
"gl": "Galego",
"de": "German",
"el": "Greek",
"fi-FI": "Finnish",
"fr-FR": "French",
"gl-ES": "Galego",
"de-DE": "German",
"el-GR": "Greek",
"he-IL": "Hebrew (Israel)",
"hu": "Hungarian",
"id": "Indonesian",
"it": "Italian",
"ja": "Japanese",
"ko": "Korean",
"it-IT": "Italian",
"ja-JP": "Japanese",
"ko-KR": "Korean",
"lo": "Lao",
"lv": "Latvian",
"ms": "Malay (Malaysia)",
"lv-LV": "Latvian",
"ms-MY": "Malay (Malaysia)",
"no": "Norwegian",
"pl": "Polish",
"pt": "Portuguese (Brazil)",
"pl-PL": "Polish",
"pt-BR": "Portuguese (Brazil)",
"pt-PT": "Portuguese (Portugal)",
"ro": "Romanian",
"ru": "Russian",
"ru-RU": "Russian",
"sr-Cyrl-RS": "Serbian (Cyrillic)",
"sr-Latn-RS": "Serbian (Latin)",
"si": "Sinhala (Sri Lanka)",
"sk": "Slovak",
"sl": "Slovenian",
"es": "Spanish",
"sv": "Swedish",
"tr": "Turkish",
"uk": "Ukrainian",
"ur": "Urdu",
"vi": "Vietnamese",
"si-LK": "Sinhala (Sri Lanka)",
"sk-SK": "Slovak",
"sl-SI": "Slovenian",
"es-ES": "Spanish",
"sv-SE": "Swedish",
"tr-TR": "Turkish",
"uk-UK": "Ukrainian",
"vi-VN": "Vietnamese",
"aa-AA": "Test Language"
}
}

View File

@ -20,7 +20,6 @@ package config
import (
"path/filepath"
"runtime"
"time"
"github.com/ONLYOFFICE/document-server-integration/utils"
"github.com/spf13/viper"
@ -37,7 +36,6 @@ type ApplicationConfig struct {
DocumentServerPreloader string `mapstructure:"DOC_SERVER_PRELOADER_URL"`
DocumentServerCommandUrl string `mapstructure:"DOC_SERVER_COMMAND_URL"`
JwtEnabled bool `mapstructure:"JWT_IS_ENABLED"`
JwtExpiresIn time.Duration `mapstructure:"JWT_EXPIRES_IN"`
JwtHeader string `mapstructure:"JWT_HEADER"`
JwtSecret string `mapstructure:"JWT_SECRET"`
StoragePath string `mapstructure:"STORAGE_PATH"`

View File

@ -22,12 +22,10 @@ import (
"fmt"
"net/http"
"strings"
"time"
"github.com/ONLYOFFICE/document-server-integration/server/managers"
"github.com/ONLYOFFICE/document-server-integration/server/models"
"github.com/ONLYOFFICE/document-server-integration/server/shared"
"github.com/golang-jwt/jwt"
)
func (srv *DefaultServerEndpointsHandler) Config(w http.ResponseWriter, r *http.Request) {
@ -73,10 +71,6 @@ func (srv *DefaultServerEndpointsHandler) Config(w http.ResponseWriter, r *http.
),
Mode: "edit",
},
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * srv.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
secret := strings.TrimSpace(srv.config.JwtSecret)

View File

@ -79,7 +79,7 @@ func (srv *DefaultServerEndpointsHandler) Convert(w http.ResponseWriter, r *http
return
}
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true, filename)
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true)
if err != nil {
response.Error = err.Error()
srv.logger.Errorf("File conversion error: %s", err.Error())

View File

@ -96,15 +96,11 @@ func (srv *DefaultServerEndpointsHandler) Create(w http.ResponseWriter, r *http.
srv.logger.Errorf("meta creation error: %s", err.Error())
}
res := map[string]interface{}{
"file": correctName,
}
shared.SendResponse(w, res)
return
}
query := r.URL.Query()
fileExt, isSample := query.Get("fileExt"), query.Get("sample")
fileExt, lang, isSample := query.Get("fileExt"), query.Get("lang"), query.Get("sample")
if strings.TrimSpace(fileExt) == "" || !utils.IsInList(fileExt, srv.specification.Extensions.Edited) {
srv.logger.Errorf("%s extension is not supported", fileExt)
@ -127,13 +123,17 @@ func (srv *DefaultServerEndpointsHandler) Create(w http.ResponseWriter, r *http.
}
srv.logger.Debugf("Creating a new %s file", fileExt)
if !strings.Contains(lang, "-") {
lang = "default"
}
sampleType := "new"
if strings.TrimSpace(isSample) != "" {
sampleType = "sample"
lang = ""
}
filename := fmt.Sprintf("%s.%s", sampleType, fileExt)
file, err := os.Open(path.Join("static/assets/document-templates", sampleType, filename))
file, err := os.Open(path.Join("static/assets/document-templates", sampleType, lang, filename))
if err != nil {
srv.logger.Errorf("could not create a new file: %s", err.Error())
http.Redirect(w, r, "/", http.StatusSeeOther)

View File

@ -23,13 +23,11 @@ import (
"net/http"
"net/url"
"strings"
"time"
"github.com/ONLYOFFICE/document-server-integration/server/managers"
"github.com/ONLYOFFICE/document-server-integration/server/models"
"github.com/ONLYOFFICE/document-server-integration/server/shared"
"github.com/ONLYOFFICE/document-server-integration/utils"
"github.com/golang-jwt/jwt"
)
func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *http.Request) {
@ -45,11 +43,15 @@ func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *ht
var fileKey map[string]string
err := json.Unmarshal([]byte(body.ReferenceData.FileKey), &fileKey)
if err == nil {
path, _ := srv.GenerateFilePath(fileKey["fileName"])
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
fileName = fileKey["fileName"]
}
if err != nil {
srv.logger.Error("FileKey decoding error")
shared.SendDocumentServerRespose(w, true)
return
}
path, _ := srv.GenerateFilePath(fileKey["fileName"])
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
fileName = fileKey["fileName"]
}
if fileName == "" && body.Link != "" {
@ -97,10 +99,6 @@ func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *ht
},
Link: remoteAddr + "/editor?filename=" + url.QueryEscape(fileName),
Path: fileName,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * srv.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
secret := strings.TrimSpace(srv.config.JwtSecret)

View File

@ -44,7 +44,7 @@ func (srv *DefaultServerEndpointsHandler) Upload(w http.ResponseWriter, r *http.
srv.logger.Debug("A new upload call")
if !srv.DocumentManager.IsDocumentConvertable(handler.Filename) {
srv.logger.Errorf("File %s is not supported", handler.Filename)
shared.SendResponse(w, map[string]string{"error": "File type is not supported"})
shared.SendCustomErrorResponse(w, "File type is not supported")
return
}

View File

@ -77,7 +77,7 @@ type ConversionManager interface {
GetInternalExtension(fileType string) string
IsCanConvert(ext string) bool
IsCanFill(ext string) bool
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool, title string) (string, string, error)
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool) (string, string, error)
}
type CommandManager interface {

View File

@ -23,7 +23,6 @@ import (
"net/http"
"net/url"
"strings"
"time"
"github.com/ONLYOFFICE/document-server-integration/config"
"github.com/ONLYOFFICE/document-server-integration/server/managers"
@ -60,10 +59,6 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
payload := CommandPayload{
C: method,
Key: docKey,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
if meta != nil {
payload.Meta = meta
@ -73,7 +68,7 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
var headerToken string
secret := strings.TrimSpace(cm.config.JwtSecret)
if secret != "" && cm.config.JwtEnabled {
headerPayload := fillJwtByUrl(uri, payload, cm.config)
headerPayload := fillJwtByUrl(uri, payload)
headerToken, err = cm.JwtManager.JwtSign(headerPayload, []byte(secret))
if err != nil {
return nil, err
@ -108,7 +103,7 @@ func (cm DefaultCommandManager) CommandRequest(method string, docKey string, met
return response, nil
}
func fillJwtByUrl(uri string, payload CommandPayload, config config.ApplicationConfig) CommandRequestHeaderPayload {
func fillJwtByUrl(uri string, payload CommandPayload) CommandRequestHeaderPayload {
urlObj, _ := url.Parse(uri)
query, _ := url.ParseQuery(urlObj.RawQuery)
queryMap := make(map[string]string)
@ -119,9 +114,5 @@ func fillJwtByUrl(uri string, payload CommandPayload, config config.ApplicationC
return CommandRequestHeaderPayload{
Query: queryMap,
Payload: payload,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
}

View File

@ -24,13 +24,11 @@ import (
"io"
"net/http"
"strings"
"time"
"github.com/ONLYOFFICE/document-server-integration/config"
"github.com/ONLYOFFICE/document-server-integration/server/managers"
"github.com/ONLYOFFICE/document-server-integration/server/shared"
"github.com/ONLYOFFICE/document-server-integration/utils"
"github.com/golang-jwt/jwt"
"go.uber.org/zap"
)
@ -102,7 +100,6 @@ func (cm DefaultConversionManager) GetConverterUri(
toExt string,
docKey string,
isAsync bool,
title string,
) (string, string, error) {
if fromExt == "" {
fromExt = utils.GetFileExt(docUri, true)
@ -112,13 +109,9 @@ func (cm DefaultConversionManager) GetConverterUri(
DocUrl: docUri,
OutputType: strings.ReplaceAll(toExt, ".", ""),
FileType: fromExt,
Title: title,
Title: utils.GetFileName(docUri),
Key: docKey,
Async: isAsync,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
var headerToken string
@ -126,13 +119,7 @@ func (cm DefaultConversionManager) GetConverterUri(
secret := strings.TrimSpace(cm.config.JwtSecret)
if secret != "" && cm.config.JwtEnabled {
headerPayload := managers.ConvertRequestHeaderPayload{
Payload: payload,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * cm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
headerPayload := managers.ConvertRequestHeaderPayload{Payload: payload}
headerToken, err = cm.JwtManager.JwtSign(headerPayload, []byte(secret))
if err != nil {
return "", "", err

View File

@ -28,7 +28,6 @@ import (
"github.com/ONLYOFFICE/document-server-integration/server/managers"
"github.com/ONLYOFFICE/document-server-integration/server/models"
"github.com/ONLYOFFICE/document-server-integration/utils"
"github.com/golang-jwt/jwt"
"go.uber.org/zap"
)
@ -153,7 +152,7 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
return nil, err
}
config := &models.Config{
config := models.Config{
Type: parameters.Type,
DocumentType: dm.ConversionManager.GetFileType(parameters.Filename),
Document: models.Document{
@ -222,15 +221,8 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
Goback: models.Goback{
RequestClose: false,
},
Features: models.Features{
FeaturesTips: user.Id == "uid-0",
},
},
},
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * dm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
secret := strings.TrimSpace(dm.config.JwtSecret)
@ -239,7 +231,7 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
config.Token = token
}
return config, nil
return &config, nil
}
func (dm DefaultDocumentManager) IsDocumentConvertable(filename string) bool {

View File

@ -23,14 +23,12 @@ import (
"fmt"
"net/http"
"path"
"time"
"github.com/ONLYOFFICE/document-server-integration/config"
"github.com/ONLYOFFICE/document-server-integration/server/managers"
"github.com/ONLYOFFICE/document-server-integration/server/models"
"github.com/ONLYOFFICE/document-server-integration/server/shared"
"github.com/ONLYOFFICE/document-server-integration/utils"
"github.com/golang-jwt/jwt"
"go.uber.org/zap"
)
@ -197,10 +195,6 @@ func (hm DefaultHistoryManager) fetchNextHistoryEntry(
Key: key,
Url: url,
Version: version,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * hm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
}
@ -267,10 +261,6 @@ func (hm DefaultHistoryManager) GetHistory(
Url: hm.StorageManager.GeneratePublicFileUri(filename, remoteAddress, managers.FileMeta{}),
Version: version,
ChangesUrl: changesUrl,
StandardClaims: jwt.StandardClaims{
ExpiresAt: time.Now().Add(time.Minute * hm.config.JwtExpiresIn).Unix(),
IssuedAt: time.Now().Unix(),
},
}
rhist.History = append(rhist.History, models.History{

View File

@ -94,7 +94,7 @@ func (sm DefaultStorageManager) GetStoredFiles(remoteAddress string) ([]models.D
}
sort.Slice(files, func(i, j int) bool {
return !files[i].ModTime().Before(files[j].ModTime())
return files[i].ModTime().Before(files[j].ModTime())
})
for _, v := range files {

View File

@ -54,7 +54,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
ReviewGroups: nil,
CommentGroups: nil,
UserInfoGroups: nil,
Favorite: 0,
Favorite: -1,
DeniedPermissions: nil,
Description: descriptionUser1,
Templates: true,
@ -86,9 +86,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
Goback: map[string]interface{}{
"text": "Go to Documents",
},
Close: map[string]interface{}{
"visible": true,
},
Close: nil,
},
{
Id: "uid-3",
@ -102,15 +100,13 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
"remove": "",
},
UserInfoGroups: []string{"group-2"},
Favorite: -1,
Favorite: 0,
DeniedPermissions: []string{"copy", "download", "print"},
Description: descriptionUser3,
Templates: false,
Avatar: false,
Goback: nil,
Close: map[string]interface{}{
"visible": true,
},
Close: nil,
},
}
return &DefaultUserManager{
@ -124,26 +120,25 @@ var descriptionUser0 []string = []string{
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can't see anyone's information",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor",
"Can't see anyone's information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document",
"Can't refresh outdated file",
}
var descriptionUser1 []string = []string{
"File author by default",
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can see the information about all users",
"This file isn't marked as favorite",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"Can submit forms",
"Has an avatar",
}
@ -151,25 +146,25 @@ var descriptionUser2 []string = []string{
"Belongs to Group2",
"Can review only his own changes or changes made by users with no group",
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
"Can see the information about users from Group2 and users who don't belong to any group",
"This file is marked as favorite",
"Can create new files from the editor",
"Has an avatar",
"Can see the information about users from Group2 and users who dont belong to any group",
"Can't submit forms",
"Has an avatar",
}
var descriptionUser3 []string = []string{
"Belongs to Group3",
"Can review changes made by Group2 users",
"Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users",
"Can see the information about Group2 users",
"The file favorite state is undefined",
"This file isn't marked as favorite",
"Can't copy data from the file to clipboard",
"Can't download the file",
"Can't print the file",
"Can create new files from the editor",
"Can see the information about Group2 users",
"Can't submit forms",
"Can't close history",
"Can't restore the file version",
"Can't submit forms",
}
func (um DefaultUserManager) GetUsers() []models.User {

View File

@ -20,10 +20,10 @@ package models
import "github.com/golang-jwt/jwt"
type Config struct {
Type string `json:"type"`
Document Document `json:"document"`
DocumentType string `json:"documentType"`
EditorConfig EditorConfig `json:"editorConfig"`
Token string `json:"token,omitempty"`
jwt.StandardClaims
Type string `json:"type"`
Document Document `json:"document"`
DocumentType string `json:"documentType"`
EditorConfig EditorConfig `json:"editorConfig"`
Token string `json:"token,omitempty"`
jwt.StandardClaims `json:"-"`
}

View File

@ -21,10 +21,6 @@ type Goback struct {
RequestClose bool `json:"requestClose"`
}
type Features struct {
FeaturesTips bool `json:"featuresTips"`
}
type Customization struct {
About bool `json:"about"`
Comments bool `json:"comments,omitempty"`
@ -32,7 +28,6 @@ type Customization struct {
Forcesave bool `json:"forcesave,omitempty"`
SubmitForm bool `json:"submitForm,omitempty"`
Goback Goback `json:"goback,omitempty"`
Features Features `json:"features,omitempty"`
Close map[string]interface{} `json:"close,omitempty"`
}

View File

@ -25,12 +25,12 @@ type ReferenceData struct {
}
type Reference struct {
ReferenceData ReferenceData `json:"referenceData"`
Link string `json:"link"`
Path string `json:"path"`
FileType string `json:"fileType"`
Key string `json:"key"`
Url string `json:"url"`
Token string `json:"token,omitempty"`
jwt.StandardClaims
ReferenceData ReferenceData `json:"referenceData"`
Link string `json:"link"`
Path string `json:"path"`
FileType string `json:"fileType"`
Key string `json:"key"`
Url string `json:"url"`
Token string `json:"token,omitempty"`
jwt.StandardClaims `json:"-"`
}

View File

@ -16,6 +16,7 @@
*
*/
var directUrl;
var formatManager;
window.onload = function () {
@ -41,8 +42,19 @@ window.onload = function () {
if (typeof jQuery !== "undefined") {
jq = jQuery.noConflict();
directUrl = getUrlVars()["directUrl"] == "true";
mustReload = false;
if (directUrl)
jq("#directUrl").prop("checked", directUrl);
else
directUrl = jq("#directUrl").prop("checked");
jq("#directUrl").change(function() {
window.location = "?directUrl=" + jq(this).prop("checked");
});
jq(function () {
jq("#fileupload").fileupload({
dataType: "json",
@ -114,7 +126,7 @@ if (typeof jQuery !== "undefined") {
if (!formatManager.isAutoConvertible(posExt)) {
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
return;
}
@ -169,16 +181,36 @@ if (typeof jQuery !== "undefined") {
if (response.step != undefined && response.step < 100) {
checkConvert(filePass, fileType);
} else {
jq("#uploadFileName").text(response.filename);
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
}
}
});
}, 1000);
};
var onuploaded = function () {
var loadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("current");
if (jq("#loadScripts").is(":empty")) {
var urlScripts = jq("#loadScripts").attr("data-docs");
var frame = "<iframe id=\"iframeScripts\" width=1 height=1 style=\"position: absolute; visibility: hidden;\" ></iframe>";
jq("#loadScripts").html(frame);
document.getElementById("iframeScripts").onload = onloadScripts;
jq("#loadScripts iframe").attr("src", urlScripts);
} else {
onloadScripts();
}
};
var onloadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("done").removeClass("current");
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
@ -240,12 +272,12 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", "#skipPass", function () {
jq("#blockPassword").hide();
onuploaded();
loadScripts();
});
jq(document).on("click", "#beginEdit:not(.disable)", function () {
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
var url = UrlEditor + "?mode=edit&fileName=" + fileId;
var url = UrlEditor + "?mode=edit&fileName=" + fileId+ "&directUrl=" + directUrl;
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
@ -254,7 +286,7 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", "#beginView:not(.disable)", function () {
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
var url = UrlEditor + "?mode=view&fileName=" + fileId;
var url = UrlEditor + "?mode=view&fileName=" + fileId+ "&directUrl=" + directUrl;
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
@ -263,7 +295,7 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId;
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId + "&directUrl=" + directUrl;
jq("#mainProgress").addClass("embedded");
jq("#beginEmbedded").addClass("disable");
@ -321,7 +353,7 @@ if (typeof jQuery !== "undefined") {
}
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("error");
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
@ -331,7 +363,6 @@ if (typeof jQuery !== "undefined") {
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep1").removeClass("error").addClass("done");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
@ -383,12 +414,14 @@ if (typeof jQuery !== "undefined") {
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
jq("#hiddenFileName").attr("data",response.filename);
if (response.error !== "FileTypeIsNotSupported") {
jq("#hiddenFileName").attr("data",response.filename);
jq("#beginEditConverted").removeClass("disable");
jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage");
} else {
let newFilename = fileName.split('.').slice(0,-1).join('.')
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter");
}
jq("td[name='convertingTypeButton']").removeClass("disable orange");
@ -409,6 +442,7 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", ".try-editor", function (e) {
var url = "create?fileExt=" + e.target.attributes["data-type"].value;
url += "&lang=" + jq("#language").val();
if (jq("#createSample").is(":checked")) {
url += "&sample=true";
}

View File

@ -146,7 +146,7 @@ header a {
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
.center, .table-main {
width: 100%;
}

View File

@ -640,7 +640,7 @@
}
}
@media (max-width: 420px) {
@media (max-width: 420px) and (min-width: 320px) {
.tableRow,
menu.links {
width: 25%;
@ -716,7 +716,7 @@
max-width: 45%;
}
}
@media (max-width: 600px) {
@media (max-width: 600px) and (min-width: 320px) {
.main-panel{
display: flex;
flex-direction: column;
@ -743,7 +743,7 @@
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
body.menu-open {
overflow: hidden;
}

View File

@ -511,6 +511,10 @@ label .checkbox {
line-height: 150%;
}
#loadScripts {
display: none;
}
#iframeScripts {
position: absolute;
visibility: hidden;

View File

@ -83,10 +83,6 @@
};
var onMetaChange = function (event) { // the meta information of the document is changed via the meta command
if (event.data.title !== undefined) {
document.title = event.data.title + " - ONLYOFFICE";
}
if (event.data.favorite) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
@ -240,33 +236,10 @@
users = {{.usersForMentions}};
}
if ((c === "protect" || c === "mention") && users && event.data.count) {
let from = event.data.from;
let count = event.data.count;
let search = event.data.search;
if (from != 0) users = [];
var resultCount = 234;
for (var i = Math.max(users.length, from); i < Math.min(from + count, resultCount); i++){
users.push({
email: "test@test.test" + (i + 1),
id: "id" + (i + 1),
name: "test_" + search + (i + 1)
});
}
}
var result = {
docEditor.setUsers({
"c": c,
"users": users,
};
if (resultCount) {
// support v9.0
result.total = 1 + (!event.data.count || users.length < event.data.count ? 0 : (event.data.from + event.data.count));
// since v9.0.1
result.isPaginated = true;
}
docEditor.setUsers(result);
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment

View File

@ -118,7 +118,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -341,7 +341,10 @@
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<div class="error-message">
@ -385,7 +388,7 @@
</div>
</div>
<iframe id="iframeScripts" src="{{ .Preloader }}" width=1 height=1 style="position: absolute; visibility: hidden; top: 0;" ></iframe>
<span id="loadScripts" data-docs="{{ .Preloader }}"></span>
<footer>
<div class="center">
@ -393,7 +396,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -18,7 +18,7 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
### Step 2. Download the Java code for the editors integration
Download the [Java-Spring example](https://api.onlyoffice.com/docs/docs-api/samples/language-specific-examples/) from our site.
Download the [Java-Spring example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation, server port and the path to the storage folder in the *src/main/resources/application.properties* file:
@ -30,7 +30,7 @@ To connect the editors to your website, specify the path to the editors installa
where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/docs/docs-api/usage-api/advanced-parameters/) it the *\src\main\resources\editor.html* file.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *\src\main\resources\editor.html* file.
### Step 3. Install the prerequisites
To run the Java example code, install the Java version 11 appropriate for your OS and framework **Apache Maven**:

View File

@ -84,7 +84,7 @@
<dependency>
<groupId>com.onlyoffice</groupId>
<artifactId>docs-integration-sdk</artifactId>
<version>1.4.3-SNAPSHOT</version>
<version>1.4.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>
@ -94,7 +94,7 @@
<dependency>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>5.4.3</version>
<version>5.4</version>
</dependency>
</dependencies>

View File

@ -38,31 +38,30 @@ public class ExampleData {
// the description for user 0
List<String> descriptionUserZero = List.of(
"The name is requested when the editor is opened",
"Doesn't belong to any group",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"Can't see anyone's information",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
"Cant submit forms",
"Can't refresh outdated file"
);
// the description for user 1
List<String> descriptionUserFirst = List.of(
"File author by default",
"He doesn't belong to any of the groups",
"He doesnt belong to any of the groups",
"He can review all the changes",
"He can do everything with the comments",
"Can see the information about all users",
"This file isn't favorite",
"The file favorite state is undefined",
"Can create a file from a template with data from the editor",
"Can see the information about all users",
"Can view chat",
"Has an avatar",
"Can submit forms"
@ -71,16 +70,16 @@ public class ExampleData {
// the description for user 2
List<String> descriptionUserSecond = List.of(
"He belongs to Group2",
"He can review only his own changes or the changes made by the users who don't belong"
"He can review only his own changes or the changes made by the users who dont belong"
+ " to any of the groups",
"He can view every comment, edit his comments and the comments left by the users "
+ "who don't belong to any of the groups and remove only his comments",
"Can see the information about users from Group2 and users who don't belong to any group",
"This file is favorite",
"Can create a file from an editor",
"Can see the information about users from Group2 and users who dont belong to any group",
"Can view chat",
"Has an avatar",
"Can't submit forms"
"Cant submit forms"
);
// the description for user 3
@ -89,23 +88,23 @@ public class ExampleData {
"He can review only the changes made by the users from Group2",
"He can view the comments left by the users from Group2 and Group3 and edit the comments left by "
+ "the users from Group2",
"Can see the information about Group2 users",
"The file favorite state is undefined",
"He can't copy data from the file into the clipboard",
"He can't download the file",
"He can't print the file",
"This file isnt favorite",
"He cant copy data from the file into the clipboard",
"He cant download the file",
"He cant print the file",
"Can create a file from an editor",
"Can see the information about Group2 users",
"Can view chat",
"Cant submit forms",
"Can't close history",
"Can't restore the file version",
"Can't submit forms"
"Can't restore the file version"
);
// create user 1 with the specified parameters
userService.createUser("John Smith", "smith@example.com", descriptionUserFirst,
"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()), false, true, true, true,
List.of(FilterState.NULL.toString()), null, true, true, true,
new Goback(null, false), new Close(null, false), true);
// create user 2 with the specified parameters
@ -117,7 +116,7 @@ public class ExampleData {
// create user 3 with the specified parameters
userService.createUser("Hamish Mitchell", null, descriptionUserThird,
"group-3", List.of("group-2"), List.of("group-2", "group-3"), List.of("group-2"),
new ArrayList<>(), List.of("group-2"), null, true, true, false,
new ArrayList<>(), List.of("group-2"), false, true, true, false,
null, new Close(null, true), false);
// create user 0 with the specified parameters

View File

@ -19,16 +19,18 @@
package com.onlyoffice.integration;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.onlyoffice.client.ApacheHttpclientDocumentServerClient;
import com.onlyoffice.client.DocumentServerClient;
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
import com.onlyoffice.manager.document.DocumentManager;
import com.onlyoffice.manager.request.DefaultRequestManager;
import com.onlyoffice.manager.request.RequestManager;
import com.onlyoffice.manager.security.DefaultJwtManager;
import com.onlyoffice.manager.security.JwtManager;
import com.onlyoffice.manager.settings.SettingsManager;
import com.onlyoffice.manager.url.UrlManager;
import com.onlyoffice.service.command.CommandService;
import com.onlyoffice.service.command.DefaultCommandService;
import com.onlyoffice.service.convert.ConvertService;
import com.onlyoffice.service.convert.DefaultConvertServiceV2;
import com.onlyoffice.service.convert.DefaultConvertService;
import org.json.simple.parser.JSONParser;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
@ -81,14 +83,21 @@ public class IntegrationConfiguration {
}
@Bean
public DocumentServerClient documentServerClient(final SettingsManager settingsManager,
final UrlManager urlManager) {
return new ApacheHttpclientDocumentServerClient(settingsManager, urlManager);
public RequestManager requestManager(final UrlManager urlManager, final JwtManager jwtManager,
final SettingsManager settingsManager) {
return new DefaultRequestManager(urlManager, jwtManager, settingsManager);
}
@Bean
public ConvertService convertService(final DocumentManager documentManager, final UrlManager urlManager,
final DocumentServerClient documentServerClient) {
return new DefaultConvertServiceV2(documentManager, urlManager, documentServerClient);
final RequestManager requestManager,
final SettingsManager settingsManager) {
return new DefaultConvertService(documentManager, urlManager, requestManager, settingsManager);
}
@Bean
public CommandService commandService(final RequestManager requestManager) {
return new DefaultCommandService(requestManager);
}
}

View File

@ -22,7 +22,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import com.onlyoffice.client.DocumentServerClient;
import com.onlyoffice.integration.documentserver.managers.history.HistoryManager;
import com.onlyoffice.integration.documentserver.storage.FileStorageMutator;
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
@ -40,6 +39,7 @@ import com.onlyoffice.integration.sdk.manager.DocumentManager;
import com.onlyoffice.integration.sdk.service.ConfigService;
import com.onlyoffice.integration.services.UserServices;
import com.onlyoffice.manager.request.RequestManager;
import com.onlyoffice.manager.security.JwtManager;
import com.onlyoffice.manager.settings.SettingsManager;
import com.onlyoffice.manager.url.UrlManager;
@ -51,8 +51,10 @@ import com.onlyoffice.model.convertservice.ConvertRequest;
import com.onlyoffice.model.convertservice.ConvertResponse;
import com.onlyoffice.model.documenteditor.Callback;
import com.onlyoffice.model.documenteditor.config.document.ReferenceData;
import com.onlyoffice.service.command.CommandService;
import com.onlyoffice.service.convert.ConvertService;
import com.onlyoffice.service.documenteditor.callback.CallbackService;
import org.apache.hc.core5.http.HttpEntity;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
@ -81,8 +83,10 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
@ -116,12 +120,14 @@ public class FileController {
@Autowired
private ConvertService convertService;
@Autowired
private DocumentServerClient documentServerClient;
private RequestManager requestManager;
@Autowired
private SettingsManager settingsManager;
@Autowired
private CallbackService callbackService;
@Autowired
private CommandService commandService;
@Autowired
private ConfigService configService;
@Autowired
private UrlManager urlManager;
@ -250,7 +256,6 @@ public class FileController {
.outputtype(conversionExtension)
.region(lang)
.async(true)
.title(fileName)
.build();
ConvertResponse convertResponse = convertService.processConvert(convertRequest, fileName);
@ -275,20 +280,26 @@ public class FileController {
String nameWithInternalExt = documentManager.getBaseName(fileName) + "." + newFileType;
String correctedName = documentManager.getCorrectName(nameWithInternalExt);
File file = storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(correctedName)));
try {
documentServerClient.getFile(newFileUri, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
fileName = requestManager.executeGetRequest(newFileUri, new RequestManager.Callback<String>() {
public String doWork(final Object response) throws IOException {
InputStream stream = ((HttpEntity) response).getContent(); // get input stream of the converted
// file
throw e;
}
if (stream == null) {
throw new RuntimeException("Input stream is null");
}
if (!keepOriginal) {
storageMutator.deleteFile(oldFileName);
}
fileName = correctedName;
// remove source file
if (!keepOriginal) {
storageMutator.deleteFile(oldFileName);
}
// create the converted file with input stream
storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(correctedName)), stream);
return correctedName;
}
});
}
// create meta information about the converted file with the user ID and name specified
@ -379,6 +390,7 @@ public class FileController {
final String fileExt, // create a sample file of the specified extension
@RequestParam(value = "sample", required = false) final Optional<Boolean> isSample,
@CookieValue(value = "uid", required = false) final String uid,
@CookieValue(value = "ulang") final String lang,
final Model model) {
// specify if the sample data exists or not
Boolean sampleData = (isSample.isPresent() && !isSample.isEmpty()) && isSample.get();
@ -391,6 +403,7 @@ public class FileController {
}
String fileName = documentManager.createDemo(fileExt,
sampleData,
lang,
uid,
user.get().getName()); // create a demo document with the sample data
if (fileName == null || fileName.isBlank()) {
@ -468,18 +481,20 @@ public class FileController {
url = urlManager.replaceToInnerDocumentServerUrl(url);
File file = storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(fileName)));
try {
documentServerClient.getFile(url, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
return requestManager.executeGetRequest(url, new RequestManager.Callback<String>() {
@Override
public String doWork(final Object response) throws Exception {
InputStream stream = ((HttpEntity) response).getContent();
throw e;
}
if (documentManager.getMaxFileSize() < stream.available() || stream.available() <= 0) {
return "{\"error\":\"File size is incorrect\"}";
}
storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(fileName)), stream);
createUserMetadata(uid, fileName);
createUserMetadata(uid, fileName);
return "{\"file\": \"" + fileName + "\"}";
return "{\"file\": \"" + fileName + "\"}";
}
});
} catch (Exception e) {
e.printStackTrace();
return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}";
@ -499,7 +514,7 @@ public class FileController {
try {
CommandResponse commandResponse = documentServerClient.command(commandRequest);
CommandResponse commandResponse = commandService.processCommand(commandRequest, body.getFileName());
return commandResponse.getError().getDescription();
} catch (Exception e) {
e.printStackTrace();
@ -667,14 +682,12 @@ public class FileController {
Files.move(sourcePathFile, bumpedFile);
if (body.getUrl() != null) {
File file = storageMutator.createFile(sourcePathFile);
try {
documentServerClient.getFile(body.getUrl(), Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
throw e;
}
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) new URL(body.getUrl())
.openConnection();
InputStream stream = connection.getInputStream();
storageMutator.createFile(sourcePathFile, stream);
stream.close();
connection.disconnect();
} else {
String recoveryVersionStringDirectory = historyManager.versionDir(
historyDirectory,

View File

@ -18,7 +18,6 @@
package com.onlyoffice.integration.controllers;
import com.onlyoffice.client.DocumentServerClient;
import com.onlyoffice.integration.dto.ForgottenFile;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@ -35,6 +34,7 @@ import com.onlyoffice.model.commandservice.CommandRequest;
import com.onlyoffice.model.commandservice.CommandResponse;
import com.onlyoffice.model.commandservice.commandrequest.Command;
import com.onlyoffice.manager.document.DocumentManager;
import com.onlyoffice.service.command.CommandService;
import java.util.ArrayList;
import java.util.List;
@ -50,10 +50,10 @@ public class ForgottenController {
private String enableForgotten;
@Autowired
private DocumentManager documentManager;
private CommandService commandService;
@Autowired
private DocumentServerClient documentServerClient;
private DocumentManager documentManager;
@GetMapping("${url.forgotten}")
public String index(final Model model) {
@ -74,14 +74,14 @@ public class ForgottenController {
CommandRequest commandRequest = CommandRequest.builder()
.c(Command.GET_FORGOTTEN_LIST)
.build();
CommandResponse commandResponse = documentServerClient.command(commandRequest);
CommandResponse commandResponse = commandService.processCommand(commandRequest, null);
List<String> keys = commandResponse.getKeys();
for (int i = 0; i < keys.size(); i++) {
commandRequest = CommandRequest.builder()
.c(Command.GET_FORGOTTEN)
.key(keys.get(i))
.build();
commandResponse = documentServerClient.command(commandRequest);
commandResponse = commandService.processCommand(commandRequest, null);
ForgottenFile file = new ForgottenFile(
commandResponse.getKey(),
documentManager.getDocumentType(commandResponse.getUrl()).toString().toLowerCase(),
@ -111,7 +111,7 @@ public class ForgottenController {
.key(filename)
.build();
CommandResponse commandResponse = documentServerClient.command(commandRequest);
CommandResponse commandResponse = commandService.processCommand(commandRequest, null);
return new ResponseEntity<>(HttpStatus.NO_CONTENT);
} catch (Exception e) {
e.printStackTrace();

View File

@ -19,12 +19,12 @@
package com.onlyoffice.integration.documentserver.managers.callback;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.onlyoffice.client.DocumentServerClient;
import com.onlyoffice.integration.documentserver.managers.history.HistoryManager;
import com.onlyoffice.integration.documentserver.storage.FileStorageMutator;
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
import com.onlyoffice.integration.sdk.manager.DocumentManager;
import com.onlyoffice.integration.sdk.manager.UrlManager;
import com.onlyoffice.manager.request.RequestManager;
import com.onlyoffice.model.commandservice.CommandRequest;
import com.onlyoffice.model.commandservice.commandrequest.Command;
import com.onlyoffice.model.convertservice.ConvertRequest;
@ -33,15 +33,19 @@ import com.onlyoffice.model.documenteditor.Callback;
import com.onlyoffice.model.documenteditor.callback.Action;
import com.onlyoffice.model.documenteditor.callback.ForcesaveType;
import com.onlyoffice.model.documenteditor.callback.action.Type;
import com.onlyoffice.service.command.CommandService;
import com.onlyoffice.service.convert.ConvertService;
import lombok.SneakyThrows;
import org.apache.hc.core5.http.HttpEntity;
import org.json.simple.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.nio.file.Files;
import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
@ -61,13 +65,46 @@ public class DefaultCallbackManager implements CallbackManager {
@Autowired
private ConvertService convertService;
@Autowired
private DocumentServerClient documentServerClient;
private RequestManager requestManager;
@Autowired
private CommandService commandService;
@Autowired
private HistoryManager historyManager;
@Autowired
private UrlManager urlManager;
// download file from url
@SneakyThrows
private byte[] getDownloadFile(final String url) {
if (url == null || url.isEmpty()) {
throw new RuntimeException("Url argument is not specified"); // URL isn't specified
}
return requestManager.executeGetRequest(url, new RequestManager.Callback<byte[]>() {
public byte[] doWork(final Object response) throws IOException {
InputStream stream = ((HttpEntity) response).getContent(); // get input stream of the converted
// file
if (stream == null) {
throw new RuntimeException("Input stream is null");
}
return stream.readAllBytes();
}
});
}
// file saving
@SneakyThrows
private void saveFile(final byte[] byteArray, final Path path) {
if (path == null) {
throw new RuntimeException("Path argument is not specified"); // file isn't specified
}
// update a file or create a new one
storageMutator.createOrUpdateFile(path, new ByteArrayInputStream(byteArray));
}
@Override
public void processEditing(final Callback callback, final String fileName) {
Action action = callback.getActions().get(0); // get the user ID who is editing the document
@ -81,7 +118,7 @@ public class DefaultCallbackManager implements CallbackManager {
// create a command request to forcibly save the document being edited without closing it
try {
documentServerClient.command(commandRequest);
commandService.processCommand(commandRequest, fileName);
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -136,6 +173,8 @@ public class DefaultCallbackManager implements CallbackManager {
}
}
byte[] byteArrayFile = getDownloadFile(downloadUri); // download document file
Path lastVersion = Paths.get(storagePathBuilder
.getFileLocation(fileName)); // get the path to the last file version
@ -155,23 +194,11 @@ public class DefaultCallbackManager implements CallbackManager {
lastVersion.toFile().renameTo(new File(versionDir + File.separator + "prev." + curExt));
File file = storageMutator.createFile(toSave);
try {
documentServerClient.getFile(downloadUri, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
saveFile(byteArrayFile, toSave); // save document file
throw e;
}
File diff = storageMutator.createFile(Path.of(versionDir + File.separator + "diff.zip"));
try {
documentServerClient.getFile(changesUri, Files.newOutputStream(diff.toPath()));
} catch (Exception e) {
diff.delete();
throw e;
}
byte[] byteArrayChanges = getDownloadFile(changesUri); // download file changes
saveFile(byteArrayChanges, Path
.of(versionDir + File.separator + "diff.zip")); // save file changes to the diff.zip archive
JSONObject jsonChanges = new JSONObject(); // create a json object for document changes
jsonChanges.put("changes", callback.getHistory().getChanges()); // put the changes to the json object
@ -235,6 +262,7 @@ public class DefaultCallbackManager implements CallbackManager {
}
}
byte[] byteArrayFile = getDownloadFile(downloadUri); // download document file
String forcesavePath = "";
// todo: Use ENUMS
@ -269,15 +297,9 @@ public class DefaultCallbackManager implements CallbackManager {
.getBaseName(fileName) + ".txt");
String formsPath = storagePathBuilder.getFileLocation(formsName);
byte[] byteArrayFormsData = getDownloadFile(formsDataUrl);
File forms = storageMutator.createFile(Paths.get(formsPath));
try {
documentServerClient.getFile(formsDataUrl, Files.newOutputStream(forms.toPath()));
} catch (Exception e) {
forms.delete();
throw e;
}
saveFile(byteArrayFormsData, Paths.get(formsPath));
} else {
throw new RuntimeException("Document editing service did not return formsDataUrl");
}
@ -296,14 +318,6 @@ public class DefaultCallbackManager implements CallbackManager {
}
}
File forcesave = storageMutator.createFile(Path.of(forcesavePath));
try {
documentServerClient.getFile(downloadUri, Files.newOutputStream(forcesave.toPath()));
} catch (Exception e) {
forcesave.delete();
throw e;
}
saveFile(byteArrayFile, Path.of(forcesavePath));
}
}

View File

@ -123,10 +123,7 @@ public class DefaultHistoryManager implements HistoryManager {
History changes = objectMapper.readValue(changesSteam, History.class);
List<Object> historyChanges = changes.getChanges();
Map<String, Object> historyChange = objectMapper.convertValue(
historyChanges.get(historyChanges.size() - 1),
Map.class
);
Map<String, Object> historyChange = objectMapper.convertValue(historyChanges.get(0), Map.class);
// write information about changes to the object
version.setChanges(changes.getChanges());

View File

@ -20,6 +20,7 @@ package com.onlyoffice.integration.documentserver.storage;
import org.springframework.core.io.Resource;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.InputStream;
import java.nio.file.Path;
@ -28,7 +29,6 @@ import java.nio.file.Path;
public interface FileStorageMutator {
void createDirectory(Path path); // create a new directory if it does not exist
boolean createFile(Path path, InputStream stream); // create a new file if it does not exist
File createFile(Path path); // create a new file if it does not exist
boolean deleteFile(String fileName); // delete a file
boolean deleteFileHistory(String fileName); // delete file history
boolean deleteUserFolder(); // delete the user's folder recursively
@ -39,4 +39,5 @@ public interface FileStorageMutator {
Resource loadFileAsResourceHistory(String fileName, String version, String file); // load file as a resource
File[] getStoredFiles(); // get a collection of all the stored files
void createMeta(String fileName, String uid, String uname); // create the file meta information
boolean createOrUpdateFile(Path path, ByteArrayInputStream stream); // create or update a file
}

View File

@ -30,6 +30,7 @@ import org.springframework.stereotype.Component;
import org.springframework.util.FileSystemUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
@ -45,8 +46,6 @@ import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Comparator;
import java.util.Date;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@ -163,18 +162,6 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
return false;
}
public File createFile(final Path path) {
if (Files.exists(path)) {
return path.toFile();
}
try {
return Files.createFile(path).toFile();
} catch (IOException e) {
throw new RuntimeException(e);
}
}
// delete a file
public boolean deleteFile(final String fileNameParam) {
String fileName = URLDecoder
@ -330,9 +317,7 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
// get a collection of all the stored files
public File[] getStoredFiles() {
File file = new File(getStorageLocation());
File[] files = file.listFiles(pathname -> pathname.isFile());
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
return files;
return file.listFiles(pathname -> pathname.isFile());
}
@SneakyThrows
@ -360,6 +345,22 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
}
}
// create or update a file
public boolean createOrUpdateFile(final Path path, final ByteArrayInputStream stream) {
if (!Files.exists(path)) { // if the specified file does not exist
return createFile(path, stream); // create it in the specified directory
} else {
try {
Files.write(path, stream
.readAllBytes()); // otherwise, write new information in the bytes format to the file
return true;
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
// get the server URL
public String getServerUrl(final Boolean forDocumentServer) {
if (forDocumentServer && !docserviceUrlExample.equals("")) {

View File

@ -25,6 +25,6 @@ public interface DocumentManager extends com.onlyoffice.manager.document.Documen
String getCorrectName(String fileName);
ArrayList<Map<String, Object>> getFilesInfo();
ArrayList<Map<String, Object>> getFilesInfo(String fileId);
String createDemo(String fileExt, Boolean sample, String uid, String uname) throws Exception;
String createDemo(String fileExt, Boolean sample, String lang, String uid, String uname) throws Exception;
String generateRevisionId(String expectedKey);
}

View File

@ -127,15 +127,22 @@ public class DocumentMangerImpl extends DefaultDocumentManager implements Docume
// create demo document
@Override
public String createDemo(final String fileExt, final Boolean sample, final String uid, final String uname) {
public String createDemo(
final String fileExt,
final Boolean sample,
final String lang,
final String uid,
final String uname
) {
String demoName = (sample ? "sample." : "new.")
+ fileExt; // create sample or new template file with the necessary extension
String langPath = lang.contains("-") ? lang : "default";
String demoPath =
"assets"
+ File.separator
+ "document-templates"
+ File.separator
+ (sample ? "sample" : "new")
+ (sample ? "sample" : ("new" + File.separator + langPath))
+ File.separator
+ demoName;

View File

@ -42,7 +42,6 @@ import com.onlyoffice.model.documenteditor.config.editorconfig.Mode;
import com.onlyoffice.model.documenteditor.config.editorconfig.Template;
import com.onlyoffice.model.documenteditor.config.editorconfig.customization.Goback;
import com.onlyoffice.model.documenteditor.config.editorconfig.customization.Close;
import com.onlyoffice.model.documenteditor.config.editorconfig.customization.Features;
import com.onlyoffice.model.documenteditor.config.editorconfig.embedded.Toolbar;
import com.onlyoffice.service.documenteditor.config.DefaultConfigService;
import org.springframework.beans.factory.annotation.Autowired;
@ -252,14 +251,6 @@ public class ConfigServiceImpl extends DefaultConfigService implements ConfigSer
close.setVisible(appUser.getClose().getVisible());
}
Features features = Features.builder()
.featuresTips(false)
.build();
if (appUser == null || String.valueOf(appUser.getId()).equals("4")) {
features.setFeaturesTips(true);
}
Customization customization = Customization.builder()
.autosave(true) // if the Autosave menu option is enabled or disabled
.comments(true) // if the Comments menu button is displayed or hidden
@ -274,7 +265,6 @@ public class ConfigServiceImpl extends DefaultConfigService implements ConfigSer
.feedback(true)
.goback(goback)
.close(close)
.features(features)
.build();
return customization;

View File

@ -1,4 +1,4 @@
server.version=1.14.0
server.version=1.13.0
server.address=
server.port=4000
@ -15,7 +15,7 @@ files.docservice.history.postfix=-hist
files.docservice.url.example=
files.docservice.languages=en:English|sq-AL:Albanian (Albania)|ar:Arabic|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs:Czech|da:Danish|nl:Dutch|en-GB:English (United Kingdom)|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lo:Lao|lv:Latvian|ms:Malay (Malaysia)|no:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|ur:Urdu|vi:Vietnamese|aa-AA:Test Language
files.docservice.languages=en:English|sq-AL:Albanian (Albania)|ar-SA:Arabic|hy-AM:Armenian|az-Latn-AZ:Azerbaijani|eu-ES:Basque|be:Belarusian|bg-BG:Bulgarian|ca:Catalan|zh-CN:Chinese (Simplified)|zh-TW:Chinese (Traditional)|cs-CZ:Czech|da:Danish|nl-NL:Dutch|en-GB:English (United Kingdom)|fi-FI:Finnish|fr-FR:French|gl-ES:Galego|de-DE:German|el-GR:Greek|he-IL:Hebrew (Israel)|hu:Hungarian|id:Indonesian|it-IT:Italian|ja-JP:Japanese|ko-KR:Korean|lo:Lao|lv-LV:Latvian|ms-MY:Malay (Malaysia)|no:Norwegian|pl-PL:Polish|pt-BR:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru-RU:Russian|sr-Cyrl-RS:Serbian (Cyrillic)|sr-Latn-RS:Serbian (Latin)|si-LK:Sinhala (Sri Lanka)|sk-SK:Slovak|sl-SI:Slovenian|es-ES:Spanish|sv-SE:Swedish|tr-TR:Turkish|uk-UK:Ukrainian|vi-VN:Vietnamese|aa-AA:Test Language
docservice.url=http://documentserver/
docservice.ignoreSSLCertificate=false
@ -23,7 +23,6 @@ docservice.lossyEdit=epub, fb2, html, odt, ott, rtf, txt, csv, ods, ots, odp, ot
docservice.security.key=
docservice.security.header=
docservice.security.tokenValidityInMinutes=5
spring.datasource.url=jdbc:h2:mem:usersdb
spring.datasource.driverClassName=org.h2.Driver

View File

@ -146,7 +146,7 @@ header a {
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
.center, .table-main {
width: 100%;
}

View File

@ -626,7 +626,7 @@
}
}
@media (max-width: 420px) {
@media (max-width: 420px) and (min-width: 320px) {
.tableRow,
menu.links {
width: 25%;
@ -702,7 +702,7 @@
max-width: 45%;
}
}
@media (max-width: 600px) {
@media (max-width: 600px) and (min-width: 320px) {
.main-panel{
display: flex;
flex-direction: column;
@ -729,7 +729,7 @@
}
}
@media (max-width: 592px) {
@media (max-width: 592px) and (min-width: 320px) {
body.menu-open {
overflow: hidden;
}

View File

@ -511,6 +511,10 @@ label .checkbox {
line-height: 150%;
}
#loadScripts {
display: none;
}
#iframeScripts {
position: absolute;
visibility: hidden;

View File

@ -114,7 +114,7 @@ if (typeof jQuery !== "undefined") {
if (!formatManager.isAutoConvertible(posExt)) {
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
return;
}
@ -168,16 +168,36 @@ if (typeof jQuery !== "undefined") {
checkConvert(filePass, fileType);
} else {
jq("#hiddenFileName").val(response.filename);
jq("#uploadFileName").text(response.filename);
jq("#step2").addClass("done").removeClass("current");
onuploaded();
loadScripts();
}
}
});
}, 1000);
};
var onuploaded = function () {
var loadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("current");
if (jq("#loadScripts").is(":empty")) {
var urlScripts = jq("#loadScripts").attr("data-docs");
var frame = "<iframe id=\"iframeScripts\" width=1 height=1 style=\"position: absolute; visibility: hidden;\" ></iframe>";
jq("#loadScripts").html(frame);
document.getElementById("iframeScripts").onload = onloadScripts;
jq("#loadScripts iframe").attr("src", urlScripts);
} else {
onloadScripts();
}
};
var onloadScripts = function () {
if (!jq("#mainProgress").is(":visible")) {
return;
}
jq("#step3").addClass("done").removeClass("current");
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
@ -245,7 +265,7 @@ if (typeof jQuery !== "undefined") {
jq(document).on("click", "#skipPass", function () {
jq("#blockPassword").hide();
onuploaded();
loadScripts();
});
jq(document).on("click", "#beginEdit:not(.disable)", function () {
@ -254,7 +274,6 @@ if (typeof jQuery !== "undefined") {
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginView:not(.disable)", function () {
@ -263,7 +282,6 @@ if (typeof jQuery !== "undefined") {
window.open(url, "_blank");
jq("#hiddenFileName").val("");
jq.unblockUI();
document.location.reload();
});
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
@ -326,7 +344,7 @@ if (typeof jQuery !== "undefined") {
}
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("error");
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
@ -336,7 +354,6 @@ if (typeof jQuery !== "undefined") {
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep1").removeClass("error").addClass("done");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
@ -388,12 +405,14 @@ if (typeof jQuery !== "undefined") {
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
jq("#hiddenFileName").attr("data",response.filename);
if (response.error !== "FileTypeIsNotSupported") {
jq("#hiddenFileName").attr("data",response.filename);
jq("#beginEditConverted").removeClass("disable");
jq("#beginViewConverted").removeClass("disable");
jq("#downloadConverted").attr("data","fromStorage");
} else {
let newFilename = fileName.split('.').slice(0,-1).join('.')
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
jq("#downloadConverted").attr("data","fromConverter");
}
jq("td[name='convertingTypeButton']").removeClass("disable orange");

View File

@ -100,10 +100,6 @@
// the meta information of the document is changed via the meta command
var onMetaChange = function (event) {
if (event.data.title !== undefined) {
document.title = event.data.title + " - ONLYOFFICE";
}
if (event.data.favorite !== undefined) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
@ -356,33 +352,10 @@
users = [[${usersForMentions}]];
}
if ((c === "protect" || c === "mention") && users && event.data.count) {
let from = event.data.from;
let count = event.data.count;
let search = event.data.search;
if (from != 0) users = [];
var resultCount = 234;
for (var i = Math.max(users.length, from); i < Math.min(from + count, resultCount); i++){
users.push({
email: "test@test.test" + (i + 1),
id: "id" + (i + 1),
name: "test_" + search + (i + 1)
});
}
}
var result = {
docEditor.setUsers({
"c": c,
"users": users,
};
if (resultCount) {
// support v9.0
result.total = 1 + (!event.data.count || users.length < event.data.count ? 0 : (event.data.from + event.data.count));
// since v9.0.1
result.isPaginated = true;
}
docEditor.setUsers(result);
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment

View File

@ -114,7 +114,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -327,7 +327,10 @@
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<div class="error-message">
@ -372,7 +375,7 @@
</div>
</div>
<iframe id="iframeScripts" th:attr="src=${datadocs}" width=1 height=1 style="position: absolute; visibility: hidden; top: 0;" ></iframe>
<span id="loadScripts" th:attr="data-docs=${datadocs}"></span>
<footer>
<div class="center">
@ -380,7 +383,7 @@
<tbody>
<tr>
<td>
<a href="https://api.onlyoffice.com/docs/docs-api/get-started/how-it-works/" target="_blank">API Documentation</a>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>

View File

@ -1,34 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>OnlineEditorsExampleJava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
<filteredResources>
<filter>
<id>1690280351006</id>
<name></name>
<type>30</type>
<matcher>
<id>org.eclipse.core.resources.regexFilterMatcher</id>
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
</matcher>
</filter>
</filteredResources>
<name>OnlineEditorsExampleJava</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>

Some files were not shown because too many files have changed in this diff Show More