Compare commits

..

52 Commits

Author SHA1 Message Date
8cc0580310 nodejs: fix comment collumn (146d26c868) 2024-06-14 11:03:58 +03:00
8c44f4a653 nodejs: switch back templates branch 2024-06-07 12:18:01 +03:00
d6309505ff 1.9.0 2024-06-07 09:43:21 +03:00
8207aec7a5 sr-Cyrl-RS skin language
# Conflicts:
#	CHANGELOG.md
2024-06-06 17:26:17 +03:00
a5fa0096e8 en-GB skin language
# Conflicts:
#	CHANGELOG.md
2024-06-06 17:25:51 +03:00
0c886264ba fix sr-Latn-RS
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/csharp-mvc/web.appsettings.config
#	web/documentserver-example/csharp/settings.config
#	web/documentserver-example/java-spring/src/main/resources/application.properties
#	web/documentserver-example/java/src/main/resources/settings.properties
2024-06-06 17:25:23 +03:00
871b08018f filling to changelog 2024-06-06 14:53:00 +03:00
4238de80cc nodejs: update pdf icon 2024-05-20 14:10:03 +03:00
146d26c868 nodejs: comment only is not for pdf 2024-05-20 13:56:06 +03:00
ecb520e4cb nodejs: submitting in embedded mode 2024-05-20 13:44:54 +03:00
26673ec668 docxf, oform as pdf documentType 2024-04-23 11:26:16 +03:00
fa303e9bf2 switching from filling to editing 2024-04-15 16:32:44 +03:00
c55142bd73 Merge remote-tracking branch 'remotes/origin/feature/create-pdf' into release/v8.1.0 2024-03-21 16:06:24 +03:00
6c03b145e2 nodejs: editing pdf form 2024-03-21 15:24:47 +03:00
15e09fece2 nodejs: filling by default if possible 2024-03-21 15:23:57 +03:00
abf382a03b nodejs: creating pdf form 2024-03-21 15:03:13 +03:00
1b8f60d5dd nodejs: update formats 2024-03-21 14:21:29 +03:00
0414319893 nodejs: fill permission in embedded mode 2024-03-21 14:05:31 +03:00
ad39fb7c19 nodejs: wopi formsubmit icon
# Conflicts:
#	CHANGELOG.md
2024-03-20 12:51:24 +03:00
495ba9814f nodejs: close editor
# Conflicts:
#	CHANGELOG.md
#	web/documentserver-example/nodejs/app.js
#	web/documentserver-example/nodejs/helpers/users.js
2024-03-18 14:35:26 +03:00
558365325c nodejs: format max length
# Conflicts:
#	web/documentserver-example/nodejs/helpers/users.js
2024-03-18 14:34:52 +03:00
333981cdad Merge pull request #549 from ONLYOFFICE/release/1.8.0
Release/1.8.0
2024-03-15 13:02:53 +03:00
65ff78fba7 Merge pull request #548 from ONLYOFFICE/fix/ruby-conversion-progress
fix(ruby): conversion percent type validation. Fix Bug 66869
2024-03-14 15:07:11 +03:00
717996af87 Merge pull request #547 from ONLYOFFICE/fix/ruby-historyobj
fix(ruby): historyobj method. Fix Bug 66862
2024-03-14 15:06:45 +03:00
66389fe69c fix(ruby): conversion percent type validation. Fix Bug 66869 2024-03-14 17:24:02 +07:00
a63d8d4284 fix(ruby): previous in history data 2024-03-14 16:30:22 +07:00
ed39928d1f Merge pull request #546 from ONLYOFFICE/fix/ruby-saveas-url-in-docker
fix(ruby): replacing file_url host in saveas. Fix Bug 66874
2024-03-14 11:13:50 +03:00
5bc7ffde73 fix(ruby): historyobj method. Fix Bug 66862 2024-03-13 18:27:58 +07:00
c6eff10be1 fix(ruby): replacing file_url host in saveas. Fix Bug 66874 2024-03-13 17:36:06 +07:00
8fdbdb926b Merge pull request #543 from ONLYOFFICE/fix/ruby-gem-conflict
fix(ruby): resolved gem conflict. Fix Bug 66514
2024-03-12 11:21:04 +03:00
0174d2a465 fix(ruby): resolved gem conflict. Fix Bug 66514 2024-03-11 18:08:26 +07:00
97b0cdd042 fix(ruby): nginx body size 2024-03-11 13:26:29 +03:00
143c0a095f fix(python): nginx body size 2024-03-11 13:25:05 +03:00
04c004acdb fix(php): nginx body size 2024-03-11 13:25:04 +03:00
0c8110d2aa Merge pull request #540 from ONLYOFFICE/fix/php-posExt-of-loaded-file
fix(php): ext of loaded file without dot. Fix Bug 66718
2024-03-05 09:51:06 +03:00
f9f8dada69 Merge pull request #539 from ONLYOFFICE/fix/php-user-in-open-source-request
fix(php): checking user in editor request. fix bug 66716
2024-03-05 09:50:33 +03:00
36535f89bb fix(php): ext of loaded file without dot. Fix Bug 66718 2024-03-05 13:46:14 +07:00
09031033aa fix(php): checking user in editor request. fix bug 66716 2024-03-05 13:30:34 +07:00
f657e5ab4a Merge pull request #537 from ONLYOFFICE/fix/csharp-mvc-document-formats-type
fix(csharp-mvc): empty strings tolerant json deserialization.
2024-03-04 15:12:50 +03:00
e42f7fd271 fix(csharp-mvc): empty strings tolerant json deserialization. Fix bug 66688 2024-03-04 13:53:31 +07:00
f9fa10e70a nodejs: fix when siteUrl is '/' (Fix Bug 66578) 2024-02-28 17:39:48 +03:00
47b07a5c8b Merge pull request #528 from ONLYOFFICE/fix/java-spring-document-formats-type
fix(java-spring): empty strings as null in json deserialization.
2024-02-27 15:02:14 +03:00
3e6bee4cc1 fix(java-spring): empty strings as null in json deserialization. fix bug 66552 2024-02-27 15:14:16 +07:00
2b1f7b0548 Merge pull request #527 from ONLYOFFICE/fix/java-document-formats-type
fix(java): empty strings as null in json dererialization. fix bug 66534
2024-02-27 08:57:14 +03:00
ba195952b2 Merge pull request #526 from ONLYOFFICE/fix/ruby-correct-server-url
Fix/ruby correct server url
2024-02-27 08:56:10 +03:00
4ac8d9ee16 fix(ruby): correct server url for images 2024-02-27 08:55:10 +03:00
c46292c595 fix(java): empty strings as null in json dererialization. fix bug 66534 2024-02-26 17:43:55 +07:00
b771b70ced Merge pull request #523 from ONLYOFFICE/fix/nodejs-editor-fileExt-vulnerability
fix(nodejs): editor fileExt validation. fix bug 66576
2024-02-26 12:37:56 +03:00
c91d765296 fix(nodejs): editor fileExt validation. fix bug 66576 2024-02-22 14:49:46 +07:00
9615f5a93a Merge pull request #522 from ONLYOFFICE/fix/php-reference-link
fix(php): fix bug 66518
2024-02-21 15:46:08 +03:00
a9f0068600 fix(php): fix bug 66518 2024-02-21 16:53:19 +07:00
2459863430 Merge pull request #468 from ONLYOFFICE/release/1.7.0
Release/1.7.0
2023-10-30 12:17:35 +03:00
90 changed files with 686 additions and 1438 deletions

2
.gitmodules vendored
View File

@ -5,7 +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/v8.0
branch = feature/v8.1
[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

View File

@ -1,11 +1,14 @@
# Change Log
- nodejs: tabs menu
- nodejs: delete all files
- change insert image
- nodejs: handling conversion -9 error
- different goback for users
- nodejs: converting function on index page
## 1.9.0
- nodejs: filling by default
- nodejs: docxf, oform as pdf documentType
- nodejs: creating and editing pdf instead docxf
- nodejs: wopi formsubmit icon
- nodejs: close editor
- en-GB, sr-Cyrl-RS skin languages
- switching from filling to editing
- fill permission in embedded mode
## 1.8.0
- nodejs: pdf, djvu, xps, oxps as pdf documentType

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -59,9 +59,7 @@ namespace OnlineEditorsExampleMVC.Helpers
"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"
"Cant submit forms"
};
static List<string> descr_user_0 = new List<string>()
@ -94,8 +92,7 @@ namespace OnlineEditorsExampleMVC.Helpers
new List<string>(),
descr_user_1,
true,
true,
new Goback()
true
),
new User(
"uid-2",
@ -114,8 +111,7 @@ namespace OnlineEditorsExampleMVC.Helpers
new List<string>(),
descr_user_2,
false,
true,
new Goback("Go to Documents", null)
true
),
new User(
"uid-3",
@ -134,8 +130,7 @@ namespace OnlineEditorsExampleMVC.Helpers
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,
false,
new Goback(null,false)
false
),
new User(
"uid-0",
@ -149,8 +144,7 @@ namespace OnlineEditorsExampleMVC.Helpers
new List<string>() { "protect" },
descr_user_0,
false,
false,
null
false
)
};
@ -241,9 +235,7 @@ namespace OnlineEditorsExampleMVC.Helpers
public List<string> userInfoGroups;
public bool avatar;
public Goback goback;
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback)
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar)
{
this.id = id;
this.name = name;
@ -257,21 +249,6 @@ namespace OnlineEditorsExampleMVC.Helpers
this.templates = templates;
this.userInfoGroups = userInfoGroups;
this.avatar = avatar;
this.goback = goback;
}
}
public class Goback
{
public string text;
public bool? blank;
public Goback(){}
public Goback(string text, bool? blank)
{
this.text = text;
this.blank = blank;
}
}
}

View File

@ -157,7 +157,7 @@ namespace OnlineEditorsExampleMVC.Models
{ "download", !user.deniedPermissions.Contains("download") },
{ "edit", canEdit && (editorsMode == "edit" || editorsMode == "view" || editorsMode == "filter" || editorsMode == "blockcontent") },
{ "print", !user.deniedPermissions.Contains("print") },
{ "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "embedded" && editorsMode != "blockcontent" },
{ "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "blockcontent" },
{ "modifyFilter", editorsMode != "filter" },
{ "modifyContentControl", editorsMode != "blockcontent" },
{ "review", canEdit && (editorsMode == "edit" || editorsMode == "review") },
@ -214,12 +214,10 @@ namespace OnlineEditorsExampleMVC.Models
{ "forcesave", false }, // adds the request for the forced file saving to the callback handler
{ "submitForm", submitForm }, // if the Submit form button is displayed or not
{
"goback", user.goback != null ? new Dictionary<string, object> // settings for the Open file location menu button and upper right corner button
"goback", new Dictionary<string, object> // settings for the Open file location menu button and upper right corner button
{
{ "url", DocManagerHelper.GetServerUrl(false) }, // the absolute URL to the website address which will be opened when clicking the Open file location menu button
{ "text", user.goback.text },
{ "blank", user.goback.blank }
} : new Dictionary<string, object>{}
{ "url", DocManagerHelper.GetServerUrl(false) } // the absolute URL to the website address which will be opened when clicking the Open file location menu button
}
}
}
}
@ -291,20 +289,20 @@ namespace OnlineEditorsExampleMVC.Models
{
Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "Content\\images\\logo.svg"
+ "Content\\images\\logo.png"
};
var directMailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(false))
{
Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "Content\\images\\logo.svg"
+ "Content\\images\\logo.png"
};
// create a logo config
var logoConfig = new Dictionary<string, object>
{
{ "fileType", "svg"},
{ "fileType", "png"},
{ "url", mailMergeUrl.ToString()}
};

View File

@ -23,6 +23,7 @@ using System.IO;
using static OnlineEditorsExampleMVC.Models.FileUtility;
using System.Linq;
using System.Text;
using Newtonsoft.Json.Converters;
namespace OnlineEditorsExampleMVC.Models
{
@ -48,9 +49,21 @@ namespace OnlineEditorsExampleMVC.Models
}
}
public class EmptyTolerantStringEnumConverter : StringEnumConverter
{
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
if (reader.TokenType == JsonToken.String && string.IsNullOrWhiteSpace(reader.Value.ToString()))
return Activator.CreateInstance(objectType);
return base.ReadJson(reader, objectType, existingValue, serializer);
}
}
public class Format
{
public string Name { get; }
[JsonConverter(typeof(EmptyTolerantStringEnumConverter))]
public FileType Type { get; }
public List<string> Actions { get; }
public List<string> Convert { get; }

View File

@ -145,6 +145,7 @@
<Content Include="Content\images\icon_xlsx.svg" />
<Content Include="Content\images\info.svg" />
<Content Include="Content\images\loader16.gif" />
<Content Include="Content\images\logo.png" />
<Content Include="Content\images\logo.svg" />
<Content Include="Content\images\mobile-fill-forms.svg" />
<Content Include="Content\images\mobile.svg" />

View File

@ -68,7 +68,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("editorsMode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("editorsMode=\\w+\&?", "i"), "") + "&editorsMode=edit";
};
// an error or some other specific event occurs
@ -259,48 +259,6 @@
}
}
<% string usersForMentions; %>
<% Model.GetUsersMentions(Request, out usersForMentions); %>
<% string usersInfo; %>
<% Model.GetUsersInfo(Request, out usersInfo); %>
<% string usersForProtect; %>
<% Model.GetUsersProtect(Request, out usersForProtect); %>
var onRequestUsers = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%= usersInfo %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%= usersForProtect %>;
break;
default:
users = <%= usersForMentions %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
config = <%= Model.GetDocConfig(Request, Url) %>;
config.width = "100%";
@ -318,27 +276,63 @@
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet,
};
<% string usersForMentions; %>
<% Model.GetUsersMentions(Request, out usersForMentions); %>
<% string usersInfo; %>
<% Model.GetUsersInfo(Request, out usersInfo); %>
<% string usersForProtect; %>
<% Model.GetUsersProtect(Request, out usersForProtect); %>
if (config.editorConfig.user.id) {
// the user is trying to show the document version history
config.events['onRequestHistory'] = onRequestHistory;
// the user is trying to click the specific document version in the document version history
config.events['onRequestHistoryData'] = onRequestHistoryData;
// the user is trying to go back to the document from viewing the document version history
if (config.editorConfig.user.id !== "uid-3") {
config.events['onRequestHistoryClose'] = function () {
document.location.reload();
};
config.events['onRequestRestore'] = onRequestRestore;
}
config.events['onRequestHistoryClose'] = function () {
document.location.reload();
};
config.events['onRequestRestore'] = onRequestRestore;
// add mentions for not anonymous users
<% if (!string.IsNullOrEmpty(usersForMentions))
{ %>
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%= usersInfo %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%= usersForProtect %>;
break;
default:
users = <%= usersForMentions %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
<% } %>
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<appSettings>
<clear />
<add key="version" value="1.8.0"/>
<add key="version" value="1.9.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>
@ -15,7 +15,7 @@
<add key="files.docservice.verify-peer-off" value="true"/>
<add key="files.docservice.languages" value="en:English|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|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|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-Latn-RS:Serbian|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA: Test Language"/>
<add key="files.docservice.languages" value="en:English|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|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|vi:Vietnamese|aa-AA:Test Language"/>
<add key="files.docservice.url.site" value="http://documentserver/"/>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -86,7 +86,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("editorsMode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("editorsMode=\\w+\&?", "i"), "") + "&editorsMode=edit";
};
// an error or some other specific event occurs
@ -233,41 +233,6 @@
}
};
var onRequestUsers = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%= UsersInfo %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%= UsersForProtect %>;
break;
default:
users = <%= UsersForMentions %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
config = <%= DocConfig %>;
config.width = "100%";
@ -310,36 +275,65 @@
docEditor.setHistoryData(JSON.parse(xhr.responseText)); // send the link to the document for viewing the version history
}
};
if (config.editorConfig.user.id !== "uid-3") {
config.events['onRequestHistoryClose'] = function () { // the user is trying to go back to the document from viewing the document version history
document.location.reload();
config.events['onRequestHistoryClose'] = function () { // the user is trying to go back to the document from viewing the document version history
document.location.reload();
};
config.events['onRequestRestore'] = function (event) {
var fileName = "<%= FileName %>";
var version = event.data.version;
var data = {
fileName: fileName,
version: version
};
config.events['onRequestRestore'] = function (event) {
var fileName = "<%= FileName %>";
var version = event.data.version;
var data = {
fileName: fileName,
version: version
};
let xhr = new XMLHttpRequest();
xhr.open("POST", "webeditor.ashx?type=restore&directUrl=" + !!config.document.directUrl);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(data));
xhr.onload = function () {
docEditor.refreshHistory(JSON.parse(xhr.responseText));
}
};
}
let xhr = new XMLHttpRequest();
xhr.open("POST", "webeditor.ashx?type=restore&directUrl=" + !!config.document.directUrl);
xhr.setRequestHeader('Content-Type', 'application/json');
xhr.send(JSON.stringify(data));
xhr.onload = function () {
docEditor.refreshHistory(JSON.parse(xhr.responseText));
}
};
// add mentions for not anonymous users
<% if (!string.IsNullOrEmpty(UsersForMentions))
{ %>
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%= UsersInfo %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%= UsersForProtect %>;
break;
default:
users = <%= UsersForMentions %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
<% } %>
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;

View File

@ -225,7 +225,7 @@ namespace OnlineEditorsExample
{ "download", !user.deniedPermissions.Contains("download") },
{ "edit", canEdit && (editorsMode == "edit" || editorsMode =="view" || editorsMode == "filter" || editorsMode == "blockcontent") },
{ "print", !user.deniedPermissions.Contains("print") },
{ "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "embedded" && editorsMode != "blockcontent" },
{ "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "blockcontent" },
{ "modifyFilter", editorsMode != "filter" },
{ "modifyContentControl", editorsMode != "blockcontent" },
{ "review", canEdit && (editorsMode == "edit" || editorsMode == "review") },
@ -282,12 +282,10 @@ namespace OnlineEditorsExample
{ "forcesave", false }, // adds the request for the forced file saving to the callback handler
{ "submitForm", submitForm }, // if the Submit form button is displayed or not
{
"goback", user.goback != null ? new Dictionary<string, object> // settings for the Open file location menu button and upper right corner button
"goback", new Dictionary<string, object> // settings for the Open file location menu button and upper right corner button
{
{ "url", _Default.GetServerUrl(false) + "default.aspx" }, // the absolute URL to the website address which will be opened when clicking the Open file location menu button
{ "text", user.goback.text },
{ "blank", user.goback.blank }
} : new Dictionary<string, object>{}
{ "url", _Default.GetServerUrl(false) + "default.aspx" } // the absolute URL to the website address which will be opened when clicking the Open file location menu button
}
}
}
}
@ -340,17 +338,17 @@ namespace OnlineEditorsExample
var InsertImageUrl = new UriBuilder(_Default.GetServerUrl(true));
InsertImageUrl.Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "App_Themes\\images\\logo.svg";
+ "App_Themes\\images\\logo.png";
var DirectImageUrl = new UriBuilder(_Default.GetServerUrl(false));
DirectImageUrl.Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "App_Themes\\images\\logo.svg";
+ "App_Themes\\images\\logo.png";
// create a logo config
Dictionary<string, object> logoConfig = new Dictionary<string, object>
{
{ "fileType", "svg"},
{ "fileType", "png"},
{ "url", InsertImageUrl.ToString()}
};

View File

@ -145,6 +145,7 @@
</ItemGroup>
<ItemGroup>
<Content Include="App_Themes\images\loader16.gif" />
<Content Include="App_Themes\images\logo.png" />
<Content Include="App_Themes\jquery-ui.css" />
<Content Include="App_Themes\stylesheet.css" />
<Content Include="DocEditor.aspx" />

View File

@ -58,9 +58,7 @@ namespace OnlineEditorsExample
"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"
"Cant submit forms"
};
static List<string> descr_user_0 = new List<string>()
@ -93,8 +91,7 @@ namespace OnlineEditorsExample
new List<string>(),
descr_user_1,
true,
true,
new Goback()
true
),
new User(
"uid-2",
@ -113,8 +110,7 @@ namespace OnlineEditorsExample
new List<string>(),
descr_user_2,
false,
true,
new Goback("Go to Documents",null)
true
),
new User(
"uid-3",
@ -133,8 +129,7 @@ namespace OnlineEditorsExample
new List<string>() { "copy", "download", "print" },
descr_user_3,
false,
false,
new Goback(null,false)
false
),
new User(
"uid-0",
@ -148,8 +143,7 @@ namespace OnlineEditorsExample
new List<string>() { "protect" },
descr_user_0,
false,
false,
null
false
)
};
@ -241,9 +235,8 @@ namespace OnlineEditorsExample
public bool templates;
public List<string> userInfoGroups;
public bool avatar;
public Goback goback;
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar, Goback goback)
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, List<string> userInfoGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates, bool avatar)
{
this.id = id;
this.name = name;
@ -257,21 +250,6 @@ namespace OnlineEditorsExample
this.templates = templates;
this.userInfoGroups = userInfoGroups;
this.avatar = avatar;
this.goback = goback;
}
}
public class Goback
{
public string text;
public bool? blank;
public Goback(){}
public Goback(string text, bool? blank)
{
this.text = text;
this.blank = blank;
}
}
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<clear />
<add key="version" value="1.8.0"/>
<add key="version" value="1.9.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>
@ -14,7 +14,7 @@
<add key="files.docservice.token.useforrequest" value="true" />
<add key="files.docservice.languages" value="en:English|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|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|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-Latn-RS:Serbian|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA: Test Language"/>
<add key="files.docservice.languages" value="en:English|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|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|vi:Vietnamese|aa-AA: Test Language"/>
<add key="files.docservice.url.site" value="http://documentserver/"/>

View File

@ -19,7 +19,6 @@
package com.onlyoffice.integration;
import com.onlyoffice.integration.documentserver.serializers.FilterState;
import com.onlyoffice.integration.entities.Goback;
import com.onlyoffice.integration.services.UserServices;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -93,32 +92,30 @@ public class ExampleData {
"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"
"Cant 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, new Goback());
List.of(FilterState.NULL.toString()), null, true, true, true);
// create user 2 with the specified parameters
userService.createUser("Mark Pottato", "pottato@example.com", descriptionUserSecond,
"group-2", List.of("", "group-2"), List.of(FilterState.NULL.toString()),
List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true, true,
true, true, new Goback("Go to Documents", null));
true, true);
// 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 Goback(null, false));
new ArrayList<>(), List.of("group-2"), false, true, true, false);
// create user 0 with the specified parameters
userService.createUser("Anonymous", null, descriptionUserZero, "",
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
new ArrayList<>(), null, false, false, false, null);
new ArrayList<>(), null, false, false, false);
}
}

View File

@ -212,11 +212,11 @@ public class EditorController {
@SneakyThrows
private String getInsertImage(final Boolean directUrl) { // get an image that will be inserted into the document
Map<String, Object> dataInsertImage = new HashMap<>();
dataInsertImage.put("fileType", "svg");
dataInsertImage.put("url", storagePathBuilder.getServerUrl(true) + "/css/img/logo.svg");
dataInsertImage.put("fileType", "png");
dataInsertImage.put("url", storagePathBuilder.getServerUrl(true) + "/css/img/logo.png");
if (directUrl) {
dataInsertImage.put("directUrl", storagePathBuilder
.getServerUrl(false) + "/css/img/logo.svg");
.getServerUrl(false) + "/css/img/logo.png");
}
// check if the document token is enabled

View File

@ -20,7 +20,6 @@ package com.onlyoffice.integration.documentserver.models.configurations;
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
import lombok.Getter;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
@ -39,18 +38,9 @@ public class Goback { // the settings for the Open file location menu button an
private String indexMapping;
@Getter
@Setter
private String url; /* the absolute URL to the website address which will be opened
when clicking the Open file location menu button */
@Getter
@Setter
private String text;
@Getter
@Setter
private Boolean blank;
@PostConstruct
private void init() {
this.url = storagePathBuilder.getServerUrl(false) + indexMapping;

View File

@ -19,6 +19,7 @@
package com.onlyoffice.integration.documentserver.util.service;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.onlyoffice.integration.documentserver.models.Format;
@ -41,6 +42,7 @@ public class DefaultFormatService implements FormatService {
final ObjectMapper objectMapper
) {
try {
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
File targetFile = resourceFile.getFile();
this.formats = objectMapper.readValue(targetFile, new TypeReference<List<Format>>() { });
} catch (Exception e) {

View File

@ -1,38 +0,0 @@
/**
*
* (c) Copyright Ascensio System SIA 2024
*
* 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.
*
*/
package com.onlyoffice.integration.entities;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import javax.persistence.Entity;
import javax.persistence.Table;
@Entity
@Table(name = "`goback`")
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class Goback extends AbstractEntity {
private String text;
private Boolean blank;
}

View File

@ -47,5 +47,4 @@ public class User extends AbstractEntity {
private List<String> descriptions;
private Boolean avatar;
private String image;
private Goback goback;
}

View File

@ -18,7 +18,6 @@
package com.onlyoffice.integration.services;
import com.onlyoffice.integration.entities.Goback;
import com.onlyoffice.integration.entities.Group;
import com.onlyoffice.integration.entities.Permission;
import com.onlyoffice.integration.entities.User;
@ -60,8 +59,7 @@ public class UserServices {
final List<String> userInfoGroups, final Boolean favoriteDoc,
final Boolean chat,
final Boolean protect,
final Boolean avatar,
final Goback goback) {
final Boolean avatar) {
User newUser = new User();
newUser.setName(name); // set the user name
newUser.setEmail(email); // set the user email
@ -90,8 +88,6 @@ public class UserServices {
protect); // specify permissions for the current user
newUser.setPermissions(permission);
newUser.setGoback(goback);
userRepository.save(newUser); // save a new user
return newUser;

View File

@ -34,11 +34,5 @@ public class DefaultCustomizationConfigurer implements CustomizationConfigurer<D
public void configure(final Customization customization, final DefaultCustomizationWrapper wrapper) {
Action action = wrapper.getAction(); // get the action parameter from the customization wrapper
User user = wrapper.getUser();
if (user != null && user.getGoback() != null) {
customization.getGoback().setText(user.getGoback().getText());
customization.getGoback().setBlank(user.getGoback().getBlank());
} else {
customization.getGoback().setUrl("");
}
}
}

View File

@ -120,7 +120,6 @@ public class DefaultFileConfigurer implements FileConfigurer<DefaultFileWrapper>
userPermissions.setFillForms(
!action.equals(Action.view)
&& !action.equals(Action.comment)
&& !action.equals(Action.embedded)
&& !action.equals(Action.blockcontent)
);

View File

@ -1,4 +1,4 @@
server.version=1.8.0
server.version=1.9.0
server.address=
server.port=4000
@ -25,7 +25,7 @@ files.docservice.token-use-for-request=true
files.docservice.verify-peer-off=true
files.docservice.languages=en:English|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|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|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-Latn-RS:Serbian|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA:Test Language
files.docservice.languages=en:English|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|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|vi:Vietnamese|aa-AA:Test Language
spring.datasource.url=jdbc:h2:mem:usersdb
spring.datasource.driverClassName=org.h2.Driver

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -52,7 +52,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("\&?action=view", "i"), "");
location.href = location.href.replace(RegExp("\&?action=\\w+", "i"), "") + "&action=edit";
};
// an error or some other specific event occurs
@ -262,44 +262,7 @@
innerAlert(response.error);
}
}
};
var onRequestUsers = function (event) {
if (event && event.data) {
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = [[${usersInfo}]];
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = [[${usersForProtect}]];
break;
default:
users = [[${usersForMentions}]];
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
}
config.width = "100%";
config.height = "100%";
@ -312,26 +275,59 @@
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestSelectDocument": onRequestSelectDocument,
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet,
"onRequestRestore": onRequestRestore,
"onRequestHistory": onRequestHistory,
"onRequestHistoryData": onRequestHistoryData,
"onRequestHistoryClose": onRequestHistoryClose
};
var usersForMentions = [[${usersForMentions}]];
var usersInfo = [[${usersInfo}]];
var usersForProtect = [[${usersForProtect}]];
if (config.editorConfig.user.id != 4) {
// add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = usersInfo;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = usersForProtect;
break;
default:
users = usersForMentions;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestOpen'] = onRequestOpen;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;
if (config.editorConfig.user.id != 3) {
config.events['onRequestHistoryClose'] = onRequestHistoryClose;
config.events['onRequestRestore'] = onRequestRestore;
}
}
if (config.editorConfig.createUrl) {

View File

@ -78,10 +78,10 @@ public class EditorServlet extends HttpServlet {
// an image that will be inserted into the document
Map<String, Object> dataInsertImage = new HashMap<>();
dataInsertImage.put("fileType", "svg");
dataInsertImage.put("url", DocumentManager.getServerUrl(true) + "/css/img/logo.svg");
dataInsertImage.put("fileType", "png");
dataInsertImage.put("url", DocumentManager.getServerUrl(true) + "/css/img/logo.png");
if (isEnableDirectUrl) {
dataInsertImage.put("directUrl", DocumentManager.getServerUrl(false) + "/css/img/logo.svg");
dataInsertImage.put("directUrl", DocumentManager.getServerUrl(false) + "/css/img/logo.png");
}
// a document that will be compared with the current document

View File

@ -114,15 +114,9 @@ public class FileModel {
editorConfig.getUser().setImage(user.getAvatar() ? DocumentManager.getServerUrl(false)
+ "/css/img/" + user.getId() + ".png" : null);
if (user.getGoback() != null) {
// write the absolute URL to the file location
editorConfig.getCustomization().getGoback()
// write the absolute URL to the file location
editorConfig.getCustomization().getGoback()
.setUrl(DocumentManager.getServerUrl(false) + "/IndexServlet");
editorConfig.getCustomization().getGoback()
.setText(user.getGoback().getText());
editorConfig.getCustomization().getGoback()
.setBlank(user.getGoback().getBlank());
}
changeType(mode, type, user, fileName);
}
@ -297,7 +291,7 @@ public class FileModel {
edit = canEdit && (modeParam.equals("edit") || modeParam.equals("view") || modeParam.equals("filter")
|| modeParam.equals("blockcontent"));
print = !user.getDeniedPermissions().contains("print");
fillForms = !modeParam.equals("view") && !modeParam.equals("comment") && !modeParam.equals("embedded")
fillForms = !modeParam.equals("view") && !modeParam.equals("comment")
&& !modeParam.equals("blockcontent");
modifyFilter = !modeParam.equals("filter");
modifyContentControl = !modeParam.equals("blockcontent");
@ -607,8 +601,6 @@ public class FileModel {
public class Goback {
private String url;
private String text;
private Boolean blank;
public String getUrl() {
return url;
@ -617,22 +609,6 @@ public class FileModel {
public void setUrl(final String urlParam) {
this.url = urlParam;
}
public String getText() {
return text;
}
public void setText(final String textParam) {
this.text = textParam;
}
public Boolean getBlank() {
return blank;
}
public void setBlank(final Boolean blankParam) {
this.blank = blankParam;
}
}
}

View File

@ -1,39 +0,0 @@
/**
*
* (c) Copyright Ascensio System SIA 2024
*
* 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.
*
*/
package entities;
public class Goback {
private String text;
private Boolean blank;
public Goback() { }
public Goback(final String textParam, final Boolean blankParam) {
this.text = textParam;
this.blank = blankParam;
}
public String getText() {
return text;
}
public Boolean getBlank() {
return blank;
}
}

View File

@ -33,13 +33,12 @@ public class User {
private final Boolean templates;
private final List<String> userInfoGroups;
private final Boolean avatar;
private final Goback goback;
public User(final String idParam, final String nameParam, final String emailParam, final String groupParam,
final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam,
final List<String> userInfoGroupsParam, final Boolean favoriteParam,
final List<String> deniedPermissionsParam, final List<String> descriptionsParam,
final Boolean templatesParam, final Boolean avatarParam, final Goback gobackParam) {
final Boolean templatesParam, final Boolean avatarParam) {
this.id = idParam;
this.name = nameParam;
this.email = emailParam;
@ -52,7 +51,6 @@ public class User {
this.templates = templatesParam;
this.userInfoGroups = userInfoGroupsParam;
this.avatar = avatarParam;
this.goback = gobackParam;
}
public String getId() {
@ -102,8 +100,4 @@ public class User {
public Boolean getAvatar() {
return avatar;
}
public Goback getGoback() {
return goback;
}
}

View File

@ -29,6 +29,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
public final class FormatManager {
@ -93,6 +94,7 @@ public final class FormatManager {
private List<Format> all() {
try {
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.configure(DeserializationFeature.ACCEPT_EMPTY_STRING_AS_NULL_OBJECT, true);
Path path = this.file();
return objectMapper.readValue(Files.readAllBytes(path), new TypeReference<List<Format>>() { });
} catch (Exception e) {

View File

@ -19,7 +19,6 @@
package helpers;
import entities.CommentGroups;
import entities.Goback;
import entities.User;
import java.util.ArrayList;
@ -65,8 +64,6 @@ public final class Users {
add("Can create new files from the editor");
add("Can see the information about Group2 users");
add("Cant submit forms");
add("Can't close history");
add("Can't restore the file version");
}};
private static List<String> descriptionUserZero = new ArrayList<String>() {{
@ -88,20 +85,19 @@ public final class Users {
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, new ArrayList<String>(), descriptionUserFirst, true, true));
add(new User("uid-2", "Mark Pottato", "pottato@example.com",
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""),
true, new ArrayList<String>(), descriptionUserSecond, false, true,
new Goback("Go to Documents", null)));
true, new ArrayList<String>(), descriptionUserSecond, false, true));
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"),
descriptionUserThird, false, false, new Goback(null, false)));
descriptionUserThird, false, false));
add(new User("uid-0", null, null,
"", null, null, null,
null, Arrays.asList("protect"), descriptionUserZero, false, false, null));
null, Arrays.asList("protect"), descriptionUserZero, false, false));
}};
private Users() { }

View File

@ -1,4 +1,4 @@
version=1.8.0
version=1.9.0
filesize-max=5242880
storage-folder=app_data
@ -13,7 +13,7 @@ files.docservice.url.api=web-apps/apps/api/documents/api.js
files.docservice.url.preloader=web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.example=
files.docservice.languages=en:English|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|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|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-Latn-RS:Serbian|si:Sinhala (Sri Lanka)|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA:Test Language
files.docservice.languages=en:English|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|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|vi:Vietnamese|aa-AA:Test Language
files.docservice.secret=
files.docservice.header=Authorization

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -58,7 +58,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("mode=\\w+\&?", "i"), "") + "&mode=edit";
};
// an error or some other specific event occurs
@ -262,43 +262,6 @@
document.location.reload();
};
var onRequestUsers = function (event) {
if (event && event.data) {
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%=(String) request.getAttribute("usersInfo")%>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%=(String) request.getAttribute("usersForProtect")%>;
break;
default:
users = <%=(String) request.getAttribute("usersForMentions")%>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
config = JSON.parse('<%= FileModel.serialize(Model) %>');
config.width = "100%";
config.height = "100%";
@ -311,26 +274,61 @@
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestSelectDocument": onRequestSelectDocument,
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet,
"onRequestRestore": onRequestRestore,
"onRequestHistory": onRequestHistory,
"onRequestHistoryData": onRequestHistoryData,
"onRequestHistoryClose": onRequestHistoryClose
};
<%
String usersForMentions = (String) request.getAttribute("usersForMentions");
String usersInfo = (String) request.getAttribute("usersInfo");
String usersForProtect = (String) request.getAttribute("usersForProtect");
%>
if (config.editorConfig.user.id) {
// add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%=usersInfo%>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%=usersForProtect%>;
break;
default:
users = <%=usersForMentions%>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestOpen'] = onRequestOpen;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;
if (config.editorConfig.user.id != "uid-3") {
config.events['onRequestHistoryClose'] = onRequestHistoryClose;
config.events['onRequestRestore'] = onRequestRestore;
}
}
if (config.editorConfig.createUrl) {

View File

@ -269,14 +269,19 @@ app.post('/create', (req, res) => {
const fileUrl = req.body.url;
try {
if (urlModule.parse(fileUrl).host !== urlModule.parse(siteUrl).host) {
req.DocManager = new DocManager(req, res);
let host = siteUrl;
if (host.indexOf('/') === 0) {
host = req.DocManager.getServerHost();
}
if (urlModule.parse(fileUrl).host !== urlModule.parse(host).host) {
res.writeHead(200, { 'Content-Type': 'application/json' });
res.write(JSON.stringify({ error: 'File domain is incorrect' }));
res.end();
return;
}
req.DocManager = new DocManager(req, res);
req.DocManager.storagePath(''); // mkdir if not exist
const fileName = req.DocManager.getCorrectName(title);
@ -328,8 +333,6 @@ app.post('/convert', (req, res) => { // define a handler for converting files
const fileUri = req.DocManager.getDownloadUrl(fileName, true);
const fileExt = fileUtility.getFileExtension(fileName, true);
const internalFileExt = 'ooxml';
let convExt = req.body.fileExt ? req.body.fileExt : internalFileExt;
if (req.body.forceConv) convExt = req.body.forceConv;
const response = res;
const writeResult = function writeResult(filename, step, error) {
@ -377,50 +380,38 @@ app.post('/convert', (req, res) => { // define a handler for converting files
if (status !== 200) throw new Error(`Conversion service returned status: ${status}`);
// write a file with a new extension, but with the content from the origin file
if (fileUtility.getFileType(correctName) !== null) {
fileSystem.writeFileSync(req.DocManager.storagePath(correctName), data);
} else {
writeResult(newFileUri, result, 'FileTypeIsNotSupported');
return;
}
// remove file with the origin extension
if (!('fileExt' in req.body)) fileSystem.unlinkSync(req.DocManager.storagePath(fileName));
fileSystem.writeFileSync(req.DocManager.storagePath(correctName), data);
fileSystem.unlinkSync(req.DocManager.storagePath(fileName)); // remove file with the origin extension
const userAddress = req.DocManager.curUserHostAddress();
const historyPath = req.DocManager.historyPath(fileName, userAddress, true);
// get the history path to the file with a new extension
const correctHistoryPath = req.DocManager.historyPath(correctName, userAddress, true);
if (!('fileExt' in req.body)) {
fileSystem.renameSync(historyPath, correctHistoryPath); // change the previous history path
fileSystem.renameSync(historyPath, correctHistoryPath); // change the previous history path
fileSystem.renameSync(
path.join(correctHistoryPath, `${fileName}.txt`),
path.join(correctHistoryPath, `${correctName}.txt`),
); // change the name of the .txt file with document information
} else if (newFileType !== null) {
const user = users.getUser(req.query.userid);
req.DocManager.saveFileData(correctName, user.id, user.name);
}
fileSystem.renameSync(
path.join(correctHistoryPath, `${fileName}.txt`),
path.join(correctHistoryPath, `${correctName}.txt`),
); // change the name of the .txt file with document information
writeResult(correctName, result, null); // write a file with a new name to the result object
} catch (e) {
if (!e.message.includes('-9')) console.log(e); // display error message in the console
console.log(e); // display error message in the console
writeResult(null, null, e.message);
}
};
try {
// check if the file with such an extension can be converted
if ((fileUtility.getConvertExtensions().indexOf(fileExt) !== -1) || ('fileExt' in req.body)) {
if (fileUtility.getConvertExtensions().indexOf(fileExt) !== -1) {
const storagePath = req.DocManager.storagePath(fileName);
const stat = fileSystem.statSync(storagePath);
let key = fileUri + stat.mtime.getTime();
key = documentService.generateRevisionId(key); // get document key
// get the url to the converted file
documentService.getConvertedUri(fileUri, fileExt, convExt, key, true, callback, filePass, lang);
documentService.getConvertedUri(fileUri, fileExt, internalFileExt, key, true, callback, filePass, lang);
} else {
// if the file with such an extension can't be converted, write the origin file to the result object
writeResult(fileName, null, null);
@ -929,26 +920,15 @@ app.get('/editor', (req, res) => { // define a handler for editing document
try {
req.DocManager = new DocManager(req, res);
const fileName = fileUtility.getFileName(req.query.fileName);
let { fileExt } = req.query;
const lang = req.DocManager.getLang();
const user = users.getUser(req.query.userid);
const userDirectUrl = req.query.directUrl === 'true';
const userid = user.id;
const { name } = user;
if (fileExt) {
// create demo document of a given extension
const fName = req.DocManager.createDemo(!!req.query.sample, fileExt, userid, name, false);
// get the redirect path
const redirectPath = `${req.DocManager.getServerUrl()}/editor?fileName=`
+ `${encodeURIComponent(fName)}${req.DocManager.getCustomParams()}`;
res.redirect(redirectPath);
return;
}
const fileName = fileUtility.getFileName(req.query.fileName);
const lang = req.DocManager.getLang();
const userDirectUrl = req.query.directUrl === 'true';
let actionData = 'null';
if (req.query.action) {
try {
@ -998,6 +978,17 @@ app.get('/editor', (req, res) => { // define a handler for editing document
}, usersInfo);
}
if (fileExt) {
fileExt = fileUtility.getFileExtension(fileUtility.getFileName(fileExt), true);
// create demo document of a given extension
const fName = req.DocManager.createDemo(!!req.query.sample, fileExt, userid, name, false);
// get the redirect path
const redirectPath = `${req.DocManager.getServerUrl()}/editor?mode=edit&fileName=`
+ `${encodeURIComponent(fName)}${req.DocManager.getCustomParams()}`;
res.redirect(redirectPath);
return;
}
fileExt = fileUtility.getFileExtension(fileName);
const userAddress = req.DocManager.curUserHostAddress();
@ -1008,11 +999,13 @@ app.get('/editor', (req, res) => { // define a handler for editing document
const key = req.DocManager.getKey(fileName);
const url = req.DocManager.getDownloadUrl(fileName, true);
const directUrl = req.DocManager.getDownloadUrl(fileName);
let mode = req.query.mode || 'edit'; // mode: view/edit/review/comment/fillForms/embedded
let canFill = fileUtility.getFillExtensions().indexOf(fileExt.slice(1)) !== -1 // check if this file can be filled
let mode = req.query.mode || (canFill ? 'fillForms' : 'edit'); // mode: view/edit/review/comment/fillForms/embedded
let canEdit = fileUtility.getEditExtensions().indexOf(fileExt.slice(1)) !== -1; // check if this file can be edited
if (((!canEdit && mode === 'edit') || mode === 'fillForms')
&& fileUtility.getFillExtensions().indexOf(fileExt.slice(1)) !== -1) {
&& canFill) {
mode = 'fillForms';
canEdit = true;
}
@ -1021,14 +1014,10 @@ app.get('/editor', (req, res) => { // define a handler for editing document
}
let submitForm = false;
if (mode === 'fillForms') {
if (mode === 'fillForms' || mode === "embedded") {
submitForm = userid === 'uid-1';
}
if (user.goback != null) {
user.goback.url = `${req.DocManager.getServerUrl()}`;
}
// file config data
const argss = {
apiUrl: siteUrl + configServer.get('apiUrl'),
@ -1054,7 +1043,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
chat: userid !== 'uid-0',
coEditing: mode === 'view' && userid === 'uid-0' ? { mode: 'strict', change: false } : null,
comment: mode !== 'view' && mode !== 'fillForms' && mode !== 'embedded' && mode !== 'blockcontent',
fillForms: mode !== 'view' && mode !== 'comment' && mode !== 'embedded' && mode !== 'blockcontent',
fillForms: mode !== 'view' && mode !== 'comment' && mode !== 'blockcontent',
modifyFilter: mode !== 'filter',
modifyContentControl: mode !== 'blockcontent',
copy: !user.deniedPermissions.includes('copy'),
@ -1062,6 +1051,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
print: !user.deniedPermissions.includes('print'),
mode: mode !== 'view' ? 'edit' : 'view',
canBackToFolder: type !== 'embedded',
backUrl: `${req.DocManager.getServerUrl()}/`,
curUserHostAddress: req.DocManager.curUserHostAddress(),
lang,
userid: userid !== 'uid-0' ? userid : null,
@ -1079,12 +1069,12 @@ app.get('/editor', (req, res) => { // define a handler for editing document
? JSON.stringify({ fileName, userAddress: req.DocManager.curUserHostAddress() }) : null,
instanceId: userid !== 'uid-0' ? req.DocManager.getInstanceId() : null,
protect: !user.deniedPermissions.includes('protect'),
goback: user.goback != null ? user.goback : '',
close: user.close,
},
dataInsertImage: {
fileType: 'svg',
url: `${req.DocManager.getServerUrl(true)}/images/logo.svg`,
directUrl: !userDirectUrl ? null : `${req.DocManager.getServerUrl()}/images/logo.svg`,
fileType: 'png',
url: `${req.DocManager.getServerUrl(true)}/images/logo.png`,
directUrl: !userDirectUrl ? null : `${req.DocManager.getServerUrl()}/images/logo.png`,
},
dataDocument: {
fileType: 'docx',
@ -1183,17 +1173,6 @@ app.post('/historyObj', (req, res) => {
res.end();
});
app.get('/formats', (req, res) => {
try {
const formats = fileUtility.getFormats();
res.json(formats);
} catch (ex) {
console.log(ex); // display error message in the console
res.status(500); // write status parameter to the response
res.render('error', { message: 'Server error' }); // render error template with the message parameter specified
}
});
wopiApp.registerRoutes(app);
// "Not found" error with 404 status

View File

@ -1,5 +1,5 @@
{
"version": "1.8.0",
"version": "1.9.0",
"log": {
"appenders": [
{
@ -51,6 +51,7 @@
"cs": "Czech",
"da": "Danish",
"nl": "Dutch",
"en-GB": "English (United Kingdom)",
"fi": "Finnish",
"fr": "French",
"gl": "Galego",
@ -70,7 +71,8 @@
"pt-PT": "Portuguese (Portugal)",
"ro": "Romanian",
"ru": "Russian",
"sr-Latn-RS": "Serbian",
"sr-Cyrl-RS": "Serbian (Cyrillic)",
"sr-Latn-RS": "Serbian (Latin)",
"si": "Sinhala (Sri Lanka)",
"sk": "Slovak",
"sl": "Slovenian",

View File

@ -20,10 +20,6 @@ const supportedFormats = require('../public/assets/document-formats/onlyoffice-d
const fileUtility = {};
fileUtility.getFormats = function getFormats() {
return supportedFormats;
};
// get file name from the given url
fileUtility.getFileName = function getFileName(url, withoutExtension) {
if (!url) return '';
@ -58,10 +54,10 @@ fileUtility.getFileType = function getFileType(url) {
const ext = fileUtility.getFileExtension(url, true); // get the file extension from the given url
for (let i = 0; i < supportedFormats.length; i++) {
if (supportedFormats[i].name === ext && supportedFormats[i].type !== '') return supportedFormats[i].type;
if (supportedFormats[i].name === ext) return supportedFormats[i].type;
}
return null; // the default file type is null
return fileUtility.fileType.word; // the default file type is word
};
fileUtility.fileType = {

View File

@ -30,7 +30,7 @@ class User {
descriptions,
templates,
avatar,
goback,
close,
) {
this.id = id;
this.name = name;
@ -44,7 +44,7 @@ class User {
this.descriptions = descriptions;
this.templates = templates;
this.avatar = avatar;
this.goback = goback;
this.close = close;
}
}
@ -82,8 +82,6 @@ const descrUser3 = [
'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',
];
const descrUser0 = [
@ -103,7 +101,21 @@ const descrUser0 = [
];
const users = [
new User('uid-1', 'John Smith', 'smith@example.com', null, null, {}, null, null, [], descrUser1, true, true, {}),
new User(
'uid-1',
'John Smith',
'smith@example.com',
null,
null,
{},
null,
null,
[],
descrUser1,
true,
true,
{ visible: false },
),
new User(
'uid-2',
'Mark Pottato',
@ -121,7 +133,7 @@ const users = [
descrUser2,
false,
true,
{ text: 'Go to Documents' },
{},
),
new User(
'uid-3',
@ -140,7 +152,7 @@ const users = [
descrUser3,
false,
false,
{ blank: false },
{},
),
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null),
];

View File

@ -53,7 +53,7 @@ exports.registerRoutes = function registerRoutes(app) {
const docsExtEdit = []; // Supported extensions for WOPI
actions.forEach((el) => {
if (el.name === 'edit') docsExtEdit.push(`${el.ext}`);
if (el.name === 'edit') docsExtEdit.push(`.${el.ext}`);
});
// Checking supported extensions

View File

@ -1,4 +0,0 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M14.4285 13C14.4102 13 14 13 14 13.5V15H6C5.44772 15 5 15.4477 5 16V17C5 17.5523 5.44771 18 6 18H14V19.5C14 20 14.3816 20 14.4285 20C14.6359 20 15.0099 19.9113 15.2172 19.7363L18.6207 17.0833C19.1264 16.6566 19.1264 16.3434 18.6207 15.9167L15.2172 13.2637C15.0099 13.0887 14.6359 13 14.4285 13Z" fill="#444444"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M9.5715 4C9.58984 4 10 4 10 4.50002V6H18C18.5523 6 19 6.44772 19 7V8C19 8.55228 18.5523 9 18 9H10V10.5C10 11 9.61841 11 9.57151 11C9.36409 11 8.99012 10.9113 8.78279 10.7363L5.37934 8.08333C4.87356 7.65662 4.87356 7.34338 5.37934 6.91667L8.78279 4.26366C8.99012 4.08874 9.36409 4 9.5715 4Z" fill="#444444"/>
</svg>

Before

Width:  |  Height:  |  Size: 821 B

View File

@ -1 +0,0 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M0 3c0-1.65685 1.34315-3 3-3h20l7 7v30c0 1.6569-1.3431 3-3 3H3c-1.65685 0-3-1.3431-3-3V3z" fill="#27ABA3"/><path d="M23 0l7 7h-4c-1.6569 0-3-1.34315-3-3V0z" fill="#008078"/><path fill-rule="evenodd" clip-rule="evenodd" d="M24 14H6v7h18v-7zm-.8182 5.9978H6.81818V15H23.1818v4.9978zM24 23H6v7h18v-7zm-.8182 5.9978H6.81818V24H23.1818v4.9978z" fill="#fff"/></svg>

Before

Width:  |  Height:  |  Size: 463 B

View File

@ -0,0 +1,5 @@
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0 3C0 1.34315 1.34315 0 3 0H23L30 7V37C30 38.6569 28.6569 40 27 40H3C1.34315 40 0 38.6569 0 37V3Z" fill="#9E1919"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M17.0062 15V16.0065H24V15H17.0062ZM17.0062 19V20.0163H24V19H17.0062ZM24 23H17.0062V24.0261H24V23ZM6 28V27.0293H24V28H6ZM7 16H14V23H7V16ZM6 15H7H14H15V16V23V24H14H7H6V23V16V15Z" fill="white"/>
<path d="M23 0L30 7H26C24.3431 7 23 5.65685 23 4V0Z" fill="black" fill-opacity="0.25"/>
</svg>

After

Width:  |  Height:  |  Size: 558 B

View File

@ -1,8 +0,0 @@
<?xml version="1.0"?>
<svg width="24" height="24" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg">
<g class="layer">
<title>Layer 1</title>
<path d="m9.05,22.33l0,-5.9l5.9,0l0,5.9l5.9,0l0,-10.33l2.95,0l-11.8,-10.33l-11.8,10.33l2.95,0l0,10.33l5.9,0z" fill="#FF6F3D" id="svg_1"/>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,4 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M6 16V13H7V11H5C4.44772 11 4 11.4477 4 12V17C4 17.5523 4.44772 18 5 18H19C19.5523 18 20 17.5523 20 17V12C20 11.4477 19.5523 11 19 11H17V13H18V16H6Z" fill="#444444"/>
<path d="M11 15H9V13L16 6H17V7H18V8L11 15Z" fill="#444444"/>
</svg>

After

Width:  |  Height:  |  Size: 379 B

View File

@ -19,15 +19,6 @@
var language;
var userid;
var directUrl;
var Formats;
window.onload = function () {
fetch('formats')
.then((response) => response.json())
.then((data) => {
Formats = data;
})
}
if (typeof jQuery != "undefined") {
jq = jQuery.noConflict();
@ -109,7 +100,7 @@ if (typeof jQuery != "undefined") {
});
var timer = null;
var checkConvert = function (filePass, forceConvert) {
var checkConvert = function (filePass) {
filePass = filePass ? filePass : null;
if (timer != null) {
clearTimeout(timer);
@ -131,16 +122,13 @@ if (typeof jQuery != "undefined") {
return;
}
var convData = {filename: fileName, filePass: filePass, lang: language};
if (forceConvert) convData.forceConv = forceConvert;
timer = setTimeout(function () {
jq.ajaxSetup({ cache: false });
jq.ajax({
async: true,
type: "post",
dataType: "json",
data: convData,
data: {filename: fileName, filePass: filePass, lang: language},
url: UrlConverter,
complete: function (data) {
var responseText = data.responseText;
@ -160,12 +148,6 @@ if (typeof jQuery != "undefined") {
}
return;
} else {
if (response.error.includes("-9")){
jq("#xmlError").removeClass("invisible");
jq("#step2").removeClass("current");
jq("#hiddenFileName").attr("placeholder",filePass);
return;
}
jq(".current").removeClass("current");
jq(".step:not(.done)").addClass("error");
jq("#mainProgress .error-message").show().find("span").text(response.error);
@ -177,7 +159,7 @@ if (typeof jQuery != "undefined") {
jq("#hiddenFileName").val(response.filename);
if (typeof response.step != "undefined" && response.step < 100) {
checkConvert(filePass, forceConvert);
checkConvert(filePass);
} else {
jq("#step2").addClass("done").removeClass("current");
loadScripts();
@ -223,15 +205,6 @@ if (typeof jQuery != "undefined") {
}
};
jq(document).on("click", "#forceConvert:not(.disable)", function () {
const currentElement = jq(this);
var fileType = currentElement.attr("data");
var filePass = jq("#hiddenFileName").attr("placeholder");
jq("div[id='forceConvert']").addClass("disable, pale");
currentElement.removeClass("pale");
checkConvert(filePass, fileType);
});
jq(document).on("click", "#enterPass", function () {
var pass = jq("#filePass").val();
if (pass) {
@ -299,38 +272,6 @@ if (typeof jQuery != "undefined") {
jq("#uploadSteps").after('<iframe id="embeddedView" src="' + url + '" height="345px" width="432px" frameborder="0" scrolling="no" allowtransparency></iframe>');
});
jq(document).on("click", "#beginEditConverted:not(.disable)", function () {
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
if (UrlEditor == "wopi-action"){
var url = UrlEditor + "/" + fileId + "?action=edit" + collectParams(true);
}else{
var url = UrlEditor + "?fileName=" + fileId + collectParams(true);
}
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
window.location = collectParams();
});
jq(document).on("click", "#beginViewConverted:not(.disable)", function () {
var fileId = encodeURIComponent(jq('#hiddenFileName').attr("data"));
if (UrlEditor == "wopi-action"){
var url = UrlEditor + "/" + fileId + "?action=view" + collectParams(true);
}else{
var url = UrlEditor + "?mode=view&fileName=" + fileId + collectParams(true);
}
window.open(url, "_blank");
jq('#hiddenFileName').val("");
jq.unblockUI();
window.location = collectParams();
});
jq(document).on("click", "#downloadConverted:not(.disable)", function () {
var fileId = jq('#hiddenFileName').attr("data");
if (jq("#downloadConverted").attr("data") == "fromConverter") window.location.assign(fileId);
else window.location.href = "download?fileName=" + encodeURIComponent(fileId);
});
jq(document).on("click", ".reload-page", function () {
setTimeout(function () { window.location = collectParams(); }, 1000);
return true;
@ -352,97 +293,6 @@ if (typeof jQuery != "undefined") {
}
});
jq(document).on("click", ".convert-file", function () {
const currentElement = jq(this);
var fileName = currentElement.attr("data");
var type = currentElement.attr("data-type");
jq.blockUI({
theme: true,
title: "Converting file" + "<div class=\"dialog-close\"></div>",
message: jq("#convertingProgress"),
overlayCSS: { "background-color": "#aaa" },
themedCSS: { width: "539px", top: "20%", left: "50%", marginLeft: "-269px" }
});
jq("#convertFileName").text(decodeURIComponent(fileName));
jq("#convertFileName").removeClass("word slide cell");
jq("#convertFileName").addClass(type);
jq("#convTypes").empty();
let convExtensions = Formats.find(format => {return format.name == fileName.split('.').pop()}).convert;
convExtensions.forEach(ext => {
jq("#convTypes").append(jq(`<td name="convertingTypeButton" id="wordTo${ext}" class="button hoar" data="${ext}">${ext}</td>`));
});
jq("#hiddenFileName").val(fileName);
jq("#convertStep1").addClass("done");
jq("#convertStep2").addClass("waiting");
});
jq(document).on("click", "td[name='convertingTypeButton']:not(.disable, .orange)", function () {
const currentElement = jq(this);
let id = currentElement[0].id;
let fileExt = jq(`#${id}`).attr("data");
jq(`#${id}`).addClass("orange");
jq("td[name='convertingTypeButton']").addClass("disable");
jq("#convertStep2").removeClass("waiting").removeClass("done").addClass("current");
jq("#convertStep2").text('2. File conversion');
jq("#convert-descr").removeClass("disable");
jq("#convertPercent").text("0 %");
jq("#hiddenFileName").attr("placeholder",fileExt);
jq("#downloadConverted").addClass("disable");
jq("#beginEditConverted").addClass("disable");
jq("#beginViewConverted").addClass("disable");
mustReload = true;
convertFile();
});
function convertFile (filePass) {
let fileName = decodeURIComponent(jq("#hiddenFileName").val());
let fileExt = jq("#hiddenFileName").attr("placeholder");
if (timer != null) {
clearTimeout(timer);
}
timer = setTimeout(function () {
jq.ajaxSetup({ cache: false });
jq.ajax({
async: true,
type: "post",
dataType: "json",
data: {filename: fileName, filePass: filePass, lang: language, fileExt: fileExt},
url: UrlConverter,
complete: function (data) {
try {
var response = jq.parseJSON(data.responseText);
} catch (e) {
response = { error: e };
}
if(response.step !==100) {
jq("#convertPercent").text(`${response.step} %`);
convertFile();
} else {
jq("#convertPercent").text(`${response.step} %`);
jq("#convertStep2").removeClass("current").addClass("done");
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
jq("#downloadConverted").removeClass("disable");
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");
}
}
});
}, 1000);
}
jq(document).on("click", ".delete-file", function () {
const currentElement = jq(this);
var fileName = currentElement.attr("data");
@ -469,22 +319,6 @@ if (typeof jQuery != "undefined") {
});
});
jq(document).on("click", ".clear-all", function () {
if (confirm("Delete all the files?")) {
jq.ajax({
async: true,
contentType: "text/xml",
type: "delete",
url: "file",
complete: function (data) {
if (JSON.parse(data.responseText).success) {
window.location = collectParams();
}
}
});
}
});
jq("#createSample").click(function () {
jq(".try-editor").each(function () {
var href = jq(this).attr("href");

View File

@ -33,15 +33,6 @@
position: absolute;
width: 100%;
}
.tableHeaderCellFileName{
width: 30%;
}
@media (max-width: 1280px) and (min-width: 1080px) {
.tableHeaderCellViewers {
width: 24%;
}
}
@media (min-width: 1280px) {
.tableHeaderCellRemove{
@ -49,7 +40,6 @@
text-align: center;
}
.tableHeaderCellDownload{
width: 13%;
padding-right: 11px;
}
.tableHeaderCellViewers{
@ -68,9 +58,6 @@
.tableRow td:first-child {
max-width: 45%;
}
.tableHeaderCellViewers {
width: 23%;
}
}
@media (max-width: 986px) and (min-width: 890px){
.tableHeaderCellRemove{
@ -81,15 +68,12 @@
padding-right: 0;
}
.tableHeaderCellViewers{
width: 22%;
width: 24%;
padding-right: 0;
}
.tableRow td:first-child {
max-width: 40%;
}
.contentCells-wopi {
padding-right: 114px;
}
}
@media (max-width: 890px) and (min-width: 769px){
.tableRow td:first-child{
@ -101,9 +85,6 @@
.contentCells-wopi{
width: unset;
}
.tableHeaderCellRemove {
width: 5%;
}
}
@media (max-width: 769px) {
.tableRow td{
@ -131,7 +112,7 @@
}
@media (max-width: 769px) and (min-width: 320px){
.contentCells-icon {
width: 9%;
width: 1%;
}
}
@media (max-width: 508px) {

View File

@ -42,14 +42,10 @@
}
.tableHeaderCellViewers {
width: 18%;
width: 29%;
text-align: right;
}
.tableHeaderCellAction {
width: 23%;
}
.tableHeaderCellDownload {
width: 21%;
padding-right: 18px;
@ -83,8 +79,7 @@
margin-left: 0;
}
.tableRow,
.storedHeader {
.tableRow {
width: 90%;
}
@ -107,10 +102,6 @@
.tableHeaderCellRemove {
padding-left: 0px;
}
.storedHeaderClearAll {
padding-right: 48px;
}
}
@media (max-width: 1008px) {
@ -144,7 +135,7 @@
}
.scroll-table-body {
top: 88px;
top: 31px;
}
footer {
@ -184,8 +175,7 @@
}
@media (max-width: 715px) {
.tableRow,
.storedHeader {
.tableRow {
width: 45%;
}
}
@ -227,7 +217,7 @@
}
.tableHeaderCellFileName {
width: 9%;
width: 16%;
}
.tableHeaderCellEditors {
@ -236,12 +226,7 @@
.tableHeaderCellViewers {
text-align: right;
width: 9%;
}
.tableHeaderCellAction{
width: 11%;
padding-right: 82px;
width: 37%;
}
.tableHeaderCellDownload {
@ -256,24 +241,19 @@
}
.tableHeaderCellEditors {
width: 15%;
width: 26%;
text-align: left;
}
.tableHeaderCellFileName {
width: 28%;
width: 17%;
}
.tableHeaderCellViewers {
width: 6%;
width: 27%;
text-align: right;
}
.tableHeaderCellAction{
width: 18%;
padding-right: 54px;
}
.tableHeaderCellDownload {
padding-right: 18px;
width: 20%;
@ -283,8 +263,7 @@
padding-left: 0;
}
.tableRow,
.storedHeader {
.tableRow {
width: 75%;
}
@ -294,21 +273,12 @@
.tableRow td:first-child {
flex-grow: 0;
width: 25%;
margin-right: auto;
width: 15%;
}
.contentCells-icon {
width: 3%;
}
.firstContentCellViewers {
margin-left: 0;
}
.storedHeaderClearAll {
padding-right: 18px;
}
}
@media (max-width: 890px) and (min-width: 769px ) {
@ -316,15 +286,14 @@
width: 20%;
}
.contentCells-shift {
padding-right: 27px;
padding-right: 28px;
}
.main-panel {
width: 580px;
}
.tableRow,
.storedHeader {
.tableRow {
width: 95%;
}
@ -349,20 +318,11 @@
.tableHeaderCellEditors {
text-align: left;
width: 1%;
width: 31%;
}
.tableHeaderCellViewers {
width: 19%;
}
.tableHeaderCellAction {
width: 19%;
padding-right: 45px;
}
.storedHeaderClearAll {
padding-right: 8px;
width: 18%;
}
}
@ -389,10 +349,6 @@
.tableRow td:first-child {
max-width: 100%;
}
.storedHeaderClearAll {
padding-right: 0px;
}
}
@ -411,7 +367,7 @@
}
.scroll-table-body {
top: 88px;
top: 31px;
}
footer table tr {
@ -451,8 +407,7 @@
padding: 16px 0 6px;
}
.tableRow,
.storedHeader {
.tableRow {
width: 40%;
}
@ -468,8 +423,8 @@
.downloadContentCellShift {
max-width: 7%;
margin-right: 24px;
margin-left: 0;
margin-right: -11px;
margin-left: auto;
}
.contentCells-icon {
@ -477,13 +432,13 @@
}
.tableRow td:last-child {
width: 7%;
padding-right: 0px;
width: 12%;
padding-right: 40px;
border: none;
}
.contentCells-shift {
padding-right: 0px;
padding-right: 35px;
}
.downloadContentCellShift:after {
@ -547,17 +502,6 @@
justify-content: space-between;
align-items: center;
}
.buttonsMobile.indent {
margin-bottom: 0;
flex-wrap: nowrap;
}
.button.forceConvert:hover,
.button.forceConvert {
height: 28px;
width: 100px;
margin-bottom: 10px !important;
font-size: 9px;
}
.button.gray{
margin: 0;
}
@ -569,15 +513,6 @@
height: 56px;
margin-bottom: 24px !important;
}
.button.hoar{
width: 18%;
height: 27px;
margin-bottom: 7px !important;
}
.button.converting{
width: 126px;
margin-top: 0;
}
}
@media (max-width: 560px) and (min-width: 510px) {
@ -586,14 +521,13 @@
}
.downloadContentCellShift {
padding-right: 16px;
padding-right: 45px;
max-width: 4%;
}
}
@media (max-width: 510px) and (min-width: 470px) {
.tableRow,
.storedHeader {
.tableRow {
width: 35%;
}
@ -606,7 +540,7 @@
.downloadContentCellShift {
max-width: 6%;
padding-right: 6px;
padding-right: 37px;
}
.firstContentCellShift {
@ -619,8 +553,7 @@
}
@media (max-width: 470px) and (min-width: 420px) {
.tableRow,
.storedHeader {
.tableRow {
width: 30%;
}
.tableRow td:first-child{
@ -632,12 +565,12 @@
.downloadContentCellShift {
max-width: 3%;
padding-right: 0px;
padding-right: 37px;
padding-left: 0;
}
.firstContentCellShift {
margin-left: 2px;
margin-left: 1px;
flex-basis: 14%;
}
@ -655,8 +588,7 @@
}
@media (max-width: 420px) and (min-width: 320px) {
.tableRow,
.storedHeader {
.tableRow {
width: 25%;
}
@ -667,7 +599,7 @@
.downloadContentCellShift {
max-width: 4%;
margin-right: 18px;
margin-right: -18px;
margin-left: -1px;
}
@ -676,7 +608,7 @@
}
.contentCells-icon{
width: 12%;
width: 10%;
}
footer table td {
margin: 0;
@ -692,10 +624,6 @@
padding-right: 2px;
width: 11%;
}
.header-list {
font-size: 12px;
}
}
@media (max-width: 1160px) {
@ -710,8 +638,7 @@
}
}
@media (max-width: 769px) and (min-width: 715px){
.tableRow,
.storedHeader {
.tableRow{
width: 50%;
}
}

View File

@ -162,7 +162,7 @@ label .checkbox {
}
.try-editor.form {
background-image: url("../images/file_docxf.svg");
background-image: url("../images/file_pdf.svg");
}
.side-option {
@ -228,79 +228,6 @@ label .checkbox {
color: #FF6F3D;
}
.button.converting {
margin-top: -20px;
padding: 16px 16px;
}
.button.converting.wide {
padding: 16px 29px;
}
.button.hoar {
background: #EFEFEF;
border: 1px solid #EFEFEF;
margin-right: 7px;
margin-bottom: 7px;
width: 13%;
padding-left: 0;
padding-right: 0;
font-size: 11px;
}
.button.hoar.disable {
opacity: 30%;
cursor: default;
}
.button.hoar:not(.disable):hover {
background: #FF6F3D;
border: 1px solid #FF6F3D;
color: #FFFFFF;
}
.button.hoar.orange {
background: #FF6F3D;
border: 1px solid #FF6F3D;
color: #FFFFFF;
cursor: default;
}
.button.hoar.orange.disable {
background: #444444;
border: 1px solid #444444;
color: #FFFFFF;
cursor: default;
opacity: 100%;
}
.button.forceConvert {
font-size: 11px;
color: #FFFFFF;
padding: 8px 8px;
margin-right: 10px;
}
.button.forceConvert.disable {
cursor: default;
}
.button.forceConvert.pale {
opacity: 30%;
}
.button.forceConvert.document {
background: #446995;
}
.button.forceConvert.spreadsheet {
background: #40865C;
}
.button.forceConvert.presentation {
background: #AA5252;
}
.upload-panel {
float: left;
padding: 24px 0;
@ -331,47 +258,24 @@ label .checkbox {
width: 192px;
}
.create-panel {
.create-panel,
.links-panel {
float: left;
padding: 16px 0;
}
.links-panel {
display: flex;
column-gap: 30px;
margin-bottom: 35px;
align-items: center;
}
.links-panel-current {
position: relative;
}
.links-panel-current::after {
content: "";
background-color: #ff6f3d;
position: absolute;
left: -10%;
bottom: -8px;
width: 120%;
height: 2.5px;
}
.links-panel a {
font-size: 14px;
text-decoration: none;
}
.links-panel-home {
width: 22px;
}
.upload-panel,
.create-panel {
width: 100%;
border-bottom: 1px solid #D0D5DA;
}
.links-panel-border {
margin-top: 24px;
width: 100%;
border-top: 1px solid #D0D5DA;
}
#mainProgress {
color: #333333;
display: none;
@ -409,32 +313,6 @@ label .checkbox {
display: none;
}
#convertingProgress {
color: #333333;
display: none;
font-size: 12px;
margin: 30px 35px;
}
#convertingProgress .convertFileName{
background-position: left center;
background-repeat: no-repeat;
display: block;
font-size: 14px;
line-height: 160%;
overflow: hidden;
padding-left: 28px;
margin-bottom: 16px;
text-overflow: ellipsis;
white-space: nowrap;
}
#convertingProgress .describeUpload {
line-height: 150%;
letter-spacing: -0.02em;
padding: 16px 0;
}
.error-message {
background: url(../images/error.svg) no-repeat scroll 4px 10px;
color: #CB0000;
@ -456,10 +334,6 @@ label .checkbox {
padding-left: 35px;
}
.waiting {
opacity: 30%;
}
.current {
background-image: url("../images/loader16.gif");
}
@ -472,12 +346,6 @@ label .checkbox {
background-image: url("../images/notdone.svg");
}
.convertPercent {
color: #FF6F3D;
font-weight: 700;
display: inline;
}
.step-descr {
display: block;
margin-left: 35px;
@ -485,10 +353,6 @@ label .checkbox {
line-height: 188%;
}
.step-descr.disable {
display: none;
}
.progress-descr {
letter-spacing: -0.02em;
line-height: 150%;
@ -591,19 +455,16 @@ footer table tr td:first-child {
white-space: nowrap;
}
.convertFileName.word,
.stored-edit.word,
.uploadFileName.word {
background-image: url("../images/icon_docx.svg");
}
.convertFileName.cell,
.stored-edit.cell,
.uploadFileName.cell {
background-image: url("../images/icon_xlsx.svg");
}
.convertFileName.slide,
.stored-edit.slide,
.uploadFileName.slide {
background-image: url("../images/icon_pptx.svg");
@ -665,11 +526,6 @@ footer table tr td:first-child {
visibility: hidden;
}
.convertTable {
margin-top: 10px;
margin-left: 35px;
}
.tableRow {
background: transparent;
-moz-transition: all 0.2s ease-in-out;
@ -716,12 +572,6 @@ footer table tr td:first-child {
width: 11%;
}
.tableHeaderCellAction{
width: 13%;
text-align: right;
padding-right: 88px;
}
.tableHeaderCellDownload{
width: 13%;
text-align: right;
@ -745,7 +595,7 @@ footer table tr td:first-child {
}
.contentCells-shift {
padding-right: 43px;
padding-right: 44px;
}
.contentCells-icon {
@ -763,28 +613,6 @@ footer table tr td:first-child {
margin-right: 8px;
}
.storedHeader {
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;
}
.storedHeaderClearAll {
padding-right: 52px;
}
.clear-all {
display: inline-block;
width: 100px;
padding: 2px;
outline: 1px solid #E5E5E5;
text-align: center;
cursor:pointer;
text-transform: uppercase;
background-color: #F5F5F5;
color: #666666;
}
.select-user {
color: #444444;
font-family: Open Sans;
@ -844,7 +672,7 @@ footer table tr td:first-child {
width: 100%;
}
.icon-action {
.icon-delete {
cursor: pointer;
}
@ -860,7 +688,7 @@ footer table tr td:first-child {
overflow-x: auto;
position: absolute;
right: 0;
top: 130px;
top: 71px;
scrollbar-color: #D0D5DA transparent;
scrollbar-width: thin;
}
@ -923,14 +751,6 @@ html {
position: relative;
}
.typeButtonsRow {
width: 100%;
display: flex;
flex-wrap: wrap;
flex-direction: row;
position: relative;
}
.tableRow td:first-child {
display: flex;
@ -939,11 +759,11 @@ html {
}
.tableHeaderCellFileName {
width: 20%;
width: 30%;
}
.tableHeaderCellEditors {
width: 20%;
width: 28%;
}
.tableHeaderCellViewers {
@ -969,13 +789,3 @@ html {
.user-descr > b {
margin-left: 25px;
}
.buttonsMobile.indent{
padding-left: 35px;
margin-top: 10px;
margin-bottom: 10px;
}
.invisible {
display: none;
}

View File

@ -39,9 +39,12 @@
"customization": {
"about": true,
"comments": true,
"close": <%- JSON.stringify(editor.close) %>,
"feedback": true,
"forcesave": false,
"goback": <%- JSON.stringify(editor.goback) %>,
"goback": {
"url": "<%- editor.backUrl %>"
},
"submitForm": <%- editor.submitForm %>
},
"embedded": {

View File

@ -57,6 +57,11 @@
document.title = title + (event.data ? "*" : "");
};
var onRequestClose = function () { // close editor
docEditor.destroyEditor();
innerAlert("Document editor closed successfully");
};
var onMetaChange = function (event) { // the meta information of the document is changed via the meta command
if (event.data.favorite) {
var favorite = !!event.data.favorite;
@ -69,7 +74,7 @@
};
var onRequestEditRights = function () { // the user is trying to switch the document from the viewing into the editing mode
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("mode=\\w+\&?", "i"), "") + "&mode=edit";
};
var onRequestHistory = function (event) { // the user is trying to show the document version history
@ -349,7 +354,9 @@
};
var onDocumentReady = function(){
fixSize();
if (config.type === "mobile") {
document.getElementsByTagName("iframe")[0].style.height = window.innerHeight + "px";
}
};
config = {
@ -370,18 +377,17 @@
};
if (<%- JSON.stringify(editor.userid) %> != null) {
config.events.onRequestClose = onRequestClose;
config.events.onRequestEditRights = onRequestEditRights;
config.events.onRequestHistory = onRequestHistory;
config.events.onRequestHistoryData = onRequestHistoryData;
config.events.onRequestHistoryClose = onRequestHistoryClose;
config.events.onRequestRestore = onRequestRestore;
config.events.onRequestRename = onRequestRename;
config.events.onRequestUsers = onRequestUsers;
config.events.onRequestSendNotify = onRequestSendNotify;
config.events.onRequestReferenceData = onRequestReferenceData;
config.events.onRequestReferenceSource = onRequestReferenceSource;
if (<%- JSON.stringify(editor.userid) %> != "uid-3") {
config.events.onRequestHistoryClose = onRequestHistoryClose;
config.events.onRequestRestore = onRequestRestore;
}
}
if (config.editorConfig.createUrl) {
@ -405,20 +411,6 @@
}
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
fixSize();
};
// get the editor sizes
var fixSize = function () {
if (config.type !== "mobile") {
return;
}
var wrapEl = document.getElementsByClassName("form");
if (wrapEl.length) {
wrapEl[0].style.height = screen.availHeight + "px";
window.scrollTo(0, -1);
wrapEl[0].style.height = window.innerHeight + "px";
}
};
const getFileExt = function (fileName) {
@ -430,10 +422,8 @@
if (window.addEventListener) {
window.addEventListener("load", connectEditor);
window.addEventListener("resize", fixSize);
} else if (window.attachEvent) {
window.attachEvent("onload", connectEditor);
window.attachEvent("onresize", fixSize);
}
</script>

View File

@ -58,7 +58,7 @@
<a class="try-editor slide reload-page action-link" target="_blank" href="editor?fileExt=pptx" title="Create new presentation">Presentation</a>
</li>
<li>
<a class="try-editor form reload-page action-link" target="_blank" href="editor?fileExt=docxf" title="Create new PDF form">PDF form</a>
<a class="try-editor form reload-page action-link" target="_blank" href="editor?fileExt=pdf" title="Create new PDF form">PDF form</a>
</li>
</ul>
<label class="side-option">
@ -106,6 +106,10 @@
</tr>
</tbody>
</table>
<div class="links-panel links-panel-border clearFix">
<a href="wopi" class="">Go to WOPI page</a>
</div>
</div>
</div>
</td>
@ -133,27 +137,15 @@
<%if (storedFiles.length > 0)
{%>
<div class="stored-list">
<div class="links-panel">
<a href="./" class="links-panel-current">
<img src="images/home.svg" alt="Home" class="links-panel-home"/>
</a>
<a href="wopi">Wopi</a>
</div>
<div class="storedHeader">
<div class="storedHeaderText">
<span class="header-list">Your documents</span>
</div>
<div class="storedHeaderClearAll">
<div class="clear-all">Clear all</div>
</div>
</div>
<span class="header-list">Your documents</span>
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
<thead>
<tr>
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
<td class="tableHeaderCell tableHeaderCellAction">Action</td>
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
</tr>
</thead>
</table>
@ -169,13 +161,17 @@
</td>
<% if (storedFiles[i].canEdit) { %>
<td class="contentCells contentCells-icon">
<a class="action-link" href="editor?type=desktop&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
<a class="action-link" href="editor?type=desktop&mode=edit&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
<img src="images/desktop.svg" alt="Open in editor for full size screens" title="Open in editor for full size screens" /></a>
</td>
<% if (storedFiles[i].documentType !== "pdf") { %>
<td class="contentCells contentCells-icon">
<a class="action-link" href="editor?type=desktop&mode=comment&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
<img src="images/comment.svg" alt="Open in editor for comment" title="Open in editor for comment" /></a>
</td>
<% } else { %>
<td class="contentCells contentCells-icon"></td>
<% } %>
<% if (storedFiles[i].documentType == "word") { %>
<td class="contentCells contentCells-icon">
<a class="action-link" href="editor?type=desktop&mode=review&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
@ -238,21 +234,13 @@
<a class="action-link" href="editor?type=embedded&mode=embedded&fileName=<%= encodeURIComponent(storedFiles[i].name) %>" target="_blank">
<img src="images/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode" /></a>
</td>
<% if (storedFiles[i].documentType != null ) {%>
<td class="contentCells contentCells-icon">
<a class="convert-file" data="<%= encodeURIComponent(storedFiles[i].name) %>" data-type="<%= storedFiles[i].documentType %>">
<img class="icon-action" src="images/convert.svg" alt="Convert" title="Convert" /></a>
</td>
<% } else { %>
<td class="contentCells contentCells-icon downloadContentCellShift"></td>
<% } %>
<td class="contentCells contentCells-icon downloadContentCellShift">
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
<a href="download?fileName=<%= encodeURIComponent(storedFiles[i].name) %>">
<img class="icon-download" src="images/download.svg" alt="Download" title="Download" /></a>
</td>
<td class="contentCells contentCells-icon contentCells-shift">
<a class="delete-file" data="<%= encodeURIComponent(storedFiles[i].name) %>">
<img class="icon-action" src="images/delete.svg" alt="Delete" title="Delete" /></a>
<img class="icon-delete" src="images/delete.svg" alt="Delete" title="Delete" /></a>
</td>
</tr>
<% } %>
@ -274,15 +262,6 @@
<div class="describeUpload">After these steps are completed, you can work with your document.</div>
<span id="step1" class="step">1. Loading the file.</span>
<span class="step-descr">The loading speed depends on file size and additional elements it contains.</span>
<div id="xmlError" class="invisible">
<br />
<span class="step">Please select the current document type</span>
<div class="buttonsMobile indent">
<div id="forceConvert" class="button forceConvert document" data="docx">Document</div>
<div id="forceConvert" class="button forceConvert spreadsheet" data="xlsx">Spreadsheet</div>
<div id="forceConvert" class="button forceConvert presentation" data="pptx">Presentation</div>
</div>
</div>
<br />
<span id="step2" class="step">2. Conversion.</span>
<span class="step-descr">The file is converted to OOXML so that you can edit it.</span>
@ -319,31 +298,6 @@
</div>
</div>
<div id="convertingProgress">
<div id="convertingSteps">
<span id="convertFileName" class="convertFileName"></span>
<span id="convertStep1" class="step">1. Select a format file to convert</span>
<span class="step-descr">The converting speed depends on file size and additional elements it contains.</span>
<table cellspacing="0" cellpadding="0" width="100%" class="convertTable">
<tbody>
<tr class="typeButtonsRow" id="convTypes"></tr>
</tbody>
</table>
<br />
<span id="convertStep2" class="step">2. File conversion</span>
<span class="step-descr disable" id="convert-descr">The file is converted <div class="convertPercent" id="convertPercent">0 %</div></span>
<div class="describeUpload">Note the speed of all operations depends on your connection quality and server location.</div>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
</div>
<br />
<div class="buttonsMobile">
<div id="downloadConverted" class="button converting orange disable">DOWNLOAD</div>
<div id="beginViewConverted" class="button converting wide gray disable">VIEW</div>
<div id="beginEditConverted" class="button converting wide gray disable">EDIT</div>
<div id="cancelEdit" class="button converting gray">CANCEL</div>
</div>
</div>
<span id="loadScripts" data-docs="<%= preloaderUrl %>"></span>
<footer>

View File

@ -66,6 +66,7 @@
office_frame.title = 'Office Frame';
office_frame.setAttribute('allowfullscreen', 'true');
office_frame.setAttribute('sandbox', 'allow-scripts allow-same-origin allow-forms allow-popups allow-top-navigation allow-popups-to-escape-sandbox allow-downloads allow-modals');
office_frame.setAttribute('allow', 'autoplay camera microphone display-capture');
frameholder.appendChild(office_frame);

View File

@ -60,7 +60,7 @@
<a class="try-editor slide reload-page action-link" target="_blank" href="wopi-new?fileExt=pptx" title="Create new presentation">Presentation</a>
</li>
<li>
<a class="try-editor form reload-page action-link" target="_blank" href="wopi-new?fileExt=docxf" title="Create new PDF form">PDF form</a>
<a class="try-editor form reload-page action-link" target="_blank" href="wopi-new?fileExt=pdf" title="Create new PDF form">PDF form</a>
</li>
</ul>
</div>
@ -98,6 +98,10 @@
</tr>
</tbody>
</table>
<div class="links-panel links-panel-border clearFix">
<a href="./" class="">Go to Index page</a>
</div>
</div>
</td>
<td class="section">
@ -105,12 +109,6 @@
<div id="portal-info" style="display: <%= storedFiles.length > 0 ? "none" : "table-cell" %>">
<% if (!wopiEnable)
{ %>
<div class="links-panel">
<a href="./">
<img src="images/home.svg" alt="Home" class="links-panel-home"/>
</a>
<a href="wopi" class="links-panel-current">Wopi</a>
</div>
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Before you get started with a demo sample of ONLYOFFICE Docs, please enable the WOPI protocol.
@ -131,20 +129,7 @@
<% if (storedFiles.length > 0)
{ %>
<div class="stored-list">
<div class="links-panel">
<a href="./">
<img src="images/home.svg" alt="Home" class="links-panel-home"/>
</a>
<a href="wopi" class="links-panel-current">Wopi</a>
</div>
<div class="storedHeader">
<div class="storedHeaderText">
<span class="header-list">Your documents</span>
</div>
<div class="storedHeaderClearAll">
<div class="clear-all">Clear all</div>
</div>
</div>
<span class="header-list">Your documents</span>
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
<thead>
<tr>
@ -187,7 +172,7 @@
</td>
<td class="contentCells contentCells-icon contentCells-shift">
<a class="delete-file" data="<%= encodeURIComponent(storedFiles[i].name) %>">
<img class="icon-action" src="images/delete.svg" alt="Delete" title="Delete" /></a>
<img class="icon-delete" src="images/delete.svg" alt="Delete" title="Delete" /></a>
</td>
</tr>
<% } %>

View File

@ -61,12 +61,6 @@ compose-prod: # Up containers in a production environment.
@docker-compose build
@docker-compose up --detach
.PHONY: restart
restart: # Restart containers replacing volume files.
@docker-compose rm --stop --force proxy example
@docker volume rm php_example
@docker compose up --detach --build
.PHONY: lint
lint: # Lint the source code for the style.
@./vendor/bin/phpcs src index.php

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -199,8 +199,8 @@ if (typeof jQuery != "undefined") {
jq("#beginView, #beginEmbedded").removeClass("disable");
var fileName = jq("#hiddenFileName").val();
var posExt = fileName.lastIndexOf('.');
posExt = 0 <= posExt ? fileName.substring(posExt + 1).trim().toLowerCase() : '';
var posExt = fileName.lastIndexOf('.') + 1;
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
if (EditedExtList.indexOf(posExt) != -1 || FillFormsExtList.indexOf(posExt) != -1) {
jq("#beginEdit").removeClass("disable");

View File

@ -537,7 +537,7 @@ function reference()
}
}
$link = $post["link"];
$link = $post["link"] ?? null;
if (!isset($filename) && isset($link)) {
if (strpos($link, serverPath()) === false) {
return ["url" => $link, "directUrl"=> $link];

View File

@ -22,7 +22,7 @@ use Example\Common\URL;
class ConfigurationManager
{
public string $version = '1.8.0';
public string $version = '1.9.0';
public function getVersion(): string
{
@ -176,6 +176,7 @@ class ConfigurationManager
'cs' => 'Czech',
'da' => 'Danish',
'nl' => 'Dutch',
'en-GB' => 'English (United Kingdom)',
'fi' => 'Finnish',
'fr' => 'French',
'gl' => 'Galego',
@ -195,7 +196,8 @@ class ConfigurationManager
'pt-PT' => 'Portuguese (Portugal)',
'ro' => 'Romanian',
'ru' => 'Russian',
'sr-Latn-RS' => 'Serbian',
'sr-Cyrl-RS' => 'Serbian (Cyrillic)',
'sr-Latn-RS' => 'Serbian (Latin)',
'si' => 'Sinhala (Sri Lanka)',
'sk' => 'Slovak',
'sl' => 'Slovenian',

View File

@ -62,9 +62,7 @@ final class ExampleUsers
"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"
"Cant submit forms"
];
$this->user0Description = [
"The name is requested when the editor is opened",
@ -93,8 +91,7 @@ final class ExampleUsers
[],
$this->user1Description,
true,
true,
[]
true
),
new Users(
"uid-2",
@ -112,8 +109,7 @@ final class ExampleUsers
[],
$this->user2Description,
false,
true,
["text" => "Go to Documents",]
true
),
new Users(
"uid-3",
@ -131,8 +127,7 @@ final class ExampleUsers
["copy", "download", "print"],
$this->user3Description,
false,
false,
["blank" => false,]
false
),
new Users(
"uid-0",
@ -146,8 +141,7 @@ final class ExampleUsers
["protect"],
$this->user0Description,
false,
false,
null
false
),
];
}

View File

@ -34,7 +34,6 @@ final class Users
public ?bool $avatar;
public ?string $image;
public ?array $goback;
/**
* Constructor
@ -51,7 +50,6 @@ final class Users
* @param array|null $descriptions
* @param bool|null $templates
* @param bool|null $avatar
* @param array|null $goback
*
* @return void
*/
@ -67,8 +65,7 @@ final class Users
?array $deniedPermissions,
?array $descriptions,
?bool $templates,
?bool $avatar,
?array $goback
?bool $avatar
) {
$this->id = $id;
$this->name = $name;
@ -82,6 +79,5 @@ final class Users
$this->templates = $templates;
$this->userInfoGroups = $userInfoGroups;
$this->avatar = $avatar;
$this->goback = $goback;
}
}

View File

@ -48,7 +48,7 @@ final class DocEditorView extends View
$jwtManager = new JwtManager();
$userList = new ExampleUsers();
$fileId = $request["fileID"] ?? "";
$user = $userList->getUser($request["user"]);
$user = $userList->getUser($request["user"] ?? null);
$isEnableDirectUrl = isset($request["directUrl"]) ? filter_var($request["directUrl"], FILTER_VALIDATE_BOOLEAN)
: false;
if (!empty($externalUrl)) {
@ -104,10 +104,6 @@ final class DocEditorView extends View
],
];
if ($user->goback !== null) {
$user->goback["url"] = serverPath();
}
// specify the document config
$config = [
"type" => $type,
@ -132,7 +128,7 @@ final class DocEditorView extends View
$editorsMode == "view" || $editorsMode == "filter" || $editorsMode == "blockcontent"),
"print" => !in_array("print", $user->deniedPermissions),
"fillForms" => $editorsMode != "view" && $editorsMode != "comment"
&& $editorsMode != "embedded" && $editorsMode != "blockcontent",
&& $editorsMode != "blockcontent",
"modifyFilter" => $editorsMode != "filter",
"modifyContentControl" => $editorsMode != "blockcontent",
"review" => $canEdit && ($editorsMode == "edit" || $editorsMode == "review"),
@ -184,20 +180,23 @@ final class DocEditorView extends View
// adds the request for the forced file saving to the callback handler when saving the document
"forcesave" => false,
"submitForm" => $submitForm, // if the Submit form button is displayed or not
// settings for the Open file location menu button and upper right corner button
"goback" => $user->goback !== null ? $user->goback : "",
"goback" => [ // settings for the Open file location menu button and upper right corner button
// the absolute URL to the website address which will be opened
// when clicking the Open file location menu button
"url" => serverPath(),
],
],
],
];
// an image for inserting
$dataInsertImage = $isEnableDirectUrl ? [
"fileType" => "svg",
"url" => serverPath(true) . "/assets/images/logo.svg",
"directUrl" => serverPath(false) . "/assets/images/logo.svg",
"fileType" => "png",
"url" => serverPath(true) . "/assets/images/logo.png",
"directUrl" => serverPath(false) . "/assets/images/logo.png",
] : [
"fileType" => "svg",
"url" => serverPath(true) . "/assets/images/logo.svg",
"fileType" => "png",
"url" => serverPath(true) . "/assets/images/logo.png",
];
// a document for comparing
@ -247,27 +246,46 @@ final class DocEditorView extends View
}
$historyLayout = "";
if ($user->id == "uid-3") {
$historyLayout .= "config.events['onRequestHistoryClose'] = null;
config.events['onRequestRestore'] = null;";
}
if ($user->id != "uid-0") {
$historyLayout .= "// add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case \"info\":
users = [];
var allUsers = {usersInfo};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case \"protect\":
var users = {usersForProtect};
break;
default:
users = {usersForMentions};
}
docEditor.setUsers({
\"c\": c,
\"users\": users,
});
};
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert(\"onRequestSendNotify: \" + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;";
if ($user->id != "uid-3") {
$historyLayout .= "config.events['onRequestHistoryClose'] = onRequestHistoryClose;
config.events['onRequestRestore'] = onRequestRestore;";
}
config.events['onRequestEditRights'] = onRequestEditRights;";
}
$this->tagsValues = [
"docType" => getDocumentType($filename),

View File

@ -67,7 +67,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("action=view\&?", "i"), "");
location.href = location.href.replace(RegExp("action=\\w+\&?", "i"), "") + "&action=edit";
};
// an error or some other specific event occurs
@ -275,44 +275,6 @@
}
}
// add mentions for not anonymous users
var onRequestUsers = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = {usersInfo};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = {usersForProtect};
break;
default:
users = {usersForMentions};
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
var сonnectEditor = function () {
{fileNotFoundAlert}
@ -332,6 +294,10 @@
'onRequestSelectDocument': onRequestSelectDocument,
'onRequestSelectSpreadsheet': onRequestSelectSpreadsheet,
'onRequestReferenceData': onRequestReferenceData,
'onRequestRestore': onRequestRestore,
'onRequestHistoryData': onRequestHistoryData,
'onRequestHistory': onRequestHistory,
'onRequestHistoryClose': onRequestHistoryClose,
"onRequestOpen": onRequestOpen,
};

View File

@ -22,7 +22,7 @@ from src.common import string
class ConfigurationManager:
version = '1.8.0'
version = '1.9.0'
def getVersion(self) -> str:
return self.version
@ -136,6 +136,7 @@ class ConfigurationManager:
'cs': 'Czech',
'da': 'Danish',
'nl': 'Dutch',
'en-GB': 'English (United Kingdom)',
'fi': 'Finnish',
'fr': 'French',
'gl': 'Galego',
@ -155,7 +156,8 @@ class ConfigurationManager:
'pt-PT': 'Portuguese (Portugal)',
'ro': 'Romanian',
'ru': 'Russian',
'sr-Latn-RS': 'Serbian',
'sr-Cyrl-RS': 'Serbian (Cyrillic)',
'sr-Latn-RS': 'Serbian (Latin)',
'si': 'Sinhala (Sri Lanka)',
'sk': 'Slovak',
'sl': 'Slovenian',

View File

@ -21,7 +21,7 @@ from typing import Optional
class User:
def __init__(self, uid, name, email, group, reviewGroups, commentGroups, userInfoGroups, favorite,
deniedPermissions, descriptions, templates, avatar, goback):
deniedPermissions, descriptions, templates, avatar):
self.id = uid
self.name = name
self.email = email
@ -34,7 +34,6 @@ class User:
self.templates = templates
self.userInfoGroups = userInfoGroups
self.avatar = avatar
self.goback = goback
descr_user_1 = [
@ -71,9 +70,7 @@ descr_user_3 = [
"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"
"Cant submit forms"
]
descr_user_0 = [
@ -95,7 +92,7 @@ descr_user_0 = [
USERS = [
User('uid-1', 'John Smith', 'smith@example.com',
'', None, {}, None,
None, [], descr_user_1, True, True, {}),
None, [], descr_user_1, True, True),
User('uid-2', 'Mark Pottato', 'pottato@example.com',
'group-2', ['group-2', ''], {
'view': "",
@ -103,18 +100,17 @@ USERS = [
'remove': ["group-2"]
},
['group-2', ''],
True, [], descr_user_2, False, True, {'text': "Go to Documents"}),
True, [], descr_user_2, False, True),
User('uid-3', 'Hamish Mitchell', None,
'group-3', ['group-2'], {
'view': ["group-3", "group-2"],
'edit': ["group-2"],
'remove': []
}, ['group-2'],
False, ["copy", "download", "print"], descr_user_3, False, False,
{'blank': False}),
False, ["copy", "download", "print"], descr_user_3, False, False),
User('uid-0', None, None,
'', None, {}, [],
None, ["protect"], descr_user_0, False, False, None)
None, ["protect"], descr_user_0, False, False)
]
DEFAULT_USER = USERS[0]

View File

@ -132,8 +132,6 @@ def saveAs(request):
body = json.loads(request.body)
saveAsFileUrl = body.get('url')
title = body.get('title')
saveAsFileUrl = saveAsFileUrl.replace(config_manager.document_server_public_url().geturl(),
config_manager.document_server_private_url().geturl())
filename = docManager.getCorrectName(title, request)
path = docManager.getStoragePath(filename, request)
@ -155,7 +153,7 @@ def saveAs(request):
response.setdefault('file', filename)
except Exception as e:
response.setdefault('error', 1)
response.setdefault('message', str(e.args[0]))
response.setdefault('message', e.args[0])
return HttpResponse(json.dumps(response), content_type='application/json')
@ -255,8 +253,6 @@ def edit(request):
'uploaded': datetime.today().strftime('%d.%m.%Y %H:%M:%S')
}
infObj['favorite'] = user.favorite
if user.goback is not None:
user.goback['url'] = docManager.getServerUrl(False, request)
# specify the document config
edConfig = {
'type': edType,
@ -276,7 +272,7 @@ def edit(request):
'edit': canEdit & ((edMode == 'edit') | (edMode == 'view') | (edMode == 'filter') \
| (edMode == "blockcontent")),
'print': 'print' not in user.deniedPermissions,
'fillForms': (edMode != 'view') & (edMode != 'comment') & (edMode != 'embedded') \
'fillForms': (edMode != 'view') & (edMode != 'comment') \
& (edMode != "blockcontent"),
'modifyFilter': edMode != 'filter',
'modifyContentControl': edMode != "blockcontent",
@ -326,20 +322,23 @@ def edit(request):
'feedback': True, # the Feedback & Support menu button display
'forcesave': False, # adds the request for the forced file saving to the callback handler
'submitForm': submitForm, # if the Submit form button is displayed or not
# settings for the Open file location menu button and upper right corner button
'goback': user.goback if user.goback is not None else '',
'goback': { # settings for the Open file location menu button and upper right corner button
# the absolute URL to the website address
# which will be opened when clicking the Open file location menu button
'url': docManager.getServerUrl(False, request)
}
}
}
}
# an image which will be inserted into the document
dataInsertImage = {
'fileType': 'svg',
'url': docManager.getServerUrl(True, request) + '/static/images/logo.svg',
'directUrl': docManager.getServerUrl(False, request) + '/static/images/logo.svg'
'fileType': 'png',
'url': docManager.getServerUrl(True, request) + '/static/images/logo.png',
'directUrl': docManager.getServerUrl(False, request) + '/static/images/logo.png'
} if isEnableDirectUrl else {
'fileType': 'svg',
'url': docManager.getServerUrl(True, request) + '/static/images/logo.svg'
'fileType': 'png',
'url': docManager.getServerUrl(True, request) + '/static/images/logo.png'
}
# a document which will be compared with the current document
@ -563,7 +562,7 @@ def reference(request):
if userAddress == request.META['REMOTE_ADDR']:
fileName = fileKey['fileName']
link = body.get('link', None)
link = body['link']
if not fileName and link:
if docManager.getServerUrl(False, request) not in link:
data = {

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -64,7 +64,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("mode=\\w+\&?", "i"), "") + "&mode=edit";
};
// an error or some other specific event occurs
@ -258,43 +258,6 @@
document.location.reload();
}
var onRequestUsers = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "protect":
var users = {{ usersForProtect | safe }};
break;
case "info":
users = [];
var allUsers = {{ usersInfo | safe }};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
default:
users = {{ usersForMentions | safe }};
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
var connectEditor = function () {
config = {{ cfg | safe }}
@ -309,15 +272,52 @@
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestSelectDocument': onRequestSelectDocument,
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet
"onRequestSelectSpreadsheet": onRequestSelectSpreadsheet,
'onRequestRestore': onRequestRestore,
'onRequestHistory': onRequestHistory,
'onRequestHistoryData': onRequestHistoryData,
'onRequestHistoryClose': onRequestHistoryClose
};
if (config.editorConfig.user.id) {
// add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = {{ usersInfo | safe }};
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = {{ usersForProtect | safe }};
break;
default:
users = {{ usersForMentions | safe }};
}
docEditor.setUsers({
"c": c,
"users": users,
})
};
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;
@ -325,12 +325,6 @@
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestOpen'] = onRequestOpen;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;
if (config.editorConfig.user.id != "uid-3") {
config.events['onRequestHistoryClose'] = onRequestHistoryClose;
config.events['onRequestRestore'] = onRequestRestore;
}
}
if (config.editorConfig.createUrl) {

View File

@ -46,7 +46,7 @@ GEM
activestorage (= 7.0.8)
activesupport (= 7.0.8)
globalid (>= 0.6.0)
nokogiri (>= 1.14.3)
nokogiri (>= 1.8.5)
actionview (7.0.8)
activesupport (= 7.0.8)
builder (~> 3.1)
@ -85,7 +85,7 @@ GEM
coffee-script-source
execjs
coffee-script-source (1.12.2)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
crass (1.0.6)
dalli (3.2.6)
date (3.3.3)
@ -95,7 +95,7 @@ GEM
ffi (1.16.2-x64-mingw-ucrt)
globalid (1.2.1)
activesupport (>= 6.1)
i18n (1.14.1)
i18n (1.14.4)
concurrent-ruby (~> 1.0)
jbuilder (2.11.5)
actionview (>= 5.0.0)
@ -107,9 +107,9 @@ GEM
json (2.6.3)
jwt (2.7.1)
language_server-protocol (3.17.0.3)
loofah (2.21.3)
loofah (2.22.0)
crass (~> 1.0.2)
nokogiri (>= 1.14.3)
nokogiri (>= 1.12.0)
macaddr (1.7.2)
systemu (~> 2.6.5)
mail (2.8.1)
@ -117,10 +117,10 @@ GEM
net-imap
net-pop
net-smtp
marcel (1.0.2)
marcel (1.0.4)
method_source (1.0.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.22.2)
net-imap (0.3.7)
date
net-protocol
@ -132,11 +132,11 @@ GEM
net-protocol
netrc (0.11.0)
nio4r (2.5.9)
nokogiri (1.15.4-arm64-darwin)
nokogiri (1.16.2-arm64-darwin)
racc (~> 1.4)
nokogiri (1.15.4-x64-mingw-ucrt)
nokogiri (1.16.2-x64-mingw-ucrt)
racc (~> 1.4)
nokogiri (1.15.4-x86_64-linux)
nokogiri (1.16.2-x86_64-linux)
racc (~> 1.4)
parallel (1.23.0)
parser (3.2.2.3)
@ -146,8 +146,8 @@ GEM
prettier_print (1.2.1)
psych (5.1.0)
stringio
racc (1.7.1)
rack (2.2.8)
racc (1.7.3)
rack (2.2.8.1)
rack-cors (2.0.1)
rack (>= 2.0.0)
rack-test (2.1.0)
@ -169,10 +169,10 @@ GEM
rails-dom-testing (2.2.0)
activesupport (>= 5.0.0)
minitest
nokogiri (>= 1.14.3)
nokogiri (>= 1.6)
rails-html-sanitizer (1.6.0)
loofah (~> 2.21)
nokogiri (~> 1.14.3)
nokogiri (~> 1.14)
railties (7.0.8)
actionpack (= 7.0.8)
activesupport (= 7.0.8)
@ -203,6 +203,10 @@ GEM
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.29.0)
parser (>= 3.2.1.0)
rubocop-rails (2.22.1)
activesupport (>= 4.2.0)
rack (>= 1.1)
rubocop (>= 1.33.0, < 2.0)
ruby-progressbar (1.13.0)
sass-rails (6.0.0)
sassc-rails (~> 2.1, >= 2.1.1)
@ -298,6 +302,7 @@ DEPENDENCIES
rack-cors (~> 2.0)
rails (~> 7.0.8)
rubocop (~> 1.52)
rubocop-rails (~> 2.20)
sass-rails (~> 6.0)
sdoc (~> 2.6)
sorbet (~> 0.5.10871)

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -31,7 +31,7 @@ class ConfigurationManager
sig { void }
def initialize
@version = '1.8.0'
@version = '1.9.0'
end
sig { returns(T.nilable(URI::Generic)) }
@ -154,6 +154,7 @@ class ConfigurationManager
cs: 'Czech',
da: 'Danish',
nl: 'Dutch',
'en-GB': 'English (United Kingdom)',
fi: 'Finnish',
fr: 'French',
gl: 'Galego',
@ -173,7 +174,8 @@ class ConfigurationManager
'pt-PT': 'Portuguese (Portugal)',
ro: 'Romanian',
ru: 'Russian',
'sr-Latn-RS': 'Serbian',
'sr-Cyrl-RS': 'Serbian (Cyrillic)',
'sr-Latn-RS': 'Serbian (Latin)',
si: 'Sinhala (Sri Lanka)',
sk: 'Slovak',
sl: 'Slovenian',

View File

@ -169,7 +169,7 @@ class HomeController < ApplicationController
action_data: file_data['action_data'],
direct_url: file_data['direct_url']
)
history = file.get_history
history = file.history
render(json: history)
rescue StandardError
render(json: '{ "error": "File not found"}')
@ -342,7 +342,10 @@ class HomeController < ApplicationController
# Save Copy as...
def saveas
body = JSON.parse(request.body.read)
file_url = body['url']
file_url = body['url'].sub(
HomeController.config_manager.document_server_public_uri.to_s,
HomeController.config_manager.document_server_private_uri.to_s
)
title = body['title']
file_name = DocumentHelper.get_correct_name(title, nil)
extension = File.extname(file_name).downcase
@ -377,7 +380,7 @@ class HomeController < ApplicationController
render(plain: "{\"file\" : \"#{file_name}\"}")
nil
rescue StandardError => e
render(plain: "{\"error\":1, \"message\": \"#{e.message}\"}")
render(plain: JSON.generate({ error: 1, message: e.message }))
nil
end

View File

@ -269,7 +269,7 @@ class DocumentHelper
# get image url for templates
def self.get_template_image_url(file_type)
path = "#{get_server_url(true)}/assets/"
path = "#{get_server_url(false)}/assets/"
case file_type
when 'word' # for word type
"#{path}file_docx.svg"

View File

@ -122,9 +122,6 @@ class FileModel
url: "#{create_url}&sample=true"
}
]
unless @user.goback.nil?
@user.goback[:url] = DocumentHelper.get_server_url(false)
end
config = {
type:,
@ -146,7 +143,7 @@ class FileModel
download: @user.denied_permissions.exclude?('download'),
edit: can_edit && ['edit', 'view', 'filter', 'blockcontent'].include?(editors_mode),
print: @user.denied_permissions.exclude?('print'),
fillForms: ['view', 'comment', 'embedded', 'blockcontent'].exclude?(editors_mode),
fillForms: ['view', 'comment', 'blockcontent'].exclude?(editors_mode),
modifyFilter: !editors_mode.eql?('filter'),
modifyContentControl: !editors_mode.eql?('blockcontent'),
review: can_edit && (editors_mode.eql?('edit') || editors_mode.eql?('review')),
@ -183,7 +180,7 @@ class FileModel
id: @user.id.eql?('uid-0') ? nil : @user.id,
name: @user.name,
group: @user.group,
image: @user.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{@user.id}.png" : nil
image: @user.avatar ? "#{DocumentHelper.get_server_url(false)}/assets/#{@user.id}.png" : nil
},
embedded: { # the parameters for the embedded document type
# the absolute URL that will allow the document to be saved onto the user personal computer
@ -200,7 +197,9 @@ class FileModel
feedback: true, # the Feedback & Support menu button display
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
goback: {
url: DocumentHelper.get_server_url(false)
}
}
}
}
@ -262,8 +261,7 @@ class FileModel
data_obj['url'] =
if i == cur_ver
DocumentHelper.get_download_url(
file_name,
true
file_name
)
else
DocumentHelper.get_historypath_uri(
@ -304,22 +302,20 @@ class FileModel
prev = hist_data[(i - 2).to_s] # get the history data from the previous file version
# write key and url information about previous file version with optional direct url
data(
obj['previous'] = if enable_direct_url? == true
{ # write key and url information about previous file version with optional directUrl
fileType: prev['fileType'],
key: prev['key'],
url: prev['url'],
directUrl: prev['directUrl']
}
else
{
fileType: prev['fileType'],
key: prev['key'],
url: prev['url']
}
end
)
data_obj['previous'] = if enable_direct_url? == true
{ # write key and url information about previous file version with optional directUrl
fileType: prev['fileType'],
key: prev['key'],
url: prev['url'],
directUrl: prev['directUrl']
}
else
{
fileType: prev['fileType'],
key: prev['key'],
url: prev['url']
}
end
diff_path = [hist_dir, (i - 1).to_s, 'diff.zip'].join(File::SEPARATOR)
if File.exist?(diff_path)
@ -356,14 +352,14 @@ class FileModel
# direct url to the image
insert_image = if enable_direct_url? == true
{
fileType: 'svg', # image file type
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.svg", # server url to the image
directUrl: "#{DocumentHelper.get_server_url(false)}/assets/logo.svg" # direct url to the image
fileType: 'png', # image file type
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.png", # server url to the image
directUrl: "#{DocumentHelper.get_server_url(false)}/assets/logo.png" # direct url to the image
}
else
{
fileType: 'svg', # image file type
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.svg" # server url to the image
fileType: 'png', # image file type
url: "#{DocumentHelper.get_server_url(true)}/assets/logo.png" # server url to the image
}
end
@ -457,7 +453,7 @@ class FileModel
templates: user_info.templates,
avatar: user_info.avatar
}
u['image'] = user_info.avatar ? "#{DocumentHelper.get_server_url(true)}/assets/#{user_info.id}.png" : nil
u['image'] = user_info.avatar ? "#{DocumentHelper.get_server_url(false)}/assets/#{user_info.id}.png" : nil
users_info.push(u)
end
users_info

View File

@ -165,7 +165,13 @@ class ServiceConverter
percent_element = file_result['percent'] # get the percentage value
result_percent = Integer(percent_element, 10) unless percent_element.nil?
result_percent = unless percent_element.nil?
if percent_element.is_a?(String)
Integer(percent_element, 10)
else
Integer(percent_element)
end
end
result_percent = 99 if result_percent >= 100

View File

@ -30,7 +30,6 @@ class User
attr_accessor :descriptions
attr_accessor :templates
attr_accessor :avatar
attr_accessor :goback
def initialize(
id,
@ -44,8 +43,7 @@ class User
denied_permissions,
descriptions,
templates,
avatar,
goback
avatar
)
@id = id
@name = name
@ -59,7 +57,6 @@ class User
@templates = templates
@user_info_groups = user_info_groups
@avatar = avatar
@goback = goback
end
end
@ -99,9 +96,7 @@ class Users
'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'
'Cant submit forms'
]
@descr_user_null = [
@ -133,8 +128,7 @@ class Users
[],
@descr_user_first,
true,
true,
{}
true
),
User.new(
'uid-2',
@ -152,8 +146,7 @@ class Users
[],
@descr_user_second,
false,
true,
{ text: 'Go to Documents' }
true
),
User.new(
'uid-3',
@ -171,8 +164,7 @@ class Users
['copy', 'download', 'print'],
@descr_user_third,
false,
false,
{ blank: false }
false
),
User.new(
'uid-0',
@ -186,8 +178,7 @@ class Users
['protect'],
@descr_user_null,
false,
false,
nil
false
)
]

View File

@ -49,7 +49,7 @@
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("editorsMode=view\&?", "i"), "");
location.href = location.href.replace(RegExp("editorsMode=\\w+\&?", "i"), "") + "&editorsMode=edit";
};
// an error or some other specific event occurs
@ -195,43 +195,6 @@
};
var onRequestUsers = function (event) {
if (event && event.data) {
var c = event.data.c;
}
switch (c) {
case "protect":
var users = <%= raw @file.users_protect.to_json %>;
break;
case "info":
users = [];
var allUsers = <%= raw @file.users_info.to_json %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
default:
users = <%= raw @file.users_mentions.to_json %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
var onRequestSendNotify = function(event) { // the user is mentioned in a comment
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
function onRequestRestore(event) {
const query = new URLSearchParams(window.location.search)
const payload = {
@ -288,27 +251,58 @@
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestSelectDocument': onRequestSelectDocument,
'onRequestSelectSpreadsheet': onRequestSelectSpreadsheet
'onRequestSelectSpreadsheet': onRequestSelectSpreadsheet,
'onRequestRestore': onRequestRestore,
'onRequestHistory': onRequestHistory,
'onRequestHistoryData': onRequestHistoryData,
'onRequestHistoryClose': onRequestHistoryClose
};
if (config.editorConfig.user.id) {
<%
usersMentions = @file.users_mentions %>
if (config.editorConfig.user.id) {
// add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestUsers'] = function (event) {
if (event && event.data){
var c = event.data.c;
}
switch (c) {
case "info":
users = [];
var allUsers = <%= raw @file.users_info.to_json %>;
for (var i = 0; i < event.data.id.length; i++) {
for (var j = 0; j < allUsers.length; j++) {
if (allUsers[j].id == event.data.id[i]) {
users.push(allUsers[j]);
break;
}
}
}
break;
case "protect":
var users = <%= raw @file.users_protect.to_json %>;
break;
default:
users = <%= raw @file.users_mentions.to_json %>;
}
docEditor.setUsers({
"c": c,
"users": users,
});
};
// the user is mentioned in a comment
config.events['onRequestSendNotify'] = onRequestSendNotify;
config.events['onRequestSendNotify'] = function (event) {
event.data.actionLink = replaceActionLink(location.href, JSON.stringify(event.data.actionLink));
var data = JSON.stringify(event.data);
innerAlert("onRequestSendNotify: " + data);
};
// prevent file renaming for anonymous users
config.events['onRequestRename'] = onRequestRename;
config.events['onRequestReferenceData'] = onRequestReferenceData;
// prevent switch the document from the viewing into the editing mode for anonymous users
config.events['onRequestEditRights'] = onRequestEditRights;
config.events['onRequestOpen'] = onRequestOpen;
config.events['onRequestHistory'] = onRequestHistory;
config.events['onRequestHistoryData'] = onRequestHistoryData;
if (config.editorConfig.user.id != "uid-3") {
config.events['onRequestHistoryClose'] = onRequestHistoryClose;
config.events['onRequestRestore'] = onRequestRestore;
}
}
if (config.editorConfig.createUrl) {

View File

@ -6,6 +6,7 @@ events {
http {
include /etc/nginx/mime.types;
client_max_body_size 100M;
server {
listen 80;