175 lines
4.1 KiB
Plaintext
175 lines
4.1 KiB
Plaintext
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head runat="server">
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no" />
|
||
|
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||
|
<meta name="mobile-web-app-capable" content="yes" />
|
||
|
<!--
|
||
|
*
|
||
|
* (c) Copyright Ascensio System SIA 2021
|
||
|
*
|
||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
* you may not use this file except in compliance with the License.
|
||
|
* You may obtain a copy of the License at
|
||
|
*
|
||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||
|
*
|
||
|
* Unless required by applicable law or agreed to in writing, software
|
||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
* See the License for the specific language governing permissions and
|
||
|
* limitations under the License.
|
||
|
*
|
||
|
-->
|
||
|
<title>ONLYOFFICE</title>
|
||
|
<style type="text/css">
|
||
|
html {
|
||
|
height: 100%;
|
||
|
width: 100%;
|
||
|
}
|
||
|
|
||
|
body {
|
||
|
background: #fff;
|
||
|
color: #333;
|
||
|
font-family: Arial, Tahoma,sans-serif;
|
||
|
font-size: 12px;
|
||
|
font-weight: normal;
|
||
|
height: 100%;
|
||
|
margin: 0;
|
||
|
overflow-y: hidden;
|
||
|
padding: 0;
|
||
|
text-decoration: none;
|
||
|
}
|
||
|
|
||
|
.form {
|
||
|
height: 100%;
|
||
|
}
|
||
|
|
||
|
div {
|
||
|
margin: 0;
|
||
|
padding: 0;
|
||
|
}
|
||
|
|
||
|
.app-error-panel {
|
||
|
position: absolute;
|
||
|
width: 100%;
|
||
|
height: 100%;
|
||
|
top: 0;
|
||
|
background-color: #f4f4f4;
|
||
|
z-index: 10;
|
||
|
}
|
||
|
|
||
|
.message-block {
|
||
|
display: inline-block;
|
||
|
vertical-align: middle;
|
||
|
width: 100%;
|
||
|
}
|
||
|
|
||
|
.message-inner {
|
||
|
width: 550px;
|
||
|
margin: auto;
|
||
|
padding: 30px;
|
||
|
background-color: #e3e3e3;
|
||
|
text-align: center;
|
||
|
}
|
||
|
|
||
|
.title {
|
||
|
font-size: 24px;
|
||
|
margin: 0 0 14px;
|
||
|
}
|
||
|
|
||
|
.text {
|
||
|
font-size: 16px;
|
||
|
}
|
||
|
|
||
|
</style>
|
||
|
</head>
|
||
|
<body>
|
||
|
<div id="progress">
|
||
|
Converting your file so you can edit it...
|
||
|
<a id="btn_end" style="display: none;">
|
||
|
<button type="button">Click here to open the converted file</button>
|
||
|
</a>
|
||
|
|
||
|
</div>
|
||
|
<div id="error" style="display: none;">
|
||
|
Conversion failed<br/>Sorry, we weren't able to convert the file for editing.<br/>Try again Go back
|
||
|
</div>
|
||
|
<script type="text/javascript" language="javascript">
|
||
|
|
||
|
function redirect(url) {
|
||
|
try {
|
||
|
window.top.location.replace(url);
|
||
|
}
|
||
|
catch (err) {
|
||
|
console.err(err);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function makeXHRRequest(url, success, error) {
|
||
|
var xhr = new XMLHttpRequest;
|
||
|
xhr.onreadystatechange = function() {
|
||
|
if (xhr.readyState == 4)
|
||
|
if (xhr.status == 200) {
|
||
|
success(xhr.responseText)
|
||
|
} else {
|
||
|
error()
|
||
|
}
|
||
|
|
||
|
}
|
||
|
;
|
||
|
xhr.open("GET", url, !0);
|
||
|
xhr.send();
|
||
|
}
|
||
|
|
||
|
function checkStatus(url, success, error) {
|
||
|
makeXHRRequest(url, function(responseText) {
|
||
|
let data = JSON.parse(responseText);
|
||
|
if(undefined !== data.error) {
|
||
|
error();
|
||
|
} else if(data.endConvert) {
|
||
|
success(data.fileUrl);
|
||
|
} else {
|
||
|
setTimeout(function(){
|
||
|
checkStatus(url, success, error);
|
||
|
}, 1000);
|
||
|
}
|
||
|
}, error);
|
||
|
}
|
||
|
|
||
|
function success(url) {
|
||
|
// redirect(url);
|
||
|
let btn = document.getElementById('btn_end');
|
||
|
btn.style.display = 'block';
|
||
|
btn.onclick = function() {
|
||
|
redirect(url);
|
||
|
};
|
||
|
}
|
||
|
|
||
|
function error() {
|
||
|
document.getElementById('progress').style.display = 'none';
|
||
|
document.getElementById('error').style.display = 'block';
|
||
|
}
|
||
|
|
||
|
var convertFile = function () {
|
||
|
|
||
|
let statusHandler = <%- JSON.stringify(statusHandler) %>;
|
||
|
|
||
|
if(!statusHandler) {
|
||
|
error();
|
||
|
}
|
||
|
|
||
|
checkStatus(statusHandler, success, error);
|
||
|
};
|
||
|
|
||
|
if (window.addEventListener) {
|
||
|
window.addEventListener("load", convertFile);
|
||
|
} else if (window.attachEvent) {
|
||
|
window.attachEvent("onload", convertFile);
|
||
|
}
|
||
|
</script>
|
||
|
</body>
|
||
|
</html>
|