release/v5.2.0

This commit is contained in:
Alexey Golubev
2018-09-27 19:07:46 +03:00
29 changed files with 192 additions and 185 deletions

View File

@ -4,44 +4,58 @@
<PropertyGroup>
<To Condition=" '$(To)' == '' ">..\deploy\</To>
<RootDir Condition="$(RootDir)==''">..\..\</RootDir>
<NameCSharp>$(To).Net (C#) Example</NameCSharp>
<DirCSharp>$(RootDir)web\documentserver-example\csharp\</DirCSharp>
<NameMvc>$(To).Net (C# MVC) Example</NameMvc>
<DirMvc>$(RootDir)web\documentserver-example\csharp-mvc\</DirMvc>
<NameJava>$(To)Java Example</NameJava>
<DirJava>$(RootDir)web\documentserver-example\java\</DirJava>
<NameNodeJS>$(To)Node.js Example</NameNodeJS>
<DirNodeJS>$(RootDir)web\documentserver-example\nodejs\</DirNodeJS>
<NamePHP>$(To)PHP Example</NamePHP>
<DirPHP>$(RootDir)web\documentserver-example\php\</DirPHP>
<NameRuby>$(To)Ruby Example</NameRuby>
<DirRuby>$(RootDir)web\documentserver-example\ruby\</DirRuby>
</PropertyGroup>
<Target Name="Build">
<RemoveDir Directories="$(To)" ContinueOnError="true" />
<ItemGroup>
<ZipFilesCSharp Include="$(DirCSharp)**" Exclude="$(DirCSharp)obj\**" />
</ItemGroup>
<Zip Files="@(ZipFilesCSharp)" WorkingDirectory="$(DirCSharp)" ZipFileName="$(To).Net (C#) Example.zip" />
<Copy SourceFiles="@(ZipFilesCSharp)" DestinationFiles="@(ZipFilesCSharp->'$(NameCSharp)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameCSharp)" WorkingDirectory="$(To)" ZipFileName="$(NameCSharp).zip" />
<ItemGroup>
<ZipFilesMVC Include="$(DirMvc)**" Exclude="$(DirMvc)obj\**" />
</ItemGroup>
<Zip Files="@(ZipFilesMVC)" WorkingDirectory="$(DirMvc)" ZipFileName="$(To).Net (C# MVC) Example.zip" />
<Copy SourceFiles="@(ZipFilesMVC)" DestinationFiles="@(ZipFilesMVC->'$(NameMvc)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameMvc)" WorkingDirectory="$(To)" ZipFileName="$(NameMvc).zip" />
<ItemGroup>
<ZipFilesJava Include="$(DirJava)**" />
</ItemGroup>
<Zip Files="@(ZipFilesJava)" WorkingDirectory="$(DirJava)" ZipFileName="$(To)Java Example.zip" />
<Copy SourceFiles="@(ZipFilesJava)" DestinationFiles="@(ZipFilesJava->'$(NameJava)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameJava)" WorkingDirectory="$(To)" ZipFileName="$(NameJava).zip" />
<ItemGroup>
<ZipFilesNodeJS Include="$(DirNodeJS)**" Exclude="$(DirNodeJS)node_modules\**" />
</ItemGroup>
<Zip Files="@(ZipFilesNodeJS)" WorkingDirectory="$(DirNodeJS)" ZipFileName="$(To)Node.js Example.zip" />
<Copy SourceFiles="@(ZipFilesNodeJS)" DestinationFiles="@(ZipFilesNodeJS->'$(NameNodeJS)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameNodeJS)" WorkingDirectory="$(To)" ZipFileName="$(NameNodeJS).zip" />
<ItemGroup>
<ZipFilesPHP Include="$(DirPHP)**" />
</ItemGroup>
<Zip Files="@(ZipFilesPHP)" WorkingDirectory="$(DirPHP)" ZipFileName="$(To)PHP Example.zip" />
<Copy SourceFiles="@(ZipFilesPHP)" DestinationFiles="@(ZipFilesPHP->'$(NamePHP)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NamePHP)" WorkingDirectory="$(To)" ZipFileName="$(NamePHP).zip" />
<ItemGroup>
<ZipFilesRuby Include="$(DirRuby)**" />
</ItemGroup>
<Zip Files="@(ZipFilesRuby)" WorkingDirectory="$(DirRuby)" ZipFileName="$(To)Ruby Example.zip" />
<Copy SourceFiles="@(ZipFilesRuby)" DestinationFiles="@(ZipFilesRuby->'$(NameRuby)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameRuby)" WorkingDirectory="$(To)" ZipFileName="$(NameRuby).zip" />
</Target>
</Project>

View File

@ -145,28 +145,11 @@
});
};
if (window.addEventListener) {
window.addEventListener("load", сonnectEditor);
} else if (window.attachEvent) {
window.attachEvent("load", сonnectEditor);
}
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
if (window.addEventListener) {
window.addEventListener("load", сonnectEditor);
} else if (window.attachEvent) {
window.attachEvent("load", сonnectEditor);
}
</script>
</body>

View File

@ -14,7 +14,7 @@
<add key="files.docservice.convert-docs" value=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.url.converter" value="http://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="http://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="http://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.converter" value="https://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
</appSettings>

View File

@ -143,35 +143,6 @@
window.attachEvent("load", сonnectEditor);
}
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function SaveFileRequest(fileName, fileType, fileUri) {
var req = getXmlHttp();
var requestAddress = "webeditor.ashx"
+ "?type=save"
+ "&filename=" + encodeURIComponent(fileName)
+ "&filetype=" + encodeURIComponent(fileType)
+ "&fileuri=" + encodeURIComponent(fileUri);
req.open('get', requestAddress, true);
req.send(fileUri);
}
</script>
</head>
<body>

View File

@ -10,7 +10,7 @@
<add key="files.docservice.convert-docs" value=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.epub"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.url.converter" value="http://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="http://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="http://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.converter" value="https://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
</appSettings>

View File

@ -0,0 +1,9 @@
FROM ubuntu:16.04
RUN apt-get update && apt-get install -y software-properties-common \
python-software-properties
RUN add-apt-repository -y ppa:webupd8team/java
RUN echo "oracle-java8-installer shared/accepted-oracle-license-v1-1 select true" | debconf-set-selections
RUN apt-get update && apt-get install -y oracle-java8-installer \
maven
COPY . /java
CMD mvn -f /java package

View File

@ -0,0 +1,61 @@
## Build instruction
At first, You need to install `oracle-java8-installer`
```
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer
```
Edit the **settings.properties** configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed
```
nano src/main/resources/settings.properties
```
Edit the following lines:
```
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html
```
Install Maven:
```
apt-get install maven
```
And build:
```
mvn package
```
After it, all bin files will be passed to `./target` folder
## Build from docker
Edit the **settings.properties** configuration file. Specify the name of your local server with the ONLYOFFICE Document Server installed
```
nano src/main/resources/settings.properties
```
Edit the following lines. You need to change `documentserver` to your documentserver:
```
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html
```
Run next command in java example directory:
```
docker build . -t java-example
docker run -it -v $PWD/target:/java/target java-example
```
After it, all bin files will be passed to `./target` folder

View File

@ -4,7 +4,7 @@
<groupId>onlyoffice.com</groupId>
<artifactId>OnlineEditorsExampleJava</artifactId>
<version>1.0-SNAPSHOT</version>
<version>1.0</version>
<packaging>war</packaging>
<name>OnlineEditorsExampleJava</name>

View File

@ -56,7 +56,7 @@ public class IndexServlet extends HttpServlet
{
String action = request.getParameter("type");
if(action == null)
if (action == null)
{
request.getRequestDispatcher("index.jsp").forward(request, response);
return;
@ -249,7 +249,7 @@ public class IndexServlet extends HttpServlet
long status = (long) jsonObj.get("status");
int saved = 0;
if(status == 2 || status == 3)//MustSave, Corrupted
if (status == 2 || status == 3)//MustSave, Corrupted
{
String downloadUri = (String) jsonObj.get("url");

View File

@ -117,7 +117,7 @@ public class DocumentManager
String storagePath = ConfigManager.GetProperty("storage-folder");
String hostAddress = CurUserHostAddress(userAddress);
String directory = serverPath + "\\" + storagePath + "\\";
String directory = serverPath + File.separator + storagePath + File.separator;
File file = new File(directory);
@ -126,7 +126,7 @@ public class DocumentManager
file.mkdir();
}
directory = directory + hostAddress + "\\";
directory = directory + hostAddress + File.separator;
file = new File(directory);
if (!file.exists())
@ -181,11 +181,11 @@ public class DocumentManager
{
try
{
String serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
String serverPath = GetServerUrl();
String storagePath = ConfigManager.GetProperty("storage-folder");
String hostAddress = CurUserHostAddress(null);
String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString());
String filePath = serverPath + "/" + storagePath + "/" + hostAddress + "/" + URLEncoder.encode(fileName, java.nio.charset.StandardCharsets.UTF_8.toString()).replace("+", "%20");
return filePath;
}
@ -197,12 +197,12 @@ public class DocumentManager
public static String GetServerUrl()
{
return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort();
return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
}
public static String GetCallback(String fileName)
{
String serverPath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
String serverPath = GetServerUrl();
String hostAddress = CurUserHostAddress(null);
try
{

View File

@ -6,7 +6,7 @@ files.docservice.edited-docs=.docx|.xlsx|.csv|.pptx|.ppsx|.txt
files.docservice.convert-docs=.docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.epub
files.docservice.timeout=120000
files.docservice.url.converter=http://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=http://documentserver/ResourceService.ashx
files.docservice.url.api=http://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=http://documentserver/web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html

View File

@ -146,23 +146,6 @@
window.attachEvent("load", сonnectEditor);
}
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest !== "undefined") {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
</script>
</head>

View File

@ -33,7 +33,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="http://documentserver/web-apps/apps/api/documents/api.js"></script>
<script id="scriptApi" type="text/javascript" src="https://documentserver/web-apps/apps/api/documents/api.js"></script>
<script type="text/javascript" src="init.js"></script>

View File

@ -1,4 +1,5 @@
/*
"use strict";
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
*
@ -150,6 +151,7 @@ app.post("/upload", function (req, res) {
const form = new formidable.IncomingForm();
form.uploadDir = uploadDirTmp;
form.keepExtensions = true;
form.maxFileSize = configServer.get("maxFileSize");
form.parse(req, function (err, fields, files) {
if (err) {
@ -229,6 +231,7 @@ app.get("/convert", function (req, res) {
if (error != null)
result["error"] = error;
response.setHeader("Content-Type", "application/json");
response.write(JSON.stringify(result));
response.end();
};
@ -268,7 +271,7 @@ app.get("/convert", function (req, res) {
fileSystem.renameSync(path.join(correctHistoryPath, fileName + ".txt"), path.join(correctHistoryPath, correctName + ".txt"));
writeResult(correctName, null, null);
writeResult(correctName, result, null);
} catch (e) {
console.log(e);
writeResult(null, null, "Server error");
@ -277,7 +280,11 @@ app.get("/convert", function (req, res) {
try {
if (configServer.get('convertedDocs').indexOf(fileExt) != -1) {
const key = documentService.generateRevisionId(fileUri);
let storagePath = docManager.storagePath(fileName);
const stat = fileSystem.statSync(storagePath);
let key = fileUri + stat.mtime.getTime();
key = documentService.generateRevisionId(key);
documentService.getConvertedUri(fileUri, fileExt, internalFileExt, key, true, callback);
} else {
writeResult(fileName, null, null);
@ -354,7 +361,7 @@ app.post("/track", function (req, res) {
var count_version = docManager.countVersion(historyPath);
version = count_version + 1;
versionPath = docManager.versionPath(fileName, userAddress, version);
var versionPath = docManager.versionPath(fileName, userAddress, version);
docManager.createDirectory(versionPath);
var downloadZip = body.changesurl;
@ -467,24 +474,32 @@ app.post("/track", function (req, res) {
//checkjwt
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
var checkJwtHeaderRes = documentService.checkJwtHeader(req);
if (checkJwtHeaderRes) {
if (checkJwtHeaderRes.payload) {
body = checkJwtHeaderRes.payload;
}
if (checkJwtHeaderRes.query) {
if (checkJwtHeaderRes.query.useraddress) {
userAddress = checkJwtHeaderRes.query.useraddress;
}
if (checkJwtHeaderRes.query.filename) {
fileName = fileUtility.getFileName(checkJwtHeaderRes.query.filename);
}
}
processTrack(res, body, fileName, userAddress);
var body = null;
if (req.body.hasOwnProperty("token")) {
body = documentService.readToken(req.body.token);
} else {
var checkJwtHeaderRes = documentService.checkJwtHeader(req);
if (checkJwtHeaderRes) {
var body;
if (checkJwtHeaderRes.payload) {
body = checkJwtHeaderRes.payload;
}
if (checkJwtHeaderRes.query) {
if (checkJwtHeaderRes.query.useraddress) {
userAddress = checkJwtHeaderRes.query.useraddress;
}
if (checkJwtHeaderRes.query.filename) {
fileName = fileUtility.getFileName(checkJwtHeaderRes.query.filename);
}
}
}
}
if (body == null) {
res.write("{\"error\":1}");
res.end();
return;
}
processTrack(res, body, fileName, userAddress);
return;
}
@ -519,7 +534,7 @@ app.get("/editor", function (req, res) {
var fileName = fileUtility.getFileName(req.query.fileName);
var key = docManager.getKey(fileName);
var url = docManager.getFileUri(fileName);
var mode = req.query.mode || "edit"; //mode: view/edit/review/comment/embedded
var mode = req.query.mode || "edit"; //mode: view/edit/review/comment/fillForms/embedded
var type = req.query.type || ""; //type: embedded/mobile/desktop
if (type == "") {
type = new RegExp(configServer.get("mobileRegEx"), "i").test(req.get('User-Agent')) ? "mobile" : "desktop";
@ -598,7 +613,8 @@ app.get("/editor", function (req, res) {
callbackUrl: docManager.getCallback(fileName),
isEdit: canEdit && (mode == "edit" || mode == "filter"),
review: mode == "edit" || mode == "review",
comment: mode != "view" && mode != "embedded",
comment: mode != "view" && mode != "fillForms" && mode != "embedded",
fillForms: mode != "view" && mode != "comment" && mode != "embedded",
modifyFilter: mode != "filter",
mode: canEdit && mode != "view" ? "edit" : "view",
canBackToFolder: type != "embedded",

View File

@ -12,7 +12,7 @@
},
"server": {
"port": 3000,
"siteUrl": "http://documentserver/",
"siteUrl": "https://documentserver/",
"commandUrl": "coauthoring/CommandService.ashx",
"converterUrl": "ConvertService.ashx",
"tempStorageUrl": "ResourceService.ashx",

View File

@ -1,3 +1,4 @@
"use strict";
/*
*
* (c) Copyright Ascensio System Limited 2010-2018
@ -303,7 +304,7 @@ docManager.getKey = function (fileName) {
let storagePath = docManager.storagePath(fileName, userAddress);
const stat = fileSystem.statSync(storagePath);
key += stat.mtime.toString();
key += stat.mtime.getTime();
return documentService.generateRevisionId(key);
};

View File

@ -46,8 +46,6 @@ var documentService = {};
documentService.userIp = null;
documentService.getConvertedUriSync = function (documentUri, fromExtension, toExtension, documentRevisionId, callback) {
documentRevisionId = documentService.generateRevisionId(documentRevisionId || documentUri);
documentService.getConvertedUri(documentUri, fromExtension, toExtension, documentRevisionId, false, function (err, data) {
if (err) {
callback();
@ -82,6 +80,7 @@ documentService.getConvertedUri = function (documentUri, fromExtension, toExtens
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
params.token = documentService.getToken(params);
}
urllib.request(uri,
@ -185,6 +184,7 @@ documentService.commandRequest = function (method, documentRevisionId, callback)
};
if (cfgSignatureEnable && cfgSignatureUseForRequest) {
headers[cfgSignatureAuthorizationHeader] = cfgSignatureAuthorizationHeaderPrefix + this.fillJwtByUrl(uri, params);
params.token = documentService.getToken(params);
}
urllib.request(uri,
@ -218,4 +218,18 @@ documentService.fillJwtByUrl = function (uri, opt_dataObject, opt_iss, opt_paylo
return jwt.sign(payload, cfgSignatureSecret, options);
}
documentService.getToken = function (data) {
var options = {algorithm: cfgSignatureSecretAlgorithmRequest, expiresIn: cfgSignatureSecretExpiresIn};
return jwt.sign(data, cfgSignatureSecret, options);
};
documentService.readToken = function (token) {
try {
return jwt.verify(token, cfgSignatureSecret);
} catch (err) {
console.log('checkJwtHeader error: name = ' + err.name + ' message = ' + err.message + ' token = ' + token)
}
return null;
};
module.exports = documentService;

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

View File

@ -70,6 +70,9 @@ if (typeof jQuery != "undefined") {
jq('#fileupload').fileupload({
dataType: 'json',
add: function (e, data) {
if (jq("#mainProgress").is(":visible")) {
return;
}
jq(".error").removeClass("error");
jq(".done").removeClass("done");
jq(".current").removeClass("current");
@ -133,10 +136,9 @@ if (typeof jQuery != "undefined") {
timer = setTimeout(function () {
var requestAddress = UrlConverter + "?filename=" + encodeURIComponent(jq("#hiddenFileName").val());
jq.ajaxSetup({ cache: false });
jq.ajax({
async: true,
contentType: "text/xml",
type: "get",
url: requestAddress,
complete: function (data) {

View File

@ -16,6 +16,7 @@
"comment": <%- editor.comment %>,
"download": true,
"edit": <%- editor.isEdit %>,
"fillForms": <%- editor.fillForms %>,
"modifyFilter": <%- editor.modifyFilter %>,
"review": <%- editor.review %>
}

View File

@ -130,7 +130,7 @@
<thead>
<tr class="tableHeader">
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td colspan="4" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="5" class="tableHeaderCell contentCells-shift">Editors</td>
<td colspan="3" class="tableHeaderCell">Viewers</td>
</tr>
</thead>
@ -163,14 +163,18 @@
<img src="images/filter-24.png" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" /></a>
<% } %>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<% if (storedFiles[i].documentType == "text" || storedFiles[i].documentType == "presentation") { %>
<td class="contentCells contentCells-icon">
<a href="editor?type=desktop&mode=comment&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/comment-24.png" alt="Open in editor for comment" title="Open in editor for comment" /></a>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<% if (storedFiles[i].documentType == "text") { %>
<a href="editor?type=desktop&mode=fillForms&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">
<img src="images/fill-forms-24.png" 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" colspan="4"></td>
<td class="contentCells contentCells-shift contentCells-icon" colspan="5"></td>
<% } %>
<td class="contentCells contentCells-icon">
<a href="editor?type=desktop&mode=view&fileName=<%= encodeURIComponent(storedFiles[i].name) + params %>" target="_blank">

View File

@ -150,7 +150,7 @@ function getClientIp() {
function serverPath($forDocumentServer = NULL) {
return $forDocumentServer && isset($GLOBALS['EXAMPLE_URL']) && $GLOBALS['EXAMPLE_URL'] != ""
? $GLOBALS['EXAMPLE_URL']
: ('http://' . $_SERVER['HTTP_HOST']);
: (getScheme() . '://' . $_SERVER['HTTP_HOST']);
}
function getCurUserHostAddress($userAddress = NULL) {
@ -257,7 +257,7 @@ function getVirtualPath($forDocumentServer) {
}
function FileUri($file_name, $forDocumentServer = NULL) {
$uri = getVirtualPath($forDocumentServer) . $file_name;
$uri = getVirtualPath($forDocumentServer) . rawurlencode($file_name);
return $uri;
}

View File

@ -12,10 +12,10 @@ $GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot",
$GLOBALS['DOC_SERV_TIMEOUT'] = "120000";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "http://documentserver/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "http://documentserver/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "https://documentserver/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "https://documentserver/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "http://documentserver/web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "https://documentserver/web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['EXAMPLE_URL'] = "";

View File

@ -228,23 +228,6 @@
window.attachEvent("load", сonnectEditor);
}
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
</script>
</head>
<body>

View File

@ -177,7 +177,7 @@
echo ' <a class="stored-edit '.$storeFile->documentType.'" href="doceditor.php?fileID='.urlencode($storeFile->name).'&user='.$user.'" target="_blank">';
echo ' <span title="'.$storeFile->name.'">'.$storeFile->name.'</span>';
echo ' </a>';
echo ' <a href="webeditor-ajax.php?type=download&filename='.$storeFile->name.'">';
echo ' <a href="'.FileUri($storeFile->name).'">';
echo ' <img class="icon-download" src="css/images/download-24.png" alt="Download" title="Download" /></a>';
echo ' </a>';
echo ' <a class="delete-file" data="'.$storeFile->name.'">';

View File

@ -61,9 +61,6 @@ if (isset($_GET["type"]) && !empty($_GET["type"])) { //Checks if type value exis
$response_array = upload();
$response_array['status'] = isset($response_array['error']) ? 'error' : 'success';
die (json_encode($response_array));
case "download":
download();
exit;
case "convert":
$response_array = convert();
$response_array['status'] = 'success';
@ -128,21 +125,6 @@ function upload() {
return $result;
}
function download() {
$fileName = $_GET["filename"];
$filePath = getStoragePath($fileName);
if (!file_exists($filePath)) {
http_response_code(404);
return;
}
header("Content-Length: " . filesize($filePath));
header("Content-Type: " . mime_content_type($fileName));
header("Content-Disposition: attachment; filename=\"".basename($filePath)."\"");
readfile($filePath);
}
function track() {
sendlog("Track START", "webedior-ajax.log");
sendlog("_GET params: " . serialize( $_GET ), "webedior-ajax.log");

View File

@ -105,21 +105,4 @@
window.attachEvent("load", сonnectEditor);
}
function getXmlHttp() {
var xmlhttp;
try {
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) {
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
} catch (ex) {
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
</script>

View File

@ -39,9 +39,9 @@ module OnlineEditorsExampleRuby
Rails.configuration.editedDocs=".docx|.xlsx|.csv|.pptx|.ppsx|.txt"
Rails.configuration.convertDocs=".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.epub"
Rails.configuration.urlConverter="http://documentserver/ConvertService.ashx"
Rails.configuration.urlApi="http://documentserver/web-apps/apps/api/documents/api.js"
Rails.configuration.urlPreloader="http://documentserver/web-apps/apps/api/documents/cache-scripts.html"
Rails.configuration.urlConverter="https://documentserver/ConvertService.ashx"
Rails.configuration.urlApi="https://documentserver/web-apps/apps/api/documents/api.js"
Rails.configuration.urlPreloader="https://documentserver/web-apps/apps/api/documents/cache-scripts.html"
end
end