Compare commits

..

49 Commits

Author SHA1 Message Date
307e5dcc63 users tooltip layout remake, add scroll 2021-09-21 23:36:05 +03:00
18d8d8258d netcore: fix user tooltip size 2021-09-14 12:29:35 +03:00
ec01bf8a3a netcore: add .oxps 2021-09-14 10:19:19 +03:00
f8f9e9cff0 layout fix 2021-09-02 13:49:56 +03:00
0c02148cb8 update layout for ie11 2021-08-26 20:21:25 +03:00
df7b372b1f net-core: set header height 48px 2021-08-23 17:01:51 +03:00
7d04bb5252 netcore: set image url for Blank template "" 2021-07-29 13:37:27 +03:00
25ebaf8844 netcore: add 3rd-Party licenses 2021-07-29 11:59:49 +03:00
b5f8487240 netcore: fix convert data from token 2021-07-29 11:31:39 +03:00
8347133022 netcore: add template submodule 2021-07-28 20:38:03 +03:00
4cb48a2db9 netcore: remove template submodule and replace project files from OnlineEditorsExampleNetCore folder to csharp-core folder 2021-07-28 20:36:20 +03:00
c180cc7d12 netcore: add copyrights 2021-07-28 18:28:12 +03:00
d460a65f38 netcore: set default token secret as "", fix request anonymous name in editor 2021-07-28 18:07:56 +03:00
1bae3ba53a netcore: remove title on span 2021-07-28 10:55:18 +03:00
63e8029d0d netcore: update README.md 2021-07-27 22:49:00 +03:00
f1d1989756 netcore: add template submodule 2021-07-27 21:25:08 +03:00
c6e2a6bcb2 delete assets folder and move LICENSE and AUTHORS from assets to root folder 2021-07-27 21:22:47 +03:00
e338311423 csharp-core: fixed jwt 2021-07-27 11:07:05 +03:00
35f397de20 csharp-core: edited appsettings.json 2021-07-22 13:28:56 +03:00
6dea1c1422 csharp-core: edited launchSettings.json 2021-07-22 13:26:07 +03:00
03f55e661e csharp-core: fixed version history 2021-07-22 11:47:14 +03:00
7a416b107f csharp-core: added new information to readme.md 2021-07-22 10:01:32 +03:00
8135aae7b0 csharp-core: fixed layout 2021-07-21 18:30:03 +03:00
a652a9f1f1 csharp-core: added 3d-party.license 2021-07-21 18:27:08 +03:00
650266133e csharp-core: edited readme 2021-07-21 17:40:23 +03:00
167d8d5059 csharp-core: fixed download 2021-07-21 13:27:29 +03:00
5ba8c4e8f7 csharp-core: fixed convertation 2021-07-20 14:56:58 +03:00
99e41cde5f csharp-core: changed storing a folder assets and files, fixed version history 2021-07-20 11:30:09 +03:00
08072226a5 csharp-core: added new class for serialize responseFromService 2021-07-16 19:31:28 +03:00
858e14a47d csharp-core: added mentions, comment groups, create from templates features, fixed convertion, history, changed icons to svg 2021-07-16 19:28:51 +03:00
621319554b Merge branch 'feature/netcore-project' of https://github.com/ONLYOFFICE/document-server-integration into feature/netcore-project 2021-07-14 12:32:28 +03:00
88eabbf40d netcore: media.css 2021-07-13 17:47:50 +03:00
c1cad2eb6b netcore: adaptive layout 2021-07-13 17:35:51 +03:00
5ae9c11bc5 Merge remote-tracking branch 'remotes/origin/develop' into feature/netcore-project 2021-07-13 15:07:24 +03:00
f84dda21f7 csharp-core: fixed homecontroller 2021-07-13 13:12:23 +03:00
c342740d44 csharp-core: fixed created with sample document and refactored 2021-07-13 11:08:31 +03:00
0cc832652d csharp-core: fixed upload method, styles and added partial views 2021-07-12 23:41:02 +03:00
bdda8a8ed1 csharp-core: upload 2021-07-12 15:55:38 +03:00
263388f1b8 csharp-core: refactor 2021-07-12 15:55:09 +03:00
c0fd4c00d5 csharp-core: refactoring and removed unnecessary packages 2021-07-09 13:37:53 +03:00
63893d2476 csharp-core: fixed track method, download and remove options 2021-07-06 15:32:33 +03:00
fa02a16376 csharp-core: track method refactor 2021-07-05 18:28:16 +03:00
4e7f4f2336 csharp-core: edited homecontroller 2021-07-05 16:11:32 +03:00
3c0384f581 csharp-core: fixed webeditor service and RoutingMiddleware 2021-07-02 16:06:55 +03:00
880fa47e49 csharp-core: added jwt and changed webeditor service to async 2021-07-01 18:51:58 +03:00
272e2f5a15 csharp-core: added webeditor service and fixed bugs 2021-06-28 19:21:57 +03:00
bbdd54712b csharp-core: added rest web api and edited config 2021-06-24 18:58:06 +03:00
2cd2251f2c csharp-core: added editor, index views, config 2021-06-22 18:41:29 +03:00
4595376ee2 netcore: created example of integration on netcore 2021-06-17 12:24:44 +03:00
720 changed files with 70098 additions and 43343 deletions

View File

@ -1,33 +0,0 @@
name: Artifact Csharp MVC
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/csharp-mvc/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/csharp-mvc/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/csharp-mvc
mkdir -p ./deploy/'DotNet (Csharp MVN) Example'
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp MVC) Example'
cd ./deploy/'DotNet (Csharp MVC) Example'/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: DotNet.Csharp.MVC.Example
path: ${{ github.workspace }}/web/documentserver-example/csharp-mvc/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Csharp
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/csharp/**']
pull_request:
branches: [master, main, develop]
paths: ['web/documentserver-example/csharp/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/csharp
mkdir -p ./deploy/'DotNet (Csharp) Example'
rsync -av --exclude='deploy' ./ ./deploy/'DotNet (Csharp) Example'
cd ./deploy/'DotNet (Csharp) Example'/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: DotNet.Csharp.Example
path: ${{ github.workspace }}/web/documentserver-example/csharp/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Java
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/java/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/java/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/java
mkdir -p ./deploy/'Java Example'
rsync -av --exclude='deploy' ./ ./deploy/'Java Example'
cd ./deploy/'Java Example'/src/main/resources/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Java.Example
path: ${{ github.workspace }}/web/documentserver-example/java/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Nodejs
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/nodejs/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/nodejs/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/nodejs
mkdir -p ./deploy/'Node.js Example'
rsync -av --exclude='deploy' ./ ./deploy/'Node.js Example'
cd ./deploy/'Node.js Example'/public/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Node.js.Example
path: ${{ github.workspace }}/web/documentserver-example/nodejs/deploy

View File

@ -1,33 +0,0 @@
name: Artifact PHP
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/php/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/php/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/php
mkdir -p ./deploy/'PHP Example'
rsync -av --exclude='deploy' ./ ./deploy/'PHP Example'
cd ./deploy/'PHP Example'/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: PHP.Example
path: ${{ github.workspace }}/web/documentserver-example/php/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Python
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/python/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/python/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/python
mkdir -p ./deploy/'Python Example'
rsync -av --exclude='deploy' ./ ./deploy/'Python Example'
cd ./deploy/'Python Example'/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Python.Example
path: ${{ github.workspace }}/web/documentserver-example/python/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Ruby
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/ruby/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/ruby/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/ruby
mkdir -p ./deploy/'Ruby Example'
rsync -av --exclude='deploy' ./ ./deploy/'Ruby Example'
cd ./deploy/'Ruby Example'/public/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Ruby.Example
path: ${{ github.workspace }}/web/documentserver-example/ruby/deploy

View File

@ -1,33 +0,0 @@
name: Artifact Java Spring
on:
workflow_dispatch:
push:
branches: [master, main]
paths: ['web/documentserver-example/java-spring/**']
pull_request:
branches: [master, main]
paths: ['web/documentserver-example/java-spring/**']
jobs:
artifact:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Build Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/java-spring
mkdir -p ./deploy/'Java Spring Example'
rsync -av --exclude='deploy' ./ ./deploy/'Java Spring Example'
cd ./deploy/'Java Spring Example'/src/main/resources/assets
rm -rf ./.git/
rm .git
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: Java.Spring.Example
path: ${{ github.workspace }}/web/documentserver-example/java-spring/deploy

View File

@ -1,31 +0,0 @@
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

View File

@ -1,35 +0,0 @@
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

View File

@ -1,29 +0,0 @@
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.2'
tools: cs2pr, phpcs
- name: Lint
run: phpcs src index.php

View File

@ -1,40 +0,0 @@
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

View File

@ -1,31 +0,0 @@
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

View File

@ -1,31 +0,0 @@
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

View File

@ -1,146 +0,0 @@
name: Release
on:
push:
branches: [master,main]
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Zip
run: sudo apt-get install zip
- name: Get Info
run: |
echo "version=$(grep -Eo '[0-9]+(\.[0-9]+)+' CHANGELOG.md | head -n 1)" >> $GITHUB_OUTPUT
id: info
- name: Generate Changelog
run: |
awk '/## [0-9]/{p++} p; /## [0-9]/{if (p > 1) exit}' CHANGELOG.md | awk 'NR>2 {print last} {last=$0}' > RELEASE.md
- name: Build Csharp MVC Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/csharp-mvc
mkdir -p ./'DotNet (Csharp MVC) Example'
rsync -av --exclude='DotNet (Csharp MVC) Example' ./ ./'DotNet (Csharp MVC) Example'
cd ./'DotNet (Csharp MVC) Example'/assets
rm -rf ./.git/
rm .git
- name: Build Csharp Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/csharp
mkdir -p ./'DotNet (Csharp) Example'
rsync -av --exclude='DotNet (Csharp) Example' ./ ./'DotNet (Csharp) Example'
cd ./'DotNet (Csharp) Example'/assets
rm -rf ./.git/
rm .git
- name: Build Java Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/java
mkdir -p ./'Java Example'
rsync -av --exclude='Java Example' ./ ./'Java Example'
cd ./'Java Example'/src/main/resources/assets
rm -rf ./.git/
rm .git
- name: Build Nodejs Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/nodejs
mkdir -p ./'Node.js Example'
rsync -av --exclude='Node.js Example' ./ ./'Node.js Example'
cd ./'Node.js Example'/public/assets
rm -rf ./.git/
rm .git
- name: Build PHP Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/php
mkdir -p ./'PHP Example'
rsync -av --exclude='PHP Example' ./ ./'PHP Example'
cd ./'PHP Example'/assets
rm -rf ./.git/
rm .git
- name: Build Python Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/python
mkdir -p ./'Python Example'
rsync -av --exclude='Python Example' ./ ./'Python Example'
cd ./'Python Example'/assets
rm -rf ./.git/
rm .git
- name: Build Ruby Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/ruby
mkdir -p ./'Ruby Example'
rsync -av --exclude='Ruby Example' ./ ./'Ruby Example'
cd ./'Ruby Example'/public/assets
rm -rf ./.git/
rm .git
- name: Build Spring Artifact
run: |
cd ${{ github.workspace }}
cwd=$(pwd)
git submodule update --init --recursive
cd ./web/documentserver-example/java-spring
mkdir -p ./'Java Spring Example'
rsync -av --exclude='Java Spring Example' ./ ./'Java Spring Example'
cd ./'Java Spring Example'/src/main/resources/assets
rm -rf ./.git/
rm .git
- name: Pack Artifacts
run: |
cd ${{ github.workspace }}/web/documentserver-example/csharp-mvc
zip -r DotNet.Csharp.MVC.Example.zip ./'DotNet (Csharp MVC) Example'
cd ${{ github.workspace }}/web/documentserver-example/csharp
zip -r DotNet.Csharp.Example.zip ./'DotNet (Csharp) Example'
cd ${{ github.workspace }}/web/documentserver-example/java
zip -r Java.Example.zip ./'Java Example'
cd ${{ github.workspace }}/web/documentserver-example/nodejs
zip -r Node.js.Example.zip ./'Node.js Example'
cd ${{ github.workspace }}/web/documentserver-example/php
zip -r PHP.Example.zip ./'PHP Example'
cd ${{ github.workspace }}/web/documentserver-example/python
zip -r Python.Example.zip ./'Python Example'
cd ${{ github.workspace }}/web/documentserver-example/ruby
zip -r Ruby.Example.zip ./'Ruby Example'
cd ${{ github.workspace }}/web/documentserver-example/java-spring
zip -r Java.Spring.Example.zip ./'Java Spring Example'
- name: Create Release
uses: ncipollo/release-action@v1
id: create_release
with:
bodyFile: RELEASE.md
artifacts: "
${{ github.workspace }}/web/documentserver-example/csharp-mvc/DotNet.Csharp.MVC.Example.zip,
${{ github.workspace }}/web/documentserver-example/csharp/DotNet.Csharp.Example.zip,
${{ github.workspace }}/web/documentserver-example/java/Java.Example.zip,
${{ github.workspace }}/web/documentserver-example/nodejs/Node.js.Example.zip,
${{ github.workspace }}/web/documentserver-example/php/PHP.Example.zip,
${{ github.workspace }}/web/documentserver-example/python/Python.Example.zip,
${{ github.workspace }}/web/documentserver-example/ruby/Ruby.Example.zip,
${{ github.workspace }}/web/documentserver-example/java-spring/Java.Spring.Example.zip
"
tag: v${{ steps.info.outputs.version }}

8
.gitignore vendored
View File

@ -11,14 +11,6 @@
**/.vscode/
**/.vs/
**/.idea
.classpath
.project
.settings/
*.iml
*.iws
.DS_Store
/web/documentserver-example/java/target/
/web/documentserver-example/java-spring/target/
/web/documentserver-example/csharp/packages
/web/documentserver-example/csharp-mvc/packages
/web/documentserver-example/java-spring/documents/

56
.gitmodules vendored
View File

@ -1,3 +1,19 @@
[submodule "web/documentserver-example/nodejs/public/assets"]
path = web/documentserver-example/nodejs/public/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java/src/main/resources/assets"]
path = web/documentserver-example/java/src/main/resources/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/php/assets"]
path = web/documentserver-example/php/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/python/assets"]
path = web/documentserver-example/python/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/csharp-mvc/assets"]
path = web/documentserver-example/csharp-mvc/assets
url = https://github.com/ONLYOFFICE/document-templates
@ -6,43 +22,11 @@
path = web/documentserver-example/csharp/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/nodejs/public/assets/document-templates"]
path = web/documentserver-example/nodejs/public/assets/document-templates
[submodule "web/documentserver-example/ruby/public/assets"]
path = web/documentserver-example/ruby/public/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/nodejs/public/assets/document-formats"]
path = web/documentserver-example/nodejs/public/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = master
[submodule "web/documentserver-example/php/assets/document-templates"]
path = web/documentserver-example/php/assets/document-templates
[submodule "web/documentserver-example/csharp-core/wwwroot/assets"]
path = web/documentserver-example/csharp-core/wwwroot/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/php/assets/document-formats"]
path = web/documentserver-example/php/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = master
[submodule "web/documentserver-example/python/assets/document-templates"]
path = web/documentserver-example/python/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/ruby/assets/document-templates"]
path = web/documentserver-example/ruby/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/java-spring/src/main/resources/assets/document-templates"]
path = web/documentserver-example/java-spring/src/main/resources/assets/document-templates
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/python/assets/document-formats"]
path = web/documentserver-example/python/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = master
[submodule "web/documentserver-example/ruby/assets/document-formats"]
path = web/documentserver-example/ruby/assets/document-formats
url = https://github.com/ONLYOFFICE/document-formats
branch = master

View File

@ -3,6 +3,10 @@ Document Server integration example uses code from the following 3rd party proje
web/documentserver-example/csharp
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -15,26 +19,10 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
JWT - JWT (JSON Web Token) Implementation for .NET (Public Domain) (https://github.com/jwt-dotnet/jwt/)
License: MIT
License File: JWT.license
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://github.com/JamesNK/Newtonsoft.Json)
License: MIT
License File: Newtonsoft.Json.license
web/documentserver-example/csharp-mvc
@ -42,6 +30,10 @@ Entity Framework - Entity Framework is an object-relational mapper that enables
License: MICROSOFT SOFTWARE SUPPLEMENTAL TERMS, MICROSOFT SOFTWARE LICENSE TERMS
License File: EntityFramework.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -54,27 +46,15 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
JWT - JWT (JSON Web Token) Implementation for .NET (Public Domain) (https://github.com/jwt-dotnet/jwt/)
License: MIT
License File: JWT.license
Microsoft.Web.Infrastructure - This package contains the Microsoft.Web.Infrastructure assembly that lets you dynamically register HTTP modules at run time. (https://www.microsoft.com/web/webpi/eula/aspnetmvc3update-eula.htm)
License: MS-EULA License
License File: Microsoft.Web.Infrastructure.license
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://github.com/JamesNK/Newtonsoft.Json)
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://licenses.nuget.org/MIT)
License: MIT
License File: Newtonsoft.Json.license
@ -85,49 +65,10 @@ License File: WebGrease.license
web/documentserver-example/java
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.FileUpload.license
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE)
License: Apache 2.0
License File: prime-jwt.license
web/documentserver-example/java-spring
Gson - Gson is a Java library that can be used to convert Java Objects into their JSON representation. (https://github.com/google/gson/blob/master/LICENSE)
License: Apache 2.0
License File: gson.license
H2 Database Engine - This software contains unmodified binary redistributions for H2 database engine. H2 is a relational DBMS that can be embedded in java applications. (https://h2database.com/html/license.html)
License: MPL 2.0 or EPL 1.0
License File: h2database.license
Jackson Databind - General-purpose data-binding functionality and tree-model for Jackson Data Processor. (https://github.com/FasterXML/jackson-databind/blob/master/LICENSE)
License: Apache 2.0
License File: jackson-databind.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -140,50 +81,14 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
JSON.simple - JSON.simple is a simple Java toolkit for JSON. You can use JSON.simple to encode or decode JSON text. (https://github.com/fangyidong/json-simple/blob/master/LICENSE.txt)
License: Apache 2.0
License File: JSON.simple.license
Project Lombok - Project Lombok is a java library that automatically plugs into your editor and build tools. (https://mvnrepository.com/artifact/org.projectlombok/lombok).
License: MIT
License File lombok.license
ModelMapper - ModelMapper is an intelligent object mapping library that automatically maps objects to each other. (https://github.com/modelmapper/modelmapper)
License: Apache 2.0
License File modelmapper.license
Prime JWT - is intended to be fast and easy to use. Prime JWT has a single external dependency on Jackson. (https://github.com/ws-apps/prime-jwt/blob/master/LICENSE)
License: Apache 2.0
License File: prime-jwt.license
Spring Boot - Helps create Spring-powered, production-grade applications and services. Has external dependencies on Spring Framework. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt)
License: Apache 2.0
License File: spring-boot.license
Spring Boot Devtools - Provides fast application restarts, LiveReload, and configurations for enhanced development experience. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt)
License: Apache 2.0
License File: spring-boot.license
Spring Boot Starter Thymeleaf - A modern server-side Java template engine for both web and standalone environments. (https://github.com/spring-projects/spring-boot/blob/main/LICENSE.txt)
License: Apache 2.0
License File: spring-boot.license
Spring Data JPA - Persist data in SQL stores with Java Persistence API using Spring Data and Hibernate. (https://github.com/spring-projects/spring-data-jpa/blob/main/LICENSE.txt)
License: Apache 2.0
License File: spring-data-jpa.license
web/documentserver-example/nodejs
@ -219,6 +124,10 @@ he - a robust HTML entity encoder/decoder written in JavaScript. (htt
License: MIT
License File: he.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -231,14 +140,6 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
@ -263,73 +164,21 @@ serve-favicon - Node.js middleware for serving a favicon. (https://github.com/ex
License: MIT
License File: serve-favicon.license
sync-request - Make synchronous web requests with cross-platform support. (https://github.com/ForbesLindesay/sync-request/blob/master/LICENSE)
License: MIT
License File: sync-request.license
urllib - Request HTTP URLs in a complex world — basic and digest authentication, redirections, cookies, timeout and more. (https://github.com/node-modules/urllib/blob/master/LICENSE)
License: MIT
License File: urllib.license
web/documentserver-example/php
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.FileUpload.license
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
JWT - JSON Web Token implementation (https://github.com/firebase/php-jwt/blob/master/LICENSE)
License: BSD-3-Clause
License File: jwt.license
PHP_CodeSniffer - PHP_CodeSniffer is a set of two PHP scripts; the main phpcs script that tokenizes PHP, JavaScript and CSS files to detect violations of a defined coding standard, and a second phpcbf script to automatically correct coding standard violations. PHP_CodeSniffer is an essential development tool that ensures your code remains clean and consistent. (https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt)
License: BSD-3-Clause
License File: PHP_CodeSniffer.license
PHPUnit - The PHP Unit Testing framework. (https://github.com/sebastianbergmann/phpunit/blob/main/LICENSE)
License: BSD 3-Clause
License File: phpunit.license
property-access - Provides functions to read and write from/to an object or array using a simple string notation. (https://github.com/symfony/property-access/blob/6.3/LICENSE)
License: MIT
License File: property-access.license
serializer - Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON. (https://github.com/symfony/serializer/blob/6.3/LICENSE)
License: MIT
License File: serializer.license
web/documentserver-example/python
django-stubs - PEP-484 stubs for Django. (https://github.com/typeddjango/django-stubs/blob/master/LICENSE.md)
License: MIT
License File: django-stubs.license
Django - Django is a high-level Python web framework that encourages rapid development and clean, pragmatic design. Thanks for checking it out. (https://github.com/django/django/blob/main/LICENSE)
License: BSD-3-Clause
License File: Django.license
flake8 - flake8 is a python tool that glues together pycodestyle, pyflakes, mccabe, and third-party plugins to check the style and quality of some python code. (https://github.com/PyCQA/flake8/blob/main/LICENSE)
License: MIT
License File: flake8.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -342,42 +191,10 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
msgspec - A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML. (https://github.com/jcrist/msgspec/blob/0.18.1/LICENSE)
License: BSD 3-Clause
License File: msgspec.license
mypy - Optional static typing for Python. (https://github.com/python/mypy/blob/master/LICENSE)
License: MIT
License File: mypy.license
PyJWT - A Python implementation of RFC 7519. (https://github.com/jpadilla/pyjwt/blob/master/LICENSE)
License: MIT
License File: PyJWT.license
python-magic - python-magic is a Python interface to the libmagic file type identification library. (https://github.com/ahupp/python-magic/blob/master/LICENSE)
License: MIT
License File: python-magic.license
requests - Requests allows you to send HTTP/1.1 requests extremely easily. Theres no need to manually add query strings to your URLs, or to form-encode your PUT & POST data — but nowadays, just use the json method! (https://github.com/psf/requests/blob/main/LICENSE)
License: Apache 2.0
License File: requests.license
typeshed - Collection of library stubs for Python, with static types. (https://github.com/python/typeshed/blob/main/LICENSE)
License: Apache 2.0
License File: typeshed.license
web/documentserver-example/ruby
@ -389,14 +206,14 @@ coffee-rails - CoffeeScript adapter for the Rails asset pipeline. (https://gith
License: MIT
License File: coffee-rails.license
dalli - High performance memcached client for Ruby. (https://github.com/petergoldstein/dalli/blob/v3.2.0/LICENSE)
License: MIT
License File: dalli.license
jbuilder - Create JSON structures via a Builder-style DSL (https://github.com/rails/jbuilder/blob/master/MIT-LICENSE)
License: MIT
License File: jbuilder.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
@ -409,14 +226,6 @@ jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https:
License: MIT
License File: jQuery.iframe-transport.license
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.Migrate - Upgrading libraries such as jQuery can be a lot of work, when breaking changes have been introduced. jQuery Migrate makes this easier, by restoring the APIs that were removed, and additionally shows warnings in the browser console (development version of jQuery Migrate only) when removed and/or deprecated APIs are used. (https://github.com/jquery/jquery-migrate/blob/main/LICENSE.txt)
License: OpenJS
License File: jQuery.Migrate.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
@ -425,18 +234,10 @@ jquery-rails - This gem provides jQuery and the jQuery-ujs driver for your Rail
License: MIT
License File: jquery-rails.license
mimemagic - А library to detect the mime type of a file by extension or by content. (https://github.com/mimemagicrb/mimemagic/blob/master/LICENSE)
License: MIT
License File: mimemagic.license
rails - Rails is a web-application framework that includes everything needed to create database-backed web applications according to the Model-View-Controller (MVC) pattern. (https://github.com/rails/rails/blob/v6.0.3.2/MIT-LICENSE)
License: MIT
License File: rails.license
rubocop - A Ruby static code analyzer and formatter, based on the community Ruby style guide. (https://github.com/rubocop/rubocop/blob/v1.52.0/LICENSE.txt)
License: MIT
License File: rubocop.license
sass-rails - This gem provides official integration for Ruby on Rails projects with the Sass stylesheet language. (https://github.com/rails/sass-rails/blob/master/MIT-LICENSE)
License: MIT
License File: sass-rails.license
@ -445,13 +246,9 @@ sdoc - rdoc generator html with javascript search index. (https://githu
License: MIT
License File: sdoc.license
sorbet - A fast, powerful type checker designed for Ruby. (https://github.com/sorbet/sorbet/blob/0.5.10871.20230607144259-d9000e2ba/LICENSE)
License: Apache License 2.0
License File: sorbet.license
tapioca - The swiss army knife of RBI generation. (https://github.com/Shopify/tapioca/blob/v0.11.6/LICENSE.txt)
License: MIT
License File: tapioca.license
sqlite3 - This module allows Ruby programs to interface with the SQLite3 database engine (www.sqlite.org). (https://github.com/sparklemotion/sqlite3-ruby/blob/master/LICENSE)
License: BSD-3-Clause
License File: sqlite3.license
turbolinks - Rails engine for Turbolinks 5 support (https://github.com/turbolinks/turbolinks-rails/blob/master/LICENSE)
License: MIT

View File

@ -1,82 +0,0 @@
# Change Log
- nodejs: onRequestSelectDocument method
- nodejs: onRequestSelectSpreadsheet method
- nodejs: onRequestOpen
- nodejs: submitForm
- nodejs: key in referenceData
- nodejs: change reference source
- php: using a repo with a list of formats
- nodejs: using a repo with a list of formats
- nodejs: delete file without reloading the page
- nodejs: getting history by a separate request
- nodejs: restore from history
- python: restore from history
- ruby: restore from history
- php: restore from history
- csharp-mvc: getting history by a separate request
- csharp-mvc: restore from history
- csharp: getting history by a separate request
- csharp: restore from history
## 1.6.0
- nodejs: setUsers for region protection
- si skin languages
- fix "no" skin languages
- anonymous can't change viewer to edit
- referenceData
- anonymous can't protect file
- separate setting for checking the token in requests
- php: linter refactoring
- horizontal scroll fix for Internet Explorer
- save file with extension from response after conversation
- conversation to ooxml
## 1.5.1
- update jquery
## 1.5.0
- nodejs: added wopi putRelativeFile action
- 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
## 1.4.0
- nodejs: option to send directUrl
- opening file on client by directUrl
- offline viewer for anonymous
- added hy, eu, zh-TW, ms, pt-PT
## 1.3.1
- charp: fix references
- ruby: update rails
## 1.3.0
- update empty files
- anonymous without chat
- changed jwt implementation in csharp, csharp-mvc, php, ruby
## 1.2.0
- ruby v3.0
- set filetype in setHistoryData
- read filetype from input request
- creating file on WOPI
- upload on WOPI page
- fix xss
- set userInfoGroups
- check JWT on downloading history
- upload dialog on mobile
- anonymous without id
- renaming from editor
- new skin languages
- ignore certificate
## 1.1.0
- creating docxf
- opening docxf, oform
## 1.0.0
- added java spring

View File

@ -1,19 +1,14 @@
## Integration examples
## Document Server integration example
Test examples are simple document management systems that can be built into your application for testing.
Do NOT use these integration examples on your own server without proper code modifications!
In case you enabled any of the test examples, disable it before going for production.
These examples show the way to integrate [ONLYOFFICE Docs][2] into your own website or application using one of the programming languages.
The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
These examples show the way to integrate [ONLYOFFICE Document Server][2] into your own website or application using one of the programming languages. The package contains examples written in .Net (C# MVC), .Net (C#), Java, Node.js, PHP and Ruby.
You should change `http://documentserver` to your server address in these files:
* [.Net (C# MVC)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp-mvc) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
* [.Net (C#)](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/csharp) - `web/documentserver-example/csharp/settings.config`
* [Java](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/java) - `web/documentserver-example/java/src/main/resources/settings.properties`
* [Node.js](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/nodejs) - `web/documentserver-example/nodejs/config/default.json`
* [PHP](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/php) - `web/documentserver-example/php/config.php`
* [Ruby](https://github.com/ONLYOFFICE/document-server-integration/tree/master/web/documentserver-example/ruby) - `web/documentserver-example/ruby/config/application.rb`
* .Net (C# MVC) - `web/documentserver-example/csharp-mvc/web.appsettings.config`
* .Net (C#) - `web/documentserver-example/csharp/settings.config`
* Java - `web/documentserver-example/java/src/main/resources/settings.properties`
* Node.js - `web/documentserver-example/nodejs/config/default.json`
* PHP - `web/documentserver-example/php/config.php`
* Ruby - `web/documentserver-example/ruby/config/application.rb`
More information on how to use these examples can be found here: [http://api.onlyoffice.com/editors/demopreview](http://api.onlyoffice.com/editors/demopreview "http://api.onlyoffice.com/editors/demopreview")
@ -67,15 +62,6 @@ The methods described below are available for all of the test examples.
| **Response** | **Code:** 200 OK <br />**Content on success:**<br /> `[{ "version": <file_version>, "id": <file_id>, "contentLength": <file_size_in_kilobytes>, "pureContentLength": <file_size_in_bytes>, "title": <file_name>, "updated": <last_change_date>}]`<br />**Content on error:**<br /> `"File not found"` |
| **Sample** | `curl -X GET http://localhost/files/{fileId}` |
## Important security info
Please keep in mind the following security aspects when you are using test examples:
* There is no protection of the storage from unauthorized access since there is no need for authorization.
* There are no checks against parameter substitution in links, since the parameters are generated by the code according to the pre-arranged scripts.
* There are no data checks in requests of saving the file after editing, since each test example is intended for requests only from ONLYOFFICE Document Server.
* There are no prohibitions on using test examples from other sites, since they are intended to interact with ONLYOFFICE Document Server from another domain.
## Project Information
Official website: [https://www.onlyoffice.com](https://www.onlyoffice.com/?utm_source=github&utm_medium=cpc&utm_campaign=GitHubIntegrationEx)
@ -86,9 +72,9 @@ ONLYOFFICE for developers: [https://www.onlyoffice.com/developer-edition.aspx](h
## User Feedback and Support
If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [forum.onlyoffice.com][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3].
If you have any problems with or questions about [ONLYOFFICE Document Server][2], please visit our official forum to find answers to your questions: [dev.onlyoffice.org][1] or you can ask and answer ONLYOFFICE development questions on [Stack Overflow][3].
[1]: https://forum.onlyoffice.com
[1]: http://dev.onlyoffice.org
[2]: https://github.com/ONLYOFFICE/DocumentServer
[3]: http://stackoverflow.com/questions/tagged/onlyoffice

View File

@ -4,14 +4,12 @@
<PropertyGroup>
<To Condition=" '$(To)' == '' ">..\deploy\</To>
<RootDir Condition="$(RootDir)==''">..\..\</RootDir>
<NameCSharp>$(To)DotNet (Csharp) Example</NameCSharp>
<NameCSharp>$(To).Net (C#) Example</NameCSharp>
<DirCSharp>$(RootDir)web\documentserver-example\csharp\</DirCSharp>
<NameMvc>$(To)DotNet (Csharp MVC) Example</NameMvc>
<NameMvc>$(To).Net (C# MVC) Example</NameMvc>
<DirMvc>$(RootDir)web\documentserver-example\csharp-mvc\</DirMvc>
<NameJava>$(To)Java Example</NameJava>
<DirJava>$(RootDir)web\documentserver-example\java\</DirJava>
<NameSpring>$(To)Java Spring Example</NameSpring>
<DirSpring>$(RootDir)web\documentserver-example\java-spring\</DirSpring>
<NameNodeJS>$(To)Node.js Example</NameNodeJS>
<DirNodeJS>$(RootDir)web\documentserver-example\nodejs\</DirNodeJS>
<NamePHP>$(To)PHP Example</NamePHP>
@ -26,49 +24,43 @@
<RemoveDir Directories="$(To)" ContinueOnError="true" />
<ItemGroup>
<ZipFilesCSharp Include="$(DirCSharp)**" Exclude="$(DirCSharp).vs\**;$(DirCSharp)bin\*.pdb;$(DirCSharp)bin\*.xml;$(DirCSharp)obj\**;$(DirCSharp)packages\**;$(DirCSharp)**\.git" />
<ZipFilesCSharp Include="$(DirCSharp)**" Exclude="$(DirCSharp)obj\**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesCSharp)" DestinationFiles="@(ZipFilesCSharp->'$(NameCSharp)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameCSharp)" WorkingDirectory="$(To)" ZipFileName="$(NameCSharp).zip" />
<ItemGroup>
<ZipFilesMVC Include="$(DirMvc)**" Exclude="$(DirMvc).vs\**;$(DirMvc)bin\*.pdb;$(DirMvc)bin\*.xml;$(DirMvc)obj\**;$(DirMvc)packages\**;$(DirMvc)**\.git" />
<ZipFilesMVC Include="$(DirMvc)**" Exclude="$(DirMvc)obj\**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesMVC)" DestinationFiles="@(ZipFilesMVC->'$(NameMvc)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameMvc)" WorkingDirectory="$(To)" ZipFileName="$(NameMvc).zip" />
<ItemGroup>
<ZipFilesJava Include="$(DirJava)**" Exclude="$(DirJava)**\.git" />
<ZipFilesJava Include="$(DirJava)**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesJava)" DestinationFiles="@(ZipFilesJava->'$(NameJava)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameJava)" WorkingDirectory="$(To)" ZipFileName="$(NameJava).zip" />
<ItemGroup>
<ZipFilesSpring Include="$(DirSpring)**" Exclude="$(DirSpring)**\.git" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesSpring)" DestinationFiles="@(ZipFilesSpring->'$(NameSpring)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameSpring)" WorkingDirectory="$(To)" ZipFileName="$(NameSpring).zip" />
<ItemGroup>
<ZipFilesNodeJS Include="$(DirNodeJS)**" Exclude="$(DirNodeJS)node_modules\**;$(DirNodeJS)**\.git" />
<ZipFilesNodeJS Include="$(DirNodeJS)**" Exclude="$(DirNodeJS)node_modules\**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesNodeJS)" DestinationFiles="@(ZipFilesNodeJS->'$(NameNodeJS)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameNodeJS)" WorkingDirectory="$(To)" ZipFileName="$(NameNodeJS).zip" />
<ItemGroup>
<ZipFilesPHP Include="$(DirPHP)**" Exclude="$(DirPHP)**\.git" />
<ZipFilesPHP Include="$(DirPHP)**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesPHP)" DestinationFiles="@(ZipFilesPHP->'$(NamePHP)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NamePHP)" WorkingDirectory="$(To)" ZipFileName="$(NamePHP).zip" />
<ItemGroup>
<ZipFilesRuby Include="$(DirRuby)**" Exclude="$(DirRuby)**\.git" />
<ZipFilesRuby Include="$(DirRuby)**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesRuby)" DestinationFiles="@(ZipFilesRuby->'$(NameRuby)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NameRuby)" WorkingDirectory="$(To)" ZipFileName="$(NameRuby).zip" />
<ItemGroup>
<ZipFilesPython Include="$(DirPython)**" Exclude="$(DirPython)**\.git" />
<ZipFilesPython Include="$(DirPython)**" />
</ItemGroup>
<Copy SourceFiles="@(ZipFilesPython)" DestinationFiles="@(ZipFilesPython->'$(NamePython)\%(RecursiveDir)%(Filename)%(Extension)')" />
<Zip Files="$(NamePython)" WorkingDirectory="$(To)" ZipFileName="$(NamePython).zip" />

View File

@ -0,0 +1,17 @@
# Integration examples
## To start integrating document editors into your own website you need to do the following:
1. Download [Document Server installation](https://www.onlyoffice.com/developer-edition-request.aspx?from=api.onlyoffice.com) and set it up on your local server.
2. Select the programming language and clone the source code for the sample of online editors integration into your web site.
3. [Edit the configuration files](https://api.onlyoffice.com/editors/advanced) in the sample changing the default path for the one to the editors installed at step 1 and other advanced parameters available for editor configuration.
4. In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files. And you must also make sure that the Document Server in its turn has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.
Please note that the integration examples are used to demonstrate document editors functions and the ways to connect **Document Server** to your own application. **DO NOT USE** these examples on your own server without **PROPER CODE MODIFICATIONS**!
The result should look like the [demo preview](https://api.onlyoffice.com/editors/demopreview#DemoPreview) on our web site.
If you have any further questions, please contact us at [integration@onlyoffice.com](mailto:integration@onlyoffice.com).

View File

@ -0,0 +1,29 @@
ONLYOFFICE Applications example uses code from the following 3rd party projects:
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.FileUpload.license
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.iframe-transport.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://licenses.nuget.org/MIT)
License: MIT
License File: Newtonsoft.Json.license
Microsoft.AspNetCore.Cors - CORS middleware and policy for ASP.NET Core to enable cross-origin resource sharing (https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt)
License: MIT
License File: Microsoft.AspNetCore.Cors.license

View File

@ -0,0 +1,4 @@
# Authors
* Ascensio System SIA: <integration@onlyoffice.com>

View File

@ -0,0 +1,372 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using OnlineEditorsExampleNetCore.Helpers;
using OnlineEditorsExampleNetCore.Models;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
namespace OnlineEditorsExampleNetCore.Controllers
{
public class HomeController : Controller
{
private readonly IWebHostEnvironment _environment;
private readonly IHttpContextAccessor _httpContextAccessor;
public HomeController(IWebHostEnvironment environment, IHttpContextAccessor httpContextAccessor)
{
_environment = environment;
_httpContextAccessor = httpContextAccessor;
}
public IActionResult Index()
{
DocManagerHelper.ContentPath = _environment.WebRootPath;
DocManagerHelper.Context = HttpContext;
return View();
}
public IActionResult Editor(string fileName, string editorsMode, string editorsType)
{
var file = new FileModel
{
Mode = editorsMode, // editor mode: edit or view
Type = editorsType, // editor type: desktop, mobile, embedded
FileName = Path.GetFileName(fileName), // file name
};
return View("Editor", file);
}
public IActionResult Sample(string fileExt, bool? sample)
{
if (ModelState.IsValid)
{
var fileName = DocManagerHelper.CreateDemo(fileExt, sample ?? false); // create a sample document
var id = Request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
DocManagerHelper.CreateMeta(fileName, user.id, user.name); // create meta information for the sample document
return Redirect(Url.Action("Editor", "Home", new { fileName = fileName }));
}
return new EmptyResult();
}
[Route("/upload")]
public IActionResult Upload(IFormCollection form)
{
HttpContext.Response.ContentType = "text/plain";
try
{
var httpPostedFile = form.Files[0];
var fileName = httpPostedFile.FileName;
if (HttpContext.Request.Headers["User-Agent"] == "IE")
{
var files = httpPostedFile.FileName.Split(new char[] { '\\' });
fileName = files[files.Length - 1];
}
var curSize = httpPostedFile.Length;
if (DocManagerHelper.MaxFileSize < curSize || curSize <= 0)
{
throw new Exception("File size is incorrect");
}
var curExt = (Path.GetExtension(fileName) ?? "").ToLower();
if (!DocManagerHelper.FileExts.Contains(curExt))
{
throw new Exception("File type is not supported");
}
fileName = DocManagerHelper.GetCorrectName(fileName);
fileName = DocManagerHelper.GetCorrectName(fileName); // get the correct file name if such a name already exists
var documentType = FileUtility.GetFileType(fileName).ToString().ToLower();
var savedFileName = DocManagerHelper.StoragePath(fileName); // get the storage path to the uploading file
using (var fs = System.IO.File.Open(savedFileName, FileMode.Create, FileAccess.ReadWrite))
{
httpPostedFile.CopyTo(fs); // and save it
}
// get file meta information or create the default one
var id = HttpContext.Request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
DocManagerHelper.CreateMeta(fileName, user.id, user.name);
return Json(new Dictionary<string, object>() {
{ "filename", fileName },
{ "documentType", documentType }
});
}
catch (Exception e)
{
return Json(new Dictionary<string, object>() { { "error", e.Message } });
}
}
[Route("/convert")]
public IActionResult Convert()
{
HttpContext.Response.ContentType = "text/plain";
try
{
string fileData;
using (var receiveStream = HttpContext.Request.Body)
using (var readStream = new StreamReader(receiveStream))
{
fileData = readStream.ReadToEnd();
if (string.IsNullOrEmpty(fileData)) return Json(new Dictionary<string, object>() { { "error", "1" }, { "message", "Request stream is empty" } });
}
var body = JsonConvert.DeserializeObject<Dictionary<string, object>>(fileData);
var fileName = Path.GetFileName(body["filename"].ToString());
var filePass = body["filePass"] != null ? body["filePass"].ToString() : null;
var fileUri = DocManagerHelper.GetDownloadUrl(fileName);
var extension = (Path.GetExtension(fileName).ToLower() ?? "").Trim('.');
var internalExtension = DocManagerHelper.GetInternalExtension(FileUtility.GetFileType(fileName)).Trim('.');
// check if the file with such an extension can be converted
if (DocManagerHelper.ConvertExts.Contains("." + extension)
&& !string.IsNullOrEmpty(internalExtension))
{
// generate document key
var key = ServiceConverter.GenerateRevisionId(fileUri);
// get the url to the converted file
string newFileUri;
var result = ServiceConverter.GetConvertedUri(fileUri.ToString(), extension, internalExtension, key, true, out newFileUri, filePass);
if (result != 100)
{
return Json(new Dictionary<string, object>() { { "step", result }, { "filename", fileName } });
}
// get a file name of an internal file extension with an index if the file with such a name already exists
var correctName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + "." + internalExtension);
var req = (HttpWebRequest)WebRequest.Create(newFileUri);
using (var stream = req.GetResponse().GetResponseStream()) // get response stream of the converting file
{
if (stream == null) throw new Exception("Stream is null");
const int bufferSize = 4096;
using (var fs = System.IO.File.Open(DocManagerHelper.StoragePath(correctName), FileMode.Create))
{
var buffer = new byte[bufferSize];
int readed;
while ((readed = stream.Read(buffer, 0, bufferSize)) != 0)
{
fs.Write(buffer, 0, readed); // write bytes to the output stream
}
}
}
Remove(fileName); // remove the original file and its history if it exists
fileName = correctName; // create meta information about the converted file with user id and name specified
var id = HttpContext.Request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
DocManagerHelper.CreateMeta(fileName, user.id, user.name);
}
var documentType = FileUtility.GetFileType(fileName).ToString().ToLower();
return Json(new Dictionary<string, object>() { { "filename", fileName }, { "documentType", documentType } });
}
catch (Exception e)
{
return Json(new Dictionary<string, object>() { { "error", e.Message } });
}
}
// track file changes
[Route("/track")]
public IActionResult Track([FromQuery] string userAddress, [FromQuery] string fileName)
{
// read request body
var fileData = TrackManager.readBody(HttpContext);
var status = (WebEditorExtenstions.TrackerStatus)(Int64)fileData["status"]; // get status from the request body
var saved = 1; // editing
switch (status)
{
case WebEditorExtenstions.TrackerStatus.Editing:
try
{
var actions = JsonConvert.DeserializeObject<List<object>>(JsonConvert.SerializeObject(fileData["actions"]));
var action = JsonConvert.DeserializeObject<Dictionary<string, object>>(JsonConvert.SerializeObject(actions[0]));
if (action != null && action["type"].ToString().Equals("0")) // finished edit
{
var user = action["userid"].ToString(); // the user who finished editing
var users = JsonConvert.DeserializeObject<List<object>>(JsonConvert.SerializeObject(fileData["users"]));
if (!users.Contains(user))
{
TrackManager.commandRequest("forcesave", fileData["key"].ToString()); // create a command request with the forcesave method
}
}
}
catch (Exception e)
{
Debug.Print(e.StackTrace);
}
break;
// MustSave, Corrupted
case WebEditorExtenstions.TrackerStatus.MustSave:
case WebEditorExtenstions.TrackerStatus.Corrupted:
try
{
// saving a document
saved = TrackManager.processSave(fileData, fileName, userAddress);
}
catch (Exception)
{
saved = 1;
}
return Json(new Dictionary<string, object>() { { "error", saved } });
// MustForceSave, CorruptedForceSave
case WebEditorExtenstions.TrackerStatus.MustForceSave:
case WebEditorExtenstions.TrackerStatus.CorruptedForceSave:
try
{
// force saving a document
saved = TrackManager.processForceSave(fileData, fileName, userAddress);
}
catch (Exception)
{
saved = 1;
}
return Json(new Dictionary<string, object>() { { "error", saved } });
}
return Json(new Dictionary<string, object>() { { "error", 0 } });
}
// remove a file
[Route("/remove")]
public IActionResult Remove([FromQuery] string fileName)
{
HttpContext.Response.ContentType = "text/plain";
try
{
WebEditorExtenstions.Remove(fileName);
}
catch (Exception e)
{
return Json(new Dictionary<string, object>() { { "error", e.Message } });
}
return Redirect(Url.Action("Index", "Home"));
}
// get files information
[Route("/files")]
public IActionResult Files([FromQuery] string fileId)
{
List<Dictionary<string, object>> files = null;
try
{
HttpContext.Response.ContentType = "application/json";
if (fileId.ToString() == null)
{
files = DocManagerHelper.GetFilesInfo(); // get the information about the files from the storage path
return Json(JsonConvert.SerializeObject(files));
}
else
{
files = DocManagerHelper.GetFilesInfo(fileId);
if (files.Count == 0)
{
return Json("File not found");
}
else
{
return Json(JsonConvert.SerializeObject(files));
}
}
}
catch (Exception e)
{
return Json(new Dictionary<string, object>() { { "error", e.Message } });
}
}
// get sample files from the assests
[Route("/assets")]
public async Task<IActionResult> Assets([FromQuery] string fileName)
{
var filePath = "assets/sample/" + fileName;
await WebEditorExtenstions.DownloadAsync(filePath, HttpContext);
return new EmptyResult();
}
// download a csv file
[Route("/csv")]
public async Task<IActionResult> GetCsv()
{
var fileName = "csv.csv";
var filePath = "assets/sample/" + fileName;
await WebEditorExtenstions.DownloadAsync(filePath, HttpContext);
return new EmptyResult();
}
// download a file
[Route("/download")]
public async Task<IActionResult> Download([FromQuery] string fileName, [FromQuery] string userAddress)
{
try
{
if (JwtManager.Enabled)
{
string JWTheader = Startup.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : Startup.AppSettings["files.docservice.header"];
if (HttpContext.Request.Headers.Keys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
{
var headerToken = HttpContext.Request.Headers[JWTheader].ToString().Substring("Bearer ".Length);
string token = JwtManager.Decode(headerToken);
if (token == null || token.Equals(""))
{
HttpContext.Response.StatusCode = (int)HttpStatusCode.Forbidden;
return Json("JWT validation failed");
}
}
}
var filePath = DocManagerHelper.ForcesavePath(fileName, userAddress, false); // get the path to the force saved document version
if (filePath.Equals(""))
{
filePath = DocManagerHelper.StoragePath(fileName, userAddress); // or to the original document
}
await WebEditorExtenstions.DownloadAsync(filePath, HttpContext);
}
catch (Exception)
{
return Json(new Dictionary<string, object>() { { "error", "File not found!" } });
}
return new EmptyResult();
}
}
}

View File

@ -0,0 +1,362 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Http;
using System.Web;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System;
using OnlineEditorsExampleNetCore.Models;
using Newtonsoft.Json;
namespace OnlineEditorsExampleNetCore.Helpers
{
public class DocManagerHelper
{
public static string ContentPath{ get; set; }
public static HttpContext Context {
set
{
Host = value.Request.Host.Host;
RequestHost = value.Request.Headers["Host"];
Port = value.Request.Host.Port.ToString();
}
}
private static string Host { get; set; }
private static string RequestHost { get; set; }
private static string Port { get; set; }
// get max file size
public static long MaxFileSize
{
get
{
long size;
long.TryParse(Startup.AppSettings["filesize-max"], out size);
return size > 0 ? size : 5 * 1024 * 1024;
}
}
// get all the supported file extensions
public static List<string> FileExts
{
get { return ViewedExts.Concat(EditedExts).Concat(ConvertExts).ToList(); }
}
// get file extensions that can be viewed
public static List<string> ViewedExts
{
get { return (Startup.AppSettings["files.docservice.viewed-docs"] ?? "").Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); }
}
// get file extensions that can be edited
public static List<string> EditedExts
{
get { return (Startup.AppSettings["files.docservice.edited-docs"] ?? "").Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); }
}
// get file extensions that can be converted
public static List<string> ConvertExts
{
get { return (Startup.AppSettings["files.docservice.convert-docs"] ?? "").Split(new char[] { '|', ',' }, StringSplitOptions.RemoveEmptyEntries).ToList(); }
}
// get current user host address
public static string CurUserHostAddress(string userAddress = null)
{
return Regex.Replace(userAddress ?? Host, "[^0-9a-zA-Z.=]", "_");
}
// get the storage path of the file
public static string StoragePath(string fileName, string userAddress = null)
{
var directory = ContentPath + "\\" + CurUserHostAddress(userAddress) + "\\";
if (!Directory.Exists(directory))
{
Directory.CreateDirectory(directory);
}
return directory + Path.GetFileName(fileName);
}
// get the path to the forcesaved file version
public static string ForcesavePath(string fileName, string userAddress, Boolean create)
{
// create the directory to this file version
var directory = ContentPath + CurUserHostAddress(userAddress) + "\\";
if (!Directory.Exists(directory))
{
return "";
}
// create the directory to the history of this file version
directory = directory + Path.GetFileName(fileName) + "-hist" + "\\";
if (!Directory.Exists(directory))
{
if (create)
{
Directory.CreateDirectory(directory);
}
else
{
return "";
}
}
directory = directory + Path.GetFileName(fileName);
if (!File.Exists(directory))
{
if (!create)
{
return "";
}
}
return directory;
}
// get the history directory
public static string HistoryDir(string storagePath)
{
return storagePath += "-hist";
}
// get the path to the file version by the history path and file version
public static string VersionDir(string histPath, int version)
{
return Path.Combine(histPath, version.ToString());
}
// get the path to the file version by the file name, user address and file version
public static string VersionDir(string fileName, string userAddress, int version)
{
return VersionDir(HistoryDir(StoragePath(fileName, userAddress)), version);
}
// get the file version by the history path
public static int GetFileVersion(string historyPath)
{
if (!Directory.Exists(historyPath)) return 0; // if the history path doesn't exist, then the file version is 0
return Directory.EnumerateDirectories(historyPath).Count() + 1; // take only directories from the history folder and count them
}
// get the file version by the file name and user address
public static int GetFileVersion(string fileName, string userAddress)
{
return GetFileVersion(HistoryDir(StoragePath(fileName, userAddress)));
}
// get a file name with an index if the file with such a name already exists
public static string GetCorrectName(string fileName, string userAddress = null)
{
var baseName = Path.GetFileNameWithoutExtension(fileName);
var ext = Path.GetExtension(fileName).ToLower();
var name = baseName + ext;
for (var i = 1; File.Exists(StoragePath(name, userAddress)); i++) // run through all the files with such a name in the storage directory
{
name = baseName + " (" + i + ")" + ext; // and add an index to the base name
}
return name;
}
// get all the stored files from the user host address
public static List<FileInfo> GetStoredFiles()
{
var directory = ContentPath + "\\" + CurUserHostAddress(null) + "\\";
if (!Directory.Exists(directory)) return new List<FileInfo>();
var directoryInfo = new DirectoryInfo(directory);
// take files from the root directory
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
return storedFiles;
}
// create demo document
public static string CreateDemo(string fileExt, bool withContent)
{
var demoName = (withContent ? "sample." : "new.") + fileExt; // create sample or new template file with the necessary extension
var demoPath = "assets\\" + (withContent ? "sample\\" : "new\\"); // get the path to the sample document
var fileName = GetCorrectName(demoName); // get a file name with an index if the file with such a name already exists
File.Copy(ContentPath + "\\" + demoPath + demoName, StoragePath(fileName)); // copy file to the storage directory
return fileName;
}
// create meta information
public static void CreateMeta(string fileName, string uid, string uname, string userAddress = null)
{
var histDir = HistoryDir(StoragePath(fileName, userAddress)); // create history directory
Directory.CreateDirectory(histDir);
// create createdInfo.json file with meta information in the history directory (creation time, user id and name)
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), JsonConvert.SerializeObject(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", uid },
{ "name", uname }
}));
}
// get file url
public static string GetFileUri(string fileName, Boolean forDocumentServer)
{
var uri = new UriBuilder(GetServerUrl(forDocumentServer))
{
Path = "/" + fileName,
Query = ""
};
return uri.ToString();
}
// get the path url
public static string GetPathUri(string path)
{
var uri = new UriBuilder(GetServerUrl(true))
{
Path = "/" + path,
Query = ""
};
return uri.ToString();
}
// get the server url
public static string GetServerUrl(Boolean forDocumentServer)
{
if (forDocumentServer && !Startup.AppSettings["files.docservice.url.example"].Equals(""))
{
return Startup.AppSettings["files.docservice.url.example"];
}
else
{
var uri = new UriBuilder(Host) { Query = "" };
uri = new UriBuilder(uri.Scheme + "://" + RequestHost);
return uri.ToString();
}
}
// get the callback url
public static string GetCallback(string fileName)
{
var callbackUrl = new UriBuilder(GetServerUrl(true))
{
Path = "/track",
Query = "fileName=" + HttpUtility.UrlEncode(fileName)
+ "&userAddress=" + HttpUtility.UrlEncode(Host)
};
return callbackUrl.ToString();
}
public static string GetCreateUrl(FileUtility.FileType fileType)
{
var createUrl = new UriBuilder(GetServerUrl(false))
{
Path = "Home/Sample",
Query = "fileExt=" + GetInternalExtension(fileType).Trim('.')
};
return createUrl.ToString();
}
public static string GetDownloadUrl(string fileName)
{
var downloadUrl = new UriBuilder(GetServerUrl(true))
{
Path = "/download",
Query = "fileName=" + HttpUtility.UrlEncode(fileName)
+ "&userAddress=" + HttpUtility.UrlEncode(Host)
};
return downloadUrl.ToString();
}
// get an editor internal extension
public static string GetInternalExtension(FileUtility.FileType fileType)
{
switch (fileType)
{
case FileUtility.FileType.Word: // .docx for word file type
return ".docx";
case FileUtility.FileType.Cell: // .xlsx for cell file type
return ".xlsx";
case FileUtility.FileType.Slide: // .pptx for slide file type
return ".pptx";
default:
return ".docx"; // the default file type is .docx
}
}
// get image url for templates
public static string GetTemplateImageUrl(FileUtility.FileType fileType)
{
var path = new UriBuilder(GetServerUrl(true)) // templates image url in the "From Template" section
{
Path = "\\img\\"
};
switch (fileType)
{
case FileUtility.FileType.Word: // for word file type
return path + "file_docx.svg";
case FileUtility.FileType.Cell: // for cell file type
return path + "file_xlsx.svg";
case FileUtility.FileType.Slide: // for slide file type
return path + "file_pptx.svg";
default:
return path + "file_docx.svg"; // the default value
}
}
// get file information
public static List<Dictionary<string, object>> GetFilesInfo(string fileId = null)
{
var files = new List<Dictionary<string, object>>();
// run through all the stored files
foreach (var file in GetStoredFiles())
{
// write all the parameters to the map
var dictionary = new Dictionary<string, object>();
dictionary.Add("version", GetFileVersion(file.Name, null));
dictionary.Add("id", ServiceConverter.GenerateRevisionId(DocManagerHelper.CurUserHostAddress() + "/" + file.Name + "/" + File.GetLastWriteTime(DocManagerHelper.StoragePath(file.Name, null)).GetHashCode()));
dictionary.Add("contentLength", Math.Round(file.Length / 1024.0, 2) + " KB");
dictionary.Add("pureContentLength", file.Length);
dictionary.Add("title", file.Name);
dictionary.Add("updated", file.LastWriteTime.ToString());
// get file information by its id
if (fileId != null)
{
if (fileId.Equals(dictionary["id"]))
{
files.Add(dictionary);
break;
}
}
else
{
files.Add(dictionary);
}
}
return files;
}
}
}

View File

@ -0,0 +1,267 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using OnlineEditorsExampleNetCore.Services;
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
namespace OnlineEditorsExampleNetCore.Helpers
{
/// <summary>
/// Class service api conversion
/// </summary>
public static class ServiceConverter
{
// /// <summary>
// /// Static constructor
// /// </summary>
static ServiceConverter()
{
DocumentConverterUrl = (Startup.AppSettings["files.docservice.url.site"] ?? "") + (Startup.AppSettings["files.docservice.url.converter"] ?? "");
Int32.TryParse(Startup.AppSettings["files.docservice.timeout"], out ConvertTimeout);
ConvertTimeout = ConvertTimeout > 0 ? ConvertTimeout : 120000;
}
#region private fields
/// <summary>
/// Timeout to request conversion
/// </summary>
private static readonly int ConvertTimeout;
/// <summary>
/// Url to the service of conversion
/// </summary>
private static readonly string DocumentConverterUrl;
#endregion
#region public method
/// <summary>
/// The method is to convert the file to the required format
/// </summary>
/// <param name="documentUri">Uri for the document to convert</param>
/// <param name="fromExtension">Document extension</param>
/// <param name="toExtension">Extension to which to convert</param>
/// <param name="documentRevisionId">Key for caching on service</param>
/// <param name="isAsync">Perform conversions asynchronously</param>
/// <param name="convertedDocumentUri">Uri to the converted document</param>
/// <returns>The percentage of conversion completion</returns>
/// <example>
/// string convertedDocumentUri;
/// GetConvertedUri("http://helpcenter.onlyoffice.com/content/GettingStarted.pdf", ".pdf", ".docx", "http://helpcenter.onlyoffice.com/content/GettingStarted.pdf", false, out convertedDocumentUri);
/// </example>
/// <exception>
/// </exception>
public static int GetConvertedUri(string documentUri,
string fromExtension,
string toExtension,
string documentRevisionId,
bool isAsync,
out string convertedDocumentUri,
string filePass = null)
{
convertedDocumentUri = string.Empty;
// check if the fromExtension parameter is defined; if not, get it from the document url
fromExtension = string.IsNullOrEmpty(fromExtension) ? Path.GetExtension(documentUri).ToLower() : fromExtension;
// check if the file name parameter is defined; if not, get random uuid for this file
var title = Path.GetFileName(documentUri);
title = string.IsNullOrEmpty(title) ? Guid.NewGuid().ToString() : title;
// get document key
documentRevisionId = string.IsNullOrEmpty(documentRevisionId)
? documentUri
: documentRevisionId;
documentRevisionId = GenerateRevisionId(documentRevisionId);
// specify request parameters
var request = (HttpWebRequest)WebRequest.Create(DocumentConverterUrl);
request.Method = "POST";
request.ContentType = "application/json";
request.Accept = "application/json";
request.Timeout = ConvertTimeout;
// write all the necessary parameters to the body object
var body = new Dictionary<string, object>() {
{ "async", isAsync },
{ "filetype", fromExtension.Trim('.') },
{ "key", documentRevisionId },
{ "outputtype", toExtension.Trim('.') },
{ "title", title },
{ "url", documentUri },
{ "password", filePass }
};
if (JwtManager.Enabled)
{
// create payload object
var payload = new Dictionary<string, object>
{
{ "payload", body }
};
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 = Startup.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : Startup.AppSettings["files.docservice.header"];
request.Headers.Add(JWTheader, "Bearer " + payloadToken);
body.Add("token", bodyToken);
}
var bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(body));
request.ContentLength = bytes.Length;
using (var requestStream = request.GetRequestStream()) // get the request stream
{
requestStream.Write(bytes, 0, bytes.Length); // and write the serialized body object to it
}
string dataResponse;
using (var response = request.GetResponse())
using (var stream = response.GetResponseStream()) // get the response stream
{
if (stream == null) throw new Exception("Response is null");
using (var reader = new StreamReader(stream))
{
dataResponse = reader.ReadToEnd(); // and read it
}
}
return GetResponseUri(dataResponse, out convertedDocumentUri);
}
/// <summary>
/// Translation key to a supported form.
/// </summary>
/// <param name="expectedKey">Expected key</param>
/// <returns>Supported key</returns>
public static string GenerateRevisionId(string expectedKey)
{
// if the expected key length is greater than 20, it is hashed and a fixed length value is stored in the string format
if (expectedKey.Length > 20) expectedKey = expectedKey.GetHashCode().ToString();
var key = Regex.Replace(expectedKey, "[^0-9-.a-zA-Z_=]", "_");
return key.Substring(key.Length - Math.Min(key.Length, 20)); // the resulting key length is 20 or less
}
#endregion
#region private method
/// <summary>
/// Processing document received from the editing service
/// </summary>
/// <param name="jsonDocumentResponse">The resulting json from editing service</param>
/// <param name="responseUri">Uri to the converted document</param>
/// <returns>The percentage of conversion completion</returns>
private static int GetResponseUri(string jsonDocumentResponse, out string responseUri)
{
if (string.IsNullOrEmpty(jsonDocumentResponse)) throw new ArgumentException("Invalid param", "jsonDocumentResponse");
var responseFromService = JsonConvert.DeserializeObject<ResponseFromConvert>(jsonDocumentResponse);
if (jsonDocumentResponse == null) throw new WebException("Invalid answer format");
var errorElement = responseFromService.Error; // if an error occurs
if (errorElement != null) ProcessResponseError(Convert.ToInt32(errorElement)); // then get an error message
// check if the conversion is completed and save the result to a variable
var isEndConvert = responseFromService.EndConvert;
int resultPercent;
responseUri = string.Empty;
if (isEndConvert) // if the conversion is completed
{
responseUri = responseFromService.FileUrl; // get the file url
resultPercent = 100;
}
else // if the conversion isn't completed
{
resultPercent = responseFromService.Percent; // get the percentage value
if (resultPercent >= 100) resultPercent = 99;
}
return resultPercent;
}
/// <summary>
/// Generate an error code table
/// </summary>
/// <param name="errorCode">Error code</param>
private static void ProcessResponseError(int errorCode)
{
var errorMessage = string.Empty;
const string errorMessageTemplate = "Error occurred in the ConvertService.ashx: {0}";
switch (errorCode)
{
case -8:
// public const int c_nErrorFileVKey = -8;
errorMessage = String.Format(errorMessageTemplate, "Error document VKey");
break;
case -7:
// public const int c_nErrorFileRequest = -7;
errorMessage = String.Format(errorMessageTemplate, "Error document request");
break;
case -6:
// public const int c_nErrorDatabase = -6;
errorMessage = String.Format(errorMessageTemplate, "Error database");
break;
case -5:
// public const int c_nErrorUnexpectedGuid = -5;
errorMessage = String.Format(errorMessageTemplate, "Incorrect password");
break;
case -4:
// public const int c_nErrorDownloadError = -4;
errorMessage = String.Format(errorMessageTemplate, "Error download error");
break;
case -3:
// public const int c_nErrorConvertationError = -3;
errorMessage = String.Format(errorMessageTemplate, "Error convertation error");
break;
case -2:
// public const int c_nErrorConvertationTimeout = -2;
errorMessage = String.Format(errorMessageTemplate, "Error convertation timeout");
break;
case -1:
// public const int c_nErrorUnknown = -1;
errorMessage = String.Format(errorMessageTemplate, "Error convertation unknown");
break;
case 0:
// public const int c_nErrorNo = 0;
break;
default:
errorMessage = "ErrorCode = " + errorCode;
break;
}
throw new Exception(errorMessage);
}
#endregion
}
}

View File

@ -0,0 +1,111 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
namespace OnlineEditorsExampleNetCore.Helpers
{
public static class JwtManager
{
private static readonly string Secret;
public static readonly bool Enabled;
static JwtManager()
{
Secret = Startup.AppSettings["files.docservice.secret"] ?? ""; // get token secret from the config parameters
Enabled = !string.IsNullOrEmpty(Secret); // check if the token is enabled
}
// encode a payload object into a token using a secret key
public static string Encode(IDictionary<string, object> payload)
{
// define the hashing algorithm and the token type
var header = new Dictionary<string, object>
{
{ "alg", "HS256" },
{ "typ", "JWT" }
};
// three parts of token
var encHeader = Base64UrlEncode(JsonConvert.SerializeObject(header)); // header
var encPayload = Base64UrlEncode(JsonConvert.SerializeObject(payload)); // payload
var hashSum = Base64UrlEncode(CalculateHash(encHeader, encPayload)); // signature
return string.Format("{0}.{1}.{2}", encHeader, encPayload, hashSum);
}
// decode a token into a payload object using a secret key
public static string Decode(string token)
{
if (!Enabled || string.IsNullOrEmpty(token)) return "";
var split = token.Split('.');
if (split.Length != 3) return "";
var hashSum = Base64UrlEncode(CalculateHash(split[0], split[1])); // get signature
if (hashSum != split[2]) return ""; // and check if it is equal to the signature from the token
return Base64UrlDecode(split[1]); // decode payload
}
// generate a hash code based on a key using the HMAC method
private static byte[] CalculateHash(string encHeader, string encPayload)
{
using (var hasher = new HMACSHA256(Encoding.UTF8.GetBytes(Secret)))
{
var bytes = Encoding.UTF8.GetBytes(string.Format("{0}.{1}", encHeader, encPayload));
return hasher.ComputeHash(bytes);
}
}
// encode a string into the base64 value
private static string Base64UrlEncode(string str)
{
return Base64UrlEncode(Encoding.UTF8.GetBytes(str));
}
// encode bytes into the base64 value
private static string Base64UrlEncode(byte[] bytes)
{
return Convert.ToBase64String(bytes)
.TrimEnd('=').Replace('+', '-').Replace('/', '_');
}
// decode a base64 value into the string
private static string Base64UrlDecode(string payload)
{
var b64 = payload.Replace('_', '/').Replace('-', '+');
switch (b64.Length % 4)
{
case 2:
b64 += "==";
break;
case 3:
b64 += "=";
break;
}
var bytes = Convert.FromBase64String(b64);
return Encoding.UTF8.GetString(bytes);
}
}
}

View File

@ -0,0 +1,308 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.IO;
using System.Net;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.AspNetCore.Http;
using Newtonsoft.Json;
namespace OnlineEditorsExampleNetCore.Helpers
{
public class TrackManager
{
// read request body
public static Dictionary<string, object> readBody(HttpContext context)
{
string body;
try
{
// read request body by streams and check if it is correct
using (var receiveStream = context.Request.Body)
using (var readStream = new StreamReader(receiveStream))
{
body = readStream.ReadToEnd();
if (string.IsNullOrEmpty(body)) context.Response.WriteAsync("{\"error\":1,\"message\":\"Request stream is empty\"}");
}
}
catch (Exception e)
{
throw new Exception(HttpStatusCode.BadRequest.ToString(), e);
}
var fileData = JsonConvert.DeserializeObject<Dictionary<string, object>>(body);
// check if the document token is enabled
if (JwtManager.Enabled)
{
string JWTheader = Startup.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : Startup.AppSettings["files.docservice.header"];
string token = null;
// if the document token is in the data
if (fileData.ContainsKey("token"))
{
token = JwtManager.Decode(fileData["token"].ToString()); // decode it
}
else if (context.Request.Headers.Keys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase)) // if the Authorization header exists
{
var headerToken = context.Request.Headers[JWTheader].ToString().Substring("Bearer ".Length);
token = JwtManager.Decode(headerToken); // decode its part after Authorization prefix
}
else // otherwise, an error occurs
{
context.Response.WriteAsync("{\"error\":1,\"message\":\"JWT expected\"}");
}
if (token != null && !token.Equals("")) // invalid signature error
{
fileData = (Dictionary<string, object>)JsonConvert.DeserializeObject<Dictionary<string, object>>(token);
}
else
{
context.Response.WriteAsync("{\"error\":1,\"message\":\"JWT validation failed\"}");
}
}
return fileData;
}
// file saving process
public static int processSave(Dictionary<string, object> fileData, string fileName, string userAddress)
{
var downloadUri = (string)fileData["url"];
string curExt = Path.GetExtension(fileName).ToLower(); // get current file extension
string downloadExt = Path.GetExtension(downloadUri).ToLower() ?? ""; // get the extension of the downloaded file
var newFileName = fileName;
// convert downloaded file to the file with the current extension if these extensions aren't equal
if (!curExt.Equals(downloadExt, StringComparison.InvariantCultureIgnoreCase))
{
try
{
// convert file and give url to a new file
string newFileUri;
var result = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), false, out newFileUri);
if (string.IsNullOrEmpty(newFileUri))
{
// get the correct file name if it already exists
newFileName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress);
}
else
{
downloadUri = newFileUri;
}
}
catch (Exception)
{
newFileName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + downloadExt, userAddress);
}
}
var storagePath = DocManagerHelper.StoragePath(newFileName, userAddress); // get the file path
var histDir = DocManagerHelper.HistoryDir(storagePath); // get the path to the history directory
if (!Directory.Exists(histDir)) Directory.CreateDirectory(histDir);
var versionDir = DocManagerHelper.VersionDir(histDir, DocManagerHelper.GetFileVersion(histDir)); // get the path to the file version
if (!Directory.Exists(versionDir)) Directory.CreateDirectory(versionDir); // if the path doesn't exist, create it
// get the path to the previous file version and move it to the storage directory
File.Move(DocManagerHelper.StoragePath(fileName, userAddress), Path.Combine(versionDir, "prev" + curExt));
DownloadToFile(downloadUri, storagePath); // save file to the storage directory
DownloadToFile((string)fileData["changesurl"], Path.Combine(versionDir, "diff.zip")); // save file changes to the diff.zip archive
var hist = fileData.ContainsKey("changeshistory") ? (string)fileData["changeshistory"] : null;
if (string.IsNullOrEmpty(hist) && fileData.ContainsKey("history"))
{
hist = JsonConvert.SerializeObject(fileData["history"]);
}
if (!string.IsNullOrEmpty(hist))
{
File.WriteAllText(Path.Combine(versionDir, "changes.json"), hist); // write the history changes to the changes.json file
}
File.WriteAllText(Path.Combine(versionDir, "key.txt"), (string)fileData["key"]); // write the key value to the key.txt file
string forcesavePath = DocManagerHelper.ForcesavePath(newFileName, userAddress, false); // get the path to the forcesaved file version
if (!forcesavePath.Equals("")) // if the forcesaved file version exists
{
File.Delete(forcesavePath); // remove it
}
return 0;
}
// file force saving process
public static int processForceSave(Dictionary<string, object> fileData, string fileName, string userAddress)
{
var downloadUri = (string)fileData["url"];
string curExt = Path.GetExtension(fileName).ToLower(); // get current file extension
string downloadExt = Path.GetExtension(downloadUri).ToLower(); // get the extension of the downloaded file
Boolean newFileName = false;
// convert downloaded file to the file with the current extension if these extensions aren't equal
if (!curExt.Equals(downloadExt))
{
try
{
// convert file and give url to a new file
string newFileUri;
var result = ServiceConverter.GetConvertedUri(downloadUri, downloadExt, curExt, ServiceConverter.GenerateRevisionId(downloadUri), false, out newFileUri);
if (string.IsNullOrEmpty(newFileUri))
{
newFileName = true;
}
else
{
downloadUri = newFileUri;
}
}
catch (Exception)
{
newFileName = true;
}
}
string forcesavePath = "";
Boolean isSubmitForm = fileData["forcesavetype"].ToString().Equals("3"); // SubmitForm
if (isSubmitForm) // if the form is submitted
{
if (newFileName)
{
fileName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + "-form" + downloadExt, userAddress); // get the correct file name if it already exists
} else
{
fileName = DocManagerHelper.GetCorrectName(Path.GetFileNameWithoutExtension(fileName) + "-form" + curExt, userAddress);
}
forcesavePath = DocManagerHelper.StoragePath(fileName, userAddress);
}
else
{
if (newFileName)
{
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
{
forcesavePath = DocManagerHelper.ForcesavePath(fileName, userAddress, true);
}
}
DownloadToFile(downloadUri, forcesavePath);
if (isSubmitForm)
{
var actions = JsonConvert.DeserializeObject<List<object>>(JsonConvert.SerializeObject(fileData["actions"]));
var action = JsonConvert.DeserializeObject<Dictionary<string, object>>(JsonConvert.SerializeObject(actions[0]));
var user = action["userid"].ToString(); // get the user id
DocManagerHelper.CreateMeta(fileName, user, "Filling Form", userAddress); // create meta data for the forcesaved file
}
return 0;
}
// create a command request
public static void commandRequest(string method, string key)
{
string documentCommandUrl = Startup.AppSettings["files.docservice.url.site"] + Startup.AppSettings["files.docservice.url.command"];
var request = (HttpWebRequest)WebRequest.Create(documentCommandUrl);
request.Method = "POST";
request.ContentType = "application/json";
var body = new Dictionary<string, object>() {
{ "c", method },
{ "key", key }
};
// check if a secret key to generate token exists or not
if (JwtManager.Enabled)
{
var payload = new Dictionary<string, object>
{
{ "payload", body }
};
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 = Startup.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : Startup.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);
}
var bytes = Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(body));
request.ContentLength = bytes.Length;
using (var requestStream = request.GetRequestStream())
{
// write bytes to the output stream
requestStream.Write(bytes, 0, bytes.Length);
}
string dataResponse;
using (var response = request.GetResponse()) // get the response
using (var stream = response.GetResponseStream())
{
if (stream == null) throw new Exception("Response is null");
using (var reader = new StreamReader(stream))
{
dataResponse = reader.ReadToEnd(); // and read it
}
}
// convert stream to json string
var responseObj = JsonConvert.DeserializeObject<Dictionary<string, object>>(dataResponse);
if (!responseObj["error"].ToString().Equals("0"))
{
throw new Exception(dataResponse);
}
}
// save file information from the url to the file specified
public static void DownloadToFile(string url, string path)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentException("url"); // url isn't specified
if (string.IsNullOrEmpty(path)) throw new ArgumentException("path"); // file isn't specified
var req = (HttpWebRequest)WebRequest.Create(url);
using (var stream = req.GetResponse().GetResponseStream()) // get input stream of the file information from the url
{
if (stream == null) throw new Exception("stream is null");
const int bufferSize = 4096;
using (var fs = File.Open(path, FileMode.Create))
{
var buffer = new byte[bufferSize];
int readed;
while ((readed = stream.Read(buffer, 0, bufferSize)) != 0)
{
fs.Write(buffer, 0, readed); // write bytes to the output stream
}
}
}
}
}
}

View File

@ -0,0 +1,191 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OnlineEditorsExampleNetCore.Helpers
{
public class Users
{
static List<string> descr_user_1 = new List<string>()
{
"File author by default",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can create files from templates using data from the editor"
};
static List<string> descr_user_2 = new List<string>()
{
"Belongs to Group2",
"Can review only his own changes or changes made by users with no group",
"Can view comments, edit his own comments and comments left by users with no group. Can remove his own comments only",
"This file is marked as favorite",
"Can create new files from the editor"
};
static List<string> descr_user_3 = new List<string>()
{
"Belongs to Group3",
"Can review changes made by Group2 users",
"Can view comments left by Group2 and Group3 users. Can edit comments left by the Group2 users",
"This file isnt marked as favorite",
"Cant copy data from the file to clipboard",
"Cant download the file",
"Cant print the file",
"Can create new files from the editor"
};
static List<string> descr_user_0 = new List<string>()
{
"The name is requested when the editor is opened",
"Doesnt belong to any group",
"Can review all the changes",
"Can perform all actions with comments",
"The file favorite state is undefined",
"Can't mention others in comments",
"Can't create new files from the editor"
};
private static List<User> users = new List<User>() {
new User(
"uid-1",
"John Smith",
"smith@mail.ru",
null,
null,
new Dictionary<string, object>(),
null,
new List<string>(),
descr_user_1,
true
),
new User(
"uid-2",
"Mark Pottato",
"pottato@mail.ru",
"group-2",
new List<string>() { "group-2", "" },
new Dictionary<string, object>()
{
{ "view", "" },
{ "edit", new List<string>() { "group-2", "" } },
{ "remove", new List<string>() { "group-2" } }
},
true,
new List<string>(),
descr_user_2,
false
),
new User(
"uid-3",
"Hamish Mitchell",
"mitchell@mail.ru",
"group-3",
new List<string>() { "group-2" },
new Dictionary<string,object>()
{
{ "view", new List<string>() { "group-2", "group-3" } },
{ "edit", new List<string>() { "group-2" } },
{ "remove", new List<string>() { } }
},
false,
new List<string>() { "copy", "download", "print" },
descr_user_3,
false
),
new User(
"uid-0",
null,
null,
null,
null,
new Dictionary<string,object>(),
null,
new List<string>(),
descr_user_0,
false
)
};
public static User getUser(string id)
{
foreach (User user in users)
{
if (user.id.Equals(id)) return user;
}
return users[0];
}
public static List<User> getAllUsers()
{
return users;
}
public static List<Dictionary<string, object>> getUsersForMentions(string id)
{
List<Dictionary<string, object>> usersData = new List<Dictionary<string, object>>();
foreach (User user in users)
{
if (!user.id.Equals(id) && user.name != null && user.email != null)
{
usersData.Add(new Dictionary<string, object>()
{
{"name", user.name },
{"email", user.email },
});
}
}
return usersData;
}
}
public class User
{
public string id;
public string name;
public string email;
public string group;
public List<string> reviewGroups;
public Dictionary<string, object> commentGroups;
public bool? favorite;
public List<string> deniedPermissions;
public List<string> descriptions;
public bool templates;
public User(string id, string name, string email, string group, List<string> reviewGroups, Dictionary<string, object> commentGroups, bool? favorite, List<string> deniedPermissions, List<string> descriptions, bool templates)
{
this.id = id;
this.name = name;
this.email = email;
this.group = group;
this.reviewGroups = reviewGroups;
this.commentGroups = commentGroups;
this.favorite = favorite;
this.deniedPermissions = deniedPermissions;
this.descriptions = descriptions;
this.templates = templates;
}
}
}

View File

@ -0,0 +1,45 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Http;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace OnlineEditorsExampleNetCore.Helpers
{
public static class Utils
{
// get the request header or return the default one
public static string GetOrDefault(this HttpContext context, string header, string def)
{
var value = context.Request.Headers[header];
if (value != String.Empty) return value.ToString();
return def;
}
// get a cookie from the cookie collection or return the default one
public static string GetOrDefault(this IRequestCookieCollection cookies, string cookie, string def)
{
var cook = cookies[cookie];
if (cook != null && !string.IsNullOrEmpty(cook)) return cook;
return def;
}
}
}

View File

@ -0,0 +1,380 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Http;
using OnlineEditorsExampleNetCore.Helpers;
using System;
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Mvc;
using System.Web;
using Newtonsoft.Json.Linq;
namespace OnlineEditorsExampleNetCore.Models
{
// create file model
public class FileModel
{
public string Mode { get; set; } // editor mode
public string Type { get; set; } // editor type
// get file url for Document Server
public string FileUri
{
get { return DocManagerHelper.GetFileUri(FileName, true); }
}
// get file url for user
public string FileUriUser
{
get { return DocManagerHelper.GetFileUri(FileName, false); }
}
public string FileName { get; set; } // file name
// get document type
public string DocumentType
{
get { return FileUtility.GetFileType(FileName).ToString().ToLower(); }
}
// get document key
public string Key
{
get { return ServiceConverter.GenerateRevisionId(DocManagerHelper.CurUserHostAddress() + "/" + FileName + "/" + File.GetLastWriteTime(DocManagerHelper.StoragePath(FileName, null)).GetHashCode()); }
}
// get the callback url
public string CallbackUrl
{
get { return DocManagerHelper.GetCallback(FileName); }
}
public string Ext { get; set; }
public string DownloadUrl
{
get { return DocManagerHelper.GetDownloadUrl(FileName); }
}
// get the document config
public string GetDocConfig(HttpContext context, IUrlHelper url)
{
var ext = Path.GetExtension(FileName).ToLower(); // get file extension
var editorsMode = Mode ?? "edit"; // get editor mode
var canEdit = DocManagerHelper.EditedExts.Contains(ext); // check if the file with such an extension can be edited
var mode = canEdit && editorsMode != "view" ? "edit" : "view"; // set the mode parameter: change it to view if the document can't be edited
var submitForm = canEdit && (editorsMode.Equals("edit") || editorsMode.Equals("fillForms")); // check if the Submit form button is displayed or not
var id = context.Request.Cookies["uid"];
var user = Users.getUser(id); // get the user
// favorite icon state
bool? favorite = user.favorite;
var actionLink = context.GetOrDefault("actionLink", null); // get the action link (comment or bookmark) if it exists
var actionData = string.IsNullOrEmpty(actionLink) ? null : JsonConvert.SerializeObject(actionLink); // get action data for the action link
var createUrl = DocManagerHelper.GetCreateUrl(FileUtility.GetFileType(FileName));
var templatesImageUrl = DocManagerHelper.GetTemplateImageUrl(FileUtility.GetFileType(FileName)); // image url for templates
var templates = new List<Dictionary<string, string>>
{
new Dictionary<string, string>()
{
{ "image", "" },
{ "title", "Blank" },
{ "url", createUrl },
},
new Dictionary<string, string>()
{
{ "image", templatesImageUrl },
{ "title", "With sample content" },
{ "url", createUrl + "&sample=true" },
}
};
// specify the document config
var config = new Dictionary<string, object>
{
{ "type", Type ?? "desktop" },
{ "documentType", DocumentType },
{
"document", new Dictionary<string, object>
{
{ "title", FileName },
{ "url", DownloadUrl },
{ "fileType", ext.Trim('.') },
{ "key", Key },
{
"info", new Dictionary<string, object>
{
{ "owner", "Me" },
{ "uploaded", DateTime.Now.ToShortDateString() },
{ "favorite", favorite}
}
},
{
// the permission for the document to be edited and downloaded or not
"permissions", new Dictionary<string, object>
{
{ "comment", editorsMode != "view" && editorsMode != "fillForms" && editorsMode != "embedded" && editorsMode != "blockcontent" },
{ "copy", !user.deniedPermissions.Contains("copy") },
{ "download", !user.deniedPermissions.Contains("download") },
{ "edit", canEdit && (editorsMode == "edit" || editorsMode == "view" || editorsMode == "filter" || editorsMode == "blockcontent") },
{ "print", !user.deniedPermissions.Contains("print") },
{ "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "embedded" && editorsMode != "blockcontent" },
{ "modifyFilter", editorsMode != "filter" },
{ "modifyContentControl", editorsMode != "blockcontent" },
{ "review", canEdit && (editorsMode == "edit" || editorsMode == "review") },
{ "reviewGroups", user.reviewGroups },
{ "commentGroups", user.commentGroups }
}
}
}
},
{
"editorConfig", new Dictionary<string, object>
{
{ "actionLink", actionData },
{ "mode", mode },
{ "lang", context.Request.Cookies.GetOrDefault("ulang", "en") },
{ "callbackUrl", CallbackUrl }, // absolute URL to the document storage service
{ "createUrl", !user.id.Equals("uid-0") ? createUrl : null },
{ "templates", user.templates ? templates : null },
{
// the user currently viewing or editing the document
"user", new Dictionary<string, object>
{
{ "id", user.id },
{ "name", user.id.Equals("uid-0") ? "" : user.name },
{ "group", user.group }
}
},
{
// the parameters for the embedded document type
"embedded", new Dictionary<string, object>
{
{ "saveUrl", FileUriUser }, // the absolute URL that will allow the document to be saved onto the user personal computer
{ "embedUrl", FileUriUser }, // the absolute URL to the document serving as a source file for the document embedded into the web page
{ "shareUrl", FileUriUser }, // the absolute URL that will allow other users to share this document
{ "toolbarDocked", "top" } // the place for the embedded viewer toolbar (top or bottom)
}
},
{
// the parameters for the editor interface
"customization", new Dictionary<string, object>
{
{ "about", true }, // the About section display
{ "feedback", true }, // the Feedback & Support menu button display
{ "forcesave", false }, // adds the request for the forced file saving to the callback handler
{ "submitForm", submitForm }, // if the Submit form button is displayed or not
{
"goback", new Dictionary<string, object> // settings for the Open file location menu button and upper right corner button
{
{ "url", url.Action("Index", "Home") } // the absolute URL to the website address which will be opened when clicking the Open file location menu button
}
}
}
}
}
}
};
// if the secret key to generate token exists
if (JwtManager.Enabled)
{
// encode the document config into a token
var token = JwtManager.Encode(config);
config.Add("token", token);
}
return JsonConvert.SerializeObject(config);
}
// get the document history
public void GetHistory(out string history, out string historyData)
{
var histDir = DocManagerHelper.HistoryDir(DocManagerHelper.StoragePath(FileName, null));
history = null;
historyData = null;
if (DocManagerHelper.GetFileVersion(histDir) > 0) // if the file was modified (the file version is greater than 0)
{
var currentVersion = DocManagerHelper.GetFileVersion(histDir);
var hist = new List<Dictionary<string, object>>();
var histData = new Dictionary<string, object>();
for (var i = 1; i <= currentVersion; i++) // run through all the file versions
{
var obj = new Dictionary<string, object>();
var dataObj = new Dictionary<string, object>();
var verDir = DocManagerHelper.VersionDir(histDir, i); // get the path to the given file version
var key = i == currentVersion ? Key : File.ReadAllText(Path.Combine(verDir, "key.txt")); // get document key
obj.Add("key", key);
obj.Add("version", i);
if (i == 1) // check if the version number is equal to 1
{
var infoPath = Path.Combine(histDir, "createdInfo.json"); // get meta data of this file
if (File.Exists(infoPath))
{
var info = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText(infoPath));
obj.Add("created", info["created"]); // write meta information to the object (user information and creation date)
obj.Add("user", new Dictionary<string, object>() {
{ "id", info["id"] },
{ "name", info["name"] },
});
}
}
dataObj.Add("key", key);
// write file url to the data object
dataObj.Add("url", i == currentVersion ? FileUri : DocManagerHelper.GetPathUri(Directory.GetFiles(verDir, "prev.*")[0].Substring(DocManagerHelper.ContentPath.Length)));
dataObj.Add("version", i);
if (i > 1) // check if the version number is greater than 1 (the file was modified)
{
// get the path to the changes.json file
var changes = JsonConvert.DeserializeObject<Dictionary<string, object>>(File.ReadAllText(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "changes.json")));
var changesArray = (JArray)changes["changes"];
var change = changesArray.Count > 0
? changesArray[0].ToObject<Dictionary<string, object>>()
: new Dictionary<string, object>();
// write information about changes to the object
obj.Add("changes", change.Count > 0 ? changes["changes"] : null);
obj.Add("serverVersion", changes["serverVersion"]);
obj.Add("created", change.Count > 0 ? change["created"] : null);
obj.Add("user", change.Count > 0 ? change["user"] : null);
var prev = (Dictionary<string, object>)histData[(i - 2).ToString()]; // get the history data from the previous file version
dataObj.Add("previous", new Dictionary<string, object>() { // write information about previous file version to the data object
{ "key", prev["key"] }, // write key and url information about previous file version
{ "url", prev["url"] },
});
// write the path to the diff.zip archive with differences in this file version
dataObj.Add("changesUrl", DocManagerHelper.GetPathUri(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "diff.zip").Substring(DocManagerHelper.ContentPath.Length)));
}
if (JwtManager.Enabled)
{
var token = JwtManager.Encode(dataObj);
dataObj.Add("token", token);
}
hist.Add(obj); // add object dictionary to the hist list
histData.Add((i - 1).ToString(), dataObj); // write data object information to the history data
}
// write history information about the current file version to the history object
history = JsonConvert.SerializeObject(new Dictionary<string, object>()
{
{ "currentVersion", currentVersion },
{ "history", hist }
});
historyData = JsonConvert.SerializeObject(histData);
}
}
// get a document which will be compared with the current document
public void GetCompareFileData(out string compareConfig)
{
// get the path to the compared file
var compareFileUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path = "/assets",
Query = "fileName=" + HttpUtility.UrlEncode("sample.docx")
};
// create an object with the information about the compared file
var dataCompareFile = new Dictionary<string, object>
{
{ "fileType", "docx" },
{ "url", compareFileUrl.ToString() }
};
if (JwtManager.Enabled) // if the secret key to generate token exists
{
var compareFileToken = JwtManager.Encode(dataCompareFile); // encode the dataCompareFile object into the token
dataCompareFile.Add("token", compareFileToken); // and add it to the dataCompareFile object
}
compareConfig = JsonConvert.SerializeObject(dataCompareFile);
}
// get a logo config
public void GetLogoConfig(out string logoUrl)
{
// get the path to the logo image
var mailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path = "\\img\\logo.png"
};
// create a logo config
var logoConfig = new Dictionary<string, object>
{
{ "fileType", "png"},
{ "url", mailMergeUrl.ToString()}
};
if (JwtManager.Enabled) // if the secret key to generate token exists
{
var token = JwtManager.Encode(logoConfig); // encode logoConfig into the token
logoConfig.Add("token", token); // and add it to the logo config
}
logoUrl = JsonConvert.SerializeObject(logoConfig).Replace("{", "").Replace("}", "");
}
// get a mail merge config
public void GetMailMergeConfig(out string dataMailMergeRecipients)
{
// get the path to the recipients data for mail merging
var mailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path = "/csv"
};
// create a mail merge config
var mailMergeConfig = new Dictionary<string, object>
{
{ "fileType", "csv" },
{ "url", mailMergeUrl.ToString()}
};
if (JwtManager.Enabled) // if the secret key to generate token exists
{
var mailmergeToken = JwtManager.Encode(mailMergeConfig); // encode mailMergeConfig into the token
mailMergeConfig.Add("token", mailmergeToken); // and add it to the mail merge config
}
dataMailMergeRecipients = JsonConvert.SerializeObject(mailMergeConfig);
}
//get a users for mentions
public void GetUsersMentions(HttpRequest request, out string usersForMentions)
{
var id = request.Cookies.GetOrDefault("uid", null);
var user = Users.getUser(id);
usersForMentions = !user.id.Equals("uid-0") ? JsonConvert.SerializeObject(Users.getUsersForMentions(user.id)) : JsonConvert.SerializeObject(null);
}
}
}

View File

@ -0,0 +1,72 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System.Collections.Generic;
using System.IO;
namespace OnlineEditorsExampleNetCore.Models
{
public static class FileUtility
{
public enum FileType
{
Word,
Cell,
Slide
}
// get file type
public static FileType GetFileType(string fileName)
{
var ext = Path.GetExtension(fileName).ToLower();
if (ExtsDocument.Contains(ext)) return FileType.Word; // word type for document extensions
if (ExtsSpreadsheet.Contains(ext)) return FileType.Cell; // cell type for spreadsheet extensions
if (ExtsPresentation.Contains(ext)) return FileType.Slide; // slide type for presentation extensions
return FileType.Word; // the default type is word
}
// document extensions
public static readonly List<string> ExtsDocument = new List<string>
{
".doc", ".docx", ".docm",
".dot", ".dotx", ".dotm",
".odt", ".fodt", ".ott", ".rtf", ".txt",
".html", ".htm", ".mht", ".xml",
".pdf", ".djvu", ".fb2", ".epub", ".xps"
};
// spreadsheet extensions
public static readonly List<string> ExtsSpreadsheet = new List<string>
{
".xls", ".xlsx", ".xlsm",
".xlt", ".xltx", ".xltm",
".ods", ".fods", ".ots", ".csv"
};
// presentation extensions
public static readonly List<string> ExtsPresentation = new List<string>
{
".pps", ".ppsx", ".ppsm",
".ppt", ".pptx", ".pptm",
".pot", ".potx", ".potm",
".odp", ".fodp", ".otp"
};
}
}

View File

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<Content Include="192.168.1.2\new.docx" />
</ItemGroup>
<ItemGroup>
<None Include="wwwroot\assets\AUTHORS.md" />
<None Include="wwwroot\assets\LICENSE" />
<None Include="wwwroot\assets\new\new.docx" />
<None Include="wwwroot\assets\new\new.pptx" />
<None Include="wwwroot\assets\new\new.xlsx" />
<None Include="wwwroot\assets\sample\csv.csv" />
<None Include="wwwroot\assets\sample\sample.docx" />
<None Include="wwwroot\assets\sample\sample.pptx" />
<None Include="wwwroot\assets\sample\sample.xlsx" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Cors" Version="2.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
</ItemGroup>
<ProjectExtensions><VisualStudio><UserProperties appsettings_1json__JsonSchema="" /></VisualStudio></ProjectExtensions>
</Project>

View File

@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.31205.134
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OnlineEditorsExampleNetCore", "OnlineEditorsExampleNetCore.csproj", "{99F3DBD2-90F0-4F99-A450-A9D8E21C6132}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{99F3DBD2-90F0-4F99-A450-A9D8E21C6132}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{99F3DBD2-90F0-4F99-A450-A9D8E21C6132}.Debug|Any CPU.Build.0 = Debug|Any CPU
{99F3DBD2-90F0-4F99-A450-A9D8E21C6132}.Release|Any CPU.ActiveCfg = Release|Any CPU
{99F3DBD2-90F0-4F99-A450-A9D8E21C6132}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {C16F5484-E16F-462F-9481-64F2A61E0A91}
EndGlobalSection
EndGlobal

View File

@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,23 +16,23 @@
*
*/
package com.onlyoffice.integration.documentserver.serializers;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Hosting;
import java.util.List;
public class SerializerFilter {
@Override
public boolean equals(final Object obj) {
if (obj instanceof List) {
if (((List<?>) obj).size() == 1 && ((List<?>) obj).get(0) == FilterState.NULL.toString()) {
return true;
}
return false;
namespace OnlineEditorsExampleNetCore
{
public class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
return false;
}
@Override
public int hashCode() {
return super.hashCode();
public static IHostBuilder CreateHostBuilder(string[] args) =>
Host.CreateDefaultBuilder(args)
.ConfigureWebHostDefaults(webBuilder =>
{
webBuilder.UseStartup<Startup>();
});
}
}

View File

@ -0,0 +1,12 @@
{
"profiles": {
"OnlineEditorsExampleNetCore": {
"commandName": "Project",
"launchBrowser": true,
"applicationUrl": "http://localhost:8000",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
}
}
}

View File

@ -0,0 +1,62 @@
## Overview
This example will help you integrate ONLYOFFICE Docs into your web application written in .Net Core.
It is aimed at testing the editors. Please, do not use it for production without proper modifications.
## Step 1. Install ONLYOFFICE Docs
Download and install ONLYOFFICE Docs (packaged as Document Server).
See the detailed guide to learn how to install Document Server [for Windows](https://helpcenter.onlyoffice.com/installation/docs-developer-install-windows.aspx), [for Linux](https://helpcenter.onlyoffice.com/installation/docs-developer-install-ubuntu.aspx), or [for Docker](https://helpcenter.onlyoffice.com/server/developer-edition/docker/docker-installation.aspx).
## Step 2. Download the .Net Core code for the editors integration and change base configuration
Download the [.Net Core example](https://api.onlyoffice.com/editors/demopreview) from our site. Or you can clone git repository using **git** command:
```
git clone https://github.com/ONLYOFFICE/document-server-integration.git
```
You need to connect the editors to your web site. Go to the project directory and specify path to the editors installation in the *appsettings.json* file:
```
"files.docservice.url.site": "https://documentserver/"
```
where the **documentserver** is the address of the server with the ONLYOFFICE Document Server installed.
If you want to experiment with the editor configuration, modify the [parameters](https://api.onlyoffice.com/editors/advanced) it the *FileModel.cs* file.
## Step 3. Install the prerequisites
Сheck if your system meets the system requirements:
* Microsoft .NET Core: version 3.1 (download it from the [official Microsoft website](https://dotnet.microsoft.com/download/dotnet/3.1));
You can install the prerequisites using scripts:
### For Windows
(https://docs.microsoft.com/en-us/dotnet/core/install/windows?tabs=net50#install-with-powershell-automation)
### For Linux
(https://docs.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install)
Or you can install .NET Core for your OS following this instruction:
([instruction](https://docs.microsoft.com/en-us/dotnet/core/install/linux))
## Step 4. Run your website with the editors
1. The example listening on http://localhost:8000, but if you want change this value, you need go to folder **Properties** and edit path in the *launchSettings.json* file:
```
"applicationUrl": "http://localhost:8000",
```
where the **http://localhost:8000** is the name of you listening address and you can change 8000 port to any available port.
2. From the current folder where the example is located in your command prompt, run the following command:
```
dotnet run
```
The **dotnet run** command will build and start the app. You can stop the app at any time by selecting **Ctrl+C**.
If you rebuild and restart the app whenever you make code changes, run the following command:
```
dotnet watch run
```
You can stop the app at any time by selecting **Ctrl+C**.
## Step 5. Check accessibility
In case the example and Document Server are installed on different computers, make sure that your server with the example installed has access to the Document Server with the address which you specify instead of **documentserver** in the configuration files.
Make sure that the Document Server has access to the server with the example installed with the address which you specify instead of **example.com** in the configuration files.

View File

@ -0,0 +1,41 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.Json.Serialization;
using System.Threading.Tasks;
namespace OnlineEditorsExampleNetCore.Services
{
public class ResponseFromConvert
{
[JsonPropertyName("error")]
public string Error { get; set; }
[JsonPropertyName("endConvert")]
public bool EndConvert { get; set; }
[JsonPropertyName("fileUrl")]
public string FileUrl { get; set; }
[JsonPropertyName("percent")]
public int Percent { get; set; }
}
}

View File

@ -0,0 +1,89 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.StaticFiles;
using OnlineEditorsExampleNetCore.Helpers;
using System;
using System.IO;
using System.Net;
using System.Threading.Tasks;
using System.Web;
namespace OnlineEditorsExampleNetCore
{
public class WebEditorExtenstions
{
// define tracker status
public enum TrackerStatus
{
NotFound = 0,
Editing = 1,
MustSave = 2,
Corrupted = 3,
Closed = 4,
MustForceSave = 6,
CorruptedForceSave = 7
}
public static void Remove(string fileName)
{
var path = DocManagerHelper.StoragePath(fileName, null);
var histDir = DocManagerHelper.HistoryDir(path);
if (File.Exists(path)) File.Delete(path);
if (Directory.Exists(histDir)) Directory.Delete(histDir, true);
}
public static void DownloadToFile(string url, string path)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentException("url");
if (string.IsNullOrEmpty(path)) throw new ArgumentException("path");
var req = (HttpWebRequest)WebRequest.Create(url);
using (var stream = req.GetResponse().GetResponseStream())
{
if (stream == null) throw new Exception("stream is null");
const int bufferSize = 4096;
using (var fs = File.Open(path, FileMode.Create))
{
var buffer = new byte[bufferSize];
int readed;
while ((readed = stream.Read(buffer, 0, bufferSize)) != 0)
{
fs.Write(buffer, 0, readed);
}
}
}
}
// download data from the url to the file
public static async Task DownloadAsync(string filePath, HttpContext context)
{
var fileinf = new FileInfo(filePath);
context.Response.Headers.Add("Content-Length", fileinf.Length.ToString()); // set headers to the response
new FileExtensionContentTypeProvider().TryGetContentType(filePath, out string contentType);
context.Response.Headers.Add("Content-Type", contentType);
var tmp = HttpUtility.UrlEncode(Path.GetFileName(filePath));
tmp = tmp.Replace("+", "%20");
context.Response.Headers.Add("Content-Disposition", "attachment; filename*=UTF-8\'\'" + tmp);
await context.Response.SendFileAsync(filePath);
}
}
}

View File

@ -0,0 +1,114 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Server.Kestrel.Core;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace OnlineEditorsExampleNetCore
{
public class Startup
{
public IConfiguration Configuration { get; set; }
public IWebHostEnvironment HostEnvironment { get; set; }
public static Dictionary<string, string> AppSettings { get; set; }
public Startup(IConfiguration configuration, IWebHostEnvironment env)
{
Configuration = configuration;
HostEnvironment = env;
}
// This method gets called by the runtime. Use this method to add services to the container.
public void ConfigureServices(IServiceCollection services)
{
AppSettings = Configuration.GetSection("AppSettings").GetChildren()
.ToDictionary(x => x.Key, x => x.Value);
services.AddSingleton(HostEnvironment);
services.AddHttpContextAccessor();
services.AddDistributedMemoryCache();
services.AddSession();
services.AddCors();
services.AddSingleton<IFileProvider>(
new PhysicalFileProvider(
Path.Combine(Directory.GetCurrentDirectory(), "wwwroot")));
services.AddControllersWithViews();
// If using Kestrel:
services.Configure<KestrelServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
// If using IIS:
services.Configure<IISServerOptions>(options =>
{
options.AllowSynchronousIO = true;
});
}
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
if (env.IsDevelopment())
{
app.UseDeveloperExceptionPage();
}
else
{
app.UseExceptionHandler("/Home/Error");
}
app.UseCors(builder =>
{
builder
.AllowAnyOrigin()
.AllowAnyMethod()
.AllowAnyHeader();
});
app.UseSession();
app.UseStaticFiles();
app.UseRouting();
app.UseAuthorization();
app.UseEndpoints(endpoints =>
{
endpoints.MapControllerRoute(
name: "default",
pattern: "{controller=Home}/{action=Index}/{id?}");
});
}
}
}

View File

@ -0,0 +1,201 @@
@{
Layout = null;
}
@model FileModel
<!DOCTYPE html>
<html>
<head runat="server">
<!--
*
* (c) Copyright Ascensio System SIA 2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
@await Html.PartialAsync("EditorMetatagsPartial")
<link rel="icon" href="@Url.Content("~/img/" + @Model.DocumentType + ".ico")" type="image/x-icon" />
<title>@Model.FileName - ONLYOFFICE</title>
@await Html.PartialAsync("EditorCssPartial")
</head>
<body>
<div class="form">
<div id="iframeEditor">
</div>
</div>
<script src="@Startup.AppSettings["files.docservice.url.site"]@Startup.AppSettings["files.docservice.url.api"]"></script>
<script type="text/javascript" language="javascript">
var docEditor;
var innerAlert = function (message) {
if (console && console.log)
console.log(message);
};
// the application is loaded into the browser
var onAppReady = function () {
innerAlert("Document editor ready");
};
// the document is modified
var onDocumentStateChange = function (event) {
var title = document.title.replace(/\*$/g, "");
document.title = title + (event.data ? "*" : "");
};
// the user is trying to switch the document from the viewing into the editing mode
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("editorsMode=view\&?", "i"), "");
};
// an error or some other specific event occurs
var onError = function (event) {
if (event)
innerAlert(event.data);
};
// the document is opened for editing with the old document.key value
var onOutdatedVersion = function (event) {
location.reload(true);
};
// replace the link to the document which contains a bookmark
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;
}
// the user is trying to get link for opening the document which contains a bookmark, scrolling to the bookmark position
var onMakeActionLink = function (event) {
var actionData = event.data;
var linkParam = JSON.stringify(actionData);
docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark
};
// the meta information of the document is changed via the meta command
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite); // change the Favorite icon state
};
// the user is trying to insert an image by clicking the Image from Storage button
var onRequestInsertImage = function (event) {
@{string logoUrl;
Model.GetLogoConfig(out logoUrl);}
docEditor.insertImage({ // insert an image into the file
"c": event.data.c,
@Html.Raw(logoUrl)
})
};
// the user is trying to select document for comparing by clicking the Document from Storage button
var onRequestCompareFile = function () {
@{string compareFileData;
Model.GetCompareFileData(out compareFileData);}
docEditor.setRevisedFile(@Html.Raw(compareFileData)); // select a document for comparing
};
// the user is trying to select recipients data by clicking the Mail merge button
var onRequestMailMergeRecipients = function (event) {
@{ string dataMailMergeRecipients;
Model.GetMailMergeConfig(out dataMailMergeRecipients); }
docEditor.setMailMergeRecipients(@Html.Raw(dataMailMergeRecipients)); // insert recipient data for mail merge into the file
};
var config = @Html.Raw(Model.GetDocConfig(Context, Url));
config.width = "100%";
config.height = "100%";
config.events = {
'onAppReady': onAppReady,
'onDocumentStateChange': onDocumentStateChange,
'onRequestEditRights': onRequestEditRights,
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
"onMakeActionLink": onMakeActionLink,
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
};
@{ string hist, histData; }
@{ Model.GetHistory(out hist, out histData); }
@{ if (!string.IsNullOrEmpty(hist) && !string.IsNullOrEmpty(histData)) }
{
// the user is trying to show the document version history
config.events['onRequestHistory'] = function () {
docEditor.refreshHistory(@Html.Raw(hist)); // show the document version history
};
// the user is trying to click the specific document version in the document version history
config.events['onRequestHistoryData'] = function (event) {
var ver = event.data;
var histData = @Html.Raw(histData);
docEditor.setHistoryData(histData[ver - 1]); // send the link to the document for viewing the version history
};
// the user is trying to go back to the document from viewing the document version history
config.events['onRequestHistoryClose '] = function () {
document.location.reload();
};
}
@{ string usersForMentions; }
@{ Model.GetUsersMentions(Context.Request, out usersForMentions); }
@{ if (!string.IsNullOrEmpty(usersForMentions)) }
{
// add mentions for not anonymous users
config.events['onRequestUsers'] = function () {
docEditor.setUsers({
"users": @Html.Raw(usersForMentions)
});
};
config.events['onRequestSendNotify'] = function (event) {
var actionLink = JSON.stringify(event.data.actionLink);
console.log("onRequestSendNotify:");
console.log(event.data);
console.log("Link to comment: " + replaceActionLink(location.href, actionLink));
};
}
var сonnectEditor = function () {
docEditor = new DocsAPI.DocEditor("iframeEditor", config);
};
if (window.addEventListener) {
window.addEventListener("load", сonnectEditor);
} else if (window.attachEvent) {
window.attachEvent("load", сonnectEditor);
}
</script>
</body>
</html>

View File

@ -0,0 +1,34 @@
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<!--
*
* (c) Copyright Ascensio System SIA 2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
<meta name="viewport" content="width=device-width" />
<title>Error</title>
</head>
<body>
<hgroup>
<h1>Error.</h1>
<h2>An error occurred while processing your request.</h2>
</hgroup>
</body>
</html>

View File

@ -0,0 +1,384 @@
@{
Layout = null;
}
@model FileModel
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en">
<head runat="server">
<!--
*
* (c) Copyright Ascensio System SIA 2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
@await Html.PartialAsync("IndexMetatagsPartial")
<title>ONLYOFFICE</title>
<link href="@Url.Content("~/favicon.ico")" rel="shortcut icon" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.com/css?family=Open+Sans:900,800,700,600,500,400,300&subset=latin,cyrillic-ext,cyrillic,latin-ext" />
@await Html.PartialAsync("IndexCssPartial")
</head>
<body>
<header>
<div class="center">
<div class="menu">
<span></span>
<span></span>
<span></span>
</div>
<a href="">
<img src="~/img/logo.svg" alt="ONLYOFFICE" />
</a>
</div>
</header>
<div class="center main">
<table class="table-main">
<tbody>
<tr>
<td class="left-panel section">
<div class="help-block">
<span>Create new</span>
<div class="clearFix">
<div class="create-panel">
<ul class="try-editor-list clearFix" data-link="@Url.Action("Sample", "Home")">
<li>
<a class="try-editor word" data-type="docx">Document</a>
</li>
<li>
<a class="try-editor cell" data-type="xlsx">Spreadsheet</a>
</li>
<li>
<a class="try-editor slide" data-type="pptx">Presentation</a>
</li>
</ul>
<label class="create-sample">
<input id="createSample" class="checkbox" type="checkbox" />With sample content
</label>
</div>
<div class="upload-panel clearFix">
<a class="file-upload">
Upload file
<input type="file" id="fileupload" name="files[]" data-url="@Url.Content("~/upload")" />
</a>
</div>
</div>
<table class="user-block-table" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="middle">
<span class="select-user">Username</span>
<img class="info" data-id="user" data-tooltip="You can open the same document using different users in different Web browser sessions, so you can check out multi-user editing functions.
</br>
@foreach (User user in Users.getAllUsers())
{
<b>
@if (@user.name == null)
{
user.name = "Anonymous";
}
else @user.name
</b>
<ul>
@foreach (string description in user.descriptions)
{
<li>@description</li>
}
</ul>
}"
src="~/img/info.svg" />
<select class="select-user" id="user">
@foreach (User user in Users.getAllUsers())
{
<option value="@user.id">
@if (@user.name == null)
{
user.name = "Anonymous";
}
else @user.name
</option>
}
</select>
</td>
</tr>
<tr>
<td valign="middle">
<span class="select-user">Language</span>
<img class="info" data-id="language" data-tooltip="Choose the language for ONLYOFFICE editors interface" src="~/img/info.svg" />
<select class="select-user" id="language">
<option value="en">English</option>
<option value="be">Belarusian</option>
<option value="bg">Bulgarian</option>
<option value="ca">Catalan</option>
<option value="zh">Chinese</option>
<option value="cs">Czech</option>
<option value="da">Danish</option>
<option value="nl">Dutch</option>
<option value="fi">Finnish</option>
<option value="fr">French</option>
<option value="de">German</option>
<option value="el">Greek</option>
<option value="hu">Hungarian</option>
<option value="id">Indonesian</option>
<option value="it">Italian</option>
<option value="ja">Japanese</option>
<option value="ko">Korean</option>
<option value="lv">Latvian</option>
<option value="lo">Lao</option>
<option value="nb">Norwegian</option>
<option value="pl">Polish</option>
<option value="pt">Portuguese</option>
<option value="ro">Romanian</option>
<option value="ru">Russian</option>
<option value="sk">Slovak</option>
<option value="sl">Slovenian</option>
<option value="sv">Swedish</option>
<option value="es">Spanish</option>
<option value="tr">Turkish</option>
<option value="uk">Ukrainian</option>
<option value="vi">Vietnamese</option>
</select>
</td>
</tr>
</tbody>
</table>
</div>
</td>
<td class="section">
<div class="main-panel">
@{ var storedFiles = DocManagerHelper.GetStoredFiles(); }
@if (!storedFiles.Any())
{
<span class="portal-name">ONLYOFFICE Document Editors Welcome!</span>
<span class="portal-descr">
Get started with a demo-sample of ONLYOFFICE Document Editors, the first html5-based editors.
<br /> You may upload your own documents for testing using the "<b>Upload file</b>" button and <b>selecting</b> the necessary files on your PC.
</span>
}
else
{
<div class="stored-list">
<span class="header-list">Your documents</span>
<table class="tableHeader" cellspacing="0" cellpadding="0" width="100%">
<thead>
<tr>
<td class="tableHeaderCell tableHeaderCellFileName">Filename</td>
<td class="tableHeaderCell tableHeaderCellEditors contentCells-shift">Editors</td>
<td class="tableHeaderCell tableHeaderCellViewers">Viewers</td>
<td class="tableHeaderCell tableHeaderCellDownload">Download</td>
<td class="tableHeaderCell tableHeaderCellRemove">Remove</td>
</tr>
</thead>
</table>
<div class="scroll-table-body">
<table cellspacing="0" cellpadding="0" width="100%">
<tbody>
@foreach (var storedFile in storedFiles)
{
var editUrl = "Editor?fileID=" + HttpUtility.UrlEncode(storedFile.Name);
var docType = FileUtility.GetFileType(storedFile.Name).ToString().ToLower();
var canEdir = DocManagerHelper.EditedExts.Contains(System.IO.Path.GetExtension(storedFile.Name).ToLower());
var version = DocManagerHelper.GetFileVersion(storedFile.Name, DocManagerHelper.CurUserHostAddress(null));
<tr class="tableRow" title="@storedFile.Name [@version]">
<td class="contentCells">
<a class="stored-edit @docType" href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name })" target="_blank">
<span>@storedFile.Name</span>
</a>
</td>
@if (canEdir)
{
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "edit" })" target="_blank">
<img src="~/img/desktop.svg" alt="Open in editor for full size screens" title="Open in editor for full size screens" />
</a>
</td>
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "mobile", editorsMode = "edit" })" target="_blank">
<img src="~/img/mobile.svg" alt="Open in editor for mobile devices" title="Open in editor for mobile devices" />
</a>
</td>
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "comment" })" target="_blank">
<img src="~/img/comment.svg" alt="Open in editor for comment" title="Open in editor for comment" />
</a>
</td>
@if (docType == "word")
{
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "review" })" target="_blank">
<img src="~/img/review.svg" alt="Open in editor for review" title="Open in editor for review" />
</a>
</td>
}
else if (docType == "cell")
{
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "filter" })" target="_blank">
<img src="~/img/filter.svg" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" />
</a>
</td>
}
@if (docType == "slide")
{
<td class="contentCells contentCells-icon contentCellsEmpty"></td>
}
@if (docType == "word")
{
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "fillForms" })" target="_blank">
<img src="~/img/fill-forms.svg" alt="Open in editor for filling in forms" title="Open in editor for filling in forms" />
</a>
</td>
}
else
{
<td class="contentCells contentCells-icon "></td>
}
@if (docType == "word")
{
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "blockcontent" })" target="_blank">
<img src="~/img/block-content.svg" alt="Open in editor without content control modification" title="Open in editor without content control modification" />
</a>
</td>
}
else
{
<td class="contentCells contentCells-shift contentCells-icon firstContentCellShift "></td>
}
@if (docType == "slide")
{
<td class="contentCells contentCells-icon "></td>
}
}
else
{
<td class="contentCells contentCells-shift contentCells-icon contentCellsEmpty" colspan="6"></td>
}
<td class="contentCells contentCells-icon firstContentCellViewers">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "view" })" target="_blank">
<img src="~/img/desktop.svg" alt="Open in viewer for full size screens" title="Open in viewer for full size screens" />
</a>
</td>
<td class="contentCells contentCells-icon">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "mobile", editorsMode = "view" })" target="_blank">
<img src="~/img/mobile.svg" alt="Open in viewer for mobile devices" title="Open in viewer for mobile devices" />
</a>
</td>
<td class="contentCells contentCells-icon contentCells-shift">
<a href="@Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "embedded", editorsMode = "embedded" })" target="_blank">
<img src="~/img/embeded.svg" alt="Open in embedded mode" title="Open in embedded mode" />
</a>
</td>
<td class="contentCells contentCells-icon contentCells-shift downloadContentCellShift">
<a href="@DocManagerHelper.GetDownloadUrl(storedFile.Name)">
<img class="icon-download" src="~/img/download.svg" alt="Download" title="Download" />
</a>
</td>
<td class="contentCells contentCells-icon contentCells-shift">
<a href="@Url.Action("Remove", "Home", new { fileName = storedFile.Name })">
<img class="icon-delete" src="~/img/delete.svg" alt="Delete" title="Delete" />
</a>
</td>
</tr>
}
</tbody>
</table>
</div>
</div>
}
</div>
</td>
</tr>
</tbody>
</table>
</div>
<div id="mainProgress">
<div id="uploadSteps">
<span id="uploadFileName" class="uploadFileName"></span>
<div class="describeUpload">After these steps are completed, you can work with your document.</div>
<span id="step1" class="step">1. Loading the file.</span>
<span class="step-descr">The loading speed depends on file size and additional elements it contains.</span>
<br />
<span id="step2" class="step">2. Conversion.</span>
<span class="step-descr">The file is converted to OOXML so that you can edit it.</span>
<br />
<div id="blockPassword">
<span class="descrFilePass">The file is password protected.</span>
<br />
<div>
<input id="filePass" type="password" />
<div id="enterPass" class="button orange">Enter</div>
<div id="skipPass" class="button gray">Skip</div>
</div>
<span class="errorPass"></span>
<br />
</div>
<span id="step3" class="step">3. Loading editor scripts.</span>
<span class="step-descr">They are loaded only once, they will be cached on your computer.</span>
<input type="hidden" name="hiddenFileName" id="hiddenFileName" />
<br />
<br />
<span class="progress-descr">Note the speed of all operations depends on your connection quality and server location.</span>
<br />
<br />
<div class="error-message">
<b>Upload error: </b><span></span>
<br />
Please select another file and try again.
</div>
</div>
<iframe id="embeddedView" src="" height="345px" width="432px" frameborder="0" scrolling="no" allowtransparency=allowtransparency></iframe>
<br />
<div id="beginEdit" class="button orange disable">Edit</div>
<div id="beginView" class="button gray disable">View</div>
<div id="beginEmbedded" class="button gray disable">Embedded view</div>
<div id="cancelEdit" class="button gray">Cancel</div>
</div>
<span id="loadScripts" data-docs="@Startup.AppSettings["files.docservice.url.site"]@Startup.AppSettings["files.docservice.url.preloader"]"></span>
<footer>
<div class="center">
<table>
<tbody>
<tr>
<td>
<a href="http://api.onlyoffice.com/editors/howitworks" target="_blank">API Documentation</a>
</td>
<td>
<a href="mailto:sales@onlyoffice.com">Submit your request</a>
</td>
<td class="copy">
&copy; Ascensio System SIA @DateTime.Now.Year.ToString(). All rights reserved.
</td>
@ViewBag.NewFileUrl
</tr>
</tbody>
</table>
</div>
</footer>
@await Html.PartialAsync("IndexScriptsPartial")
<script language="javascript" type="text/javascript">
var ConverExtList = '@string.Join(",", DocManagerHelper.ConvertExts.ToArray())';
var EditedExtList = '@string.Join(",", DocManagerHelper.EditedExts.ToArray())';
var UrlConverter = '@Url.Content("~/convert")';
var UrlEditor = '@Url.Action("editor", "Home")';
</script>
</body>
</html>

View File

@ -0,0 +1 @@
<link href="~/css/editor.css" type="text/css" rel="stylesheet" />

View File

@ -0,0 +1,5 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no, minimal-ui" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="mobile-web-app-capable" content="yes" />

View File

@ -0,0 +1,3 @@
<link href="~/css/jquery-ui.css" type="text/css" rel="stylesheet" />
<link href="~/css/stylesheet.css" type="text/css" rel="stylesheet" />
<link href="~/css/media.css" type="text/css" rel="stylesheet" />

View File

@ -0,0 +1,3 @@
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width" />

View File

@ -0,0 +1 @@
<script asp-src-include="~/js/*.js"></script>

View File

@ -0,0 +1 @@


View File

@ -0,0 +1,25 @@
<!--
*
* (c) Copyright Ascensio System SIA 2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
@using OnlineEditorsExampleNetCore
@using OnlineEditorsExampleNetCore.Models
@using OnlineEditorsExampleNetCore.Helpers
@using System.IO
@using Microsoft.AspNetCore.Http
@using System.Web
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers

View File

@ -0,0 +1,21 @@
<!--
*
* (c) Copyright Ascensio System SIA 2020
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
-->
@{
Layout = "_Layout";
}

View File

@ -0,0 +1,9 @@
{
"Logging": {
"LogLevel": {
"Default": "Information",
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information"
}
}
}

View File

@ -0,0 +1,27 @@
{
"AppSettings": {
"webpages:Version": "2.0.0.0",
"webpages:Enabled": "false",
"PreserveLoginUrl": "true",
"ClientValidationEnabled": "true",
"UnobtrusiveJavaScriptEnabled": "true",
"filesize-max": "5242880",
"files.docservice.viewed-docs": ".pdf|.djvu|.xps|.oxps",
"files.docservice.edited-docs": ".docx|.xlsx|.csv|.pptx|.txt",
"files.docservice.convert-docs": ".docm|.dotx|.dotm|.dot|.doc|.odt|.fodt|.ott|.xlsm|.xltx|.xltm|.xlt|.xls|.ods|.fods|.ots|.pptm|.ppt|.ppsx|.ppsm|.pps|.potx|.potm|.pot|.odp|.fodp|.otp|.rtf|.mht|.html|.htm|.xml|.epub|.fb2",
"files.docservice.timeout": "120000",
"files.docservice.secret": "",
"files.docservice.header": "Authorization",
"files.docservice.url.site": "https://documentserver/",
"files.docservice.url.converter": "ConvertService.ashx",
"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.command": "coauthoring/CommandService.ashx",
"files.docservice.url.example": ""
}
}

View File

@ -0,0 +1,29 @@
ONLYOFFICE Applications example uses code from the following 3rd party projects:
jQuery - jQuery is a new kind of JavaScript Library. jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is designed to change the way that you write JavaScript. NOTE: This package is maintained on behalf of the library owners by the NuGet Community Packages project at https://nugetpackages.codeplex.com/ (https://jquery.org/license/)
License: MIT
License File: jQuery.license
jQuery.BlockUI - The jQuery BlockUI Plugin lets you simulate synchronous behavior when using AJAX, without locking the browser. (https://github.com/malsup/blockui/)
License: MIT, GPL
License File: jQuery.BlockUI.license
jQuery.FileUpload - File Upload widget with multiple file selection, drag&drop support, progress bar, validation and preview images, audio and video for jQuery. Supports cross-domain, chunked and resumable file uploads. Works with any server-side platform (Google App Engine, PHP, Python, Ruby on Rails, Java, etc.) that supports standard HTML form file uploads. (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.FileUpload.license
jQuery.iframe-transport - jQuery Iframe Transport Plugin for File Upload (https://github.com/blueimp/jQuery-File-Upload/blob/master/LICENSE.txt)
License: MIT
License File: jQuery.iframe-transport.license
jQuery.UI - jQuery UI is an open source library of interface components — interactions, full-featured widgets, and animation effects — based on the stellar jQuery javascript library . Each component is built according to jQuery's event-driven architecture (find something, manipulate it) and is themeable, making it easy for developers of any skill level to integrate and extend into their own code. (https://jquery.org/license/)
License: MIT
License File: jQuery.UI.license
Newtonsoft.Json - Json.NET is a popular high-performance JSON framework for .NET (https://licenses.nuget.org/MIT)
License: MIT
License File: Newtonsoft.Json.license
Microsoft.AspNetCore.Cors - CORS middleware and policy for ASP.NET Core to enable cross-origin resource sharing (https://raw.githubusercontent.com/aspnet/AspNetCore/2.0.0/LICENSE.txt)
License: MIT
License File: Microsoft.AspNetCore.Cors.license

View File

@ -0,0 +1,14 @@
Copyright (c) .NET Foundation and Contributors
All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
CONDITIONS OF ANY KIND, either express or implied. See the License for the
specific language governing permissions and limitations under the License.

View File

@ -0,0 +1,14 @@
The MIT License (MIT)
Copyright (c) 2007 James Newton-King
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.

View File

@ -1,4 +1,4 @@
Copyright (c) Peter M. Goldstein, Mike Perham
Copyright (c) 2009 John Resig, http://jquery.com/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the

View File

@ -1,6 +1,6 @@
/**
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,7 +16,7 @@
*
*/
html {
html {
height: 100%;
width: 100%;
}

View File

@ -1,3 +1,21 @@
/**
*
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
@media (min-width: 1280px) and (max-width: 1380px) {
.copy {
margin-right: 6.5%;
@ -87,10 +105,6 @@
}
@media (max-width: 1008px) {
#portal-info {
width: 60vw;
}
.left-panel {
margin-left: 0;
width: 94%;
@ -129,10 +143,6 @@
height: 80px;
}
.main {
height: calc(100% - 128px);
}
.left-panel {
width: 90%;
}
@ -340,9 +350,6 @@
@media (max-width: 593px ) {
#portal-info {
width: 50vw;
}
.file-upload{
width: 100%;
}
@ -357,6 +364,15 @@
top: 31px;
}
.menu {
display: flex;
}
header .center > a {
position: absolute;
left: 30px;
}
footer table tr {
justify-content: center;
}
@ -371,10 +387,6 @@
height: 80px;
}
.main {
height: calc(100% - 128px);
}
.copy {
width: 100%;
text-align: center;
@ -448,58 +460,6 @@
display: none;
width: 1%;
}
/* Mobile Upload*/
.blockUI.blockMsg.blockPage.ui-dialog.ui-widget.ui-corner-all.ui-widget-content.ui-draggable {
width: 344px !important;
box-shadow: 0px 7px 15px rgba(85, 85, 85, 0.1);
border-radius: 2px;
top: 10% !important;
margin-left: -172px !important;
}
.ui-dialog .ui-dialog-titlebar {
padding: 0;
}
.ui-dialog .ui-dialog-content {
padding: 0 !important;
}
#mainProgress {
margin: 24px 16px 0 !important;
}
.blockTitle {
padding: 10px 10px 6px 16px !important;
font-size: 14px !important;
}
#mainProgress .describeUpload {
padding: 8px 0 !important;
}
.dialog-close {
margin: 0 !important;
}
.step-descr{
line-height: 150%;
}
.step {
line-height: 160%;
}
.buttonsMobile{
display: flex;
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
align-items: center;
}
.button.gray{
margin: 0;
}
.button, .button:hover{
display: flex;
justify-content: center;
padding: 0 !important;
width: 144px;
height: 56px;
margin-bottom: 24px !important;
}
}
@media (max-width: 560px) and (min-width: 510px) {
@ -634,43 +594,3 @@
padding-left: 6px;
}
}
@media (max-width: 1100px) and (min-width: 890px){
.main-panel > span{
max-width: 70%;
}
}
@media (max-width: 780px) and (min-width: 600px) {
.main-panel{
display: flex;
flex-direction: column;
}
.main-panel > span{
max-width: 45%;
}
}
@media (max-width: 600px) and (min-width: 320px) {
.main-panel{
display: flex;
flex-direction: column;
}
}
@media (max-width:600px) and (min-width:500px){
.main-panel > span{
max-width:35%;
}
}
@media (max-width:500px) and (min-width:400px){
.main-panel > span{
max-width:20%;
}
}
@media (max-width:400px) and (min-width:320px){
.main-panel > span{
max-width:15%;
}
}
@media all and (-ms-high-contrast: none), (-ms-high-contrast: active) {
.tableRow td:first-child{
max-width: none;
}
}

View File

@ -1,6 +1,6 @@
/**
*
* (c) Copyright Ascensio System SIA 2023
* (c) Copyright Ascensio System SIA 2021
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -16,13 +16,12 @@
*
*/
html {
html {
height: 100%;
width: 100%;
}
body {
display: block;
background: #FFFFFF;
color: #333333;
font-family: Open Sans;
@ -50,6 +49,7 @@ a,
a:hover,
a:visited {
color: #333333;
cursor: pointer;
}
header {
@ -70,8 +70,7 @@ header img {
width: 1152px;
}
.main{
display: table;
.main {
height: calc(100% - 112px);
min-height: 536px;
}
@ -82,7 +81,7 @@ header img {
min-height: 536px;
}
.section{
.section {
height: 100%;
padding: 0;
vertical-align: top;
@ -98,10 +97,6 @@ header img {
width: 896px;
}
#portal-info {
max-width: 65vw;
}
.portal-name {
color: #FF6F3D;
font-size: 24px;
@ -151,22 +146,18 @@ label .checkbox {
}
.try-editor.word {
background-image: url("/assets/images/file_docx.svg");
background-image: url("/img/file_docx.svg");
}
.try-editor.cell {
background-image: url("/assets/images/file_xlsx.svg");
background-image: url("/img/file_xlsx.svg");
}
.try-editor.slide {
background-image: url("/assets/images/file_pptx.svg");
background-image: url("/img/file_pptx.svg");
}
.try-editor.form {
background-image: url("/assets/images/file_docxf.svg");
}
.side-option {
.create-sample {
color: #666666;
line-height: 24px;
}
@ -178,7 +169,7 @@ label .checkbox {
align-items: center;
border-radius: 3px;
box-sizing: border-box;
cursor:pointer;
cursor: pointer;
display: inline-block;
font-weight: 600;
letter-spacing: 0.08em;
@ -209,7 +200,7 @@ label .checkbox {
cursor: default;
}
.button.orange:not(.disable):hover{
.button.orange:not(.disable):hover {
background: #ff7a4b;
}
@ -235,7 +226,7 @@ label .checkbox {
}
.file-upload {
background: url("/assets/images/file_upload.svg") no-repeat 0 transparent;
background: url("/img/file_upload.svg") no-repeat 0 transparent;
cursor: pointer;
display: block;
font-size: 14px;
@ -277,7 +268,7 @@ label .checkbox {
margin: 30px 40px;
}
#mainProgress .uploadFileName{
#mainProgress .uploadFileName {
background-position: left center;
background-repeat: no-repeat;
display: block;
@ -308,7 +299,7 @@ label .checkbox {
}
.error-message {
background: url("/assets/images/error.svg") no-repeat scroll 4px 10px;
background: url("../img/error.svg") no-repeat scroll 4px 10px;
color: #CB0000;
display: none;
line-height: 160%;
@ -329,15 +320,15 @@ label .checkbox {
}
.current {
background-image: url("/assets/images/loader16.gif");
background-image: url("../img/loader16.gif");
}
.done {
background-image: url("/assets/images/done.svg");
background-image: url("../img/done.svg");
}
.error {
background-image: url("/assets/images/notdone.svg");
background-image: url("../img/notdone.svg");
}
.step-descr {
@ -366,13 +357,15 @@ footer {
color: #AAAAAA;
height: 64px;
width: 100%;
position: relative;
left: 0;
bottom: 0;
position: relative;
left: 0;
bottom: 0;
}
footer > .center{
width: 100%;
}
footer table {
width: 100%;
border-spacing: 0;
@ -390,7 +383,7 @@ footer table tr {
}
footer table td {
display: block;
display: block;
position: relative;
padding-left: 32px;
}
@ -406,16 +399,15 @@ footer a:visited {
footer a:hover {
text-decoration: none;
}
footer table tr td:first-child {
margin-left: 14%;
}
.copy {
color: #aaaaaa;
width: max-content;
position: relative;
margin-left: auto;
margin-right: 14%;
}
.help-block {
@ -451,24 +443,22 @@ footer table tr td:first-child {
.stored-edit.word,
.uploadFileName.word {
background-image: url("/assets/images/icon_docx.svg");
background-image: url("../img/icon_docx.svg");
}
.stored-edit.cell,
.uploadFileName.cell {
background-image: url("/assets/images/icon_xlsx.svg");
background-image: url("../img/icon_xlsx.svg");
}
.stored-edit.slide,
.uploadFileName.slide {
background-image: url("/assets/images/icon_pptx.svg");
background-image: url("../img/icon_pptx.svg");
}
.stored-edit span {
font-size: 12px;
line-height: 12px;
bottom: 35%;
position: relative;
}
.stored-edit:hover span {
@ -483,14 +473,14 @@ footer table tr td:first-child {
-webkit-border-radius: 0 !important;
color: #F5F5F5 !important;
font-size: 16px !important;
font-weight: 600!important;
font-weight: 600 !important;
line-height: 133%;
letter-spacing: -0.02em;
padding: 14px 16px 14px 46px !important;
}
.dialog-close {
background: url("/assets/images/close.svg") no-repeat scroll left top;
background: url("../img/close.svg") no-repeat scroll left top;
cursor: pointer;
float: right;
font-size: 1px;
@ -534,7 +524,7 @@ footer table tr td:first-child {
padding-top: 10px;
}
.tableHeader tr{
.tableHeader tr {
background: transparent;
cursor: default;
height: 40px;
@ -555,26 +545,26 @@ footer table tr td:first-child {
width: 37%;
}
.tableHeaderCellEditors{
.tableHeaderCellEditors {
width: 29%;
}
.tableHeaderCellViewers{
.tableHeaderCellViewers {
width: 11%;
}
.tableHeaderCellDownload{
.tableHeaderCellDownload {
width: 13%;
text-align: right;
padding-right: 20px;
}
.tableHeaderCellRemove{
.tableHeaderCellRemove {
text-align: left;
}
.contentCells {
display: block;
display: block;
border-bottom: 1px solid #EFEFEF;
font-family: 'Open Sans', sans-serif;
font-size: 16px;
@ -597,18 +587,46 @@ footer table tr td:first-child {
.select-user {
color: #444444;
font-family: Open Sans;
font-size: 12px!important;
font-weight: normal!important;
line-height: 16px!important;
font-size: 12px !important;
font-weight: normal !important;
line-height: 16px !important;
}
.info{
.info {
cursor: pointer;
margin: -2px 5px;
}
.tooltip {
background: #FFFFFF;
border-radius: 5px;
box-shadow: 0px 7px 25px rgba(85, 85, 85, 0.15);
color: #666666;
line-height: 160%;
max-width: 60vw;
padding: 14px;
position: absolute;
}
#user-tooltip {
overflow-y: overlay;
height: 86vh;
top: 30px;
}
.tooltip ul {
margin: 0;
}
.arrow {
border-top: 8px solid transparent;
border-bottom: 8px solid transparent;
border-right: 8px solid #FFFFFF;
position: absolute;
transform: translate(-50%, -50%);
}
.user-block-table {
height: 100%;
padding-top: 14px;
width: 100%;
}
@ -633,7 +651,11 @@ footer table tr td:first-child {
}
.left-panel {
width: 256px;
display: flex;
flex-direction: column;
flex-wrap: nowrap;
max-width: 256px;
width: 100%;
background: #F5F5F5;
}
@ -683,7 +705,7 @@ footer table tr td:first-child {
}
.errorInput {
border-color: #CB0000!important;
border-color: #CB0000 !important;
}
.errorPass {
@ -693,12 +715,31 @@ footer table tr td:first-child {
letter-spacing: -0.02em;
word-wrap: break-word;
}
.menu {
cursor: pointer;
display: none;
flex-wrap: nowrap;
flex-direction: column;
justify-content: space-between;
top: 10px;
left: 12px;
position: absolute;
content: "";
height: 26px;
width: 30px;
}
.menu span {
content: "";
width: 26px;
height: 3px;
background: rgb(194, 194, 194);
}
html {
overflow-x: hidden;
}
.tableRow {
width: 100%;
display: flex;
@ -707,7 +748,6 @@ html {
position: relative;
}
.tableRow td:first-child {
display: flex;
flex-grow: 1;
@ -730,40 +770,9 @@ html {
.firstContentCellViewers {
margin-left: auto;
}
.user-descr {
display: inline-table;
width: 30vw;
min-width: 200px;
max-width: 400px;
margin-top: 20px;
}
.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%);
.tableHeaderCellDownload{
width: 12%;
}
.tableHeaderCellRemove{
padding-left: 10px;
}

View File

Before

Width:  |  Height:  |  Size: 144 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 452 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 8.2 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

Before

Width:  |  Height:  |  Size: 781 B

After

Width:  |  Height:  |  Size: 781 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 127 B

View File

Before

Width:  |  Height:  |  Size: 547 B

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 425 B

After

Width:  |  Height:  |  Size: 425 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

Before

Width:  |  Height:  |  Size: 331 B

After

Width:  |  Height:  |  Size: 331 B

View File

Before

Width:  |  Height:  |  Size: 507 B

After

Width:  |  Height:  |  Size: 507 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 757 B

After

Width:  |  Height:  |  Size: 757 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

Before

Width:  |  Height:  |  Size: 593 B

After

Width:  |  Height:  |  Size: 593 B

View File

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 738 B

View File

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 691 B

View File

Before

Width:  |  Height:  |  Size: 992 B

After

Width:  |  Height:  |  Size: 992 B

View File

Before

Width:  |  Height:  |  Size: 1004 B

After

Width:  |  Height:  |  Size: 1004 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 152 B

View File

Before

Width:  |  Height:  |  Size: 379 B

After

Width:  |  Height:  |  Size: 379 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 233 B

After

Width:  |  Height:  |  Size: 233 B

View File

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

View File

Before

Width:  |  Height:  |  Size: 631 B

After

Width:  |  Height:  |  Size: 631 B

View File

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 832 B

View File

Before

Width:  |  Height:  |  Size: 488 B

After

Width:  |  Height:  |  Size: 488 B

View File

Before

Width:  |  Height:  |  Size: 673 B

After

Width:  |  Height:  |  Size: 673 B

View File

Before

Width:  |  Height:  |  Size: 2.0 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Some files were not shown because too many files have changed in this diff Show More