Compare commits

...

64 Commits

Author SHA1 Message Date
46d308c1b8 Merge branch 'release/v9.0.0' into develop
# Conflicts:
#	CHANGELOG.md
2025-03-28 13:48:37 +03:00
a7552677eb Merge branch 'hotfix/v8.3.3' into release/v9.0.0
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/nodejs/public/assets/document-formats
#	web/documentserver-example/nodejs/public/images/diagram.ico
2025-03-28 13:45:09 +03:00
f40f1a4704 fix text 2025-03-24 13:06:13 +03:00
88e541971e nodejs: fix lint 2025-03-24 12:55:34 +03:00
6239e05032 Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-03-24 12:53:20 +03:00
e25f957605 Merge pull request 'features-tips' from features-tips into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/52
2025-03-24 09:51:59 +00:00
5c0c2f7baa Merge remote-tracking branch 'remotes/origin/develop' into features-tips
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/csharp-mvc/Helpers/Users.cs
#	web/documentserver-example/csharp/Users.cs
#	web/documentserver-example/go/server/managers/default/user.go
#	web/documentserver-example/java-spring/pom.xml
#	web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/ExampleData.java
#	web/documentserver-example/java/src/main/java/helpers/Users.java
#	web/documentserver-example/nodejs/helpers/users.js
#	web/documentserver-example/php-laravel/app/Repositories/UserRepository.php
#	web/documentserver-example/php/src/helpers/ExampleUsers.php
#	web/documentserver-example/python/src/utils/users.py
#	web/documentserver-example/ruby/app/models/users.rb
2025-03-24 12:46:19 +03:00
974e728d8b Merge pull request 'feature/docs-integration-sdk' from feature/docs-integration-sdk into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/55
2025-03-24 09:40:10 +00:00
14dabe7789 fix: (java-spring) code style 2025-03-20 11:25:39 +03:00
18de6a1616 feat(java-spring): DocumentServerClient instead HttpURLConnection 2025-03-20 11:17:12 +03:00
983fa34c9f feat(java-spring): DocumentServerClient instead RequestManager 2025-03-20 11:16:42 +03:00
95a28b15b4 build(java-spring): com.onlyoffice:docs-integration-sdk:1.4.3-SNAPSHOT 2025-03-20 11:16:12 +03:00
6290abf5dd feat(java-spring): enable features tips for anonymous 2025-03-20 13:50:46 +07:00
d11115e452 build(java-spring): update docs-intergation-sdk to version 1.4.2-SNAPSHOT 2025-03-20 13:49:55 +07:00
39a32011f8 Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-03-19 11:46:53 +03:00
938212cb6a first user with favorite option 2025-03-17 16:12:41 +03:00
267e14edde reorder user's info 2025-03-17 15:59:31 +03:00
90710b9710 nodejs: reorder user's info 2025-03-17 15:12:04 +03:00
1794ce39ab nodejs: replace symbol 2025-03-14 17:07:52 +03:00
95218e4fe4 Merge branch 'feature/roles' into develop
# Conflicts:
#	CHANGELOG.md
2025-03-14 17:03:18 +03:00
13ccad5fbd Merge branch 'feature/submit' into develop 2025-03-14 16:19:08 +03:00
15c23bfc40 Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-03-14 16:18:59 +03:00
f5a11721bd Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-03-11 12:02:16 +03:00
9a3865e36e Merge branch 'release/v9.0.0' into develop
# Conflicts:
#	CHANGELOG.md
2025-03-11 11:46:53 +03:00
c796154fe1 update diagram tab icon
# Conflicts:
#	web/documentserver-example/csharp-mvc/Content/images/diagram.ico
#	web/documentserver-example/csharp/App_Themes/images/diagram.ico
#	web/documentserver-example/go/static/images/diagram.ico
#	web/documentserver-example/java/src/main/webapp/css/img/diagram.ico
#	web/documentserver-example/php/assets/images/diagram.ico
#	web/documentserver-example/python/static/images/diagram.ico
#	web/documentserver-example/ruby/app/assets/images/diagram.ico
2025-03-11 11:44:48 +03:00
0599f74117 nodejs: support diagram editor
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/nodejs/public/assets/document-formats
2025-03-11 11:44:26 +03:00
8f944e203d nodejs: support vsdx in visio editor
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/nodejs/public/assets/document-formats
2025-03-11 11:43:38 +03:00
d8ea6a6dbb Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-03-11 11:24:37 +03:00
aaf8ac5328 feat(ruby): enable features tips for anonymous 2025-03-03 14:57:09 +07:00
11bbbebec1 feat(python): enable features tips for anonymous 2025-03-03 14:52:30 +07:00
27f21fd6f5 feat(php-laravel): enable features tips for anonymous 2025-03-03 14:45:08 +07:00
e76faa4671 feat(php): enable features tips for anonymous 2025-03-03 14:26:30 +07:00
4d7fe321ba feat(java): enable features tips for anonymous 2025-03-03 14:13:25 +07:00
aeda04b9e7 feat(golang): enable features tips for anonymous 2025-03-03 13:47:51 +07:00
699370936a feat(csharp-mvc): enable features tips for anonymous 2025-03-03 12:01:22 +07:00
ba95202084 fix(csharp-mvc): correct null users for protect and mentions for anonymous 2025-03-03 11:57:23 +07:00
2f72904deb feat(csharp): enable features tips for anonymous 2025-03-03 11:38:09 +07:00
cd033ac3bd fix(csharp): correct null users for protect and mentions for anonymous 2025-03-03 11:37:07 +07:00
6b9e5503c3 feat(nodejs): enable features tips for anonymous 2025-02-27 15:17:18 +07:00
d6d9ea024c Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-02-24 17:21:00 +03:00
f74fb7384e Merge pull request 'feat(nodejs): wopi proof key verification' from feature/wopi-verification into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/43
2025-02-24 14:15:35 +00:00
14458f82dd Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-02-24 15:11:21 +03:00
f4a11e2047 Merge pull request 'nodejs: move editor style to template file' from replace-editor-css into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/48
2025-02-24 12:10:13 +00:00
0f9f09d346 nodejs: move editor style to template file 2025-02-24 14:09:28 +07:00
ed0a70f071 Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-02-20 13:18:39 +03:00
dadba2a81f Merge remote-tracking branch 'remotes/origin/hotfix/v8.3.1' into develop 2025-02-19 11:33:47 +03:00
fe56ec24b5 nodejs: encode path in url for wopi 2025-02-19 11:31:24 +03:00
6a11ac4ced diagram to changelog for all 2025-02-17 10:35:07 +03:00
5169b1dc97 ci: change sdk version to dev-diagram 2025-02-17 10:26:35 +03:00
dabb51bf8a Merge branch 'release/1.13.0' into develop 2025-02-17 10:23:08 +03:00
f15f48eba5 java-spring: sdk 1.4.1-SNAPSHOT 2025-02-14 15:55:18 +03:00
12753dee19 Merge remote-tracking branch 'remotes/origin/release/1.13.0' into develop 2025-02-14 15:51:54 +03:00
598e914452 Merge pull request 'feature/diagrams' from feature/diagrams-editor into develop
Reviewed-on: https://git.onlyoffice.com/ONLYOFFICE/document-server-integration/pulls/33
2025-02-11 15:19:08 +00:00
099a53b24b Merge remote-tracking branch 'remotes/origin/develop' into feature/diagrams-editor
# Conflicts:
#	.gitmodules
#	CHANGELOG.md
2025-02-11 18:14:51 +03:00
d01263917c nodejs: vsdx 2025-02-11 18:14:00 +03:00
0f3c40e0b1 update diagram tab icon 2025-02-11 16:42:41 +07:00
bf2f32b7cb Merge remote-tracking branch 'remotes/origin/develop' into feature/diagrams-editor
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/csharp-mvc/assets/document-formats
#	web/documentserver-example/csharp/assets/document-formats
#	web/documentserver-example/go/static/assets/document-formats
#	web/documentserver-example/java/src/main/resources/assets/document-formats
#	web/documentserver-example/php/assets/document-formats
#	web/documentserver-example/python/assets/document-formats
#	web/documentserver-example/ruby/assets/document-formats
2025-02-07 11:59:22 +03:00
534eedfae1 feat(ruby): support vsdx in diagram editor 2025-02-04 15:56:39 +07:00
77775754b6 feat(python): support vsdx in diagram editor 2025-02-04 15:47:49 +07:00
bfebc197af feat(php): support vsdx in diagram editor 2025-02-04 15:28:36 +07:00
a3d7b159da feat(java): support vsdx in diagram editor 2025-02-04 15:03:07 +07:00
f12cb242ea feat(go): support vsdx in diagram editor 2025-02-04 14:48:00 +07:00
8a5f37da3f feat(csharp-mvc): support vsdx in diagram editor 2025-02-04 14:10:43 +07:00
5c9fe8f8f5 feat(csharp): support vsdx in diagram editor 2025-02-04 13:27:05 +07:00
78 changed files with 570 additions and 387 deletions

8
.gitmodules vendored
View File

@ -5,6 +5,7 @@
[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
@ -12,6 +13,7 @@
[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
@ -19,6 +21,7 @@
[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
@ -42,15 +45,19 @@
[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
@ -58,6 +65,7 @@
[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

View File

@ -1,5 +1,7 @@
# Change Log
- features tips for anonymous
- nodejs: support vsdx in diagram editor
- nodejs: user role
- nodejs: start filling

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -631,6 +631,11 @@ footer table tr td:first-child {
background-image: url("images/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("images/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

View File

@ -26,12 +26,12 @@ namespace OnlineEditorsExampleMVC.Helpers
static List<string> descr_user_1 = new List<string>()
{
"File author by default",
"Doesnt belong to any group",
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"This file isn't marked as favorite",
"Can create files from templates using data from the editor",
"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",
"Cant submit forms"
"Can't 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",
"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",
"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",
"Can create new files from the editor",
"Can't submit forms",
"Can't close history",
"Can't restore the file version"
};
@ -67,19 +67,20 @@ namespace OnlineEditorsExampleMVC.Helpers
static List<string> descr_user_0 = new List<string>()
{
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"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",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Cant submit forms",
"Cant refresh outdated file"
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
};
private static List<User> users = new List<User>() {
@ -91,7 +92,7 @@ namespace OnlineEditorsExampleMVC.Helpers
null,
new Dictionary<string, object>(),
null,
null,
false,
new List<string>(),
descr_user_1,
true,
@ -133,7 +134,7 @@ namespace OnlineEditorsExampleMVC.Helpers
{ "remove", new List<string>() { } }
},
new List<string>() { "group-2" },
false,
null,
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,

View File

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

View File

@ -35,7 +35,8 @@ namespace OnlineEditorsExampleMVC.Models
Word,
Cell,
Slide,
Pdf
Pdf,
Diagram
}
// get file type
@ -47,6 +48,7 @@ namespace OnlineEditorsExampleMVC.Models
if (FormatManager.DocumentExtensions().Contains(ext)) return FileType.Word; // word type for document extensions
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return FileType.Cell; // cell type for spreadsheet extensions
if (FormatManager.PresentationExtensions().Contains(ext)) return FileType.Slide; // slide type for presentation extensions
if (FormatManager.DiagramExtensions().Contains(ext)) return FileType.Diagram; // diagram type for diagram extensions
return FileType.Null; // the default type is word
}
@ -202,6 +204,20 @@ namespace OnlineEditorsExampleMVC.Models
.ToList();
}
public static List<string> DiagramExtensions()
{
return Diagrams()
.Select(format => format.Extension())
.ToList();
}
public static List<Format> Diagrams()
{
return All()
.Where(format => format.Type == FileType.Diagram)
.ToList();
}
public static List<string> AllExtensions()
{
return All()

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -635,6 +635,11 @@ footer a:hover {
background-image: url("images/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("images/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

View File

@ -254,6 +254,7 @@ namespace OnlineEditorsExample
if (FormatManager.DocumentExtensions().Contains(ext)) return "word"; // word for text document extensions
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return "cell"; // cell for spreadsheet extensions
if (FormatManager.PresentationExtensions().Contains(ext)) return "slide"; // slide for presentation extensions
if (FormatManager.DiagramExtensions().Contains(ext)) return "diagram"; // diagram for diagram extensions
return "word"; // the default document type is word
}

View File

@ -294,6 +294,12 @@ 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") }
}
}
}
}
@ -327,14 +333,14 @@ namespace OnlineEditorsExample
// get users for mentions
List<Dictionary<string, object>> usersData = Users.getUsersForMentions(user.id);
UsersForMentions = !user.id.Equals("uid-0") ? jss.Serialize(usersData) : null;
UsersForMentions = jss.Serialize(!user.id.Equals("uid-0") ? 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 = !user.id.Equals("uid-0") ? jss.Serialize(usersProtectData) : null;
UsersForProtect = jss.Serialize(!user.id.Equals("uid-0") ? usersProtectData : null);
}
catch { }
}

View File

@ -164,6 +164,20 @@ namespace OnlineEditorsExample
.ToList();
}
public static List<string> DiagramExtensions()
{
return Diagrams()
.Select(format => format.Extension())
.ToList();
}
public static List<Format> Diagrams()
{
return All()
.Where(format => format.Type == "diagram")
.ToList();
}
public static List<string> AllExtensions()
{
return All()

View File

@ -25,12 +25,12 @@ namespace OnlineEditorsExample
static List<string> descr_user_1 = new List<string>()
{
"File author by default",
"Doesnt belong to any group",
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"This file isn't marked as favorite",
"Can create files from templates using data from the editor",
"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",
"Cant submit forms"
"Can't submit forms"
};
static List<string> descr_user_3 = new List<string>()
@ -52,33 +52,34 @@ 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",
"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",
"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",
"Can create new files from the editor",
"Can't close history",
"Can't restore the file version"
"Can't restore the file version",
"Can't submit forms"
};
static List<string> descr_user_0 = new List<string>()
{
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"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",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Cant submit forms",
"Cant refresh outdated file"
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
};
private static List<User> users = new List<User>() {
@ -90,7 +91,7 @@ namespace OnlineEditorsExample
null,
new Dictionary<string, object>(),
null,
null,
false,
new List<string>(),
descr_user_1,
true,
@ -132,7 +133,7 @@ namespace OnlineEditorsExample
{ "remove", new List<string>() { } }
},
new List<string>() { "group-2" },
false,
null,
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,

View File

@ -29,4 +29,5 @@ type ExtensionTypes struct {
Presentation []string `json:"presentation"`
Document []string `json:"document"`
Pdf []string `json:"pdf"`
Diagram []string `json:"diagram"`
}

View File

@ -93,6 +93,7 @@ func NewSpecification() (specification SpecificationConfig, err error) {
fm.GetPresentationExtensions(),
fm.GetDocumentExtensions(),
fm.GetPdfExtensions(),
fm.GetDiagramExtensions(),
}
specification = SpecificationConfig{
exts,

View File

@ -68,6 +68,9 @@ func (cm DefaultConversionManager) GetFileType(filename string) string {
if utils.IsInList(ext, exts.Presentation) {
return shared.ONLYOFFICE_PRESENTATION
}
if utils.IsInList(ext, exts.Diagram) {
return shared.ONLYOFFICE_DIAGRAM
}
return shared.ONLYOFFICE_DOCUMENT
}

View File

@ -222,6 +222,9 @@ func (dm DefaultDocumentManager) BuildDocumentConfig(
Goback: models.Goback{
RequestClose: false,
},
Features: models.Features{
FeaturesTips: user.Id == "uid-0",
},
},
},
StandardClaims: jwt.StandardClaims{

View File

@ -54,7 +54,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
ReviewGroups: nil,
CommentGroups: nil,
UserInfoGroups: nil,
Favorite: -1,
Favorite: 0,
DeniedPermissions: nil,
Description: descriptionUser1,
Templates: true,
@ -102,7 +102,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
"remove": "",
},
UserInfoGroups: []string{"group-2"},
Favorite: 0,
Favorite: -1,
DeniedPermissions: []string{"copy", "download", "print"},
Description: descriptionUser3,
Templates: false,
@ -124,25 +124,26 @@ 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 submit forms",
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document",
}
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",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"This file isn't marked as favorite",
"Can create files from templates using data from the editor",
"Can submit forms",
"Has an avatar",
}
@ -150,25 +151,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",
"Can see the information about users from Group2 and users who dont belong to any group",
"Can't submit forms",
"Has an avatar",
"Can't submit forms",
}
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",
"This file isn't marked as favorite",
"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",
"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

@ -21,6 +21,10 @@ 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"`
@ -28,6 +32,7 @@ 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

@ -22,5 +22,6 @@ const (
ONLYOFFICE_SPREADSHEET = "cell"
ONLYOFFICE_PRESENTATION = "slide"
ONLYOFFICE_PDF = "pdf"
ONLYOFFICE_DIAGRAM = "diagram"
ONLYOFFICE_HISTORY_POSTFIX = "-hist"
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -632,6 +632,11 @@ footer table tr td:first-child {
background-image: url("../images/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("../images/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

View File

@ -48,6 +48,7 @@ type FormatManager interface {
GetSpreadsheetExtensions() []string
GetPresentationExtensions() []string
GetPdfExtensions() []string
GetDiagramExtensions() []string
}
func NewFormatManager() (FormatManager, error) {
@ -141,10 +142,19 @@ func (fm DefaultFormatManager) GetPresentationExtensions() (slide []string) {
return
}
func (fm DefaultFormatManager) GetPdfExtensions() (slide []string) {
func (fm DefaultFormatManager) GetPdfExtensions() (pdf []string) {
for _, f := range fm.formats {
if f.FormatType == "pdf" {
slide = append(slide, f.Name)
pdf = append(pdf, f.Name)
}
}
return
}
func (fm DefaultFormatManager) GetDiagramExtensions() (diagram []string) {
for _, f := range fm.formats {
if f.FormatType == "diagram" {
diagram = append(diagram, f.Name)
}
}
return

View File

@ -84,7 +84,7 @@
<dependency>
<groupId>com.onlyoffice</groupId>
<artifactId>docs-integration-sdk</artifactId>
<version>1.4.0</version>
<version>1.4.3-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents.core5</groupId>

View File

@ -38,30 +38,31 @@ public class ExampleData {
// the description for user 0
List<String> descriptionUserZero = List.of(
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"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",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Cant submit forms",
"Can't refresh outdated file"
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
);
// the description for user 1
List<String> descriptionUserFirst = List.of(
"File author by default",
"He doesnt belong to any of the groups",
"He doesn't belong to any of the groups",
"He can review all the changes",
"He can do everything with the comments",
"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",
"This file isn't favorite",
"Can create a file from a template with data from the editor",
"Can view chat",
"Has an avatar",
"Can submit forms"
@ -70,16 +71,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 dont belong"
"He can review only his own changes or the changes made by the users who don't 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",
"Cant submit forms"
"Can't submit forms"
);
// the description for user 3
@ -88,23 +89,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",
"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",
"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",
"Can create a file from an editor",
"Can view chat",
"Cant submit forms",
"Can't close history",
"Can't restore the file version"
"Can't restore the file version",
"Can't submit forms"
);
// 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()), null, true, true, true,
List.of(FilterState.NULL.toString()), false, true, true, true,
new Goback(null, false), new Close(null, false), true);
// create user 2 with the specified parameters
@ -116,7 +117,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"), false, true, true, false,
new ArrayList<>(), List.of("group-2"), null, true, true, false,
null, new Close(null, true), false);
// create user 0 with the specified parameters

View File

@ -19,18 +19,16 @@
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.DefaultConvertService;
import com.onlyoffice.service.convert.DefaultConvertServiceV2;
import org.json.simple.parser.JSONParser;
import org.modelmapper.ModelMapper;
import org.modelmapper.convention.MatchingStrategies;
@ -83,21 +81,14 @@ public class IntegrationConfiguration {
}
@Bean
public RequestManager requestManager(final UrlManager urlManager, final JwtManager jwtManager,
final SettingsManager settingsManager) {
return new DefaultRequestManager(urlManager, jwtManager, settingsManager);
public DocumentServerClient documentServerClient(final SettingsManager settingsManager,
final UrlManager urlManager) {
return new ApacheHttpclientDocumentServerClient(settingsManager, urlManager);
}
@Bean
public ConvertService convertService(final DocumentManager documentManager, final UrlManager urlManager,
final RequestManager requestManager,
final SettingsManager settingsManager) {
return new DefaultConvertService(documentManager, urlManager, requestManager, settingsManager);
final DocumentServerClient documentServerClient) {
return new DefaultConvertServiceV2(documentManager, urlManager, documentServerClient);
}
@Bean
public CommandService commandService(final RequestManager requestManager) {
return new DefaultCommandService(requestManager);
}
}

View File

@ -22,6 +22,7 @@ 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;
@ -39,7 +40,6 @@ 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,10 +51,8 @@ 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;
@ -83,10 +81,8 @@ 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;
@ -120,14 +116,12 @@ public class FileController {
@Autowired
private ConvertService convertService;
@Autowired
private RequestManager requestManager;
private DocumentServerClient documentServerClient;
@Autowired
private SettingsManager settingsManager;
@Autowired
private CallbackService callbackService;
@Autowired
private CommandService commandService;
@Autowired
private ConfigService configService;
@Autowired
private UrlManager urlManager;
@ -281,26 +275,20 @@ public class FileController {
String nameWithInternalExt = documentManager.getBaseName(fileName) + "." + newFileType;
String correctedName = documentManager.getCorrectName(nameWithInternalExt);
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
File file = storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(correctedName)));
try {
documentServerClient.getFile(newFileUri, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
if (stream == null) {
throw new RuntimeException("Input stream is null");
}
throw e;
}
if (!keepOriginal) {
storageMutator.deleteFile(oldFileName);
}
// 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;
}
});
fileName = correctedName;
}
// create meta information about the converted file with the user ID and name specified
@ -480,20 +468,18 @@ public class FileController {
url = urlManager.replaceToInnerDocumentServerUrl(url);
return requestManager.executeGetRequest(url, new RequestManager.Callback<String>() {
@Override
public String doWork(final Object response) throws Exception {
InputStream stream = ((HttpEntity) response).getContent();
File file = storageMutator.createFile(Path.of(storagePathBuilder.getFileLocation(fileName)));
try {
documentServerClient.getFile(url, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
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);
throw e;
}
return "{\"file\": \"" + fileName + "\"}";
}
});
createUserMetadata(uid, fileName);
return "{\"file\": \"" + fileName + "\"}";
} catch (Exception e) {
e.printStackTrace();
return "{ \"error\" : 1, \"message\" : \"" + e.getMessage() + "\"}";
@ -513,7 +499,7 @@ public class FileController {
try {
CommandResponse commandResponse = commandService.processCommand(commandRequest, body.getFileName());
CommandResponse commandResponse = documentServerClient.command(commandRequest);
return commandResponse.getError().getDescription();
} catch (Exception e) {
e.printStackTrace();
@ -681,12 +667,14 @@ public class FileController {
Files.move(sourcePathFile, bumpedFile);
if (body.getUrl() != null) {
java.net.HttpURLConnection connection = (java.net.HttpURLConnection) new URL(body.getUrl())
.openConnection();
InputStream stream = connection.getInputStream();
storageMutator.createFile(sourcePathFile, stream);
stream.close();
connection.disconnect();
File file = storageMutator.createFile(sourcePathFile);
try {
documentServerClient.getFile(body.getUrl(), Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
throw e;
}
} else {
String recoveryVersionStringDirectory = historyManager.versionDir(
historyDirectory,

View File

@ -18,6 +18,7 @@
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;
@ -34,7 +35,6 @@ 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 CommandService commandService;
private DocumentManager documentManager;
@Autowired
private DocumentManager documentManager;
private DocumentServerClient documentServerClient;
@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 = commandService.processCommand(commandRequest, null);
CommandResponse commandResponse = documentServerClient.command(commandRequest);
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 = commandService.processCommand(commandRequest, null);
commandResponse = documentServerClient.command(commandRequest);
ForgottenFile file = new ForgottenFile(
commandResponse.getKey(),
documentManager.getDocumentType(commandResponse.getUrl()).toString().toLowerCase(),
@ -111,7 +111,7 @@ public class ForgottenController {
.key(filename)
.build();
CommandResponse commandResponse = commandService.processCommand(commandRequest, null);
CommandResponse commandResponse = documentServerClient.command(commandRequest);
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,19 +33,15 @@ 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.io.IOException;
import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.List;
@ -65,46 +61,13 @@ public class DefaultCallbackManager implements CallbackManager {
@Autowired
private ConvertService convertService;
@Autowired
private RequestManager requestManager;
@Autowired
private CommandService commandService;
private DocumentServerClient documentServerClient;
@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
@ -118,7 +81,7 @@ public class DefaultCallbackManager implements CallbackManager {
// create a command request to forcibly save the document being edited without closing it
try {
commandService.processCommand(commandRequest, fileName);
documentServerClient.command(commandRequest);
} catch (Exception e) {
throw new RuntimeException(e);
}
@ -173,8 +136,6 @@ 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
@ -194,11 +155,23 @@ public class DefaultCallbackManager implements CallbackManager {
lastVersion.toFile().renameTo(new File(versionDir + File.separator + "prev." + curExt));
saveFile(byteArrayFile, toSave); // save document file
File file = storageMutator.createFile(toSave);
try {
documentServerClient.getFile(downloadUri, Files.newOutputStream(file.toPath()));
} catch (Exception e) {
file.delete();
byte[] byteArrayChanges = getDownloadFile(changesUri); // download file changes
saveFile(byteArrayChanges, Path
.of(versionDir + File.separator + "diff.zip")); // save file changes to the diff.zip archive
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;
}
JSONObject jsonChanges = new JSONObject(); // create a json object for document changes
jsonChanges.put("changes", callback.getHistory().getChanges()); // put the changes to the json object
@ -262,7 +235,6 @@ public class DefaultCallbackManager implements CallbackManager {
}
}
byte[] byteArrayFile = getDownloadFile(downloadUri); // download document file
String forcesavePath = "";
// todo: Use ENUMS
@ -297,9 +269,15 @@ public class DefaultCallbackManager implements CallbackManager {
.getBaseName(fileName) + ".txt");
String formsPath = storagePathBuilder.getFileLocation(formsName);
byte[] byteArrayFormsData = getDownloadFile(formsDataUrl);
saveFile(byteArrayFormsData, Paths.get(formsPath));
File forms = storageMutator.createFile(Paths.get(formsPath));
try {
documentServerClient.getFile(formsDataUrl, Files.newOutputStream(forms.toPath()));
} catch (Exception e) {
forms.delete();
throw e;
}
} else {
throw new RuntimeException("Document editing service did not return formsDataUrl");
}
@ -318,6 +296,14 @@ public class DefaultCallbackManager implements CallbackManager {
}
}
saveFile(byteArrayFile, Path.of(forcesavePath));
File forcesave = storageMutator.createFile(Path.of(forcesavePath));
try {
documentServerClient.getFile(downloadUri, Files.newOutputStream(forcesave.toPath()));
} catch (Exception e) {
forcesave.delete();
throw e;
}
}
}

View File

@ -20,7 +20,6 @@ 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;
@ -29,6 +28,7 @@ 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,5 +39,4 @@ 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,7 +30,6 @@ 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;
@ -164,6 +163,18 @@ 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
@ -349,22 +360,6 @@ 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

@ -42,6 +42,7 @@ 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;
@ -251,6 +252,14 @@ 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
@ -265,6 +274,7 @@ public class ConfigServiceImpl extends DefaultConfigService implements ConfigSer
.feedback(true)
.goback(goback)
.close(close)
.features(features)
.build();
return customization;

View File

@ -114,6 +114,9 @@ public class FileModel {
editorConfig.getUser().setImage(user.getAvatar() ? DocumentManager.getServerUrl(false)
+ "/css/img/" + user.getId() + ".png" : null);
editorConfig.getCustomization().getFeatures()
.setFeaturesTips(user.getId().equals("uid-0"));
if (user.getGoback() != null) {
// write the absolute URL to the file location
editorConfig.getCustomization().getGoback()
@ -571,6 +574,7 @@ public class FileModel {
// customization parameters
public class Customization {
private Features features;
private Goback goback;
private Close close;
private Boolean forcesave;
@ -592,10 +596,15 @@ public class FileModel {
comments = true;
feedback = true;
forcesave = false;
features = new Features();
goback = new Goback();
close = new Close();
}
public Features getFeatures() {
return features;
}
public Goback getGoback() {
return goback;
}
@ -624,6 +633,18 @@ public class FileModel {
return feedback;
}
public class Features {
private Boolean featuresTips;
public Boolean getFeaturesTips() {
return featuresTips;
}
public void setFeaturesTips(final Boolean featuresTipsParam) {
this.featuresTips = featuresTipsParam;
}
}
public class Goback {
private String url;
private String text;

View File

@ -33,5 +33,8 @@ public enum FileType {
SLIDE,
@JsonProperty("pdf")
@SerializedName("pdf")
PDF
PDF,
@JsonProperty("diagram")
@SerializedName("diagram")
DIAGRAM
}

View File

@ -33,12 +33,12 @@ public final class Users {
private static List<String> descriptionUserFirst = new ArrayList<String>() {{
add("File author by default");
add("Doesnt belong to any group");
add("Doesn't belong to any group");
add("Can review all the changes");
add("Can perform all actions with comments");
add("The file favorite state is undefined");
add("Can create files from templates using data from the editor");
add("Can see the information about all users");
add("This file isn't marked as favorite");
add("Can create files from templates using data from the editor");
add("Has an avatar");
add("Can submit forms");
}};
@ -48,49 +48,50 @@ public final class Users {
add("Can review only his own changes or changes made by users with no group");
add("Can view comments, edit his own comments and comments left by users with no group."
+ " Can remove his own comments only");
add("Can see the information about users from Group2 and users who don't belong to any group");
add("This file is marked as favorite");
add("Can create new files from the editor");
add("Can see the information about users from Group2 and users who dont belong to any group");
add("Has an avatar");
add("Cant submit forms");
add("Can't submit forms");
}};
private static List<String> descriptionUserThird = new ArrayList<String>() {{
add("Belongs to Group3");
add("Can review changes made by Group2 users");
add("Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users");
add("This file isnt marked as favorite");
add("Cant copy data from the file to clipboard");
add("Cant download the file");
add("Cant print the file");
add("Can create new files from the editor");
add("Can see the information about Group2 users");
add("Cant submit forms");
add("The file favorite state is undefined");
add("Can't copy data from the file to clipboard");
add("Can't download the file");
add("Can't print the file");
add("Can create new files from the editor");
add("Can't close history");
add("Can't restore the file version");
add("Can't submit forms");
}};
private static List<String> descriptionUserZero = new ArrayList<String>() {{
add("The name is requested when the editor is opened");
add("Doesnt belong to any group");
add("Doesn't belong to any group");
add("Can review all the changes");
add("Can perform all actions with comments");
add("Can't see anyone's information");
add("The file favorite state is undefined");
add("Can't mention others in comments");
add("Can't create new files from the editor");
add("Cant see anyones information");
add("Can't rename files from the editor");
add("Can't view chat");
add("Can't protect file");
add("View file without collaboration");
add("Cant submit forms");
add("Can't refresh outdated file");
add("Can't submit forms");
add("Tour of tips when opening a document");
}};
private static List<User> users = new ArrayList<User>() {{
add(new User("uid-1", "John Smith", "smith@example.com",
"", null, new CommentGroups(), null,
null, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false),
false, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false),
new Close(null, false)));
add(new User("uid-2", "Mark Pottato", "pottato@example.com",
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
@ -100,7 +101,7 @@ public final class Users {
add(new User("uid-3", "Hamish Mitchell", null,
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
Arrays.asList("group-2"), null), Arrays.asList("group-2"),
false, Arrays.asList("copy", "download", "print"),
null, Arrays.asList("copy", "download", "print"),
descriptionUserThird, false, false, null, new Close(null, true)));
add(new User("uid-0", null, null,
"", null, null, null,

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -634,6 +634,11 @@ footer table tr td:first-child {
background-image: url("img/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("img/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

View File

@ -1241,6 +1241,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
protect: !user.deniedPermissions.includes('protect'),
goback: user.goback != null ? user.goback : '',
close: user.close,
featuresTips: userid === 'uid-0',
},
dataInsertImage: {
fileType: 'svg',

View File

@ -56,65 +56,66 @@ class User {
const descrUser1 = [
'File author by default',
'Doesnt belong to any group',
'Doesn\'t belong to any group',
'Can review all the changes',
'Can perform all actions with comments',
'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',
'This file isn\'t marked as favorite',
'Can create files from templates using data from the editor',
'Has an avatar',
'Has no roles',
'Can start filling',
'Has no roles',
'Can submit forms',
];
const descrUser2 = [
'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',
'Can submit forms',
'Has an avatar',
'Has role "Anyone"',
'Can start filling',
'Has role "Anyone"',
'Can submit forms',
];
const descrUser3 = [
'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',
'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',
'Cant close history',
'Cant restore the file version',
'Has role "role"',
'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',
'Can create new files from the editor',
'Can\'t close history',
'Can\'t restore the file version',
'Can start filling',
'Has role "role"',
'Can\'t submit forms',
];
const descrUser0 = [
'The name is requested when the editor is opened',
'Doesnt belong to any group',
'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',
'Cant see anyones information',
'Can\'t rename files from the editor',
'Can\'t view chat',
'Can\'t protect file',
'View file without collaboration',
'Cant submit forms',
'Cant refresh outdated file',
'Can\'t refresh outdated file',
'Can\'t start filling',
'Has empty role',
'Cant start filling',
'Can\'t submit forms',
'Tour of tips when opening a document',
];
const users = [
@ -126,7 +127,7 @@ const users = [
null,
{},
null,
null,
false,
[],
descrUser1,
true,
@ -156,7 +157,7 @@ const users = [
{ text: 'Go to Documents' },
{},
true,
[ 'Anyone' ],
['Anyone'],
),
new User(
'uid-3',
@ -170,7 +171,7 @@ const users = [
remove: [],
},
['group-2'],
false,
null,
['copy', 'download', 'print'],
descrUser3,
false,
@ -178,7 +179,7 @@ const users = [
null,
{},
false,
[ 'role' ],
['role'],
),
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null, false, []),
];

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -1,44 +0,0 @@
/**
*
* (c) Copyright Ascensio System SIA 2025
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
html {
height: 100%;
width: 100%;
}
body {
background: #fff;
color: #333;
font-family: Arial, Tahoma,sans-serif;
font-size: 12px;
font-weight: normal;
height: 100%;
margin: 0;
overflow-y: hidden;
padding: 0;
text-decoration: none;
}
.form {
height: 100%;
}
div {
margin: 0;
padding: 0;
}

View File

@ -41,6 +41,9 @@
"comments": true,
"close": <%- JSON.stringify(editor.close) %>,
"feedback": true,
"features": {
"featuresTips": <%- editor.featuresTips %>
},
"forcesave": false,
"goback": <%- JSON.stringify(editor.goback) %>,
"submitForm": <%- editor.submitForm %>

View File

@ -27,7 +27,34 @@
<link rel="icon"
href="images/<%- editor.documentType %>.ico"
type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="stylesheets/editor.css" />
<style>
html {
height: 100%;
width: 100%;
}
body {
background: #fff;
color: #333;
font-family: Arial, Tahoma,sans-serif;
font-size: 12px;
font-weight: normal;
height: 100%;
margin: 0;
overflow-y: hidden;
padding: 0;
text-decoration: none;
}
.form {
height: 100%;
}
div {
margin: 0;
padding: 0;
}
</style>
</head>
<body>
<div class="form">

View File

@ -136,6 +136,9 @@ class Editor
'submitForm' => $this->user->id === 'uid-1',
'goback' => $this->user->goback !== null ? $this->user->goback : '',
'close' => $this->user->close !== null ? $this->user->close : '',
'features' => [
'featuresTips' => $this->user->id == 'uid-0',
],
],
];
}

View File

@ -28,12 +28,12 @@ class UserRepository
{
$descriptions[] = [
'File author by default',
'Doesnt belong to any group',
'Doesn\'t belong to any group',
'Can review all the changes',
'Can perform all actions with comments',
'The file favorite state is undefined',
'Can create files from templates using data from the editor',
'Can see the information about all users',
'This file isn\'t marked as favorite',
'Can create files from templates using data from the editor',
'Has an avatar',
'Can submit forms',
];
@ -42,40 +42,41 @@ class UserRepository
'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',
'Cant submit forms',
'Can\'t submit forms',
];
$descriptions[] = [
'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',
'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',
'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',
'Can create new files from the editor',
"Can't close history",
"Can't restore the file version",
'Can\'t submit forms',
];
$descriptions[] = [
'The name is requested when the editor is opened',
'Doesnt belong to any group',
'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",
'Cant see anyones information',
"Can't rename files from the editor",
"Can't view chat",
'View file without collaboration',
'Cant submit forms',
'Cant refresh outdated file',
'Can\'t refresh outdated file',
'Can\'t submit forms',
'Tour of tips when opening a document',
];
$this->users = [
new User(
@ -86,7 +87,7 @@ class UserRepository
null,
[],
null,
null,
false,
[],
$descriptions[0],
true,
@ -126,7 +127,7 @@ class UserRepository
'remove' => [],
],
['group-2'],
false,
null,
['copy', 'download', 'print'],
$descriptions[2],
false,

View File

@ -4,7 +4,7 @@
"firebase/php-jwt": "^6.10",
"laravel/framework": "^11.0",
"laravel/tinker": "^2.9",
"onlyoffice/docs-integration-sdk": "^1.2"
"onlyoffice/docs-integration-sdk": "dev-feature/diagram"
},
"require-dev": {
"fakerphp/faker": "^1.23",

View File

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "ccf9e46d33350e7606c494225b794de1",
"content-hash": "d4ee81f9421da2deb58e94784aafa3b3",
"packages": [
{
"name": "brick/math",
@ -2382,16 +2382,16 @@
},
{
"name": "onlyoffice/docs-integration-sdk",
"version": "v1.2.0",
"version": "dev-feature/diagram",
"source": {
"type": "git",
"url": "https://github.com/ONLYOFFICE/docs-integration-sdk-php.git",
"reference": "31a038dfea8c2a383ab7b1854e720ba40d25ec68"
"reference": "ad47131e692cce1ff266955e6febbab9ac3bdeec"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ONLYOFFICE/docs-integration-sdk-php/zipball/31a038dfea8c2a383ab7b1854e720ba40d25ec68",
"reference": "31a038dfea8c2a383ab7b1854e720ba40d25ec68",
"url": "https://api.github.com/repos/ONLYOFFICE/docs-integration-sdk-php/zipball/ad47131e692cce1ff266955e6febbab9ac3bdeec",
"reference": "ad47131e692cce1ff266955e6febbab9ac3bdeec",
"shasum": ""
},
"require": {
@ -2431,7 +2431,7 @@
"issues": "https://github.com/ONLYOFFICE/docs-integration-sdk-php/issues",
"source": "https://github.com/ONLYOFFICE/docs-integration-sdk-php"
},
"time": "2025-02-14T13:01:23+00:00"
"time": "2025-02-14T13:08:36+00:00"
},
{
"name": "phpoption/phpoption",
@ -8317,7 +8317,9 @@
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": {},
"stability-flags": {
"onlyoffice/docs-integration-sdk": 20
},
"prefer-stable": true,
"prefer-lowest": false,
"platform": {

View File

@ -631,6 +631,11 @@ footer table tr td:first-child {
background-image: url("/assets/images/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("/assets/images/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -32,12 +32,12 @@ final class ExampleUsers
{
$this->user1Description = [
"File author by default",
"Doesnt belong to any group",
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"This file isn't marked as favorite",
"Can create files from templates using data from the editor",
"Has an avatar",
"Can submit forms"
];
@ -46,40 +46,41 @@ final class ExampleUsers
"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",
"Cant submit forms"
"Can't submit forms"
];
$this->user3Description = [
"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",
"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",
"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",
"Can create new files from the editor",
"Can't close history",
"Can't restore the file version"
"Can't restore the file version",
"Can't submit forms"
];
$this->user0Description = [
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"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",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"View file without collaboration",
"Cant submit forms",
"Cant refresh outdated file"
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
];
$this->users = [
new Users(
@ -90,7 +91,7 @@ final class ExampleUsers
null,
[],
null,
null,
false,
[],
$this->user1Description,
true,
@ -130,7 +131,7 @@ final class ExampleUsers
"remove" => [],
],
["group-2"],
false,
null,
["copy", "download", "print"],
$this->user3Description,
false,

View File

@ -185,6 +185,9 @@ final class DocEditorView extends View
// settings for the Open file location menu button and upper right corner button
"goback" => $user->goback !== null ? $user->goback : "",
"close" => $user->close != null ? $user->close : "",
"features" => [
"featuresTips" => $user->id == "uid-0"
]
],
],
];

View File

@ -83,6 +83,16 @@ class FormatManager():
)
return list(filtered)
def diagram_extensions(self) -> list[str]:
formats = self.diagrams()
mapped = map(lambda format: format.extension(), formats)
return list(mapped)
def diagrams(self) -> list[Format]:
formats = self.all()
filtered = filter(lambda format: format.type == 'diagram', formats)
return list(filtered)
def pdf_extensions(self) -> list[str]:
formats = self.pdfs()
mapped = map(lambda format: format.extension(), formats)

View File

@ -54,5 +54,7 @@ def getFileType(uri):
return 'cell'
if ext in format_manager.presentation_extensions():
return 'slide'
if ext in format_manager.diagram_extensions():
return 'diagram'
return 'word' # default file type is word

View File

@ -40,12 +40,12 @@ class User:
descr_user_1 = [
"File author by default",
"Doesnt belong to any group",
"Doesn't belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor",
"Can see the information about all users",
"This file isn't marked as favorite",
"Can create files from templates using data from the editor",
"Has an avatar",
"Can submit forms"
]
@ -55,49 +55,50 @@ descr_user_2 = [
"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",
"Cant submit forms"
"Can't submit forms"
]
descr_user_3 = [
"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",
"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",
"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",
"Can create new files from the editor",
"Can't close history",
"Can't restore the file version"
"Can't restore the file version",
"Can't submit forms"
]
descr_user_0 = [
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"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",
"Cant see anyones information",
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
"View file without collaboration",
"Cant submit forms",
"Can't refresh outdated file"
"Can't refresh outdated file",
"Can't submit forms",
"Tour of tips when opening a document"
]
USERS = [
User('uid-1', 'John Smith', 'smith@example.com',
'', None, {}, None,
None, [], descr_user_1, True, True, {'blank': False}, {'visible': False}),
False, [], descr_user_1, True, True, {'blank': False}, {'visible': False}),
User('uid-2', 'Mark Pottato', 'pottato@example.com',
'group-2', ['group-2', ''], {
'view': "",
@ -112,7 +113,7 @@ USERS = [
'edit': ["group-2"],
'remove': []
}, ['group-2'],
False, ["copy", "download", "print"], descr_user_3, False, False,
None, ["copy", "download", "print"], descr_user_3, False, False,
None, {}),
User('uid-0', None, None,
'', None, {}, [],

View File

@ -345,6 +345,9 @@ def edit(request):
# settings for the Open file location menu button and upper right corner button
'goback': user.goback if user.goback is not None else '',
'close': user.close if user.close is not None else '',
'features': {
'featuresTips': user.id == 'uid-0'
}
}
}
}

View File

@ -632,6 +632,11 @@ footer table tr td:first-child {
background-image: url("../images/icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("../images/icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

@ -0,0 +1,6 @@
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
</svg>

After

Width:  |  Height:  |  Size: 469 B

View File

@ -633,6 +633,11 @@ footer table tr td:first-child {
background-image: url("icon_pdf.svg");
}
.stored-edit.diagram,
.uploadFileName.diagram {
background-image: url("icon_vsdx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;

View File

@ -94,6 +94,18 @@ class FormatManager
end
end
sig { returns(T::Array[String]) }
def diagram_extensions
diagram.map(&:extension)
end
sig { returns(T::Array[Format]) }
def diagram
all.filter do |format|
format.type == 'diagram'
end
end
sig { returns(T::Array[String]) }
def pdf_extensions
pdf.map(&:extension)

View File

@ -201,7 +201,10 @@ class FileModel
forcesave: false, # adding the request for the forced file saving to the callback handler
submitForm: submit_form, # the Submit form button state
goback: @user.goback.nil? ? '' : @user.goback,
close: @user.close.nil? ? '' : @user.close
close: @user.close.nil? ? '' : @user.close,
features: {
featuresTips: @user.id.eql?('uid-0')
}
}
}
}

View File

@ -29,6 +29,7 @@ class FileUtility
def self.get_file_type(file_name)
ext = File.extname(file_name).downcase
return 'diagram' if FileUtility.format_manager.diagram_extensions.include?(ext)
return 'pdf' if FileUtility.format_manager.pdf_extensions.include?(ext)
return 'word' if FileUtility.format_manager.document_extensinons.include?(ext)
return 'cell' if FileUtility.format_manager.spreadsheet_extensinons.include?(ext)

View File

@ -70,12 +70,12 @@ end
class Users
@descr_user_first = [
'File author by default',
'Doesnt belong to any group',
'Doesn\'t belong to any group',
'Can review all the changes',
'Can perform all actions with comments',
'The file favorite state is undefined',
'Can create files from templates using data from the editor',
'Can see the information about all users',
'This file isn\'t marked as favorite',
'Can create files from templates using data from the editor',
'Has an avatar',
'Can submit forms'
]
@ -85,43 +85,44 @@ class Users
'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',
'Cant submit forms'
'Can\'t submit forms'
]
@descr_user_third = [
'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',
'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',
'Cant close history',
'Cant restore the file version'
'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',
'Can create new files from the editor',
'Can\'t close history',
'Can\'t restore the file version',
'Can\'t submit forms'
]
@descr_user_null = [
'The name is requested when the editor is opened',
'Doesnt belong to any group',
'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",
'Cant see anyones information',
"Can't rename files from the editor",
"Can't view chat",
"Can't protect file",
'View file without collaboration',
'Cant submit forms',
'Cant refresh outdated file'
'Can\'t refresh outdated file',
'Can\'t submit forms',
'Tour of tips when opening a document'
]
@users = [
@ -133,7 +134,7 @@ class Users
nil,
{},
nil,
nil,
false,
[],
@descr_user_first,
true,
@ -173,7 +174,7 @@ class Users
remove: []
},
['group-2'],
false,
nil,
['copy', 'download', 'print'],
@descr_user_third,
false,