mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Compare commits
25 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9ccb32786a | |||
| 3f5879da9d | |||
| e9dac43436 | |||
| 08ba477f6b | |||
| d190f68f90 | |||
| 61884c519f | |||
| 90a6514b6e | |||
| 841fd9f27f | |||
| 6112ff4d02 | |||
| f84a031581 | |||
| a9e2df73ca | |||
| 34b066f846 | |||
| 9e9f177508 | |||
| 1392a567d7 | |||
| 8ed261dabc | |||
| 27982b0aa6 | |||
| 08edfca9b0 | |||
| a4122c1393 | |||
| a412f3f591 | |||
| 01132d78c2 | |||
| b61e7574bb | |||
| f148233e64 | |||
| 92a322f2a7 | |||
| 689ac66bba | |||
| c3774d8cb6 |
@ -4,9 +4,9 @@
|
||||
<PropertyGroup>
|
||||
<To Condition=" '$(To)' == '' ">..\deploy\</To>
|
||||
<RootDir Condition="$(RootDir)==''">..\..\</RootDir>
|
||||
<NameCSharp>$(To).Net (C#) Example</NameCSharp>
|
||||
<NameCSharp>$(To)DotNet (Csharp) Example</NameCSharp>
|
||||
<DirCSharp>$(RootDir)web\documentserver-example\csharp\</DirCSharp>
|
||||
<NameMvc>$(To).Net (C# MVC) Example</NameMvc>
|
||||
<NameMvc>$(To)DotNet (Csharp MVC) Example</NameMvc>
|
||||
<DirMvc>$(RootDir)web\documentserver-example\csharp-mvc\</DirMvc>
|
||||
<NameJava>$(To)Java Example</NameJava>
|
||||
<DirJava>$(RootDir)web\documentserver-example\java\</DirJava>
|
||||
|
||||
@ -730,11 +730,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@ -82,7 +82,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
string documentRevisionId,
|
||||
bool isAsync,
|
||||
out string convertedDocumentUri,
|
||||
string filePass = null)
|
||||
string filePass = null,
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentUri = string.Empty;
|
||||
|
||||
@ -114,7 +115,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
{ "outputtype", toExtension.Trim('.') },
|
||||
{ "title", title },
|
||||
{ "url", documentUri },
|
||||
{ "password", filePass }
|
||||
{ "password", filePass },
|
||||
{ "region", lang }
|
||||
};
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
|
||||
@ -289,10 +289,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -159,25 +159,25 @@
|
||||
<%
|
||||
if (storedFiles.Any())
|
||||
{ %>
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
|
||||
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
|
||||
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
|
||||
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="scroll-table-body">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tbody>
|
||||
<% foreach (var storedFile in storedFiles)
|
||||
{
|
||||
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile.Name);
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||||
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
|
||||
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
|
||||
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
|
||||
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
<div class="scroll-table-body">
|
||||
<table cellspacing="0" cellpadding="0" width="100%">
|
||||
<tbody>
|
||||
<% foreach (var storedFile in storedFiles)
|
||||
{
|
||||
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile.Name);
|
||||
var docType = FileUtility.GetFileType(storedFile.Name).ToString().ToLower();
|
||||
var canEdit = DocManagerHelper.EditedExts.Contains(Path.GetExtension(storedFile.Name).ToLower());
|
||||
%>
|
||||
|
||||
@ -136,6 +136,7 @@ namespace OnlineEditorsExampleMVC
|
||||
var body = jss.Deserialize<Dictionary<string, object>>(fileData);
|
||||
|
||||
var fileName = Path.GetFileName(body["filename"].ToString());
|
||||
var lang = context.Request.Cookies.GetOrDefault("ulang", null);
|
||||
var filePass = body["filePass"] != null ? body["filePass"].ToString() : null;
|
||||
var fileUri = DocManagerHelper.GetDownloadUrl(fileName);
|
||||
|
||||
@ -159,7 +160,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
// get the url to the converted file
|
||||
string newFileUri;
|
||||
var result = ServiceConverter.GetConvertedUri(downloadUri.ToString(), extension, internalExtension, key, true, out newFileUri, filePass);
|
||||
var result = ServiceConverter.GetConvertedUri(downloadUri.ToString(), extension, internalExtension, key, true, out newFileUri, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
context.Response.Write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
|
||||
@ -12,7 +12,7 @@
|
||||
<add key="files.docservice.secret" value="" />
|
||||
<add key="files.docservice.header" value="Authorization" />
|
||||
|
||||
<add key="files.docservice.url.site" value="https://documentserver/"/>
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
<add key="files.docservice.url.converter" value="ConvertService.ashx"/>
|
||||
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
|
||||
|
||||
@ -734,11 +734,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@ -135,8 +135,9 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="section">
|
||||
<% var storedFiles = GetStoredFiles(); %>
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
<div id="portal-info" style="display: <%= storedFiles.Any() ? "none" : "block" %>">
|
||||
<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.
|
||||
@ -156,8 +157,8 @@
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<% var storedFiles = GetStoredFiles();
|
||||
if storedFiles.Any())
|
||||
<%
|
||||
if (storedFiles.Any())
|
||||
{ %>
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
|
||||
@ -369,6 +369,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
_fileName = Path.GetFileName(body["filename"].ToString());
|
||||
var filePass = body["filePass"] != null ? body["filePass"].ToString() : null;
|
||||
var lang = context.Request.Cookies.GetOrDefault("ulang", null);
|
||||
|
||||
var extension = (Path.GetExtension(_fileName).ToLower() ?? "").Trim('.');
|
||||
var internalExtension = FileType.GetInternalExtension(_fileName).Trim('.');
|
||||
@ -389,7 +390,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
// get the url to the converted file
|
||||
string newFileUri;
|
||||
var result = ServiceConverter.GetConvertedUri(fileUrl.ToString() , extension, internalExtension, key, true, out newFileUri, filePass); ;
|
||||
var result = ServiceConverter.GetConvertedUri(fileUrl.ToString() , extension, internalExtension, key, true, out newFileUri, filePass, lang);
|
||||
if (result != 100)
|
||||
{
|
||||
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
|
||||
|
||||
@ -84,7 +84,8 @@ namespace ASC.Api.DocumentConverter
|
||||
string documentRevisionId,
|
||||
bool isAsync,
|
||||
out string convertedDocumentUri,
|
||||
string filePass = null)
|
||||
string filePass = null,
|
||||
string lang = null)
|
||||
{
|
||||
convertedDocumentUri = string.Empty;
|
||||
|
||||
@ -116,7 +117,8 @@ namespace ASC.Api.DocumentConverter
|
||||
{ "outputtype", toExtension.Trim('.') },
|
||||
{ "title", title },
|
||||
{ "url", documentUri },
|
||||
{ "password", filePass }
|
||||
{ "password", filePass },
|
||||
{ "region", lang }
|
||||
};
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
|
||||
@ -288,10 +288,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
<add key="files.docservice.secret" value="" />
|
||||
<add key="files.docservice.header" value="Authorization" />
|
||||
|
||||
<add key="files.docservice.url.site" value="https://documentserver/"/>
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
<add key="files.docservice.url.converter" value="ConvertService.ashx"/>
|
||||
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
|
||||
|
||||
@ -133,7 +133,7 @@ public class FileController {
|
||||
@PostMapping(path = "${url.converter}")
|
||||
@ResponseBody
|
||||
public String convert(@RequestBody Converter body,
|
||||
@CookieValue("uid") String uid){
|
||||
@CookieValue("uid") String uid, @CookieValue("ulang") String lang){
|
||||
String fileName = body.getFileName();
|
||||
String fileUri = documentManager.getDownloadUrl(fileName);
|
||||
String filePass = body.getFilePass() != null ? body.getFilePass() : null;
|
||||
@ -145,7 +145,7 @@ public class FileController {
|
||||
if(fileUtility.getConvertExts().contains(fileExt)){
|
||||
String key = serviceConverter.generateRevisionId(fileUri);
|
||||
String newFileUri = serviceConverter
|
||||
.getConvertedUri(fileUri, fileExt, internalFileExt, key, filePass, true);
|
||||
.getConvertedUri(fileUri, fileExt, internalFileExt, key, filePass, true, lang);
|
||||
|
||||
if(newFileUri.isEmpty()){
|
||||
return "{ \"step\" : \"0\", \"filename\" : \"" + fileName + "\"}";
|
||||
|
||||
@ -97,7 +97,7 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
//TODO: Refactoring
|
||||
if (!curExt.equals(downloadExt)) {
|
||||
try {
|
||||
String newFileUri = serviceConverter.getConvertedUri(downloadUri, downloadExt, curExt, serviceConverter.generateRevisionId(downloadUri), null, false); // convert file and get url to a new file
|
||||
String newFileUri = serviceConverter.getConvertedUri(downloadUri, downloadExt, curExt, serviceConverter.generateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = documentManager
|
||||
.getCorrectName(fileUtility.getFileNameWithoutExtension(fileName) + downloadExt); // get the correct file name if it already exists
|
||||
@ -208,7 +208,7 @@ public class DefaultCallbackManager implements CallbackManager {
|
||||
if (!curExt.equals(downloadExt)) {
|
||||
try {
|
||||
String newFileUri = serviceConverter.getConvertedUri(downloadUri, downloadExt,
|
||||
curExt, serviceConverter.generateRevisionId(downloadUri), null, false); // convert file and get url to a new file
|
||||
curExt, serviceConverter.generateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = true;
|
||||
} else {
|
||||
|
||||
@ -107,7 +107,7 @@ public class DefaultServiceConverter implements ServiceConverter
|
||||
|
||||
public String getConvertedUri(String documentUri, String fromExtension,
|
||||
String toExtension, String documentRevisionId,
|
||||
String filePass, Boolean isAsync)
|
||||
String filePass, Boolean isAsync, String lang)
|
||||
{
|
||||
fromExtension = fromExtension == null || fromExtension.isEmpty() ?
|
||||
fileUtility.getFileExtension(documentUri) : fromExtension;
|
||||
@ -120,6 +120,7 @@ public class DefaultServiceConverter implements ServiceConverter
|
||||
documentRevisionId = generateRevisionId(documentRevisionId); // create document token
|
||||
|
||||
Convert body = new Convert();
|
||||
body.setLang(lang);
|
||||
body.setUrl(documentUri);
|
||||
body.setOutputtype(toExtension.replace(".", ""));
|
||||
body.setFiletype(fromExtension.replace(".", ""));
|
||||
@ -133,6 +134,7 @@ public class DefaultServiceConverter implements ServiceConverter
|
||||
if (jwtManager.tokenEnabled())
|
||||
{
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("region", lang);
|
||||
map.put("url", body.getUrl());
|
||||
map.put("outputtype", body.getOutputtype());
|
||||
map.put("filetype", body.getFiletype());
|
||||
|
||||
@ -27,7 +27,7 @@ import java.io.InputStream;
|
||||
public interface ServiceConverter {
|
||||
String getConvertedUri(String documentUri, String fromExtension,
|
||||
String toExtension, String documentRevisionId,
|
||||
String filePass, Boolean isAsync);
|
||||
String filePass, Boolean isAsync, String lang);
|
||||
String generateRevisionId(String expectedKey);
|
||||
String convertStreamToString(InputStream stream);
|
||||
JSONObject convertStringToJSON(String jsonString);
|
||||
|
||||
@ -36,4 +36,5 @@ public class Convert {
|
||||
private String filePass;
|
||||
private Boolean async;
|
||||
private String token;
|
||||
private String lang;
|
||||
}
|
||||
|
||||
@ -31,4 +31,6 @@ public class Converter {
|
||||
private String fileName;
|
||||
@JsonProperty("filePass")
|
||||
private String filePass;
|
||||
@JsonProperty("lang")
|
||||
private String lang;
|
||||
}
|
||||
|
||||
@ -14,7 +14,7 @@ files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|
|
||||
files.docservice.timeout=120000
|
||||
files.docservice.history.postfix=-hist
|
||||
|
||||
files.docservice.url.site=https://documentserver/
|
||||
files.docservice.url.site=http://documentserver/
|
||||
files.docservice.url.converter=ConvertService.ashx
|
||||
files.docservice.url.command=coauthoring/CommandService.ashx
|
||||
files.docservice.url.api=web-apps/apps/api/documents/api.js
|
||||
|
||||
@ -742,11 +742,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
@ -302,9 +302,6 @@ if (typeof jQuery !== "undefined") {
|
||||
jq("#portal-info")[0].innerHTML += jq("#portal-info")[0].attributes.tooltip.value;
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -124,7 +124,7 @@
|
||||
</td>
|
||||
<td class="section">
|
||||
<div class="main-panel">
|
||||
<div id="portal-info" th:attr="tooltip=${tooltip}">
|
||||
<div id="portal-info" th:attr="tooltip=${tooltip}" th:style="${not #lists.isEmpty(files)} ? 'display: none' : 'display: block' ">
|
||||
<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.
|
||||
|
||||
@ -163,8 +163,8 @@ public class IndexServlet extends HttpServlet
|
||||
}
|
||||
|
||||
// convert a file
|
||||
private static void Convert(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
|
||||
{
|
||||
private static void Convert(HttpServletRequest request, HttpServletResponse response, PrintWriter writer) throws UnsupportedEncodingException {
|
||||
CookieManager cm = new CookieManager(request);
|
||||
response.setContentType("text/plain");
|
||||
|
||||
try
|
||||
@ -178,6 +178,7 @@ public class IndexServlet extends HttpServlet
|
||||
JSONObject body = (JSONObject) parser.parse(bodyString);
|
||||
|
||||
String fileName = FileUtility.GetFileName((String) body.get("filename"));
|
||||
String lang = cm.getCookie("ulang");
|
||||
String filePass = body.get("filePass") != null ? (String) body.get("filePass") : null;
|
||||
String fileUri = DocumentManager.GetDownloadUrl(fileName);
|
||||
String fileExt = FileUtility.GetFileExtension(fileName);
|
||||
@ -191,7 +192,7 @@ public class IndexServlet extends HttpServlet
|
||||
String key = ServiceConverter.GenerateRevisionId(fileUri);
|
||||
|
||||
// get the url to the converted file
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, filePass, true);
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, filePass, true, lang);
|
||||
|
||||
if (newFileUri.isEmpty())
|
||||
{
|
||||
@ -234,7 +235,6 @@ public class IndexServlet extends HttpServlet
|
||||
fileName = correctName;
|
||||
|
||||
// create meta information about the converted file with the user id and name specified
|
||||
CookieManager cm = new CookieManager(request);
|
||||
User user = Users.getUser(cm.getCookie("uid"));
|
||||
|
||||
DocumentManager.CreateMeta(fileName, user.id, user.name, null);
|
||||
|
||||
@ -45,6 +45,7 @@ public class ServiceConverter
|
||||
|
||||
public static class ConvertBody
|
||||
{
|
||||
public String region;
|
||||
public String url;
|
||||
public String outputtype;
|
||||
public String filetype;
|
||||
@ -72,7 +73,7 @@ public class ServiceConverter
|
||||
}
|
||||
|
||||
// get the url of the converted file
|
||||
public static String GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, String filePass, Boolean isAsync) throws Exception
|
||||
public static String GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, String filePass, Boolean isAsync, String lang) throws Exception
|
||||
{
|
||||
// check if the fromExtension parameter is defined; if not, get it from the document url
|
||||
fromExtension = fromExtension == null || fromExtension.isEmpty() ? FileUtility.GetFileExtension(documentUri) : fromExtension;
|
||||
@ -87,6 +88,7 @@ public class ServiceConverter
|
||||
|
||||
// write all the necessary parameters to the body object
|
||||
ConvertBody body = new ConvertBody();
|
||||
body.region = lang;
|
||||
body.url = documentUri;
|
||||
body.outputtype = toExtension.replace(".", "");
|
||||
body.filetype = fromExtension.replace(".", "");
|
||||
@ -100,6 +102,7 @@ public class ServiceConverter
|
||||
if (DocumentManager.TokenEnabled())
|
||||
{
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("region", lang);
|
||||
map.put("url", body.url);
|
||||
map.put("outputtype", body.outputtype);
|
||||
map.put("filetype", body.filetype);
|
||||
|
||||
@ -132,7 +132,7 @@ public class TrackManager {
|
||||
// convert downloaded file to the file with the current extension if these extensions aren't equal
|
||||
if (!curExt.equals(downloadExt)) {
|
||||
try {
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false); // convert file and get url to a new file
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = DocumentManager.GetCorrectName(FileUtility.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress); // get the correct file name if it already exists
|
||||
} else {
|
||||
@ -194,7 +194,7 @@ public class TrackManager {
|
||||
// convert downloaded file to the file with the current extension if these extensions aren't equal
|
||||
if (!curExt.equals(downloadExt)) {
|
||||
try {
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false); // convert file and get url to a new file
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), null, false, null); // convert file and get url to a new file
|
||||
if (newFileUri.isEmpty()) {
|
||||
newFileName = true;
|
||||
} else {
|
||||
|
||||
@ -8,7 +8,7 @@ files.docservice.edited-docs=.docx|.xlsx|.csv|.pptx|.txt
|
||||
files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsx|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.xml|.epub|.fb2
|
||||
files.docservice.timeout=120000
|
||||
|
||||
files.docservice.url.site=https://documentserver/
|
||||
files.docservice.url.site=http://documentserver/
|
||||
files.docservice.url.converter=ConvertService.ashx
|
||||
files.docservice.url.command=coauthoring/CommandService.ashx
|
||||
files.docservice.url.api=web-apps/apps/api/documents/api.js
|
||||
|
||||
@ -737,11 +737,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -133,8 +133,10 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="section">
|
||||
<% DocumentManager.Init(request, response); %>
|
||||
<% File[] files = DocumentManager.GetStoredFiles(null); %>
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
<div id="portal-info" style="display: <%= files.length > 0 ? "none" : "block" %>">
|
||||
<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.
|
||||
@ -152,8 +154,6 @@
|
||||
</div>
|
||||
<% } %>
|
||||
</div>
|
||||
<% DocumentManager.Init(request, response); %>
|
||||
<% File[] files = DocumentManager.GetStoredFiles(null); %>
|
||||
<% if (files.length > 0) { %>
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
|
||||
@ -287,10 +287,6 @@ if (typeof jQuery !== "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
<link href="stylesheet.css" type="text/css" rel="stylesheet">
|
||||
|
||||
<!--Change the address on installed ONLYOFFICE Document Editors-->
|
||||
<script id="scriptApi" type="text/javascript" src="https://documentserver/web-apps/apps/api/documents/api.js"></script>
|
||||
<script id="scriptApi" type="text/javascript" src="http://documentserver/web-apps/apps/api/documents/api.js"></script>
|
||||
|
||||
|
||||
<script type="text/javascript" src="init.js"></script>
|
||||
|
||||
@ -103,6 +103,7 @@ app.get("/", function (req, res) { // define a handler for default page
|
||||
preloaderUrl: siteUrl + configServer.get('preloaderUrl'),
|
||||
convertExts: configServer.get('convertedDocs').join(","),
|
||||
editedExts: configServer.get('editedDocs').join(","),
|
||||
fillExts: configServer.get('fillDocs').join(","),
|
||||
storedFiles: docManager.getStoredFiles(),
|
||||
params: docManager.getCustomParams(),
|
||||
users: users,
|
||||
@ -195,7 +196,7 @@ app.post("/upload", function (req, res) { // define a handler for uploading fil
|
||||
return;
|
||||
}
|
||||
|
||||
const exts = [].concat(configServer.get('viewedDocs'), configServer.get('editedDocs'), configServer.get('convertedDocs')); // all the supported file extensions
|
||||
const exts = [].concat(configServer.get('viewedDocs'), configServer.get('editedDocs'), configServer.get('convertedDocs'), configServer.get('fillDocs')); // all the supported file extensions
|
||||
const curExt = fileUtility.getFileExtension(file.name);
|
||||
const documentType = fileUtility.getFileType(file.name);
|
||||
|
||||
@ -224,10 +225,59 @@ app.post("/upload", function (req, res) { // define a handler for uploading fil
|
||||
});
|
||||
});
|
||||
|
||||
app.post("/create", function (req, res) {
|
||||
var title = req.body.title;
|
||||
var fileUrl = req.body.url;
|
||||
|
||||
try {
|
||||
docManager.init(storageFolder, req, res);
|
||||
docManager.storagePath(""); // mkdir if not exist
|
||||
|
||||
var fileName = docManager.getCorrectName(title);
|
||||
var userAddress = docManager.curUserHostAddress();
|
||||
docManager.historyPath(fileName, userAddress, true);
|
||||
|
||||
var file = syncRequest("GET", fileUrl);
|
||||
var fileBody = file.getBody();
|
||||
|
||||
if (configServer.get("maxFileSize") < fileBody.length || fileBody.length <= 0) { // check if the file size exceeds the maximum file size
|
||||
res.writeHead(200, { "Content-Type": "application/json" });
|
||||
res.write(JSON.stringify({ "error": "File size is incorrect" }));
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
const exts = [].concat(configServer.get("viewedDocs"), configServer.get("editedDocs"), configServer.get("convertedDocs"), configServer.get('fillDocs')); // all the supported file extensions
|
||||
const curExt = fileUtility.getFileExtension(fileName);
|
||||
|
||||
if (exts.indexOf(curExt) == -1) { // check if the file extension is supported
|
||||
res.writeHead(200, { "Content-Type": "application/json" }); // and write the error status and message to the response
|
||||
res.write(JSON.stringify({ "error": "File type is not supported" }));
|
||||
res.end();
|
||||
return;
|
||||
}
|
||||
|
||||
fileSystem.writeFileSync(docManager.storagePath(fileName), fileBody);
|
||||
|
||||
res.writeHead(200, { "Content-Type": "application/json" });
|
||||
res.write(JSON.stringify({ "file" : fileName }));
|
||||
res.end();
|
||||
|
||||
} catch (e) {
|
||||
res.status(500);
|
||||
res.write(JSON.stringify({
|
||||
error: 1,
|
||||
message: e.message
|
||||
}));
|
||||
res.end();
|
||||
}
|
||||
});
|
||||
|
||||
app.post("/convert", function (req, res) { // define a handler for converting files
|
||||
|
||||
var fileName = fileUtility.getFileName(req.body.filename);
|
||||
var filePass = req.body.filePass ? req.body.filePass : null;
|
||||
var lang = req.body.lang ? req.body.lang : null;
|
||||
var fileUri = docManager.getFileUri(fileName);
|
||||
var fileExt = fileUtility.getFileExtension(fileName);
|
||||
var fileType = fileUtility.getFileType(fileName);
|
||||
@ -301,7 +351,7 @@ app.post("/convert", function (req, res) { // define a handler for converting f
|
||||
let key = fileUri + stat.mtime.getTime();
|
||||
|
||||
key = documentService.generateRevisionId(key); // get document key
|
||||
documentService.getConvertedUri(fileUri, fileExt, internalFileExt, key, true, callback, filePass); // get the url to the converted file
|
||||
documentService.getConvertedUri(fileUri, fileExt, internalFileExt, key, true, callback, filePass, lang); // get the url to the converted file
|
||||
} else {
|
||||
writeResult(fileName, null, null); // if the file with such an extension can't be converted, write the origin file to the result object
|
||||
}
|
||||
@ -681,6 +731,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
res.redirect(redirectPath);
|
||||
return;
|
||||
}
|
||||
fileExt = fileUtility.getFileExtension(fileName);
|
||||
|
||||
var userAddress = docManager.curUserHostAddress();
|
||||
if (!docManager.existsSync(docManager.storagePath(fileName, userAddress))) { // if the file with a given name doesn't exist
|
||||
@ -697,8 +748,12 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
type = new RegExp(configServer.get("mobileRegEx"), "i").test(req.get('User-Agent')) ? "mobile" : "desktop";
|
||||
}
|
||||
|
||||
var canEdit = configServer.get('editedDocs').indexOf(fileUtility.getFileExtension(fileName)) != -1; // check if this file can be edited
|
||||
var submitForm = canEdit && (mode == "edit" || mode == "fillForms");
|
||||
var canEdit = configServer.get('editedDocs').indexOf(fileExt) != -1; // check if this file can be edited
|
||||
if ((!canEdit && mode == "edit" || mode == "fillForms") && configServer.get('fillDocs').indexOf(fileExt) != -1) {
|
||||
mode = "fillForms";
|
||||
canEdit = true;
|
||||
}
|
||||
var submitForm = mode == "fillForms" && userid == "uid-1" && !1;
|
||||
|
||||
var countVersion = 1;
|
||||
|
||||
@ -722,7 +777,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
var historyD = {
|
||||
version: i,
|
||||
key: keyVersion,
|
||||
url: i == countVersion ? url : (docManager.getlocalFileUri(fileName, i, true) + "/prev" + fileUtility.getFileExtension(fileName)),
|
||||
url: i == countVersion ? url : (docManager.getlocalFileUri(fileName, i, true) + "/prev" + fileExt),
|
||||
};
|
||||
|
||||
if (i > 1 && docManager.existsSync(docManager.diffPath(fileName, userAddress, i-1))) { // check if the path to the file with document versions differences exists
|
||||
@ -836,7 +891,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
catch (ex) {
|
||||
console.log(ex);
|
||||
res.status(500);
|
||||
res.render("error", { message: "Server error" });
|
||||
res.render("error", { message: "Server error: " + ex.message });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
},
|
||||
"server": {
|
||||
"port": 3000,
|
||||
"siteUrl": "https://documentserver/",
|
||||
"siteUrl": "http://documentserver/",
|
||||
"wopi": {
|
||||
"discovery": "hosting/discovery"
|
||||
},
|
||||
@ -23,7 +23,8 @@
|
||||
"preloaderUrl": "web-apps/apps/api/documents/cache-scripts.html",
|
||||
"exampleUrl": null,
|
||||
"viewedDocs": [".pdf", ".djvu", ".xps", ".oxps"],
|
||||
"editedDocs": [".docx", ".xlsx", ".csv", ".pptx", ".txt"],
|
||||
"editedDocs": [".docx", ".xlsx", ".csv", ".pptx", ".txt", ".docxf"],
|
||||
"fillDocs": [".docx", ".oform"],
|
||||
"convertedDocs": [".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".xml", ".epub", ".fb2"],
|
||||
"storageFolder": "./files",
|
||||
"storagePath": "/files",
|
||||
|
||||
@ -46,7 +46,7 @@ documentService.getConvertedUriSync = function (documentUri, fromExtension, toEx
|
||||
};
|
||||
|
||||
// get the url of the converted file
|
||||
documentService.getConvertedUri = function (documentUri, fromExtension, toExtension, documentRevisionId, async, callback, filePass = null) {
|
||||
documentService.getConvertedUri = function (documentUri, fromExtension, toExtension, documentRevisionId, async, callback, filePass = null, lang = null) {
|
||||
fromExtension = fromExtension || fileUtility.getFileExtension(documentUri); // get the current document extension
|
||||
|
||||
var title = fileUtility.getFileName(documentUri) || guidManager.newGuid(); // get the current document name or uuid
|
||||
@ -60,7 +60,8 @@ documentService.getConvertedUri = function (documentUri, fromExtension, toExtens
|
||||
filetype: fromExtension.replace(".", ""),
|
||||
title: title,
|
||||
key: documentRevisionId,
|
||||
password: filePass
|
||||
password: filePass,
|
||||
region: lang,
|
||||
};
|
||||
|
||||
var uri = siteUrl + configServer.get('converterUrl'); // get the absolute converter url
|
||||
|
||||
@ -63,7 +63,7 @@ fileUtility.fileType = {
|
||||
}
|
||||
|
||||
// the document extension list
|
||||
fileUtility.documentExts = [".doc", ".docx", ".docm", ".dot", ".dotx", ".dotm", ".odt", ".fodt", ".ott", ".rtf", ".txt", ".html", ".htm", ".mht", ".xml", ".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps"];
|
||||
fileUtility.documentExts = [".doc", ".docx", ".oform", ".docm", ".dot", ".dotx", ".dotm", ".odt", ".fodt", ".ott", ".rtf", ".txt", ".html", ".htm", ".mht", ".xml", ".pdf", ".djvu", ".fb2", ".epub", ".xps", ".oxps"];
|
||||
|
||||
// the spreadsheet extension list
|
||||
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".xlsm", ".xlt", ".xltx", ".xltm", ".ods", ".fods", ".ots", ".csv"];
|
||||
|
||||
@ -22,7 +22,8 @@ var descr_user_1 = [
|
||||
"Can review all the changes",
|
||||
"Can perform all actions with comments",
|
||||
"The file favorite state is undefined",
|
||||
"Can create files from templates using data from the editor"
|
||||
"Can create files from templates using data from the editor",
|
||||
//"Can submit forms"
|
||||
];
|
||||
|
||||
var descr_user_2 = [
|
||||
@ -30,7 +31,8 @@ var descr_user_2 = [
|
||||
"Can review only his own changes or changes made by users with no group",
|
||||
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
|
||||
"This file is marked as favorite",
|
||||
"Can create new files from the editor"
|
||||
"Can create new files from the editor",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var descr_user_3 = [
|
||||
@ -41,7 +43,8 @@ var descr_user_3 = [
|
||||
"Can’t copy data from the file to clipboard",
|
||||
"Can’t download the file",
|
||||
"Can’t print the file",
|
||||
"Can create new files from the editor"
|
||||
"Can create new files from the editor",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var descr_user_0 = [
|
||||
@ -51,7 +54,8 @@ var descr_user_0 = [
|
||||
"Can perform all actions with comments",
|
||||
"The file favorite state is undefined",
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor"
|
||||
"Can't create new files from the editor",
|
||||
//"Can’t submit forms"
|
||||
];
|
||||
|
||||
var users = [
|
||||
|
||||
@ -25,7 +25,7 @@ const he = require("he");
|
||||
var cache = null;
|
||||
|
||||
// get the wopi discovery information
|
||||
function getDiscoveryInfo(siteUrl, maxTry = 1) {
|
||||
function getDiscoveryInfo(siteUrl) {
|
||||
let actions = [];
|
||||
|
||||
if (cache) return cache;
|
||||
@ -55,9 +55,6 @@ function getDiscoveryInfo(siteUrl, maxTry = 1) {
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
if (--maxTry > 0) {
|
||||
setTimeout(getDiscoveryInfo, 1000, maxTry);
|
||||
}
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,7 @@ exports.registerRoutes = function(app) {
|
||||
}
|
||||
|
||||
// get the wopi discovery information
|
||||
let actions = utils.getDiscoveryInfo(absSiteUrl, 3);
|
||||
let actions = utils.getDiscoveryInfo(absSiteUrl);
|
||||
let wopiEnable = actions.length != 0 ? true : false;
|
||||
|
||||
try {
|
||||
|
||||
Submodule web/documentserver-example/nodejs/public/assets updated: f9fc118e43...59de88feb6
@ -0,0 +1,10 @@
|
||||
<svg width="30" height="40" viewBox="0 0 30 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M0 3C0 1.34315 1.34315 0 3 0H22.9167L30 7.08333V37C30 38.6569 28.6569 40 27 40H3C1.34315 40 0 38.6569 0 37V3Z" fill="#007267"/>
|
||||
<path d="M22.9165 0L29.9998 7.08333H25.9165C24.2597 7.08333 22.9165 5.74019 22.9165 4.08333V0Z" fill="#00524A"/>
|
||||
<rect x="5.5" y="12.5" width="19" height="14" stroke="white"/>
|
||||
<path d="M5 19L6 18V27H5V19Z" fill="#007267"/>
|
||||
<path opacity="0.1" d="M5 12H21.1505H25V14.8125V27H14.9661H12.3817H5V12Z" fill="white"/>
|
||||
<path d="M12.7574 15.8485C13.226 15.3798 13.9858 15.3798 14.4544 15.8485L16.1515 17.5455C16.6201 18.0141 16.6201 18.7739 16.1515 19.2426L9.36345 26.0306L5.12061 26.8793L5.96934 22.6365L12.7574 15.8485Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.4225 18.7304L11.3012 20.8518C10.7154 21.4375 9.95562 21.6275 9.60415 21.276V21.276L12.7861 18.094L13.4225 18.7304Z" fill="#198076"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15.2436 20.7274L11.8494 17.3333L12.4858 16.6969L15.88 20.091L15.2436 20.7274Z" fill="#198076"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
@ -0,0 +1,6 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M5 5C5 3.89543 5.89543 3 7 3H16C17.1046 3 18 3.89543 18 5V8H17V6H6V18H17V16H18V19C18 20.1046 17.1046 21 16 21H7C5.89543 21 5 20.1046 5 19V5ZM13 4H10V5H13V4ZM12 19.5C12 19.7761 11.7761 20 11.5 20C11.2239 20 11 19.7761 11 19.5C11 19.2239 11.2239 19 11.5 19C11.7761 19 12 19.2239 12 19.5Z" fill="#444444"/>
|
||||
<rect x="7" y="9" width="1" height="6" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M12 8V9L11 9V15H12V16H9V15H10V9H9V8H12Z" fill="#444444"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M15 10H18V14H15H14H13V15H14H18C18.5523 15 19 14.5523 19 14V10C19 9.44772 18.5523 9 18 9H14H13V10H14H15Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 790 B |
@ -129,7 +129,7 @@ if (typeof jQuery != "undefined") {
|
||||
async: true,
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: {filename: fileName, filePass: filePass},
|
||||
data: {filename: fileName, filePass: filePass, lang: language},
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
@ -308,10 +308,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -157,6 +157,10 @@ label .checkbox {
|
||||
background-image: url("../images/file_pptx.svg");
|
||||
}
|
||||
|
||||
.try-editor.form {
|
||||
background-image: url("../images/file_docxf.svg");
|
||||
}
|
||||
|
||||
.create-sample {
|
||||
color: #666666;
|
||||
line-height: 24px;
|
||||
@ -749,11 +753,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -145,38 +145,57 @@
|
||||
console.log("Link to comment: " + replaceActionLink(location.href, actionLink));
|
||||
};
|
||||
|
||||
var events = {
|
||||
"onAppReady": onAppReady,
|
||||
"onDocumentStateChange": onDocumentStateChange,
|
||||
"onRequestEditRights": onRequestEditRights,
|
||||
"onError": onError,
|
||||
"onRequestHistory": onRequestHistory,
|
||||
"onRequestHistoryData": onRequestHistoryData,
|
||||
"onRequestHistoryClose": onRequestHistoryClose,
|
||||
"onOutdatedVersion": onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
"onMetaChange": onMetaChange,
|
||||
"onRequestInsertImage": onRequestInsertImage,
|
||||
"onRequestCompareFile": onRequestCompareFile,
|
||||
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
|
||||
};
|
||||
var onRequestSaveAs = function (event) { // the user is trying to save file by clicking Save Copy as... button
|
||||
var title = event.data.title;
|
||||
var url = event.data.url;
|
||||
var data = {
|
||||
title: title,
|
||||
url: url
|
||||
}
|
||||
|
||||
var config = {<%- include("config") %>, events: events};
|
||||
fetch("create", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
.then((response) => console.log(response.json()))
|
||||
.catch((error) => console.log(error));
|
||||
}
|
||||
|
||||
var config = {<%- include("config") %>,
|
||||
events: {
|
||||
"onAppReady": onAppReady,
|
||||
"onDocumentStateChange": onDocumentStateChange,
|
||||
"onRequestEditRights": onRequestEditRights,
|
||||
"onError": onError,
|
||||
"onRequestHistory": onRequestHistory,
|
||||
"onRequestHistoryData": onRequestHistoryData,
|
||||
"onRequestHistoryClose": onRequestHistoryClose,
|
||||
"onOutdatedVersion": onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
"onMetaChange": onMetaChange,
|
||||
"onRequestInsertImage": onRequestInsertImage,
|
||||
"onRequestCompareFile": onRequestCompareFile,
|
||||
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
|
||||
}
|
||||
};
|
||||
|
||||
if (<%- JSON.stringify(usersForMentions) %> != null) {
|
||||
config.events.onRequestUsers = onRequestUsers;
|
||||
config.events.onRequestSendNotify = onRequestSendNotify;
|
||||
}
|
||||
|
||||
if (config.editorConfig.createUrl) {
|
||||
config.events.onRequestSaveAs = onRequestSaveAs;
|
||||
}
|
||||
|
||||
var connectEditor = function () {
|
||||
addMentions();
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||||
fixSize();
|
||||
};
|
||||
|
||||
var addMentions = function () {
|
||||
if (<%- JSON.stringify(usersForMentions) %> != null)
|
||||
{
|
||||
events.onRequestUsers = onRequestUsers;
|
||||
events.onRequestSendNotify = onRequestSendNotify;
|
||||
}
|
||||
};
|
||||
|
||||
// get the editor sizes
|
||||
var fixSize = function () {
|
||||
var wrapEl = document.getElementsByClassName("form");
|
||||
|
||||
@ -56,6 +56,9 @@
|
||||
<li>
|
||||
<a class="try-editor slide reload-page" target="_blank" href="editor?fileExt=pptx<%= params %>" title="Create new presentation">Presentation</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="try-editor form reload-page" target="_blank" href="editor?fileExt=docxf<%= params %>" title="Create new master form">Master form</a>
|
||||
</li>
|
||||
</ul>
|
||||
<label class="create-sample">
|
||||
<input id="createSample" type="checkbox" class="checkbox" />With sample content
|
||||
@ -130,7 +133,7 @@
|
||||
</td>
|
||||
<td class="section">
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
<div id="portal-info" style="display: <%= storedFiles.length > 0 ? "none" : "block" %>">
|
||||
<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.
|
||||
@ -202,23 +205,34 @@
|
||||
<% } %>
|
||||
<% if (storedFiles[i].documentType == "word") { %>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<img src="images/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<% } %>
|
||||
<% if (storedFiles[i].documentType == "word") { %>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
|
||||
<a href="editor?type=desktop&mode=blockcontent&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<img src="images/block-content.svg" alt="Open in editor without content control modification" title="Open in editor without content control modification" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift"></td>
|
||||
<td class="contentCells contentCells-icon"></td>
|
||||
<% } %>
|
||||
<% if (storedFiles[i].documentType !== "word" && storedFiles[i].documentType !== "cell") {%>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<%}%>
|
||||
<% } %>
|
||||
<% if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.')).trim().toLowerCase()) !== -1) { %>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift"">
|
||||
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<img src="images/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" /></a>
|
||||
</td>
|
||||
<% } %>
|
||||
<% } else if (fillExts.indexOf(storedFiles[i].name.substring(storedFiles[i].name.lastIndexOf('.')).trim().toLowerCase()) !== -1) { %>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon">
|
||||
<a href="editor?type=mobile&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<img src="images/mobile-fill-forms.svg" alt="Open in editor for filling in forms for mobile devices" title="Open in editor for filling in forms for mobile devices" /></a>
|
||||
</td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-icon "></td>
|
||||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift"">
|
||||
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
|
||||
<img src="images/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" /></a>
|
||||
</td>
|
||||
<% } else { %>
|
||||
<td class="contentCells contentCells-shift contentCells-icon contentCellsEmpty" colspan="6"></td>
|
||||
<% } %>
|
||||
|
||||
@ -13,7 +13,7 @@ $GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot",
|
||||
$GLOBALS['DOC_SERV_TIMEOUT'] = "120000";
|
||||
|
||||
|
||||
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
|
||||
$GLOBALS['DOC_SERV_SITE_URL'] = "http://documentserver/";
|
||||
|
||||
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "ConvertService.ashx";
|
||||
$GLOBALS['DOC_SERV_API_URL'] = "web-apps/apps/api/documents/api.js";
|
||||
|
||||
@ -730,11 +730,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ function GenerateRevisionId($expected_key) {
|
||||
*
|
||||
* @return Document request result of conversion
|
||||
*/
|
||||
function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $filePass) {
|
||||
function SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $filePass, $lang) {
|
||||
if (empty($from_extension))
|
||||
{
|
||||
$path_parts = pathinfo($document_uri);
|
||||
@ -148,7 +148,8 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
|
||||
"filetype" => trim($from_extension, '.'),
|
||||
"title" => $title,
|
||||
"key" => $document_revision_id,
|
||||
"password" => $filePass
|
||||
"password" => $filePass,
|
||||
"region" => $lang
|
||||
];
|
||||
|
||||
// add header token
|
||||
@ -200,9 +201,9 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
|
||||
*
|
||||
* @return The percentage of completion of conversion
|
||||
*/
|
||||
function GetConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, &$converted_document_uri, $filePass) {
|
||||
function GetConvertedUri($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, &$converted_document_uri, $filePass, $lang) {
|
||||
$converted_document_uri = "";
|
||||
$responceFromConvertService = SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $filePass);
|
||||
$responceFromConvertService = SendRequestToConvertService($document_uri, $from_extension, $to_extension, $document_revision_id, $is_async, $filePass, $lang);
|
||||
$json = json_decode($responceFromConvertService, true);
|
||||
|
||||
// if an error occurs, then display an error message
|
||||
|
||||
@ -136,7 +136,13 @@
|
||||
</td>
|
||||
<td class="section">
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
<?php
|
||||
$storedFiles = getStoredFiles();
|
||||
if (!empty($storedFiles)): ?>
|
||||
<div id="portal-info" style="display: none">
|
||||
<?php else: ?>
|
||||
<div id="portal-info" style="display: block">
|
||||
<?php endif; ?>
|
||||
<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.
|
||||
@ -153,10 +159,9 @@
|
||||
}
|
||||
echo '</ul>';
|
||||
echo '</div>';
|
||||
} ?>"
|
||||
} ?>
|
||||
</div>
|
||||
<?php
|
||||
$storedFiles = getStoredFiles();
|
||||
if (!empty($storedFiles)) { ?>
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
|
||||
@ -320,10 +320,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -196,6 +196,7 @@ function convert() {
|
||||
$post = json_decode(file_get_contents('php://input'), true);
|
||||
$fileName = basename($post["filename"]);
|
||||
$filePass = $post["filePass"];
|
||||
$lang = $_COOKIE["ulang"];
|
||||
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
|
||||
$internalExtension = trim(getInternalExtension($fileName),'.');
|
||||
|
||||
@ -218,7 +219,7 @@ function convert() {
|
||||
|
||||
try {
|
||||
// convert file and get the percentage of the conversion completion
|
||||
$percent = GetConvertedUri($fileUri, $extension, $internalExtension, $key, TRUE, $newFileUri, $filePass);
|
||||
$percent = GetConvertedUri($fileUri, $extension, $internalExtension, $key, TRUE, $newFileUri, $filePass, $lang);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$result["error"] = "error: " . $e->getMessage();
|
||||
@ -370,4 +371,4 @@ function delTree($dir) {
|
||||
return rmdir($dir);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@ -17,7 +17,7 @@ DOC_SERV_CONVERT = [ # file extensions
|
||||
|
||||
DOC_SERV_TIMEOUT = 120000
|
||||
|
||||
DOC_SERV_SITE_URL = 'https://documentserver/'
|
||||
DOC_SERV_SITE_URL = 'http://documentserver/'
|
||||
|
||||
DOC_SERV_CONVERTER_URL = 'ConvertService.ashx'
|
||||
DOC_SERV_API_URL = 'web-apps/apps/api/documents/api.js'
|
||||
|
||||
@ -31,7 +31,7 @@ import config
|
||||
from . import fileUtils, jwtManager
|
||||
|
||||
# convert file and give url to a new file
|
||||
def getConverterUri(docUri, fromExt, toExt, docKey, isAsync, filePass = None):
|
||||
def getConverterUri(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
|
||||
|
||||
@ -43,7 +43,8 @@ def getConverterUri(docUri, fromExt, toExt, docKey, isAsync, filePass = None):
|
||||
'filetype': fromExt.replace('.', ''),
|
||||
'title': title,
|
||||
'key': docKey,
|
||||
'password': filePass
|
||||
'password': filePass,
|
||||
'region': lang
|
||||
}
|
||||
|
||||
headers={'accept': 'application/json'}
|
||||
|
||||
@ -70,6 +70,7 @@ def convert(request):
|
||||
body = json.loads(request.body)
|
||||
filename = fileUtils.getFileName(body.get("filename"))
|
||||
filePass = body.get("filePass")
|
||||
lang = request.COOKIES.get('ulang') if request.COOKIES.get('ulang') else 'en'
|
||||
fileUri = docManager.getDownloadUrl(filename,request)
|
||||
fileExt = fileUtils.getFileExt(filename)
|
||||
fileType = fileUtils.getFileType(filename)
|
||||
@ -78,7 +79,7 @@ def convert(request):
|
||||
if docManager.isCanConvert(fileExt): # check if the file extension is available for converting
|
||||
key = docManager.generateFileKey(filename, request) # generate the file key
|
||||
|
||||
newUri = serviceConverter.getConverterUri(fileUri, fileExt, newExt, key, True, filePass) # get the url of the converted file
|
||||
newUri = serviceConverter.getConverterUri(fileUri, fileExt, newExt, key, True, filePass, lang) # get the url of the converted file
|
||||
|
||||
if not newUri: # if the converter url is not received, the original file name is passed to the response
|
||||
response.setdefault('step', '0')
|
||||
|
||||
@ -739,11 +739,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -294,10 +294,6 @@ if (typeof jQuery !== "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -107,7 +107,11 @@
|
||||
</td>
|
||||
<td class="section">
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
{% if files %}
|
||||
<div id="portal-info" style="display: none">
|
||||
{% else %}
|
||||
<div id="portal-info" style="display: block">
|
||||
{% endif %}
|
||||
<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.
|
||||
|
||||
@ -99,12 +99,15 @@ GEM
|
||||
nokogiri (~> 1)
|
||||
rake
|
||||
mini_mime (1.0.2)
|
||||
mini_portile2 (2.5.0)
|
||||
mini_portile2 (2.6.1)
|
||||
minitest (5.14.2)
|
||||
nio4r (2.5.4)
|
||||
nokogiri (1.11.5-x64-mingw32)
|
||||
nokogiri (1.12.5)
|
||||
mini_portile2 (~> 2.6.1)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.11.5-x86_64-linux)
|
||||
nokogiri (1.12.5-x64-mingw32)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.12.5-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
racc (1.5.2)
|
||||
rack (2.2.3)
|
||||
|
||||
@ -286,10 +286,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var fileList = jq("tr.tableRow");
|
||||
if (fileList.length > 0) {
|
||||
console.log(jq("div#portal-info").is(":visible"));
|
||||
jq("div#portal-info").hide();
|
||||
}
|
||||
|
||||
var mouseIsOverTooltip = false;
|
||||
var hideTooltipTimeout = null;
|
||||
|
||||
@ -731,11 +731,6 @@ html {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
#portal-info {
|
||||
display: block;
|
||||
width: 70vw;
|
||||
}
|
||||
|
||||
.portal-descr:nth-child(3) {
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
@ -96,6 +96,7 @@ class HomeController < ApplicationController
|
||||
body = JSON.parse(file_data)
|
||||
|
||||
file_name = File.basename(body["filename"])
|
||||
lang = cookies[:ulang] ? cookies[:ulang] : "en"
|
||||
file_pass = body["filePass"] ? body["filePass"] : nil
|
||||
file_uri = DocumentHelper.get_download_url(file_name)
|
||||
extension = File.extname(file_name).downcase
|
||||
@ -103,7 +104,7 @@ class HomeController < ApplicationController
|
||||
|
||||
if DocumentHelper.convert_exts.include? (extension) # check if the file with such an extension can be converted
|
||||
key = ServiceConverter.generate_revision_id(file_uri) # generate document key
|
||||
percent, new_file_uri = ServiceConverter.get_converted_uri(file_uri, extension.delete('.'), internal_extension.delete('.'), key, true, file_pass) # get the url of the converted file and the conversion percentage
|
||||
percent, new_file_uri = ServiceConverter.get_converted_uri(file_uri, extension.delete('.'), internal_extension.delete('.'), key, true, file_pass, lang) # get the url of the converted file and the conversion percentage
|
||||
|
||||
# if the conversion isn't completed, write file name and step values to the response
|
||||
if percent != 100
|
||||
|
||||
@ -22,7 +22,7 @@ class ServiceConverter
|
||||
class << self
|
||||
|
||||
# get the url of the converted file
|
||||
def get_converted_uri(document_uri, from_ext, to_ext, document_revision_id, is_async, file_pass)
|
||||
def get_converted_uri(document_uri, from_ext, to_ext, document_revision_id, is_async, file_pass, lang = nil)
|
||||
|
||||
from_ext = from_ext == nil ? File.extname(document_uri).downcase : from_ext # get the current document extension
|
||||
|
||||
@ -41,7 +41,8 @@ class ServiceConverter
|
||||
:filetype => from_ext.delete('.'),
|
||||
:title => title,
|
||||
:key => document_revision_id,
|
||||
:password => file_pass
|
||||
:password => file_pass,
|
||||
:region => lang
|
||||
}
|
||||
|
||||
data = nil
|
||||
|
||||
@ -109,8 +109,12 @@
|
||||
</div>
|
||||
</td>
|
||||
<td class="section">
|
||||
<%
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
docs = DocumentHelper.get_stored_files(nil)
|
||||
%>
|
||||
<div class="main-panel">
|
||||
<div id="portal-info">
|
||||
<div id="portal-info" style="display: <%= docs.length > 0 ? "none" : "block" %>">
|
||||
<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.
|
||||
@ -126,12 +130,9 @@
|
||||
<% end %>
|
||||
</ul>
|
||||
</div>
|
||||
<% end %>"
|
||||
<% end %>
|
||||
</div>
|
||||
<%
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
docs = DocumentHelper.get_stored_files(nil)
|
||||
if docs.length > 0 %>
|
||||
<% if docs.length > 0 %>
|
||||
<div class="stored-list">
|
||||
<span class="header-list">Your documents</span>
|
||||
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
|
||||
|
||||
@ -36,7 +36,7 @@ module OnlineEditorsExampleRuby
|
||||
Rails.configuration.editedDocs=".docx|.xlsx|.csv|.pptx|.txt"
|
||||
Rails.configuration.convertDocs=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsx|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.xml|.epub|.fb2"
|
||||
|
||||
Rails.configuration.urlSite="https://documentserver/"
|
||||
Rails.configuration.urlSite="http://documentserver/"
|
||||
Rails.configuration.urlConverter="ConvertService.ashx"
|
||||
Rails.configuration.urlApi="web-apps/apps/api/documents/api.js"
|
||||
Rails.configuration.urlPreloader="web-apps/apps/api/documents/cache-scripts.html"
|
||||
|
||||
Reference in New Issue
Block a user