mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Compare commits
57 Commits
v5.5.3.18
...
v5.5.99.20
| Author | SHA1 | Date | |
|---|---|---|---|
| 5cefe5c3b2 | |||
| 0cf0171721 | |||
| f8a1587109 | |||
| 44142da370 | |||
| ecbae22fcc | |||
| b3a79deef8 | |||
| c4f278d58a | |||
| b0ea8ed388 | |||
| 220516c930 | |||
| 3be28877ab | |||
| b3a96f15ab | |||
| 14a68befd2 | |||
| b1af12a78d | |||
| 75f137470b | |||
| 45ea1a8c1d | |||
| 1b90f16eb5 | |||
| 29072e3d5c | |||
| b82c2c68d5 | |||
| 67d6eaa18b | |||
| cb91ba1620 | |||
| 0e91256847 | |||
| ce16625091 | |||
| 4d538fc35d | |||
| 36c9583a2c | |||
| 1bde1f66d3 | |||
| fddc08c24b | |||
| 06305ee262 | |||
| e55e27cee8 | |||
| 8fa77cb9ba | |||
| f038327928 | |||
| 0adaf8a84b | |||
| 85cb88b0fc | |||
| 4c8ac0457f | |||
| 3ba6072b3e | |||
| ad966cfc28 | |||
| 1f9b2b8230 | |||
| 8b9f07e46e | |||
| af7101844a | |||
| b58bf412fa | |||
| a1c524df00 | |||
| be25001479 | |||
| 7466aba10f | |||
| c4fc8c85e2 | |||
| 007efef742 | |||
| a4bf9d76f6 | |||
| 7c5faa7c8a | |||
| 3497eeea9f | |||
| 7717cb35f8 | |||
| 1c59409ce2 | |||
| 5545568e04 | |||
| 6ba9b33606 | |||
| 8d657a0101 | |||
| c1454eff13 | |||
| f7867e4bc3 | |||
| f94e057492 | |||
| a5371faa27 | |||
| 34527f0b3e |
@ -28,3 +28,17 @@ Steve Matteson
|
||||
|
||||
License: Apache License, version 2.0
|
||||
|
||||
|
||||
6. requests - Requests is an elegant and simple HTTP library for Python
|
||||
|
||||
License: Apache License, version 2.0
|
||||
|
||||
|
||||
7. pyjwt - JSON Web Token implementation in Python
|
||||
|
||||
License: MIT
|
||||
|
||||
|
||||
8. django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design
|
||||
|
||||
License: BSD
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -16,6 +16,8 @@
|
||||
<DirPHP>$(RootDir)web\documentserver-example\php\</DirPHP>
|
||||
<NameRuby>$(To)Ruby Example</NameRuby>
|
||||
<DirRuby>$(RootDir)web\documentserver-example\ruby\</DirRuby>
|
||||
<NamePython>$(To)Python Example</NamePython>
|
||||
<DirPython>$(RootDir)web\documentserver-example\python\</DirPython>
|
||||
</PropertyGroup>
|
||||
|
||||
<Target Name="Build">
|
||||
@ -56,6 +58,12 @@
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(ZipFilesRuby)" DestinationFiles="@(ZipFilesRuby->'$(NameRuby)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Zip Files="$(NameRuby)" WorkingDirectory="$(To)" ZipFileName="$(NameRuby).zip" />
|
||||
|
||||
<ItemGroup>
|
||||
<ZipFilesPython Include="$(DirPython)**" />
|
||||
</ItemGroup>
|
||||
<Copy SourceFiles="@(ZipFilesPython)" DestinationFiles="@(ZipFilesPython->'$(NamePython)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
<Zip Files="$(NamePython)" WorkingDirectory="$(To)" ZipFileName="$(NamePython).zip" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
@ -25,3 +25,18 @@ License: MIT
|
||||
5. Prime JWT - Prime JWT is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson.
|
||||
|
||||
License: Apache-2.0
|
||||
|
||||
|
||||
6. requests - Requests is an elegant and simple HTTP library for Python
|
||||
|
||||
License: Apache License, version 2.0
|
||||
|
||||
|
||||
7. pyjwt - JSON Web Token implementation in Python
|
||||
|
||||
License: MIT
|
||||
|
||||
|
||||
8. django - Django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design
|
||||
|
||||
License: BSD
|
||||
27
licences/django.license
Normal file
27
licences/django.license
Normal file
@ -0,0 +1,27 @@
|
||||
Copyright (c) Django Software Foundation and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Django nor the names of its contributors may be used
|
||||
to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
21
licences/pyjwt.license
Normal file
21
licences/pyjwt.license
Normal file
@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 José Padilla
|
||||
|
||||
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.
|
||||
13
licences/requests.license
Normal file
13
licences/requests.license
Normal file
@ -0,0 +1,13 @@
|
||||
Copyright 2019 Kenneth Reitz
|
||||
|
||||
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
|
||||
|
||||
https://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.
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -52,7 +52,7 @@ namespace OnlineEditorsExampleMVC.Controllers
|
||||
public ActionResult Sample(string fileExt, bool? sample)
|
||||
{
|
||||
var fileName = DocManagerHelper.CreateDemo(fileExt, sample ?? false);
|
||||
DocManagerHelper.CreateMeta(fileName, Request.Cookies["uid"]?.Value, Request.Cookies["uname"]?.Value);
|
||||
DocManagerHelper.CreateMeta(fileName, Request.Cookies.GetOrDefault("uid", ""), Request.Cookies.GetOrDefault("uname", ""));
|
||||
Response.Redirect(Url.Action("Editor", "Home", new { fileName = fileName }));
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
21
web/documentserver-example/csharp-mvc/Helpers/Utils.cs
Normal file
21
web/documentserver-example/csharp-mvc/Helpers/Utils.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Web;
|
||||
|
||||
namespace OnlineEditorsExampleMVC.Helpers
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string GetOrDefault(this HttpRequest request, string header, string def)
|
||||
{
|
||||
var value = request[header];
|
||||
if (value != null) return value;
|
||||
return def;
|
||||
}
|
||||
|
||||
public static string GetOrDefault(this HttpCookieCollection cookies, string cookie, string def)
|
||||
{
|
||||
var cook = cookies[cookie];
|
||||
if (cook != null && !string.IsNullOrEmpty(cook.Value)) return cook.Value;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -64,12 +64,17 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
|
||||
public string GetDocConfig(HttpRequest request, UrlHelper url)
|
||||
{
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
var ext = Path.GetExtension(FileName);
|
||||
var editorsMode = Mode ?? "edit";
|
||||
|
||||
var canEdit = DocManagerHelper.EditedExts.Contains(ext);
|
||||
var mode = canEdit && editorsMode != "view" ? "edit" : "view";
|
||||
|
||||
var actionLink = request.GetOrDefault("actionLink", null);
|
||||
var actionData = string.IsNullOrEmpty(actionLink) ? null : jss.DeserializeObject(actionLink);
|
||||
|
||||
var config = new Dictionary<string, object>
|
||||
{
|
||||
{ "type", Type ?? "desktop" },
|
||||
@ -105,14 +110,15 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
{
|
||||
"editorConfig", new Dictionary<string, object>
|
||||
{
|
||||
{ "actionLink", actionData },
|
||||
{ "mode", mode },
|
||||
{ "lang", request.Cookies["ulang"]?.Value ?? "en" },
|
||||
{ "lang", request.Cookies.GetOrDefault("ulang", "en") },
|
||||
{ "callbackUrl", CallbackUrl },
|
||||
{
|
||||
"user", new Dictionary<string, object>
|
||||
{
|
||||
{ "id", request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -147,7 +153,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
config.Add("token", token);
|
||||
}
|
||||
|
||||
return new JavaScriptSerializer().Serialize(config);
|
||||
return jss.Serialize(config);
|
||||
}
|
||||
|
||||
public void GetHistory(out string history, out string historyData)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -137,6 +137,7 @@
|
||||
<Compile Include="Helpers\DocManagerHelper.cs" />
|
||||
<Compile Include="Helpers\DocumentConverter.cs" />
|
||||
<Compile Include="Helpers\JwtManager.cs" />
|
||||
<Compile Include="Helpers\Utils.cs" />
|
||||
<Compile Include="Models\FileModel.cs" />
|
||||
<Compile Include="Models\FileUtility.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("OnlineEditorsExampleMVC")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2019")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -83,6 +83,28 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var replaceActionLink = function(href, linkParam) {
|
||||
var link;
|
||||
var actionIndex = href.indexOf("&actionLink=");
|
||||
if (actionIndex != -1) {
|
||||
var endIndex = href.indexOf("&", actionIndex + "&actionLink=".length);
|
||||
if (endIndex != -1) {
|
||||
link = href.substring(0, actionIndex) + href.substring(endIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
} else {
|
||||
link = href.substring(0, actionIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
} else {
|
||||
link = href + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
|
||||
};
|
||||
|
||||
var config = <%= Model.GetDocConfig(Request, Url) %>;
|
||||
|
||||
config.width = "100%";
|
||||
@ -94,6 +116,7 @@
|
||||
'onRequestEditRights': onRequestEditRights,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
};
|
||||
|
||||
<% string hist, histData; %>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -59,7 +59,7 @@
|
||||
<td width="30%" valign="middle">
|
||||
<span class="select-user">Username:</span>
|
||||
<select class="select-user" id="user">
|
||||
<option value="uid-1">Jonn Smith</option>
|
||||
<option value="uid-1">John Smith</option>
|
||||
<option value="uid-2">Mark Pottato</option>
|
||||
<option value="uid-3">Hamish Mitchell</option>
|
||||
</select>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -95,7 +95,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
var savedFileName = DocManagerHelper.StoragePath(fileName);
|
||||
httpPostedFile.SaveAs(savedFileName);
|
||||
DocManagerHelper.CreateMeta(fileName, context.Request.Cookies["uid"]?.Value, context.Request.Cookies["uname"]?.Value);
|
||||
DocManagerHelper.CreateMeta(fileName, context.Request.Cookies.GetOrDefault("uid", ""), context.Request.Cookies.GetOrDefault("uname", ""));
|
||||
|
||||
context.Response.Write("{ \"filename\": \"" + fileName + "\"}");
|
||||
}
|
||||
@ -151,7 +151,7 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
Remove(fileName);
|
||||
fileName = correctName;
|
||||
DocManagerHelper.CreateMeta(fileName, context.Request.Cookies["uid"]?.Value, context.Request.Cookies["uname"]?.Value);
|
||||
DocManagerHelper.CreateMeta(fileName, context.Request.Cookies.GetOrDefault("uid", ""), context.Request.Cookies.GetOrDefault("uname", ""));
|
||||
}
|
||||
|
||||
context.Response.Write("{ \"filename\" : \"" + fileName + "\"}");
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -54,7 +54,7 @@
|
||||
<td width="30%" valign="middle">
|
||||
<span class="select-user">Username:</span>
|
||||
<select class="select-user" id="user">
|
||||
<option value="uid-1">Jonn Smith</option>
|
||||
<option value="uid-1">John Smith</option>
|
||||
<option value="uid-2">Mark Pottato</option>
|
||||
<option value="uid-3">Hamish Mitchell</option>
|
||||
</select>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -241,8 +241,8 @@ namespace OnlineEditorsExample
|
||||
Directory.CreateDirectory(histDir);
|
||||
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
|
||||
{ "created", DateTime.Now.ToString() },
|
||||
{ "id", context.Request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", context.Request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", context.Request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", context.Request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}));
|
||||
|
||||
return _fileName;
|
||||
@ -288,8 +288,8 @@ namespace OnlineEditorsExample
|
||||
Directory.CreateDirectory(histDir);
|
||||
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
|
||||
{ "created", DateTime.Now.ToString() },
|
||||
{ "id", request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}));
|
||||
}
|
||||
catch (Exception)
|
||||
@ -354,8 +354,8 @@ namespace OnlineEditorsExample
|
||||
Directory.CreateDirectory(histDir);
|
||||
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
|
||||
{ "created", DateTime.Now.ToString() },
|
||||
{ "id", context.Request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", context.Request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", context.Request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", context.Request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}));
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@
|
||||
};
|
||||
|
||||
var onRequestEditRights = function () {
|
||||
location.href = location.href.replace(RegExp("action=view\&?", "i"), "");
|
||||
location.href = location.href.replace(RegExp("editorsMode=view\&?", "i"), "");
|
||||
};
|
||||
|
||||
var onError = function (event) {
|
||||
@ -76,6 +76,28 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var replaceActionLink = function(href, linkParam) {
|
||||
var link;
|
||||
var actionIndex = href.indexOf("&actionLink=");
|
||||
if (actionIndex != -1) {
|
||||
var endIndex = href.indexOf("&", actionIndex + "&actionLink=".length);
|
||||
if (endIndex != -1) {
|
||||
link = href.substring(0, actionIndex) + href.substring(endIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
} else {
|
||||
link = href.substring(0, actionIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
} else {
|
||||
link = href + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
|
||||
};
|
||||
|
||||
var config = <%= DocConfig %>;
|
||||
|
||||
config.width = "100%";
|
||||
@ -87,6 +109,7 @@
|
||||
'onRequestEditRights': onRequestEditRights,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
'onMakeActionLink': onMakeActionLink,
|
||||
};
|
||||
|
||||
<% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData))
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -101,14 +101,19 @@ namespace OnlineEditorsExample
|
||||
|
||||
var ext = Path.GetExtension(FileName);
|
||||
|
||||
var editorsMode = Request["editorsMode"] ?? "edit";
|
||||
var editorsMode = Request.GetOrDefault("editorsMode", "edit");
|
||||
|
||||
var canEdit = _Default.EditedExts.Contains(ext);
|
||||
var mode = canEdit && editorsMode != "view" ? "edit" : "view";
|
||||
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
var actionLink = Request.GetOrDefault("actionLink", null);
|
||||
var actionData = string.IsNullOrEmpty(actionLink) ? null : jss.DeserializeObject(actionLink);
|
||||
|
||||
var config = new Dictionary<string, object>
|
||||
{
|
||||
{ "type", Request["editorsType"] ?? "desktop" },
|
||||
{ "type", Request.GetOrDefault("editorsType", "desktop") },
|
||||
{ "documentType", _Default.DocumentType(FileName) },
|
||||
{
|
||||
"document", new Dictionary<string, object>
|
||||
@ -141,14 +146,15 @@ namespace OnlineEditorsExample
|
||||
{
|
||||
"editorConfig", new Dictionary<string, object>
|
||||
{
|
||||
{ "actionLink", actionData },
|
||||
{ "mode", mode },
|
||||
{ "lang", Request.Cookies["ulang"]?.Value ?? "en" },
|
||||
{ "lang", Request.Cookies.GetOrDefault("ulang", "en") },
|
||||
{ "callbackUrl", CallbackUrl },
|
||||
{
|
||||
"user", new Dictionary<string, object>
|
||||
{
|
||||
{ "id", Request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", Request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", Request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", Request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -183,13 +189,13 @@ namespace OnlineEditorsExample
|
||||
config.Add("token", token);
|
||||
}
|
||||
|
||||
var jss = new JavaScriptSerializer();
|
||||
|
||||
DocConfig = jss.Serialize(config);
|
||||
|
||||
try
|
||||
{
|
||||
GetHistory(out var hist, out var histData);
|
||||
Dictionary<string, object> hist;
|
||||
Dictionary<string, object> histData;
|
||||
GetHistory(out hist, out histData);
|
||||
if (hist != null && histData != null)
|
||||
{
|
||||
History = jss.Serialize(hist);
|
||||
@ -305,8 +311,8 @@ namespace OnlineEditorsExample
|
||||
Directory.CreateDirectory(histDir);
|
||||
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
|
||||
{ "created", DateTime.Now.ToString() },
|
||||
{ "id", request.Cookies["uid"]?.Value ?? "uid-1" },
|
||||
{ "name", request.Cookies["uname"]?.Value ?? "John Smith" }
|
||||
{ "id", request.Cookies.GetOrDefault("uid", "uid-1") },
|
||||
{ "name", request.Cookies.GetOrDefault("uname", "John Smith") }
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -92,6 +92,7 @@
|
||||
<Compile Include="Default.aspx.designer.cs">
|
||||
<DependentUpon>Default.aspx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Utils.cs" />
|
||||
<Compile Include="WebEditor.ashx.cs">
|
||||
<DependentUpon>WebEditor.ashx</DependentUpon>
|
||||
</Compile>
|
||||
|
||||
@ -7,7 +7,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("Ascensio System SIA")]
|
||||
[assembly: AssemblyProduct("OnlineEditorsExample")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2019")]
|
||||
[assembly: AssemblyCopyright("Ascensio System SIA 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
|
||||
21
web/documentserver-example/csharp/Utils.cs
Normal file
21
web/documentserver-example/csharp/Utils.cs
Normal file
@ -0,0 +1,21 @@
|
||||
using System.Web;
|
||||
|
||||
namespace OnlineEditorsExample
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
public static string GetOrDefault(this HttpRequest request, string header, string def)
|
||||
{
|
||||
var value = request[header];
|
||||
if (value != null) return value;
|
||||
return def;
|
||||
}
|
||||
|
||||
public static string GetOrDefault(this HttpCookieCollection cookies, string cookie, string def)
|
||||
{
|
||||
var cook = cookies[cookie];
|
||||
if (cook != null && !string.IsNullOrEmpty(cook.Value)) return cook.Value;
|
||||
return def;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -69,7 +69,7 @@ public class EditorServlet extends HttpServlet
|
||||
}
|
||||
}
|
||||
|
||||
FileModel file = new FileModel(fileName, cm.getCookie("ulang"), cm.getCookie("uid"), cm.getCookie("uname"));
|
||||
FileModel file = new FileModel(fileName, cm.getCookie("ulang"), cm.getCookie("uid"), cm.getCookie("uname"), request.getParameter("actionLink"));
|
||||
file.changeType(request.getParameter("mode"), request.getParameter("type"));
|
||||
|
||||
if (DocumentManager.TokenEnabled())
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -38,6 +38,7 @@ import helpers.DocumentManager;
|
||||
import helpers.ServiceConverter;
|
||||
import helpers.FileUtility;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import org.json.simple.JSONArray;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -52,7 +53,7 @@ public class FileModel
|
||||
public EditorConfig editorConfig;
|
||||
public String token;
|
||||
|
||||
public FileModel(String fileName, String lang, String uid, String uname)
|
||||
public FileModel(String fileName, String lang, String uid, String uname, String actionData)
|
||||
{
|
||||
if (fileName == null) fileName = "";
|
||||
fileName = fileName.trim();
|
||||
@ -65,7 +66,7 @@ public class FileModel
|
||||
document.fileType = FileUtility.GetFileExtension(fileName).replace(".", "");
|
||||
document.key = ServiceConverter.GenerateRevisionId(DocumentManager.CurUserHostAddress(null) + "/" + fileName + "/" + Long.toString(new File(DocumentManager.StoragePath(fileName, null)).lastModified()));
|
||||
|
||||
editorConfig = new EditorConfig();
|
||||
editorConfig = new EditorConfig(actionData);
|
||||
editorConfig.callbackUrl = DocumentManager.GetCallback(fileName);
|
||||
if (lang != null) editorConfig.lang = lang;
|
||||
|
||||
@ -227,6 +228,7 @@ public class FileModel
|
||||
|
||||
public class EditorConfig
|
||||
{
|
||||
public HashMap<String, Object> actionLink = null;
|
||||
public String mode = "edit";
|
||||
public String callbackUrl;
|
||||
public String lang = "en";
|
||||
@ -234,8 +236,12 @@ public class FileModel
|
||||
public Customization customization;
|
||||
public Embedded embedded;
|
||||
|
||||
public EditorConfig()
|
||||
public EditorConfig(String actionData)
|
||||
{
|
||||
if (actionData != null) {
|
||||
Gson gson = new Gson();
|
||||
actionLink = gson.fromJson(actionData, new TypeToken<HashMap<String, Object>>() { }.getType());
|
||||
}
|
||||
user = new User();
|
||||
customization = new Customization();
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -73,6 +73,28 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var replaceActionLink = function(href, linkParam) {
|
||||
var link;
|
||||
var actionIndex = href.indexOf("&actionLink=");
|
||||
if (actionIndex != -1) {
|
||||
var endIndex = href.indexOf("&", actionIndex + "&actionLink=".length);
|
||||
if (endIndex != -1) {
|
||||
link = href.substring(0, actionIndex) + href.substring(endIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
} else {
|
||||
link = href.substring(0, actionIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
} else {
|
||||
link = href + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
|
||||
};
|
||||
|
||||
var config = JSON.parse('<%= FileModel.Serialize(Model) %>');
|
||||
config.width = "100%";
|
||||
config.height = "100%";
|
||||
@ -82,6 +104,7 @@
|
||||
'onRequestEditRights': onRequestEditRights,
|
||||
"onError": onError,
|
||||
"onOutdatedVersion": onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
};
|
||||
|
||||
<%
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -58,7 +58,7 @@
|
||||
<td width="30%" valign="middle">
|
||||
<span class="select-user">Username:</span>
|
||||
<select class="select-user" id="user">
|
||||
<option value="uid-1">Jonn Smith</option>
|
||||
<option value="uid-1">John Smith</option>
|
||||
<option value="uid-2">Mark Pottato</option>
|
||||
<option value="uid-3">Hamish Mitchell</option>
|
||||
</select>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!--*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -202,7 +202,7 @@ app.post("/upload", function (req, res) {
|
||||
res.write("{ \"filename\": \"" + file.name + "\"}");
|
||||
|
||||
const userid = req.query.userid ? req.query.userid : "uid-1";
|
||||
const name = req.query.name ? req.query.name : "Jonn Smith";
|
||||
const name = req.query.name ? req.query.name : "John Smith";
|
||||
|
||||
docManager.saveFileData(file.name, userid, name);
|
||||
}
|
||||
@ -521,7 +521,8 @@ app.get("/editor", function (req, res) {
|
||||
var historyData = [];
|
||||
var lang = docManager.getLang();
|
||||
var userid = req.query.userid ? req.query.userid : "uid-1";
|
||||
var name = req.query.name ? req.query.name : "Jonn Smith";
|
||||
var name = req.query.name ? req.query.name : "John Smith";
|
||||
var actionData = req.query.action ? req.query.action : "null";
|
||||
|
||||
if (fileExt != null) {
|
||||
var fileName = docManager.createDemo((req.query.sample ? "sample." : "new.") + fileExt, userid, name);
|
||||
@ -631,7 +632,8 @@ app.get("/editor", function (req, res) {
|
||||
userid: userid,
|
||||
name: name,
|
||||
fileChoiceUrl: fileChoiceUrl,
|
||||
plugins: JSON.stringify(plugins)
|
||||
plugins: JSON.stringify(plugins),
|
||||
actionData: actionData
|
||||
},
|
||||
history: history,
|
||||
historyData: historyData
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
}
|
||||
},
|
||||
"editorConfig": {
|
||||
"actionLink": <%- editor.actionData %>,
|
||||
"mode": "<%- editor.mode %>",
|
||||
"lang": "<%- editor.lang %>",
|
||||
"callbackUrl": "<%- editor.callbackUrl %>",
|
||||
|
||||
@ -96,6 +96,28 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var replaceActionLink = function(href, linkParam) {
|
||||
var link;
|
||||
var actionIndex = href.indexOf("&action=");
|
||||
if (actionIndex != -1) {
|
||||
var endIndex = href.indexOf("&", actionIndex + "&action=".length);
|
||||
if (endIndex != -1) {
|
||||
link = href.substring(0, actionIndex) + href.substring(endIndex) + "&action=" + encodeURIComponent(linkParam);
|
||||
} else {
|
||||
link = href.substring(0, actionIndex) + "&action=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
} else {
|
||||
link = href + "&action=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
|
||||
};
|
||||
|
||||
var connectEditor = function () {
|
||||
|
||||
docEditor = new DocsAPI.DocEditor("iframeEditor", {<% include config %>,
|
||||
@ -108,6 +130,7 @@
|
||||
"onRequestHistoryData": onRequestHistoryData,
|
||||
"onRequestHistoryClose": onRequestHistoryClose,
|
||||
"onOutdatedVersion": onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@
|
||||
<td valign="middle" width="30%">
|
||||
<span class="select-user">Username:</span>
|
||||
<select class="select-user" id="user">
|
||||
<option value="uid-1">Jonn Smith</option>
|
||||
<option value="uid-1">John Smith</option>
|
||||
<option value="uid-2">Mark Pottato</option>
|
||||
<option value="uid-3">Hamish Mitchell</option>
|
||||
</select>
|
||||
@ -86,7 +86,7 @@
|
||||
<option value="vi">Vietnamese</option>
|
||||
</select>
|
||||
</td>
|
||||
<td valign="middle" width="70%">Choose the language for ONLYOFFICE™ editors interface.</td>
|
||||
<td valign="middle" width="70%">Choose the language for ONLYOFFICE editors interface.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br />
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ONLYOFFICE
|
||||
Copyright (c) 2020 ONLYOFFICE
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -291,7 +291,7 @@ function createMeta($fileName, $uid = "0") {
|
||||
$name = "";
|
||||
switch ($uid) {
|
||||
case 0:
|
||||
$name = "Jonn Smith";
|
||||
$name = "John Smith";
|
||||
break;
|
||||
case 1:
|
||||
$name = "Mark Pottato";
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -63,7 +63,7 @@
|
||||
$uname = "";
|
||||
switch ($uid) {
|
||||
case 0:
|
||||
$uname = "Jonn Smith";
|
||||
$uname = "John Smith";
|
||||
break;
|
||||
case 1:
|
||||
$uname = "Mark Pottato";
|
||||
@ -100,6 +100,7 @@
|
||||
]
|
||||
],
|
||||
"editorConfig" => [
|
||||
"actionLink" => empty($_GET["actionLink"]) ? null : json_decode($_GET["actionLink"]),
|
||||
"mode" => $mode,
|
||||
"lang" => empty($_COOKIE["ulang"]) ? "en" : $_COOKIE["ulang"],
|
||||
"callbackUrl" => getCallbackUrl($filename),
|
||||
@ -295,6 +296,28 @@
|
||||
location.reload(true);
|
||||
};
|
||||
|
||||
var replaceActionLink = function(href, linkParam) {
|
||||
var link;
|
||||
var actionIndex = href.indexOf("&actionLink=");
|
||||
if (actionIndex != -1) {
|
||||
var endIndex = href.indexOf("&", actionIndex + "&actionLink=".length);
|
||||
if (endIndex != -1) {
|
||||
link = href.substring(0, actionIndex) + href.substring(endIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
} else {
|
||||
link = href.substring(0, actionIndex) + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
} else {
|
||||
link = href + "&actionLink=" + encodeURIComponent(linkParam);
|
||||
}
|
||||
return link;
|
||||
}
|
||||
|
||||
var onMakeActionLink = function (event) {
|
||||
var actionData = event.data;
|
||||
var linkParam = JSON.stringify(actionData);
|
||||
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
|
||||
};
|
||||
|
||||
var сonnectEditor = function () {
|
||||
|
||||
<?php
|
||||
@ -314,6 +337,7 @@
|
||||
'onRequestEditRights': onRequestEditRights,
|
||||
'onError': onError,
|
||||
'onOutdatedVersion': onOutdatedVersion,
|
||||
'onMakeActionLink': onMakeActionLink,
|
||||
};
|
||||
|
||||
<?php
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
@ -84,7 +84,7 @@
|
||||
<td valign="middle" width="30%">
|
||||
<span class="select-user">Username:</span>
|
||||
<select class="select-user" id="user">
|
||||
<option value="0">Jonn Smith</option>
|
||||
<option value="0">John Smith</option>
|
||||
<option value="1">Mark Pottato</option>
|
||||
<option value="2">Hamish Mitchell</option>
|
||||
</select>
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2019
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* The MIT License (MIT)
|
||||
*
|
||||
|
||||
55
web/documentserver-example/python/config.py
Normal file
55
web/documentserver-example/python/config.py
Normal file
@ -0,0 +1,55 @@
|
||||
import os
|
||||
|
||||
FILE_SIZE_MAX = 5242880
|
||||
STORAGE_PATH = 'app_data'
|
||||
|
||||
DOC_SERV_VIEWED = [".pdf", ".djvu", ".xps"]
|
||||
DOC_SERV_EDITED = [".docx", ".xlsx", ".csv", ".pptx", ".txt"]
|
||||
DOC_SERV_CONVERT = [
|
||||
".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt",
|
||||
".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm",
|
||||
".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt",
|
||||
".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot",
|
||||
".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub"
|
||||
]
|
||||
|
||||
DOC_SERV_TIMEOUT = 120000
|
||||
|
||||
DOC_SERV_CONVERTER_URL = 'https://documentserver/ConvertService.ashx'
|
||||
DOC_SERV_API_URL = 'https://documentserver/web-apps/apps/api/documents/api.js'
|
||||
DOC_SERV_PRELOADER_URL = 'https://documentserver/web-apps/apps/api/documents/cache-scripts.html'
|
||||
|
||||
EXAMPLE_DOMAIN = 'https://exampleserver/'
|
||||
|
||||
DOC_SERV_JWT_SECRET = ''
|
||||
|
||||
|
||||
EXT_SPREADSHEET = [
|
||||
".xls", ".xlsx", ".xlsm",
|
||||
".xlt", ".xltx", ".xltm",
|
||||
".ods", ".fods", ".ots", ".csv"
|
||||
]
|
||||
|
||||
EXT_PRESENTATION = [
|
||||
".pps", ".ppsx", ".ppsm",
|
||||
".ppt", ".pptx", ".pptm",
|
||||
".pot", ".potx", ".potm",
|
||||
".odp", ".fodp", ".otp"
|
||||
]
|
||||
|
||||
EXT_DOCUMENT = [
|
||||
".doc", ".docx", ".docm",
|
||||
".dot", ".dotx", ".dotm",
|
||||
".odt", ".fodt", ".ott", ".rtf", ".txt",
|
||||
".html", ".htm", ".mht",
|
||||
".pdf", ".djvu", ".fb2", ".epub", ".xps"
|
||||
]
|
||||
|
||||
|
||||
if os.environ.get("EXAMPLE_DOMAIN"):
|
||||
EXAMPLE_DOMAIN = os.environ.get("EXAMPLE_DOMAIN")
|
||||
if os.environ.get("DOC_SERV"):
|
||||
base = os.environ.get("DOC_SERV").rstrip('/')
|
||||
DOC_SERV_CONVERTER_URL = base + '/ConvertService.ashx'
|
||||
DOC_SERV_API_URL = base + '/web-apps/apps/api/documents/api.js'
|
||||
DOC_SERV_PRELOADER_URL = base + '/web-apps/apps/api/documents/cache-scripts.html'
|
||||
21
web/documentserver-example/python/manage.py
Normal file
21
web/documentserver-example/python/manage.py
Normal file
@ -0,0 +1,21 @@
|
||||
#!/usr/bin/env python
|
||||
"""Django's command-line utility for administrative tasks."""
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
def main():
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'src.settings')
|
||||
try:
|
||||
from django.core.management import execute_from_command_line
|
||||
except ImportError as exc:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
execute_from_command_line(sys.argv)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
18
web/documentserver-example/python/readme.md
Normal file
18
web/documentserver-example/python/readme.md
Normal file
@ -0,0 +1,18 @@
|
||||
## Requirements
|
||||
|
||||
Example is written for Python 3.6+
|
||||
|
||||
You should also install following dependencies:
|
||||
```
|
||||
pip install Django==2.2.6
|
||||
pip install requests==2.22.0
|
||||
pip install pyjwt==1.7.1
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
Configuration located inside `config.py`
|
||||
|
||||
## Launch
|
||||
|
||||
`python manage.py runserver 0.0.0.0:8000`
|
||||
BIN
web/documentserver-example/python/samples/new.docx
Normal file
BIN
web/documentserver-example/python/samples/new.docx
Normal file
Binary file not shown.
BIN
web/documentserver-example/python/samples/new.pptx
Normal file
BIN
web/documentserver-example/python/samples/new.pptx
Normal file
Binary file not shown.
BIN
web/documentserver-example/python/samples/new.xlsx
Normal file
BIN
web/documentserver-example/python/samples/new.xlsx
Normal file
Binary file not shown.
BIN
web/documentserver-example/python/samples/sample.docx
Normal file
BIN
web/documentserver-example/python/samples/sample.docx
Normal file
Binary file not shown.
BIN
web/documentserver-example/python/samples/sample.pptx
Normal file
BIN
web/documentserver-example/python/samples/sample.pptx
Normal file
Binary file not shown.
BIN
web/documentserver-example/python/samples/sample.xlsx
Normal file
BIN
web/documentserver-example/python/samples/sample.xlsx
Normal file
Binary file not shown.
99
web/documentserver-example/python/src/settings.py
Normal file
99
web/documentserver-example/python/src/settings.py
Normal file
@ -0,0 +1,99 @@
|
||||
"""
|
||||
Django settings for example project.
|
||||
|
||||
Generated by 'django-admin startproject' using Django 2.2.6.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/topics/settings/
|
||||
|
||||
For the full list of settings and their values, see
|
||||
https://docs.djangoproject.com/en/2.2/ref/settings/
|
||||
"""
|
||||
|
||||
import os
|
||||
import config
|
||||
|
||||
# Build paths inside the project like this: os.path.join(BASE_DIR, ...)
|
||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
|
||||
|
||||
# Quick-start development settings - unsuitable for production
|
||||
# See https://docs.djangoproject.com/en/2.2/howto/deployment/checklist/
|
||||
|
||||
# SECURITY WARNING: keep the secret key used in production secret!
|
||||
SECRET_KEY = '7a5qnm_bv)iskjhx%4cbwwdmjev03%zewm=3@4s*uz)el#ds5o'
|
||||
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = True
|
||||
|
||||
ALLOWED_HOSTS = [
|
||||
'*'
|
||||
]
|
||||
|
||||
|
||||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
'django.contrib.contenttypes',
|
||||
'django.contrib.sessions',
|
||||
]
|
||||
|
||||
MIDDLEWARE = [
|
||||
'src.utils.historyManager.CorsHeaderMiddleware',
|
||||
'django.middleware.security.SecurityMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.middleware.clickjacking.XFrameOptionsMiddleware',
|
||||
]
|
||||
|
||||
ROOT_URLCONF = 'src.urls'
|
||||
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [ 'templates' ],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
'django.template.context_processors.debug',
|
||||
'django.template.context_processors.request',
|
||||
],
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
WSGI_APPLICATION = 'src.wsgi.application'
|
||||
|
||||
|
||||
# Database
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#databases
|
||||
|
||||
DATABASES = {}
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/2.2/ref/settings/#auth-password-validators
|
||||
|
||||
AUTH_PASSWORD_VALIDATORS = []
|
||||
|
||||
|
||||
# Internationalization
|
||||
# https://docs.djangoproject.com/en/2.2/topics/i18n/
|
||||
|
||||
LANGUAGE_CODE = 'en-us'
|
||||
|
||||
TIME_ZONE = 'UTC'
|
||||
|
||||
USE_I18N = True
|
||||
|
||||
USE_L10N = True
|
||||
|
||||
USE_TZ = True
|
||||
|
||||
|
||||
# Static files (CSS, JavaScript, Images)
|
||||
# https://docs.djangoproject.com/en/2.2/howto/static-files/
|
||||
|
||||
STATIC_ROOT = ''
|
||||
STATIC_URL = '/static/'
|
||||
STATICFILES_DIRS = ( os.path.join('static'), os.path.join(config.STORAGE_PATH) )
|
||||
42
web/documentserver-example/python/src/urls.py
Normal file
42
web/documentserver-example/python/src/urls.py
Normal file
@ -0,0 +1,42 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
from django.urls import path
|
||||
|
||||
from src.views import index, actions
|
||||
from django.contrib.staticfiles.urls import staticfiles_urlpatterns
|
||||
|
||||
urlpatterns = [
|
||||
path('', index.default),
|
||||
path('upload', actions.upload),
|
||||
path('convert', actions.convert),
|
||||
path('create', actions.createNew),
|
||||
path('edit', actions.edit),
|
||||
path('track', actions.track),
|
||||
path('remove', actions.remove)
|
||||
]
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
185
web/documentserver-example/python/src/utils/docManager.py
Normal file
185
web/documentserver-example/python/src/utils/docManager.py
Normal file
@ -0,0 +1,185 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
|
||||
import config
|
||||
import os
|
||||
import shutil
|
||||
import io
|
||||
import re
|
||||
import requests
|
||||
|
||||
from src import settings
|
||||
from . import fileUtils, historyManager
|
||||
|
||||
LANGUAGES = {
|
||||
'en': 'English',
|
||||
'bg': 'Bulgarian',
|
||||
'zh': 'Chinese',
|
||||
'cs': 'Czech',
|
||||
'nl': 'Dutch',
|
||||
'fr': 'French',
|
||||
'de': 'German',
|
||||
'hu': 'Hungarian',
|
||||
'it': 'Italian',
|
||||
'ja': 'Japanese',
|
||||
'ko': 'Korean',
|
||||
'lv': 'Latvian',
|
||||
'pl': 'Polish',
|
||||
'pt': 'Portuguese',
|
||||
'ru': 'Russian',
|
||||
'sk': 'Slovak',
|
||||
'sl': 'Slovenian',
|
||||
'es': 'Spanish',
|
||||
'tr': 'Turkish',
|
||||
'uk': 'Ukrainian',
|
||||
'vi': 'Vietnamese'
|
||||
}
|
||||
|
||||
def isCanView(ext):
|
||||
return ext in config.DOC_SERV_VIEWED
|
||||
|
||||
def isCanEdit(ext):
|
||||
return ext in config.DOC_SERV_EDITED
|
||||
|
||||
def isCanConvert(ext):
|
||||
return ext in config.DOC_SERV_CONVERT
|
||||
|
||||
def isSupportedExt(ext):
|
||||
return isCanView(ext) | isCanEdit(ext) | isCanConvert(ext)
|
||||
|
||||
def getInternalExtension(fileType):
|
||||
mapping = {
|
||||
'text': '.docx',
|
||||
'spreadsheet': '.xlsx',
|
||||
'presentation': '.pptx'
|
||||
}
|
||||
|
||||
return mapping.get(fileType, '.docx')
|
||||
|
||||
def getCorrectName(filename, req):
|
||||
basename = fileUtils.getFileNameWithoutExt(filename)
|
||||
ext = fileUtils.getFileExt(filename)
|
||||
name = f'{basename}{ext}'
|
||||
|
||||
i = 1
|
||||
while os.path.exists(getStoragePath(name, req)):
|
||||
name = f'{basename} ({i}){ext}'
|
||||
i += 1
|
||||
|
||||
return name
|
||||
|
||||
def getFileUri(filename, req):
|
||||
host = config.EXAMPLE_DOMAIN.rstrip('/')
|
||||
curAdr = req.META['REMOTE_ADDR']
|
||||
return f'{host}{settings.STATIC_URL}{curAdr}/{filename}'
|
||||
|
||||
def getCallbackUrl(filename, req):
|
||||
host = config.EXAMPLE_DOMAIN
|
||||
curAdr = req.META['REMOTE_ADDR']
|
||||
return f'{host}track?filename={filename}&userAddress={curAdr}'
|
||||
|
||||
def getRootFolder(req):
|
||||
if isinstance(req, str):
|
||||
curAdr = req
|
||||
else:
|
||||
curAdr = req.META['REMOTE_ADDR']
|
||||
|
||||
directory = os.path.join(config.STORAGE_PATH, curAdr)
|
||||
|
||||
if not os.path.exists(directory):
|
||||
os.makedirs(directory)
|
||||
|
||||
return directory
|
||||
|
||||
def getStoragePath(filename, req):
|
||||
directory = getRootFolder(req)
|
||||
|
||||
return os.path.join(directory, filename)
|
||||
|
||||
def getStoredFiles(req):
|
||||
directory = getRootFolder(req)
|
||||
|
||||
files = os.listdir(directory)
|
||||
files.sort(key=lambda x: os.path.getmtime(os.path.join(directory, x)), reverse=True)
|
||||
|
||||
fileInfos = []
|
||||
|
||||
for f in files:
|
||||
if os.path.isfile(os.path.join(directory, f)):
|
||||
fileInfos.append({ 'type': fileUtils.getFileType(f), 'title': f, 'url': getFileUri(f, req) })
|
||||
|
||||
return fileInfos
|
||||
|
||||
def createFile(stream, path, req = None, meta = False):
|
||||
bufSize = 8196
|
||||
with io.open(path, 'wb') as out:
|
||||
read = stream.read(bufSize)
|
||||
|
||||
while len(read) > 0:
|
||||
out.write(read)
|
||||
read = stream.read(bufSize)
|
||||
|
||||
if meta:
|
||||
historyManager.createMeta(path, req)
|
||||
return
|
||||
|
||||
def saveFileFromUri(uri, path, req = None, meta = False):
|
||||
resp = requests.get(uri, stream=True)
|
||||
createFile(resp.raw, path, req, meta)
|
||||
return
|
||||
|
||||
def createSample(fileType, sample, req):
|
||||
ext = getInternalExtension(fileType)
|
||||
|
||||
if not sample:
|
||||
sample = 'false'
|
||||
|
||||
sampleName = 'sample' if sample == 'true' else 'new'
|
||||
|
||||
filename = getCorrectName(f'{sampleName}{ext}', req)
|
||||
path = getStoragePath(filename, req)
|
||||
|
||||
with io.open(os.path.join('samples', f'{sampleName}{ext}'), 'rb') as stream:
|
||||
createFile(stream, path, req, True)
|
||||
return filename
|
||||
|
||||
def removeFile(filename, req):
|
||||
path = getStoragePath(filename, req)
|
||||
if os.path.exists(path):
|
||||
os.remove(path)
|
||||
histDir = historyManager.getHistoryDir(path)
|
||||
if os.path.exists(histDir):
|
||||
shutil.rmtree(histDir)
|
||||
|
||||
def generateFileKey(filename, req):
|
||||
path = getStoragePath(filename, req)
|
||||
uri = getFileUri(filename, req)
|
||||
stat = os.stat(path)
|
||||
|
||||
h = str(hash(f'{uri}_{stat.st_mtime_ns}'))
|
||||
replaced = re.sub(r'[^0-9-.a-zA-Z_=]', '_', h)
|
||||
return replaced[:20]
|
||||
52
web/documentserver-example/python/src/utils/fileUtils.py
Normal file
52
web/documentserver-example/python/src/utils/fileUtils.py
Normal file
@ -0,0 +1,52 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import config
|
||||
|
||||
def getFileName(str):
|
||||
ind = str.rfind('/')
|
||||
return str[ind+1:]
|
||||
|
||||
def getFileNameWithoutExt(str):
|
||||
fn = getFileName(str)
|
||||
ind = fn.rfind('.')
|
||||
return fn[:ind]
|
||||
|
||||
def getFileExt(str):
|
||||
fn = getFileName(str)
|
||||
ind = fn.rfind('.')
|
||||
return fn[ind:].lower()
|
||||
|
||||
def getFileType(str):
|
||||
ext = getFileExt(str)
|
||||
if ext in config.EXT_DOCUMENT:
|
||||
return 'text'
|
||||
if ext in config.EXT_SPREADSHEET:
|
||||
return 'spreadsheet'
|
||||
if ext in config.EXT_PRESENTATION:
|
||||
return 'presentation'
|
||||
|
||||
return 'text'
|
||||
196
web/documentserver-example/python/src/utils/historyManager.py
Normal file
196
web/documentserver-example/python/src/utils/historyManager.py
Normal file
@ -0,0 +1,196 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import os
|
||||
import io
|
||||
import json
|
||||
import config
|
||||
|
||||
from . import users, fileUtils
|
||||
from datetime import datetime
|
||||
from src import settings
|
||||
|
||||
def getHistoryDir(storagePath):
|
||||
return f'{storagePath}-hist'
|
||||
|
||||
def getVersionDir(histDir, version):
|
||||
return os.path.join(histDir, str(version))
|
||||
|
||||
def getFileVersion(histDir):
|
||||
if not os.path.exists(histDir):
|
||||
return 0
|
||||
|
||||
cnt = 0
|
||||
|
||||
for f in os.listdir(histDir):
|
||||
if not os.path.isfile(os.path.join(histDir, f)):
|
||||
cnt += 1
|
||||
|
||||
return cnt
|
||||
|
||||
def getNextVersionDir(histDir):
|
||||
v = getFileVersion(histDir)
|
||||
path = getVersionDir(histDir, v + 1)
|
||||
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
def getChangesZipPath(verDir):
|
||||
return os.path.join(verDir, 'diff.zip')
|
||||
|
||||
def getChangesHistoryPath(verDir):
|
||||
return os.path.join(verDir, 'changes.json')
|
||||
|
||||
def getPrevFilePath(verDir, ext):
|
||||
return os.path.join(verDir, f'prev{ext}')
|
||||
|
||||
def getKeyPath(verDir):
|
||||
return os.path.join(verDir, 'key.txt')
|
||||
|
||||
def getMetaPath(histDir):
|
||||
return os.path.join(histDir, 'createdInfo.json')
|
||||
|
||||
def createMeta(storagePath, req):
|
||||
histDir = getHistoryDir(storagePath)
|
||||
path = getMetaPath(histDir)
|
||||
|
||||
if not os.path.exists(histDir):
|
||||
os.makedirs(histDir)
|
||||
|
||||
user = users.getUserFromReq(req)
|
||||
|
||||
obj = {
|
||||
'created': datetime.today().strftime('%d.%m.%Y %H:%M:%S'),
|
||||
'uid': user['uid'],
|
||||
'uname': user['uname']
|
||||
}
|
||||
|
||||
writeFile(path, json.dumps(obj))
|
||||
|
||||
return
|
||||
|
||||
def writeFile(path, content):
|
||||
with io.open(path, 'w') as out:
|
||||
out.write(content)
|
||||
return
|
||||
|
||||
def readFile(path):
|
||||
with io.open(path, 'r') as stream:
|
||||
return stream.read()
|
||||
|
||||
def getPrevUri(filename, ver, ext, req):
|
||||
host = config.EXAMPLE_DOMAIN.rstrip('/')
|
||||
curAdr = req.META['REMOTE_ADDR']
|
||||
return f'{host}{settings.STATIC_URL}{curAdr}/{filename}-hist/{ver}/prev{ext}'
|
||||
|
||||
def getZipUri(filename, ver, req):
|
||||
host = config.EXAMPLE_DOMAIN.rstrip('/')
|
||||
curAdr = req.META['REMOTE_ADDR']
|
||||
return f'{host}{settings.STATIC_URL}{curAdr}/{filename}-hist/{ver}/diff.zip'
|
||||
|
||||
def getMeta(storagePath):
|
||||
histDir = getHistoryDir(storagePath)
|
||||
path = getMetaPath(histDir)
|
||||
|
||||
if os.path.exists(path):
|
||||
with io.open(path, 'r') as stream:
|
||||
return json.loads(stream.read())
|
||||
|
||||
return None
|
||||
|
||||
def getHistoryObject(storagePath, filename, docKey, docUrl, req):
|
||||
histDir = getHistoryDir(storagePath)
|
||||
version = getFileVersion(histDir)
|
||||
if version > 0:
|
||||
hist = []
|
||||
histData = {}
|
||||
|
||||
for i in range(version + 1):
|
||||
obj = {}
|
||||
dataObj = {}
|
||||
prevVerDir = getVersionDir(histDir, i)
|
||||
verDir = getVersionDir(histDir, i + 1)
|
||||
|
||||
try:
|
||||
key = docKey if i == version else readFile(getKeyPath(verDir))
|
||||
|
||||
obj['key'] = key
|
||||
obj['version'] = i
|
||||
dataObj['key'] = key
|
||||
dataObj['version'] = i
|
||||
|
||||
if i == 0:
|
||||
meta = getMeta(storagePath)
|
||||
if meta:
|
||||
obj['created'] = meta['created']
|
||||
obj['user'] = {
|
||||
'id': meta['uid'],
|
||||
'name': meta['uname']
|
||||
}
|
||||
|
||||
dataObj['url'] = docUrl if i == version else getPrevUri(filename, i + 1, fileUtils.getFileExt(filename), req)
|
||||
|
||||
if i > 0:
|
||||
changes = json.loads(readFile(getChangesHistoryPath(prevVerDir)))
|
||||
change = changes['changes'][0]
|
||||
|
||||
obj['changes'] = changes['changes']
|
||||
obj['serverVersion'] = changes['serverVersion']
|
||||
obj['created'] = change['created']
|
||||
obj['user'] = change['user']
|
||||
|
||||
prev = histData[str(i - 1)]
|
||||
prevInfo = {
|
||||
'key': prev['key'],
|
||||
'url': prev['url']
|
||||
}
|
||||
dataObj['previous'] = prevInfo
|
||||
dataObj['changesUrl'] = getZipUri(filename, i, req)
|
||||
|
||||
hist.append(obj)
|
||||
histData[str(i)] = dataObj
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
histObj = {
|
||||
'currentVersion': version,
|
||||
'history': hist
|
||||
}
|
||||
|
||||
return { 'history': histObj, 'historyData': histData }
|
||||
return {}
|
||||
|
||||
|
||||
class CorsHeaderMiddleware:
|
||||
def __init__(self, get_response):
|
||||
self.get_response = get_response
|
||||
|
||||
def __call__(self, request):
|
||||
resp = self.get_response(request)
|
||||
if request.path.endswith('.zip'):
|
||||
resp['Access-Control-Allow-Origin'] = '*'
|
||||
return resp
|
||||
37
web/documentserver-example/python/src/utils/jwtManager.py
Normal file
37
web/documentserver-example/python/src/utils/jwtManager.py
Normal file
@ -0,0 +1,37 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import config
|
||||
import jwt
|
||||
|
||||
def isEnabled():
|
||||
return bool(config.DOC_SERV_JWT_SECRET)
|
||||
|
||||
def encode(payload):
|
||||
return jwt.encode(payload, config.DOC_SERV_JWT_SECRET, algorithm='HS256').decode('utf-8')
|
||||
|
||||
def decode(string):
|
||||
return jwt.decode(string, config.DOC_SERV_JWT_SECRET, algorithms=['HS256'])
|
||||
@ -0,0 +1,85 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import json
|
||||
import requests
|
||||
import config
|
||||
|
||||
from . import fileUtils, jwtManager
|
||||
|
||||
def getConverterUri(docUri, fromExt, toExt, docKey, isAsync):
|
||||
if not fromExt:
|
||||
fromExt = fileUtils.getFileExt(docUri)
|
||||
|
||||
title = fileUtils.getFileName(docUri)
|
||||
|
||||
payload = {
|
||||
'url': docUri,
|
||||
'outputtype': toExt.replace('.', ''),
|
||||
'filetype': fromExt.replace('.', ''),
|
||||
'title': title,
|
||||
'key': docKey
|
||||
}
|
||||
|
||||
headers={'accept': 'application/json'}
|
||||
|
||||
if (isAsync):
|
||||
payload.setdefault('async', True)
|
||||
|
||||
if jwtManager.isEnabled():
|
||||
headerToken = jwtManager.encode({'payload': payload})
|
||||
payload['token'] = jwtManager.encode(payload)
|
||||
headers['Authorization'] = f'Bearer {headerToken}'
|
||||
|
||||
response = requests.post(config.DOC_SERV_CONVERTER_URL, json=payload, headers=headers )
|
||||
json = response.json()
|
||||
|
||||
return getResponseUri(json)
|
||||
|
||||
def getResponseUri(json):
|
||||
isEnd = json.get('endConvert')
|
||||
error = json.get('error')
|
||||
if error:
|
||||
processError(error)
|
||||
|
||||
if isEnd:
|
||||
return json.get('fileUrl')
|
||||
|
||||
def processError(error):
|
||||
prefix = 'Error occurred in the ConvertService: '
|
||||
|
||||
mapping = {
|
||||
'-8': f'{prefix}Error document VKey',
|
||||
'-7': f'{prefix}Error document request',
|
||||
'-6': f'{prefix}Error database',
|
||||
'-5': f'{prefix}Error unexpected guid',
|
||||
'-4': f'{prefix}Error download error',
|
||||
'-3': f'{prefix}Error convertation error',
|
||||
'-2': f'{prefix}Error convertation timeout',
|
||||
'-1': f'{prefix}Error convertation unknown'
|
||||
}
|
||||
|
||||
raise Exception(mapping.get(str(error), f'Error Code: {error}'))
|
||||
53
web/documentserver-example/python/src/utils/users.py
Normal file
53
web/documentserver-example/python/src/utils/users.py
Normal file
@ -0,0 +1,53 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
from urllib.parse import unquote
|
||||
|
||||
USERS = [
|
||||
{
|
||||
'uid': 'uid-1',
|
||||
'uname': 'John Smith'
|
||||
},
|
||||
{
|
||||
'uid': 'uid-2',
|
||||
'uname': 'Mark Pottato'
|
||||
},
|
||||
{
|
||||
'uid': 'uid-3',
|
||||
'uname': 'Hamish Mitchell'
|
||||
}
|
||||
]
|
||||
|
||||
DEFAULT_USER = USERS[0]
|
||||
|
||||
def getUserFromReq(req):
|
||||
uid = req.COOKIES.get('uid')
|
||||
uname = req.COOKIES.get('uname')
|
||||
|
||||
if (not uid) | (not uname):
|
||||
return DEFAULT_USER
|
||||
else:
|
||||
return { 'uid': unquote(uid), 'uname': unquote(uname) }
|
||||
264
web/documentserver-example/python/src/views/actions.py
Normal file
264
web/documentserver-example/python/src/views/actions.py
Normal file
@ -0,0 +1,264 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import config
|
||||
import json
|
||||
import os
|
||||
|
||||
from datetime import datetime
|
||||
from django.http import HttpResponse, HttpResponseRedirect
|
||||
from django.shortcuts import render
|
||||
from src.utils import docManager, fileUtils, serviceConverter, users, jwtManager, historyManager
|
||||
|
||||
|
||||
def upload(request):
|
||||
response = {}
|
||||
|
||||
try:
|
||||
fileInfo = request.FILES['uploadedFile']
|
||||
|
||||
if fileInfo.size > config.FILE_SIZE_MAX:
|
||||
raise Exception('File size is too big')
|
||||
|
||||
curExt = fileUtils.getFileExt(fileInfo.name)
|
||||
if not docManager.isSupportedExt(curExt):
|
||||
raise Exception('File type is not supported')
|
||||
|
||||
name = docManager.getCorrectName(fileInfo.name, request)
|
||||
path = docManager.getStoragePath(name, request)
|
||||
|
||||
docManager.createFile(fileInfo.file, path, request, True)
|
||||
|
||||
response.setdefault('filename', name)
|
||||
|
||||
except Exception as e:
|
||||
response.setdefault('error', e.args[0])
|
||||
|
||||
return HttpResponse(json.dumps(response), content_type='application/json')
|
||||
|
||||
def convert(request):
|
||||
response = {}
|
||||
|
||||
try:
|
||||
filename = request.GET['filename']
|
||||
fileUri = docManager.getFileUri(filename, request)
|
||||
fileExt = fileUtils.getFileExt(filename)
|
||||
fileType = fileUtils.getFileType(filename)
|
||||
newExt = docManager.getInternalExtension(fileType)
|
||||
|
||||
if docManager.isCanConvert(fileExt):
|
||||
key = docManager.generateFileKey(filename, request)
|
||||
|
||||
newUri = serviceConverter.getConverterUri(fileUri, fileExt, newExt, key, True)
|
||||
|
||||
if not newUri:
|
||||
response.setdefault('step', '0')
|
||||
response.setdefault('filename', filename)
|
||||
else:
|
||||
correctName = docManager.getCorrectName(fileUtils.getFileNameWithoutExt(filename) + newExt, request)
|
||||
path = docManager.getStoragePath(correctName, request)
|
||||
docManager.saveFileFromUri(newUri, path, request, True)
|
||||
docManager.removeFile(filename, request)
|
||||
response.setdefault('filename', correctName)
|
||||
else:
|
||||
response.setdefault('filename', filename)
|
||||
|
||||
except Exception as e:
|
||||
response.setdefault('error', e.args[0])
|
||||
|
||||
return HttpResponse(json.dumps(response), content_type='application/json')
|
||||
|
||||
def createNew(request):
|
||||
response = {}
|
||||
|
||||
try:
|
||||
fileType = request.GET['fileType']
|
||||
sample = request.GET.get('sample', False)
|
||||
|
||||
filename = docManager.createSample(fileType, sample, request)
|
||||
|
||||
return HttpResponseRedirect(f'edit?filename={filename}')
|
||||
|
||||
except Exception as e:
|
||||
response.setdefault('error', e.args[0])
|
||||
|
||||
return HttpResponse(json.dumps(response), content_type='application/json')
|
||||
|
||||
def edit(request):
|
||||
filename = request.GET['filename']
|
||||
|
||||
ext = fileUtils.getFileExt(filename)
|
||||
|
||||
fileUri = docManager.getFileUri(filename, request)
|
||||
docKey = docManager.generateFileKey(filename, request)
|
||||
fileType = fileUtils.getFileType(filename)
|
||||
user = users.getUserFromReq(request)
|
||||
|
||||
edMode = request.GET.get('mode') if request.GET.get('mode') else 'edit'
|
||||
canEdit = docManager.isCanEdit(ext)
|
||||
mode = 'edit' if canEdit & (edMode != 'view') else 'view'
|
||||
|
||||
edType = request.GET.get('type') if request.GET.get('type') else 'desktop'
|
||||
lang = request.COOKIES.get('ulang') if request.COOKIES.get('ulang') else 'en'
|
||||
|
||||
storagePath = docManager.getStoragePath(filename, request)
|
||||
meta = historyManager.getMeta(storagePath)
|
||||
infObj = None
|
||||
|
||||
actionData = request.GET.get('actionLink')
|
||||
actionLink = json.loads(actionData) if actionData else None
|
||||
|
||||
if (meta):
|
||||
infObj = {
|
||||
'author': meta['uname'],
|
||||
'created': meta['created']
|
||||
}
|
||||
else:
|
||||
infObj = {
|
||||
'author': 'Me',
|
||||
'created': datetime.today().strftime('%d.%m.%Y %H:%M:%S')
|
||||
}
|
||||
|
||||
edConfig = {
|
||||
'type': edType,
|
||||
'documentType': fileType,
|
||||
'document': {
|
||||
'title': filename,
|
||||
'url': fileUri,
|
||||
'fileType': ext[1:],
|
||||
'key': docKey,
|
||||
'info': infObj,
|
||||
'permissions': {
|
||||
'comment': (edMode != 'view') & (edMode != 'fillForms') & (edMode != 'embedded') & (edMode != "blockcontent"),
|
||||
'download': True,
|
||||
'edit': canEdit & ((edMode == 'edit') | (edMode == 'filter') | (edMode == "blockcontent")),
|
||||
'fillForms': (edMode != 'view') & (edMode != 'comment') & (edMode != 'embedded') & (edMode != "blockcontent"),
|
||||
'modifyFilter': edMode != 'filter',
|
||||
'modifyContentControl': edMode != "blockcontent",
|
||||
'review': (edMode == 'edit') | (edMode == 'review')
|
||||
}
|
||||
},
|
||||
'editorConfig': {
|
||||
'actionLink': actionLink,
|
||||
'mode': mode,
|
||||
'lang': lang,
|
||||
'callbackUrl': docManager.getCallbackUrl(filename, request),
|
||||
'user': {
|
||||
'id': user['uid'],
|
||||
'name': user['uname']
|
||||
},
|
||||
'embedded': {
|
||||
'saveUrl': fileUri,
|
||||
'embedUrl': fileUri,
|
||||
'shareUrl': fileUri,
|
||||
'toolbarDocked': 'top'
|
||||
},
|
||||
'customization': {
|
||||
'about': True,
|
||||
'feedback': True,
|
||||
'goback': {
|
||||
'url': config.EXAMPLE_DOMAIN
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if jwtManager.isEnabled():
|
||||
edConfig['token'] = jwtManager.encode(edConfig)
|
||||
|
||||
hist = historyManager.getHistoryObject(storagePath, filename, docKey, fileUri, request)
|
||||
|
||||
context = {
|
||||
'cfg': json.dumps(edConfig),
|
||||
'history': json.dumps(hist['history']) if 'history' in hist else None,
|
||||
'historyData': json.dumps(hist['historyData']) if 'historyData' in hist else None,
|
||||
'fileType': fileType,
|
||||
'apiUrl': config.DOC_SERV_API_URL
|
||||
}
|
||||
return render(request, 'editor.html', context)
|
||||
|
||||
def track(request):
|
||||
filename = request.GET['filename']
|
||||
usAddr = request.GET['userAddress']
|
||||
|
||||
response = {}
|
||||
|
||||
try:
|
||||
body = json.loads(request.body)
|
||||
|
||||
if jwtManager.isEnabled():
|
||||
token = body.get('token')
|
||||
|
||||
if (not token):
|
||||
token = request.headers.get('Authorization')
|
||||
if token:
|
||||
token = token[len('Bearer '):]
|
||||
|
||||
if (not token):
|
||||
raise Exception('Expected JWT')
|
||||
|
||||
body = jwtManager.decode(token)
|
||||
if (body.get('payload')):
|
||||
body = body['payload']
|
||||
|
||||
status = body['status']
|
||||
download = body.get('url')
|
||||
|
||||
if (status == 2) | (status == 3): # mustsave, corrupted
|
||||
path = docManager.getStoragePath(filename, usAddr)
|
||||
histDir = historyManager.getHistoryDir(path)
|
||||
versionDir = historyManager.getNextVersionDir(histDir)
|
||||
changesUri = body.get('changesurl')
|
||||
|
||||
os.rename(path, historyManager.getPrevFilePath(versionDir, fileUtils.getFileExt(filename)))
|
||||
docManager.saveFileFromUri(download, path)
|
||||
docManager.saveFileFromUri(changesUri, historyManager.getChangesZipPath(versionDir))
|
||||
|
||||
hist = None
|
||||
hist = body.get('changeshistory')
|
||||
if (not hist) & ('history' in body):
|
||||
hist = json.dumps(body.get('history'))
|
||||
if hist:
|
||||
historyManager.writeFile(historyManager.getChangesHistoryPath(versionDir), hist)
|
||||
|
||||
historyManager.writeFile(historyManager.getKeyPath(versionDir), body.get('key'))
|
||||
|
||||
except Exception as e:
|
||||
response.setdefault('error', 1)
|
||||
response.setdefault('message', e.args[0])
|
||||
|
||||
response.setdefault('error', 0)
|
||||
return HttpResponse(json.dumps(response), content_type='application/json', status=200 if response['error'] == 0 else 500)
|
||||
|
||||
def remove(request):
|
||||
filename = request.GET['filename']
|
||||
|
||||
response = {}
|
||||
|
||||
docManager.removeFile(filename, request)
|
||||
|
||||
response.setdefault('success', True)
|
||||
return HttpResponse(json.dumps(response), content_type='application/json')
|
||||
44
web/documentserver-example/python/src/views/index.py
Normal file
44
web/documentserver-example/python/src/views/index.py
Normal file
@ -0,0 +1,44 @@
|
||||
"""
|
||||
|
||||
(c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
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.
|
||||
|
||||
"""
|
||||
|
||||
import config
|
||||
import json
|
||||
|
||||
from django.shortcuts import render
|
||||
|
||||
from src.utils import users
|
||||
from src.utils import docManager
|
||||
|
||||
def default(request):
|
||||
context = {
|
||||
'users': users.USERS,
|
||||
'languages': docManager.LANGUAGES,
|
||||
'preloadurl': config.DOC_SERV_PRELOADER_URL,
|
||||
'editExt': json.dumps(config.DOC_SERV_EDITED),
|
||||
'convExt': json.dumps(config.DOC_SERV_CONVERT),
|
||||
'files': docManager.getStoredFiles(request)
|
||||
}
|
||||
return render(request, 'index.html', context)
|
||||
16
web/documentserver-example/python/src/wsgi.py
Normal file
16
web/documentserver-example/python/src/wsgi.py
Normal file
@ -0,0 +1,16 @@
|
||||
"""
|
||||
WSGI config for example project.
|
||||
|
||||
It exposes the WSGI callable as a module-level variable named ``application``.
|
||||
|
||||
For more information on this file, see
|
||||
https://docs.djangoproject.com/en/2.2/howto/deployment/wsgi/
|
||||
"""
|
||||
|
||||
import os
|
||||
|
||||
from django.core.wsgi import get_wsgi_application
|
||||
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'src.settings')
|
||||
|
||||
application = get_wsgi_application()
|
||||
52
web/documentserver-example/python/static/css/editor.css
Normal file
52
web/documentserver-example/python/static/css/editor.css
Normal file
@ -0,0 +1,52 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
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;
|
||||
}
|
||||
464
web/documentserver-example/python/static/css/jquery-ui.css
vendored
Normal file
464
web/documentserver-example/python/static/css/jquery-ui.css
vendored
Normal file
@ -0,0 +1,464 @@
|
||||
/*! jQuery UI - v1.9.2 - 2012-11-23
|
||||
* http://jqueryui.com
|
||||
* Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css
|
||||
* Copyright 2012 jQuery Foundation and other contributors; Licensed MIT */
|
||||
|
||||
/* Layout helpers
|
||||
----------------------------------*/
|
||||
.ui-helper-hidden { display: none; }
|
||||
.ui-helper-hidden-accessible { border: 0; clip: rect(0 0 0 0); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; }
|
||||
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
|
||||
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
|
||||
.ui-helper-clearfix:after { clear: both; }
|
||||
.ui-helper-clearfix { zoom: 1; }
|
||||
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
|
||||
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-disabled { cursor: default !important; }
|
||||
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* states and images */
|
||||
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
|
||||
|
||||
.ui-accordion .ui-accordion-header { display: block; cursor: pointer; position: relative; margin-top: 2px; padding: .5em .5em .5em .7em; zoom: 1; }
|
||||
.ui-accordion .ui-accordion-icons { padding-left: 2.2em; }
|
||||
.ui-accordion .ui-accordion-noicons { padding-left: .7em; }
|
||||
.ui-accordion .ui-accordion-icons .ui-accordion-icons { padding-left: 2.2em; }
|
||||
.ui-accordion .ui-accordion-header .ui-accordion-header-icon { position: absolute; left: .5em; top: 50%; margin-top: -8px; }
|
||||
.ui-accordion .ui-accordion-content { padding: 1em 2.2em; border-top: 0; overflow: auto; zoom: 1; }
|
||||
|
||||
.ui-autocomplete {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
/* workarounds */
|
||||
* html .ui-autocomplete { width:1px; } /* without this, the menu expands to 100% in IE6 */
|
||||
|
||||
.ui-button { display: inline-block; position: relative; padding: 0; margin-right: .1em; cursor: pointer; text-align: center; zoom: 1; overflow: visible; } /* the overflow property removes extra width in IE */
|
||||
.ui-button, .ui-button:link, .ui-button:visited, .ui-button:hover, .ui-button:active { text-decoration: none; }
|
||||
.ui-button-icon-only { width: 2.2em; } /* to make room for the icon, a width needs to be set here */
|
||||
button.ui-button-icon-only { width: 2.4em; } /* button elements seem to need a little more width */
|
||||
.ui-button-icons-only { width: 3.4em; }
|
||||
button.ui-button-icons-only { width: 3.7em; }
|
||||
|
||||
/*button text element */
|
||||
.ui-button .ui-button-text { display: block; line-height: 1.4; }
|
||||
.ui-button-text-only .ui-button-text { padding: .4em 1em; }
|
||||
.ui-button-icon-only .ui-button-text, .ui-button-icons-only .ui-button-text { padding: .4em; text-indent: -9999999px; }
|
||||
.ui-button-text-icon-primary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 1em .4em 2.1em; }
|
||||
.ui-button-text-icon-secondary .ui-button-text, .ui-button-text-icons .ui-button-text { padding: .4em 2.1em .4em 1em; }
|
||||
.ui-button-text-icons .ui-button-text { padding-left: 2.1em; padding-right: 2.1em; }
|
||||
/* no icon support for input elements, provide padding by default */
|
||||
input.ui-button { padding: .4em 1em; }
|
||||
|
||||
/*button icon element(s) */
|
||||
.ui-button-icon-only .ui-icon, .ui-button-text-icon-primary .ui-icon, .ui-button-text-icon-secondary .ui-icon, .ui-button-text-icons .ui-icon, .ui-button-icons-only .ui-icon { position: absolute; top: 50%; margin-top: -8px; }
|
||||
.ui-button-icon-only .ui-icon { left: 50%; margin-left: -8px; }
|
||||
.ui-button-text-icon-primary .ui-button-icon-primary, .ui-button-text-icons .ui-button-icon-primary, .ui-button-icons-only .ui-button-icon-primary { left: .5em; }
|
||||
.ui-button-text-icon-secondary .ui-button-icon-secondary, .ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
.ui-button-text-icons .ui-button-icon-secondary, .ui-button-icons-only .ui-button-icon-secondary { right: .5em; }
|
||||
|
||||
/*button sets*/
|
||||
.ui-buttonset { margin-right: 7px; }
|
||||
.ui-buttonset .ui-button { margin-left: 0; margin-right: -.3em; }
|
||||
|
||||
/* workarounds */
|
||||
button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra padding in Firefox */
|
||||
|
||||
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
|
||||
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
|
||||
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
|
||||
.ui-datepicker .ui-datepicker-prev { left:2px; }
|
||||
.ui-datepicker .ui-datepicker-next { right:2px; }
|
||||
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
|
||||
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
|
||||
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
|
||||
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
|
||||
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
|
||||
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
|
||||
.ui-datepicker select.ui-datepicker-month,
|
||||
.ui-datepicker select.ui-datepicker-year { width: 49%;}
|
||||
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
|
||||
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
|
||||
.ui-datepicker td { border: 0; padding: 1px; }
|
||||
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
|
||||
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
|
||||
|
||||
/* with multiple calendars */
|
||||
.ui-datepicker.ui-datepicker-multi { width:auto; }
|
||||
.ui-datepicker-multi .ui-datepicker-group { float:left; }
|
||||
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
|
||||
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
|
||||
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
|
||||
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
|
||||
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
|
||||
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
|
||||
|
||||
/* RTL support */
|
||||
.ui-datepicker-rtl { direction: rtl; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
|
||||
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
|
||||
|
||||
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
|
||||
.ui-datepicker-cover {
|
||||
position: absolute; /*must have*/
|
||||
z-index: -1; /*must have*/
|
||||
filter: mask(); /*must have*/
|
||||
top: -4px; /*must have*/
|
||||
left: -4px; /*must have*/
|
||||
width: 200px; /*must have*/
|
||||
height: 200px; /*must have*/
|
||||
}
|
||||
.ui-dialog { position: absolute; top: 0; left: 0; padding: .2em; width: 650px; overflow: hidden; }
|
||||
.ui-dialog .ui-dialog-titlebar { padding: .4em 1em; position: relative; }
|
||||
.ui-dialog .ui-dialog-title { float: left; margin: .1em 16px .1em 0; }
|
||||
.ui-dialog .ui-dialog-titlebar-close { position: absolute; right: .3em; top: 50%; width: 19px; margin: -10px 0 0 0; padding: 1px; height: 18px; }
|
||||
.ui-dialog .ui-dialog-titlebar-close span { display: block; margin: 1px; }
|
||||
.ui-dialog .ui-dialog-titlebar-close:hover, .ui-dialog .ui-dialog-titlebar-close:focus { padding: 0; }
|
||||
.ui-dialog .ui-dialog-content { position: relative; border: 0; padding: .5em 1em; background: none; overflow: auto; zoom: 1; }
|
||||
.ui-dialog .ui-dialog-buttonpane { text-align: left; border-width: 1px 0 0 0; background-image: none; margin: .5em 0 0 0; padding: .3em 1em .5em .4em; }
|
||||
.ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { float: right; }
|
||||
.ui-dialog .ui-dialog-buttonpane button { margin: .5em .4em .5em 0; cursor: pointer; }
|
||||
.ui-dialog .ui-resizable-se { width: 14px; height: 14px; right: 3px; bottom: 3px; }
|
||||
.ui-draggable .ui-dialog-titlebar { cursor: move; }
|
||||
|
||||
.ui-menu { list-style:none; padding: 2px; margin: 0; display:block; outline: none; }
|
||||
.ui-menu .ui-menu { margin-top: -3px; position: absolute; }
|
||||
.ui-menu .ui-menu-item { margin: 0; padding: 0; zoom: 1; width: 100%; }
|
||||
.ui-menu .ui-menu-divider { margin: 5px -2px 5px -2px; height: 0; font-size: 0; line-height: 0; border-width: 1px 0 0 0; }
|
||||
.ui-menu .ui-menu-item a { text-decoration: none; display: block; padding: 2px .4em; line-height: 1.5; zoom: 1; font-weight: normal; }
|
||||
.ui-menu .ui-menu-item a.ui-state-focus,
|
||||
.ui-menu .ui-menu-item a.ui-state-active { font-weight: normal; margin: -1px; }
|
||||
|
||||
.ui-menu .ui-state-disabled { font-weight: normal; margin: .4em 0 .2em; line-height: 1.5; }
|
||||
.ui-menu .ui-state-disabled a { cursor: default; }
|
||||
|
||||
/* icon support */
|
||||
.ui-menu-icons { position: relative; }
|
||||
.ui-menu-icons .ui-menu-item a { position: relative; padding-left: 2em; }
|
||||
|
||||
/* left-aligned */
|
||||
.ui-menu .ui-icon { position: absolute; top: .2em; left: .2em; }
|
||||
|
||||
/* right-aligned */
|
||||
.ui-menu .ui-menu-icon { position: static; float: right; }
|
||||
|
||||
.ui-progressbar { height:2em; text-align: left; overflow: hidden; }
|
||||
.ui-progressbar .ui-progressbar-value {margin: -1px; height:100%; }
|
||||
.ui-resizable { position: relative;}
|
||||
.ui-resizable-handle { position: absolute;font-size: 0.1px; display: block; }
|
||||
.ui-resizable-disabled .ui-resizable-handle, .ui-resizable-autohide .ui-resizable-handle { display: none; }
|
||||
.ui-resizable-n { cursor: n-resize; height: 7px; width: 100%; top: -5px; left: 0; }
|
||||
.ui-resizable-s { cursor: s-resize; height: 7px; width: 100%; bottom: -5px; left: 0; }
|
||||
.ui-resizable-e { cursor: e-resize; width: 7px; right: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-w { cursor: w-resize; width: 7px; left: -5px; top: 0; height: 100%; }
|
||||
.ui-resizable-se { cursor: se-resize; width: 12px; height: 12px; right: 1px; bottom: 1px; }
|
||||
.ui-resizable-sw { cursor: sw-resize; width: 9px; height: 9px; left: -5px; bottom: -5px; }
|
||||
.ui-resizable-nw { cursor: nw-resize; width: 9px; height: 9px; left: -5px; top: -5px; }
|
||||
.ui-resizable-ne { cursor: ne-resize; width: 9px; height: 9px; right: -5px; top: -5px;}
|
||||
.ui-selectable-helper { position: absolute; z-index: 100; border:1px dotted black; }
|
||||
|
||||
.ui-slider { position: relative; text-align: left; }
|
||||
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
|
||||
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
|
||||
|
||||
.ui-slider-horizontal { height: .8em; }
|
||||
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }
|
||||
.ui-slider-horizontal .ui-slider-range { top: 0; height: 100%; }
|
||||
.ui-slider-horizontal .ui-slider-range-min { left: 0; }
|
||||
.ui-slider-horizontal .ui-slider-range-max { right: 0; }
|
||||
|
||||
.ui-slider-vertical { width: .8em; height: 100px; }
|
||||
.ui-slider-vertical .ui-slider-handle { left: -.3em; margin-left: 0; margin-bottom: -.6em; }
|
||||
.ui-slider-vertical .ui-slider-range { left: 0; width: 100%; }
|
||||
.ui-slider-vertical .ui-slider-range-min { bottom: 0; }
|
||||
.ui-slider-vertical .ui-slider-range-max { top: 0; }
|
||||
.ui-spinner { position:relative; display: inline-block; overflow: hidden; padding: 0; vertical-align: middle; }
|
||||
.ui-spinner-input { border: none; background: none; padding: 0; margin: .2em 0; vertical-align: middle; margin-left: .4em; margin-right: 22px; }
|
||||
.ui-spinner-button { width: 16px; height: 50%; font-size: .5em; padding: 0; margin: 0; text-align: center; position: absolute; cursor: default; display: block; overflow: hidden; right: 0; }
|
||||
.ui-spinner a.ui-spinner-button { border-top: none; border-bottom: none; border-right: none; } /* more specificity required here to overide default borders */
|
||||
.ui-spinner .ui-icon { position: absolute; margin-top: -8px; top: 50%; left: 0; } /* vertical centre icon */
|
||||
.ui-spinner-up { top: 0; }
|
||||
.ui-spinner-down { bottom: 0; }
|
||||
|
||||
/* TR overrides */
|
||||
.ui-spinner .ui-icon-triangle-1-s {
|
||||
/* need to fix icons sprite */
|
||||
background-position:-65px -16px;
|
||||
}
|
||||
|
||||
.ui-tabs { position: relative; padding: .2em; zoom: 1; } /* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */
|
||||
.ui-tabs .ui-tabs-nav { margin: 0; padding: .2em .2em 0; }
|
||||
.ui-tabs .ui-tabs-nav li { list-style: none; float: left; position: relative; top: 0; margin: 1px .2em 0 0; border-bottom: 0; padding: 0; white-space: nowrap; }
|
||||
.ui-tabs .ui-tabs-nav li a { float: left; padding: .5em 1em; text-decoration: none; }
|
||||
.ui-tabs .ui-tabs-nav li.ui-tabs-active { margin-bottom: -1px; padding-bottom: 1px; }
|
||||
.ui-tabs .ui-tabs-nav li.ui-tabs-active a, .ui-tabs .ui-tabs-nav li.ui-state-disabled a, .ui-tabs .ui-tabs-nav li.ui-tabs-loading a { cursor: text; }
|
||||
.ui-tabs .ui-tabs-nav li a, .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active a { cursor: pointer; } /* first selector in group seems obsolete, but required to overcome bug in Opera applying cursor: text overall if defined elsewhere... */
|
||||
.ui-tabs .ui-tabs-panel { display: block; border-width: 0; padding: 1em 1.4em; background: none; }
|
||||
|
||||
.ui-tooltip {
|
||||
padding: 8px;
|
||||
position: absolute;
|
||||
z-index: 9999;
|
||||
max-width: 300px;
|
||||
-webkit-box-shadow: 0 0 5px #aaa;
|
||||
box-shadow: 0 0 5px #aaa;
|
||||
}
|
||||
/* Fades and background-images don't work well together in IE6, drop the image */
|
||||
* html .ui-tooltip {
|
||||
background-image: none;
|
||||
}
|
||||
body .ui-tooltip { border-width: 2px; }
|
||||
|
||||
/* Component containers
|
||||
----------------------------------*/
|
||||
.ui-widget { font-family: 'Open Sans',sans-serif; font-size: 1.1em; }
|
||||
.ui-widget .ui-widget { font-size: 1em; }
|
||||
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: 'Open Sans',sans-serif; font-size: 1em; }
|
||||
.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; color: #222222; }
|
||||
.ui-widget-content a { color: #222222; }
|
||||
.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc 50% 50% repeat-x; color: #222222; font-weight: bold; }
|
||||
.ui-widget-header a { color: #222222; }
|
||||
|
||||
/* Interaction states
|
||||
----------------------------------*/
|
||||
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 50% 50% repeat-x; font-weight: normal; color: #555555; }
|
||||
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
|
||||
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
||||
.ui-state-hover a, .ui-state-hover a:hover, .ui-state-hover a:link, .ui-state-hover a:visited { color: #212121; text-decoration: none; }
|
||||
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff 50% 50% repeat-x; font-weight: normal; color: #212121; }
|
||||
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
|
||||
|
||||
/* Interaction Cues
|
||||
----------------------------------*/
|
||||
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee 50% 50% repeat-x; color: #363636; }
|
||||
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
|
||||
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec 50% 50% repeat-x; color: #cd0a0a; }
|
||||
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
|
||||
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
|
||||
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
|
||||
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
|
||||
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
|
||||
.ui-state-disabled .ui-icon { filter:Alpha(Opacity=35); } /* For IE8 - See #6059 */
|
||||
|
||||
/* Icons
|
||||
----------------------------------*/
|
||||
|
||||
/* positioning */
|
||||
.ui-icon-carat-1-n { background-position: 0 0; }
|
||||
.ui-icon-carat-1-ne { background-position: -16px 0; }
|
||||
.ui-icon-carat-1-e { background-position: -32px 0; }
|
||||
.ui-icon-carat-1-se { background-position: -48px 0; }
|
||||
.ui-icon-carat-1-s { background-position: -64px 0; }
|
||||
.ui-icon-carat-1-sw { background-position: -80px 0; }
|
||||
.ui-icon-carat-1-w { background-position: -96px 0; }
|
||||
.ui-icon-carat-1-nw { background-position: -112px 0; }
|
||||
.ui-icon-carat-2-n-s { background-position: -128px 0; }
|
||||
.ui-icon-carat-2-e-w { background-position: -144px 0; }
|
||||
.ui-icon-triangle-1-n { background-position: 0 -16px; }
|
||||
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
|
||||
.ui-icon-triangle-1-e { background-position: -32px -16px; }
|
||||
.ui-icon-triangle-1-se { background-position: -48px -16px; }
|
||||
.ui-icon-triangle-1-s { background-position: -64px -16px; }
|
||||
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
|
||||
.ui-icon-triangle-1-w { background-position: -96px -16px; }
|
||||
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
|
||||
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
|
||||
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
|
||||
.ui-icon-arrow-1-n { background-position: 0 -32px; }
|
||||
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
|
||||
.ui-icon-arrow-1-e { background-position: -32px -32px; }
|
||||
.ui-icon-arrow-1-se { background-position: -48px -32px; }
|
||||
.ui-icon-arrow-1-s { background-position: -64px -32px; }
|
||||
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
|
||||
.ui-icon-arrow-1-w { background-position: -96px -32px; }
|
||||
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
|
||||
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
|
||||
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
|
||||
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
|
||||
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
|
||||
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
|
||||
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
|
||||
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
|
||||
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
|
||||
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
|
||||
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
|
||||
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
|
||||
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
|
||||
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
|
||||
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
|
||||
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
|
||||
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
|
||||
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
|
||||
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
|
||||
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
|
||||
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
|
||||
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
|
||||
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
|
||||
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
|
||||
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
|
||||
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
|
||||
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
|
||||
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
|
||||
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
|
||||
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
|
||||
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
|
||||
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
|
||||
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
|
||||
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
|
||||
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
|
||||
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
|
||||
.ui-icon-arrow-4 { background-position: 0 -80px; }
|
||||
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
|
||||
.ui-icon-extlink { background-position: -32px -80px; }
|
||||
.ui-icon-newwin { background-position: -48px -80px; }
|
||||
.ui-icon-refresh { background-position: -64px -80px; }
|
||||
.ui-icon-shuffle { background-position: -80px -80px; }
|
||||
.ui-icon-transfer-e-w { background-position: -96px -80px; }
|
||||
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
|
||||
.ui-icon-folder-collapsed { background-position: 0 -96px; }
|
||||
.ui-icon-folder-open { background-position: -16px -96px; }
|
||||
.ui-icon-document { background-position: -32px -96px; }
|
||||
.ui-icon-document-b { background-position: -48px -96px; }
|
||||
.ui-icon-note { background-position: -64px -96px; }
|
||||
.ui-icon-mail-closed { background-position: -80px -96px; }
|
||||
.ui-icon-mail-open { background-position: -96px -96px; }
|
||||
.ui-icon-suitcase { background-position: -112px -96px; }
|
||||
.ui-icon-comment { background-position: -128px -96px; }
|
||||
.ui-icon-person { background-position: -144px -96px; }
|
||||
.ui-icon-print { background-position: -160px -96px; }
|
||||
.ui-icon-trash { background-position: -176px -96px; }
|
||||
.ui-icon-locked { background-position: -192px -96px; }
|
||||
.ui-icon-unlocked { background-position: -208px -96px; }
|
||||
.ui-icon-bookmark { background-position: -224px -96px; }
|
||||
.ui-icon-tag { background-position: -240px -96px; }
|
||||
.ui-icon-home { background-position: 0 -112px; }
|
||||
.ui-icon-flag { background-position: -16px -112px; }
|
||||
.ui-icon-calendar { background-position: -32px -112px; }
|
||||
.ui-icon-cart { background-position: -48px -112px; }
|
||||
.ui-icon-pencil { background-position: -64px -112px; }
|
||||
.ui-icon-clock { background-position: -80px -112px; }
|
||||
.ui-icon-disk { background-position: -96px -112px; }
|
||||
.ui-icon-calculator { background-position: -112px -112px; }
|
||||
.ui-icon-zoomin { background-position: -128px -112px; }
|
||||
.ui-icon-zoomout { background-position: -144px -112px; }
|
||||
.ui-icon-search { background-position: -160px -112px; }
|
||||
.ui-icon-wrench { background-position: -176px -112px; }
|
||||
.ui-icon-gear { background-position: -192px -112px; }
|
||||
.ui-icon-heart { background-position: -208px -112px; }
|
||||
.ui-icon-star { background-position: -224px -112px; }
|
||||
.ui-icon-link { background-position: -240px -112px; }
|
||||
.ui-icon-cancel { background-position: 0 -128px; }
|
||||
.ui-icon-plus { background-position: -16px -128px; }
|
||||
.ui-icon-plusthick { background-position: -32px -128px; }
|
||||
.ui-icon-minus { background-position: -48px -128px; }
|
||||
.ui-icon-minusthick { background-position: -64px -128px; }
|
||||
.ui-icon-close { background-position: -80px -128px; }
|
||||
.ui-icon-closethick { background-position: -96px -128px; }
|
||||
.ui-icon-key { background-position: -112px -128px; }
|
||||
.ui-icon-lightbulb { background-position: -128px -128px; }
|
||||
.ui-icon-scissors { background-position: -144px -128px; }
|
||||
.ui-icon-clipboard { background-position: -160px -128px; }
|
||||
.ui-icon-copy { background-position: -176px -128px; }
|
||||
.ui-icon-contact { background-position: -192px -128px; }
|
||||
.ui-icon-image { background-position: -208px -128px; }
|
||||
.ui-icon-video { background-position: -224px -128px; }
|
||||
.ui-icon-script { background-position: -240px -128px; }
|
||||
.ui-icon-alert { background-position: 0 -144px; }
|
||||
.ui-icon-info { background-position: -16px -144px; }
|
||||
.ui-icon-notice { background-position: -32px -144px; }
|
||||
.ui-icon-help { background-position: -48px -144px; }
|
||||
.ui-icon-check { background-position: -64px -144px; }
|
||||
.ui-icon-bullet { background-position: -80px -144px; }
|
||||
.ui-icon-radio-on { background-position: -96px -144px; }
|
||||
.ui-icon-radio-off { background-position: -112px -144px; }
|
||||
.ui-icon-pin-w { background-position: -128px -144px; }
|
||||
.ui-icon-pin-s { background-position: -144px -144px; }
|
||||
.ui-icon-play { background-position: 0 -160px; }
|
||||
.ui-icon-pause { background-position: -16px -160px; }
|
||||
.ui-icon-seek-next { background-position: -32px -160px; }
|
||||
.ui-icon-seek-prev { background-position: -48px -160px; }
|
||||
.ui-icon-seek-end { background-position: -64px -160px; }
|
||||
.ui-icon-seek-start { background-position: -80px -160px; }
|
||||
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
|
||||
.ui-icon-seek-first { background-position: -80px -160px; }
|
||||
.ui-icon-stop { background-position: -96px -160px; }
|
||||
.ui-icon-eject { background-position: -112px -160px; }
|
||||
.ui-icon-volume-off { background-position: -128px -160px; }
|
||||
.ui-icon-volume-on { background-position: -144px -160px; }
|
||||
.ui-icon-power { background-position: 0 -176px; }
|
||||
.ui-icon-signal-diag { background-position: -16px -176px; }
|
||||
.ui-icon-signal { background-position: -32px -176px; }
|
||||
.ui-icon-battery-0 { background-position: -48px -176px; }
|
||||
.ui-icon-battery-1 { background-position: -64px -176px; }
|
||||
.ui-icon-battery-2 { background-position: -80px -176px; }
|
||||
.ui-icon-battery-3 { background-position: -96px -176px; }
|
||||
.ui-icon-circle-plus { background-position: 0 -192px; }
|
||||
.ui-icon-circle-minus { background-position: -16px -192px; }
|
||||
.ui-icon-circle-close { background-position: -32px -192px; }
|
||||
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
|
||||
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
|
||||
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
|
||||
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
|
||||
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
|
||||
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
|
||||
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
|
||||
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
|
||||
.ui-icon-circle-zoomin { background-position: -176px -192px; }
|
||||
.ui-icon-circle-zoomout { background-position: -192px -192px; }
|
||||
.ui-icon-circle-check { background-position: -208px -192px; }
|
||||
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
|
||||
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
|
||||
.ui-icon-circlesmall-close { background-position: -32px -208px; }
|
||||
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
|
||||
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
|
||||
.ui-icon-squaresmall-close { background-position: -80px -208px; }
|
||||
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
|
||||
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
|
||||
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
|
||||
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
|
||||
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
|
||||
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
|
||||
|
||||
|
||||
/* Misc visuals
|
||||
----------------------------------*/
|
||||
|
||||
/* Corner radius */
|
||||
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
|
||||
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
|
||||
|
||||
/* Overlays */
|
||||
.ui-widget-overlay { background: #aaaaaa 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); }
|
||||
.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa 50% 50% repeat-x; opacity: .3;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -khtml-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; }
|
||||
466
web/documentserver-example/python/static/css/stylesheet.css
Normal file
466
web/documentserver-example/python/static/css/stylesheet.css
Normal file
@ -0,0 +1,466 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System SIA 2020
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
*/
|
||||
|
||||
html {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
body {
|
||||
background: #fff;
|
||||
color: #333;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 12px;
|
||||
font-weight: normal;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
text-decoration: none;
|
||||
}
|
||||
form {
|
||||
height: 100%;
|
||||
}
|
||||
div {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
a, a:hover, a:visited {
|
||||
color: #333;
|
||||
}
|
||||
header {
|
||||
height: 44px;
|
||||
background: #3D4A6B;
|
||||
height: 80px;
|
||||
margin: 0 auto;
|
||||
min-width: 600px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
header img {
|
||||
margin: 12px 0 0 16px;
|
||||
}
|
||||
|
||||
.main-panel {
|
||||
margin: 80px auto 16px;
|
||||
width: 600px;
|
||||
}
|
||||
.portal-name {
|
||||
font-size: 20px;
|
||||
}
|
||||
.portal-descr {
|
||||
display: inline-block;
|
||||
line-height: 20px;
|
||||
margin-bottom: 20px;
|
||||
width: 600px;
|
||||
}
|
||||
label .checkbox {
|
||||
margin: 0 5px 3px 0;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.try-descr {
|
||||
font-size: 16px;
|
||||
white-space : nowrap;
|
||||
}
|
||||
|
||||
.try-editor-list {
|
||||
list-style: none;
|
||||
margin: 0 0 16px;
|
||||
padding: 0;
|
||||
}
|
||||
.try-editor-list li {
|
||||
float: left;
|
||||
margin: 0 15px;
|
||||
width: 100px;
|
||||
}
|
||||
.try-editor {
|
||||
background-color: transparent;
|
||||
background-position: center 0;
|
||||
background-repeat: no-repeat;
|
||||
display: block;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
height: 45px;
|
||||
padding-top: 100px;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
.try-editor.document {
|
||||
background-image: url("../images/file_docx.png");
|
||||
}
|
||||
.try-editor.spreadsheet {
|
||||
background-image: url("../images/file_xlsx.png");
|
||||
}
|
||||
.try-editor.presentation {
|
||||
background-image: url("../images/file_pptx.png");
|
||||
}
|
||||
.create-sample {
|
||||
display: inline-block;
|
||||
margin-left: 75px;
|
||||
}
|
||||
.button, .button:visited, .button:hover, .button:active {
|
||||
display: inline-block;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
text-decoration: none;
|
||||
vertical-align: middle;
|
||||
cursor:pointer;
|
||||
border-radius: 6px;
|
||||
-moz-border-radius: 6px;
|
||||
-webkit-border-radius: 6px;
|
||||
touch-callout: none;
|
||||
-o-touch-callout: none;
|
||||
-moz-touch-callout: none;
|
||||
-webkit-touch-callout: none;
|
||||
user-select: none;
|
||||
-o-user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
font-size: 12px;
|
||||
line-height: 16px;
|
||||
margin-right: 3px;
|
||||
padding: 4px 12px;
|
||||
|
||||
color: #fff;
|
||||
|
||||
background: #3D96C6;
|
||||
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
border-color: #3D96C6;
|
||||
}
|
||||
|
||||
.button.disable {
|
||||
cursor: default;
|
||||
background: #BADDEF;
|
||||
border: 1px solid #BADDEF;
|
||||
}
|
||||
.button.gray {
|
||||
background: #ebebeb;
|
||||
border: 1px solid #D0D0D0;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.upload-panel {
|
||||
border-right: 1px solid #D1D1D1;
|
||||
float: left;
|
||||
margin-right: 25px;
|
||||
}
|
||||
.file-upload {
|
||||
background: url("../images/file_upload.png") no-repeat center 0 transparent;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
height: 45px;
|
||||
margin: 0 40px 16px;
|
||||
overflow: hidden;
|
||||
padding-top: 100px;
|
||||
position: relative;
|
||||
text-align: center;
|
||||
width: 100px;
|
||||
}
|
||||
.file-upload input {
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
position: absolute;
|
||||
right: 0;
|
||||
top: 0;
|
||||
transform: translate(555px, 60px) scale(8);
|
||||
}
|
||||
.create-panel {
|
||||
float: left;
|
||||
}
|
||||
.upload-panel,
|
||||
.create-panel {
|
||||
padding: 10px 0;
|
||||
}
|
||||
|
||||
#mainProgress {
|
||||
color: #979b9f;
|
||||
display: none;
|
||||
margin: 15px;
|
||||
}
|
||||
#mainProgress #embeddedView {
|
||||
display: none;
|
||||
}
|
||||
#mainProgress.embedded #embeddedView {
|
||||
display: block;
|
||||
}
|
||||
#mainProgress.embedded #uploadSteps {
|
||||
display: none;
|
||||
}
|
||||
.error-message {
|
||||
background: url("../images/alert.png") no-repeat scroll 4px 10px #FFECE3;
|
||||
color: #666668 !important;
|
||||
display: none;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
margin: 5px 0;
|
||||
padding: 10px 10px 10px 30px;
|
||||
vertical-align: middle;
|
||||
}
|
||||
#mainProgress .error-message a {
|
||||
color: #666668;
|
||||
}
|
||||
.step {
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
background-color: transparent;
|
||||
color: #979B9F;
|
||||
font-size: 14px;
|
||||
line-height: 30px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
.current {
|
||||
background-image: url("../images/loader16.gif");
|
||||
color: #333;
|
||||
}
|
||||
.done {
|
||||
background-image: url("../images/done.png");
|
||||
color: #333;
|
||||
}
|
||||
.error {
|
||||
background-image: url("../images/alert.png");
|
||||
}
|
||||
.step-descr {
|
||||
display: block;
|
||||
margin-left: 45px;
|
||||
}
|
||||
#mainProgress .step-descr a {
|
||||
color: #979B9F;
|
||||
}
|
||||
.progress-descr {
|
||||
color: #333;
|
||||
}
|
||||
#loadScripts {
|
||||
display: none;
|
||||
}
|
||||
#iframeScripts {
|
||||
position: absolute;
|
||||
visibility: hidden;
|
||||
}
|
||||
footer {
|
||||
text-align: right;
|
||||
width: auto;
|
||||
margin-bottom: 15px;
|
||||
margin-right: 15px;
|
||||
}
|
||||
.help-block span {
|
||||
font-size: 16px;
|
||||
line-height: 26px;
|
||||
}
|
||||
|
||||
.stored-list {
|
||||
border-top: 1px solid #D1D1D1;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.stored-list li {
|
||||
border-bottom: 1px solid #D1D1D1;
|
||||
line-height: 28px;
|
||||
padding: 0 8px;
|
||||
}
|
||||
.stored-edit {
|
||||
background-color: transparent;
|
||||
background-position: left center;
|
||||
background-repeat: no-repeat;
|
||||
display: inline-block;
|
||||
height: 16px;
|
||||
max-width: 200px;
|
||||
margin-bottom: -6px;
|
||||
overflow: hidden;
|
||||
padding: 8px 0 1px 34px;
|
||||
text-decoration: none;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.stored-edit.text {
|
||||
background-image: url("../images/icon_docx.png");
|
||||
}
|
||||
.stored-edit.spreadsheet {
|
||||
background-image: url("../images/icon_xlsx.png");
|
||||
}
|
||||
.stored-edit.presentation {
|
||||
background-image: url("../images/icon_pptx.png");
|
||||
}
|
||||
.stored-edit span {
|
||||
font-size: 12px;
|
||||
line-height: 12px;
|
||||
vertical-align: top;
|
||||
}
|
||||
.stored-edit:hover span {
|
||||
text-decoration: underline;
|
||||
}
|
||||
.stored-download {
|
||||
color: #787878;
|
||||
float: right;
|
||||
text-decoration: none;
|
||||
}
|
||||
.stored-download:hover {
|
||||
color: #787878;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.blockTitle {
|
||||
background-color: #E2E2E2 !important;
|
||||
border: none !important;
|
||||
border-radius: 0 !important;
|
||||
-moz-border-radius: 0 !important;
|
||||
-webkit-border-radius: 0 !important;
|
||||
color: #333 !important;
|
||||
font-size: 16px !important;
|
||||
font-weight: normal !important;
|
||||
padding: 15px 25px !important;
|
||||
}
|
||||
.dialog-close {
|
||||
background: url("../images/close.png") no-repeat scroll left top #E2E2E2;
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-size: 1px;
|
||||
height: 12px;
|
||||
line-height: 1px;
|
||||
margin-top: 4px;
|
||||
width: 12px;
|
||||
}
|
||||
.blockPage {
|
||||
border: none !important;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
||||
-moz-box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
|
||||
-webkit-box-shadow:0 2px 4px rgba(0, 0, 0, 0.5);
|
||||
padding: 0 !important;
|
||||
}
|
||||
|
||||
.clearFix:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.td100 {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.block-lang {
|
||||
padding-right: 10px;
|
||||
padding-top: 9px;
|
||||
}
|
||||
/*Icon table*/
|
||||
#tableRow {
|
||||
vertical-align: top;
|
||||
}
|
||||
.tableRow {
|
||||
background: transparent;
|
||||
|
||||
-moz-transition: all 0.2s ease-in-out;
|
||||
-webkit-transition: all 0.2s ease-in-out;
|
||||
-o-transition: all 0.2s ease-in-out;
|
||||
-ms-transition: all 0.2s ease-in-out;
|
||||
transition: all 0.2s ease-in-out;
|
||||
}
|
||||
.tableRow:hover {
|
||||
background-color: #ebebeb;
|
||||
}
|
||||
|
||||
.tableHeader {
|
||||
background: transparent;
|
||||
color: #333;
|
||||
cursor: default;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 13px;
|
||||
height: 40px;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.tableHeaderCell {
|
||||
padding: 2px 1px 2px 5px;
|
||||
text-align: center;
|
||||
}
|
||||
.tableHeaderCellFileName {
|
||||
text-align: left;
|
||||
}
|
||||
.contentCells {
|
||||
padding: 4px 1px 4px 5px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 16px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
white-space: nowrap;
|
||||
-khtml-user-select: none;
|
||||
user-select: none;
|
||||
-moz-user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
.contentCells > a {
|
||||
text-decoration: none;
|
||||
}
|
||||
.contentCells-shift {
|
||||
padding-right: 30px;
|
||||
}
|
||||
.contentCells-icon {
|
||||
width: 6%;
|
||||
}
|
||||
.contentCellsSmall {
|
||||
padding: 5px 1px 5px 6px;
|
||||
font-family: 'Open Sans', sans-serif;
|
||||
font-size: 13px;
|
||||
border-bottom: 1px solid #e5e5e5;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
}
|
||||
.primaryRow {
|
||||
background-color: #e9e9e9;
|
||||
}
|
||||
.secondaryRow {
|
||||
background-color: #F9F9F9;
|
||||
}
|
||||
.select-user {
|
||||
margin-left: 15px;
|
||||
}
|
||||
.user-block-table {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
}
|
||||
.user-block-table td {
|
||||
background-color: #F4F4F4;
|
||||
border-bottom: 1px solid white;
|
||||
padding: 12px 0;
|
||||
}
|
||||
#user, #language {
|
||||
width: 130px;
|
||||
}
|
||||
.icon-download {
|
||||
margin-bottom: -5px;
|
||||
}
|
||||
.icon-delete {
|
||||
cursor: pointer;
|
||||
margin-bottom: -6px;
|
||||
}
|
||||
BIN
web/documentserver-example/python/static/images/alert.png
Normal file
BIN
web/documentserver-example/python/static/images/alert.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 452 B |
BIN
web/documentserver-example/python/static/images/close.png
Normal file
BIN
web/documentserver-example/python/static/images/close.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 197 B |
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user