Compare commits
6 Commits
v99.99.99.
...
v8.1.0.92
| Author | SHA1 | Date | |
|---|---|---|---|
| 26673ec668 | |||
| fa303e9bf2 | |||
| c55142bd73 | |||
| 6c03b145e2 | |||
| 15e09fece2 | |||
| abf382a03b |
4
.gitmodules
vendored
@ -1,11 +1,11 @@
|
||||
[submodule "web/documentserver-example/nodejs/public/assets/document-templates"]
|
||||
path = web/documentserver-example/nodejs/public/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
branch = main/en
|
||||
branch = main/en-8.1
|
||||
[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
|
||||
|
||||
13
CHANGELOG.md
@ -1,15 +1,10 @@
|
||||
# Change Log
|
||||
|
||||
- en-GB skin language
|
||||
- save as for pdf
|
||||
- nodejs: docxf, oform as pdf documentType
|
||||
- switching from filling to editing
|
||||
- nodejs: creating pdf instead docxf
|
||||
- fill permission in embedded mode
|
||||
- delete all files
|
||||
- handling conversion -9 error
|
||||
- nodejs: wopi formsubmit icon
|
||||
- nodejs: tabs menu
|
||||
- change insert image
|
||||
- different goback for users
|
||||
- nodejs: converting function on index page
|
||||
- nodejs: close editor
|
||||
|
||||
## 1.8.0
|
||||
@ -17,7 +12,7 @@
|
||||
- nodejs: filling pdf
|
||||
- version number to page meta
|
||||
- ar skin languages
|
||||
- sr-Latn-RS skin languages
|
||||
- sr-Latn-CS skin languages
|
||||
- getting history via api
|
||||
- using a repo with a list of formats
|
||||
- convert after uploading only tagged formats
|
||||
|
||||
10
Readme.md
@ -1,11 +1,11 @@
|
||||
## Integration examples
|
||||
|
||||
These test examples are simple document management systems that can be built into your application for testing.
|
||||
Test examples are simple document management systems that can be built into your application for testing.
|
||||
Do NOT use these integration examples on your own server without proper code modifications!
|
||||
In case you enabled any of the test examples, disable it before going for production.
|
||||
|
||||
These examples show the way to integrate [ONLYOFFICE Docs][2] into your own website or application using one of the programming languages.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Java Spring, Node.js, PHP, Python and Ruby.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
|
||||
|
||||
You should change `http://documentserver` to your server address in these files:
|
||||
* [.Net (C# MVC)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp-mvc) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
|
||||
@ -13,9 +13,9 @@ You should change `http://documentserver` to your server address in these files:
|
||||
* [Java](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java) - `web/documentserver-example/java/src/main/resources/settings.properties`
|
||||
* [Java Spring](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java-spring) - `web/documentserver-example/java-spring/src/main/resources/application.properties`
|
||||
* [Node.js](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/nodejs) - `web/documentserver-example/nodejs/config/default.json`
|
||||
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/src/configuration/ConfigurationManager.php`
|
||||
* [Python](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/python) - `web/documentserver-example/python/src/configuration/configuration.py`
|
||||
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/app/configuration/configuration.rb`
|
||||
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/config.json`
|
||||
* [Python](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/python) - `web/documentserver-example/python/config.py`
|
||||
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/config/application.rb`
|
||||
|
||||
More information on how to use these examples can be found here: [http://api.onlyoffice.com/editors/demopreview](http://api.onlyoffice.com/editors/demopreview "http://api.onlyoffice.com/editors/demopreview")
|
||||
|
||||
|
||||
BIN
web/documentserver-example/csharp-mvc/Content/images/logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
@ -502,17 +502,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@ -230,33 +230,6 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
padding: 8px 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.button.file-type.disable {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.file-type.pale {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.button.file-type.document {
|
||||
background: #446995;
|
||||
}
|
||||
|
||||
.button.file-type.spreadsheet {
|
||||
background: #40865C;
|
||||
}
|
||||
|
||||
.button.file-type.presentation {
|
||||
background: #AA5252;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
float: left;
|
||||
padding: 24px 0;
|
||||
@ -619,29 +592,6 @@ footer table tr td:first-child {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -791,16 +741,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.buttonsMobile.indent{
|
||||
padding-left: 35px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
|
||||
@ -229,10 +229,6 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case -9:
|
||||
// public const int c_nErrorConversionOutputFormatError = -9;
|
||||
errorMessage = String.Format(errorMessageTemplate, "Error conversion output format");
|
||||
break;
|
||||
case -8:
|
||||
// public const int c_nErrorFileVKey = -8;
|
||||
errorMessage = String.Format(errorMessageTemplate, "Error document VKey");
|
||||
|
||||
@ -59,9 +59,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
"Can’t print the file",
|
||||
"Can create new files from the editor",
|
||||
"Can see the information about Group2 users",
|
||||
"Can’t submit forms",
|
||||
"Can't close history",
|
||||
"Can't restore the file version"
|
||||
"Can’t submit forms"
|
||||
};
|
||||
|
||||
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(null, false)
|
||||
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,
|
||||
null
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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()}
|
||||
};
|
||||
|
||||
|
||||
@ -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" />
|
||||
|
||||
@ -1,66 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
class Format {
|
||||
constructor(name, type, actions, convert, mime) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.actions = actions;
|
||||
this.convert = convert;
|
||||
this.mime = mime;
|
||||
}
|
||||
|
||||
isAutoConvertible() {
|
||||
return this.actions.includes('auto-convert');
|
||||
}
|
||||
|
||||
isEditable() {
|
||||
return this.actions.includes('edit') || this.actions.includes('lossy-edit');
|
||||
}
|
||||
|
||||
isFillable() {
|
||||
return this.actions.includes('fill');
|
||||
}
|
||||
}
|
||||
|
||||
class FormatManager {
|
||||
formats = [];
|
||||
|
||||
constructor(formats) {
|
||||
if(Array.isArray(formats)) this.formats = formats;
|
||||
}
|
||||
|
||||
findByExtension(extension) {
|
||||
return this.formats.find(format => format.name == extension);
|
||||
}
|
||||
|
||||
isAutoConvertible(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isAutoConvertible();
|
||||
}
|
||||
|
||||
isEditable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isEditable();
|
||||
}
|
||||
|
||||
isFillable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isFillable();
|
||||
}
|
||||
}
|
||||
@ -17,27 +17,6 @@
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch("webeditor.ashx?type=formats")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.formats) {
|
||||
let formats = [];
|
||||
data.formats.forEach(format => {
|
||||
formats.push(new Format(
|
||||
format.Name,
|
||||
format.Type,
|
||||
format.Actions,
|
||||
format.Convert,
|
||||
format.Mime
|
||||
));
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery != "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
@ -108,7 +87,7 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass, fileType) {
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
@ -124,7 +103,7 @@ if (typeof jQuery != "undefined") {
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
if (ConverExtList.indexOf(posExt) == -1) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
return;
|
||||
@ -137,7 +116,7 @@ if (typeof jQuery != "undefined") {
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ filename: fileName, filePass: filePass, fileExt: fileType }),
|
||||
data: JSON.stringify({ filename: fileName, filePass: filePass }),
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -153,12 +132,6 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")) {
|
||||
jq("#select-file-type").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);
|
||||
@ -170,7 +143,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (response.step && response.step < 100) {
|
||||
checkConvert(filePass, fileType);
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
@ -205,10 +178,10 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#beginView, #beginEmbedded").removeClass("disable");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (formatManager.isEditable(posExt) || formatManager.isFillable(posExt)) {
|
||||
if (EditedExtList.indexOf(posExt) != -1 || FillExtList.indexOf(posExt) != -1) {
|
||||
jq("#beginEdit").removeClass("disable");
|
||||
}
|
||||
};
|
||||
@ -240,15 +213,6 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
};
|
||||
|
||||
jq(document).on("click", ".file-type:not(.disable)", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileType = currentElement.attr("data");
|
||||
var filePass = jq("#hiddenFileName").attr("placeholder");
|
||||
jq('.file-type').addClass(["disable", "pale"]);
|
||||
currentElement.removeClass("pale");
|
||||
checkConvert(filePass, fileType);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var filePass = jq("#filePass").val();
|
||||
if (filePass) {
|
||||
@ -330,23 +294,6 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
});
|
||||
|
||||
jq(document).on("click", ".clear-all", function () {
|
||||
if (confirm("Delete all the files?")) {
|
||||
var requestAddress = "webeditor.ashx"
|
||||
+ "?type=remove";
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "text/xml",
|
||||
url: requestAddress,
|
||||
complete: function (data) {
|
||||
if (JSON.parse(data.responseText).success) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showUserTooltip (isMobile) {
|
||||
if ( jq("div#portal-info").is(":hidden") ) {
|
||||
jq("div#portal-info").show();
|
||||
|
||||
@ -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,28 +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,
|
||||
});
|
||||
};
|
||||
<% } %>
|
||||
|
||||
config.events['onRequestSaveAs'] = onRequestSaveAs;
|
||||
// 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;
|
||||
@ -348,7 +341,17 @@
|
||||
config.events['onRequestOpen'] = onRequestOpen;
|
||||
}
|
||||
|
||||
if (config.editorConfig.createUrl) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
|
||||
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
|
||||
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
|
||||
return;
|
||||
}
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
|
||||
@ -151,14 +151,7 @@
|
||||
if (storedFiles.Any())
|
||||
{ %>
|
||||
<div class="stored-list">
|
||||
<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>
|
||||
@ -302,15 +295,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="select-file-type" class="invisible">
|
||||
<br />
|
||||
<span class="step">Please select the current document type</span>
|
||||
<div class="buttonsMobile indent">
|
||||
<div class="button file-type document" data="docx">Document</div>
|
||||
<div class="button file-type spreadsheet" data="xlsx">Spreadsheet</div>
|
||||
<div class="button file-type 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>
|
||||
@ -373,6 +357,9 @@
|
||||
<%: Scripts.Render("~/bundles/jquery", "~/bundles/scripts") %>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var FillExtList = '<%= string.Join(",", DocManagerHelper.FillFormExts.ToArray()) %>';
|
||||
var ConverExtList = '<%= string.Join(",", DocManagerHelper.ConvertExts.ToArray()) %>';
|
||||
var EditedExtList = '<%= string.Join(",", DocManagerHelper.EditedExts.ToArray()) %>';
|
||||
var UrlConverter = '<%= Url.Content("~/webeditor.ashx?type=convert") %>';
|
||||
var UrlEditor = '<%= Url.Action("editor", "Home") %>';
|
||||
</script>
|
||||
|
||||
@ -87,9 +87,6 @@ namespace OnlineEditorsExampleMVC
|
||||
case "reference":
|
||||
Reference(context);
|
||||
break;
|
||||
case "formats":
|
||||
Formats(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -243,13 +240,7 @@ namespace OnlineEditorsExampleMVC
|
||||
var fileUri = DocManagerHelper.GetDownloadUrl(fileName);
|
||||
|
||||
var extension = (Path.GetExtension(fileName).ToLower() ?? "").Trim('.');
|
||||
string conversionExtension = "ooxml";
|
||||
object fileExt;
|
||||
|
||||
if (body.TryGetValue("fileExt", out fileExt) && !String.IsNullOrEmpty(fileExt.ToString()))
|
||||
{
|
||||
conversionExtension = fileExt.ToString();
|
||||
}
|
||||
var internalExtension = "ooxml";
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (DocManagerHelper.ConvertExts.Contains("." + extension))
|
||||
@ -267,7 +258,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, internalExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
@ -402,17 +393,8 @@ namespace OnlineEditorsExampleMVC
|
||||
context.Response.ContentType = "text/plain";
|
||||
try
|
||||
{
|
||||
string fileName = context.Request["fileName"];
|
||||
|
||||
if (!String.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = Path.GetFileName(context.Request["fileName"]);
|
||||
Remove(fileName); // remove a file and its history if it exists
|
||||
}
|
||||
else
|
||||
{
|
||||
RemoveUserDirectory(); // remove the user's directory
|
||||
}
|
||||
var fileName = Path.GetFileName(context.Request["fileName"]);
|
||||
Remove(fileName); // remove a file and its history if it exists
|
||||
|
||||
context.Response.Write("{ \"success\": true }");
|
||||
}
|
||||
@ -432,14 +414,6 @@ namespace OnlineEditorsExampleMVC
|
||||
if (Directory.Exists(histDir)) Directory.Delete(histDir, true);
|
||||
}
|
||||
|
||||
// remove the user's directory
|
||||
private static void RemoveUserDirectory()
|
||||
{
|
||||
var path = DocManagerHelper.StoragePath("", null); // get the path to the user directory
|
||||
|
||||
if (Directory.Exists(path)) Directory.Delete(path, true);
|
||||
}
|
||||
|
||||
// get files information
|
||||
private static void Files(HttpContext context)
|
||||
{
|
||||
@ -977,25 +951,6 @@ namespace OnlineEditorsExampleMVC
|
||||
return history;
|
||||
}
|
||||
|
||||
// return all the supported formats
|
||||
private static void Formats(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> data = new Dictionary<string, object>
|
||||
{
|
||||
{ "formats", FormatManager.All() }
|
||||
};
|
||||
context.Response.ContentType = "application/json";
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
context.Response.Write(jss.Serialize(data));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -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|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-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|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-CS: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.url.site" value="http://documentserver/"/>
|
||||
|
||||
|
||||
BIN
web/documentserver-example/csharp/App_Themes/images/logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
@ -502,17 +502,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@ -230,33 +230,6 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
padding: 8px 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.button.file-type.disable {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.file-type.pale {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.button.file-type.document {
|
||||
background: #446995;
|
||||
}
|
||||
|
||||
.button.file-type.spreadsheet {
|
||||
background: #40865C;
|
||||
}
|
||||
|
||||
.button.file-type.presentation {
|
||||
background: #AA5252;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
float: left;
|
||||
padding: 24px 0;
|
||||
@ -623,29 +596,6 @@ footer a:hover {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -795,16 +745,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.buttonsMobile.indent{
|
||||
padding-left: 35px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
|
||||
@ -153,14 +153,7 @@
|
||||
if (storedFiles.Any())
|
||||
{ %>
|
||||
<div class="stored-list">
|
||||
<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 >
|
||||
@ -304,15 +297,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="select-file-type" class="invisible">
|
||||
<br />
|
||||
<span class="step">Please select the current document type</span>
|
||||
<div class="buttonsMobile indent">
|
||||
<div class="button file-type document" data="docx">Document</div>
|
||||
<div class="button file-type spreadsheet" data="xlsx">Spreadsheet</div>
|
||||
<div class="button file-type 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>
|
||||
@ -380,8 +364,12 @@
|
||||
<script language="javascript" type="text/javascript" src="script/jquery.iframe-transport.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="script/jquery.fileupload.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="script/jquery.dropdownToggle.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="script/formats.js"></script>
|
||||
<script language="javascript" type="text/javascript" src="script/jscript.js"></script>
|
||||
<script language="javascript" type="text/javascript">
|
||||
var FillFormExtList = '<%= string.Join(",", FillFormsExts.ToArray()) %>';
|
||||
var ConverExtList = '<%= string.Join(",", ConvertExts.ToArray()) %>';
|
||||
var EditedExtList = '<%= string.Join(",", EditedExts.ToArray()) %>';
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@ -437,14 +437,7 @@ namespace OnlineEditorsExample
|
||||
var lang = context.Request.Cookies.GetOrDefault("ulang", null);
|
||||
|
||||
var extension = (Path.GetExtension(_fileName).ToLower() ?? "").Trim('.');
|
||||
string conversionExtension = "ooxml"; // set the default conversion extension as ooxml
|
||||
object fileExt;
|
||||
|
||||
// change the conversion extension if it was provided in the request body
|
||||
if (body.TryGetValue("fileExt", out fileExt) && !String.IsNullOrEmpty(fileExt.ToString()))
|
||||
{
|
||||
conversionExtension = fileExt.ToString();
|
||||
}
|
||||
var internalExtension = "ooxml";
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (ConvertExts.Contains("." + extension))
|
||||
@ -461,7 +454,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, internalExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
|
||||
|
||||
@ -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,37 +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,
|
||||
});
|
||||
};
|
||||
<% } %>
|
||||
|
||||
config.events['onRequestSaveAs'] = onRequestSaveAs;
|
||||
// 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;
|
||||
@ -349,7 +342,17 @@
|
||||
config.events['onRequestOpen'] = onRequestOpen;
|
||||
}
|
||||
|
||||
if (config.editorConfig.createUrl) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
|
||||
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
|
||||
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
|
||||
return;
|
||||
}
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
|
||||
@ -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()}
|
||||
};
|
||||
|
||||
|
||||
@ -231,10 +231,6 @@ namespace ASC.Api.DocumentConverter
|
||||
|
||||
switch (errorCode)
|
||||
{
|
||||
case -9:
|
||||
// public const int c_nErrorConversionOutputFormatError = -9;
|
||||
errorMessage = String.Format(errorMessageTemplate, "Error conversion output format");
|
||||
break;
|
||||
case -8:
|
||||
// public const int c_nErrorFileVKey = -8;
|
||||
errorMessage = String.Format(errorMessageTemplate, "Error document VKey");
|
||||
|
||||
@ -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" />
|
||||
|
||||
@ -58,9 +58,7 @@ namespace OnlineEditorsExample
|
||||
"Can’t print the file",
|
||||
"Can create new files from the editor",
|
||||
"Can see the information about Group2 users",
|
||||
"Can’t submit forms",
|
||||
"Can't close history",
|
||||
"Can't restore the file version"
|
||||
"Can’t submit forms"
|
||||
};
|
||||
|
||||
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(null, false)
|
||||
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,
|
||||
null
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -87,9 +87,6 @@ namespace OnlineEditorsExample
|
||||
case "reference":
|
||||
Reference(context);
|
||||
break;
|
||||
case "formats":
|
||||
Formats(context);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -225,22 +222,12 @@ namespace OnlineEditorsExample
|
||||
context.Response.ContentType = "text/plain";
|
||||
try
|
||||
{
|
||||
string fileName = context.Request["fileName"];
|
||||
string userAddress = HttpUtility.UrlEncode(_Default.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress));
|
||||
var fileName = Path.GetFileName(context.Request["fileName"]);
|
||||
var path = _Default.StoragePath(fileName, HttpUtility.UrlEncode(_Default.CurUserHostAddress(HttpContext.Current.Request.UserHostAddress)));
|
||||
var histDir = _Default.HistoryDir(path);
|
||||
|
||||
if (!String.IsNullOrEmpty(fileName))
|
||||
{
|
||||
fileName = Path.GetFileName(fileName);
|
||||
var path = _Default.StoragePath(fileName, userAddress);
|
||||
var histDir = _Default.HistoryDir(path);
|
||||
|
||||
if (File.Exists(path)) File.Delete(path); // delete file
|
||||
if (Directory.Exists(histDir)) Directory.Delete(histDir, true); // delete file history
|
||||
} else
|
||||
{
|
||||
string userDir = _Default.StoragePath("", userAddress);
|
||||
if (Directory.Exists(userDir)) Directory.Delete(userDir, true); // delete the user's directory
|
||||
}
|
||||
if (File.Exists(path)) File.Delete(path); // delete file
|
||||
if (Directory.Exists(histDir)) Directory.Delete(histDir, true); // delete file history
|
||||
|
||||
context.Response.Write("{ \"success\": true }");
|
||||
}
|
||||
@ -791,25 +778,5 @@ namespace OnlineEditorsExample
|
||||
+ userAddress;
|
||||
return fileUrl.ToString();
|
||||
}
|
||||
|
||||
// return all the supported formats
|
||||
private static void Formats(HttpContext context)
|
||||
{
|
||||
try
|
||||
{
|
||||
Dictionary<string, object> data = new Dictionary<string, object>
|
||||
{
|
||||
{ "formats", FormatManager.All() }
|
||||
};
|
||||
context.Response.ContentType = "application/json";
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
context.Response.Write(jss.Serialize(data));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,66 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
class Format {
|
||||
constructor(name, type, actions, convert, mime) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.actions = actions;
|
||||
this.convert = convert;
|
||||
this.mime = mime;
|
||||
}
|
||||
|
||||
isAutoConvertible() {
|
||||
return this.actions.includes('auto-convert');
|
||||
}
|
||||
|
||||
isEditable() {
|
||||
return this.actions.includes('edit') || this.actions.includes('lossy-edit');
|
||||
}
|
||||
|
||||
isFillable() {
|
||||
return this.actions.includes('fill');
|
||||
}
|
||||
}
|
||||
|
||||
class FormatManager {
|
||||
formats = [];
|
||||
|
||||
constructor(formats) {
|
||||
if(Array.isArray(formats)) this.formats = formats;
|
||||
}
|
||||
|
||||
findByExtension(extension) {
|
||||
return this.formats.find(format => format.name == extension);
|
||||
}
|
||||
|
||||
isAutoConvertible(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isAutoConvertible();
|
||||
}
|
||||
|
||||
isEditable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isEditable();
|
||||
}
|
||||
|
||||
isFillable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isFillable();
|
||||
}
|
||||
}
|
||||
@ -17,27 +17,6 @@
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch("webeditor.ashx?type=formats")
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.formats) {
|
||||
let formats = [];
|
||||
data.formats.forEach(format => {
|
||||
formats.push(new Format(
|
||||
format.Name,
|
||||
format.Type,
|
||||
format.Actions,
|
||||
format.Convert,
|
||||
format.Mime
|
||||
));
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery != "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
@ -108,7 +87,7 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass, fileType) {
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
@ -124,7 +103,7 @@ if (typeof jQuery != "undefined") {
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
if (ConverExtList.indexOf(posExt) == -1) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
return;
|
||||
@ -137,7 +116,7 @@ if (typeof jQuery != "undefined") {
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ filename: fileName, filePass: filePass, fileExt: fileType }),
|
||||
data: JSON.stringify({ filename: fileName, filePass: filePass }),
|
||||
url: requestAddress,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -153,12 +132,6 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")) {
|
||||
jq("#select-file-type").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);
|
||||
@ -170,7 +143,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (response.step && response.step < 100) {
|
||||
checkConvert(filePass, fileType);
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
@ -205,10 +178,10 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#beginView, #beginEmbedded").removeClass("disable");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (formatManager.isEditable(posExt) || formatManager.isFillable(posExt)) {
|
||||
if (EditedExtList.indexOf(posExt) != -1 || FillFormExtList.indexOf(posExt) != -1) {
|
||||
jq("#beginEdit").removeClass("disable");
|
||||
}
|
||||
};
|
||||
@ -240,15 +213,6 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
};
|
||||
|
||||
jq(document).on("click", ".file-type:not(.disable)", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileType = currentElement.attr("data");
|
||||
var filePass = jq("#hiddenFileName").attr("placeholder");
|
||||
jq('.file-type').addClass(["disable", "pale"]);
|
||||
currentElement.removeClass("pale");
|
||||
checkConvert(filePass, fileType);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var filePass = jq("#filePass").val();
|
||||
if (filePass) {
|
||||
@ -329,24 +293,6 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
});
|
||||
|
||||
jq(document).on("click", ".clear-all", function () {
|
||||
if (confirm("Delete all the files?")) {
|
||||
var requestAddress = "webeditor.ashx"
|
||||
+ "?type=remove";
|
||||
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "text/xml",
|
||||
url: requestAddress,
|
||||
complete: function (data) {
|
||||
if (JSON.parse(data.responseText).success) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showUserTooltip (isMobile) {
|
||||
if ( jq("div#portal-info").is(":hidden") ) {
|
||||
jq("div#portal-info").show();
|
||||
|
||||
@ -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|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-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|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-CS: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.url.site" value="http://documentserver/"/>
|
||||
|
||||
|
||||
@ -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",
|
||||
"Can’t submit forms",
|
||||
"Can't close history",
|
||||
"Can't restore the file version"
|
||||
"Can’t submit forms"
|
||||
);
|
||||
|
||||
// create user 1 with the specified parameters
|
||||
userService.createUser("John Smith", "smith@example.com", descriptionUserFirst,
|
||||
"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||
List.of(FilterState.NULL.toString()), null, true, true, true, new Goback(null, false));
|
||||
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, null);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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
|
||||
|
||||
@ -248,15 +248,15 @@ public class FileController {
|
||||
// get document type (word, cell or slide)
|
||||
DocumentType type = fileUtility.getDocumentType(fileName);
|
||||
|
||||
// get an auto-conversion extension from the request body or set it to the ooxml extension
|
||||
String conversionExtension = body.getFileExt() != null ? body.getFileExt() : "ooxml";
|
||||
// convert to .ooxml
|
||||
String internalFileExt = "ooxml";
|
||||
|
||||
try {
|
||||
// check if the file with such an extension can be converted
|
||||
if (fileUtility.getConvertExts().contains(fileExt)) {
|
||||
String key = serviceConverter.generateRevisionId(fileUri); // generate document key
|
||||
ConvertedData response = serviceConverter // get the URL to the converted file
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
|
||||
.getConvertedData(fileUri, fileExt, internalFileExt, key, filePass, true, lang);
|
||||
|
||||
String newFileUri = response.getUri();
|
||||
String newFileType = "." + response.getFileType();
|
||||
@ -291,33 +291,24 @@ public class FileController {
|
||||
return createUserMetadata(uid, fileName);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
|
||||
// if the operation of file converting is unsuccessful, an error occurs
|
||||
return "{ \"error\": \"" + e.getMessage() + "\"}";
|
||||
}
|
||||
// if the operation of file converting is unsuccessful, an error occurs
|
||||
return "{ \"error\": \"" + "The file can't be converted.\"}";
|
||||
}
|
||||
|
||||
@PostMapping("/delete")
|
||||
@ResponseBody
|
||||
public String delete(@RequestBody final Converter body) { // delete a file
|
||||
try {
|
||||
String filename = body.getFileName();
|
||||
boolean success = false;
|
||||
String fullFileName = fileUtility.getFileName(body.getFileName()); // get full file name
|
||||
|
||||
if (filename != null) {
|
||||
String fullFileName = fileUtility.getFileName(filename); // get full file name
|
||||
// delete a file from the storage and return the status of this operation (true or false)
|
||||
boolean fileSuccess = storageMutator.deleteFile(fullFileName);
|
||||
|
||||
// delete a file from the storage and return the status of this operation (true or false)
|
||||
boolean fileSuccess = storageMutator.deleteFile(fullFileName);
|
||||
// delete file history and return the status of this operation (true or false)
|
||||
boolean historySuccess = storageMutator.deleteFileHistory(fullFileName);
|
||||
|
||||
// delete file history and return the status of this operation (true or false)
|
||||
boolean historySuccess = storageMutator.deleteFileHistory(fullFileName);
|
||||
success = fileSuccess && historySuccess;
|
||||
} else {
|
||||
// delete the user's folder and return the boolean status
|
||||
success = storageMutator.deleteUserFolder();
|
||||
}
|
||||
return "{ \"success\": \"" + (success) + "\"}";
|
||||
return "{ \"success\": \"" + (fileSuccess && historySuccess) + "\"}";
|
||||
} catch (Exception e) {
|
||||
// if the operation of file deleting is unsuccessful, an error occurs
|
||||
return "{ \"error\": \"" + e.getMessage() + "\"}";
|
||||
|
||||
@ -22,10 +22,8 @@ import com.onlyoffice.integration.documentserver.storage.FileStorageMutator;
|
||||
import com.onlyoffice.integration.documentserver.storage.FileStoragePathBuilder;
|
||||
import com.onlyoffice.integration.documentserver.util.Misc;
|
||||
import com.onlyoffice.integration.documentserver.util.file.FileUtility;
|
||||
import com.onlyoffice.integration.documentserver.util.service.FormatService;
|
||||
import com.onlyoffice.integration.entities.User;
|
||||
import com.onlyoffice.integration.services.UserServices;
|
||||
import com.onlyoffice.integration.dto.FormatsList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
@ -35,7 +33,6 @@ import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
@ -64,9 +61,6 @@ public class IndexController {
|
||||
@Autowired
|
||||
private UserServices userService;
|
||||
|
||||
@Autowired
|
||||
private FormatService formatService;
|
||||
|
||||
@Value("${files.docservice.url.site}")
|
||||
private String docserviceSite;
|
||||
|
||||
@ -142,16 +136,16 @@ public class IndexController {
|
||||
@ResponseBody
|
||||
public HashMap<String, String> configParameters() { // get configuration parameters
|
||||
HashMap<String, String> configuration = new HashMap<>();
|
||||
|
||||
configuration.put("FillExtList", String.join(",", fileUtility
|
||||
.getFillExts())); // put a list of the extensions that can be filled to config
|
||||
configuration.put("ConverExtList", String.join(",", fileUtility
|
||||
.getConvertExts())); // put a list of the extensions that can be converted to config
|
||||
configuration.put("EditedExtList", String.join(",", fileUtility
|
||||
.getEditedExts())); // put a list of the extensions that can be edited to config
|
||||
configuration.put("UrlConverter", urlConverter);
|
||||
configuration.put("UrlEditor", urlEditor);
|
||||
|
||||
return configuration;
|
||||
}
|
||||
|
||||
@GetMapping("/formats")
|
||||
@ResponseBody
|
||||
public ResponseEntity<FormatsList> formats() { // return all the supported formats
|
||||
FormatsList list = new FormatsList(formatService.getFormats());
|
||||
return ResponseEntity.ok(list);
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -27,8 +27,7 @@ public enum ConvertErrorType {
|
||||
UNEXPECTED_GUID_ERROR(-5, "Error unexpected guid"),
|
||||
DATABASE_ERROR(-6, "Error database"),
|
||||
DOCUMENT_REQUEST_ERROR(-7, "Error document request"),
|
||||
DOCUMENT_VKEY_ERROR(-8, "Error document VKey"),
|
||||
DOCUMENT_CONVERSION_OUTPUT_ERROR(-9, "Error conversion output format");
|
||||
DOCUMENT_VKEY_ERROR(-8, "Error document VKey");
|
||||
|
||||
private final int code;
|
||||
private final String label;
|
||||
|
||||
@ -31,7 +31,6 @@ public interface FileStorageMutator {
|
||||
boolean createFile(Path path, InputStream stream); // create a new file if it does not exist
|
||||
boolean deleteFile(String fileName); // delete a file
|
||||
boolean deleteFileHistory(String fileName); // delete file history
|
||||
boolean deleteUserFolder(); // delete the user's folder recursively
|
||||
String updateFile(String fileName, byte[] bytes); // update a file
|
||||
boolean writeToFile(String pathName, String payload); // write the payload to the file
|
||||
boolean moveFile(Path source, Path destination); // move a file to the specified destination
|
||||
|
||||
@ -202,11 +202,6 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
|
||||
return historyDeleted || historyWithoutExtDeleted;
|
||||
}
|
||||
|
||||
// delete the user's folder recursively
|
||||
public boolean deleteUserFolder() {
|
||||
return FileSystemUtils.deleteRecursively(new File(getStorageLocation()));
|
||||
}
|
||||
|
||||
// update a file
|
||||
public String updateFile(final String fileName, final byte[] bytes) {
|
||||
Path path = fileUtility
|
||||
|
||||
@ -31,8 +31,6 @@ public class Converter {
|
||||
private String fileName;
|
||||
@JsonProperty("filePass")
|
||||
private String filePass;
|
||||
@JsonProperty("fileExt")
|
||||
private String fileExt;
|
||||
@JsonProperty("lang")
|
||||
private String lang;
|
||||
}
|
||||
|
||||
@ -1,32 +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.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import com.onlyoffice.integration.documentserver.models.Format;
|
||||
import java.util.List;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class FormatsList {
|
||||
private List<Format> formats;
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
@ -47,5 +47,4 @@ public class User extends AbstractEntity {
|
||||
private List<String> descriptions;
|
||||
private Boolean avatar;
|
||||
private String image;
|
||||
private Goback goback;
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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("");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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|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-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|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-CS:Serbian|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
|
||||
|
||||
|
After Width: | Height: | Size: 2.0 KiB |
@ -489,17 +489,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@ -230,33 +230,6 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
padding: 8px 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.button.file-type.disable {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.file-type.pale {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.button.file-type.document {
|
||||
background: #446995;
|
||||
}
|
||||
|
||||
.button.file-type.spreadsheet {
|
||||
background: #40865C;
|
||||
}
|
||||
|
||||
.button.file-type.presentation {
|
||||
background: #AA5252;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
float: left;
|
||||
padding: 24px 0;
|
||||
@ -622,29 +595,6 @@ footer table tr td:first-child {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -802,16 +752,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.buttonsMobile.indent{
|
||||
padding-left: 35px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
|
||||
@ -16,12 +16,18 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var ConverExtList;
|
||||
var EditedExtList;
|
||||
var UrlConverter;
|
||||
var UrlEditor;
|
||||
var FillExtList;
|
||||
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jQuery.post('/config',
|
||||
function(data) {
|
||||
FillExtList = data.FillExtList.split(',');
|
||||
ConverExtList = data.ConverExtList.split(',');
|
||||
EditedExtList = data.EditedExtList.split(',');
|
||||
UrlConverter = data.UrlConverter;
|
||||
UrlEditor = data.UrlEditor;
|
||||
});
|
||||
|
||||
@ -1,66 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
class Format {
|
||||
constructor(name, type, actions, convert, mime) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.actions = actions;
|
||||
this.convert = convert;
|
||||
this.mime = mime;
|
||||
}
|
||||
|
||||
isAutoConvertible() {
|
||||
return this.actions.includes('auto-convert');
|
||||
}
|
||||
|
||||
isEditable() {
|
||||
return this.actions.includes('edit') || this.actions.includes('lossy-edit');
|
||||
}
|
||||
|
||||
isFillable() {
|
||||
return this.actions.includes('fill');
|
||||
}
|
||||
}
|
||||
|
||||
class FormatManager {
|
||||
formats = [];
|
||||
|
||||
constructor(formats) {
|
||||
if(Array.isArray(formats)) this.formats = formats;
|
||||
}
|
||||
|
||||
findByExtension(extension) {
|
||||
return this.formats.find(format => format.name == extension);
|
||||
}
|
||||
|
||||
isAutoConvertible(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isAutoConvertible();
|
||||
}
|
||||
|
||||
isEditable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isEditable();
|
||||
}
|
||||
|
||||
isFillable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isFillable();
|
||||
}
|
||||
}
|
||||
@ -17,27 +17,6 @@
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch('/formats')
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.formats) {
|
||||
let formats = [];
|
||||
data.formats.forEach(format => {
|
||||
formats.push(new Format(
|
||||
format.name,
|
||||
format.type,
|
||||
format.actions,
|
||||
format.convert,
|
||||
format.mime
|
||||
));
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
@ -108,7 +87,7 @@ if (typeof jQuery !== "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass, fileType) {
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer);
|
||||
@ -124,7 +103,7 @@ if (typeof jQuery !== "undefined") {
|
||||
var posExt = fileName.lastIndexOf(".") + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : "";
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
if (ConverExtList.includes(posExt) === -1) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
return;
|
||||
@ -136,7 +115,7 @@ if (typeof jQuery !== "undefined") {
|
||||
contentType: "application/json",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass, fileExt: fileType}),
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass}),
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -152,12 +131,6 @@ if (typeof jQuery !== "undefined") {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")){
|
||||
jq("#select-file-type").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);
|
||||
@ -169,7 +142,7 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (response.step && response.step < 100) {
|
||||
checkConvert(filePass, fileType);
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
@ -207,7 +180,7 @@ if (typeof jQuery !== "undefined") {
|
||||
var posExt = fileName.lastIndexOf(".") + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : "";
|
||||
|
||||
if (formatManager.isEditable(posExt) || formatManager.isFillable(posExt)) {
|
||||
if (EditedExtList.includes(posExt) !== -1 || FillExtList.includes(posExt) !== -1) {
|
||||
jq("#beginEdit").removeClass("disable");
|
||||
}
|
||||
};
|
||||
@ -245,15 +218,6 @@ if (typeof jQuery !== "undefined") {
|
||||
}
|
||||
};
|
||||
|
||||
jq(document).on("click", ".file-type:not(.disable)", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileType = currentElement.attr("data");
|
||||
var filePass = jq("#hiddenFileName").attr("placeholder");
|
||||
jq('.file-type').addClass(["disable", "pale"]);
|
||||
currentElement.removeClass("pale");
|
||||
checkConvert(filePass, fileType);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var pass = jq("#filePass").val();
|
||||
if (pass) {
|
||||
@ -335,24 +299,6 @@ if (typeof jQuery !== "undefined") {
|
||||
});
|
||||
});
|
||||
|
||||
jq(document).on("click", ".clear-all", function () {
|
||||
if (confirm("Delete all the files?")) {
|
||||
jq.ajax({
|
||||
async: true,
|
||||
contentType: "application/json",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({filename: null, filePass: null}),
|
||||
url: "/delete",
|
||||
complete: function (data) {
|
||||
if (JSON.parse(data.responseText).success) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showUserTooltip (isMobile) {
|
||||
if ( jq("div#portal-info").is(":hidden") ) {
|
||||
jq("div#portal-info").show();
|
||||
|
||||
@ -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,30 +275,72 @@
|
||||
"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['onRequestSaveAs'] = onRequestSaveAs;
|
||||
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) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
|
||||
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
|
||||
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
|
||||
return;
|
||||
}
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
|
||||
@ -123,14 +123,7 @@
|
||||
</div>
|
||||
<th:block th:if="${not #lists.isEmpty(files)}">
|
||||
<div class="stored-list">
|
||||
<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>
|
||||
@ -282,15 +275,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="select-file-type" class="invisible">
|
||||
<br />
|
||||
<span class="step">Please select the current document type</span>
|
||||
<div class="buttonsMobile indent">
|
||||
<div class="button file-type document" data="docx">Document</div>
|
||||
<div class="button file-type spreadsheet" data="xlsx">Spreadsheet</div>
|
||||
<div class="button file-type 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>
|
||||
@ -357,7 +341,6 @@
|
||||
<script type="text/javascript" src="scripts/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.dropdownToggle.js"></script>
|
||||
<script type="text/javascript" src="scripts/formats.js"></script>
|
||||
<script type="text/javascript" src="scripts/jscript.js"></script>
|
||||
<script type="text/javascript" src="scripts/converter.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
@ -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
|
||||
|
||||
@ -29,7 +29,6 @@ import helpers.FileUtility;
|
||||
import helpers.ServiceConverter;
|
||||
import helpers.TrackManager;
|
||||
import helpers.Users;
|
||||
import format.FormatManager;
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
import org.json.simple.parser.JSONParser;
|
||||
@ -140,9 +139,6 @@ public class IndexServlet extends HttpServlet {
|
||||
case "historydata":
|
||||
historyData(request, response, writer);
|
||||
break;
|
||||
case "formats":
|
||||
formats(request, response, writer);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -287,8 +283,7 @@ public class IndexServlet extends HttpServlet {
|
||||
String fileUri = DocumentManager.getDownloadUrl(fileName, true);
|
||||
String fileExt = FileUtility.getFileExtension(fileName);
|
||||
FileType fileType = FileUtility.getFileType(fileName);
|
||||
// get an auto-conversion extension from the request body or set it to the ooxml extension
|
||||
String conversionExtension = body.get("fileExt") != null ? (String) body.get("fileExt") : "ooxml";
|
||||
String internalFileExt = "ooxml";
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (DocumentManager.getConvertExts().contains(fileExt)) {
|
||||
@ -297,7 +292,7 @@ public class IndexServlet extends HttpServlet {
|
||||
|
||||
// get the url and file type to the converted file
|
||||
Map<String, String> newFileData = ServiceConverter
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
|
||||
.getConvertedData(fileUri, fileExt, internalFileExt, key, filePass, true, lang);
|
||||
String newFileUri = newFileData.get("fileUrl");
|
||||
String newFileType = "." + newFileData.get("fileType");
|
||||
|
||||
@ -421,23 +416,17 @@ public class IndexServlet extends HttpServlet {
|
||||
final HttpServletResponse response,
|
||||
final PrintWriter writer) {
|
||||
try {
|
||||
String fileName = request.getParameter("filename");
|
||||
if (fileName != null && !fileName.isEmpty()) {
|
||||
fileName = FileUtility.getFileName(fileName);
|
||||
String path = DocumentManager.storagePath(fileName, null);
|
||||
String fileName = FileUtility.getFileName(request.getParameter("filename"));
|
||||
String path = DocumentManager.storagePath(fileName, null);
|
||||
|
||||
// delete file
|
||||
File f = new File(path);
|
||||
delete(f);
|
||||
// delete file
|
||||
File f = new File(path);
|
||||
delete(f);
|
||||
|
||||
// delete file history
|
||||
File hist = new File(DocumentManager.historyDir(path));
|
||||
delete(hist);
|
||||
|
||||
// delete file history
|
||||
File hist = new File(DocumentManager.historyDir(path));
|
||||
delete(hist);
|
||||
} else {
|
||||
// delete the user's folder and all the containing files
|
||||
File userFolder = new File(DocumentManager.storagePath(null, null));
|
||||
delete(userFolder);
|
||||
}
|
||||
writer.write("{ \"success\": true }");
|
||||
} catch (Exception e) {
|
||||
writer.write("{ \"error\": \"" + e.getMessage() + "\"}");
|
||||
@ -1050,16 +1039,6 @@ public class IndexServlet extends HttpServlet {
|
||||
writer.write("{}");
|
||||
}
|
||||
|
||||
private static void formats(final HttpServletRequest request,
|
||||
final HttpServletResponse response,
|
||||
final PrintWriter writer) {
|
||||
Map<String, Object> data = new HashMap<String, Object>();
|
||||
data.put("formats", (new FormatManager()).getFormats());
|
||||
response.setContentType("application/json");
|
||||
Gson gson = new Gson();
|
||||
writer.write(gson.toJson(data));
|
||||
}
|
||||
|
||||
// process get request
|
||||
@Override
|
||||
protected void doGet(final HttpServletRequest request,
|
||||
|
||||
@ -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);
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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("Can’t 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, false)));
|
||||
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, null));
|
||||
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() { }
|
||||
|
||||
@ -27,8 +27,7 @@ public enum ConvertErrorType {
|
||||
UNEXPECTED_GUID_ERROR(-5, "Error unexpected guid"),
|
||||
DATABASE_ERROR(-6, "Error database"),
|
||||
DOCUMENT_REQUEST_ERROR(-7, "Error document request"),
|
||||
DOCUMENT_VKEY_ERROR(-8, "Error document VKey"),
|
||||
CONVERSION_OUTPUT_FORMAT_ERROR(-9, "Error conversion output format");
|
||||
DOCUMENT_VKEY_ERROR(-8, "Error document VKey");
|
||||
|
||||
private final int code;
|
||||
private final String label;
|
||||
|
||||
@ -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|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-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|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-CS: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.secret=
|
||||
files.docservice.header=Authorization
|
||||
|
||||
BIN
web/documentserver-example/java/src/main/webapp/css/img/logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
@ -488,17 +488,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
@ -230,33 +230,6 @@ label .checkbox {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.button.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
padding: 8px 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.button.file-type.disable {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.file-type.pale {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.button.file-type.document {
|
||||
background: #446995;
|
||||
}
|
||||
|
||||
.button.file-type.spreadsheet {
|
||||
background: #40865C;
|
||||
}
|
||||
|
||||
.button.file-type.presentation {
|
||||
background: #AA5252;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
float: left;
|
||||
padding: 24px 0;
|
||||
@ -622,29 +595,6 @@ footer table tr td:first-child {
|
||||
width: 4%;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -798,16 +748,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.buttonsMobile.indent{
|
||||
padding-left: 35px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
|
||||
@ -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,30 +274,74 @@
|
||||
"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['onRequestSaveAs'] = onRequestSaveAs;
|
||||
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) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
|
||||
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
|
||||
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
|
||||
return;
|
||||
}
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
|
||||
@ -146,14 +146,7 @@
|
||||
</div>
|
||||
<% if (files.length > 0) { %>
|
||||
<div class="stored-list">
|
||||
<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>
|
||||
@ -306,15 +299,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="select-file-type" class="invisible">
|
||||
<br />
|
||||
<span class="step">Please select the current document type</span>
|
||||
<div class="buttonsMobile indent">
|
||||
<div class="button file-type document" data="docx">Document</div>
|
||||
<div class="button file-type spreadsheet" data="xlsx">Spreadsheet</div>
|
||||
<div class="button file-type 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>
|
||||
@ -381,10 +365,12 @@
|
||||
<script type="text/javascript" src="scripts/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.dropdownToggle.js"></script>
|
||||
<script type="text/javascript" src="scripts/formats.js"></script>
|
||||
<script type="text/javascript" src="scripts/jscript.js"></script>
|
||||
|
||||
<script language="javascript" type="text/javascript">
|
||||
var FillExtList = "<%= String.join(",", DocumentManager.getFillExts()) %>".split(",");
|
||||
var ConverExtList = "<%= String.join(",", DocumentManager.getConvertExts()) %>".split(",");
|
||||
var EditedExtList = "<%= String.join(",", DocumentManager.getEditedExts()) %>".split(",");
|
||||
var UrlConverter = "IndexServlet?type=convert";
|
||||
var UrlEditor = "EditorServlet";
|
||||
|
||||
|
||||
@ -1,66 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
class Format {
|
||||
constructor(name, type, actions, convert, mime) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.actions = actions;
|
||||
this.convert = convert;
|
||||
this.mime = mime;
|
||||
}
|
||||
|
||||
isAutoConvertible() {
|
||||
return this.actions.includes('auto-convert');
|
||||
}
|
||||
|
||||
isEditable() {
|
||||
return this.actions.includes('edit') || this.actions.includes('lossy-edit');
|
||||
}
|
||||
|
||||
isFillable() {
|
||||
return this.actions.includes('fill');
|
||||
}
|
||||
}
|
||||
|
||||
class FormatManager {
|
||||
formats = [];
|
||||
|
||||
constructor(formats) {
|
||||
if(Array.isArray(formats)) this.formats = formats;
|
||||
}
|
||||
|
||||
findByExtension(extension) {
|
||||
return this.formats.find(format => format.name == extension);
|
||||
}
|
||||
|
||||
isAutoConvertible(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isAutoConvertible();
|
||||
}
|
||||
|
||||
isEditable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isEditable();
|
||||
}
|
||||
|
||||
isFillable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isFillable();
|
||||
}
|
||||
}
|
||||
@ -17,27 +17,6 @@
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch('IndexServlet?type=formats')
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.formats) {
|
||||
let formats = [];
|
||||
data.formats.forEach(format => {
|
||||
formats.push(new Format(
|
||||
format.name,
|
||||
format.type,
|
||||
format.actions,
|
||||
format.convert,
|
||||
format.mime
|
||||
));
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
@ -108,7 +87,7 @@ if (typeof jQuery !== "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass, fileType) {
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer !== null) {
|
||||
clearTimeout(timer);
|
||||
@ -124,7 +103,7 @@ if (typeof jQuery !== "undefined") {
|
||||
var posExt = fileName.lastIndexOf(".") + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : "";
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
if (!ConverExtList.includes(posExt)) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
return;
|
||||
@ -136,7 +115,7 @@ if (typeof jQuery !== "undefined") {
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass, fileExt: fileType}),
|
||||
data: JSON.stringify({filename: fileName, filePass: filePass}),
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -152,12 +131,6 @@ if (typeof jQuery !== "undefined") {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("Error conversion output format")){
|
||||
jq("#select-file-type").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);
|
||||
@ -169,7 +142,7 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (response.step && response.step < 100) {
|
||||
checkConvert(filePass, fileType);
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
@ -207,7 +180,7 @@ if (typeof jQuery !== "undefined") {
|
||||
var posExt = fileName.lastIndexOf(".") + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : "";
|
||||
|
||||
if (formatManager.isEditable(posExt) || formatManager.isFillable(posExt)) {
|
||||
if (EditedExtList.includes(posExt) || FillExtList.includes(posExt)) {
|
||||
jq("#beginEdit").removeClass("disable");
|
||||
}
|
||||
};
|
||||
@ -239,15 +212,6 @@ if (typeof jQuery !== "undefined") {
|
||||
});
|
||||
};
|
||||
|
||||
jq(document).on("click", ".file-type:not(.disable)", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileType = currentElement.attr("data");
|
||||
var filePass = jq("#hiddenFileName").attr("placeholder");
|
||||
jq('.file-type').addClass(["disable", "pale"]);
|
||||
currentElement.removeClass("pale");
|
||||
checkConvert(filePass, fileType);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var pass = jq("#filePass").val();
|
||||
if (pass) {
|
||||
@ -326,21 +290,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",
|
||||
url: "IndexServlet?type=remove",
|
||||
complete: function (data) {
|
||||
if (JSON.parse(data.responseText).success) {
|
||||
window.location.reload(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function showUserTooltip (isMobile) {
|
||||
if ( jq("div#portal-info").is(":hidden") ) {
|
||||
jq("div#portal-info").show();
|
||||
|
||||
@ -93,6 +93,8 @@ app.get('/', (req, res) => { // define a handler for default page
|
||||
|
||||
res.render('index', { // render index template with the parameters specified
|
||||
preloaderUrl: siteUrl + configServer.get('preloaderUrl'),
|
||||
convertExts: fileUtility.getConvertExtensions(),
|
||||
editedExts: fileUtility.getEditExtensions(),
|
||||
fillExts: fileUtility.getFillExtensions(),
|
||||
storedFiles: req.DocManager.getStoredFiles(),
|
||||
params: req.DocManager.getCustomParams(),
|
||||
@ -211,7 +213,7 @@ app.post('/upload', (req, res) => { // define a handler for uploading files
|
||||
return;
|
||||
}
|
||||
|
||||
const file = files.uploadedFile[0];
|
||||
const file = files.uploadedFile;
|
||||
|
||||
if (file === undefined) { // if file parameter is undefined
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' }); // write the error status and message to the response
|
||||
@ -220,7 +222,7 @@ app.post('/upload', (req, res) => { // define a handler for uploading files
|
||||
return;
|
||||
}
|
||||
|
||||
file.originalFilename = req.DocManager.getCorrectName(file.originalFilename);
|
||||
file.name = req.DocManager.getCorrectName(file.name);
|
||||
|
||||
// check if the file size exceeds the maximum file size
|
||||
if (configServer.get('maxFileSize') < file.size || file.size <= 0) {
|
||||
@ -232,8 +234,8 @@ app.post('/upload', (req, res) => { // define a handler for uploading files
|
||||
}
|
||||
|
||||
const exts = fileUtility.getSuppotredExtensions(); // all the supported file extensions
|
||||
const curExt = fileUtility.getFileExtension(file.originalFilename, true);
|
||||
const documentType = fileUtility.getFileType(file.originalFilename);
|
||||
const curExt = fileUtility.getFileExtension(file.name, true);
|
||||
const documentType = fileUtility.getFileType(file.name);
|
||||
|
||||
if (exts.indexOf(curExt) === -1) { // check if the file extension is supported
|
||||
// DocManager.cleanFolderRecursive(uploadDirTmp, true); // if not, clean the folder with temporary files
|
||||
@ -243,19 +245,19 @@ app.post('/upload', (req, res) => { // define a handler for uploading files
|
||||
return;
|
||||
}
|
||||
|
||||
fileSystem.rename(file.filepath, `${uploadDir}/${file.originalFilename}`, (error) => { // rename a file
|
||||
fileSystem.rename(file.path, `${uploadDir}/${file.name}`, (error) => { // rename a file
|
||||
// DocManager.cleanFolderRecursive(uploadDirTmp, true); // clean the folder with temporary files
|
||||
res.writeHead(200, { 'Content-Type': 'text/plain' });
|
||||
if (error) { // if an error occurs
|
||||
res.write(`{ "error": "${error}"}`); // write an error message to the response
|
||||
} else {
|
||||
// otherwise, write a new file name to the response
|
||||
res.write(`{ "filename": "${file.originalFilename}", "documentType": "${documentType}" }`);
|
||||
res.write(`{ "filename": "${file.name}", "documentType": "${documentType}" }`);
|
||||
|
||||
// get user id and name parameters or set them to the default values
|
||||
const user = users.getUser(req.query.userid);
|
||||
|
||||
req.DocManager.saveFileData(file.originalFilename, user.id, user.name);
|
||||
req.DocManager.saveFileData(file.name, user.id, user.name);
|
||||
}
|
||||
res.end();
|
||||
});
|
||||
@ -331,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';
|
||||
const convExt = req.body.fileExt ? req.body.fileExt : internalFileExt;
|
||||
const { keepOriginal } = req.body;
|
||||
const response = res;
|
||||
|
||||
const writeResult = function writeResult(filename, step, error) {
|
||||
@ -380,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 (!keepOriginal) 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 (!keepOriginal) {
|
||||
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);
|
||||
@ -655,7 +643,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
const zip = await urllib.request(downloadZip, { method: 'GET' });
|
||||
const statusZip = zip.status;
|
||||
const dataZip = zip.data;
|
||||
if (statusZip === 200) {
|
||||
if (status === 200) {
|
||||
fileSystem.writeFileSync(pathChanges, dataZip); // write the document version differences to the archive
|
||||
} else {
|
||||
emitWarning(`Document editing service returned status: ${statusZip}`);
|
||||
@ -686,7 +674,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
response.write(`{"error":1,"message":${JSON.stringify(ex)}}`);
|
||||
response.write('{"error":1}');
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
@ -698,7 +686,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
// file saving process
|
||||
const processSave = async function processSave(downloadUri, body, fileName, userAddress) {
|
||||
if (!downloadUri) {
|
||||
response.write('{"error":1,"message":"save uri is empty"}');
|
||||
response.write('{"error":1}');
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
@ -809,8 +797,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
}
|
||||
}
|
||||
} catch (ex) {
|
||||
console.log(ex);
|
||||
response.write(`{"error":1,"message":${JSON.stringify(ex)}}`);
|
||||
response.write('{"error":1}');
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
@ -822,7 +809,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
// file force saving process
|
||||
const processForceSave = async function processForceSave(downloadUri, body, fileName, userAddress) {
|
||||
if (!downloadUri) {
|
||||
response.write('{"error":1,"message":"forcesave uri is empty"}');
|
||||
response.write('{"error":1}');
|
||||
response.end();
|
||||
return;
|
||||
}
|
||||
@ -914,7 +901,7 @@ app.post('/track', async (req, res) => { // define a handler for tracking file c
|
||||
}
|
||||
}
|
||||
if (!body) {
|
||||
res.write('{"error":1,"message":"body is empty"}');
|
||||
res.write('{"error":1}');
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
@ -933,27 +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) {
|
||||
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?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 {
|
||||
@ -995,21 +970,25 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
const { userInfoGroups } = user;
|
||||
|
||||
const usersInfo = [];
|
||||
const usersForProtect = [];
|
||||
if (user.id !== 'uid-0') {
|
||||
users.getAllUsers().forEach((userInfo) => {
|
||||
const u = userInfo;
|
||||
u.image = userInfo.avatar ? `${req.DocManager.getServerUrl()}/images/${userInfo.id}.png` : null;
|
||||
usersInfo.push(u);
|
||||
}, usersInfo);
|
||||
|
||||
users.getUsersForProtect(user.id).forEach((userInfo) => {
|
||||
const u = userInfo;
|
||||
u.image = userInfo.avatar ? `${req.DocManager.getServerUrl()}/images/${userInfo.id}.png` : null;
|
||||
usersForProtect.push(u);
|
||||
}, usersForProtect);
|
||||
}
|
||||
|
||||
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();
|
||||
@ -1020,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;
|
||||
}
|
||||
@ -1037,10 +1018,6 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
submitForm = userid === 'uid-1';
|
||||
}
|
||||
|
||||
if (user.goback != null) {
|
||||
user.goback.url = `${req.DocManager.getServerUrl()}`;
|
||||
}
|
||||
|
||||
// file config data
|
||||
const argss = {
|
||||
apiUrl: siteUrl + configServer.get('apiUrl'),
|
||||
@ -1074,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,
|
||||
@ -1091,13 +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',
|
||||
@ -1112,7 +1089,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
directUrl: !userDirectUrl ? null : `${req.DocManager.getServerUrl()}/csv`,
|
||||
},
|
||||
usersForMentions: user.id !== 'uid-0' ? users.getUsersForMentions(user.id) : null,
|
||||
usersForProtect,
|
||||
usersForProtect: user.id !== 'uid-0' ? users.getUsersForProtect(user.id) : null,
|
||||
usersInfo,
|
||||
};
|
||||
|
||||
@ -1196,19 +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
|
||||
|
||||
@ -51,7 +51,6 @@
|
||||
"cs": "Czech",
|
||||
"da": "Danish",
|
||||
"nl": "Dutch",
|
||||
"en-GB": "English (United Kingdom)",
|
||||
"fi": "Finnish",
|
||||
"fr": "French",
|
||||
"gl": "Galego",
|
||||
@ -71,7 +70,7 @@
|
||||
"pt-PT": "Portuguese (Portugal)",
|
||||
"ro": "Romanian",
|
||||
"ru": "Russian",
|
||||
"sr-Latn-RS": "Serbian",
|
||||
"sr-Latn-CS": "Serbian",
|
||||
"si": "Sinhala (Sri Lanka)",
|
||||
"sk": "Slovak",
|
||||
"sl": "Slovenian",
|
||||
|
||||
@ -51,7 +51,7 @@ DocManager.prototype.createDirectory = function createDirectory(directory) {
|
||||
|
||||
// get the language from the request
|
||||
DocManager.prototype.getLang = function getLang() {
|
||||
if (/^[a-z]{2}(-[a-zA-z]{4})?(-[A-Z]{2})?$/.test(this.req.query.lang)) {
|
||||
if (/^[a-z]{2}(-[A-z]{4})?(-[A-Z]{2})?$/.test(this.req.query.lang)) {
|
||||
return this.req.query.lang;
|
||||
} // the default language value is English
|
||||
return 'en';
|
||||
|
||||
@ -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 = {
|
||||
|
||||
@ -30,7 +30,6 @@ class User {
|
||||
descriptions,
|
||||
templates,
|
||||
avatar,
|
||||
goback,
|
||||
close,
|
||||
) {
|
||||
this.id = id;
|
||||
@ -45,7 +44,6 @@ class User {
|
||||
this.descriptions = descriptions;
|
||||
this.templates = templates;
|
||||
this.avatar = avatar;
|
||||
this.goback = goback;
|
||||
this.close = close;
|
||||
}
|
||||
}
|
||||
@ -84,8 +82,6 @@ const descrUser3 = [
|
||||
'Can create new files from the editor',
|
||||
'Can see the information about Group2 users',
|
||||
'Can’t submit forms',
|
||||
'Can’t close history',
|
||||
'Can’t restore the file version',
|
||||
];
|
||||
|
||||
const descrUser0 = [
|
||||
@ -118,7 +114,6 @@ const users = [
|
||||
descrUser1,
|
||||
true,
|
||||
true,
|
||||
{ blank: false },
|
||||
{ visible: false },
|
||||
),
|
||||
new User(
|
||||
@ -138,7 +133,6 @@ const users = [
|
||||
descrUser2,
|
||||
false,
|
||||
true,
|
||||
{ text: 'Go to Documents' },
|
||||
{},
|
||||
),
|
||||
new User(
|
||||
@ -158,10 +152,9 @@ const users = [
|
||||
descrUser3,
|
||||
false,
|
||||
false,
|
||||
null,
|
||||
{},
|
||||
),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null),
|
||||
];
|
||||
|
||||
// get a list of all the users
|
||||
@ -199,7 +192,10 @@ users.getUsersForProtect = function getUsersForProtect(id) {
|
||||
const result = [];
|
||||
this.forEach((user) => {
|
||||
if (user.id !== id && user.name != null) {
|
||||
result.push(user);
|
||||
result.push({
|
||||
id: user.id,
|
||||
name: user.name,
|
||||
});
|
||||
}
|
||||
});
|
||||
return result;
|
||||
|
||||
@ -187,12 +187,13 @@ const putFile = function putFile(wopi, req, res, userHost) {
|
||||
|
||||
const userAddress = req.DocManager.curUserHostAddress(userHost);
|
||||
const storagePath = req.DocManager.storagePath(wopi.id, userAddress);
|
||||
const fileSize = fileSystem.statSync(storagePath).size;
|
||||
|
||||
if (!lockManager.hasLock(storagePath) && fileSize !== 0) {
|
||||
if (!lockManager.hasLock(storagePath)) {
|
||||
// ToDo: if body length is 0 bytes => handle document creation
|
||||
|
||||
// file isn't locked => mismatch
|
||||
returnLockMismatch(res, '', 'File isn\'t locked');
|
||||
} else if (lockManager.getLock(storagePath) === requestLock || fileSize === 0) {
|
||||
} else if (lockManager.getLock(storagePath) === requestLock) {
|
||||
// lock matches current lock => put file
|
||||
saveFileFromBody(req, wopi.id, userAddress, true, (err, version) => {
|
||||
if (!err) {
|
||||
|
||||
@ -27,72 +27,57 @@ const siteUrl = configServer.get('siteUrl'); // the path to the editors installa
|
||||
|
||||
let cache = null;
|
||||
|
||||
const requestDiscovery = async function requestDiscovery(DocManager) {
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf('/') === 0) {
|
||||
absSiteUrl = DocManager.getServerHost() + siteUrl;
|
||||
}
|
||||
|
||||
const requestDiscovery = async function requestDiscovery(url) {
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
return new Promise((resolve, reject) => {
|
||||
const uri = absSiteUrl + configServer.get('wopi.discovery');
|
||||
const actions = [];
|
||||
|
||||
// parse url to allow request by relative url after
|
||||
// https://github.com/node-modules/urllib/pull/321/commits/514de1924bf17a38a6c2db2a22a6bc3494c0a959
|
||||
urllib.request(
|
||||
urlModule.parse(uri),
|
||||
{
|
||||
method: 'GET',
|
||||
},
|
||||
(err, data) => {
|
||||
if (data) {
|
||||
// create the discovery XML file with the parameters from the response
|
||||
const xmlParseOptions = {
|
||||
attributeNamePrefix: '',
|
||||
ignoreAttributes: false,
|
||||
parseAttributeValue: true,
|
||||
attrValueProcessor: (val) => he.decode(val, { isAttributeValue: true }),
|
||||
};
|
||||
const parser = new xmlParser.XMLParser(xmlParseOptions);
|
||||
// create the discovery XML file with the parameters from the response
|
||||
const discovery = parser.parse(data.toString());
|
||||
if (discovery['wopi-discovery']) {
|
||||
discovery['wopi-discovery']['net-zone'].app.forEach((app) => {
|
||||
let appAction = app.action;
|
||||
if (!Array.isArray(appAction)) {
|
||||
appAction = [appAction];
|
||||
}
|
||||
appAction.forEach((action) => {
|
||||
actions.push({ // write all the parameters to the actions element
|
||||
app: app.name,
|
||||
favIconUrl: app.favIconUrl,
|
||||
checkLicense: app.checkLicense === 'true',
|
||||
name: action.name,
|
||||
ext: action.ext || '',
|
||||
progid: action.progid || '',
|
||||
isDefault: !!action.default,
|
||||
urlsrc: action.urlsrc,
|
||||
requires: action.requires || '',
|
||||
});
|
||||
urllib.request(urlModule.parse(url + configServer.get('wopi.discovery')), { method: 'GET' }, (err, data) => {
|
||||
if (data) {
|
||||
// create the discovery XML file with the parameters from the response
|
||||
const xmlParseOptions = {
|
||||
attributeNamePrefix: '',
|
||||
ignoreAttributes: false,
|
||||
parseAttributeValue: true,
|
||||
attrValueProcessor: (val) => he.decode(val, { isAttributeValue: true }),
|
||||
};
|
||||
const parser = new xmlParser.XMLParser(xmlParseOptions);
|
||||
// create the discovery XML file with the parameters from the response
|
||||
const discovery = parser.parse(data.toString());
|
||||
if (discovery['wopi-discovery']) {
|
||||
discovery['wopi-discovery']['net-zone'].app.forEach((app) => {
|
||||
let appAction = app.action;
|
||||
if (!Array.isArray(appAction)) {
|
||||
appAction = [appAction];
|
||||
}
|
||||
appAction.forEach((action) => {
|
||||
actions.push({ // write all the parameters to the actions element
|
||||
app: app.name,
|
||||
favIconUrl: app.favIconUrl,
|
||||
checkLicense: app.checkLicense === 'true',
|
||||
name: action.name,
|
||||
ext: action.ext || '',
|
||||
progid: action.progid || '',
|
||||
isDefault: !!action.default,
|
||||
urlsrc: action.urlsrc,
|
||||
requires: action.requires || '',
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
resolve(actions);
|
||||
},
|
||||
);
|
||||
}
|
||||
resolve(actions);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
// get the wopi discovery information
|
||||
const getDiscoveryInfo = async function getDiscoveryInfo(DocManager) {
|
||||
const getDiscoveryInfo = async function getDiscoveryInfo(url) {
|
||||
let actions = [];
|
||||
|
||||
if (cache) return cache;
|
||||
|
||||
try {
|
||||
actions = await requestDiscovery(DocManager);
|
||||
actions = await requestDiscovery(url);
|
||||
} catch (e) {
|
||||
return actions;
|
||||
}
|
||||
@ -106,9 +91,19 @@ const getDiscoveryInfo = async function getDiscoveryInfo(DocManager) {
|
||||
return actions;
|
||||
};
|
||||
|
||||
const initWopi = async function initWopi(DocManager) {
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf('/') === 0) {
|
||||
absSiteUrl = DocManager.getServerHost() + siteUrl;
|
||||
}
|
||||
|
||||
// get the wopi discovery information
|
||||
await getDiscoveryInfo(absSiteUrl);
|
||||
};
|
||||
|
||||
// get actions of the specified extension
|
||||
const getActions = async function getActions(DocManager, ext) {
|
||||
const actions = await getDiscoveryInfo(DocManager); // get the wopi discovery information
|
||||
const getActions = async function getActions(ext) {
|
||||
const actions = await getDiscoveryInfo(); // get the wopi discovery information
|
||||
const filtered = [];
|
||||
|
||||
actions.forEach((action) => { // and filter it by the specified extention
|
||||
@ -121,8 +116,8 @@ const getActions = async function getActions(DocManager, ext) {
|
||||
};
|
||||
|
||||
// get an action for the specified extension and name
|
||||
const getAction = async function getAction(DocManager, ext, name) {
|
||||
const actions = await getDiscoveryInfo(DocManager);
|
||||
const getAction = async function getAction(ext, name) {
|
||||
const actions = await getDiscoveryInfo();
|
||||
let act = null;
|
||||
|
||||
actions.forEach((action) => {
|
||||
@ -135,8 +130,8 @@ const getAction = async function getAction(DocManager, ext, name) {
|
||||
};
|
||||
|
||||
// get the default action for the specified extension
|
||||
const getDefaultAction = async function getDefaultAction(DocManager, ext) {
|
||||
const actions = await getDiscoveryInfo(DocManager);
|
||||
const getDefaultAction = async function getDefaultAction(ext) {
|
||||
const actions = await getDiscoveryInfo();
|
||||
let act = null;
|
||||
|
||||
actions.forEach((action) => {
|
||||
@ -154,6 +149,7 @@ const getActionUrl = function getActionUrl(host, userAddress, action, filename)
|
||||
return `${action.urlsrc.replace(/<.*&>/g, '')}WOPISrc=${encodeURIComponent(WOPISrc)}`;
|
||||
};
|
||||
|
||||
exports.initWopi = initWopi;
|
||||
exports.getDiscoveryInfo = getDiscoveryInfo;
|
||||
exports.getAction = getAction;
|
||||
exports.getActions = getActions;
|
||||
|
||||
@ -45,13 +45,15 @@ exports.registerRoutes = function registerRoutes(app) {
|
||||
app.get('/wopi', async (req, res) => {
|
||||
req.DocManager = new DocManager(req, res);
|
||||
|
||||
await utils.initWopi(req.DocManager);
|
||||
|
||||
// get the wopi discovery information
|
||||
const actions = await utils.getDiscoveryInfo(req.DocManager);
|
||||
const actions = await utils.getDiscoveryInfo();
|
||||
const wopiEnable = actions.length !== 0;
|
||||
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
|
||||
@ -65,13 +67,11 @@ exports.registerRoutes = function registerRoutes(app) {
|
||||
// run through all the files and write the corresponding information to each file
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
for (const file of files) {
|
||||
const mobile = new RegExp(configServer.get('mobileRegEx'), 'i').test(req.get('User-Agent'));
|
||||
const ext = fileUtility.getFileExtension(file.name, true); // get an extension of each file
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
file.actions = await utils.getActions(req.DocManager, ext); // get actions of the specified extension
|
||||
file.actions = await utils.getActions(ext); // get actions of the specified extension
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
file.defaultAction = await utils.getDefaultAction(req.DocManager, ext);// get the default action for extension
|
||||
if (mobile) file.actions.forEach((act) => { if (act.name === 'mobileEdit') file.defaultAction = act; });
|
||||
file.defaultAction = await utils.getDefaultAction(ext);// get the default action of the specified extension
|
||||
}
|
||||
|
||||
// render wopiIndex template with the parameters specified
|
||||
@ -111,12 +111,14 @@ exports.registerRoutes = function registerRoutes(app) {
|
||||
try {
|
||||
req.DocManager = new DocManager(req, res);
|
||||
|
||||
await utils.initWopi(req.DocManager);
|
||||
|
||||
let fileName = req.DocManager.getCorrectName(req.params.id);
|
||||
const fileExt = fileUtility.getFileExtension(fileName, true); // get the file extension from the request
|
||||
const user = users.getUser(req.query.userid); // get a user by the id
|
||||
|
||||
// get an action for the specified extension and name
|
||||
const action = await utils.getAction(req.DocManager, fileExt, req.query.action);
|
||||
const action = await utils.getAction(fileExt, req.query.action);
|
||||
|
||||
if (action && req.query.action === 'editnew') {
|
||||
fileName = req.DocManager.requestEditnew(req, fileName, user);
|
||||
|
||||
@ -17,17 +17,17 @@
|
||||
"url": "https://github.com/ONLYOFFICE/document-server-integration/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"body-parser": "^1.20.2",
|
||||
"config": "^3.3.11",
|
||||
"debug": "^4.3.4",
|
||||
"ejs": "^3.1.9",
|
||||
"express": "^4.18.2",
|
||||
"fast-xml-parser": "^4.3.4",
|
||||
"formidable": "^3.2.4",
|
||||
"body-parser": "^1.19.0",
|
||||
"config": "^3.3.2",
|
||||
"debug": "^4.2.0",
|
||||
"ejs": "^3.1.5",
|
||||
"express": "^4.17.1",
|
||||
"fast-xml-parser": "^4.3.1",
|
||||
"formidable": "^1.2.2",
|
||||
"he": "^1.2.0",
|
||||
"jsonwebtoken": "^9.0.2",
|
||||
"jsonwebtoken": "^9.0.0",
|
||||
"jwa": "^2.0.0",
|
||||
"log4js": "^6.9.1",
|
||||
"log4js": "^6.3.0",
|
||||
"mime": "^2.4.6",
|
||||
"serve-favicon": "^2.5.0",
|
||||
"urllib": "^2.36.1"
|
||||
@ -44,16 +44,8 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.56.0",
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.29.1"
|
||||
},
|
||||
"overrides": {
|
||||
"semver": "7.5.2",
|
||||
"word-wrap": "1.2.4",
|
||||
"pac-resolver": "7.0.0",
|
||||
"degenerator": "3.0.1",
|
||||
"qs": "6.7.3",
|
||||
"json5": "2.2.3"
|
||||
"eslint-plugin-import": "^2.26.0"
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 |
|
Before Width: | Height: | Size: 463 B After Width: | Height: | Size: 463 B |
@ -1,3 +0,0 @@
|
||||
<svg width="20" height="17" viewBox="0 0 20 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M8 17V11H12V17H17V9H20L10 0L0 9H3V17H8Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 173 B |
BIN
web/documentserver-example/nodejs/public/images/logo.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
@ -1,66 +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.
|
||||
*
|
||||
*/
|
||||
|
||||
class Format {
|
||||
constructor(name, type, actions, convert, mime) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.actions = actions;
|
||||
this.convert = convert;
|
||||
this.mime = mime;
|
||||
}
|
||||
|
||||
isAutoConvertible() {
|
||||
return this.actions.includes('auto-convert');
|
||||
}
|
||||
|
||||
isEditable() {
|
||||
return this.actions.includes('edit') || this.actions.includes('lossy-edit');
|
||||
}
|
||||
|
||||
isFillable() {
|
||||
return this.actions.includes('fill');
|
||||
}
|
||||
}
|
||||
|
||||
class FormatManager {
|
||||
formats = [];
|
||||
|
||||
constructor(formats) {
|
||||
if(Array.isArray(formats)) this.formats = formats;
|
||||
}
|
||||
|
||||
findByExtension(extension) {
|
||||
return this.formats.find(format => format.name == extension);
|
||||
}
|
||||
|
||||
isAutoConvertible(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isAutoConvertible();
|
||||
}
|
||||
|
||||
isEditable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isEditable();
|
||||
}
|
||||
|
||||
isFillable(extension) {
|
||||
let format = this.findByExtension(extension);
|
||||
return format !== undefined && format.isFillable();
|
||||
}
|
||||
}
|
||||
@ -19,27 +19,6 @@
|
||||
var language;
|
||||
var userid;
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
fetch('formats')
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
if (data.formats) {
|
||||
let formats = [];
|
||||
data.formats.forEach(format => {
|
||||
formats.push(new Format(
|
||||
format.name,
|
||||
format.type,
|
||||
format.actions,
|
||||
format.convert,
|
||||
format.mime
|
||||
));
|
||||
});
|
||||
formatManager = new FormatManager(formats);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
if (typeof jQuery != "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
@ -121,7 +100,7 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function (filePass, fileType) {
|
||||
var checkConvert = function (filePass) {
|
||||
filePass = filePass ? filePass : null;
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
@ -137,7 +116,7 @@ if (typeof jQuery != "undefined") {
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (!formatManager.isAutoConvertible(posExt)) {
|
||||
if (ConverExtList.indexOf(posExt) == -1) {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
return;
|
||||
@ -149,7 +128,7 @@ if (typeof jQuery != "undefined") {
|
||||
async: true,
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {filename: fileName, filePass: filePass, lang: language, fileExt: fileType},
|
||||
data: {filename: fileName, filePass: filePass, lang: language},
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -169,12 +148,6 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
if (response.error.includes("-9")){
|
||||
jq("#select-file-type").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);
|
||||
@ -186,7 +159,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (typeof response.step != "undefined" && response.step < 100) {
|
||||
checkConvert(filePass, fileType);
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
@ -224,20 +197,14 @@ if (typeof jQuery != "undefined") {
|
||||
var posExt = fileName.lastIndexOf('.') + 1;
|
||||
posExt = 0 <= posExt ? fileName.substring(posExt).trim().toLowerCase() : '';
|
||||
|
||||
if (formatManager.isEditable(posExt) || formatManager.isFillable(posExt)) {
|
||||
var checkEdited = EditedExtList.split(",").filter(function(ext) { return ext == posExt;});
|
||||
var checkFilled = FilledExtList.split(",").filter(function(ext) { return ext == posExt;});
|
||||
|
||||
if (checkEdited != "" || checkFilled != "") {
|
||||
jq("#beginEdit").removeClass("disable");
|
||||
}
|
||||
};
|
||||
|
||||
jq(document).on("click", ".file-type:not(.disable)", function () {
|
||||
const currentElement = jq(this);
|
||||
var fileType = currentElement.attr("data");
|
||||
var filePass = jq("#hiddenFileName").attr("placeholder");
|
||||
jq(".file-type").addClass(["disable", "pale"]);
|
||||
currentElement.removeClass("pale");
|
||||
checkConvert(filePass, fileType);
|
||||
});
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var pass = jq("#filePass").val();
|
||||
if (pass) {
|
||||
@ -305,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;
|
||||
@ -358,101 +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 format = formatManager.findByExtension(fileName.split('.').pop());
|
||||
if (format) {
|
||||
format.convert.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, keepOriginal: true},
|
||||
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");
|
||||
@ -479,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");
|
||||
|
||||
@ -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) {
|
||||
|
||||
@ -42,14 +42,10 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
width: 18%;
|
||||
width: 29%;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction {
|
||||
width: 23%;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
width: 21%;
|
||||
padding-right: 18px;
|
||||
@ -83,9 +79,7 @@
|
||||
margin-left: 0;
|
||||
}
|
||||
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 90%;
|
||||
}
|
||||
|
||||
@ -108,10 +102,6 @@
|
||||
.tableHeaderCellRemove {
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
.storedHeaderClearAll {
|
||||
padding-right: 48px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1008px) {
|
||||
@ -129,8 +119,7 @@
|
||||
.contentCells-icon{
|
||||
width: 5%;
|
||||
}
|
||||
.tableRow,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 55%;
|
||||
}
|
||||
|
||||
@ -146,7 +135,7 @@
|
||||
}
|
||||
|
||||
.scroll-table-body {
|
||||
top: 33px;
|
||||
top: 31px;
|
||||
}
|
||||
|
||||
footer {
|
||||
@ -186,9 +175,7 @@
|
||||
}
|
||||
|
||||
@media (max-width: 715px) {
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 45%;
|
||||
}
|
||||
}
|
||||
@ -230,7 +217,7 @@
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 9%;
|
||||
width: 16%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
@ -239,12 +226,7 @@
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
text-align: right;
|
||||
width: 9%;
|
||||
}
|
||||
|
||||
.tableHeaderCellAction{
|
||||
width: 11%;
|
||||
padding-right: 82px;
|
||||
width: 37%;
|
||||
}
|
||||
|
||||
.tableHeaderCellDownload {
|
||||
@ -259,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%;
|
||||
@ -286,9 +263,7 @@
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
@ -298,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 ) {
|
||||
@ -320,16 +286,14 @@
|
||||
width: 20%;
|
||||
}
|
||||
.contentCells-shift {
|
||||
padding-right: 27px;
|
||||
padding-right: 28px;
|
||||
}
|
||||
|
||||
.main-panel {
|
||||
width: 580px;
|
||||
}
|
||||
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 95%;
|
||||
}
|
||||
|
||||
@ -354,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%;
|
||||
}
|
||||
}
|
||||
|
||||
@ -394,10 +349,6 @@
|
||||
.tableRow td:first-child {
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.storedHeaderClearAll {
|
||||
padding-right: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -416,7 +367,7 @@
|
||||
}
|
||||
|
||||
.scroll-table-body {
|
||||
top: 33px;
|
||||
top: 31px;
|
||||
}
|
||||
|
||||
footer table tr {
|
||||
@ -456,9 +407,7 @@
|
||||
padding: 16px 0 6px;
|
||||
}
|
||||
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 40%;
|
||||
}
|
||||
|
||||
@ -474,8 +423,8 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 7%;
|
||||
margin-right: 24px;
|
||||
margin-left: 0;
|
||||
margin-right: -11px;
|
||||
margin-left: auto;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -483,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 {
|
||||
@ -553,17 +502,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
@ -575,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) {
|
||||
@ -592,15 +521,13 @@
|
||||
}
|
||||
|
||||
.downloadContentCellShift {
|
||||
padding-right: 16px;
|
||||
padding-right: 45px;
|
||||
max-width: 4%;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 510px) and (min-width: 470px) {
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 35%;
|
||||
}
|
||||
|
||||
@ -613,7 +540,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 6%;
|
||||
padding-right: 6px;
|
||||
padding-right: 37px;
|
||||
}
|
||||
|
||||
.firstContentCellShift {
|
||||
@ -626,9 +553,7 @@
|
||||
}
|
||||
|
||||
@media (max-width: 470px) and (min-width: 420px) {
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 30%;
|
||||
}
|
||||
.tableRow td:first-child{
|
||||
@ -640,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%;
|
||||
}
|
||||
|
||||
@ -663,9 +588,7 @@
|
||||
}
|
||||
|
||||
@media (max-width: 420px) and (min-width: 320px) {
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow {
|
||||
width: 25%;
|
||||
}
|
||||
|
||||
@ -676,7 +599,7 @@
|
||||
|
||||
.downloadContentCellShift {
|
||||
max-width: 4%;
|
||||
margin-right: 18px;
|
||||
margin-right: -18px;
|
||||
margin-left: -1px;
|
||||
}
|
||||
|
||||
@ -685,7 +608,7 @@
|
||||
}
|
||||
|
||||
.contentCells-icon{
|
||||
width: 12%;
|
||||
width: 10%;
|
||||
}
|
||||
footer table td {
|
||||
margin: 0;
|
||||
@ -701,10 +624,6 @@
|
||||
padding-right: 2px;
|
||||
width: 11%;
|
||||
}
|
||||
|
||||
.header-list {
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: 1160px) {
|
||||
@ -719,9 +638,7 @@
|
||||
}
|
||||
}
|
||||
@media (max-width: 769px) and (min-width: 715px){
|
||||
.tableRow,
|
||||
.storedHeader,
|
||||
menu.links {
|
||||
.tableRow{
|
||||
width: 50%;
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.file-type {
|
||||
font-size: 11px;
|
||||
color: #FFFFFF;
|
||||
padding: 8px 8px;
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.button.file-type.disable {
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.button.file-type.pale {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.button.file-type.document {
|
||||
background: #446995;
|
||||
}
|
||||
|
||||
.button.file-type.spreadsheet {
|
||||
background: #40865C;
|
||||
}
|
||||
|
||||
.button.file-type.presentation {
|
||||
background: #AA5252;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
float: left;
|
||||
padding: 24px 0;
|
||||
@ -331,64 +258,24 @@ label .checkbox {
|
||||
width: 192px;
|
||||
}
|
||||
|
||||
.create-panel {
|
||||
.create-panel,
|
||||
.links-panel {
|
||||
float: left;
|
||||
padding: 16px 0;
|
||||
}
|
||||
|
||||
.links {
|
||||
display: flex;
|
||||
padding: 0;
|
||||
column-gap: 30px;
|
||||
align-items: center;
|
||||
list-style: none;
|
||||
border-bottom: 1px solid #E2E2E2;
|
||||
margin: 0;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
|
||||
.links li {
|
||||
padding: 4px;
|
||||
border-bottom: 2px solid transparent;
|
||||
margin-bottom: -1px;
|
||||
}
|
||||
|
||||
.links li.active {
|
||||
border-bottom: 2px solid #FF6F3D;
|
||||
}
|
||||
|
||||
.links li.active a {
|
||||
color: #FF6F3D;
|
||||
}
|
||||
|
||||
.links li.active a img {
|
||||
filter: invert(55%) sepia(67%) saturate(2727%) hue-rotate(335deg) brightness(104%) contrast(101%);
|
||||
}
|
||||
|
||||
.links a {
|
||||
display: inline-block;
|
||||
padding: 2px 0;
|
||||
line-height: 20px;
|
||||
font-size: 13px;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.home-link {
|
||||
height: 24px;
|
||||
padding: 0 2px 8px !important;
|
||||
}
|
||||
|
||||
.home-link a {
|
||||
padding: 0;
|
||||
padding-top: 7px;
|
||||
}
|
||||
|
||||
.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;
|
||||
@ -426,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;
|
||||
@ -473,10 +334,6 @@ label .checkbox {
|
||||
padding-left: 35px;
|
||||
}
|
||||
|
||||
.waiting {
|
||||
opacity: 30%;
|
||||
}
|
||||
|
||||
.current {
|
||||
background-image: url("../images/loader16.gif");
|
||||
}
|
||||
@ -489,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;
|
||||
@ -502,10 +353,6 @@ label .checkbox {
|
||||
line-height: 188%;
|
||||
}
|
||||
|
||||
.step-descr.disable {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.progress-descr {
|
||||
letter-spacing: -0.02em;
|
||||
line-height: 150%;
|
||||
@ -608,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");
|
||||
@ -682,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;
|
||||
@ -733,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;
|
||||
@ -762,7 +595,7 @@ footer table tr td:first-child {
|
||||
}
|
||||
|
||||
.contentCells-shift {
|
||||
padding-right: 43px;
|
||||
padding-right: 44px;
|
||||
}
|
||||
|
||||
.contentCells-icon {
|
||||
@ -780,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;
|
||||
@ -861,7 +672,7 @@ footer table tr td:first-child {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.icon-action {
|
||||
.icon-delete {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
@ -877,7 +688,7 @@ footer table tr td:first-child {
|
||||
overflow-x: auto;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 75px;
|
||||
top: 71px;
|
||||
scrollbar-color: #D0D5DA transparent;
|
||||
scrollbar-width: thin;
|
||||
}
|
||||
@ -940,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;
|
||||
@ -956,11 +759,11 @@ html {
|
||||
}
|
||||
|
||||
.tableHeaderCellFileName {
|
||||
width: 20%;
|
||||
width: 30%;
|
||||
}
|
||||
|
||||
.tableHeaderCellEditors {
|
||||
width: 20%;
|
||||
width: 28%;
|
||||
}
|
||||
|
||||
.tableHeaderCellViewers {
|
||||
@ -986,13 +789,3 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.buttonsMobile.indent{
|
||||
padding-left: 35px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
}
|
||||
|
||||
.invisible {
|
||||
display: none;
|
||||
}
|
||||
@ -42,7 +42,9 @@
|
||||
"close": <%- JSON.stringify(editor.close) %>,
|
||||
"feedback": true,
|
||||
"forcesave": false,
|
||||
"goback": <%- JSON.stringify(editor.goback) %>,
|
||||
"goback": {
|
||||
"url": "<%- editor.backUrl %>"
|
||||
},
|
||||
"submitForm": <%- editor.submitForm %>
|
||||
},
|
||||
"embedded": {
|
||||
|
||||
@ -74,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
|
||||
@ -354,7 +354,9 @@
|
||||
};
|
||||
|
||||
var onDocumentReady = function(){
|
||||
fixSize();
|
||||
if (config.type === "mobile") {
|
||||
document.getElementsByTagName("iframe")[0].style.height = window.innerHeight + "px";
|
||||
}
|
||||
};
|
||||
|
||||
config = {
|
||||
@ -379,16 +381,17 @@
|
||||
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.onRequestSaveAs = onRequestSaveAs;
|
||||
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) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -400,21 +403,14 @@
|
||||
}
|
||||
|
||||
var connectEditor = function () {
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
fixSize();
|
||||
};
|
||||
|
||||
// get the editor sizes
|
||||
var fixSize = function () {
|
||||
if (config.type !== "mobile") {
|
||||
if ((config.document.fileType === "docxf" || config.document.fileType === "oform")
|
||||
&& DocsAPI.DocEditor.version().split(".")[0] < 7) {
|
||||
innerAlert("Please update ONLYOFFICE Docs to version 7.0 to work on fillable forms online.");
|
||||
return;
|
||||
}
|
||||
var wrapEl = document.getElementsByTagName("iframe");
|
||||
if (wrapEl.length) {
|
||||
wrapEl[0].style.height = screen.availHeight + "px";
|
||||
window.scrollTo(0, -1);
|
||||
wrapEl[0].style.height = window.innerHeight + "px";
|
||||
}
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
};
|
||||
|
||||
const getFileExt = function (fileName) {
|
||||
@ -426,12 +422,8 @@
|
||||
|
||||
if (window.addEventListener) {
|
||||
window.addEventListener("load", connectEditor);
|
||||
window.addEventListener("resize", fixSize);
|
||||
window.addEventListener("orientationchange", fixSize);
|
||||
} else if (window.attachEvent) {
|
||||
window.attachEvent("onload", connectEditor);
|
||||
window.attachEvent("onresize", fixSize);
|
||||
window.attachEvent("orientationchange", fixSize);
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
@ -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,21 +106,15 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="links-panel links-panel-border clearFix">
|
||||
<a href="wopi" class="">Go to WOPI page</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td class="section">
|
||||
<div class="main-panel">
|
||||
<menu class="links">
|
||||
<li class="home-link active" >
|
||||
<a href="./">
|
||||
<img src="images/home.svg" alt="Home"/>
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="wopi">Wopi</a>
|
||||
</li>
|
||||
</menu>
|
||||
<div id="portal-info" style="display: <%= storedFiles.length > 0 ? "none" : "table-cell" %>">
|
||||
<span class="portal-name">ONLYOFFICE Document Editors – Welcome!</span>
|
||||
<span class="portal-descr">
|
||||
@ -143,21 +137,15 @@
|
||||
<%if (storedFiles.length > 0)
|
||||
{%>
|
||||
<div class="stored-list">
|
||||
<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>
|
||||
@ -173,7 +161,7 @@
|
||||
</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>
|
||||
<td class="contentCells contentCells-icon">
|
||||
@ -242,21 +230,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>
|
||||
<% } %>
|
||||
@ -278,15 +258,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="select-file-type" class="invisible">
|
||||
<br />
|
||||
<span class="step">Please select the current document type</span>
|
||||
<div class="buttonsMobile indent">
|
||||
<div class="button file-type document" data="docx">Document</div>
|
||||
<div class="button file-type spreadsheet" data="xlsx">Spreadsheet</div>
|
||||
<div class="button file-type 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>
|
||||
@ -323,31 +294,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>
|
||||
@ -377,10 +323,12 @@
|
||||
<script type="text/javascript" src="javascripts/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jquery.dropdownToggle.js"></script>
|
||||
<script type="text/javascript" src="javascripts/formats.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jscript.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var ConverExtList = "<%= convertExts %>";
|
||||
var EditedExtList = "<%= editedExts %>";
|
||||
var FilledExtList = "<%= fillExts %>";
|
||||
var UrlConverter = "convert";
|
||||
var UrlEditor = "editor";
|
||||
</script>
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
*
|
||||
-->
|
||||
<title>ONLYOFFICE Document Editors</title>
|
||||
<link href="../images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
<link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
@ -32,7 +32,7 @@
|
||||
overflow: hidden;
|
||||
-ms-content-zooming: none;
|
||||
}
|
||||
|
||||
|
||||
#office_frame {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
@ -66,33 +66,11 @@
|
||||
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);
|
||||
|
||||
document.getElementById('office_form').submit();
|
||||
|
||||
var _onMessage = function(msg) {
|
||||
var data = msg.data;
|
||||
if (Object.prototype.toString.apply(data) !== '[object String]' || !window.JSON) {
|
||||
return;
|
||||
}
|
||||
|
||||
var cmd = JSON.parse(data);
|
||||
if (cmd) {
|
||||
if ( cmd.MessageId == 'App_LoadingStatus' ) {
|
||||
var fixSize = function() {
|
||||
document.getElementsByTagName("iframe")[0].style.height = window.innerHeight + "px";
|
||||
}
|
||||
|
||||
fixSize();
|
||||
window.addEventListener("orientationchange", fixSize);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('message', function (e) {
|
||||
_onMessage(e);
|
||||
});
|
||||
</script>
|
||||
|
||||
</body>
|
||||
|
||||
@ -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,20 +98,14 @@
|
||||
</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">
|
||||
<div class="main-panel">
|
||||
<menu class="links">
|
||||
<li class="home-link" >
|
||||
<a href="./">
|
||||
<img src="images/home.svg" alt="Home"/>
|
||||
</a>
|
||||
</li>
|
||||
<li class="active">
|
||||
<a href="wopi">Wopi</a>
|
||||
</li>
|
||||
</menu>
|
||||
<div id="portal-info" style="display: <%= storedFiles.length > 0 ? "none" : "table-cell" %>">
|
||||
<% if (!wopiEnable)
|
||||
{ %>
|
||||
@ -135,14 +129,7 @@
|
||||
<% if (storedFiles.length > 0)
|
||||
{ %>
|
||||
<div class="stored-list">
|
||||
<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>
|
||||
@ -185,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>
|
||||
<% } %>
|
||||
@ -272,10 +259,12 @@
|
||||
<script type="text/javascript" src="javascripts/jquery.iframe-transport.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jquery.fileupload.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jquery.dropdownToggle.js"></script>
|
||||
<script type="text/javascript" src="javascripts/formats.js"></script>
|
||||
<script type="text/javascript" src="javascripts/jscript.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var ConverExtList = "<%= convertExts %>";
|
||||
var EditedExtList = "<%= editedExts %>";
|
||||
var FilledExtList = "<%= fillExts %>";
|
||||
var UrlConverter = "convert";
|
||||
var UrlEditor = "wopi-action";
|
||||
</script>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -504,17 +504,6 @@
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
.buttonsMobile.indent {
|
||||
margin-bottom: 0;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
.button.file-type:hover,
|
||||
.button.file-type {
|
||||
height: 28px;
|
||||
width: 100px;
|
||||
margin-bottom: 10px !important;
|
||||
font-size: 9px;
|
||||
}
|
||||
.button.gray{
|
||||
margin: 0;
|
||||
}
|
||||
|
||||