mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
165 lines
6.5 KiB
Plaintext
165 lines
6.5 KiB
Plaintext
<!--*
|
|
*
|
|
* (c) Copyright Ascensio System Limited 2010-2016
|
|
*
|
|
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
|
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
|
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
|
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
|
*
|
|
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
|
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
|
*
|
|
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
|
*
|
|
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
|
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
|
*
|
|
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
|
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
|
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
|
* in every copy of the program you distribute.
|
|
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
|
*
|
|
*-->
|
|
|
|
<!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" />
|
|
<title>ONLYOFFICE™</title>
|
|
<link rel="icon" href="images/favicon.ico" type="image/x-icon" />
|
|
<link rel="stylesheet" type="text/css" href="stylesheets/editor.css" />
|
|
</head>
|
|
<body>
|
|
<div class="form">
|
|
<div id="iframeEditor">
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript" src="<%= apiUrl %>"></script>
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
var docEditor;
|
|
var fileName = "<%= file.name %>";
|
|
var fileType = "<%= file.ext %>";
|
|
|
|
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 onRequestHistory = function (event) {
|
|
var historyObj = <%- JSON.stringify(history) %> || null;
|
|
|
|
docEditor.refreshHistory(
|
|
{
|
|
currentVersion: "<%= file.version %>",
|
|
history: historyObj
|
|
});
|
|
};
|
|
|
|
var onRequestHistoryData = function (data) {
|
|
var version = data.data;
|
|
var url_arr = "<%= setHistoryData.url %>".split(",");
|
|
var urlDiff_arr = "<%= setHistoryData.urlDiff %>".split(",");
|
|
|
|
docEditor.setHistoryData({
|
|
version: version,
|
|
url: url_arr[version-1] != "" ? url_arr[version-1]: null,
|
|
urlDiff: urlDiff_arr[version-1] != "" ? urlDiff_arr[version-1]: null,
|
|
});
|
|
};
|
|
|
|
var onRequestHistoryClose = function (event){
|
|
document.location.reload();
|
|
};
|
|
|
|
var onError = function (event) {
|
|
if (event)
|
|
innerAlert(event.data);
|
|
};
|
|
|
|
var connectEditor = function () {
|
|
|
|
docEditor = new DocsAPI.DocEditor("iframeEditor",
|
|
{
|
|
width: "100%",
|
|
height: "100%",
|
|
type: "<%= editor.type %>",
|
|
documentType: "<%= editor.documentType %>",
|
|
document: {
|
|
title: fileName,
|
|
url: "<%= file.uri %>",
|
|
fileType: fileType,
|
|
key: "<%= editor.key %>",
|
|
info: {
|
|
author: "Me",
|
|
created: new Date().toDateString(),
|
|
},
|
|
permissions: {
|
|
edit: "<%= editor.isEdit %>" == "true",
|
|
download: true,
|
|
}
|
|
},
|
|
editorConfig: {
|
|
mode: "<%= editor.mode %>",
|
|
lang: "<%= editor.lang %>",
|
|
callbackUrl: "<%- editor.callbackUrl %>",
|
|
user: {
|
|
id: "<%= editor.userid %>",
|
|
firstname: "<%= editor.firstname %>",
|
|
lastname: "<%= editor.lastname %>",
|
|
},
|
|
embedded: {
|
|
saveUrl: "<%= file.uri %>",
|
|
embedUrl: "<%= file.uri %>",
|
|
shareUrl: "<%= file.uri %>",
|
|
toolbarDocked: "top",
|
|
},
|
|
customization: {
|
|
about: true,
|
|
chat: true,
|
|
comments: true,
|
|
feedback: true,
|
|
goback: {
|
|
url: "<%= editor.getServerUrl %>",
|
|
},
|
|
},
|
|
},
|
|
events: {
|
|
"onReady": onReady,
|
|
"onDocumentStateChange": onDocumentStateChange,
|
|
'onRequestEditRights': onRequestEditRights,
|
|
"onError": onError,
|
|
"onRequestHistory": onRequestHistory,
|
|
"onRequestHistoryData": onRequestHistoryData,
|
|
"onRequestHistoryClose": onRequestHistoryClose,
|
|
},
|
|
});
|
|
};
|
|
|
|
if (window.addEventListener) {
|
|
window.addEventListener("load", connectEditor);
|
|
} else if (window.attachEvent) {
|
|
window.attachEvent("load", connectEditor);
|
|
}
|
|
|
|
</script>
|
|
</body>
|
|
</html>
|