mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
csharp-mvc: add password for convert
This commit is contained in:
@ -28,6 +28,7 @@ if (typeof jQuery != "undefined") {
|
||||
jq(".current").removeClass("current");
|
||||
jq("#step1").addClass("current");
|
||||
jq("#mainProgress .error-message").hide().find("span").text("");
|
||||
jq("#blockPassword").hide();
|
||||
jq("#mainProgress").removeClass("embedded");
|
||||
jq("#uploadFileName").text("");
|
||||
|
||||
@ -60,7 +61,6 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#uploadFileName").addClass(response.documentType);
|
||||
|
||||
jq("#step1").addClass("done").removeClass("current");
|
||||
jq("#step2").addClass("current");
|
||||
|
||||
checkConvert();
|
||||
}
|
||||
@ -70,7 +70,7 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
|
||||
var timer = null;
|
||||
var checkConvert = function () {
|
||||
var checkConvert = function (filePass = null) {
|
||||
if (timer != null) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
@ -78,6 +78,8 @@ if (typeof jQuery != "undefined") {
|
||||
if (!jq("#mainProgress").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
jq("#step2").addClass("current");
|
||||
jq("#filePass").val("");
|
||||
|
||||
var fileName = jq("#hiddenFileName").val();
|
||||
var posExt = fileName.lastIndexOf('.');
|
||||
@ -95,24 +97,36 @@ if (typeof jQuery != "undefined") {
|
||||
contentType: "text/xml",
|
||||
type: "post",
|
||||
dataType: "json",
|
||||
data: JSON.stringify({ filename: fileName }),
|
||||
data: JSON.stringify({ filename: fileName, filePass: filePass }),
|
||||
url: UrlConverter,
|
||||
complete: function (data) {
|
||||
var responseText = data.responseText;
|
||||
var response = jq.parseJSON(responseText);
|
||||
if (response.error) {
|
||||
jq(".current").removeClass("current");
|
||||
jq(".step:not(.done)").addClass("error");
|
||||
jq("#mainProgress .error-message").show().find("span").text(response.error);
|
||||
jq('#hiddenFileName').val("");
|
||||
return;
|
||||
if (response.error.includes("Incorrect password")) {
|
||||
jq(".current").removeClass("current");
|
||||
jq("#step2").addClass("error");
|
||||
jq("#blockPassword").show();
|
||||
if (filePass) {
|
||||
jq("#filePass").addClass("errorInput");
|
||||
jq(".errorPass").text("The password is incorrect, please try again.");
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
jq(".current").removeClass("current");
|
||||
jq(".step:not(.done)").addClass("error");
|
||||
jq("#mainProgress .error-message").show().find("span").text(response.error);
|
||||
jq('#hiddenFileName').val("");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
jq("#hiddenFileName").val(response.filename);
|
||||
|
||||
if (response.step && response.step < 100) {
|
||||
checkConvert();
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
loadScripts();
|
||||
}
|
||||
}
|
||||
@ -124,7 +138,6 @@ if (typeof jQuery != "undefined") {
|
||||
if (!jq("#mainProgress").is(":visible")) {
|
||||
return;
|
||||
}
|
||||
jq("#step2").addClass("done").removeClass("current");
|
||||
jq("#step3").addClass("current");
|
||||
|
||||
if (jq("#loadScripts").is(":empty")) {
|
||||
@ -182,6 +195,23 @@ if (typeof jQuery != "undefined") {
|
||||
});
|
||||
};
|
||||
|
||||
jq(document).on("click", "#enterPass", function () {
|
||||
var filePass = jq("#filePass").val();
|
||||
if (filePass) {
|
||||
jq("#step2").removeClass("error");
|
||||
jq("#blockPassword").hide();
|
||||
checkConvert(filePass);
|
||||
} else {
|
||||
jq("#filePass").addClass("errorInput");
|
||||
jq(".errorPass").text("Password can't be blank.");
|
||||
}
|
||||
});
|
||||
|
||||
jq(document).on("click", "#skipPass", function () {
|
||||
jq("#blockPassword").hide();
|
||||
loadScripts();
|
||||
});
|
||||
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
var url = UrlEditor + "?fileName=" + fileId;
|
||||
|
||||
Reference in New Issue
Block a user