mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
v5.0.0
This commit is contained in:
@ -36,7 +36,6 @@ import java.io.InputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.net.URL;
|
||||
import java.util.Scanner;
|
||||
import javafx.util.Pair;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.annotation.MultipartConfig;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
@ -149,14 +148,11 @@ public class IndexServlet extends HttpServlet {
|
||||
{
|
||||
String key = ServiceConverter.GenerateRevisionId(fileUri);
|
||||
|
||||
Pair<Integer, String> res = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, true);
|
||||
String newFileUri = ServiceConverter.GetConvertedUri(fileUri, fileExt, internalFileExt, key, true);
|
||||
|
||||
int result = res.getKey();
|
||||
String newFileUri = res.getValue();
|
||||
|
||||
if (result != 100)
|
||||
if (newFileUri == "")
|
||||
{
|
||||
writer.write("{ \"step\" : \"" + result + "\", \"filename\" : \"" + fileName + "\"}");
|
||||
writer.write("{ \"step\" : \"0\", \"filename\" : \"" + fileName + "\"}");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@ -70,7 +70,7 @@ public class ServiceConverter
|
||||
}
|
||||
}
|
||||
|
||||
public static Pair<Integer, String> GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, Boolean isAsync) throws Exception
|
||||
public static String GetConvertedUri(String documentUri, String fromExtension, String toExtension, String documentRevisionId, Boolean isAsync) throws Exception
|
||||
{
|
||||
String convertedDocumentUri = null;
|
||||
|
||||
@ -112,7 +112,7 @@ public class ServiceConverter
|
||||
percent = percent >= 100 ? 99 : percent;
|
||||
}
|
||||
|
||||
return new Pair<>(percent, convertedDocumentUri);
|
||||
return percent >= 100 ? convertedDocumentUri : "";
|
||||
}
|
||||
|
||||
public static String GetExternalUri(InputStream fileStream, long contentLength, String contentType, String documentRevisionId) throws IOException, Exception
|
||||
@ -154,9 +154,9 @@ public class ServiceConverter
|
||||
|
||||
connection.disconnect();
|
||||
|
||||
Pair <Integer, String> res = GetResponseUri(xml);
|
||||
String res = GetResponseUri(xml);
|
||||
|
||||
return res.getValue();
|
||||
return res;
|
||||
}
|
||||
|
||||
public static String GenerateRevisionId(String expectedKey)
|
||||
@ -270,7 +270,7 @@ public class ServiceConverter
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
|
||||
private static Pair<Integer, String> GetResponseUri(String xml) throws Exception
|
||||
private static String GetResponseUri(String xml) throws Exception
|
||||
{
|
||||
Document document = ConvertStringToXmlDocument(xml);
|
||||
|
||||
@ -309,7 +309,7 @@ public class ServiceConverter
|
||||
resultPercent = resultPercent >= 100 ? 99 : resultPercent;
|
||||
}
|
||||
|
||||
return new Pair<>(resultPercent, responseUri);
|
||||
return resultPercent >= 100 ? responseUri : "";
|
||||
}
|
||||
|
||||
private static String ConvertStreamToString(InputStream stream) throws IOException
|
||||
|
||||
@ -519,7 +519,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
|
||||
var mode = req.query.mode || "edit"; //mode: view/edit/review/comment/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";
|
||||
@ -597,7 +597,7 @@ app.get("/editor", function (req, res) {
|
||||
callbackUrl: docManager.getCallback(fileName),
|
||||
isEdit: canEdit && mode == "edit",
|
||||
review: mode == "edit" || mode == "review",
|
||||
comment: mode == "edit" || mode == "comment",
|
||||
comment: mode != "view" && mode != "embedded",
|
||||
mode: canEdit && mode != "view" ? "edit" : "view",
|
||||
canBackToFolder: type != "embedded",
|
||||
backUrl: docManager.getServerUrl(),
|
||||
|
||||
@ -22,7 +22,7 @@
|
||||
"exampleUrl": null,
|
||||
"viewedDocs": [".ppt", ".pps", ".odp", ".pdf", ".djvu", ".epub", ".xps"],
|
||||
"editedDocs": [".docx", ".doc", ".odt", ".xlsx", ".xls", ".ods", ".csv", ".pptx", ".ppsx", ".rtf", ".txt", ".mht", ".html", ".htm"],
|
||||
"convertedDocs": [".doc", ".odt", ".xls", ".ods", ".ppt", ".pps", ".odp", ".rtf", ".mht", ".html", ".htm", ".epub"],
|
||||
"convertedDocs": [".doc", ".odt", ".xls", ".ods", ".ppt", ".pps", ".odp", ".rtf", ".mht", ".html", ".htm", ".epub", ".docm", ".dot", ".dotm", ".dotx", ".xlsm", ".xlt", ".xltm", ".xltx", ".pot", ".potm", ".potx", ".ppsm", ".pptm"],
|
||||
"storageFolder": "files",
|
||||
"maxFileSize": 1073741824,
|
||||
"mobileRegEx": "android|avantgo|playbook|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od|ad)|iris|kindle|lge |maemo|midp|mmp|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\\/|plucker|pocket|psp|symbian|treo|up\\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino",
|
||||
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 3000,
|
||||
"siteUrl": "http://127.0.0.1:8080/"
|
||||
"siteUrl": "http://127.0.0.1:8080/",
|
||||
"apiUrl": "web-apps-pro/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps-pro/apps/api/documents/cache-scripts.html"
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,8 @@
|
||||
{
|
||||
"server": {
|
||||
"port": 80,
|
||||
"siteUrl": "http://127.0.0.1:8001/"
|
||||
"siteUrl": "http://127.0.0.1:8001/",
|
||||
"apiUrl": "web-apps-pro/apps/api/documents/api.js",
|
||||
"preloaderUrl": "web-apps-pro/apps/api/documents/cache-scripts.html"
|
||||
}
|
||||
}
|
||||
@ -77,11 +77,11 @@ fileUtility.fileType = {
|
||||
presentation: "presentation"
|
||||
}
|
||||
|
||||
fileUtility.documentExts = [".docx", ".doc", ".odt", ".rtf", ".txt", ".html", ".htm", ".mht", ".pdf", ".djvu", ".fb2", ".epub", ".xps"];
|
||||
fileUtility.documentExts = [".docx", ".doc", ".odt", ".rtf", ".txt", ".html", ".htm", ".mht", ".pdf", ".djvu", ".fb2", ".epub", ".xps", ".docm", ".dot", ".dotm", ".dotx"];
|
||||
|
||||
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".ods", ".csv"];
|
||||
fileUtility.spreadsheetExts = [".xls", ".xlsx", ".ods", ".csv", ".xlsm", ".xlt", ".xltm", ".xltx"];
|
||||
|
||||
fileUtility.presentationExts = [".pps", ".ppsx", ".ppt", ".pptx", ".odp"];
|
||||
fileUtility.presentationExts = [".pps", ".ppsx", ".ppt", ".pptx", ".odp", ".pot", ".potm", ".potx", ".ppsm", ".pptm"];
|
||||
|
||||
function getUrlParams(url) {
|
||||
try {
|
||||
|
||||
@ -35,6 +35,8 @@ if (typeof jQuery != "undefined") {
|
||||
userid = getUrlVars()["userid"];
|
||||
language = getUrlVars()["lang"];
|
||||
|
||||
mustReload = false;
|
||||
|
||||
if ("" != language && undefined != language)
|
||||
jq("#language").val(language);
|
||||
else
|
||||
@ -100,6 +102,7 @@ if (typeof jQuery != "undefined") {
|
||||
}
|
||||
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
mustReload = true;
|
||||
|
||||
jq("#step1").addClass("done").removeClass("current");
|
||||
jq("#step2").addClass("current");
|
||||
@ -241,6 +244,9 @@ if (typeof jQuery != "undefined") {
|
||||
jq('#hiddenFileName').val("");
|
||||
jq("#embeddedView").attr("src", "");
|
||||
jq.unblockUI();
|
||||
if (mustReload) {
|
||||
document.location.reload();
|
||||
}
|
||||
});
|
||||
|
||||
jq(document).on("click", ".delete-file", function () {
|
||||
|
||||
Reference in New Issue
Block a user