mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Compare commits
102 Commits
v7.3.0.48
...
v7.3.0.136
| Author | SHA1 | Date | |
|---|---|---|---|
| c344a1d6a6 | |||
| a53f36eca3 | |||
| 4882459f51 | |||
| 0a0f5b556c | |||
| 2502c2a979 | |||
| be85920ce4 | |||
| 7d7c10b3bc | |||
| 1cbc6eca2e | |||
| d007b0a969 | |||
| 63f032d924 | |||
| 820cafe202 | |||
| e0d7e416d3 | |||
| 806aba967c | |||
| 3ec226109e | |||
| b1f0fa6ecc | |||
| b02ffff33e | |||
| f74f0ba376 | |||
| 96d3bf2e63 | |||
| daf4f62acd | |||
| ade8a07e95 | |||
| 8b613627d1 | |||
| 3d3a10005c | |||
| 801c451899 | |||
| df034c2af2 | |||
| 9726c06c84 | |||
| 3a45e1b0f3 | |||
| ed8d0194b7 | |||
| a59da2d5df | |||
| f5c9a9e924 | |||
| 7b12b970c0 | |||
| 87a11c8633 | |||
| 01e0cefae5 | |||
| 98d42249fa | |||
| fd9454dd5f | |||
| fbf4153dea | |||
| 83b0411a4d | |||
| c60e4e25e2 | |||
| 4ebbecf580 | |||
| 6dbf383e2d | |||
| 1012bf13a6 | |||
| a24e081564 | |||
| 187ee212a9 | |||
| 106d9bfed3 | |||
| 13e243f900 | |||
| 4ccc3fa35e | |||
| be1fa2da14 | |||
| b6645427a8 | |||
| 39d7c366e3 | |||
| 075f464701 | |||
| 9414dff70c | |||
| 05b8989a87 | |||
| 43b6f53652 | |||
| c22c0d72aa | |||
| d61c112aa2 | |||
| ae3def67f5 | |||
| 7c22ba4e9e | |||
| 320881f1cf | |||
| 90c31eb887 | |||
| 702d0f1aa8 | |||
| dbf1047f29 | |||
| 0d27d142d4 | |||
| 807cbbf236 | |||
| e6b0bfd0be | |||
| 943d059c7c | |||
| 399ab0714d | |||
| 8cabbe9c71 | |||
| e40b6b2e28 | |||
| 0a390094e5 | |||
| f7bb668f8b | |||
| 808712ad34 | |||
| 2b0ba914dc | |||
| 249adaab48 | |||
| ee99a80ead | |||
| d61fdaaa53 | |||
| 270cbee160 | |||
| e9721dd655 | |||
| a31a24a871 | |||
| df0e197cb5 | |||
| 09802afc6f | |||
| 1c43679d87 | |||
| 573eeb6e18 | |||
| 78cf6c35f8 | |||
| c7f5003d69 | |||
| 19baff4340 | |||
| cc5c912658 | |||
| 64f2d605c2 | |||
| c9fca685bf | |||
| 820883a584 | |||
| 05a00a33a3 | |||
| 613cb713cc | |||
| 9216ff3a97 | |||
| 456df162e6 | |||
| 50fd47cf7c | |||
| f9c0da1696 | |||
| a7807513c6 | |||
| 128430d698 | |||
| 8077a66f16 | |||
| b3d8695a26 | |||
| 00872758ee | |||
| 3301c24de5 | |||
| dd0c049a70 | |||
| 5319e18fb5 |
31
.github/workflows/lint-java.yml
vendored
Normal file
31
.github/workflows/lint-java.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Lint Java
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/java/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/java/**']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/java
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Java 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
|
||||
- name: Run linter
|
||||
run: |
|
||||
mvn -version
|
||||
mvn package
|
||||
35
.github/workflows/lint-nodejs.yml
vendored
Normal file
35
.github/workflows/lint-nodejs.yml
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
name: ESLint
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/nodejs/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/nodejs/**']
|
||||
|
||||
env:
|
||||
NODE_VERSION: 16
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
name: Lint
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/nodejs
|
||||
steps:
|
||||
- name: Install NodeJS
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ env.NODE_VERSION }}
|
||||
|
||||
- name: Code Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Code Linting
|
||||
run: npm run lint
|
||||
29
.github/workflows/lint-php.yml
vendored
Normal file
29
.github/workflows/lint-php.yml
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
name: PHPCs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/php/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/php/**']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/php
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.1'
|
||||
tools: cs2pr, phpcs
|
||||
|
||||
- name: Run phpcs
|
||||
run: phpcs -q --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md,yml --ignore=node_modules,bower_components,vendor ./
|
||||
40
.github/workflows/lint-python.yml
vendored
Normal file
40
.github/workflows/lint-python.yml
vendored
Normal file
@ -0,0 +1,40 @@
|
||||
name: PyLint
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/python/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/python/**']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/python
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v4
|
||||
with:
|
||||
python-version: '3.10'
|
||||
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8
|
||||
pip install pylint
|
||||
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
||||
|
||||
- name: Lint Flake8
|
||||
run: |
|
||||
flake8 ./**/*.py --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
flake8 ./**/*.py --count --max-complexity=10 --max-line-length=79 --statistics
|
||||
|
||||
- name: Lint Pylint
|
||||
run: |
|
||||
pylint ./**/*.py
|
||||
31
.github/workflows/lint-ruby.yml
vendored
Normal file
31
.github/workflows/lint-ruby.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Rubocop
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/ruby/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/ruby/**']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/ruby
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: '3.0'
|
||||
bundler-cache: true
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
bundle install
|
||||
- name: Rubocop
|
||||
run: |
|
||||
gem install rubocop
|
||||
rubocop
|
||||
31
.github/workflows/lint-spring.yml
vendored
Normal file
31
.github/workflows/lint-spring.yml
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
name: Lint Spring
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches: [master, main]
|
||||
paths: ['web/documentserver-example/java-spring/**']
|
||||
pull_request:
|
||||
branches: [master, main, develop]
|
||||
paths: ['web/documentserver-example/java-spring/**']
|
||||
|
||||
jobs:
|
||||
lint:
|
||||
runs-on: ubuntu-latest
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./web/documentserver-example/java-spring
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
||||
- name: Install Java 11
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
distribution: 'temurin'
|
||||
java-version: '11'
|
||||
|
||||
- name: Run linter
|
||||
run: |
|
||||
mvn -version
|
||||
mvn package
|
||||
@ -1,5 +1,9 @@
|
||||
# Change Log
|
||||
|
||||
- nodejs: wopi editnew action for exisiting file
|
||||
- nodejs: fix wopi actions after restart
|
||||
- setting an unavailable language
|
||||
- description in the tooltip on the main page
|
||||
- nodejs: referenceData
|
||||
- option to send directUrl
|
||||
|
||||
|
||||
@ -740,3 +740,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@ -130,7 +130,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
var payloadToken = JwtManager.Encode(payload); // encode the payload object to the payload token
|
||||
var bodyToken = JwtManager.Encode(body); // encode the body object to the body token
|
||||
// create header token
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
request.Headers.Add(JWTheader, "Bearer " + payloadToken);
|
||||
|
||||
body.Add("token", bodyToken);
|
||||
|
||||
@ -55,7 +55,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
// check if the document token is enabled
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
string token = null;
|
||||
|
||||
@ -92,7 +92,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
// file saving process
|
||||
public static int processSave(Dictionary<string, object> fileData, string fileName, string userAddress)
|
||||
{
|
||||
if (fileData["url"].Equals(null)) {
|
||||
if (string.IsNullOrEmpty((string)fileData["url"])) {
|
||||
throw new Exception("DownloadUrl is null");
|
||||
}
|
||||
var downloadUri = (string)fileData["url"];
|
||||
@ -169,7 +169,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
// file force saving process
|
||||
public static int processForceSave(Dictionary<string, object> fileData, string fileName, string userAddress)
|
||||
{
|
||||
if (fileData["url"].Equals(null)) {
|
||||
if ( string.IsNullOrEmpty((string)fileData["url"])) {
|
||||
throw new Exception("DownloadUrl is null");
|
||||
}
|
||||
var downloadUri = (string)fileData["url"];
|
||||
@ -228,7 +228,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
fileName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress);
|
||||
}
|
||||
forcesavePath = DocManagerHelper.ForcesavePath(fileName, userAddress, false);
|
||||
if (forcesavePath.Equals("")) // create forcesave path if it doesn't exist
|
||||
if (string.IsNullOrEmpty(forcesavePath)) // create forcesave path if it doesn't exist
|
||||
{
|
||||
forcesavePath = DocManagerHelper.ForcesavePath(fileName, userAddress, true);
|
||||
}
|
||||
@ -279,7 +279,7 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
|
||||
var payloadToken = JwtManager.Encode(payload); // encode a payload object into a header token
|
||||
var bodyToken = JwtManager.Encode(body); // encode body into a body token
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
request.Headers.Add(JWTheader, "Bearer " + payloadToken); // add a header Authorization with a header token and Authorization prefix in it
|
||||
|
||||
body.Add("token", bodyToken);
|
||||
|
||||
@ -323,7 +323,7 @@ if (typeof jQuery != "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
@ -352,4 +352,18 @@ if (typeof jQuery != "undefined") {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({ "top": top, "left": left });
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" src="content/images/info.svg" />
|
||||
<img id="info" class="info" src="content/images/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<% foreach (User user in Users.getAllUsers())
|
||||
{ %>
|
||||
@ -97,7 +97,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="content/images/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<% Dictionary<string, string> languages = DocManagerHelper.GetLanguages();
|
||||
foreach (var lang in languages)
|
||||
|
||||
@ -463,13 +463,13 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
if (JwtManager.Enabled && isEmbedded == null)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
|
||||
string token = JwtManager.Decode(headerToken);
|
||||
if (token == null || token.Equals(""))
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
context.Response.Write("JWT validation failed");
|
||||
@ -479,7 +479,7 @@ namespace OnlineEditorsExampleMVC
|
||||
}
|
||||
|
||||
var filePath = DocManagerHelper.ForcesavePath(fileName, userAddress, false); // get the path to the force saved document version
|
||||
if (filePath.Equals(""))
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
filePath = DocManagerHelper.StoragePath(fileName, userAddress); // or to the original document
|
||||
}
|
||||
@ -520,14 +520,14 @@ namespace OnlineEditorsExampleMVC
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
|
||||
string token = JwtManager.Decode(headerToken);
|
||||
|
||||
if (token == null || token.Equals(""))
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
context.Response.Write("JWT validation failed");
|
||||
|
||||
@ -16,7 +16,7 @@
|
||||
|
||||
<add key="files.docservice.verify-peer-off" value="true"/>
|
||||
|
||||
<add key="files.docservice.languages" value="en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese"/>
|
||||
<add key="files.docservice.languages" value="en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA: Test Language"/>
|
||||
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
|
||||
@ -744,3 +744,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img class="info" src="app_themes/images/info.svg" />
|
||||
<img id="info" class="info" src="app_themes/images/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<% foreach (User user in Users.getAllUsers())
|
||||
{ %>
|
||||
@ -99,7 +99,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="app_themes/images/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<% Dictionary<string, string> languages = GetLanguages();
|
||||
foreach (var lang in languages)
|
||||
|
||||
@ -132,7 +132,7 @@ namespace ASC.Api.DocumentConverter
|
||||
var payloadToken = JwtManager.Encode(payload); // encode the payload object to the payload token
|
||||
var bodyToken = JwtManager.Encode(body); // encode the body object to the body token
|
||||
// create header token
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
request.Headers.Add(JWTheader, "Bearer " + payloadToken); // and add it to the request headers with the Bearer prefix
|
||||
|
||||
body.Add("token", bodyToken);
|
||||
|
||||
@ -57,7 +57,7 @@ namespace OnlineEditorsExample
|
||||
// check if the document token is enabled
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
string token = null;
|
||||
|
||||
@ -76,7 +76,7 @@ namespace OnlineEditorsExample
|
||||
context.Response.Write("{\"error\":1,\"message\":\"JWT expected\"}");
|
||||
}
|
||||
|
||||
if (token != null && !token.Equals("")) // invalid signature error
|
||||
if (!string.IsNullOrEmpty(token)) // invalid signature error
|
||||
{
|
||||
fileData = jss.Deserialize<Dictionary<string, object>>(token);
|
||||
if (fileData.ContainsKey("payload"))
|
||||
@ -160,7 +160,7 @@ namespace OnlineEditorsExample
|
||||
File.WriteAllText(Path.Combine(versionDir, "key.txt"), (string)fileData["key"]); // write the key value to the key.txt file
|
||||
|
||||
string forcesavePath = _Default.ForcesavePath(newFileName, userAddress, false); // get the path to the forcesaved file version
|
||||
if (!forcesavePath.Equals("")) // if the forcesaved file version exists
|
||||
if (!string.IsNullOrEmpty(forcesavePath)) // if the forcesaved file version exists
|
||||
{
|
||||
File.Delete(forcesavePath); // remove it
|
||||
}
|
||||
@ -231,7 +231,7 @@ namespace OnlineEditorsExample
|
||||
}
|
||||
|
||||
forcesavePath = _Default.ForcesavePath(fileName, userAddress, false);
|
||||
if (forcesavePath.Equals("")) // create forcesave path if it doesn't exist
|
||||
if (string.IsNullOrEmpty(forcesavePath)) // create forcesave path if it doesn't exist
|
||||
{
|
||||
forcesavePath = _Default.ForcesavePath(fileName, userAddress, true);
|
||||
}
|
||||
@ -282,7 +282,7 @@ namespace OnlineEditorsExample
|
||||
|
||||
var payloadToken = JwtManager.Encode(payload); // encode a payload object into a header token
|
||||
var bodyToken = JwtManager.Encode(body); // encode body into a body token
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
request.Headers.Add(JWTheader, "Bearer " + payloadToken); // add a header Authorization with a header token and Authorization prefix in it
|
||||
|
||||
body.Add("token", bodyToken);
|
||||
|
||||
@ -283,14 +283,14 @@ namespace OnlineEditorsExample
|
||||
|
||||
if (JwtManager.Enabled && isEmbedded == null)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
|
||||
string token = JwtManager.Decode(headerToken);
|
||||
|
||||
if (token == null || token.Equals(""))
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
context.Response.Write("JWT validation failed");
|
||||
@ -300,7 +300,7 @@ namespace OnlineEditorsExample
|
||||
}
|
||||
|
||||
var filePath = _Default.ForcesavePath(fileName, userAddress, false); // get the path to the force saved document version
|
||||
if (filePath.Equals(""))
|
||||
if (string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
filePath = _Default.StoragePath(fileName, userAddress); // or to the original document
|
||||
}
|
||||
@ -340,14 +340,14 @@ namespace OnlineEditorsExample
|
||||
|
||||
if (JwtManager.Enabled)
|
||||
{
|
||||
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
string JWTheader = string.IsNullOrEmpty(WebConfigurationManager.AppSettings["files.docservice.header"]) ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
|
||||
|
||||
if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
|
||||
{
|
||||
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
|
||||
string token = JwtManager.Decode(headerToken);
|
||||
|
||||
if (token == null || token.Equals(""))
|
||||
if (string.IsNullOrEmpty(token))
|
||||
{
|
||||
context.Response.StatusCode = (int)HttpStatusCode.Forbidden;
|
||||
context.Response.Write("JWT validation failed");
|
||||
|
||||
@ -322,7 +322,7 @@ if (typeof jQuery != "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
@ -351,4 +351,18 @@ if (typeof jQuery != "undefined") {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({ "top": top, "left": left });
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
@ -15,7 +15,7 @@
|
||||
<add key="files.docservice.header" value="Authorization" />
|
||||
<add key="files.docservice.verify-peer-off" value="true"/>
|
||||
|
||||
<add key="files.docservice.languages" value="en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese"/>
|
||||
<add key="files.docservice.languages" value="en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA: Test Language"/>
|
||||
|
||||
<add key="files.docservice.url.site" value="http://documentserver/"/>
|
||||
|
||||
|
||||
@ -83,6 +83,31 @@
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>validate</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<configLocation>google_checks.xml</configLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
<failsOnError>true</failsOnError>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<logViolationsToConsole>true</logViolationsToConsole>
|
||||
<violationSeverity>warning</violationSeverity>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<includeTestSourceDirectory>true
|
||||
</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@ -27,7 +27,7 @@ files.docservice.header=Authorization
|
||||
|
||||
files.docservice.verify-peer-off=true
|
||||
|
||||
files.docservice.languages=en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese
|
||||
files.docservice.languages=en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA:Test Language
|
||||
|
||||
spring.datasource.url=jdbc:h2:mem:usersdb
|
||||
spring.datasource.driverClassName=org.h2.Driver
|
||||
|
||||
@ -751,3 +751,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@ -336,7 +336,7 @@ if (typeof jQuery !== "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
@ -366,4 +366,18 @@ if (typeof jQuery !== "undefined") {
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({"top": top, "left": left});
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
|
||||
}
|
||||
@ -85,7 +85,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="css/img/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<option th:each="language: ${languages}"
|
||||
th:value="${language.key}"
|
||||
|
||||
@ -85,6 +85,31 @@
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.17</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>validate</id>
|
||||
<phase>validate</phase>
|
||||
<configuration>
|
||||
<configLocation>google_checks.xml</configLocation>
|
||||
<encoding>UTF-8</encoding>
|
||||
<failsOnError>true</failsOnError>
|
||||
<failOnViolation>true</failOnViolation>
|
||||
<logViolationsToConsole>true</logViolationsToConsole>
|
||||
<violationSeverity>warning</violationSeverity>
|
||||
<consoleOutput>true</consoleOutput>
|
||||
<includeTestSourceDirectory>true
|
||||
</includeTestSourceDirectory>
|
||||
</configuration>
|
||||
<goals>
|
||||
<goal>check</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@ -16,7 +16,7 @@ files.docservice.url.api=web-apps/apps/api/documents/api.js
|
||||
files.docservice.url.preloader=web-apps/apps/api/documents/cache-scripts.html
|
||||
files.docservice.url.example=
|
||||
|
||||
files.docservice.languages=en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese
|
||||
files.docservice.languages=en:English|hy:Armenian|az:Azerbaijani|eu:Basque|be:Belarusian|bg:Bulgarian|ca:Catalan|zh:Chinese (People's Republic of China)|zh-TW:Chinese (Traditional, Taiwan)|cs:Czech|da:Danish|nl:Dutch|fi:Finnish|fr:French|gl:Galego|de:German|el:Greek|hu:Hungarian|id:Indonesian|it:Italian|ja:Japanese|ko:Korean|lv:Latvian|lo:Lao|ms:Malay (Malaysia)|nb:Norwegian|pl:Polish|pt:Portuguese (Brazil)|pt-PT:Portuguese (Portugal)|ro:Romanian|ru:Russian|sk:Slovak|sl:Slovenian|es:Spanish|sv:Swedish|tr:Turkish|uk:Ukrainian|vi:Vietnamese|aa-AA:Test Language
|
||||
|
||||
files.docservice.secret=
|
||||
files.docservice.header=Authorization
|
||||
|
||||
@ -747,3 +747,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" src="css/img/info.svg" />
|
||||
<img id="info" class="info" src="css/img/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<% for (User user : Users.getAllUsers()) { %>
|
||||
<option value="<%= user.id %>"><%= user.name == null ? "Anonymous" : user.name %></option>
|
||||
@ -97,7 +97,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="css/img/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<% Map<String, String> languages = DocumentManager.GetLanguages(); %>
|
||||
<% for (Map.Entry<String, String> language : languages.entrySet()) { %>
|
||||
|
||||
@ -321,7 +321,7 @@ if (typeof jQuery !== "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
@ -350,4 +350,18 @@ if (typeof jQuery !== "undefined") {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({"top": top, "left": left});
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
1
web/documentserver-example/nodejs/.eslintignore
Normal file
1
web/documentserver-example/nodejs/.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
public
|
||||
15
web/documentserver-example/nodejs/.eslintrc.js
Normal file
15
web/documentserver-example/nodejs/.eslintrc.js
Normal file
@ -0,0 +1,15 @@
|
||||
module.exports = {
|
||||
env: {
|
||||
browser: true,
|
||||
commonjs: true,
|
||||
es2021: true,
|
||||
},
|
||||
extends: ['airbnb-base'],
|
||||
overrides: [
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: 'latest',
|
||||
},
|
||||
rules: {
|
||||
},
|
||||
};
|
||||
@ -29,7 +29,6 @@ const config = require('config');
|
||||
const configServer = config.get('server');
|
||||
const storageFolder = configServer.get("storageFolder");
|
||||
const mime = require("mime");
|
||||
const urlModule = require("url");
|
||||
const docManager = require("./helpers/docManager");
|
||||
const documentService = require("./helpers/documentService");
|
||||
const fileUtility = require("./helpers/fileUtility");
|
||||
@ -482,42 +481,24 @@ app.post("/reference", function (req, res) { //define a handler for renaming fil
|
||||
|
||||
var referenceData = req.body.referenceData;
|
||||
if (!!referenceData) {
|
||||
var portalName = referenceData.portalName;
|
||||
var instanceId = referenceData.instanceId;
|
||||
|
||||
if (portalName != req.docManager.getServerUrl()) {
|
||||
result({ "error": "You do not have access to this site" });
|
||||
return;
|
||||
}
|
||||
if (instanceId === req.docManager.getInstanceId()) {
|
||||
var fileKey = JSON.parse(referenceData.fileKey);
|
||||
var userAddress = fileKey.userAddress;
|
||||
|
||||
var fileId = JSON.parse(referenceData.fileId);
|
||||
var userAddress = fileId.userAddress;
|
||||
if (userAddress != req.docManager.curUserHostAddress()) {
|
||||
result({ "error": "You do not have access to this file" });
|
||||
return;
|
||||
if (userAddress === req.docManager.curUserHostAddress()
|
||||
&& req.docManager.existsSync(req.docManager.storagePath(fileKey.fileName, userAddress))) {
|
||||
var fileName = fileKey.fileName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var fileName = fileId.fileName;
|
||||
if (!req.docManager.existsSync(req.docManager.storagePath(fileName, userAddress))) {
|
||||
result({ "error": "File is not exist" });
|
||||
return;
|
||||
}
|
||||
} else if (!!req.body.link) {
|
||||
if (req.body.link.indexOf(req.docManager.curUserHostAddress()) != -1) {
|
||||
result({ "error": "You do not have access to this site" });
|
||||
return;
|
||||
}
|
||||
if (!fileName && !!req.body.path) {
|
||||
var path = fileUtility.getFileName(req.body.path);
|
||||
|
||||
var urlObj = urlModule.parse(req.body.link, true);
|
||||
var fileName = urlObj.query.fileName;
|
||||
if (!req.docManager.existsSync(req.docManager.storagePath(fileName, userAddress))) {
|
||||
result({ "error": "File is not exist" });
|
||||
return;
|
||||
}
|
||||
} else if (!!req.body.path) {
|
||||
var fileName = fileUtility.getFileName(req.body.path);
|
||||
if (!req.docManager.existsSync(req.docManager.storagePath(fileName, userAddress))) {
|
||||
result({ "error": "File is not exist" });
|
||||
return;
|
||||
if (req.docManager.existsSync(req.docManager.storagePath(path, userAddress))) {
|
||||
fileName = path;
|
||||
}
|
||||
}
|
||||
|
||||
@ -530,10 +511,9 @@ app.post("/reference", function (req, res) { //define a handler for renaming fil
|
||||
url: req.docManager.getDownloadUrl(fileName, true),
|
||||
directUrl: req.docManager.getDownloadUrl(fileName),
|
||||
referenceData: {
|
||||
fileId: JSON.stringify({ fileName: fileName, userAddress: req.docManager.curUserHostAddress()}),
|
||||
portalName: req.docManager.getServerUrl()
|
||||
fileKey: JSON.stringify({ fileName: fileName, userAddress: req.docManager.curUserHostAddress()}),
|
||||
instanceId: req.docManager.getServerUrl()
|
||||
},
|
||||
link: req.docManager.getServerUrl() + "/editor?fileName=" + encodeURIComponent(fileName),
|
||||
path: fileName,
|
||||
});
|
||||
});
|
||||
@ -848,11 +828,6 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
}
|
||||
}
|
||||
|
||||
var referenceData = {
|
||||
fileId: JSON.stringify({ fileName: fileName, userAddress: req.docManager.curUserHostAddress()}),
|
||||
portalName: req.docManager.getServerUrl()
|
||||
};
|
||||
|
||||
var type = req.query.type || ""; // type: embedded/mobile/desktop
|
||||
if (type == "") {
|
||||
type = new RegExp(configServer.get("mobileRegEx"), "i").test(req.get('User-Agent')) ? "mobile" : "desktop";
|
||||
@ -1020,7 +995,8 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
submitForm: submitForm,
|
||||
plugins: JSON.stringify(plugins),
|
||||
actionData: actionData,
|
||||
referenceData: userid != "uid-0" ? referenceData : null
|
||||
fileKey: userid != "uid-0" ? JSON.stringify({ fileName: fileName, userAddress: req.docManager.curUserHostAddress()}) : null,
|
||||
instanceId: userid != "uid-0" ? req.docManager.getInstanceId() : null
|
||||
},
|
||||
history: history,
|
||||
historyData: historyData,
|
||||
|
||||
@ -84,7 +84,8 @@
|
||||
"sv": "Swedish",
|
||||
"tr": "Turkish",
|
||||
"uk": "Ukrainian",
|
||||
"vi": "Vietnamese"
|
||||
"vi": "Vietnamese",
|
||||
"aa-AA": "Test Language"
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
|
||||
@ -496,5 +496,9 @@ docManager.prototype.getFilesInfo = function (fileId) {
|
||||
else return responseArray;
|
||||
};
|
||||
|
||||
docManager.prototype.getInstanceId = function () {
|
||||
return this.getServerUrl();
|
||||
};
|
||||
|
||||
// save all the functions to the docManager module to export it later in other files
|
||||
module.exports = docManager;
|
||||
|
||||
@ -22,9 +22,20 @@ var urlModule = require("url");
|
||||
var urllib = require("urllib");
|
||||
const xmlParser = require("fast-xml-parser");
|
||||
const he = require("he");
|
||||
const siteUrl = configServer.get("siteUrl"); // the path to the editors installation
|
||||
|
||||
var cache = null;
|
||||
|
||||
async function initWopi(docManager) {
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf("/") === 0) {
|
||||
absSiteUrl = docManager.getServerHost() + siteUrl;
|
||||
}
|
||||
|
||||
// get the wopi discovery information
|
||||
await getDiscoveryInfo(absSiteUrl);
|
||||
}
|
||||
|
||||
// get the wopi discovery information
|
||||
async function getDiscoveryInfo(siteUrl) {
|
||||
let actions = [];
|
||||
@ -125,6 +136,7 @@ function getActionUrl(host, userAddress, action, filename) {
|
||||
return action.urlsrc.replace(/<.*&>/g, "") + "WOPISrc=" + host + "/wopi/files/" + filename + "@" + userAddress;
|
||||
}
|
||||
|
||||
exports.initWopi = initWopi;
|
||||
exports.getDiscoveryInfo = getDiscoveryInfo;
|
||||
exports.getAction = getAction;
|
||||
exports.getActions = getActions;
|
||||
|
||||
@ -23,7 +23,7 @@ const docManager = require("../docManager");
|
||||
const fileUtility = require("../fileUtility");
|
||||
const config = require('config');
|
||||
const configServer = config.get('server');
|
||||
const siteUrl = configServer.get('siteUrl'); // the path to the editors installation
|
||||
const siteUrl = configServer.get("siteUrl"); // the path to the editors installation
|
||||
const users = require("../users");
|
||||
|
||||
exports.registerRoutes = function(app) {
|
||||
@ -33,24 +33,10 @@ exports.registerRoutes = function(app) {
|
||||
|
||||
req.docManager = new docManager(req, res);
|
||||
|
||||
let absSiteUrl = siteUrl;
|
||||
if (absSiteUrl.indexOf("/") === 0) {
|
||||
absSiteUrl = req.docManager.getServerHost() + siteUrl;
|
||||
|
||||
//todo: remove
|
||||
if (absSiteUrl.indexOf("example") !== -1) {
|
||||
let host = req.get("host");
|
||||
let pos = host.indexOf("/", "https://".length);
|
||||
if (pos > -1)
|
||||
{
|
||||
host = host.substring(0, pos);
|
||||
}
|
||||
absSiteUrl = req.docManager.getProtocol() + "://" + host + siteUrl;
|
||||
}
|
||||
}
|
||||
await utils.initWopi(req.docManager);
|
||||
|
||||
// get the wopi discovery information
|
||||
let actions = await utils.getDiscoveryInfo(absSiteUrl);
|
||||
let actions = await utils.getDiscoveryInfo();
|
||||
let wopiEnable = actions.length != 0 ? true : false;
|
||||
let docsExtEdit = []; // Supported extensions for WOPI
|
||||
|
||||
@ -111,6 +97,8 @@ exports.registerRoutes = function(app) {
|
||||
try {
|
||||
req.docManager = new docManager(req, res);
|
||||
|
||||
await utils.initWopi(req.docManager);
|
||||
|
||||
var fileName = req.docManager.getCorrectName(req.params['id'])
|
||||
var fileExt = fileUtility.getFileExtension(fileName, true); // get the file extension from the request
|
||||
var user = users.getUser(req.query.userid); // get a user by the id
|
||||
|
||||
3281
web/documentserver-example/nodejs/npm-shrinkwrap.json
generated
3281
web/documentserver-example/nodejs/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -3,7 +3,9 @@
|
||||
"version": "4.1.0",
|
||||
"private": false,
|
||||
"scripts": {
|
||||
"start": "node ./bin/www"
|
||||
"start": "node ./bin/www",
|
||||
"lint": "eslint .",
|
||||
"lint:fix": "eslint --fix ."
|
||||
},
|
||||
"bin": "bin/www",
|
||||
"description": "OnlineEditorsExampleNodeJS",
|
||||
@ -40,5 +42,10 @@
|
||||
"public/**/*",
|
||||
"views/*"
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^8.28.0",
|
||||
"eslint-config-airbnb-base": "^15.0.0",
|
||||
"eslint-plugin-import": "^2.26.0"
|
||||
}
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 316 B After Width: | Height: | Size: 316 B |
@ -0,0 +1,5 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<rect width="10" height="2" rx="1" transform="matrix(1.19249e-08 -1 -1 -1.19249e-08 13 13)" fill="#444444"/>
|
||||
<path d="M6.57692 19.6154C6.30247 20.2741 6.78642 21 7.5 21H16.5C17.2136 21 17.6975 20.2741 17.4231 19.6154L15.7564 15.6154C15.6011 15.2427 15.237 15 14.8333 15H9.16667C8.76297 15 8.39886 15.2427 8.24359 15.6154L6.57692 19.6154Z" fill="#444444"/>
|
||||
<path d="M15 14C15 13.2044 14.6839 12.4413 14.1213 11.8787C13.5587 11.3161 12.7956 11 12 11C11.2044 11 10.4413 11.3161 9.87868 11.8787C9.31607 12.4413 9 13.2044 9 14L12 14H15Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 653 B |
@ -0,0 +1,6 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M14.326 18.6739C13.8912 18.2391 13.8912 17.5342 14.326 17.0994L20.0993 11.3261C20.5341 10.8913 21.239 10.8913 21.6738 11.3261C22.1086 11.7609 22.1086 12.4658 21.6738 12.9006L15.9006 18.6739C15.4658 19.1087 14.7608 19.1087 14.326 18.6739Z" fill="#444444"/>
|
||||
<path d="M14.326 5.3261C14.7608 4.8913 15.4658 4.8913 15.9006 5.3261L21.6738 11.0994C22.1086 11.5342 22.1086 12.2391 21.6738 12.6739C21.239 13.1087 20.5341 13.1087 20.0993 12.6739L14.326 6.90063C13.8912 6.46583 13.8912 5.76089 14.326 5.3261Z" fill="#444444"/>
|
||||
<path d="M9.67385 5.3261C10.1086 5.76089 10.1086 6.46583 9.67385 6.90063L3.90061 12.6739C3.46582 13.1087 2.76088 13.1087 2.32609 12.6739C1.8913 12.2391 1.8913 11.5342 2.32609 11.0994L8.09933 5.3261C8.53412 4.8913 9.23905 4.8913 9.67385 5.3261Z" fill="#444444"/>
|
||||
<path d="M9.67385 18.6739C9.23905 19.1087 8.53412 19.1087 8.09933 18.6739L2.32609 12.9006C1.8913 12.4658 1.8913 11.7609 2.32609 11.3261C2.76088 10.8913 3.46582 10.8913 3.90061 11.3261L9.67385 17.0994C10.1086 17.5342 10.1086 18.2391 9.67385 18.6739Z" fill="#444444"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 838 B After Width: | Height: | Size: 838 B |
@ -22,7 +22,10 @@
|
||||
"commentGroups": <%- editor.commentGroups %>,
|
||||
"userInfoGroups": <%- editor.userInfoGroups %>
|
||||
},
|
||||
"referenceData": <%- JSON.stringify(editor.referenceData) %>,
|
||||
"referenceData": {
|
||||
"fileKey": <%- JSON.stringify(editor.fileKey) %>,
|
||||
"instanceId": <%- JSON.stringify(editor.instanceId) %>
|
||||
},
|
||||
"title": "<%- file.name %>",
|
||||
"url": "<%- file.uri %>"
|
||||
},
|
||||
|
||||
@ -158,15 +158,11 @@
|
||||
<% if (storedFiles[i].actions && storedFiles[i].actions.length > 0) { %>
|
||||
<td class="contentCells contentCells-wopi contentCells-shift">
|
||||
<% for (var j = 0; j < storedFiles[i].actions.length; j++) { %>
|
||||
<% if (storedFiles[i].actions[j].name != "editnew") { %>
|
||||
<a href="<%= serverUrl %>/wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].actions[j].name %><%= params %>" target="_blank">
|
||||
<% if (storedFiles[i].actions[j].name == "edit") { %>
|
||||
<img src="images/editor.svg" alt="<%= storedFiles[i].actions[j].name %>" title="<%= storedFiles[i].actions[j].name %>" />
|
||||
<%} else { %>
|
||||
<img src="images/view.svg" alt="<%= storedFiles[i].actions[j].name %>" title="<%= storedFiles[i].actions[j].name %>" />
|
||||
<% } %>
|
||||
</a>
|
||||
<% } %>
|
||||
<a href="<%= serverUrl %>/wopi-action/<%= encodeURIComponent(storedFiles[i].name) %>?action=<%= storedFiles[i].actions[j].name %><%= params %>" target="_blank">
|
||||
<img
|
||||
src="images/wopi-<%= storedFiles[i].actions[j].name %>.svg"
|
||||
alt="<%= storedFiles[i].actions[j].name %>" title="<%= storedFiles[i].actions[j].name %>" />
|
||||
</a>
|
||||
<% } %>
|
||||
</td>
|
||||
<% } %>
|
||||
|
||||
@ -84,6 +84,7 @@ $GLOBALS['LANGUAGES'] = array(
|
||||
'sv' => 'Swedish',
|
||||
'tr' => 'Turkish',
|
||||
'uk' => 'Ukrainian',
|
||||
'vi' => 'Vietnamese'
|
||||
'vi' => 'Vietnamese',
|
||||
'aa-AA' => 'Test Language'
|
||||
);
|
||||
?>
|
||||
@ -740,3 +740,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
@ -88,7 +88,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" src="css/images/info.svg" />
|
||||
<img id="info" class="info" src="css/images/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<?php foreach(getAllUsers() as $user_l) {
|
||||
$name = $user_l->name ? $user_l->name : "Anonymous";
|
||||
@ -99,7 +99,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="css/images/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<?php foreach ($GLOBALS['LANGUAGES'] as $key => $language) { ?>
|
||||
<option value="<?=$key?>"><?=$language?></option>
|
||||
|
||||
@ -343,12 +343,12 @@ if (typeof jQuery != "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
jq(".info").mouseover(function (event) {
|
||||
jq("#info").mouseover(function (event) {
|
||||
if (fileList.length > 0) {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
@ -372,6 +372,20 @@ if (typeof jQuery != "undefined") {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({"top": top, "left": left});
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
|
||||
function getUrlVars() {
|
||||
|
||||
@ -91,7 +91,8 @@ LANGUAGES = {
|
||||
'sv': 'Swedish',
|
||||
'tr': 'Turkish',
|
||||
'uk': 'Ukrainian',
|
||||
'vi': 'Vietnamese'
|
||||
'vi': 'Vietnamese',
|
||||
'aa-AA': 'Test Language'
|
||||
}
|
||||
|
||||
if os.environ.get("EXAMPLE_DOMAIN"): # generates a link for example domain
|
||||
|
||||
@ -749,3 +749,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
@ -317,7 +317,7 @@ if (typeof jQuery !== "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
@ -357,4 +357,18 @@ if (typeof jQuery !== "undefined") {
|
||||
}
|
||||
return vars;
|
||||
};
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({"top": top, "left": left});
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
@ -86,7 +86,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" src="{% static "images/info.svg" %}" />
|
||||
<img id="info" class="info" src="{% static "images/info.svg" %}" />
|
||||
<select class="select-user" id="user">
|
||||
{% for user in users %}
|
||||
<option value="{{ user.id }}">{% if user.name %} {{ user.name }} {% else %} Anonymous {% endif %} </option>
|
||||
@ -96,7 +96,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="{% static "images/info.svg" %}" />
|
||||
<select class="select-user" id="language">
|
||||
{% for key, val in languages.items %}
|
||||
<option value="{{ key }}">{{ val }}</option>
|
||||
|
||||
@ -17,11 +17,13 @@
|
||||
*/
|
||||
|
||||
var directUrl;
|
||||
var userId;
|
||||
|
||||
if (typeof jQuery != "undefined") {
|
||||
jq = jQuery.noConflict();
|
||||
|
||||
directUrl = getUrlVars()["directUrl"] == "true";
|
||||
userId = getUrlVars()["userId"];
|
||||
|
||||
mustReload = false;
|
||||
|
||||
@ -29,11 +31,20 @@ if (typeof jQuery != "undefined") {
|
||||
jq("#directUrl").prop("checked", directUrl);
|
||||
else
|
||||
directUrl = jq("#directUrl").prop("checked");
|
||||
|
||||
|
||||
jq("#directUrl").change(function() {
|
||||
window.location = "?directUrl=" + jq(this).prop("checked");
|
||||
window.location = "?directUrl=" + jq(this).prop("checked") + "&userId=" + userId;
|
||||
});
|
||||
|
||||
if (userId)
|
||||
jq("#user").val(userId);
|
||||
else
|
||||
userId = jq("#user").val();
|
||||
|
||||
jq("#user").change(function() {
|
||||
window.location = "?directUrl=" + directUrl + "&userId=" + jq(this).val();
|
||||
});
|
||||
|
||||
jq(function () {
|
||||
jq('#fileupload').fileupload({
|
||||
dataType: 'json',
|
||||
@ -186,7 +197,6 @@ if (typeof jQuery != "undefined") {
|
||||
};
|
||||
|
||||
var initSelectors = function () {
|
||||
var userSel = jq("#user");
|
||||
var langSel = jq("#language");
|
||||
|
||||
function getCookie(name) {
|
||||
@ -199,14 +209,9 @@ if (typeof jQuery != "undefined") {
|
||||
document.cookie = name + "=" + value + "; expires=" + new Date(Date.now() + 1000 * 60 * 60 * 24 * 7).toUTCString(); //week
|
||||
}
|
||||
|
||||
var userId = getCookie("uid");
|
||||
if (userId) userSel.val(userId);
|
||||
var langId = getCookie("ulang");
|
||||
if (langId) langSel.val(langId);
|
||||
|
||||
userSel.on("change", function () {
|
||||
setCookie("uid", userSel.val());
|
||||
});
|
||||
langSel.on("change", function () {
|
||||
setCookie("ulang", langSel.val());
|
||||
});
|
||||
@ -231,7 +236,7 @@ if (typeof jQuery != "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEdit:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
var url = UrlEditor + "?fileName=" + fileId + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?fileName=" + fileId + "&directUrl=" + directUrl + "&userId=" + userId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
@ -239,7 +244,7 @@ if (typeof jQuery != "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginView:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
var url = UrlEditor + "?editorsMode=view&fileName=" + fileId + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?editorsMode=view&fileName=" + fileId + "&directUrl=" + directUrl + "&userId=" + userId;
|
||||
window.open(url, "_blank");
|
||||
jq('#hiddenFileName').val("");
|
||||
jq.unblockUI();
|
||||
@ -247,7 +252,7 @@ if (typeof jQuery != "undefined") {
|
||||
|
||||
jq(document).on("click", "#beginEmbedded:not(.disable)", function () {
|
||||
var fileId = encodeURIComponent(jq('#hiddenFileName').val());
|
||||
var url = UrlEditor + "?editorsType=embedded&editorsMode=embedded&fileName=" + fileId + "&directUrl=" + directUrl;
|
||||
var url = UrlEditor + "?editorsType=embedded&editorsMode=embedded&fileName=" + fileId + "&directUrl=" + directUrl + "&userId=" + userId;
|
||||
|
||||
jq("#mainProgress").addClass("embedded");
|
||||
jq("#beginEmbedded").addClass("disable");
|
||||
@ -269,6 +274,9 @@ if (typeof jQuery != "undefined") {
|
||||
if (jq("#createSample").is(":checked")) {
|
||||
url += "&sample=true";
|
||||
}
|
||||
if (userId) {
|
||||
url += "&userId=" + userId;
|
||||
}
|
||||
var w = window.open(url, "_blank");
|
||||
w.onload = function () {
|
||||
window.location.reload();
|
||||
@ -320,12 +328,12 @@ if (typeof jQuery != "undefined") {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
}
|
||||
jq(".info").on("touchend", function () {
|
||||
jq("#info").on("touchend", function () {
|
||||
showUserTooltip(true);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
jq(".info").mouseover(function (event) {
|
||||
jq("#info").mouseover(function (event) {
|
||||
if (fileList.length > 0) {
|
||||
if (hideTooltipTimeout != null) {
|
||||
clearTimeout(hideTooltipTimeout);
|
||||
@ -349,4 +357,18 @@ if (typeof jQuery != "undefined") {
|
||||
}, 500);
|
||||
});
|
||||
}
|
||||
|
||||
jq(".info-tooltip").mouseover(function (event) {
|
||||
var target = event.target;
|
||||
var id = target.dataset.id ? target.dataset.id : target.id;
|
||||
var tooltip = target.dataset.tooltip;
|
||||
|
||||
jq("<div class='tooltip'>" + tooltip + "<div class='arrow'></div></div>").appendTo("body");
|
||||
|
||||
var top = jq("#" + id).offset().top + jq("#" + id).outerHeight() / 2 - jq("div.tooltip").outerHeight() / 2;
|
||||
var left = jq("#" + id).offset().left + jq("#" + id).outerWidth() + 20;
|
||||
jq("div.tooltip").css({"top": top, "left": left});
|
||||
}).mouseout(function () {
|
||||
jq("div.tooltip").remove();
|
||||
});
|
||||
}
|
||||
@ -742,3 +742,28 @@ html {
|
||||
.user-descr > b {
|
||||
margin-left: 25px;
|
||||
}
|
||||
|
||||
.tooltip {
|
||||
background: #FFFFFF;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
|
||||
color: #666666;
|
||||
line-height: 160%;
|
||||
max-width: 455px;
|
||||
padding: 14px;
|
||||
position: absolute;
|
||||
}
|
||||
|
||||
.tooltip ul {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.arrow {
|
||||
border-top: 8px solid transparent;
|
||||
border-bottom: 8px solid transparent;
|
||||
border-right: 8px solid #FFFFFF;
|
||||
left: -4px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
transform: translate(-50%, -50%);
|
||||
}
|
||||
|
||||
@ -24,8 +24,7 @@ class HomeController < ApplicationController
|
||||
def editor
|
||||
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
user = Users.get_user(cookies[:uid])
|
||||
|
||||
user = Users.get_user(params[:userId])
|
||||
@file = FileModel.new(:file_name => File.basename(params[:fileName]), :mode => params[:editorsMode], :type => params[:editorsType], :user_ip => request.remote_ip, :lang => cookies[:ulang], :user => user, :action_data => params[:actionLink], :direct_url => params[:directUrl])
|
||||
|
||||
end
|
||||
@ -34,10 +33,9 @@ class HomeController < ApplicationController
|
||||
def sample
|
||||
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
user = Users.get_user(cookies[:uid])
|
||||
|
||||
user = Users.get_user(params[:userId])
|
||||
file_name = DocumentHelper.create_demo(params[:fileExt], params[:sample], user)
|
||||
redirect_to :controller => 'home', :action => 'editor', :fileName => file_name
|
||||
redirect_to :controller => 'home', :action => 'editor', :fileName => file_name, :userId => user.id
|
||||
|
||||
end
|
||||
|
||||
@ -73,7 +71,7 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
# create file meta information
|
||||
user = Users.get_user(cookies[:uid])
|
||||
user = Users.get_user(params[:userId])
|
||||
|
||||
DocumentHelper.create_meta(file_name, user.id, user.name, nil)
|
||||
|
||||
@ -134,7 +132,7 @@ class HomeController < ApplicationController
|
||||
end
|
||||
|
||||
file_name = correct_name
|
||||
user = Users.get_user(cookies[:uid])
|
||||
user = Users.get_user(params[:userId])
|
||||
|
||||
DocumentHelper.create_meta(file_name, user.id, user.name, nil) # create meta data of the new file
|
||||
end
|
||||
@ -335,7 +333,7 @@ class HomeController < ApplicationController
|
||||
File.open(DocumentHelper.storage_path(file_name, nil), 'wb') do |file|
|
||||
file.write(data)
|
||||
end
|
||||
user = Users.get_user(cookies[:uid])
|
||||
user = Users.get_user(params[:userId])
|
||||
DocumentHelper.create_meta(file_name, user.id, user.name, nil) # create meta data of the new file
|
||||
|
||||
render plain: '{"file" : "' + file_name + '"}'
|
||||
|
||||
@ -60,7 +60,7 @@
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Username</span>
|
||||
<img id="info" data-id="user" src="assets/info.svg" />
|
||||
<img id="info" class="info" data-id="user" src="assets/info.svg" />
|
||||
<select class="select-user" id="user">
|
||||
<% for user in Users.get_all_users() do %>
|
||||
<option value="<%= user.id %>"><%= user.name ? user.name : "Anonymous" %></option>
|
||||
@ -70,7 +70,10 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td valign="middle">
|
||||
<span class="select-user">Language editors interface</span>
|
||||
<span class="select-user">Language</span>
|
||||
<img class="info info-tooltip" data-id="language"
|
||||
data-tooltip="Choose the language for ONLYOFFICE editors interface"
|
||||
src="assets/info.svg" />
|
||||
<select class="select-user" id="language">
|
||||
<% Rails.configuration.languages.each { |key, language|%>
|
||||
<option value="<%=key %>"> <%=language %> </option>
|
||||
@ -96,6 +99,7 @@
|
||||
DocumentHelper.init(request.remote_ip, request.base_url)
|
||||
docs = DocumentHelper.get_stored_files(nil)
|
||||
directUrl = request.params[:directUrl]
|
||||
userId = request.params[:userId]
|
||||
%>
|
||||
<div class="main-panel">
|
||||
<div id="portal-info" style="display: <%= docs.length > 0 ? "none" : "table-cell" %>">
|
||||
@ -137,7 +141,9 @@
|
||||
<%
|
||||
docs.each { |d|
|
||||
isFillFormDoc = DocumentHelper.fill_forms_exts.include?(File.extname(d).downcase)
|
||||
editUrl = directUrl == nil ? "editor?fileName=#{ERB::Util.url_encode(d)}" : "editor?fileName=#{ERB::Util.url_encode(d)}&directUrl=#{directUrl}"
|
||||
userIdParam = userId == nil ? "" : "&userId=#{userId}";
|
||||
directUrlParam = directUrl == nil ? "" : "&directUrl=#{directUrl}";
|
||||
editUrl = "editor?fileName=#{ERB::Util.url_encode(d)}" + directUrlParam + userIdParam;
|
||||
docType = FileUtility.get_file_type(d)
|
||||
canEdit = DocumentHelper.edited_exts.include?(File.extname(d).downcase) %>
|
||||
<tr class="tableRow" title="<%= d %> [<%= DocumentHelper.get_file_version(DocumentHelper.history_dir(DocumentHelper.storage_path(d, nil))) %>]">
|
||||
|
||||
@ -88,7 +88,8 @@ module OnlineEditorsExampleRuby
|
||||
'sv' => 'Swedish',
|
||||
'tr' => 'Turkish',
|
||||
'uk' => 'Ukrainian',
|
||||
'vi' => 'Vietnamese'
|
||||
'vi' => 'Vietnamese',
|
||||
'aa-AA' => 'Test Language'
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user