mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
103 lines
3.4 KiB
Plaintext
103 lines
3.4 KiB
Plaintext
<!--*
|
||
*
|
||
* (c) Copyright Ascensio System Limited 2010-2018
|
||
*
|
||
* The MIT License (MIT)
|
||
*
|
||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||
* of this software and associated documentation files (the "Software"), to deal
|
||
* in the Software without restriction, including without limitation the rights
|
||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||
* copies of the Software, and to permit persons to whom the Software is
|
||
* furnished to do so, subject to the following conditions:
|
||
*
|
||
* The above copyright notice and this permission notice shall be included in all
|
||
* copies or substantial portions of the Software.
|
||
*
|
||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||
* SOFTWARE.
|
||
*
|
||
*-->
|
||
|
||
<%@page import="entities.FileModel"%>
|
||
<%@page contentType="text/html" pageEncoding="UTF-8"%>
|
||
|
||
<!DOCTYPE html>
|
||
<html>
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||
<title>ONLYOFFICE</title>
|
||
<link rel="icon" href="favicon.ico" type="image/x-icon" />
|
||
<link rel="stylesheet" type="text/css" href="css/editor.css" />
|
||
|
||
<% FileModel Model = (FileModel) request.getAttribute("file"); %>
|
||
|
||
<script type="text/javascript" src="${docserviceApiUrl}"></script>
|
||
|
||
<script type="text/javascript" language="javascript">
|
||
|
||
var docEditor;
|
||
|
||
var innerAlert = function (message) {
|
||
if (console && console.log)
|
||
console.log(message);
|
||
};
|
||
|
||
var onReady = function () {
|
||
innerAlert("Document editor ready");
|
||
};
|
||
|
||
var onDocumentStateChange = function (event) {
|
||
var title = document.title.replace(/\*$/g, "");
|
||
document.title = title + (event.data ? "*" : "");
|
||
};
|
||
|
||
var onRequestEditRights = function () {
|
||
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
|
||
};
|
||
|
||
var onError = function (event) {
|
||
if (event)
|
||
innerAlert(event.data);
|
||
};
|
||
|
||
var onOutdatedVersion = function (event) {
|
||
location.reload(true);
|
||
};
|
||
|
||
var сonnectEditor = function () {
|
||
var config = <%= FileModel.Serialize(Model) %>;
|
||
config.width = "100%";
|
||
config.height = "100%";
|
||
config.events = {
|
||
"onReady": onReady,
|
||
"onDocumentStateChange": onDocumentStateChange,
|
||
'onRequestEditRights': onRequestEditRights,
|
||
"onError": onError,
|
||
"onOutdatedVersion": onOutdatedVersion,
|
||
};
|
||
|
||
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
|
||
};
|
||
|
||
if (window.addEventListener) {
|
||
window.addEventListener("load", сonnectEditor);
|
||
} else if (window.attachEvent) {
|
||
window.attachEvent("load", сonnectEditor);
|
||
}
|
||
|
||
</script>
|
||
|
||
</head>
|
||
<body>
|
||
<div class="form">
|
||
<div id="iframeEditor"></div>
|
||
</div>
|
||
</body>
|
||
</html>
|