Merge branch 'develop' into feature/jwtHistoryFiles

This commit is contained in:
Andrey
2021-12-22 17:13:10 +03:00
committed by GitHub
81 changed files with 469 additions and 225 deletions

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,9 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -22,6 +22,7 @@
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -71,6 +72,7 @@ header img {
}
.main {
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -97,6 +99,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -79,12 +79,21 @@ namespace OnlineEditorsExampleMVC.Helpers
// get the storage path of the file
public static string StoragePath(string fileName, string userAddress = null)
{
var directory = HttpRuntime.AppDomainAppPath + CurUserHostAddress(userAddress) + "\\";
var directory = "";
if (!string.IsNullOrEmpty(WebConfigurationManager.AppSettings["storage-path"]) && Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
}
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
return directory + Path.GetFileName(fileName);
return directory + (fileName.Contains("\\") ? fileName : Path.GetFileName(fileName));
}
// get the path to the history file version
@ -99,7 +108,16 @@ namespace OnlineEditorsExampleMVC.Helpers
public static string ForcesavePath(string fileName, string userAddress, Boolean create)
{
// create the directory to this file version
var directory = HttpRuntime.AppDomainAppPath + CurUserHostAddress(userAddress) + "\\";
var directory = "";
if (!string.IsNullOrEmpty(WebConfigurationManager.AppSettings["storage-path"]) && Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
}
if (!Directory.Exists(directory))
{
return "";
@ -180,7 +198,16 @@ namespace OnlineEditorsExampleMVC.Helpers
// get all the stored files from the user host address
public static List<FileInfo> GetStoredFiles()
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
var directory = "";
if (!string.IsNullOrEmpty(WebConfigurationManager.AppSettings["storage-path"]) && Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
}
if (!Directory.Exists(directory)) return new List<FileInfo>();
var directoryInfo = new DirectoryInfo(directory);
@ -236,8 +263,7 @@ namespace OnlineEditorsExampleMVC.Helpers
{
var uri = new UriBuilder(GetServerUrl(true))
{
Path = HttpRuntime.AppDomainAppVirtualPath + "/"
+ path,
Path = HttpRuntime.AppDomainAppVirtualPath + "/" + path,
Query = ""
};

View File

@ -70,7 +70,7 @@ namespace OnlineEditorsExampleMVC.Helpers
"uid-1",
"John Smith",
"smith@example.com",
null,
"",
null,
new Dictionary<string, object>(),
null,
@ -116,7 +116,7 @@ namespace OnlineEditorsExampleMVC.Helpers
"uid-0",
null,
null,
null,
"",
null,
new Dictionary<string,object>(),
null,

View File

@ -21,6 +21,7 @@ using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Web;
using System.Web.Configuration;
using System.Web.Mvc;
using System.Web.Script.Serialization;
using OnlineEditorsExampleMVC.Helpers;
@ -42,7 +43,7 @@ namespace OnlineEditorsExampleMVC.Models
// get file url for user
public string FileUriUser
{
get { return DocManagerHelper.GetFileUri(FileName, false); }
get { return Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ? DownloadUrl + "&dmode=emb" : DocManagerHelper.GetFileUri(FileName, false); }
}
public string FileName { get; set; } // file name
@ -215,6 +216,7 @@ namespace OnlineEditorsExampleMVC.Models
// get the document history
public void GetHistory(out string history, out string historyData)
{
var storagePath = WebConfigurationManager.AppSettings["storage-path"];
var jss = new JavaScriptSerializer();
var histDir = DocManagerHelper.HistoryDir(DocManagerHelper.StoragePath(FileName, null));
@ -256,7 +258,18 @@ namespace OnlineEditorsExampleMVC.Models
dataObj.Add("fileType", ext.Replace(".", ""));
dataObj.Add("key", key);
// write file url to the data object
dataObj.Add("url", i == currentVersion ? FileUri : DocManagerHelper.GetHistoryDownloadUrl(FileName,i.ToString(),"prev"+ext));
string prevFileUrl;
if (Path.IsPathRooted(storagePath) && !string.IsNullOrEmpty(storagePath))
{
prevFileUrl = i == currentVersion ? DocManagerHelper.GetHistoryDownloadUrl(FileName,i.ToString(),"prev"+ext));
: DocManagerHelper.GetDownloadUrl(Directory.GetFiles(verDir, "prev.*")[0].Replace(storagePath + "\\", ""));
}
else {
prevFileUrl = i == currentVersion ? FileUri
: DocManagerHelper.GetPathUri(Directory.GetFiles(verDir, "prev.*")[0].Substring(HttpRuntime.AppDomainAppPath.Length));
}
dataObj.Add("url", prevFileUrl);
dataObj.Add("version", i);
if (i > 1) // check if the version number is greater than 1 (the file was modified)
{
@ -280,7 +293,9 @@ namespace OnlineEditorsExampleMVC.Models
{ "url", prev["url"] },
});
// write the path to the diff.zip archive with differences in this file version
dataObj.Add("changesUrl", DocManagerHelper.GetPathUri(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "diff.zip").Substring(HttpRuntime.AppDomainAppPath.Length)));
var changesUrl = Path.IsPathRooted(storagePath) ? DocManagerHelper.GetDownloadUrl(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "diff.zip").Replace(storagePath + "\\", ""))
: DocManagerHelper.GetPathUri(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "diff.zip").Substring(HttpRuntime.AppDomainAppPath.Length));
dataObj.Add("changesUrl", changesUrl);
}
if(JwtManager.Enabled)
{

View File

@ -13,11 +13,14 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
## Step 2. Download the .Net (C# MVC) code for the editors integration
Download the [.Net (C# MVC) example](https://api.onlyoffice.com/editors/demopreview) from our site.
You need to connnect the editors to your website. Specify path to the editors installation in the *settings.config* file:
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *settings.config* file:
```
<add key="storage-path" value=""/>
<add key="files.docservice.url.site" value="https://documentserver/" />
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-path** is the path where files will be created and stored. You can set an absolute path.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *DocEditor.aspx* file.
## Step 3. Install the prerequisites
@ -25,6 +28,16 @@ If you want to experiment with the editor configuration, modify the [parameters]
* **Microsoft .NET Framework**: version 4.5 (download it from the [official Microsoft website](https://www.microsoft.com/en-US/download/details.aspx?id=30653));
* **Internet Information Services**: version 7 or later.
Configure the IIS components for the server to work correctly:
1. Open Windows features:
**Start** -> **Control Panel** -> **Programs** -> **Programs and Features** -> **Turn Windows features on or off**
2. In the opened window, find **Internet Information Services** and choose all the necessary features. To do this, open the **World Wide Web Services** list and check the following components:
* **Application Development Features**: .NET Extensibility 4.8, ASP.NET 4.8, ISAPI Extensions, ISAPI Filters,
* **Common HTTP Features**: Default Document,
* **Security**: Request Filtering.
## Step 4. Run your website with the editors
1. Run the Internet Information Service (IIS) Manager:

View File

@ -139,7 +139,7 @@
<td class="section">
<div class="main-panel">
<% var storedFiles = DocManagerHelper.GetStoredFiles(); %>
<div id="portal-info" style="display: <%= storedFiles.Any() ? "none" : "block" %>">
<div id="portal-info" style="display: <%= storedFiles.Any() ? "none" : "table-cell" %>">
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -222,9 +222,6 @@
</a>
</td>
<% } %>
<% if (docType != "word" && docType != "cell") { %>
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
<% } %>
<% if (docType == "word") { %>
<td class="contentCells contentCells-icon">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "blockcontent" }) %>" target="_blank">

View File

@ -446,10 +446,12 @@ namespace OnlineEditorsExampleMVC
{
try
{
var fileName = Path.GetFileName(context.Request["fileName"]);
var fileName = Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ? context.Request["fileName"]
: Path.GetFileName(context.Request["fileName"]);
var userAddress = context.Request["userAddress"];
var isEmbedded = context.Request["dmode"];
if (JwtManager.Enabled)
if (JwtManager.Enabled && isEmbedded == null)
{
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];

View File

@ -1,9 +1,10 @@
<?xml version="1.0"?>
<appSettings>
<clear />
<add key="version" value="1.0.0"/>
<add key="version" value="1.1.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>
<add key="files.docservice.fillform-docs" value=".oform|.docx"/>
<add key="files.docservice.viewed-docs" value=".pdf|.djvu|.xps|.oxps"/>

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,9 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -22,6 +22,7 @@ html {
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -71,6 +72,7 @@ header img {
}
.main {
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -97,6 +99,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -140,7 +140,7 @@
<td class="section">
<% var storedFiles = GetStoredFiles(); %>
<div class="main-panel">
<div id="portal-info" style="display: <%= storedFiles.Any() ? "none" : "block" %>">
<div id="portal-info" style="display: <%= storedFiles.Any() ? "none" : "table-cell" %>">
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -223,9 +223,6 @@
</a>
</td>
<% } %>
<%if (docType != "word" && docType != "cell") { %>
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
<% } %>
<% if (docType == "word") { %>
<td class="contentCells contentCells-icon">
<a href="<%= editUrl + "&editorsType=desktop&editorsMode=blockcontent" %>" target="_blank">

View File

@ -78,7 +78,9 @@ namespace OnlineEditorsExample
{
get
{
return
return Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ?
WebConfigurationManager.AppSettings["storage-path"] + "/"
:
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ WebConfigurationManager.AppSettings["storage-path"]
@ -144,12 +146,21 @@ namespace OnlineEditorsExample
// get the storage path of the given file
public static string StoragePath(string fileName, string userAddress)
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
var directory = "";
if (Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
}
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory); // if the file directory doesn't exist, make it
}
return directory + Path.GetFileName(fileName);
return directory + (fileName.Contains("\\") ? fileName : Path.GetFileName(fileName));
}
// get the path to the history file version
@ -162,7 +173,16 @@ namespace OnlineEditorsExample
// get the path to the forcesaved file version
public static string ForcesavePath(string fileName, string userAddress, Boolean create)
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
var directory = "";
if (Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(userAddress) + "\\";
}
if (!Directory.Exists(directory)) // the directory with host address doesn't exist
{
return "";
@ -535,7 +555,16 @@ namespace OnlineEditorsExample
// get all the stored files from the folder
protected static List<FileInfo> GetStoredFiles()
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
var directory = "";
if (Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]))
{
directory = WebConfigurationManager.AppSettings["storage-path"] + "\\";
}
else
{
directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
}
if (!Directory.Exists(directory)) return new List<FileInfo>();
var directoryInfo = new DirectoryInfo(directory); // read the user host directory contents

View File

@ -41,7 +41,7 @@ namespace OnlineEditorsExample
// get url to the original file for Document Server
public static string FileUriUser
{
get { return _Default.FileUri(FileName, false); }
get { return Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ? getDownloadUrl(FileName) + "&dmode=emb" : _Default.FileUri(FileName, false); }
}
protected string Key
@ -100,9 +100,7 @@ namespace OnlineEditorsExample
}
// get url to download a file
public static string getDownloadUrl
{
get
public static string getDownloadUrl(string fileName)
{
var downloadUrl = new UriBuilder(_Default.GetServerUrl(true));
downloadUrl.Path =
@ -110,11 +108,10 @@ namespace OnlineEditorsExample
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx";
downloadUrl.Query = "type=download"
+ "&fileName=" + HttpUtility.UrlEncode(FileName)
+ "&fileName=" + HttpUtility.UrlEncode(fileName)
+ "&userAddress=" + HttpUtility.UrlEncode(HttpContext.Current.Request.UserHostAddress);
return downloadUrl.ToString();
}
}
// loading a page
protected void Page_Load(object sender, EventArgs e)
@ -195,7 +192,7 @@ namespace OnlineEditorsExample
"document", new Dictionary<string, object>
{
{ "title", FileName },
{ "url", getDownloadUrl },
{ "url", getDownloadUrl(FileName) },
{ "fileType", ext.Trim('.') },
{ "key", Key },
{
@ -318,6 +315,7 @@ namespace OnlineEditorsExample
// get the document history
private void GetHistory(out Dictionary<string, object> history, out Dictionary<string, object> historyData)
{
var storagePath = WebConfigurationManager.AppSettings["storage-path"];
var jss = new JavaScriptSerializer();
var histDir = _Default.HistoryDir(_Default.StoragePath(FileName, null));
@ -357,7 +355,15 @@ namespace OnlineEditorsExample
var ext = Path.GetExtension(FileName).ToLower();
dataObj.Add("fileType", ext.Replace(".", ""));
dataObj.Add("key", key);
dataObj.Add("url", i == currentVersion ? FileUri : MakePublicHistoryUrl(FileName,i.ToString(),"prev"+ext)); // write file url to the data object
// write file url to the data object
var prevFileUrl = i == currentVersion ? FileUri : MakePublicHistoryUrl(FileName,i.ToString(),"prev"+ext));
if (Path.IsPathRooted(storagePath))
{
prevFileUrl = i == currentVersion ? getDownloadUrl(FileName) : getDownloadUrl(Directory.GetFiles(verDir, "prev.*")[0].Replace(storagePath + "\\", ""));
}
dataObj.Add("url", prevFileUrl); // write file url to the data object
dataObj.Add("version", i);
if (i > 1) // check if the version number is greater than 1 (the file was modified)
{
@ -381,7 +387,9 @@ namespace OnlineEditorsExample
{ "url", prev["url"] },
});
// write the path to the diff.zip archive with differences in this file version
dataObj.Add("changesUrl", MakePublicUrl(Path.Combine(_Default.VersionDir(histDir, i - 1), "diff.zip")));
var changesUrl = Path.IsPathRooted(storagePath) ? getDownloadUrl(Path.Combine(_Default.VersionDir(histDir, i - 1), "diff.zip").Replace(storagePath + "\\", ""))
: MakePublicUrl(Path.Combine(_Default.VersionDir(histDir, i - 1), "diff.zip"));
dataObj.Add("changesUrl", changesUrl);
}
if (JwtManager.Enabled)
{
@ -505,7 +513,8 @@ namespace OnlineEditorsExample
// create the public url
private string MakePublicUrl(string fullPath)
{
var root = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"];
var root = Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ? WebConfigurationManager.AppSettings["storage-path"]
: HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"];
return _Default.GetServerUrl(true) + fullPath.Substring(root.Length).Replace(Path.DirectorySeparatorChar, '/');
}

View File

@ -14,11 +14,12 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
Download the [.Net (C#) example](https://api.onlyoffice.com/editors/demopreview) from our site.
Connect the editors to your website by specifying the path to the editors installation in the *settings.config* file:
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *settings.config* file:
```
<add key="storage-path" value=""/>
<add key="files.docservice.url.site" value="https://documentserver/" />
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-path** is the path where files will be created and stored. You can set an absolute path.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *DocEditor.aspx* file.
@ -28,6 +29,16 @@ Check that your system meets the requirements:
* **Microsoft .NET Framework**: version 4.5 (download it from the [official Microsoft website](https://www.microsoft.com/en-US/download/details.aspx?id=30653));
* **Internet Information Services**: version 7 or later.
Configure the IIS components for the server to work correctly:
1. Open Windows features:
**Start** -> **Control Panel** -> **Programs** -> **Programs and Features** -> **Turn Windows features on or off**
2. In the opened window, find **Internet Information Services** and choose all the necessary features. To do this, open the **World Wide Web Services** list and check the following components:
* **Application Development Features**: .NET Extensibility 4.8, ASP.NET 4.8, ISAPI Extensions, ISAPI Filters,
* **Common HTTP Features**: Default Document,
* **Security**: Request Filtering.
## Step 4. Run your website with the editors
1. Run the Internet Information Service (IIS) Manager:

View File

@ -69,7 +69,7 @@ namespace OnlineEditorsExample
"uid-1",
"John Smith",
"smith@example.com",
null,
"",
null,
new Dictionary<string, object>(),
null,
@ -115,7 +115,7 @@ namespace OnlineEditorsExample
"uid-0",
null,
null,
null,
"",
null,
new Dictionary<string, object>(),
null,

View File

@ -274,10 +274,11 @@ namespace OnlineEditorsExample
{
try
{
var fileName = Path.GetFileName(context.Request["fileName"]);
var fileName = Path.IsPathRooted(WebConfigurationManager.AppSettings["storage-path"]) ? context.Request["fileName"] : Path.GetFileName(context.Request["fileName"]);
var userAddress = Path.GetFileName(context.Request["userAddress"]);
var isEmbedded = context.Request["dmode"];
if (JwtManager.Enabled)
if (JwtManager.Enabled && isEmbedded == null)
{
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<appSettings>
<clear />
<add key="version" value="1.0.0"/>
<add key="version" value="1.1.0"/>
<add key="filesize-max" value="52428800"/>
<add key="storage-path" value=""/>

View File

@ -19,16 +19,15 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
Download the [Java-Spring example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation, server address and port in the *\src\main\resources\application.properties* file:
To connect the editors to your website, specify the path to the editors installation, server port and the path to the storage folder in the *\src\main\resources\application.properties* file:
```
server.address=address
files.storage=
server.port=port
files.docservice.url.site=https://documentserver/
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
**address** is the address of the server or comment this line to use localhost, **port** is the any available port.
where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *\src\main\resources\editor.html* file.
@ -113,8 +112,6 @@ To run the Java example code, install the Java version 11 appropriate for your O
http://server.address:server.port/
```
### Step 6. Check accessibility
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files.
@ -173,13 +170,13 @@ See the detailed guide to learn how to install Document Server [for Linux](https
Edit the following lines:
```
server.address=address
files.storage=
server.port=port
files.docservice.url.site=https://documentserver/
```
Where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
**address** is the address of the server or comment this line to use localhost, **port** is the any available port.
where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path.
5. Install **Maven**:
@ -204,7 +201,6 @@ See the detailed guide to learn how to install Document Server [for Linux](https
```
### Step 3. Check accessibility
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files.
@ -222,13 +218,12 @@ Make sure that the Document Server has access to the server with the example ins
2. Edit the following lines:
```
server.address=address
files.storage=
server.port=port
files.docservice.url.site=https://documentserver/
```
Where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
**address** is the address of the server or comment this line to use localhost, **port** is the any available port.
where the **documentserver** is the name of the server with the ONLYOFFICE Docs installed, **port** is any available port and **files.storage** is the path where files will be created and stored (in the project folder by default). You can set an absolute path.
3. Run the next command in the java example directory:

View File

@ -8,6 +8,8 @@ services:
working_dir: /java-spring
volumes:
- .:/java-spring
ports:
- 4000:4000
command: mvn clean spring-boot:run

View File

@ -68,7 +68,7 @@ public class ExampleData {
"Can create a file from an editor"
);
userService.createUser("John Smith", "smith@example.com", // create user 1 with the specified parameters
description_user_1, null, List.of(FilterState.NULL.toString()),
description_user_1, "", List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()), null);
@ -79,7 +79,7 @@ public class ExampleData {
description_user_3, "group-3", List.of("group-2"), List.of("group-2", "group-3"),
List.of("group-2"), new ArrayList<>(), false);
userService.createUser("Anonymous",null, // create user 0 with the specified parameters
description_user_0,null, List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
description_user_0,"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), null);
}
}

View File

@ -45,6 +45,8 @@ public class DefaultDocumentManager implements DocumentManager {
@Value("${files.storage.folder}")
private String storageFolder;
@Value("${files.storage}")
private String filesStorage;
@Value("${url.track}")
private String trackUrl;
@Value("${url.download}")
@ -93,6 +95,9 @@ public class DefaultDocumentManager implements DocumentManager {
String hostAddress = storagePathBuilder.getStorageLocation(); // get the storage directory
String filePathDownload = !fileName.contains(InetAddress.getLocalHost().getHostAddress()) ? fileName
: fileName.substring(fileName.indexOf(InetAddress.getLocalHost().getHostAddress()) + InetAddress.getLocalHost().getHostAddress().length() + 1);
if (!filesStorage.isEmpty() && filePathDownload.contains(filesStorage)) {
filePathDownload = filePathDownload.substring(filesStorage.length() + 1);
}
String filePath = serverPath + "/download?fileName=" + URLEncoder.encode(filePathDownload, java.nio.charset.StandardCharsets.UTF_8.toString())
+ "&userAddress" + URLEncoder.encode(hostAddress, java.nio.charset.StandardCharsets.UTF_8.toString());

View File

@ -85,10 +85,18 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
// get the storage directory
public String getStorageLocation(){
String serverPath = System.getProperty("user.dir"); // get the path to the server
String directory = serverPath // create the storage directory
String directory; // create the storage directory
if (Paths.get(this.storageAddress).isAbsolute()) {
directory = this.storageAddress + File.separator;
} else {
directory = serverPath
+ File.separator + storageFolder
+ File.separator + this.storageAddress
+ File.separator;
}
if (!Files.exists(Paths.get(directory))) {
createDirectory(Paths.get(directory));
}
return directory;
}

View File

@ -1,6 +1,6 @@
server.version=1.0.0
server.version=1.1.0
server.address=127.0.0.1
server.address=
server.port=4000
filesize-max=5242880

View File

@ -98,6 +98,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -127,7 +127,7 @@
</td>
<td class="section">
<div class="main-panel">
<div id="portal-info" th:attr="tooltip=${tooltip}" th:style="${not #lists.isEmpty(files)} ? 'display: none' : 'display: block' ">
<div id="portal-info" th:attr="tooltip=${tooltip}" th:style="${not #lists.isEmpty(files)} ? 'display: none' : 'display: table-cell' ">
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -189,9 +189,6 @@
</a>
</td>
</div>
<div th:if="${docTypes[iState.index]} eq 'slide'">
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
</div>
<div th:if="${docTypes[iState.index]} eq 'word'">
<td class="contentCells contentCells-icon">
<a th:href="@{/editor(fileName=${files[iState.index].getName()},type='desktop',action='blockcontent')}" target="_blank">

View File

@ -0,0 +1,9 @@
FROM maven:3.6.1-jdk-8-alpine AS MVN_BLDR
COPY pom.xml /tmp/
COPY src /tmp/src/
WORKDIR /tmp/
RUN mvn package
FROM tomcat:alpine
RUN rm -fr /usr/local/tomcat/webapps/ROOT
COPY --from=MVN_BLDR /tmp/target/*.war $CATALINA_HOME/webapps/ROOT.war

View File

@ -16,13 +16,14 @@ See the detailed guide to learn how to [install Document Server for Windows](htt
Download the [Java example](https://api.onlyoffice.com/editors/demopreview) from our site.
To connect the editors to your website, specify the path to the editors installation in the *\src\main\resources\settings.properties* file:
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *\src\main\resources\settings.properties* file:
```
storage-folder = app_data
files.docservice.url.site=https://documentserver/
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-folder** is the path where files will be created and stored. You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *\src\main\webapp\editor.jsp* file.
@ -167,13 +168,17 @@ See the detailed guide to learn how to [install Document Server for Linux](https
nano src/main/resources/settings.properties
```
Edit the following line:
Edit the following lines:
```
storage-folder = app_data
files.docservice.url.site=https://documentserver/
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-folder** is the path where files will be created and stored. Please note that you must have read and write permissions to the folder. If you do not have them, please use the next command:
```
sudo chmod -R ugo+rw /{path}
```
5. Install **Maven**:
@ -242,13 +247,14 @@ Make sure that the Document Server has access to the server with the example ins
nano src/main/resources/settings.properties
```
2. Edit the following line:
2. Edit the following lines:
```
storage-folder = app_data
files.docservice.url.site=https://documentserver/
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storage-folder** is the path where files will be created and stored.
3. Run the next command in the Java example directory:

View File

@ -1,7 +1,9 @@
version: '3'
services:
java-intg-ex:
build:
image: maven:3.6
volumes:
- .:/java
command: mvn -f /java package
context: ./
dockerfile: Dockerfile
ports:
- 8080:8080

View File

@ -72,7 +72,7 @@ public class EditorServlet extends HttpServlet
// create file model (get all the necessary parameters from cookies)
FileModel file = new FileModel(fileName, cm.getCookie("ulang"), request.getParameter("actionLink"), user);
// change type parameter if needed
file.changeType(request.getParameter("mode"), request.getParameter("type"), user);
file.changeType(request.getParameter("mode"), request.getParameter("type"), user, fileName);
// an image that will be inserted into the document
Map<String, Object> dataInsertImage = new HashMap<>();

View File

@ -481,8 +481,9 @@ public class IndexServlet extends HttpServlet
try {
String fileName = FileUtility.GetFileName(request.getParameter("fileName"));
String userAddress = request.getParameter("userAddress");
String isEmbedded = request.getParameter("dmode");
if (DocumentManager.TokenEnabled()) {
if (DocumentManager.TokenEnabled() && isEmbedded == null) {
String DocumentJwtHeader = ConfigManager.GetProperty("files.docservice.header");

View File

@ -20,16 +20,14 @@ package entities;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import helpers.DocumentManager;
import helpers.FileUtility;
import helpers.ServiceConverter;
import helpers.Users;
import helpers.*;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
import java.io.File;
import java.io.FileInputStream;
import java.text.SimpleDateFormat;
import java.util.*;
public class FileModel
@ -54,7 +52,6 @@ public class FileModel
document = new Document();
document.title = fileName;
document.url = DocumentManager.GetDownloadUrl(fileName); // get file url
document.urlUser = DocumentManager.GetFileUri(fileName, false);
document.fileType = FileUtility.GetFileExtension(fileName).replace(".", ""); // get file extension from the file name
// generate document key
document.key = ServiceConverter.GenerateRevisionId(DocumentManager.CurUserHostAddress(null) + "/" + fileName + "/" + Long.toString(new File(DocumentManager.StoragePath(fileName, null)).lastModified()));
@ -94,11 +91,11 @@ public class FileModel
// write the absolute URL to the file location
editorConfig.customization.goback.url = DocumentManager.GetServerUrl(false) + "/IndexServlet";
changeType(mode, type, user);
changeType(mode, type, user, fileName);
}
// change the document type
public void changeType(String _mode, String _type, User user)
public void changeType(String _mode, String _type, User user, String fileName)
{
if (_mode != null) mode = _mode;
if (_type != null) type = _type;
@ -119,12 +116,12 @@ public class FileModel
// set document permissions
document.permissions = new Permissions(mode, type, canEdit, user);
if (type.equals("embedded")) InitDesktop(); // set parameters for the embedded document
if (type.equals("embedded")) InitDesktop(fileName); // set parameters for the embedded document
}
public void InitDesktop()
public void InitDesktop(String fileName)
{
editorConfig.InitDesktop(document.urlUser);
editorConfig.InitDesktop(DocumentManager.GetDownloadUrl(fileName) + "&dmode=emb");
}
// generate document token
@ -201,7 +198,12 @@ public class FileModel
prevInfo.put("url", prev.get("url"));
dataObj.put("previous", prevInfo); // write information about previous file version to the data object
// write the path to the diff.zip archive with differences in this file version
dataObj.put("changesUrl", DocumentManager.GetPathUri(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "diff.zip"));
String storagePath = ConfigManager.GetProperty("storage-folder");
String changesUrl = DocumentManager.GetPathUri(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "diff.zip");
if (new File(storagePath).isAbsolute()) {
changesUrl = DocumentManager.GetDownloadUrl((DocumentManager.VersionDir(histDir, i - 1) + File.separator + "diff.zip").replace(storagePath, ""));
}
dataObj.put("changesUrl", changesUrl);
}
if (DocumentManager.TokenEnabled())
@ -248,7 +250,6 @@ public class FileModel
{
public String title;
public String url;
public String urlUser;
public String fileType;
public String key;
public Info info;
@ -290,7 +291,14 @@ public class FileModel
// the Favorite icon state
public class Info
{
public String owner = "Me";
public Boolean favorite;
public String uploaded = getDate();
private String getDate() {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("EEE MMM dd yyyy", Locale.US);
return simpleDateFormat.format(new Date());
}
}
// the editor config parameters
public class EditorConfig

View File

@ -130,7 +130,20 @@ public class DocumentManager
String hostAddress = CurUserHostAddress(userAddress); // get current user host address
String serverPath = request.getSession().getServletContext().getRealPath(""); // get the server url
String storagePath = ConfigManager.GetProperty("storage-folder"); // get the storage directory
String directory = serverPath + storagePath + File.separator + hostAddress + File.separator;
File f = new File(storagePath);
if (f.isAbsolute()) {
if (!f.exists()) {
if (Files.isWritable(Paths.get(storagePath.substring(0, storagePath.lastIndexOf(File.separator))))) {
f.mkdirs();
} else {
throw new SecurityException("No write permission to path: " + f.toPath());
}
} else if (f.exists() && f.isFile()) {
throw new SecurityException("The path to the file is specified instead of the folder");
}
}
String directory = !f.isAbsolute() ? serverPath + storagePath + File.separator + hostAddress + File.separator : storagePath + File.separator;
File file = new File(directory);
@ -337,13 +350,20 @@ public class DocumentManager
{
String serverPath = GetServerUrl(forDocumentServer);
String storagePath = ConfigManager.GetProperty("storage-folder");
File f = new File(storagePath);
String hostAddress = CurUserHostAddress(null);
String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20");
if (f.isAbsolute() && f.isFile()) {
filePath = GetDownloadUrl(fileName);
if (!Files.isWritable(f.toPath())) {
throw new SecurityException("No write permission to path: " + f.toPath());
}
}
return filePath;
}
catch (UnsupportedEncodingException e)
catch (Exception e)
{
return "";
}

View File

@ -64,7 +64,7 @@ public class Users {
private static List<User> users = new ArrayList<User>() {{
add(new User("uid-1", "John Smith", "smith@example.com",
null, null, new CommentGroups(),
"", null, new CommentGroups(),
null, new ArrayList<String>(), descr_user_1, 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")),
@ -73,7 +73,7 @@ public class Users {
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"), Arrays.asList("group-2"), new ArrayList<String>()),
false, Arrays.asList("copy", "download", "print"), descr_user_3, false));
add(new User("uid-0", null, null,
null, null, new CommentGroups(),
"", null, new CommentGroups(),
null, new ArrayList<String>(), descr_user_0, false));
}};

View File

@ -1,4 +1,4 @@
version=1.0.0
version=1.1.0
filesize-max=5242880
storage-folder=app_data

View File

@ -86,10 +86,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -299,6 +295,9 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -22,6 +22,7 @@ html {
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -71,6 +72,7 @@ header img {
}
.main{
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -97,6 +99,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -139,7 +139,7 @@
<% DocumentManager.Init(request, response); %>
<% File[] files = DocumentManager.GetStoredFiles(null); %>
<div class="main-panel">
<div id="portal-info" style="display: <%= files.length > 0 ? "none" : "block" %>">
<div id="portal-info" style="display: <%= files.length > 0 ? "none" : "table-cell" %>">
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -180,7 +180,7 @@
Boolean canEdit = DocumentManager.GetEditedExts().contains(FileUtility.GetFileExtension(files[i].getName()));
String version=" ["+DocumentManager.GetFileVersion(DocumentManager.HistoryDir(DocumentManager.StoragePath(files[i].getName(), null)))+"]";
%>
<tr class="tableRow" title="<%= files[i].getName() %> [<%= version %>]">
<tr class="tableRow" title="<%= files[i].getName() %><%= version %>">
<td class="contentCells">
<a class="stored-edit <%= docType %>" href="EditorServlet?fileName=<%= URLEncoder.encode(files[i].getName(), "UTF-8") %>" target="_blank">
<span><%= files[i].getName() %></span>
@ -215,9 +215,6 @@
</a>
</td>
<% } %>
<% if (!docType.equals("cell") && !docType.equals("word")) { %>
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
<% } %>
<% if (docType.equals("word")) { %>
<td class="contentCells contentCells-icon">
<a href="EditorServlet?fileName=<%= URLEncoder.encode(files[i].getName(), "UTF-8") %>&type=desktop&mode=blockcontent" target="_blank">

View File

@ -16,13 +16,15 @@ See the detailed guide to learn how to [install Document Server for Windows](htt
Download the [Node.js example](https://api.onlyoffice.com/editors/demopreview) from our site.
You need to connect the editors to your website. Specify the path to the editors installation in the *config/default.json* file:
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *config/default.json* file:
```
"storageFolder": "./files"
"storagePath": "/files"
"siteUrl": "https://documentserver/"
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed, the **storageFolder** and **storagePath** are the paths where files will be created and stored. You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *\views\editor.ejs* file.
@ -114,13 +116,18 @@ See the detailed guide to learn how to [install Document Server for Linux](https
nano config/default.json
```
Edit the following line:
Edit the following lines:
```
"storageFolder": "./files"
"storagePath": "/files"
"siteUrl": "https://documentserver/"
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed, the **storageFolder** and **storagePath** are the paths where files will be created and stored. Please note that you must have read and write permissions to the folder. If you do not have them, please use the next command:
```
sudo chmod -R ugo+rw /{path}
```
6. Run the project with Node.js:

View File

@ -144,8 +144,9 @@ app.get("/download", function(req, res) { // define a handler for downloading f
var fileName = fileUtility.getFileName(req.query.fileName);
var userAddress = req.query.useraddress;
var isEmbedded = req.query.dmode;
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
if ((cfgSignatureEnable && cfgSignatureUseForRequest) && isEmbedded == null ) {
var authorization = req.get(cfgSignatureAuthorizationHeader);
if (authorization && authorization.startsWith(cfgSignatureAuthorizationHeaderPrefix)) {
var token = authorization.substring(cfgSignatureAuthorizationHeaderPrefix.length);
@ -179,7 +180,7 @@ app.post("/upload", function (req, res) { // define a handler for uploading fil
docManager.storagePath(""); // mkdir if not exist
const userIp = docManager.curUserHostAddress(); // get the path to the user host
const uploadDir = path.join(storageFolder, userIp);
const uploadDir = path.isAbsolute(storageFolder) ? storageFolder : path.join(storageFolder, userIp);
const uploadDirTmp = path.join(uploadDir, 'tmp'); // and create directory for temporary files if it doesn't exist
docManager.createDirectory(uploadDirTmp);
@ -765,7 +766,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
}
var key = docManager.getKey(fileName);
var url = docManager.getDownloadUrl(fileName);
var urlUser = docManager.getlocalFileUri(fileName, 0, false)
var urlUser = path.isAbsolute(storageFolder) ? docManager.getDownloadUrl(fileName) + "&dmode=emb" : docManager.getlocalFileUri(fileName, 0, false);
var mode = req.query.mode || "edit"; // mode: view/edit/review/comment/fillForms/embedded
var type = req.query.type || ""; // type: embedded/mobile/desktop
if (type == "") {
@ -811,7 +812,8 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
key: historyData[i-2].key,
url: historyData[i-2].url,
};
historyD.changesUrl = docManager.getlocalFileUri(fileName, i-1) + "/diff.zip"; // get the path to the diff.zip file and write it to the history object
let changesUrl = docManager.getlocalFileUri(fileName, i-1);
historyD.changesUrl = changesUrl.includes("diff.zip") ? changesUrl : changesUrl + "/diff.zip"; // get the path to the diff.zip file and write it to the history object
}
historyData.push(historyD);

View File

@ -1,5 +1,5 @@
{
"version": "1.0.0",
"version": "1.1.0",
"log": {
"appenders": [
{

View File

@ -151,7 +151,12 @@ docManager.getFileUri = function (fileName) {
docManager.getlocalFileUri = function (fileName, version, forDocumentServer) {
const serverPath = docManager.getServerUrl(forDocumentServer);
const hostAddress = docManager.curUserHostAddress();
const url = serverPath + configServer.get("storagePath") + "/" + hostAddress + "/" + encodeURIComponent(fileName); // get full url address to the file
let url = serverPath + configServer.get("storagePath") + "/" + hostAddress + "/" + encodeURIComponent(fileName); // get full url address to the file
if (path.isAbsolute(configServer.get("storageFolder"))) {
let separator = configServer.get("storagePath").includes("/") ? "/" : "\\";
url = docManager.getDownloadUrl(fileName + "-history" + separator + version + separator + "diff.zip");
return url;
}
if (!version) {
return url;
}
@ -208,14 +213,14 @@ docManager.getDownloadUrl = function (fileName) {
// get the storage path of the given file
docManager.storagePath = function (fileName, userAddress) {
fileName = fileUtility.getFileName(fileName); // get the file name with extension
const directory = path.join(docManager.dir, docManager.curUserHostAddress(userAddress)); // get the path to the directory for the host address
const directory = path.isAbsolute(docManager.dir) ? docManager.dir : path.join(docManager.dir, docManager.curUserHostAddress(userAddress)); // get the path to the directory for the host address
this.createDirectory(directory); // create a new directory if it doesn't exist
return path.join(directory, fileName); // put the given file to this directory
};
// get the path to the forcesaved file version
docManager.forcesavePath = function (fileName, userAddress, create) {
let directory = path.join(docManager.dir, docManager.curUserHostAddress(userAddress));
let directory = path.isAbsolute(docManager.dir) ? docManager.dir : path.join(docManager.dir, docManager.curUserHostAddress(userAddress));
if (!this.existsSync(directory)) { // the directory with host address doesn't exist
return "";
}
@ -233,7 +238,7 @@ docManager.forcesavePath = function (fileName, userAddress, create) {
// create the path to the file history
docManager.historyPath = function (fileName, userAddress, create) {
let directory = path.join(docManager.dir, docManager.curUserHostAddress(userAddress));
let directory = path.isAbsolute(docManager.dir) ? docManager.dir : path.join(docManager.dir, userAddress);
if (!this.existsSync(directory)) {
return "";
}
@ -278,7 +283,7 @@ docManager.changesUser = function (fileName, userAddress, version) {
// get all the stored files
docManager.getStoredFiles = function () {
const userAddress = docManager.curUserHostAddress();
const directory = path.join(docManager.dir, userAddress);
const directory = path.isAbsolute(docManager.dir) ? docManager.dir : path.join(docManager.dir, userAddress);
this.createDirectory(directory);
const result = [];
const storedFiles = fileSystem.readdirSync(directory); // read the user host directory contents
@ -451,7 +456,7 @@ docManager.cleanFolderRecursive = function (folder, me) {
// get files information
docManager.getFilesInfo = function (fileId) {
const userAddress = docManager.curUserHostAddress();
const directory = path.join(docManager.dir, userAddress);
const directory = path.isAbsolute(docManager.dir) ? docManager.dir : path.join(docManager.dir, userAddress);
const filesInDirectory = this.getStoredFiles(); // get all the stored files from the folder
let responseArray = [];
let responseObject;

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,9 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -97,6 +97,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -133,7 +133,7 @@
</td>
<td class="section">
<div class="main-panel">
<div id="portal-info" style="display: <%= storedFiles.length > 0 ? "none" : "block" %>">
<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">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -200,9 +200,6 @@
<img src="images/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" /></a>
</td>
<% } %>
<% if (storedFiles[i].documentType !== "word" && storedFiles[i].documentType !== "cell") {%>
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
<% } %>
<% if (storedFiles[i].documentType == "word") { %>
<td class="contentCells contentCells-icon">
<a href="editor?type=desktop&mode=blockcontent&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">

View File

@ -16,13 +16,14 @@ See the detailed guide to learn how to [install Document Server for Windows](htt
Download the [PHP example](https://api.onlyoffice.com/editors/demopreview) from our site.
You need to connect the editors to your website. Specify the path to the editors installation in the *config.php* file:
To connect the editors to your website, specify the path to the editors installation and the path to the storage folder in the *config.php* file:
```
$GLOBALS['STORAGE_PATH'] = "";
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **STORAGE_PATH** is the path where files will be created and stored. You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) in the *doceditor.php* file.
@ -147,13 +148,14 @@ See the detailed guide to learn how to [install Document Server for Linux](https
nano config.php
```
Edit the following line:
Edit the following lines:
```
$GLOBALS['STORAGE_PATH'] = "";
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **STORAGE_PATH** is the path where files will be created and stored. You can set an absolute path.
5. Set permission for site:

View File

@ -200,7 +200,15 @@ function getScheme() {
// get the storage path of the given file
function getStoragePath($fileName, $userAddress = NULL) {
$storagePath = trim(str_replace(array('/','\\'), DIRECTORY_SEPARATOR, $GLOBALS['STORAGE_PATH']), DIRECTORY_SEPARATOR);
if (!empty($storagePath) && !file_exists($storagePath) && !is_dir($storagePath)) {
mkdir($storagePath);
}
if (realpath($storagePath) === $storagePath) {
$directory = $storagePath;
} else {
$directory = __DIR__ . DIRECTORY_SEPARATOR . $storagePath;
}
if ($storagePath != "")
{
@ -212,20 +220,27 @@ function getStoragePath($fileName, $userAddress = NULL) {
}
}
if (realpath($storagePath) !== $storagePath) {
$directory = $directory . getCurUserHostAddress($userAddress) . DIRECTORY_SEPARATOR;
}
if (!file_exists($directory) && !is_dir($directory)) {
mkdir($directory);
}
sendlog("getStoragePath result: " . $directory . basename($fileName), "common.log");
return $directory . basename($fileName);
return realpath($storagePath) === $storagePath ? $directory . $fileName : $directory . basename($fileName);
}
// get the path to the forcesaved file version
function getForcesavePath($fileName, $userAddress, $create) {
$storagePath = trim(str_replace(array('/','\\'), DIRECTORY_SEPARATOR, $GLOBALS['STORAGE_PATH']), DIRECTORY_SEPARATOR);
// create the directory to this file version
if (realpath($storagePath) === $storagePath) {
$directory = $storagePath . DIRECTORY_SEPARATOR;
} else {
$directory = __DIR__ . DIRECTORY_SEPARATOR . $storagePath . getCurUserHostAddress($userAddress) . DIRECTORY_SEPARATOR;
}
if (!is_dir($directory)) return "";
@ -233,8 +248,9 @@ function getForcesavePath($fileName, $userAddress, $create) {
$directory = $directory . $fileName . "-hist" . DIRECTORY_SEPARATOR;
if (!$create && !is_dir($directory)) return "";
if (!file_exists($directory) && !is_dir($directory)) {
mkdir($directory);
}
$directory = $directory . $fileName;
if (!$create && !file_exists($directory)) return "";
@ -275,7 +291,15 @@ function getFileVersion($histDir) {
// get all the stored files from the folder
function getStoredFiles() {
$storagePath = trim(str_replace(array('/','\\'), DIRECTORY_SEPARATOR, $GLOBALS['STORAGE_PATH']), DIRECTORY_SEPARATOR);
if (!empty($storagePath) && !file_exists($storagePath) && !is_dir($storagePath)) {
mkdir($storagePath);
}
if (realpath($storagePath) === $storagePath) {
$directory = $storagePath;
} else {
$directory = __DIR__ . DIRECTORY_SEPARATOR . $storagePath;
}
// get the storage path and check if it exists
$result = array();
@ -288,7 +312,9 @@ function getStoredFiles() {
}
}
if (realpath($storagePath) !== $storagePath) {
$directory = $directory . getCurUserHostAddress() . DIRECTORY_SEPARATOR;
}
if (!file_exists($directory) && !is_dir($directory)) {
return $result;
@ -320,7 +346,11 @@ function getVirtualPath($forDocumentServer) {
$storagePath = $storagePath != "" ? $storagePath . '/' : "";
if (realpath($storagePath) === $storagePath) {
$virtPath = serverPath($forDocumentServer) . '/' . $storagePath . '/';
} else {
$virtPath = serverPath($forDocumentServer) . '/' . $storagePath . getCurUserHostAddress() . '/';
}
sendlog("getVirtualPath virtPath: " . $virtPath, "common.log");
return $virtPath;
}

View File

@ -1,6 +1,6 @@
<?php
$GLOBALS['version'] = "1.0.0";
$GLOBALS['version'] = "1.1.0";
$GLOBALS['FILE_SIZE_MAX'] = 5242880;
$GLOBALS['STORAGE_PATH'] = "";

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,10 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -22,6 +22,7 @@ html {
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -70,6 +71,7 @@ header img {
}
.main{
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -96,6 +98,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -52,7 +52,7 @@
}
$fileuri = FileUri($filename, true);
$fileuriUser = FileUri($filename);
$fileuriUser = realpath($GLOBALS['STORAGE_PATH']) === $GLOBALS['STORAGE_PATH'] ? getDownloadUrl($filename) . "&dmode=emb" : FileUri($filename);
$docKey = getDocEditorKey($filename);
$filetype = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
@ -217,6 +217,7 @@
// get document history
function getHistory($filename, $filetype, $docKey, $fileuri) {
$storagePath = $GLOBALS['STORAGE_PATH'];
$histDir = getHistoryDir(getStoragePath($filename)); // get the path to the file history
if (getFileVersion($histDir) > 0) { // check if the file was modified (the file version is greater than 0)
@ -248,16 +249,21 @@
$fileExe = strtolower(pathinfo($filename, PATHINFO_EXTENSION));
$prevFileName = $verDir . DIRECTORY_SEPARATOR . "prev." . $filetype;
$prevFileName = substr($prevFileName, strlen(getStoragePath("")));
$prevFileUrl = $i == $curVer ? $fileuri : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($prevFileName));
if (realpath($storagePath) === $storagePath) {
$prevFileUrl = $i == $curVer ? getDownloadUrl($filename) : getDownloadUrl($prevFileName);
}
$dataObj["fileType"] = $fileExe;
$dataObj["key"] = $key;
$dataObj["url"] = $i == $curVer ? $fileuri : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($prevFileName)); // write file url to the data object
$dataObj["url"] = $prevFileUrl; // write file url to the data object
$dataObj["version"] = $i;
if ($i > 1) { // check if the version number is greater than 1 (the document was modified)
$changes = json_decode(file_get_contents(getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "changes.json"), true); // get the path to the changes.json file
$change = $changes["changes"][0];
$obj["changes"] = $change ? $changes["changes"][0] : null; // write information about changes to the object
$obj["changes"] = $changes ? $changes["changes"] : null; // write information about changes to the object
$obj["serverVersion"] = $changes["serverVersion"];
$obj["created"] = $change ? $change["created"] : null;
$obj["user"] = $change ? $change["user"] : null;
@ -268,11 +274,12 @@
"key" => $prev["key"],
"url" => $prev["url"]
];
$changesUrl = getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "diff.zip";
$changesUrl = substr($changesUrl, strlen(getStoragePath("")));
$changesPath = getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "diff.zip";
$changesPath = substr($changesPath, strlen(getStoragePath("")));
// write the path to the diff.zip archive with differences in this file version
$dataObj["changesUrl"] = getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($changesUrl));
$changesUrl = realpath($storagePath) === $storagePath ? getDownloadUrl($changesPath) : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($changesPath)) ;
$dataObj["changesUrl"] = $changesUrl;
}
if (isJwtEnabled()) {

View File

@ -144,7 +144,7 @@
if (!empty($storedFiles)): ?>
<div id="portal-info" style="display: none">
<?php else: ?>
<div id="portal-info" style="display: block">
<div id="portal-info" style="display: table-cell">
<?php endif; ?>
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
@ -213,9 +213,6 @@
echo ' <img src="css/images/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" /></a>';
echo ' </td>';
}
if($storeFile->documentType!="word" && $storeFile->documentType!="cell"){
echo ' <td class="contentCells contentCells-icon contentCellsEmpty"></td>';
}
if ($storeFile->documentType == "word") {
echo ' <td class="contentCells contentCells-icon ">';
echo ' <a href="doceditor.php?fileID=' . urlencode($storeFile->name) . '&user=' . htmlentities($user) . '&action=blockcontent&type=desktop" target="_blank">';

View File

@ -73,7 +73,7 @@ $descr_user_0 = [
$users = [
new User("uid-1", "John Smith", "smith@example.com",
null, null, [],
"", null, [],
null, [], $descr_user_1, true),
new User("uid-2", "Mark Pottato", "pottato@example.com",
"group-2", ["group-2", ""], [
@ -90,7 +90,7 @@ $users = [
],
false, ["copy", "download", "print"], $descr_user_3, false),
new User("uid-0", null, null,
null, null, [],
"", null, [],
null, [], $descr_user_0, false)
];

View File

@ -392,10 +392,11 @@ function downloadHistory() {
// download a file
function download() {
try {
$fileName = basename($_GET["fileName"]); // get the file name
$fileName = realpath($GLOBALS['STORAGE_PATH']) === $GLOBALS['STORAGE_PATH'] ? $_GET["fileName"] : basename($_GET["fileName"]); // get the file name
$userAddress = $_GET["userAddress"];
$isEmbedded = $_GET["&dmode"];
if (isJwtEnabled()) {
if (isJwtEnabled() && $isEmbedded == null) {
$jwtHeader = $GLOBALS['DOC_SERV_JWT_HEADER'] == "" ? "Authorization" : $GLOBALS['DOC_SERV_JWT_HEADER'];
if (!empty(apache_request_headers()[$jwtHeader])) {
$token = jwtDecode(substr(apache_request_headers()[$jwtHeader], strlen("Bearer ")));

View File

@ -1,6 +1,6 @@
import os
VERSION = '1.0.0'
VERSION = '1.1.0'
FILE_SIZE_MAX = 5242880
STORAGE_PATH = 'app_data'

View File

@ -45,13 +45,14 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
nano config.py
```
Edit the following line:
Edit the following lines:
```
STORAGE_PATH = 'app_data'
DOC_SERV_SITE_URL = 'https://documentserver/'
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **STORAGE_PATH** is the path where files will be created and stored. You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
6. Run the **Python** server:

View File

@ -164,7 +164,7 @@ def getRootFolder(req):
else:
curAdr = req.META['REMOTE_ADDR']
directory = os.path.join(config.STORAGE_PATH, curAdr)
directory = config.STORAGE_PATH if os.path.isabs(config.STORAGE_PATH) else os.path.join(config.STORAGE_PATH, curAdr)
if not os.path.exists(directory): # if such a directory does not exist, make it
os.makedirs(directory)

View File

@ -79,7 +79,7 @@ descr_user_0 = [
USERS = [
User('uid-1', 'John Smith', 'smith@example.com',
None, None, {},
'', None, {},
None, [], descr_user_1, True),
User('uid-2', 'Mark Pottato', 'pottato@example.com',
'group-2', ['group-2', ''], {
@ -96,7 +96,7 @@ USERS = [
},
False, ["copy", "download", "print"], descr_user_3, False),
User('uid-0', None, None,
None, None, {},
'', None, {},
None, [], descr_user_0, False)
]

View File

@ -154,7 +154,7 @@ def edit(request):
ext = fileUtils.getFileExt(filename)
fileUri = docManager.getFileUri(filename, True, request)
fileUriUser = docManager.getFileUri(filename, False, request)
fileUriUser = docManager.getDownloadUrl(filename, request) + "&dmode=emb" if os.path.isabs(config.STORAGE_PATH) else docManager.getFileUri(filename, False, request)
docKey = docManager.generateFileKey(filename, request)
fileType = fileUtils.getFileType(filename)
user = users.getUserFromReq(request) # get user
@ -361,8 +361,9 @@ def download(request):
try:
fileName = fileUtils.getFileName(request.GET['fileName']) # get the file name
userAddress = request.GET.get('userAddress') if request.GET.get('userAddress') else request
isEmbedded = request.GET.get('dmode')
if (jwtManager.isEnabled()):
if (jwtManager.isEnabled() and isEmbedded == None):
jwtHeader = 'Authorization' if config.DOC_SERV_JWT_HEADER is None or config.DOC_SERV_JWT_HEADER == '' else config.DOC_SERV_JWT_HEADER
token = request.headers.get(jwtHeader)
if token:

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,10 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -30,6 +30,7 @@ html {
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -79,6 +80,7 @@ header img {
}
.main{
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -105,6 +107,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -113,7 +113,7 @@
{% if files %}
<div id="portal-info" style="display: none">
{% else %}
<div id="portal-info" style="display: block">
<div id="portal-info" style="display: table-cell">
{% endif %}
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
@ -185,9 +185,6 @@
</a>
</td>
{% endif %}
{% if file.type == 'slide' %}
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
{% endif %}
{% if file.type == 'word' %}
<td class="contentCells contentCells-icon">
<a href="edit?filename={{ file.title }}&type=desktop&mode=blockcontent" target="_blank">

View File

@ -46,3 +46,5 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
gem 'uuid'
gem 'rack-cors'
gem 'webrick'

View File

@ -12,14 +12,14 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
## Step 2. Install the prerequisites and run the website with the editors
1. Install **Ruby Version Manager (RVM)** and the stable 2.7 **Ruby** version:
1. Install **Ruby Version Manager (RVM)** and the latest stable **Ruby** version:
```
gpg --keyserver "hkp://keys.gnupg.net" --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
```
```
\curl -sSL https://get.rvm.io | bash -s stable --ruby=2.7.0
\curl -sSL https://get.rvm.io | bash -s stable --ruby
```
2. Download the archive with the Ruby example and unpack the archive:
@ -50,17 +50,19 @@ See the detailed guide to learn how to install Document Server [for Windows](htt
nano config/application.rb
```
Edit the following line:
Edit the following lines:
```
Rails.configuration.storagePath="app_data"
Rails.configuration.urlSite="https://documentserver/"
```
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed.
where the **documentserver** is the name of the server with the ONLYOFFICE Document Server installed and the **storagePath** is the path where files will be created and stored. You can set an absolute path. For example, *D:\\\\folder*. Please note that on Windows OS the double backslash must be used as a separator.
6. Run the **Rails** application:
```
rails server -u webrick
rails s -b 0.0.0.0 -p 80
```

View File

@ -87,10 +87,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 65vw;
}
.left-panel {
margin-left: 0;
}
@ -312,6 +308,10 @@
.tableRow td:first-child {
max-width: 17%;
}
#portal-info {
max-width: 60vw;
}
}
.downloadContentCellShift:after {

View File

@ -22,6 +22,7 @@ html {
}
body {
display: inline-table;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -71,6 +72,7 @@ header img {
}
.main{
display: table;
height: calc(100% - 112px);
min-height: 536px;
}
@ -97,6 +99,10 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;

View File

@ -264,8 +264,9 @@ class HomeController < ApplicationController
begin
file_name = File.basename(params[:fileName])
user_address = params[:userAddress]
isEmbedded = params[:dmode]
if JwtHelper.is_enabled
if JwtHelper.is_enabled && isEmbedded == nil
jwtHeader = Rails.configuration.header.empty? ? "Authorization" : Rails.configuration.header;
if request.headers[jwtHeader]
hdr = request.headers[jwtHeader]

View File

@ -83,7 +83,8 @@ class DocumentHelper
# get the storage path of the given file
def storage_path(file_name, user_address)
directory = Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address)) # get the path to the directory for the host address
directory = File.absolute_path?(Rails.configuration.storagePath) ? Rails.configuration.storagePath
: Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address)) # get the path to the directory for the host address
# create a new directory if it doesn't exist
unless File.directory?(directory)
@ -91,19 +92,20 @@ class DocumentHelper
end
# put the given file to this directory
directory.join(File.basename(file_name)).to_s
File.join(directory, File.basename(file_name))
end
# get the path to the forcesaved file version
def forcesave_path(file_name, user_address, create)
directory = Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address))
directory = File.absolute_path?(Rails.configuration.storagePath) ? Rails.configuration.storagePath
: Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address))
# the directory with host address doesn't exist
unless File.directory?(directory)
return ""
end
directory = directory.join("#{File.basename(file_name)}-hist") # get the path to the history of the given file
directory = File.join(directory,"#{File.basename(file_name)}-hist") # get the path to the history of the given file
unless File.directory?(directory)
if create
FileUtils.mkdir_p(directory) # create history directory if it doesn't exist
@ -112,7 +114,7 @@ class DocumentHelper
end
end
directory = directory.join(File.basename(file_name)) # get the path to the given file
directory = File.join(directory, File.basename(file_name)) # get the path to the given file
unless File.file?(directory)
if !create
return ""
@ -174,7 +176,8 @@ class DocumentHelper
# get all the stored files from the folder
def get_stored_files(user_address)
directory = Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address))
directory = File.absolute_path?(Rails.configuration.storagePath) ? Rails.configuration.storagePath
: Rails.root.join('public', Rails.configuration.storagePath, cur_user_host_address(user_address))
arr = [];

View File

@ -45,7 +45,7 @@ class FileModel
# get file uri for document server
def file_uri_user
DocumentHelper.get_file_uri(@file_name, false)
File.absolute_path?(Rails.configuration.storagePath) ? download_url + "&dmode=emb" : DocumentHelper.get_file_uri(@file_name, false)
end
# get document type from its name (word, cell or slide)

View File

@ -72,7 +72,7 @@ class Users
@@users = [
User.new("uid-1", "John Smith", "smith@example.com",
nil, nil, {},
"", nil, {},
nil, [], @@descr_user_1, true),
User.new("uid-2", "Mark Pottato", "pottato@example.com",
"group-2", ["group-2", ""], {
@ -89,7 +89,7 @@ class Users
},
false, ["copy", "download", "print"], @@descr_user_3, false),
User.new("uid-0", nil, nil,
nil, nil, {},
"", nil, {},
nil, [], @@descr_user_0, false)
]

View File

@ -117,7 +117,7 @@
docs = DocumentHelper.get_stored_files(nil)
%>
<div class="main-panel">
<div id="portal-info" style="display: <%= docs.length > 0 ? "none" : "block" %>">
<div id="portal-info" style="display: <%= docs.length > 0 ? "none" : "table-cell" %>">
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
@ -192,9 +192,6 @@
<img src="assets/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" />
</a>
</td>
<% end %>
<% if !docType.eql?("word") && !docType.eql?("cell")%>
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
<% end %>
<% if docType.eql?("word") %>
<td class="contentCells contentCells-icon">

View File

@ -26,7 +26,7 @@ module OnlineEditorsExampleRuby
end
end
Rails.configuration.version="1.0.0"
Rails.configuration.version="1.1.0"
Rails.configuration.fileSizeMax=5242880
Rails.configuration.storagePath="app_data"

View File

@ -5,6 +5,7 @@ Rails.application.config.assets.version = '1.0'
Rails.application.config.assets.precompile += %w( editor.css )
Rails.application.config.assets.precompile += %w( jquery-ui.css )
Rails.application.config.assets.precompile += %w( stylesheet.css )
Rails.application.config.assets.precompile += %w( media.css )
# Add additional assets to the asset load path
# Rails.application.config.assets.paths << Emoji.images_path