Compare commits
25 Commits
v9.0.0.28
...
v99.99.99.
| Author | SHA1 | Date | |
|---|---|---|---|
| d6d9ea024c | |||
| f74fb7384e | |||
| 14458f82dd | |||
| f4a11e2047 | |||
| 0f9f09d346 | |||
| ed0a70f071 | |||
| dadba2a81f | |||
| fe56ec24b5 | |||
| 6a11ac4ced | |||
| 5169b1dc97 | |||
| dabb51bf8a | |||
| f15f48eba5 | |||
| 12753dee19 | |||
| 598e914452 | |||
| 099a53b24b | |||
| d01263917c | |||
| 0f3c40e0b1 | |||
| bf2f32b7cb | |||
| 534eedfae1 | |||
| 77775754b6 | |||
| bfebc197af | |||
| a3d7b159da | |||
| f12cb242ea | |||
| 8a5f37da3f | |||
| 5c9fe8f8f5 |
2
.github/workflows/artifact-csharp-mvc.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp MVC) Example'
|
||||
rm -rf ./deploy/'DotNet (Csharp MVC) Example'/assets/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DotNet.Csharp.MVC.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/csharp-mvc/deploy
|
||||
2
.github/workflows/artifact-csharp.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp) Example'
|
||||
rm -rf ./deploy/'DotNet (Csharp) Example'/assets/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: DotNet.Csharp.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/csharp/deploy
|
||||
2
.github/workflows/artifact-java.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Java Example'/src/main/resources/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Java.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/java/deploy
|
||||
2
.github/workflows/artifact-node.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Node.js Example'/public/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Node.js Example'/public/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Node.js.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/nodejs/deploy
|
||||
2
.github/workflows/artifact-php.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'PHP Example'/assets/document-formats/.git
|
||||
rm -rf ./deploy/'PHP Example'/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: PHP.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/php/deploy
|
||||
2
.github/workflows/artifact-python.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Python Example'/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Python Example'/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Python.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/python/deploy
|
||||
2
.github/workflows/artifact-ruby.yml
vendored
@ -25,7 +25,7 @@ jobs:
|
||||
rm -rf ./deploy/'Ruby Example'/public/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Ruby Example'/public/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Ruby.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/ruby/deploy
|
||||
2
.github/workflows/artifact-spring.yml
vendored
@ -26,7 +26,7 @@ jobs:
|
||||
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-formats/.git
|
||||
rm -rf ./deploy/'Java Spring Example'/src/main/resources/assets/document-templates/.git
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Java.Spring.Example
|
||||
path: ${{ github.workspace }}/web/documentserver-example/java-spring/deploy
|
||||
7
.gitmodules
vendored
@ -13,6 +13,7 @@
|
||||
[submodule "web/documentserver-example/csharp-mvc/assets/document-formats"]
|
||||
path = web/documentserver-example/csharp-mvc/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/php/assets/document-templates"]
|
||||
path = web/documentserver-example/php/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -20,6 +21,7 @@
|
||||
[submodule "web/documentserver-example/php/assets/document-formats"]
|
||||
path = web/documentserver-example/php/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/python/assets/document-templates"]
|
||||
path = web/documentserver-example/python/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -43,15 +45,19 @@
|
||||
[submodule "web/documentserver-example/go/static/assets/document-formats"]
|
||||
path = web/documentserver-example/go/static/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/python/assets/document-formats"]
|
||||
path = web/documentserver-example/python/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/ruby/assets/document-formats"]
|
||||
path = web/documentserver-example/ruby/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/java/src/main/resources/assets/document-formats"]
|
||||
path = web/documentserver-example/java/src/main/resources/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/csharp/assets/document-templates"]
|
||||
path = web/documentserver-example/csharp/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
@ -59,6 +65,7 @@
|
||||
[submodule "web/documentserver-example/csharp/assets/document-formats"]
|
||||
path = web/documentserver-example/csharp/assets/document-formats
|
||||
url = https://github.com/ONLYOFFICE/document-formats
|
||||
branch = feature/diagram
|
||||
[submodule "web/documentserver-example/php-laravel/public/assets/document-templates"]
|
||||
path = web/documentserver-example/php-laravel/public/assets/document-templates
|
||||
url = https://github.com/ONLYOFFICE/document-templates
|
||||
|
||||
@ -361,41 +361,6 @@ License: MIT
|
||||
License File: serializer.license
|
||||
|
||||
|
||||
web/documentserver-example/php-laravel
|
||||
|
||||
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
|
||||
License: MIT, GPL
|
||||
License File: jQuery.BlockUI.license
|
||||
|
||||
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: jQuery.FileUpload.license
|
||||
|
||||
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
|
||||
License: MIT
|
||||
License File: jQuery.iframe-transport.license
|
||||
|
||||
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.license
|
||||
|
||||
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
|
||||
License: OpenJS
|
||||
License File: jQuery.Migrate.license
|
||||
|
||||
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
|
||||
License: MIT
|
||||
License File: jQuery.UI.license
|
||||
|
||||
JWT - PHP package for JWT (https://github.com/firebase/php-jwt/blob/main/LICENSE)
|
||||
License: BSD-3-Clause
|
||||
License File: jwt.license
|
||||
|
||||
Laravel - Laravel is a web application framework with expressive, elegant syntax. We’ve already laid the foundation for your next big idea — freeing you to create without sweating the small things. (https://github.com/laravel/framework/blob/master/LICENSE.md)
|
||||
License - MIT
|
||||
License File - laravel.license
|
||||
|
||||
|
||||
web/documentserver-example/python
|
||||
|
||||
django-stubs - PEP-484 stubs for Django. (https://github.com/typeddjango/django-stubs/blob/master/LICENSE.md)
|
||||
|
||||
@ -1,8 +1,6 @@
|
||||
# Change Log
|
||||
|
||||
- nodejs: support vsdx in diagram editor
|
||||
- nodejs: user role
|
||||
- nodejs: start filling
|
||||
- support vsdx in diagram editor
|
||||
|
||||
## 1.13.0
|
||||
- nodejs: rename in wopi
|
||||
|
||||
@ -5,7 +5,7 @@ Do NOT use these integration examples on your own server without proper code mod
|
||||
In case you enabled any of the test examples, disable it before going for production.
|
||||
|
||||
These examples show the way to integrate [ONLYOFFICE Docs][2] into your own website or application using one of the programming languages.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Go, Java, Java Spring, Node.js, PHP, PHP (Laravel), Python and Ruby.
|
||||
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Java Spring, Node.js, PHP, Python and Ruby.
|
||||
|
||||
You should change `http://documentserver` to your server address in these files:
|
||||
* [.Net (C# MVC)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp-mvc) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
|
||||
@ -15,7 +15,6 @@ You should change `http://documentserver` to your server address in these files:
|
||||
* [Java Spring](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java-spring) - `web/documentserver-example/java-spring/src/main/resources/application.properties`
|
||||
* [Node.js](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/nodejs) - `web/documentserver-example/nodejs/config/default.json`
|
||||
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/src/configuration/ConfigurationManager.php`
|
||||
* [PHP (Laravel)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php-laravel) - `web/documentserver-example/php-laravel/.env.example`
|
||||
* [Python](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/python) - `web/documentserver-example/python/src/configuration/configuration.py`
|
||||
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/app/configuration/configuration.rb`
|
||||
|
||||
|
||||
BIN
web/documentserver-example/csharp-mvc/Content/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -631,6 +631,11 @@ footer table tr td:first-child {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -217,9 +217,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
var directoryInfo = new DirectoryInfo(directory);
|
||||
|
||||
// take files from the root directory
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly)
|
||||
.OrderByDescending(f => f.LastWriteTimeUtc)
|
||||
.ToList();
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
@ -83,8 +83,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null,
|
||||
string fileName = null)
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -92,7 +91,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
var title = string.IsNullOrEmpty(fileName) ? Path.GetFileName(documentUri) : fileName;
|
||||
var title = Path.GetFileName(documentUri);
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -35,7 +35,8 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
Word,
|
||||
Cell,
|
||||
Slide,
|
||||
Pdf
|
||||
Pdf,
|
||||
Diagram
|
||||
}
|
||||
|
||||
// get file type
|
||||
@ -47,6 +48,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
if (FormatManager.DocumentExtensions().Contains(ext)) return FileType.Word; // word type for document extensions
|
||||
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return FileType.Cell; // cell type for spreadsheet extensions
|
||||
if (FormatManager.PresentationExtensions().Contains(ext)) return FileType.Slide; // slide type for presentation extensions
|
||||
if (FormatManager.DiagramExtensions().Contains(ext)) return FileType.Diagram; // diagram type for diagram extensions
|
||||
|
||||
return FileType.Null; // the default type is word
|
||||
}
|
||||
@ -202,6 +204,20 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> DiagramExtensions()
|
||||
{
|
||||
return Diagrams()
|
||||
.Select(format => format.Extension())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<Format> Diagrams()
|
||||
{
|
||||
return All()
|
||||
.Where(format => format.Type == FileType.Diagram)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> AllExtensions()
|
||||
{
|
||||
return All()
|
||||
|
||||
@ -415,12 +415,14 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -280,7 +280,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang, fileName);
|
||||
var result = ServiceConverter.GetConvertedData(downloadUri.ToString(), extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
@ -990,7 +990,7 @@ namespace OnlineEditorsExampleMVC
|
||||
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
|
||||
var changesArray = (ArrayList)changes["changes"];
|
||||
var change = changesArray.Count > 0
|
||||
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
|
||||
BIN
web/documentserver-example/csharp/App_Themes/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -635,6 +635,11 @@ footer a:hover {
|
||||
background-image: url("images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -254,6 +254,7 @@ namespace OnlineEditorsExample
|
||||
if (FormatManager.DocumentExtensions().Contains(ext)) return "word"; // word for text document extensions
|
||||
if (FormatManager.SpreadsheetExtensions().Contains(ext)) return "cell"; // cell for spreadsheet extensions
|
||||
if (FormatManager.PresentationExtensions().Contains(ext)) return "slide"; // slide for presentation extensions
|
||||
if (FormatManager.DiagramExtensions().Contains(ext)) return "diagram"; // diagram for diagram extensions
|
||||
|
||||
return "word"; // the default document type is word
|
||||
}
|
||||
@ -469,7 +470,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
// get the url and file type of the converted file
|
||||
Dictionary<string, string> newFileData;
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang, _fileName);
|
||||
var result = ServiceConverter.GetConvertedData(fileUrl.ToString() , extension, conversionExtension, key, true, out newFileData, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
|
||||
@ -562,10 +563,7 @@ namespace OnlineEditorsExample
|
||||
var directoryInfo = new DirectoryInfo(directory); // read the user host directory contents
|
||||
|
||||
// get the list of stored files from the host directory
|
||||
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
|
||||
storedFiles.Sort((a, b) => b.LastWriteTimeUtc.CompareTo(a.LastWriteTimeUtc)); // sort files by the modification date
|
||||
|
||||
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
|
||||
return storedFiles;
|
||||
}
|
||||
|
||||
|
||||
@ -85,8 +85,7 @@ namespace ASC.Api.DocumentConverter
|
||||
bool isAsync,
|
||||
out Dictionary<string, string> convertedDocumentData,
|
||||
string filePass = null,
|
||||
string lang = null,
|
||||
string filename = null)
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentData = new Dictionary<string, string>();
|
||||
|
||||
@ -94,7 +93,7 @@ namespace ASC.Api.DocumentConverter
|
||||
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
var title = string.IsNullOrEmpty(filename) ? Path.GetFileName(documentUri) : filename;
|
||||
var title = Path.GetFileName(documentUri);
|
||||
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
|
||||
|
||||
// get document key
|
||||
|
||||
@ -164,6 +164,20 @@ namespace OnlineEditorsExample
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> DiagramExtensions()
|
||||
{
|
||||
return Diagrams()
|
||||
.Select(format => format.Extension())
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<Format> Diagrams()
|
||||
{
|
||||
return All()
|
||||
.Where(format => format.Type == "diagram")
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static List<string> AllExtensions()
|
||||
{
|
||||
return All()
|
||||
|
||||
@ -778,7 +778,7 @@ namespace OnlineEditorsExample
|
||||
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(changesPath));
|
||||
var changesArray = (ArrayList)changes["changes"];
|
||||
var change = changesArray.Count > 0
|
||||
? (Dictionary<string, object>)changesArray[changesArray.Count - 1]
|
||||
? (Dictionary<string, object>)changesArray[0]
|
||||
: new Dictionary<string, object>();
|
||||
|
||||
// write information about changes to the object
|
||||
|
||||
@ -415,12 +415,14 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -29,4 +29,5 @@ type ExtensionTypes struct {
|
||||
Presentation []string `json:"presentation"`
|
||||
Document []string `json:"document"`
|
||||
Pdf []string `json:"pdf"`
|
||||
Diagram []string `json:"diagram"`
|
||||
}
|
||||
|
||||
@ -93,6 +93,7 @@ func NewSpecification() (specification SpecificationConfig, err error) {
|
||||
fm.GetPresentationExtensions(),
|
||||
fm.GetDocumentExtensions(),
|
||||
fm.GetPdfExtensions(),
|
||||
fm.GetDiagramExtensions(),
|
||||
}
|
||||
specification = SpecificationConfig{
|
||||
exts,
|
||||
|
||||
@ -79,7 +79,7 @@ func (srv *DefaultServerEndpointsHandler) Convert(w http.ResponseWriter, r *http
|
||||
return
|
||||
}
|
||||
|
||||
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true, filename)
|
||||
newUrl, newExt, err := srv.ConversionManager.GetConverterUri(fileUrl, fileExt, toExt, key, true)
|
||||
if err != nil {
|
||||
response.Error = err.Error()
|
||||
srv.logger.Errorf("File conversion error: %s", err.Error())
|
||||
|
||||
@ -96,10 +96,6 @@ func (srv *DefaultServerEndpointsHandler) Create(w http.ResponseWriter, r *http.
|
||||
srv.logger.Errorf("meta creation error: %s", err.Error())
|
||||
}
|
||||
|
||||
res := map[string]interface{}{
|
||||
"file": correctName,
|
||||
}
|
||||
shared.SendResponse(w, res)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -45,11 +45,15 @@ func (srv *DefaultServerEndpointsHandler) Reference(w http.ResponseWriter, r *ht
|
||||
|
||||
var fileKey map[string]string
|
||||
err := json.Unmarshal([]byte(body.ReferenceData.FileKey), &fileKey)
|
||||
if err == nil {
|
||||
path, _ := srv.GenerateFilePath(fileKey["fileName"])
|
||||
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
|
||||
fileName = fileKey["fileName"]
|
||||
}
|
||||
if err != nil {
|
||||
srv.logger.Error("FileKey decoding error")
|
||||
shared.SendDocumentServerRespose(w, true)
|
||||
return
|
||||
}
|
||||
|
||||
path, _ := srv.GenerateFilePath(fileKey["fileName"])
|
||||
if body.ReferenceData.InstanceId == remoteAddr && srv.PathExists(path) {
|
||||
fileName = fileKey["fileName"]
|
||||
}
|
||||
|
||||
if fileName == "" && body.Link != "" {
|
||||
|
||||
@ -44,7 +44,7 @@ func (srv *DefaultServerEndpointsHandler) Upload(w http.ResponseWriter, r *http.
|
||||
srv.logger.Debug("A new upload call")
|
||||
if !srv.DocumentManager.IsDocumentConvertable(handler.Filename) {
|
||||
srv.logger.Errorf("File %s is not supported", handler.Filename)
|
||||
shared.SendResponse(w, map[string]string{"error": "File type is not supported"})
|
||||
shared.SendCustomErrorResponse(w, "File type is not supported")
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@ -77,7 +77,7 @@ type ConversionManager interface {
|
||||
GetInternalExtension(fileType string) string
|
||||
IsCanConvert(ext string) bool
|
||||
IsCanFill(ext string) bool
|
||||
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool, title string) (string, string, error)
|
||||
GetConverterUri(docUri, fromExt, toExt, docKey string, isAsync bool) (string, string, error)
|
||||
}
|
||||
|
||||
type CommandManager interface {
|
||||
|
||||
@ -68,6 +68,9 @@ func (cm DefaultConversionManager) GetFileType(filename string) string {
|
||||
if utils.IsInList(ext, exts.Presentation) {
|
||||
return shared.ONLYOFFICE_PRESENTATION
|
||||
}
|
||||
if utils.IsInList(ext, exts.Diagram) {
|
||||
return shared.ONLYOFFICE_DIAGRAM
|
||||
}
|
||||
|
||||
return shared.ONLYOFFICE_DOCUMENT
|
||||
}
|
||||
@ -99,7 +102,6 @@ func (cm DefaultConversionManager) GetConverterUri(
|
||||
toExt string,
|
||||
docKey string,
|
||||
isAsync bool,
|
||||
title string,
|
||||
) (string, string, error) {
|
||||
if fromExt == "" {
|
||||
fromExt = utils.GetFileExt(docUri, true)
|
||||
@ -109,7 +111,7 @@ func (cm DefaultConversionManager) GetConverterUri(
|
||||
DocUrl: docUri,
|
||||
OutputType: strings.ReplaceAll(toExt, ".", ""),
|
||||
FileType: fromExt,
|
||||
Title: title,
|
||||
Title: utils.GetFileName(docUri),
|
||||
Key: docKey,
|
||||
Async: isAsync,
|
||||
StandardClaims: jwt.StandardClaims{
|
||||
|
||||
@ -94,7 +94,7 @@ func (sm DefaultStorageManager) GetStoredFiles(remoteAddress string) ([]models.D
|
||||
}
|
||||
|
||||
sort.Slice(files, func(i, j int) bool {
|
||||
return !files[i].ModTime().Before(files[j].ModTime())
|
||||
return files[i].ModTime().Before(files[j].ModTime())
|
||||
})
|
||||
|
||||
for _, v := range files {
|
||||
|
||||
@ -86,9 +86,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
|
||||
Goback: map[string]interface{}{
|
||||
"text": "Go to Documents",
|
||||
},
|
||||
Close: map[string]interface{}{
|
||||
"visible": true,
|
||||
},
|
||||
Close: nil,
|
||||
},
|
||||
{
|
||||
Id: "uid-3",
|
||||
@ -108,9 +106,7 @@ func NewDefaultUserManager(logger *zap.SugaredLogger) managers.UserManager {
|
||||
Templates: false,
|
||||
Avatar: false,
|
||||
Goback: nil,
|
||||
Close: map[string]interface{}{
|
||||
"visible": true,
|
||||
},
|
||||
Close: nil,
|
||||
},
|
||||
}
|
||||
return &DefaultUserManager{
|
||||
|
||||
@ -22,5 +22,6 @@ const (
|
||||
ONLYOFFICE_SPREADSHEET = "cell"
|
||||
ONLYOFFICE_PRESENTATION = "slide"
|
||||
ONLYOFFICE_PDF = "pdf"
|
||||
ONLYOFFICE_DIAGRAM = "diagram"
|
||||
ONLYOFFICE_HISTORY_POSTFIX = "-hist"
|
||||
)
|
||||
|
||||
BIN
web/documentserver-example/go/static/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -16,6 +16,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var formatManager;
|
||||
|
||||
window.onload = function () {
|
||||
@ -41,8 +42,19 @@ window.onload = function () {
|
||||
if (typeof jQuery !== "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
|
||||
directUrl = getUrlVars()["directUrl"] == "true";
|
||||
|
||||
mustReload = false;
|
||||
|
||||
if (directUrl)
|
||||
jq("#directUrl").prop("checked", directUrl);
|
||||
else
|
||||
directUrl = jq("#directUrl").prop("checked");
|
||||
|
||||
jq("#directUrl").change(function() {
|
||||
window.location = "?directUrl=" + jq(this).prop("checked");
|
||||
});
|
||||
|
||||
jq(function () {
|
||||
jq("#fileupload").fileupload({
|
||||
dataType: "json",
|
||||
@ -265,7 +277,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?mode=edit&fileName=" + fileId;
|
||||
var url = UrlEditor + "?mode=edit&fileName=" + fileId+ "&directUrl=" + directUrl;
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
@ -274,7 +286,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId;
|
||||
var url = UrlEditor + "?mode=view&fileName=" + fileId+ "&directUrl=" + directUrl;
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
@ -283,7 +295,7 @@ if (typeof jQuery !== "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq("#hiddenFileName").val());
|
||||
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId;
|
||||
var url = UrlEditor + "?type=embedded&mode=embedded&fileName=" + fileId + "&directUrl=" + directUrl;
|
||||
|
||||
jq("#mainProgress").addClass("embedded");
|
||||
jq("#beginEmbedded").addClass("disable");
|
||||
@ -402,12 +414,14 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -632,6 +632,11 @@ footer table tr td:first-child {
|
||||
background-image: url("../images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("../images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -48,6 +48,7 @@ type FormatManager interface {
|
||||
GetSpreadsheetExtensions() []string
|
||||
GetPresentationExtensions() []string
|
||||
GetPdfExtensions() []string
|
||||
GetDiagramExtensions() []string
|
||||
}
|
||||
|
||||
func NewFormatManager() (FormatManager, error) {
|
||||
@ -141,10 +142,19 @@ func (fm DefaultFormatManager) GetPresentationExtensions() (slide []string) {
|
||||
return
|
||||
}
|
||||
|
||||
func (fm DefaultFormatManager) GetPdfExtensions() (slide []string) {
|
||||
func (fm DefaultFormatManager) GetPdfExtensions() (pdf []string) {
|
||||
for _, f := range fm.formats {
|
||||
if f.FormatType == "pdf" {
|
||||
slide = append(slide, f.Name)
|
||||
pdf = append(pdf, f.Name)
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func (fm DefaultFormatManager) GetDiagramExtensions() (diagram []string) {
|
||||
for _, f := range fm.formats {
|
||||
if f.FormatType == "diagram" {
|
||||
diagram = append(diagram, f.Name)
|
||||
}
|
||||
}
|
||||
return
|
||||
|
||||
@ -84,7 +84,7 @@
|
||||
<dependency>
|
||||
<groupId>com.onlyoffice</groupId>
|
||||
<artifactId>docs-integration-sdk</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<version>1.4.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents.core5</groupId>
|
||||
|
||||
@ -256,7 +256,6 @@ public class FileController {
|
||||
.outputtype(conversionExtension)
|
||||
.region(lang)
|
||||
.async(true)
|
||||
.title(fileName)
|
||||
.build();
|
||||
|
||||
ConvertResponse convertResponse = convertService.processConvert(convertRequest, fileName);
|
||||
|
||||
@ -123,10 +123,7 @@ public class DefaultHistoryManager implements HistoryManager {
|
||||
History changes = objectMapper.readValue(changesSteam, History.class);
|
||||
|
||||
List<Object> historyChanges = changes.getChanges();
|
||||
Map<String, Object> historyChange = objectMapper.convertValue(
|
||||
historyChanges.get(historyChanges.size() - 1),
|
||||
Map.class
|
||||
);
|
||||
Map<String, Object> historyChange = objectMapper.convertValue(historyChanges.get(0), Map.class);
|
||||
|
||||
// write information about changes to the object
|
||||
version.setChanges(changes.getChanges());
|
||||
|
||||
@ -46,8 +46,6 @@ import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@ -319,9 +317,7 @@ public class LocalFileStorage implements FileStorageMutator, FileStoragePathBuil
|
||||
// get a collection of all the stored files
|
||||
public File[] getStoredFiles() {
|
||||
File file = new File(getStorageLocation());
|
||||
File[] files = file.listFiles(pathname -> pathname.isFile());
|
||||
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
||||
return files;
|
||||
return file.listFiles(pathname -> pathname.isFile());
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
|
||||
@ -274,7 +274,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
@ -283,7 +282,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
@ -407,12 +405,14 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -303,7 +303,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, fileName);
|
||||
.getConvertedData(fileUri, fileExt, conversionExtension, key, filePass, true, lang);
|
||||
String newFileUri = newFileData.get("fileUrl");
|
||||
String newFileType = newFileData.get("fileType");
|
||||
|
||||
@ -960,8 +960,7 @@ public class IndexServlet extends HttpServlet {
|
||||
JSONObject changes = (JSONObject) parser.parse(
|
||||
DocumentManager.readFileToEnd(new File(DocumentManager
|
||||
.versionDir(histDir, i - 1) + File.separator + "changes.json")));
|
||||
JSONObject change = (JSONObject) ((JSONArray) changes.get("changes"))
|
||||
.get(((JSONArray) changes.get("changes")).size() - 1);
|
||||
JSONObject change = (JSONObject) ((JSONArray) changes.get("changes")).get(0);
|
||||
|
||||
// write information about changes to the object
|
||||
obj.put("changes", !change.isEmpty() ? changes.get("changes") : null);
|
||||
|
||||
@ -33,5 +33,8 @@ public enum FileType {
|
||||
SLIDE,
|
||||
@JsonProperty("pdf")
|
||||
@SerializedName("pdf")
|
||||
PDF
|
||||
PDF,
|
||||
@JsonProperty("diagram")
|
||||
@SerializedName("diagram")
|
||||
DIAGRAM
|
||||
}
|
||||
|
||||
@ -50,7 +50,6 @@ import java.text.SimpleDateFormat;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
@ -292,17 +291,12 @@ public final class DocumentManager {
|
||||
String directory = filesRootPath(userAddress);
|
||||
|
||||
File file = new File(directory);
|
||||
|
||||
File[] files = file.listFiles(new FileFilter() { // take only files from the root directory
|
||||
return file.listFiles(new FileFilter() { // take only files from the root directory
|
||||
@Override
|
||||
public boolean accept(final File pathname) {
|
||||
return pathname.isFile();
|
||||
}
|
||||
});
|
||||
|
||||
Arrays.sort(files, Comparator.comparingLong(File::lastModified).reversed());
|
||||
|
||||
return files;
|
||||
}
|
||||
|
||||
// create demo document
|
||||
|
||||
@ -140,13 +140,13 @@ public final class ServiceConverter {
|
||||
public static Map<String, String> getConvertedData(final String documentUri, final String fromExtension,
|
||||
final String toExtension, final String documentRevisionId,
|
||||
final String filePass, final Boolean isAsync,
|
||||
final String lang, final String filename) throws Exception {
|
||||
final String lang) throws Exception {
|
||||
// check if the fromExtension parameter is defined; if not, get it from the document url
|
||||
String fromExt = fromExtension == null || fromExtension.isEmpty()
|
||||
? FileUtility.getFileExtension(documentUri) : fromExtension;
|
||||
|
||||
// check if the file name parameter is defined; if not, get random uuid for this file
|
||||
String title = filename == null || filename.isEmpty() ? FileUtility.getFileName(documentUri) : filename;
|
||||
String title = FileUtility.getFileName(documentUri);
|
||||
title = title == null || title.isEmpty() ? UUID.randomUUID().toString() : title;
|
||||
|
||||
String documentRevId = documentRevisionId == null || documentRevisionId.isEmpty()
|
||||
|
||||
@ -158,7 +158,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri),
|
||||
null, false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
null, false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
|
||||
// get the correct file name if it already exists
|
||||
@ -250,7 +250,7 @@ public final class TrackManager {
|
||||
String newFileUri = ServiceConverter
|
||||
.getConvertedData(downloadUri, downloadExt, curExt,
|
||||
ServiceConverter.generateRevisionId(downloadUri), null,
|
||||
false, null, null).get("fileUrl"); // convert file and get url to a new file
|
||||
false, null).get("fileUrl"); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = true;
|
||||
} else {
|
||||
|
||||
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -634,6 +634,11 @@ footer table tr td:first-child {
|
||||
background-image: url("img/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("img/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
@ -281,7 +281,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
@ -290,7 +289,6 @@ if (typeof jQuery !== "undefined") {
|
||||
window.open(url, "_blank");
|
||||
jq("#hiddenFileName").val("");
|
||||
jq.unblockUI();
|
||||
document.location.reload();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
@ -414,12 +412,14 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -500,7 +500,7 @@ app.post('/convert', (req, res) => { // define a handler for converting files
|
||||
|
||||
key = documentService.generateRevisionId(key); // get document key
|
||||
// get the url to the converted file
|
||||
documentService.getConvertedUri(fileUri, fileExt, convExt, key, true, callback, filePass, lang, fileName);
|
||||
documentService.getConvertedUri(fileUri, fileExt, convExt, 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);
|
||||
@ -1139,7 +1139,6 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
const { reviewGroups } = user;
|
||||
const { commentGroups } = user;
|
||||
const { userInfoGroups } = user;
|
||||
const userRoles = user.roles;
|
||||
|
||||
const usersInfo = [];
|
||||
const usersForProtect = [];
|
||||
@ -1181,7 +1180,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
|
||||
let submitForm = false;
|
||||
if (mode !== 'view') {
|
||||
submitForm = user.canSubmitForm;
|
||||
submitForm = userid === 'uid-1';
|
||||
}
|
||||
|
||||
if (user.goback != null) {
|
||||
@ -1227,7 +1226,6 @@ app.get('/editor', (req, res) => { // define a handler for editing document
|
||||
userImage: user.avatar ? `${req.DocManager.getServerUrl()}/images/${user.id}.png` : null,
|
||||
name,
|
||||
userGroup,
|
||||
userRoles,
|
||||
reviewGroups: JSON.stringify(reviewGroups),
|
||||
commentGroups: JSON.stringify(commentGroups),
|
||||
userInfoGroups: JSON.stringify(userInfoGroups),
|
||||
|
||||
@ -533,8 +533,7 @@ DocManager.prototype.getHistory = function getHistory(fileName, content, keyVers
|
||||
let createdFromJson = null;
|
||||
if (fileContent) { // if content is defined
|
||||
if (fileContent.changes && fileContent.changes.length) { // and there are some modifications in the content
|
||||
// write these modifications to the json content
|
||||
contentJson = fileContent.changes[fileContent.changes.length - 1];
|
||||
[contentJson] = fileContent.changes; // write these modifications to the json content
|
||||
} else if (fileContent.length) {
|
||||
[contentJson] = fileContent; // otherwise, write original content to the json content
|
||||
oldVersion = true; // and note that this is an old version
|
||||
|
||||
@ -60,13 +60,12 @@ documentService.getConvertedUri = function getConvertedUri(
|
||||
callback,
|
||||
filePass = null,
|
||||
lang = null,
|
||||
filename = null,
|
||||
) {
|
||||
// get the current document extension
|
||||
const fromExt = fromExtension || fileUtility.getFileExtension(documentUri, false, true);
|
||||
|
||||
// get the current document name or uuid
|
||||
const title = filename || fileUtility.getFileNameFromUrl(documentUri) || guidManager.newGuid();
|
||||
const title = fileUtility.getFileNameFromUrl(documentUri) || guidManager.newGuid();
|
||||
|
||||
// generate the document key value
|
||||
const revisionId = documentService.generateRevisionId(documentRevisionId || documentUri);
|
||||
|
||||
@ -32,8 +32,6 @@ class User {
|
||||
avatar,
|
||||
goback,
|
||||
close,
|
||||
canSubmitForm,
|
||||
roles,
|
||||
) {
|
||||
this.id = id;
|
||||
this.name = name;
|
||||
@ -49,8 +47,6 @@ class User {
|
||||
this.avatar = avatar;
|
||||
this.goback = goback;
|
||||
this.close = close;
|
||||
this.canSubmitForm = canSubmitForm;
|
||||
this.roles = roles;
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,8 +60,6 @@ const descrUser1 = [
|
||||
'Can see the information about all users',
|
||||
'Can submit forms',
|
||||
'Has an avatar',
|
||||
'Has no roles',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser2 = [
|
||||
@ -75,10 +69,8 @@ const descrUser2 = [
|
||||
'This file is marked as favorite',
|
||||
'Can create new files from the editor',
|
||||
'Can see the information about users from Group2 and users who don’t belong to any group',
|
||||
'Can submit forms',
|
||||
'Can’t submit forms',
|
||||
'Has an avatar',
|
||||
'Has role "Anyone"',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser3 = [
|
||||
@ -94,8 +86,6 @@ const descrUser3 = [
|
||||
'Can’t submit forms',
|
||||
'Can’t close history',
|
||||
'Can’t restore the file version',
|
||||
'Has role "role"',
|
||||
'Can start filling',
|
||||
];
|
||||
|
||||
const descrUser0 = [
|
||||
@ -113,8 +103,6 @@ const descrUser0 = [
|
||||
'View file without collaboration',
|
||||
'Can’t submit forms',
|
||||
'Can’t refresh outdated file',
|
||||
'Has empty role',
|
||||
'Can’t start filling',
|
||||
];
|
||||
|
||||
const users = [
|
||||
@ -133,8 +121,6 @@ const users = [
|
||||
true,
|
||||
{ blank: false },
|
||||
{ visible: false },
|
||||
true,
|
||||
null,
|
||||
),
|
||||
new User(
|
||||
'uid-2',
|
||||
@ -155,8 +141,6 @@ const users = [
|
||||
true,
|
||||
{ text: 'Go to Documents' },
|
||||
{},
|
||||
true,
|
||||
[ 'Anyone' ],
|
||||
),
|
||||
new User(
|
||||
'uid-3',
|
||||
@ -177,10 +161,8 @@ const users = [
|
||||
false,
|
||||
null,
|
||||
{},
|
||||
false,
|
||||
[ 'role' ],
|
||||
),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null, false, []),
|
||||
new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null, null),
|
||||
];
|
||||
|
||||
// get a list of all the users
|
||||
|
||||
@ -454,12 +454,14 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
/**
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-family: Arial, Tahoma,sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow-y: hidden;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.form {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
@ -60,8 +60,7 @@
|
||||
"group": "<%- editor.userGroup %>",
|
||||
"id": "<%- editor.userid %>",
|
||||
"image": "<%- editor.userImage %>",
|
||||
"name": "<%- editor.name %>",
|
||||
"roles": <%- JSON.stringify(editor.userRoles) %>
|
||||
"name": "<%- editor.name %>"
|
||||
}
|
||||
},
|
||||
"height": "100%",
|
||||
|
||||
@ -27,7 +27,34 @@
|
||||
<link rel="icon"
|
||||
href="images/<%- editor.documentType %>.ico"
|
||||
type="image/x-icon" />
|
||||
<link rel="stylesheet" type="text/css" href="stylesheets/editor.css" />
|
||||
<style>
|
||||
html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-family: Arial, Tahoma,sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
overflow-y: hidden;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.form {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="form">
|
||||
@ -368,18 +395,6 @@
|
||||
};
|
||||
};
|
||||
|
||||
var onRequestStartFilling = function(event) {
|
||||
var data = event.data;
|
||||
var submit = confirm("Start filling?\n" + JSON.stringify(data));
|
||||
if (submit) {
|
||||
docEditor.startFilling(true);
|
||||
}
|
||||
};
|
||||
|
||||
var onStartFilling = function(event) {
|
||||
innerAlert("The form is ready to fill out.");
|
||||
};
|
||||
|
||||
var onDocumentReady = function(){
|
||||
fixSize();
|
||||
};
|
||||
@ -414,8 +429,6 @@
|
||||
config.events.onRequestReferenceData = onRequestReferenceData;
|
||||
config.events.onRequestReferenceSource = onRequestReferenceSource;
|
||||
config.events.onRequestRefreshFile = onRequestRefreshFile;
|
||||
config.events.onRequestStartFilling = onRequestStartFilling;
|
||||
config.events.onStartFilling = onStartFilling;
|
||||
if (<%- JSON.stringify(editor.userid) %> != "uid-3") {
|
||||
config.events.onRequestHistoryClose = onRequestHistoryClose;
|
||||
config.events.onRequestRestore = onRequestRestore;
|
||||
|
||||
@ -90,7 +90,7 @@ class ReferenceController extends Controller
|
||||
'instanceId' => $storagePublicUrl,
|
||||
],
|
||||
'path' => $filename,
|
||||
'link' => $request->getScheme().'://'.$request->getHost().'/editor?fileID='.$filename,
|
||||
'link' => "$storagePublicUrl/editor?fileID=$filename",
|
||||
];
|
||||
|
||||
if ($settings->getSetting('jwt.enabled')) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
* (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.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
* (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.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Copyright Ascensio System SIA 2025
|
||||
* (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.
|
||||
|
||||
@ -35,7 +35,6 @@ class ConvertRequest
|
||||
$data['key'],
|
||||
false,
|
||||
$data['lang'],
|
||||
$data['filename'],
|
||||
);
|
||||
|
||||
if (property_exists($result, 'Error')) {
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
//
|
||||
// (c) Copyright Ascensio System SIA 2025
|
||||
// (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.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Copyright Ascensio System SIA 2025.
|
||||
* (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.
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* (c) Copyright Ascensio System SIA 2025.
|
||||
* (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.
|
||||
|
||||
@ -5,10 +5,10 @@ namespace App\UseCases\Document\Update;
|
||||
use App\Helpers\Path\Path;
|
||||
use App\Models\Version;
|
||||
use App\Models\VersionInfo;
|
||||
use App\OnlyOffice\Managers\SettingsManager;
|
||||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Repositories\VersionRepository;
|
||||
use App\Services\ServerConfig;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class ChangeDocumentVersionCommand
|
||||
@ -17,7 +17,7 @@ class ChangeDocumentVersionCommand
|
||||
private FileRepository $fileRepository,
|
||||
private VersionRepository $versionRepository,
|
||||
private UserRepository $userRepository,
|
||||
private SettingsManager $settings,
|
||||
private ServerConfig $serverConfig,
|
||||
) {}
|
||||
|
||||
public function __invoke(ChangeDocumentVersionRequest $request): void
|
||||
@ -33,8 +33,8 @@ class ChangeDocumentVersionCommand
|
||||
if ($request->url) {
|
||||
$data = file_get_contents(
|
||||
str_replace(
|
||||
$this->settings->getSetting('url.server.public'),
|
||||
$this->settings->getSetting('url.server.private'),
|
||||
$this->serverConfig->get('url.public'),
|
||||
$this->serverConfig->get('url.private'),
|
||||
$request->url),
|
||||
false,
|
||||
stream_context_create(['http' => ['timeout' => 5]])
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
"firebase/php-jwt": "^6.10",
|
||||
"laravel/framework": "^11.0",
|
||||
"laravel/tinker": "^2.9",
|
||||
"onlyoffice/docs-integration-sdk": "^1.2"
|
||||
"onlyoffice/docs-integration-sdk": "dev-feature/diagram"
|
||||
},
|
||||
"require-dev": {
|
||||
"fakerphp/faker": "^1.23",
|
||||
|
||||
16
web/documentserver-example/php-laravel/composer.lock
generated
@ -4,7 +4,7 @@
|
||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||
"This file is @generated automatically"
|
||||
],
|
||||
"content-hash": "ccf9e46d33350e7606c494225b794de1",
|
||||
"content-hash": "d4ee81f9421da2deb58e94784aafa3b3",
|
||||
"packages": [
|
||||
{
|
||||
"name": "brick/math",
|
||||
@ -2382,16 +2382,16 @@
|
||||
},
|
||||
{
|
||||
"name": "onlyoffice/docs-integration-sdk",
|
||||
"version": "v1.2.0",
|
||||
"version": "dev-feature/diagram",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ONLYOFFICE/docs-integration-sdk-php.git",
|
||||
"reference": "31a038dfea8c2a383ab7b1854e720ba40d25ec68"
|
||||
"reference": "ad47131e692cce1ff266955e6febbab9ac3bdeec"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/ONLYOFFICE/docs-integration-sdk-php/zipball/31a038dfea8c2a383ab7b1854e720ba40d25ec68",
|
||||
"reference": "31a038dfea8c2a383ab7b1854e720ba40d25ec68",
|
||||
"url": "https://api.github.com/repos/ONLYOFFICE/docs-integration-sdk-php/zipball/ad47131e692cce1ff266955e6febbab9ac3bdeec",
|
||||
"reference": "ad47131e692cce1ff266955e6febbab9ac3bdeec",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -2431,7 +2431,7 @@
|
||||
"issues": "https://github.com/ONLYOFFICE/docs-integration-sdk-php/issues",
|
||||
"source": "https://github.com/ONLYOFFICE/docs-integration-sdk-php"
|
||||
},
|
||||
"time": "2025-02-14T13:01:23+00:00"
|
||||
"time": "2025-02-14T13:08:36+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpoption/phpoption",
|
||||
@ -8317,7 +8317,9 @@
|
||||
],
|
||||
"aliases": [],
|
||||
"minimum-stability": "stable",
|
||||
"stability-flags": {},
|
||||
"stability-flags": {
|
||||
"onlyoffice/docs-integration-sdk": 20
|
||||
},
|
||||
"prefer-stable": true,
|
||||
"prefer-lowest": false,
|
||||
"platform": {
|
||||
|
||||
@ -446,7 +446,8 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
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");
|
||||
|
||||
@ -631,6 +631,11 @@ footer table tr td:first-child {
|
||||
background-image: url("/assets/images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("/assets/images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
BIN
web/documentserver-example/php/assets/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -430,12 +430,14 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||
@ -252,8 +252,7 @@ function convert()
|
||||
true,
|
||||
$newFileUri,
|
||||
$filePass,
|
||||
$lang,
|
||||
$fileName
|
||||
$lang
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$result["error"] = "error: " . $e->getMessage();
|
||||
@ -677,7 +676,7 @@ function restore()
|
||||
|
||||
if ($url) {
|
||||
$data = file_get_contents(
|
||||
getCorrectUrl($url),
|
||||
$url,
|
||||
false,
|
||||
stream_context_create(["http" => ["timeout" => 5]])
|
||||
);
|
||||
|
||||
@ -659,8 +659,7 @@ function sendRequestToConvertService(
|
||||
$documentRevisionID,
|
||||
$async,
|
||||
$filePass,
|
||||
$lang,
|
||||
$fileName = null
|
||||
$lang
|
||||
) {
|
||||
$configManager = new ConfigurationManager();
|
||||
|
||||
@ -670,7 +669,7 @@ function sendRequestToConvertService(
|
||||
}
|
||||
|
||||
// if title is undefined, then replace it with a random guid
|
||||
$title = $fileName ?? basename($documentURL);
|
||||
$title = basename($documentURL);
|
||||
if (empty($title)) {
|
||||
$title = guid();
|
||||
}
|
||||
@ -759,8 +758,7 @@ function getConvertedData(
|
||||
$async,
|
||||
&$convertedDocumentURL,
|
||||
$filePass,
|
||||
$lang,
|
||||
$fileName = null
|
||||
$lang
|
||||
) {
|
||||
$convertedDocumentURL = "";
|
||||
$responceFromConvertService = sendRequestToConvertService(
|
||||
@ -770,8 +768,7 @@ function getConvertedData(
|
||||
$documentRevisionID,
|
||||
$async,
|
||||
$filePass,
|
||||
$lang,
|
||||
$fileName
|
||||
$lang
|
||||
);
|
||||
$json = json_decode($responceFromConvertService, true);
|
||||
|
||||
@ -968,7 +965,7 @@ function getHistory($filename, $filetype, $docKey, $fileuri, $isEnableDirectUrl)
|
||||
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"][count($changes["changes"]) - 1];
|
||||
$change = $changes["changes"][0];
|
||||
|
||||
// write information about changes to the object
|
||||
$obj["changes"] = $changes ? $changes["changes"] : null;
|
||||
|
||||
@ -359,8 +359,8 @@ function commandRequest($method, $key, $meta = null)
|
||||
if ($responseData === false) {
|
||||
throw new Exception('Document Server connection error.');
|
||||
}
|
||||
$error = json_decode(html_entity_decode($responseData), true)['error'];
|
||||
if ($error !== 0 && $error !== 4) {
|
||||
$error = json_decode($responseData, true)['error'];
|
||||
if ($error !== 0) {
|
||||
throw new Exception('Command Service Error #'. $error);
|
||||
}
|
||||
|
||||
|
||||
@ -83,6 +83,16 @@ class FormatManager():
|
||||
)
|
||||
return list(filtered)
|
||||
|
||||
def diagram_extensions(self) -> list[str]:
|
||||
formats = self.diagrams()
|
||||
mapped = map(lambda format: format.extension(), formats)
|
||||
return list(mapped)
|
||||
|
||||
def diagrams(self) -> list[Format]:
|
||||
formats = self.all()
|
||||
filtered = filter(lambda format: format.type == 'diagram', formats)
|
||||
return list(filtered)
|
||||
|
||||
def pdf_extensions(self) -> list[str]:
|
||||
formats = self.pdfs()
|
||||
mapped = map(lambda format: format.extension(), formats)
|
||||
|
||||
@ -54,5 +54,7 @@ def getFileType(uri):
|
||||
return 'cell'
|
||||
if ext in format_manager.presentation_extensions():
|
||||
return 'slide'
|
||||
if ext in format_manager.diagram_extensions():
|
||||
return 'diagram'
|
||||
|
||||
return 'word' # default file type is word
|
||||
|
||||
@ -195,7 +195,7 @@ def getHistoryObject(storagePath, filename, docKey, docUrl, isEnableDirectUrl, r
|
||||
if i > 1: # check if the version number is greater than 1 (the file was modified)
|
||||
# get the path to the changes.json file
|
||||
changes = json.loads(readFile(getChangesHistoryPath(prevVerDir)))
|
||||
change = changes['changes'][-1]
|
||||
change = changes['changes'][0]
|
||||
# write information about changes to the object
|
||||
obj['changes'] = changes['changes'] if change else None
|
||||
obj['serverVersion'] = changes['serverVersion']
|
||||
|
||||
@ -25,11 +25,11 @@ config_manager = ConfigurationManager()
|
||||
|
||||
|
||||
# convert file and give url to a new file
|
||||
def getConvertedData(docUri, fromExt, toExt, docKey, isAsync, filePass=None, lang=None, title=None):
|
||||
def getConvertedData(docUri, fromExt, toExt, docKey, isAsync, filePass=None, lang=None):
|
||||
if not fromExt: # check if the extension from the request matches the real file extension
|
||||
fromExt = fileUtils.getFileExt(docUri) # if not, overwrite the extension value
|
||||
|
||||
title = title or fileUtils.getFileName(docUri)
|
||||
title = fileUtils.getFileName(docUri)
|
||||
|
||||
payload = { # write all the necessary data to the payload object
|
||||
'url': docUri,
|
||||
|
||||
@ -86,7 +86,7 @@ def convert(request):
|
||||
|
||||
# get the url of the converted file
|
||||
convertedData = serviceConverter.getConvertedData(
|
||||
fileUri, fileExt, conversionExtension, key, True, filePass, lang, filename
|
||||
fileUri, fileExt, conversionExtension, key, True, filePass, lang
|
||||
)
|
||||
|
||||
# if the converter url is not received, the original file name is passed to the response
|
||||
@ -676,10 +676,7 @@ def restore(request: HttpRequest) -> HttpResponse:
|
||||
Path(bumped_changes_file).write_text(bumped_changes_content, 'utf-8')
|
||||
copy(source_file, bumped_file)
|
||||
if url is not None:
|
||||
data = requests.get(url.replace(
|
||||
config_manager.document_server_public_url().geturl(),
|
||||
config_manager.document_server_private_url().geturl()
|
||||
))
|
||||
data = requests.get(url)
|
||||
Path(source_file).write_bytes(data.content)
|
||||
else:
|
||||
copy(recovery_file, source_file)
|
||||
|
||||
@ -632,6 +632,11 @@ footer table tr td:first-child {
|
||||
background-image: url("../images/icon_pdf.svg");
|
||||
}
|
||||
|
||||
.stored-edit.diagram,
|
||||
.uploadFileName.diagram {
|
||||
background-image: url("../images/icon_vsdx.svg");
|
||||
}
|
||||
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
|
||||
BIN
web/documentserver-example/python/static/images/diagram.ico
Normal file
|
After Width: | Height: | Size: 4.2 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M13.5 3.707V15a.5.5 0 0 1-.5.5H3a.5.5 0 0 1-.5-.5V1A.5.5 0 0 1 3 .5h7.293z" fill="#fff" stroke="#BBB"/>
|
||||
<path d="M9.5 1v2.7c0 .28 0 .42.055.527a.5.5 0 0 0 .218.218c.107.055.247.055.527.055H13" stroke="#BBB"/>
|
||||
<path d="M5 8h6v1H5zm0 1h1v1H5zm5 0h1v1h-1zM7 6h2v2H7z" fill="#5951BB"/>
|
||||
<path stroke="#5951BB" d="M4.5 10.5h2v2h-2zm5 0h2v2h-2z"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 469 B |
@ -414,12 +414,14 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#convertStep2").removeClass("current").addClass("done");
|
||||
jq("#convertStep2").text(`2. File conversion to ${fileExt}`);
|
||||
jq("#downloadConverted").removeClass("disable");
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
if (response.error !== "FileTypeIsNotSupported") {
|
||||
jq("#hiddenFileName").attr("data",response.filename);
|
||||
jq("#beginEditConverted").removeClass("disable");
|
||||
jq("#beginViewConverted").removeClass("disable");
|
||||
jq("#downloadConverted").attr("data","fromStorage");
|
||||
} else {
|
||||
let newFilename = fileName.split('.').slice(0,-1).join('.')
|
||||
jq("#hiddenFileName").attr("data",response.filename.split("&filename=download").join(`&filename=${newFilename}`));
|
||||
jq("#downloadConverted").attr("data","fromConverter");
|
||||
}
|
||||
jq("td[name='convertingTypeButton']").removeClass("disable orange");
|
||||
|
||||