mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
338 lines
18 KiB
Plaintext
Executable File
338 lines
18 KiB
Plaintext
Executable File
<%#
|
||
(c) Copyright Ascensio System SIA 2023
|
||
|
||
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.
|
||
%>
|
||
|
||
<header>
|
||
<div class="center">
|
||
<a href="">
|
||
<img src ="assets/logo.svg" alt="ONLYOFFICE" />
|
||
</a>
|
||
</div>
|
||
</header>
|
||
<div class="center main">
|
||
<table class="table-main">
|
||
<tbody>
|
||
<tr>
|
||
<td class="left-panel section">
|
||
<div class="help-block">
|
||
<span>Create new</span>
|
||
<div class="clearFix">
|
||
<div class="create-panel">
|
||
<ul class="try-editor-list clearFix">
|
||
<li>
|
||
<a class="try-editor word" data-type="docx">Document</a>
|
||
</li>
|
||
<li>
|
||
<a class="try-editor cell" data-type="xlsx">Spreadsheet</a>
|
||
</li>
|
||
<li>
|
||
<a class="try-editor slide" data-type="pptx">Presentation</a>
|
||
</li>
|
||
<li>
|
||
<a class="try-editor form" data-type="docxf">Form template</a>
|
||
</li>
|
||
</ul>
|
||
<label class="side-option">
|
||
<input id="createSample" class="checkbox" type="checkbox" />With sample content
|
||
</label>
|
||
</div>
|
||
|
||
<div class="upload-panel clearFix">
|
||
<a class="file-upload">Upload file
|
||
<input type="file" id="fileupload" name="file" data-url="<%= upload_path %>" />
|
||
</a>
|
||
</div>
|
||
|
||
<table class="user-block-table" cellspacing="0" cellpadding="0">
|
||
<tbody>
|
||
<tr>
|
||
<td valign="middle">
|
||
<span class="select-user">Username</span>
|
||
<img id="info" class="info" data-id="user" src="assets/info.svg" />
|
||
<select class="select-user" id="user">
|
||
<% for user in Users.all_users() do %>
|
||
<option value="<%= user.id %>"><%= user.name ? user.name : "Anonymous" %></option>
|
||
<% end %>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="middle">
|
||
<span class="select-user">Language</span>
|
||
<img class="info info-tooltip" data-id="language"
|
||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||
src="assets/info.svg" />
|
||
<select class="select-user" id="language">
|
||
<% ConfigurationManager.new.languages.each { |key, language|%>
|
||
<option value="<%=key %>"> <%=language %> </option>
|
||
<% } %>
|
||
</select>
|
||
</td>
|
||
</tr>
|
||
<tr>
|
||
<td valign="middle">
|
||
<label class="side-option">
|
||
<input id="directUrl" type="checkbox" class="checkbox" />Try opening on client
|
||
<img id="directUrlInfo" class="info info-tooltip" data-id="directUrlInfo" data-tooltip="Some files can be opened in the user's browser without connecting to the document server." src="assets/info.svg" />
|
||
</label>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
</td>
|
||
<td class="section">
|
||
<%
|
||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||
docs = DocumentHelper.get_stored_files(nil)
|
||
directUrl = request.params[:directUrl]
|
||
userId = request.params[:userId]
|
||
%>
|
||
<div class="main-panel">
|
||
<div id="portal-info" style="display: <%= docs.length > 0 ? "none" : "table-cell" %>">
|
||
<span class="portal-name">ONLYOFFICE Document Editors – Welcome!</span>
|
||
<span class="portal-descr">
|
||
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
|
||
<br /> You may upload your own documents for testing using the "<b>Upload file</b>" button and <b>selecting</b> the necessary files on your PC.
|
||
</span>
|
||
<span class="portal-descr">Please do NOT use this integration example on your own server without proper code modifications, it is intended for testing purposes only. In case you enabled this test example, disable it before going for production.</span>
|
||
<span class="portal-descr">You can open the same document using different users in different Web browser sessions, so you can check out multi-user editing functions.</span>
|
||
<% for user in Users.all_users() do %>
|
||
<div class="user-descr">
|
||
<b><%= user.name ? user.name : "Anonymous" %></b>
|
||
<ul>
|
||
<% for description in user.descriptions do %>
|
||
<li><%= description %></li>
|
||
<% end %>
|
||
</ul>
|
||
</div>
|
||
<% end %>
|
||
</div>
|
||
<% if docs.length > 0 %>
|
||
<div class="stored-list">
|
||
<span class="header-list">Your documents</span>
|
||
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
|
||
<thead>
|
||
<tr>
|
||
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
|
||
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
|
||
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
|
||
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
|
||
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
|
||
</tr>
|
||
</thead>
|
||
</table>
|
||
<div class="scroll-table-body">
|
||
<table cellspacing="0" cellpadding="0" width="100%">
|
||
<tbody>
|
||
<%
|
||
docs.each { |d|
|
||
isFillFormDoc = DocumentHelper.fill_forms_exts.include?(File.extname(d).downcase)
|
||
userIdParam = userId == nil ? "" : "&userId=#{userId}";
|
||
directUrlParam = directUrl == nil ? "" : "&directUrl=#{directUrl}";
|
||
editUrl = "editor?fileName=#{ERB::Util.url_encode(d)}" + directUrlParam + userIdParam;
|
||
docType = FileUtility.get_file_type(d)
|
||
canEdit = DocumentHelper.edited_exts.include?(File.extname(d).downcase) %>
|
||
<tr class="tableRow" title="<%= d %> [<%= DocumentHelper.get_file_version(DocumentHelper.history_dir(DocumentHelper.storage_path(d, nil))) %>]">
|
||
<td class="contentCells">
|
||
<a class="stored-edit <%= docType %>" href="<%= editUrl %>" target="_blank">
|
||
<span><%= d %></span>
|
||
</a>
|
||
</td>
|
||
<% if canEdit %>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=edit" %>" target="_blank">
|
||
<img src="assets/desktop.svg" alt="Open in editor for full size screens" title="Open in editor for full size screens"/>
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=mobile&editorsMode=edit" %>" target="_blank">
|
||
<img src="assets/mobile.svg" alt="Open in editor for mobile devices" title="Open in editor for mobile devices"/>
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=comment" %>" target="_blank">
|
||
<img src="assets/comment.svg" alt="Open in editor for comment" title="Open in editor for comment"/>
|
||
</a>
|
||
</td>
|
||
<% if docType.eql?("word") %>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=review" %>" target="_blank">
|
||
<img src="assets/review.svg" alt="Open in editor for review" title="Open in editor for review"/>
|
||
</a>
|
||
</td>
|
||
<% elsif docType.eql?("cell") %>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=filter" %>" target="_blank">
|
||
<img src="assets/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" />
|
||
</a>
|
||
</td>
|
||
<% end %>
|
||
<% if docType.eql?("word") %>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=blockcontent" %>" target="_blank">
|
||
<img src="assets/block-content.svg" alt="Open in editor without content control modification" title="Open in editor without content control modification"/>
|
||
</a>
|
||
</td>
|
||
<% else %>
|
||
<td class="contentCells contentCells-icon"></td>
|
||
<% end %>
|
||
<% if !docType.eql?("word") && !docType.eql?("cell")%>
|
||
<td class="contentCells contentCells-icon "></td>
|
||
<% end %>
|
||
<% if isFillFormDoc%>
|
||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=fillForms" %>" target="_blank">
|
||
<img src="assets/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms"/>
|
||
</a>
|
||
</td>
|
||
<% else %>
|
||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift"></td>
|
||
<% end %>
|
||
<% elsif isFillFormDoc %>
|
||
<td class="contentCells contentCells-icon"></td>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=mobile&editorsMode=fillForms" %>" target="_blank">
|
||
<img src="assets/mobile-fill-forms.svg" alt="Open in editor for filling in forms for mobile devices" title="Open in editor for filling in forms for mobile devices" />
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-icon"></td>
|
||
<td class="contentCells contentCells-icon"></td>
|
||
<td class="contentCells contentCells-icon"></td>
|
||
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=fillForms" %>" target="_blank">
|
||
<img src="assets/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms"/>
|
||
</a>
|
||
</td>
|
||
<% else %>
|
||
<td class="contentCells contentCells-shift contentCells-icon contentCellsEmpty" colspan="6"></td>
|
||
<% end %>
|
||
<td class="contentCells contentCells-icon firstContentCellViewers">
|
||
<a href="<%= "#{editUrl}&editorsType=desktop&editorsMode=view" %>" target="_blank">
|
||
<img src="assets/desktop.svg" alt="Open in viewer for full size screens" title="Open in viewer for full size screens"/>
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=mobile&editorsMode=view" %>" target="_blank">
|
||
<img src="assets/mobile.svg" alt="Open in viewer for mobile devices" title="Open in viewer for mobile devices"/>
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-shift contentCells-icon">
|
||
<a href="<%= "#{editUrl}&editorsType=embedded&editorsMode=embedded" %>" target="_blank">
|
||
<img src="assets/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode"/>
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-shift contentCells-icon downloadContentCellShift">
|
||
<a href="<%= "download?fileName=#{ERB::Util.url_encode(d)}" %>">
|
||
<img class="icon-download" src="assets/download.svg" alt="Download" title="Download" />
|
||
</a>
|
||
</td>
|
||
<td class="contentCells contentCells-shift contentCells-icon">
|
||
<a class="delete-file" data-filename="<%= d %>">
|
||
<img class="icon-delete" src="assets/delete.svg" alt="Delete" title="Delete" />
|
||
</a>
|
||
</td>
|
||
</tr>
|
||
<%
|
||
} %>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</div>
|
||
<%
|
||
end %>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
<div id="mainProgress">
|
||
<div id="uploadSteps">
|
||
<span id="uploadFileName" class="uploadFileName"></span>
|
||
<div class="describeUpload">After these steps are completed, you can work with your document.</div>
|
||
<span id="step1" class="step">1. Loading the file.</span>
|
||
<span class="step-descr">The loading speed depends on file size and additional elements it contains.</span>
|
||
<br />
|
||
<span id="step2" class="step">2. Conversion.</span>
|
||
<span class="step-descr">The file is converted to OOXML so that you can edit it.</span>
|
||
<br />
|
||
<div id="blockPassword">
|
||
<span class="descrFilePass">The file is password protected.</span>
|
||
<br />
|
||
<div>
|
||
<input id="filePass" type="password"/>
|
||
<div id="enterPass" class="button orange">Enter</div>
|
||
<div id="skipPass" class="button gray">Skip</div>
|
||
</div>
|
||
<span class="errorPass"></span>
|
||
<br />
|
||
</div>
|
||
<span id="step3" class="step">3. Loading editor scripts.</span>
|
||
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
|
||
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
|
||
<br />
|
||
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
|
||
<br />
|
||
<div class="error-message">
|
||
<b>Upload error: </b><span></span>
|
||
<br />
|
||
Please select another file and try again.
|
||
</div>
|
||
</div>
|
||
<iframe id="embeddedView" src="" height="345px" width="432px" frameborder="0" scrolling="no" allowtransparency></iframe>
|
||
<br />
|
||
<div class="buttonsMobile">
|
||
<div id="beginEdit" class="button orange disable">Edit</div>
|
||
<div id="beginView" class="button gray disable">View</div>
|
||
<div id="beginEmbedded" class="button gray disable">Embedded view</div>
|
||
<div id="cancelEdit" class="button gray">Cancel</div>
|
||
</div>
|
||
</div>
|
||
|
||
<span id="loadScripts" data-docs="<%= ConfigurationManager.new.document_server_preloader_uri.to_s %>"></span>
|
||
|
||
<footer>
|
||
<div class="center">
|
||
<table>
|
||
<tbody>
|
||
<tr>
|
||
<td>
|
||
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
|
||
</td>
|
||
<td>
|
||
<a href="mailto:sales@onlyoffice.com">Submit your request</a>
|
||
</td>
|
||
<td class="copy">
|
||
© Ascensio System SIA <%= Time.now.year %>. All rights reserved.
|
||
</td>
|
||
</tr>
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
</footer>
|
||
|
||
<%= javascript_include_tag "application" %>
|
||
|
||
<script language="javascript" type="text/javascript">
|
||
var FillExtList = '<%= DocumentHelper.fill_forms_exts.join"," %>';
|
||
var ConvertExtList = '<%= DocumentHelper.convert_exts.join(",") %>';
|
||
var EditedExtList = '<%= DocumentHelper.edited_exts.join(",") %>';
|
||
var UrlConverter = '<%= convert_path %>';
|
||
var UrlEditor = '<%= editor_path %>';
|
||
</script>
|