Compare commits

...

219 Commits

Author SHA1 Message Date
37e36f7fef Merge pull request #120 from ONLYOFFICE/feature/fix-filename
Feature/fix filename
2021-02-05 14:00:19 +03:00
ec90b2ff98 ruby: check filename from url 2021-02-05 13:40:13 +03:00
758f0c08e5 java: add check filename for download 2021-02-05 13:33:57 +03:00
b76c532569 csharp-mvc: check filename from url 2021-02-05 13:29:08 +03:00
856613d644 csharp: check filename from url 2021-02-05 13:25:12 +03:00
75c11f4ee8 Merge remote-tracking branch 'remotes/origin/develop' into feature/fix-filename
# Conflicts:
#	web/documentserver-example/java/src/main/java/controllers/IndexServlet.java
#	web/documentserver-example/python/src/views/actions.py
2021-02-05 12:56:04 +03:00
1e023e58b2 Merge pull request #119 from ONLYOFFICE/feature/template-submodule
Feature/template submodule
2021-02-04 18:39:50 +03:00
f9f757bd0d ruby: added templates submodule 2021-02-04 17:42:56 +03:00
a213b635f2 csharp-mvc: changed path to sample 2021-02-04 17:05:40 +03:00
96d6c521ef csharp: changed path to sample 2021-02-04 16:56:28 +03:00
7d2469cfe9 php: changed path to sample 2021-02-04 16:36:17 +03:00
2f7352c296 java: changed path to sample 2021-02-04 16:26:05 +03:00
5fdbd2954b uploaded instead created 2021-02-04 16:06:40 +03:00
758291fd71 owner instead author 2021-02-04 15:43:09 +03:00
2a856c6919 python: changed path to sample 2021-02-04 15:25:28 +03:00
f026d0ef60 nodejs: changed path to sample 2021-02-04 15:15:26 +03:00
506b55a201 update submodule (csharp-mvc, csharp, php, java, nodejs, python) 2021-02-04 14:26:15 +03:00
90dd2c837f Merge remote-tracking branch 'remotes/origin/develop' into feature/template-submodule 2021-02-04 11:00:08 +03:00
75d828a6ae Merge pull request #118 from ONLYOFFICE/feature/update-dependencies
python: update (django, requests, pyjwt)
2021-02-04 10:45:50 +03:00
fe3b5558df python: update (django, requests, pyjwt) 2021-02-04 10:41:41 +03:00
3d49eabaf0 Merge pull request #117 from ONLYOFFICE/feature/get-files
Feature/get files
2021-02-04 10:07:13 +03:00
51f712b900 ruby: improved get_files_info 2021-02-03 13:01:44 +03:00
a565da4035 php: improved GetFilesInfo 2021-02-03 12:52:11 +03:00
7db6983167 python: improved GetFilesInfo 2021-02-03 12:47:13 +03:00
b7262ff874 java: improved GetFilesInfo 2021-02-03 12:43:08 +03:00
50921b278b csharp: improved GetFilesInfo 2021-02-03 12:42:39 +03:00
9d16bee672 csharp-mvc: improved GetFilesInfo 2021-02-03 12:42:00 +03:00
1a63a7f65f nodejs: add Content-Type 2021-02-03 12:13:17 +03:00
f8f15d2191 Merge remote-tracking branch 'remotes/origin/develop' into feature/get-files
# Conflicts:
#	web/documentserver-example/csharp-mvc/WebEditor.ashx.cs
#	web/documentserver-example/csharp/WebEditor.ashx.cs
#	web/documentserver-example/java/src/main/java/controllers/IndexServlet.java
#	web/documentserver-example/php/webeditor-ajax.php
#	web/documentserver-example/python/src/urls.py
#	web/documentserver-example/python/src/views/actions.py
#	web/documentserver-example/ruby/app/controllers/home_controller.rb
#	web/documentserver-example/ruby/config/routes.rb
2021-02-02 22:12:21 +03:00
2b217de9b4 ruby: get-file 2021-02-02 22:01:48 +03:00
6f64d40e5d ruby: get-files 2021-02-02 21:44:50 +03:00
9759839cd0 Merge pull request #114 from ONLYOFFICE/feature/fix-history
Feature/fix history
2021-02-02 13:09:41 +03:00
e6ee57e09b php: fix tabulation 2021-02-02 12:53:56 +03:00
50daec31b4 java: fix tabulation 2021-02-02 12:51:08 +03:00
bcd114d089 ruby: fix-history 2021-02-02 12:29:04 +03:00
49592f66bf Merge pull request #113 from ONLYOFFICE/feature/fix-history-cors
Feature/fix history cors
2021-02-02 11:13:40 +03:00
e854b78884 Merge pull request #112 from ONLYOFFICE/feature/add-jwt
Feature/add jwt
2021-02-02 11:06:12 +03:00
4dd5f9d9f6 Merge remote-tracking branch 'remotes/origin/develop' into feature/add-jwt
# Conflicts:
#	web/documentserver-example/python/src/utils/historyManager.py
2021-02-02 11:02:53 +03:00
abee34981b ruby: jwt for historyData 2021-02-02 10:57:52 +03:00
768f45f4fb Merge remote-tracking branch 'remotes/origin/release/v6.2.0' into develop 2021-02-02 09:54:22 +03:00
e53dac1e2b Merge pull request #111 from ONLYOFFICE/feature/mail-merge
Feature/mail merge
2021-02-02 09:51:22 +03:00
71ab72299a php: added function download 2021-02-01 23:16:47 +03:00
eb4e6b4bc0 csharp-mvc: added function download 2021-02-01 23:09:49 +03:00
4f02a4957f csharp: added function download 2021-02-01 23:05:25 +03:00
469c2b6ced java: added function download 2021-02-01 23:02:55 +03:00
8b9a2d2481 csharp: fix merge 2021-02-01 23:02:15 +03:00
e921c936b8 java: fix merge 2021-02-01 23:00:10 +03:00
a5929897ad php: fix merge 2021-02-01 22:59:17 +03:00
00a1c64353 python: fix merge 2021-02-01 22:58:42 +03:00
6c18acdf97 ruby: fix merge 2021-02-01 22:57:13 +03:00
c0f459132e csharp-mvc: fix merge 2021-02-01 21:07:49 +03:00
d780a61e52 ruby: jwt for mailmerge 2021-02-01 20:30:07 +03:00
361b8bd0f4 Merge remote-tracking branch 'remotes/origin/develop' into feature/mail-merge
# Conflicts:
#	web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
#	web/documentserver-example/csharp-mvc/WebEditor.ashx.cs
#	web/documentserver-example/csharp/DocEditor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx.cs
#	web/documentserver-example/csharp/WebEditor.ashx.cs
#	web/documentserver-example/java/src/main/java/controllers/EditorServlet.java
#	web/documentserver-example/java/src/main/java/controllers/IndexServlet.java
#	web/documentserver-example/java/src/main/webapp/editor.jsp
#	web/documentserver-example/nodejs/app.js
#	web/documentserver-example/nodejs/views/editor.ejs
#	web/documentserver-example/php/doceditor.php
#	web/documentserver-example/php/webeditor-ajax.php
#	web/documentserver-example/python/src/views/actions.py
#	web/documentserver-example/python/templates/editor.html
#	web/documentserver-example/ruby/app/models/file_model.rb
#	web/documentserver-example/ruby/app/views/home/editor.html.erb
2021-02-01 16:57:59 +03:00
48694f0f31 ruby: mailmerge 2021-02-01 12:33:23 +03:00
9ed7b0e96e ruby: fix cors 2021-01-31 16:02:57 +03:00
a2a094a22c Merge pull request #109 from ONLYOFFICE/feature/config-refactor
Feature/config refactor
2021-01-29 16:20:26 +03:00
9d9afce3ce GetServerUrl 2021-01-29 15:54:27 +03:00
bb19ea1a6f рhp: fix serverPath 2021-01-29 14:41:02 +03:00
d667a62a24 csharp: fix GetServerUrl 2021-01-29 14:28:56 +03:00
a92907135d csharp-mvc: fix GetServerUrl 2021-01-29 14:14:25 +03:00
71fde6f7b9 python: fix getServerUrl 2021-01-29 13:58:29 +03:00
9ac78b77dc ruby: fix get_server_url 2021-01-29 13:45:38 +03:00
dae246e8a2 Merge remote-tracking branch 'remotes/origin/develop' into feature/config-refactor
# Conflicts:
#	web/documentserver-example/java/src/main/java/controllers/EditorServlet.java
#	web/documentserver-example/python/src/views/actions.py
#	web/documentserver-example/ruby/config/application.rb
2021-01-29 12:49:30 +03:00
7f95d59394 java: fix jwtHeader 2021-01-29 12:38:23 +03:00
7bfa4229de ruby: add Rails.configuration.header 2021-01-29 12:35:10 +03:00
1c6c45606b ruby: add Rails.configuration.urlExample 2021-01-29 12:09:16 +03:00
1c0a742f54 ruby: config-refactor 2021-01-28 22:05:09 +03:00
4eb4753c01 Merge pull request #107 from ONLYOFFICE/feature/insert-image
Feature/insert image
2021-01-28 19:07:10 +03:00
979f001fd0 csharp: fixed tabulation 2021-01-28 17:47:48 +03:00
d0edb368ac csharp-mvc: fixed tabulation 2021-01-28 17:46:41 +03:00
ac36df16d1 csharp-mvc: moved functions 2021-01-28 17:35:34 +03:00
e845cc498b csharp: moved functions 2021-01-28 17:34:45 +03:00
606ce23228 nodejs: fix merge 2021-01-28 15:29:14 +03:00
dcd4adf5ad ruby: fix merge 2021-01-28 15:16:19 +03:00
6e81fa8996 Merge branch 'develop' into feature/insert-image
# Conflicts:
#	web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx.cs
#	web/documentserver-example/java/src/main/java/controllers/EditorServlet.java
#	web/documentserver-example/java/src/main/webapp/editor.jsp
#	web/documentserver-example/nodejs/app.js
#	web/documentserver-example/nodejs/views/editor.ejs
#	web/documentserver-example/php/doceditor.php
#	web/documentserver-example/python/src/views/actions.py
#	web/documentserver-example/python/templates/editor.html
#	web/documentserver-example/ruby/app/models/file_model.rb
#	web/documentserver-example/ruby/app/views/home/editor.html.erb
2021-01-28 15:12:36 +03:00
15580ee144 add logo.png csharp-mvc, csharp, java, nodejs, php, python, ruby 2021-01-28 14:48:44 +03:00
422bb36b53 delete logo.png csharp-mvc, csharp, java, nodejs, php, python, ruby 2021-01-28 14:46:00 +03:00
e74811a755 Merge pull request #108 from ONLYOFFICE/feature/compare-file
Feature/compare file
2021-01-28 14:11:57 +03:00
4c987fbfce nodejs: fix merge 2021-01-28 13:49:30 +03:00
e90ba356fe ruby: fix merge 2021-01-28 13:49:14 +03:00
54c6025bc5 Merge remote-tracking branch 'remotes/origin/develop' into feature/compare-file
# Conflicts:
#	web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx
#	web/documentserver-example/java/src/main/webapp/editor.jsp
#	web/documentserver-example/nodejs/views/editor.ejs
#	web/documentserver-example/php/doceditor.php
#	web/documentserver-example/python/templates/editor.html
#	web/documentserver-example/ruby/app/views/home/editor.html.erb
2021-01-28 13:38:00 +03:00
b867d75bac ruby: compare-file 2021-01-28 13:28:28 +03:00
2748dbf5b3 csharp: fix tabulation 2021-01-28 11:28:24 +03:00
8b5aab3c63 Merge branch hotfix/v6.1.1 into develop 2021-01-28 08:15:33 +00:00
ee23e7948e ruby: jwt for insert-image 2021-01-28 11:13:10 +03:00
badcd6e110 ruby: fix merge 2021-01-28 10:50:24 +03:00
53e1fbe9ef nodejs fix merge 2021-01-28 10:49:44 +03:00
c28e12e31e add logo.png csharp-mvc, csharp, java, nodejs, php, python, ruby 2021-01-28 10:32:04 +03:00
b94704adf8 Merge remote-tracking branch 'remotes/origin/develop' into feature/insert-image
# Conflicts:
#	web/documentserver-example/csharp-mvc/Views/Home/Editor.aspx
#	web/documentserver-example/csharp/DocEditor.aspx
#	web/documentserver-example/java/src/main/webapp/editor.jsp
#	web/documentserver-example/nodejs/views/editor.ejs
#	web/documentserver-example/php/doceditor.php
#	web/documentserver-example/python/templates/editor.html
#	web/documentserver-example/ruby/app/views/home/editor.html.erb
2021-01-27 17:13:14 +03:00
1fc1fb2b76 Merge pull request #106 from ONLYOFFICE/feature/add-format
Feature/add format
2021-01-27 11:51:38 +03:00
267fe7d260 Merge pull request #105 from ONLYOFFICE/feature/favorite
Feature/favorite
2021-01-27 11:49:21 +03:00
b8f5485201 Merge pull request #104 from ONLYOFFICE/feature/new-banner
Feature/new banner
2021-01-27 11:16:26 +03:00
d19eaf0ef4 js: new banner 2021-01-27 10:14:29 +03:00
9ee379e8df ruby: setFavorite 2021-01-26 17:04:38 +03:00
a4b75554bd csharp: fix banner 2021-01-26 16:18:00 +03:00
854f5e7045 csharp-mvc: fix banner 2021-01-26 16:14:31 +03:00
8cf4eb2fc2 Merge branch 'develop' into feature/new-banner 2021-01-26 16:06:46 +03:00
eba3f15587 ruby: fix banner 2021-01-26 16:02:48 +03:00
3f52fd5563 ruby: insert-image 2021-01-26 15:41:33 +03:00
b439a5f729 ruby: add fb2 to ConverExtList 2021-01-26 13:35:07 +03:00
848229f79c ruby: new banner 2021-01-26 13:22:17 +03:00
491f600dc0 csharp: added templates submodule 2021-01-25 12:22:42 +03:00
0e3c759806 csharp: get-file 2021-01-25 01:45:57 +03:00
6427db4ea6 csharp: get-files 2021-01-25 01:39:28 +03:00
d624cdf0f6 csharp: fix-history 2021-01-25 00:50:04 +03:00
930338f5fc csharp: fix cors 2021-01-24 23:17:30 +03:00
0875ca8d89 csharp: add files.docservice.header 2021-01-24 23:11:43 +03:00
193bbe2cb7 csharp-mvc: fix files.docservice.header b2ee170ecb 2021-01-24 22:39:12 +03:00
533ee1af91 csharp-mvc: fix GetServerUrl a104aa6c61 2021-01-24 22:11:15 +03:00
db0339d4e4 csharp: add files.docservice.url.example 2021-01-24 22:10:19 +03:00
1a46b8a215 csharp: config-refactor 2021-01-24 16:41:07 +03:00
022f1bb16d csharp: setFavorite 2021-01-24 15:41:45 +03:00
c01afdec17 csharp-mvc: set favorite 2021-01-24 02:49:09 +03:00
b2ee170ecb csharp: add files.docservice.header 2021-01-22 14:43:51 +03:00
a104aa6c61 csharp: add files.docservice.url.example 2021-01-22 11:47:53 +03:00
3f13590f55 csharp-mvc: config-refactor 2021-01-21 14:48:25 +03:00
aa7132e467 csharp-mvc: fix-history 2021-01-20 22:31:01 +03:00
60ddcb433c Merge branch 'develop' into feature/fix-history 2021-01-20 21:58:27 +03:00
14840847bf csharp-mvc: get-file 2021-01-20 21:10:39 +03:00
06cf08822b csharp-mvc: get-files 2021-01-20 17:50:46 +03:00
c4e2921040 Merge branch 'develop' into feature/get-files 2021-01-20 14:52:30 +03:00
ea455421f7 csharp-mvc: fix cors 2021-01-20 12:10:22 +03:00
90abe267bf Merge branch 'develop' into feature/fix-history-cors 2021-01-20 12:04:38 +03:00
a92963aed1 csharp-mvc: added templates submodule 2021-01-19 15:11:45 +03:00
d19ee9d4c1 python: added templates submodule 2021-01-16 21:19:36 +03:00
1a7fbe656b php: added templates submodule 2021-01-16 20:36:14 +03:00
500be4f8e4 java: added templates submodule 2021-01-16 20:02:54 +03:00
1b2cec44ac nodejs: mime v2 lookup renamed to getType (0a2056b1b1) 2020-12-25 10:03:42 +03:00
ecfe99f7ed Merge branch 'develop' into feature/mail-merge 2020-12-25 10:02:44 +03:00
81450a883f nodejs: mime v2 lookup renamed to getType (0a2056b1b1) 2020-12-25 10:02:29 +03:00
fec328ad9d python: setFavorite 2020-12-24 22:51:35 +03:00
b197f4c258 php: setFavorite 2020-12-24 22:50:28 +03:00
0b03093c53 java: setFavorite 2020-12-24 22:49:22 +03:00
3bf8952b1a nodejs: nodejs: templates submodule 2020-12-21 15:10:12 +03:00
23b42ed070 nodejs: restructured assets folder 2020-12-21 15:05:07 +03:00
25906383e2 nodejs: setFavorite 2020-12-16 09:57:29 +03:00
c597e914a9 nodejs: favorite 2020-12-15 17:33:00 +03:00
125d9a2ab4 Merge remote-tracking branch 'origin/release/v6.1.0' into develop 2020-12-07 12:45:21 +03:00
4dd4453599 csharp: jwt for HistoryData 2020-12-06 13:30:30 +03:00
7e2d83f04e csharp-mvc: jwt for HistoryData 2020-12-06 13:28:13 +03:00
b7d2775733 Merge branch 'feature/compare-file' of https://github.com/ONLYOFFICE/document-server-integration into feature/compare-file 2020-12-05 12:29:30 +03:00
aa5f1e3df4 csharp: compare-file 2020-12-05 12:22:35 +03:00
4193089de4 csharp-mvc: compare-file 2020-12-05 12:07:56 +03:00
18a4dc20eb csharp: insert-image 2020-12-04 19:03:02 +03:00
7ced0591bd csharp-mvc: insert-image 2020-12-04 18:19:54 +03:00
a010088395 csharp-mvc: fix mail-merge 2020-12-04 12:35:06 +03:00
d5a6c1e605 csharp: fix mail-merge 2020-12-04 12:33:22 +03:00
ab68d95f5d csharp-mvc: mail-merge 2020-12-02 19:22:20 +03:00
301775aafd csharp: mail-merge 2020-12-02 19:01:55 +03:00
51c180726c Merge remote-tracking branch 'remotes/origin/develop' into feature/mail-merge 2020-11-29 13:29:01 +03:00
aee637b980 python: check filename from url 2020-11-27 22:56:24 +03:00
63af540fe8 php: check filename from url 2020-11-27 22:55:01 +03:00
2819cbc5e3 java: check filename from url 2020-11-27 22:52:22 +03:00
02db6fa76a csharp: added .fb2 to ConverExtList 2020-11-27 17:16:06 +03:00
1feb56e397 csharp-mvc: added .fb2 to ConverExtList 2020-11-27 17:14:34 +03:00
502f001cfa Merge branch 'feature/csharp' into feature/add-format 2020-11-27 17:02:04 +03:00
7c10a0fe82 csharp-mvc: banner 2020-11-27 16:27:12 +03:00
aa16df8de7 java: fix filename (38cc631e2e) 2020-11-27 15:25:47 +03:00
bbff0206c1 php: fix filename (7b017c15f8) 2020-11-27 13:09:10 +03:00
e08e6f5f27 java: jwt for compare-file 2020-11-27 11:34:10 +03:00
38cc631e2e java: compare-file 2020-11-27 11:31:13 +03:00
6250902a55 php: jwt for compare-file 2020-11-27 11:00:16 +03:00
7b017c15f8 php: compare-file 2020-11-27 10:57:50 +03:00
b21d179f4b python: jwt for compare-file 2020-11-26 18:32:06 +03:00
c75f9166c5 python: compare-file 2020-11-26 18:30:27 +03:00
0f2695fba0 nodejs: jwt for compare-file 2020-11-26 18:16:44 +03:00
aca8e94f2a nodejs: compare-file 2020-11-26 18:13:01 +03:00
9876e745e5 python: jwt for insert-image 2020-11-26 17:27:01 +03:00
eb8cf75bc0 java: jwt for insert-image 2020-11-26 17:23:21 +03:00
62060d2538 php: jwt for insert-image 2020-11-26 17:20:57 +03:00
0ad9907eb6 nodejs: jwt for insert-image 2020-11-26 17:18:04 +03:00
2090bad807 nodejs: insert-image 2020-11-26 17:12:53 +03:00
2368354c6d php: insert-image 2020-11-26 16:10:09 +03:00
31337cc9c9 python: insert-image 2020-11-26 15:33:16 +03:00
17cad4a0dc java: insert-image 2020-11-26 14:54:09 +03:00
48fa83b850 php: jwt for mailmerge 2020-11-26 01:16:33 +03:00
2017c45c19 java: jwt for mailmerge 2020-11-26 01:07:23 +03:00
74505f5c44 nodejs: jwt for mailmerge 2020-11-26 00:31:42 +03:00
6f6e80cf68 python: jwt for mailmerge 2020-11-26 00:14:12 +03:00
d5a8cdc760 python: jwt for historyData 2020-11-25 18:54:46 +03:00
ca5ba06506 php: jwt for historyData 2020-11-25 18:47:12 +03:00
720c61c7b7 java: jwt for historyData 2020-11-25 18:40:30 +03:00
6e03e71b59 php: add DOC_SERV_JWT_HEADER 2020-11-25 10:20:29 +03:00
ea22efdac8 java: fix 773aa62478 2020-11-24 22:24:19 +03:00
5521cd44dd python: add DOC_SERV_JWT_HEADER 2020-11-24 13:27:54 +03:00
773aa62478 java: add files.docservice.url.example 2020-11-23 17:22:02 +03:00
280d9e3dba nodejs: fix config 2020-11-23 15:47:37 +03:00
ee5fe30010 python: fix 791f2b53a9 2020-11-23 15:19:38 +03:00
c0b520e440 php: config-refactor 2020-11-23 11:00:57 +03:00
fd95aca32b java: config-refactor 2020-11-23 10:42:32 +03:00
791f2b53a9 python: config-refactor 2020-11-20 18:16:26 +03:00
9f806aa48a java: fix banner 2020-11-19 17:48:51 +03:00
85dd8f8b77 java: add fb2 to ConverExtList 2020-11-19 17:18:13 +03:00
e91beb5518 php: add fb2 to ConverExtList 2020-11-19 16:45:10 +03:00
39fbf43019 python: add fb2 to ConverExtList 2020-11-19 13:59:09 +03:00
e8eb607325 python: fix-history 2020-11-19 12:17:04 +03:00
974840bbac python: new banner 2020-11-18 18:26:53 +03:00
be5f6e3a6e python: fix 4903c017f4 2020-11-18 18:14:59 +03:00
19debed4d1 php: fix 9b7d54fdfb 2020-11-18 17:50:41 +03:00
4903c017f4 python: mailmerge 2020-11-18 17:48:19 +03:00
6c3f31c32a python: get-file 2020-11-18 14:57:17 +03:00
73d79c1f61 python: get-files 2020-11-18 14:55:23 +03:00
4ef5f7d290 nodejs, java: add Content-Type, fix 2e3fd4725a, 1d24a4a309 2020-11-16 16:02:12 +03:00
9b7d54fdfb php: mailmerge 2020-11-16 15:45:28 +03:00
4e17421c7e php: get-file 2020-11-16 11:16:51 +03:00
2b4513d68b php: get-files 2020-11-15 20:53:04 +03:00
47c0b04de1 php: new banner 2020-11-13 14:38:45 +03:00
ee077978b9 php: fix-history 2020-11-13 14:32:14 +03:00
1dc5e67da6 php: fix cors 2020-11-13 11:48:40 +03:00
0512243be0 java: fix-history 2020-11-12 10:28:38 +03:00
ba3b3b4ce6 java: fix cors 2020-11-11 14:15:54 +03:00
57e813d0ce fixed tabulation 1d24a4a309 2020-11-10 15:35:34 +03:00
1d24a4a309 The GetFilesInfo () method has been improved. If the method is called without a parameter, then the entire list of files is returned, if the idFile parameter is specified, then information about the file with id: idFile is returned. 2020-11-09 18:15:45 +03:00
fe7e7640b5 method getFilesInFolderInfo() moved from nodejs example to java example 2020-11-09 15:23:48 +03:00
67b93909ac java: mailmerge 2020-11-09 11:10:34 +03:00
17f651c47a java: new banner 2020-11-06 11:29:47 +03:00
928cc7480a nodejs: new banner 2020-11-06 11:10:39 +03:00
bf8e59ddee csharp: new banner 2020-11-06 10:46:25 +03:00
fa0aad779d nodejs: mailmerge 2020-07-07 16:27:26 +03:00
137 changed files with 1779 additions and 385 deletions

28
.gitmodules vendored Normal file
View File

@ -0,0 +1,28 @@
[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
branch = main/en
[submodule "web/documentserver-example/csharp/assets"]
path = web/documentserver-example/csharp/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en
[submodule "web/documentserver-example/ruby/public/assets"]
path = web/documentserver-example/ruby/public/assets
url = https://github.com/ONLYOFFICE/document-templates
branch = main/en

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -44,10 +44,13 @@ a, a:hover, a:visited {
.top-panel {
background: url("images/logo.png") no-repeat 30px center #3D4A6B;
background: #3D4A6B;
height: 80px;
width: 100%;
}
.top-panel img {
margin: 12px 0 0 16px;
}
.main-panel {
margin: 80px auto;
width: 600px;

View File

@ -16,6 +16,7 @@
*
*/
using System.IO;
using System.Web.Mvc;
using OnlineEditorsExampleMVC.Helpers;
using OnlineEditorsExampleMVC.Models;
@ -35,7 +36,7 @@ namespace OnlineEditorsExampleMVC.Controllers
{
Mode = editorsMode,
Type = editorsType,
FileName = fileName
FileName = Path.GetFileName(fileName)
};
return View("Editor", file);

View File

@ -72,7 +72,7 @@ namespace OnlineEditorsExampleMVC.Helpers
{
Directory.CreateDirectory(directory);
}
return directory + fileName;
return directory + Path.GetFileName(fileName);
}
public static string HistoryDir(string storagePath)
@ -93,7 +93,7 @@ namespace OnlineEditorsExampleMVC.Helpers
public static int GetFileVersion(string historyPath)
{
if (!Directory.Exists(historyPath)) return 0;
return Directory.EnumerateDirectories(historyPath).Count();
return Directory.EnumerateDirectories(historyPath).Count() + 1;
}
public static int GetFileVersion(string fileName, string userAddress)
@ -114,24 +114,26 @@ namespace OnlineEditorsExampleMVC.Helpers
return name;
}
public static List<string> GetStoredFiles()
public static List<FileInfo> GetStoredFiles()
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
if (!Directory.Exists(directory)) return new List<string>();
if (!Directory.Exists(directory)) return new List<FileInfo>();
var directoryInfo = new DirectoryInfo(directory);
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).Select(fileInfo => fileInfo.Name).ToList();
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
return storedFiles;
}
public static string CreateDemo(string fileExt, bool withContent)
{
var demoName = (withContent ? "sample." : "new.") + fileExt;
var demoPath = "assets\\" + (withContent ? "sample\\" : "new\\");
var fileName = GetCorrectName(demoName);
File.Copy(HttpRuntime.AppDomainAppPath + "app_data\\" + demoName, StoragePath(fileName));
File.Copy(HttpRuntime.AppDomainAppPath + demoPath + demoName, StoragePath(fileName));
return fileName;
}
@ -141,15 +143,15 @@ namespace OnlineEditorsExampleMVC.Helpers
var histDir = HistoryDir(StoragePath(fileName, null));
Directory.CreateDirectory(histDir);
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString() },
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", string.IsNullOrEmpty(uid) ? "uid-1" : uid },
{ "name", string.IsNullOrEmpty(uname) ? "John Smith" : uname }
}));
}
public static string GetFileUri(string fileName)
public static string GetFileUri(string fileName, Boolean forDocumentServer)
{
var uri = new UriBuilder(HttpContext.Current.Request.Url)
var uri = new UriBuilder(GetServerUrl(forDocumentServer))
{
Path = HttpRuntime.AppDomainAppVirtualPath + "/"
+ CurUserHostAddress() + "/"
@ -162,7 +164,7 @@ namespace OnlineEditorsExampleMVC.Helpers
public static string GetPathUri(string path)
{
var uri = new UriBuilder(HttpContext.Current.Request.Url)
var uri = new UriBuilder(GetServerUrl(true))
{
Path = HttpRuntime.AppDomainAppVirtualPath + "/"
+ path,
@ -172,9 +174,26 @@ namespace OnlineEditorsExampleMVC.Helpers
return uri.ToString();
}
public static string GetServerUrl(Boolean forDocumentServer)
{
if (forDocumentServer && !WebConfigurationManager.AppSettings["files.docservice.url.example"].Equals(""))
{
return WebConfigurationManager.AppSettings["files.docservice.url.example"];
}
else
{
var uri = new UriBuilder(HttpContext.Current.Request.Url) { Query = "" };
var requestHost = HttpContext.Current.Request.Headers["Host"];
if (!string.IsNullOrEmpty(requestHost))
uri = new UriBuilder(uri.Scheme + "://" + requestHost);
return uri.ToString();
}
}
public static string GetCallback(string fileName)
{
var callbackUrl = new UriBuilder(HttpContext.Current.Request.Url)
var callbackUrl = new UriBuilder(GetServerUrl(true))
{
Path =
HttpRuntime.AppDomainAppVirtualPath
@ -201,5 +220,36 @@ namespace OnlineEditorsExampleMVC.Helpers
return ".docx";
}
}
public static List<Dictionary<string, object>> GetFilesInfo(string fileId = null)
{
var files = new List<Dictionary<string, object>>();
foreach (var file in GetStoredFiles())
{
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());
if (fileId != null)
{
if (fileId.Equals(dictionary["id"]))
{
files.Add(dictionary);
break;
}
}
else
{
files.Add(dictionary);
}
}
return files;
}
}
}

View File

@ -38,7 +38,7 @@ namespace OnlineEditorsExampleMVC.Helpers
/// </summary>
static ServiceConverter()
{
DocumentConverterUrl = WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "";
DocumentConverterUrl = (WebConfigurationManager.AppSettings["files.docservice.url.site"] ?? "") + (WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "");
Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out ConvertTimeout);
ConvertTimeout = ConvertTimeout > 0 ? ConvertTimeout : 120000;
@ -119,7 +119,8 @@ namespace OnlineEditorsExampleMVC.Helpers
var payloadToken = JwtManager.Encode(payload);
var bodyToken = JwtManager.Encode(body);
request.Headers.Add("Authorization", "Bearer " + payloadToken);
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
request.Headers.Add(JWTheader, "Bearer " + payloadToken);
body.Add("token", bodyToken);
}

View File

@ -34,7 +34,12 @@ namespace OnlineEditorsExampleMVC.Models
public string FileUri
{
get { return DocManagerHelper.GetFileUri(FileName); }
get { return DocManagerHelper.GetFileUri(FileName, true); }
}
public string FileUriUser
{
get { return DocManagerHelper.GetFileUri(FileName, false); }
}
public string FileName { get; set; }
@ -64,6 +69,12 @@ namespace OnlineEditorsExampleMVC.Models
var canEdit = DocManagerHelper.EditedExts.Contains(ext);
var mode = canEdit && editorsMode != "view" ? "edit" : "view";
object favorite = null;
if (!string.IsNullOrEmpty(request.Cookies.GetOrDefault("uid", null)))
{
favorite = request.Cookies.GetOrDefault("uid", null).Equals("uid-2");
}
var actionLink = request.GetOrDefault("actionLink", null);
var actionData = string.IsNullOrEmpty(actionLink) ? null : jss.DeserializeObject(actionLink);
@ -81,8 +92,9 @@ namespace OnlineEditorsExampleMVC.Models
{
"info", new Dictionary<string, object>
{
{ "author", "Me" },
{ "created", DateTime.Now.ToShortDateString() }
{ "owner", "Me" },
{ "uploaded", DateTime.Now.ToShortDateString() },
{ "favorite", favorite}
}
},
{
@ -116,9 +128,9 @@ namespace OnlineEditorsExampleMVC.Models
{
"embedded", new Dictionary<string, object>
{
{ "saveUrl", FileUri },
{ "embedUrl", FileUri },
{ "shareUrl", FileUri },
{ "saveUrl", FileUriUser },
{ "embedUrl", FileUriUser },
{ "shareUrl", FileUriUser },
{ "toolbarDocked", "top" }
}
},
@ -162,18 +174,18 @@ namespace OnlineEditorsExampleMVC.Models
var hist = new List<Dictionary<string, object>>();
var histData = new Dictionary<string, object>();
for (var i = 0; i <= currentVersion; i++)
for (var i = 1; i <= currentVersion; i++)
{
var obj = new Dictionary<string, object>();
var dataObj = new Dictionary<string, object>();
var verDir = DocManagerHelper.VersionDir(histDir, i + 1);
var verDir = DocManagerHelper.VersionDir(histDir, i);
var key = i == currentVersion ? Key : File.ReadAllText(Path.Combine(verDir, "key.txt"));
obj.Add("key", key);
obj.Add("version", i);
if (i == 0)
if (i == 1)
{
var infoPath = Path.Combine(histDir, "createdInfo.json");
@ -191,9 +203,9 @@ namespace OnlineEditorsExampleMVC.Models
dataObj.Add("key", key);
dataObj.Add("url", i == currentVersion ? FileUri : DocManagerHelper.GetPathUri(Directory.GetFiles(verDir, "prev.*")[0].Substring(HttpRuntime.AppDomainAppPath.Length)));
dataObj.Add("version", i);
if (i > 0)
if (i > 1)
{
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(Path.Combine(DocManagerHelper.VersionDir(histDir, i), "changes.json")));
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "changes.json")));
var change = ((Dictionary<string, object>)((ArrayList)changes["changes"])[0]);
obj.Add("changes", changes["changes"]);
@ -201,16 +213,20 @@ namespace OnlineEditorsExampleMVC.Models
obj.Add("created", change["created"]);
obj.Add("user", change["user"]);
var prev = (Dictionary<string, object>)histData[(i - 1).ToString()];
var prev = (Dictionary<string, object>)histData[(i - 2).ToString()];
dataObj.Add("previous", new Dictionary<string, object>() {
{ "key", prev["key"] },
{ "url", prev["url"] },
});
dataObj.Add("changesUrl", DocManagerHelper.GetPathUri(Path.Combine(DocManagerHelper.VersionDir(histDir, i), "diff.zip").Substring(HttpRuntime.AppDomainAppPath.Length)));
dataObj.Add("changesUrl", DocManagerHelper.GetPathUri(Path.Combine(DocManagerHelper.VersionDir(histDir, i - 1), "diff.zip").Substring(HttpRuntime.AppDomainAppPath.Length)));
}
if(JwtManager.Enabled)
{
var token = JwtManager.Encode(dataObj);
dataObj.Add("token", token);
}
hist.Add(obj);
histData.Add(i.ToString(), dataObj);
histData.Add((i - 1).ToString(), dataObj);
}
history = jss.Serialize(new Dictionary<string, object>()
@ -221,5 +237,86 @@ namespace OnlineEditorsExampleMVC.Models
historyData = jss.Serialize(histData);
}
}
public void GetCompareFileData(out string compareConfig)
{
var jss = new JavaScriptSerializer();
var compareFileUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx",
Query = "type=download&fileName=" + HttpUtility.UrlEncode("sample.docx")
};
var dataCompareFile = new Dictionary<string, object>
{
{ "fileType", "docx" },
{ "url", compareFileUrl.ToString() }
};
if (JwtManager.Enabled)
{
var compareFileToken = JwtManager.Encode(dataCompareFile);
dataCompareFile.Add("token", compareFileToken);
}
compareConfig = jss.Serialize(dataCompareFile);
}
public void GetLogoConfig(out string logoUrl)
{
var jss = new JavaScriptSerializer();
var mailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "Content\\images\\logo.png"
};
var logoConfig = new Dictionary<string, object>
{
{ "fileType", "png"},
{ "url", mailMergeUrl.ToString()}
};
if (JwtManager.Enabled)
{
var token = JwtManager.Encode(logoConfig);
logoConfig.Add("token", token);
}
logoUrl = jss.Serialize(logoConfig).Replace("{", "").Replace("}", "");
}
public void GetMailMergeConfig(out string dataMailMergeRecipients)
{
var jss = new JavaScriptSerializer();
var mailMergeUrl = new UriBuilder(DocManagerHelper.GetServerUrl(true))
{
Path =
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx",
Query = "type=csv"
};
var mailMergeConfig = new Dictionary<string, object>
{
{ "fileType", "csv" },
{ "url", mailMergeUrl.ToString()}
};
if (JwtManager.Enabled)
{
var mailmergeToken = JwtManager.Encode(mailMergeConfig);
mailMergeConfig.Add("token", mailmergeToken);
}
dataMailMergeRecipients = jss.Serialize(mailMergeConfig);
}
}
}

View File

@ -168,9 +168,15 @@
<Content Include="WebEditor.ashx" />
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
</ItemGroup>
<ItemGroup>
<Content Include="assets\AUTHORS.md" />
<Content Include="assets\LICENSE" />
<Content Include="assets\new\new.docx" />
<Content Include="assets\new\new.pptx" />
<Content Include="assets\new\new.xlsx" />
<Content Include="assets\sample\csv.csv" />
<Content Include="assets\sample\sample.docx" />
<Content Include="assets\sample\sample.pptx" />
<Content Include="assets\sample\sample.xlsx" />
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup>

View File

@ -41,7 +41,7 @@
</div>
</div>
<%: Scripts.Render(new []{ WebConfigurationManager.AppSettings["files.docservice.url.api"] }) %>
<%: Scripts.Render(new []{ WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.api"] }) %>
<script type="text/javascript" language="javascript">
@ -96,6 +96,34 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var onRequestInsertImage = function (event) {
<% string logoUrl;%>
<% Model.GetLogoConfig(out logoUrl); %>
docEditor.insertImage({
"c": event.data.c,
<%= logoUrl%>
})
};
var onRequestCompareFile = function () {
<% string compareFileData; %>
<% Model.GetCompareFileData(out compareFileData); %>
docEditor.setRevisedFile(<%=compareFileData%>);
};
var onRequestMailMergeRecipients = function (event) {
<% string dataMailMergeRecipients; %>
<% Model.GetMailMergeConfig(out dataMailMergeRecipients); %>
docEditor.setMailMergeRecipients(<%= dataMailMergeRecipients%>);
};
var config = <%= Model.GetDocConfig(Request, Url) %>;
config.width = "100%";
@ -108,6 +136,10 @@
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
"onMakeActionLink": onMakeActionLink,
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
};
<% string hist, histData; %>
@ -120,7 +152,7 @@
config.events['onRequestHistoryData'] = function (event) {
var ver = event.data;
var histData = <%= histData %>;
docEditor.setHistoryData(histData[ver]);
docEditor.setHistoryData(histData[ver - 1]);
};
config.events['onRequestHistoryClose '] = function () {
document.location.reload();

View File

@ -37,7 +37,11 @@
<%: Styles.Render("~/Content/css") %>
</head>
<body>
<div class="top-panel"></div>
<div class="top-panel">
<a href="">
<img src ="content/images/logo.svg" alt="ONLYOFFICE" />
</a>
</div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
@ -148,75 +152,75 @@
<% foreach (var storedFile in storedFiles)
{ %>
<%
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile);
var docType = FileUtility.GetFileType(storedFile).ToString().ToLower();
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile.Name);
var docType = FileUtility.GetFileType(storedFile.Name).ToString().ToLower();
%>
<tr class="tableRow" title="<%= storedFile %>">
<tr class="tableRow" title="<%= storedFile.Name %>">
<td class="contentCells">
<a class="stored-edit <%= docType %>" href="<%= Url.Action("Editor", "Home", new { fileName = storedFile }) %>" target="_blank">
<span title="<%= storedFile %>"><%= storedFile %></span>
<a class="stored-edit <%= docType %>" href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name }) %>" target="_blank">
<span title="<%= storedFile.Name %>"><%= storedFile.Name %></span>
</a>
<a href="<%= Url.Content(DocManagerHelper.CurUserHostAddress() + "/" + storedFile) %>">
<img class="icon-download" src="content/images/download-24.png" alt="Download" title="Download" />
</a>
<a class="delete-file" data-filename="<%= storedFile %>">
<a class="delete-file" data-filename="<%= storedFile.Name %>">
<img class="icon-delete" src="content/images/delete-24.png" alt="Delete" title="Delete" />
</a>
</td>
<td class="contentCells contentCells-icon">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "edit" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "edit" }) %>" target="_blank">
<img src="content/images/desktop-24.png" 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, editorsType = "mobile", editorsMode = "edit" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "mobile", editorsMode = "edit" }) %>" target="_blank">
<img src="content/images/mobile-24.png" alt="Open in editor for mobile devices" title="Open in editor for mobile devices"/>
</a>
</td>
<td class="contentCells contentCells-icon">
<% if (docType == "text") { %>
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "review" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "review" }) %>" target="_blank">
<img src="content/images/review-24.png" alt="Open in editor for review" title="Open in editor for review"/>
</a>
<% } else if (docType == "spreadsheet") { %>
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "filter" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "filter" }) %>" target="_blank">
<img src="content/images/filter-24.png" alt="Open in editor without access to change the filter" title="Open in editor without access to change the filter" />
</a>
<% } %>
</td>
<td class="contentCells contentCells-icon">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "comment" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "comment" }) %>" target="_blank">
<img src="content/images/comment-24.png" alt="Open in editor for comment" title="Open in editor for comment"/>
</a>
</td>
<td class="contentCells contentCells-icon">
<% if (docType == "text") { %>
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "fillForms" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "fillForms" }) %>" target="_blank">
<img src="content/images/fill-forms-24.png" alt="Open in editor for filling in forms" title="Open in editor for filling in forms"/>
</a>
<% } %>
</td>
<td class="contentCells contentCells-shift contentCells-icon">
<% if (docType == "text") { %>
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "blockcontent" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "blockcontent" }) %>" target="_blank">
<img src="content/images/block-content-24.png" alt="Open in editor without content control modification" title="Open in editor without content control modification"/>
</a>
<% } %>
</td>
<td class="contentCells contentCells-icon">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "desktop", editorsMode = "view" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "desktop", editorsMode = "view" }) %>" target="_blank">
<img src="content/images/desktop-24.png" 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, editorsType = "mobile", editorsMode = "view" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "mobile", editorsMode = "view" }) %>" target="_blank">
<img src="content/images/mobile-24.png" alt="Open in viewer for mobile devices" title="Open in viewer for mobile devices"/>
</a>
</td>
<td class="contentCells contentCells-icon">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile, editorsType = "embedded", editorsMode = "embedded" }) %>" target="_blank">
<a href="<%= Url.Action("Editor", "Home", new { fileName = storedFile.Name, editorsType = "embedded", editorsMode = "embedded" }) %>" target="_blank">
<img src="content/images/embeded-24.png" alt="Open in embedded mode" title="Open in embedded mode"/>
</a>
</td>
@ -281,7 +285,7 @@
<div id="cancelEdit" class="button gray">Cancel</div>
</div>
<span id="loadScripts" data-docs="<%= WebConfigurationManager.AppSettings["files.docservice.url.preloader"] %>"></span>
<span id="loadScripts" data-docs="<%= WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.preloader"] %>"></span>
<div class="bottom-panel">&copy; Ascensio System SIA <%= DateTime.Now.Year.ToString() %>. All rights reserved.</div>

View File

@ -26,6 +26,11 @@
</system.web>
<system.webServer>
<validation validateIntegratedModeConfiguration="false" />
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<handlers>
<remove name="ExtensionlessUrlHandler-Integrated-4.0" />
<remove name="OPTIONSVerbHandler" />
@ -47,6 +52,10 @@
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
<bindingRedirect oldVersion="1.0.0.0-5.2.7.0" newVersion="5.2.7.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42632606e9261f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<entityFramework>

View File

@ -22,9 +22,9 @@ using System.IO;
using System.Linq;
using System.Net;
using System.Web;
using System.Web.Configuration;
using System.Web.Script.Serialization;
using System.Web.Services;
using System.Web.Configuration;
using OnlineEditorsExampleMVC.Helpers;
using OnlineEditorsExampleMVC.Models;
@ -50,6 +50,15 @@ namespace OnlineEditorsExampleMVC
case "remove":
Remove(context);
break;
case "download":
Download(context);
break;
case "csv":
GetCsv(context);
break;
case "files":
Files(context);
break;
}
}
@ -102,8 +111,8 @@ namespace OnlineEditorsExampleMVC
context.Response.ContentType = "text/plain";
try
{
var fileName = context.Request["filename"];
var fileUri = DocManagerHelper.GetFileUri(fileName);
var fileName = Path.GetFileName(context.Request["filename"]);
var fileUri = DocManagerHelper.GetFileUri(fileName, true);
var extension = (Path.GetExtension(fileUri) ?? "").Trim('.');
var internalExtension = DocManagerHelper.GetInternalExtension(FileUtility.GetFileType(fileName)).Trim('.');
@ -166,7 +175,7 @@ namespace OnlineEditorsExampleMVC
private static void Track(HttpContext context)
{
var userAddress = context.Request["userAddress"];
var fileName = context.Request["fileName"];
var fileName = Path.GetFileName(context.Request["fileName"]);
string body;
try
@ -188,18 +197,31 @@ namespace OnlineEditorsExampleMVC
if (JwtManager.Enabled)
{
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
string token = null;
if (fileData.ContainsKey("token"))
{
fileData = jss.Deserialize<Dictionary<string, object>>(JwtManager.Decode(fileData["token"].ToString()));
token = JwtManager.Decode(fileData["token"].ToString());
}
else if (context.Request.Headers.AllKeys.Contains("Authorization", StringComparer.InvariantCultureIgnoreCase))
else if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
{
var headerToken = context.Request.Headers.Get("Authorization").Substring("Bearer ".Length);
fileData = (Dictionary<string, object>)jss.Deserialize<Dictionary<string, object>>(JwtManager.Decode(headerToken))["payload"];
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
token = JwtManager.Decode(headerToken);
}
else
{
throw new Exception("Expected JWT");
context.Response.Write("{\"error\":1,\"message\":\"JWT expected\"}");
}
if (token != null && !token.Equals(""))
{
fileData = (Dictionary<string, object>)jss.Deserialize<Dictionary<string, object>>(token)["payload"];
}
else
{
context.Response.Write("{\"error\":1,\"message\":\"JWT validation failed\"}");
}
}
@ -216,7 +238,7 @@ namespace OnlineEditorsExampleMVC
{
var storagePath = DocManagerHelper.StoragePath(fileName, userAddress);
var histDir = DocManagerHelper.HistoryDir(storagePath);
var versionDir = DocManagerHelper.VersionDir(histDir, DocManagerHelper.GetFileVersion(histDir) + 1);
var versionDir = DocManagerHelper.VersionDir(histDir, DocManagerHelper.GetFileVersion(histDir));
if (!Directory.Exists(versionDir)) Directory.CreateDirectory(versionDir);
@ -253,7 +275,7 @@ namespace OnlineEditorsExampleMVC
context.Response.ContentType = "text/plain";
try
{
var fileName = context.Request["fileName"];
var fileName = Path.GetFileName(context.Request["fileName"]);
Remove(fileName);
context.Response.Write("{ \"success\": true }");
@ -273,6 +295,64 @@ namespace OnlineEditorsExampleMVC
if (Directory.Exists(histDir)) Directory.Delete(histDir, true);
}
private static void Files(HttpContext context)
{
List<Dictionary<string, object>> files = null;
try
{
var jss = new JavaScriptSerializer();
context.Response.ContentType = "application/json";
if (context.Request["fileId"] == null)
{
files = DocManagerHelper.GetFilesInfo();
context.Response.Write(jss.Serialize(files));
}
else
{
var fileId = context.Request["fileId"];
files = DocManagerHelper.GetFilesInfo(fileId);
if (files.Count == 0)
{
context.Response.Write("\"File not found\"");
}
else
{
context.Response.Write(jss.Serialize(files));
}
}
}
catch (Exception e)
{
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
}
}
private static void Download(HttpContext context)
{
var fileName = "sample/" + Path.GetFileName(context.Request["filename"]);
download(fileName, context);
}
private static void GetCsv(HttpContext context)
{
var fileName = "sample/" + "csv.csv";
download(fileName, context);
}
private static void download(string fileName, HttpContext context)
{
var csvPath = HttpRuntime.AppDomainAppPath + "assets/" + fileName;
var fileinf = new FileInfo(csvPath);
context.Response.AddHeader("Content-Length", fileinf.Length.ToString());
context.Response.AddHeader("Content-Type", MimeMapping.GetMimeMapping(csvPath));
var tmp = HttpUtility.UrlEncode(Path.GetFileName(csvPath));
tmp = tmp.Replace("+", "%20");
context.Response.AddHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + tmp);
context.Response.TransmitFile(csvPath);
}
private static void DownloadToFile(string url, string path)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentException("url");

View File

@ -11,11 +11,17 @@
<add key="files.docservice.viewed-docs" value=".pdf|.djvu|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.xlsx|.csv|.pptx|.txt"/>
<add key="files.docservice.convert-docs" value=".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|.epub"/>
<add key="files.docservice.convert-docs" value=".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|.epub|.fb2"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.secret" value="" />
<add key="files.docservice.header" value="Authorization" />
<add key="files.docservice.url.converter" value="https://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.site" value="http://documentserver/"/>
<add key="files.docservice.url.converter" value="ConvertService.ashx"/>
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.example" value=""/>
</appSettings>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -44,10 +44,13 @@ a, a:hover, a:visited {
.top-panel {
background: url("images/logo.png") no-repeat 30px center #3D4A6B;
background: #3D4A6B;
height: 80px;
width: 100%;
}
.top-panel img {
margin: 12px 0 0 16px;
}
.main-panel {
margin: 80px auto;
width: 600px;

View File

@ -57,7 +57,11 @@
<body>
<form id="form1" runat="server">
<div class="top-panel"></div>
<div class="top-panel">
<a href="">
<img src ="app_themes/images/logo.svg" alt="ONLYOFFICE" />
</a>
</div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />
@ -168,18 +172,18 @@
<% foreach (var storedFile in storedFiles)
{ %>
<%
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile);
var docType = DocumentType(storedFile);
var editUrl = "doceditor.aspx?fileID=" + HttpUtility.UrlEncode(storedFile.Name);
var docType = DocumentType(storedFile.Name);
%>
<tr class="tableRow" title="<%= storedFile %>">
<tr class="tableRow" title="<%= storedFile.Name %>">
<td class="contentCells">
<a class="stored-edit <%= docType %>" href="<%= editUrl %>" target="_blank">
<span title="<%= storedFile %>"><%= storedFile %></span>
<span title="<%= storedFile.Name %>"><%= storedFile.Name %></span>
</a>
<a href="<%= VirtualPath + WebConfigurationManager.AppSettings["storage-path"] + storedFile %>">
<a href="<%= VirtualPath + WebConfigurationManager.AppSettings["storage-path"] + storedFile.Name %>">
<img class="icon-download" src="app_themes/images/download-24.png" alt="Download" title="Download" />
</a>
<a class="delete-file" data-filename="<%= storedFile %>">
<a class="delete-file" data-filename="<%= storedFile.Name %>">
<img class="icon-delete" src="app_themes/images/delete-24.png" alt="Delete" title="Delete" />
</a>
</td>
@ -254,7 +258,7 @@
<div class="help-block">
<span>Want to learn how it works?</span>
<% var examples = new DirectoryInfo(HttpRuntime.AppDomainAppPath + "App_Data")
<% var examples = new DirectoryInfo(HttpRuntime.AppDomainAppPath + "assets")
.GetFiles("*.zip", SearchOption.TopDirectoryOnly)
.Select(fileInfo => fileInfo.Name).ToList();
if (examples.Any())

View File

@ -68,18 +68,6 @@ namespace OnlineEditorsExample
public partial class _Default : Page
{
public static UriBuilder Host
{
get
{
var uri = new UriBuilder(HttpContext.Current.Request.Url) {Query = ""};
var requestHost = HttpContext.Current.Request.Headers["Host"];
if (!string.IsNullOrEmpty(requestHost))
uri = new UriBuilder(uri.Scheme + "://" + requestHost);
return uri;
}
}
public static string VirtualPath
{
@ -144,7 +132,7 @@ namespace OnlineEditorsExample
{
Directory.CreateDirectory(directory);
}
return directory + fileName;
return directory + Path.GetFileName(fileName);
}
public static string HistoryDir(string storagePath)
@ -165,7 +153,7 @@ namespace OnlineEditorsExample
public static int GetFileVersion(string historyPath)
{
if (!Directory.Exists(historyPath)) return 0;
return Directory.EnumerateDirectories(historyPath).Count();
return Directory.EnumerateDirectories(historyPath).Count() + 1;
}
public static int GetFileVersion(string fileName, string userAddress)
@ -173,13 +161,30 @@ namespace OnlineEditorsExample
return GetFileVersion(HistoryDir(StoragePath(fileName, userAddress)));
}
public static string FileUri(string fileName)
public static string FileUri(string fileName, Boolean forDocumentServer)
{
var uri = Host;
var uri = new UriBuilder(GetServerUrl(forDocumentServer));
uri.Path = VirtualPath + fileName;
return uri.ToString();
}
public static string GetServerUrl(Boolean forDocumentServer)
{
if (forDocumentServer && !WebConfigurationManager.AppSettings["files.docservice.url.example"].Equals(""))
{
return WebConfigurationManager.AppSettings["files.docservice.url.example"];
}
else
{
var uri = new UriBuilder(HttpContext.Current.Request.Url) { Query = "" };
var requestHost = HttpContext.Current.Request.Headers["Host"];
if (!string.IsNullOrEmpty(requestHost))
uri = new UriBuilder(uri.Scheme + "://" + requestHost);
return uri.ToString();
}
}
public static string DocumentType(string fileName)
{
var ext = Path.GetExtension(fileName).ToLower();
@ -191,7 +196,7 @@ namespace OnlineEditorsExample
return string.Empty;
}
protected string UrlPreloadScripts = WebConfigurationManager.AppSettings["files.docservice.url.preloader"];
protected string UrlPreloadScripts = WebConfigurationManager.AppSettings["files.docservice.url.site"] + WebConfigurationManager.AppSettings["files.docservice.url.preloader"];
protected void Page_Load(object sender, EventArgs e)
@ -232,7 +237,7 @@ namespace OnlineEditorsExample
var histDir = HistoryDir(savedFileName);
Directory.CreateDirectory(histDir);
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString() },
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", context.Request.Cookies.GetOrDefault("uid", "uid-1") },
{ "name", context.Request.Cookies.GetOrDefault("uname", "John Smith") }
}));
@ -279,7 +284,7 @@ namespace OnlineEditorsExample
var histDir = HistoryDir(StoragePath(_fileName, null));
Directory.CreateDirectory(histDir);
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString() },
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", request.Cookies.GetOrDefault("uid", "uid-1") },
{ "name", request.Cookies.GetOrDefault("uname", "John Smith") }
}));
@ -293,7 +298,7 @@ namespace OnlineEditorsExample
public static string DoConvert(HttpContext context)
{
_fileName = context.Request["filename"];
_fileName = Path.GetFileName(context.Request["filename"]);
var extension = (Path.GetExtension(_fileName) ?? "").Trim('.');
var internalExtension = FileType.GetInternalExtension(_fileName).Trim('.');
@ -301,10 +306,10 @@ namespace OnlineEditorsExample
if (ConvertExts.Contains("." + extension)
&& !string.IsNullOrEmpty(internalExtension))
{
var key = ServiceConverter.GenerateRevisionId(FileUri(_fileName));
var key = ServiceConverter.GenerateRevisionId(FileUri(_fileName, true));
string newFileUri;
var result = ServiceConverter.GetConvertedUri(FileUri(_fileName), extension, internalExtension, key, true, out newFileUri);
var result = ServiceConverter.GetConvertedUri(FileUri(_fileName, true), extension, internalExtension, key, true, out newFileUri);
if (result != 100)
{
return "{ \"step\" : \"" + result + "\", \"filename\" : \"" + _fileName + "\"}";
@ -367,15 +372,45 @@ namespace OnlineEditorsExample
return name;
}
protected static List<string> GetStoredFiles()
protected static List<FileInfo> GetStoredFiles()
{
var directory = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"] + CurUserHostAddress(null) + "\\";
if (!Directory.Exists(directory)) return new List<string>();
if (!Directory.Exists(directory)) return new List<FileInfo>();
var directoryInfo = new DirectoryInfo(directory);
var storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).Select(fileInfo => fileInfo.Name).ToList();
List<FileInfo> storedFiles = directoryInfo.GetFiles("*.*", SearchOption.TopDirectoryOnly).ToList();
return storedFiles;
}
public static List<Dictionary<string, object>> GetFilesInfo(string fileId = null)
{
var files = new List<Dictionary<string, object>>();
foreach (var file in GetStoredFiles())
{
var dictionary = new Dictionary<string, object>();
dictionary.Add("version", GetFileVersion(file.Name, null));
dictionary.Add("id", ServiceConverter.GenerateRevisionId(_Default.CurUserHostAddress(null) + "/" + file.Name + "/" + File.GetLastWriteTime(_Default.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());
if (fileId != null)
{
if (fileId.Equals(dictionary["id"]))
{
files.Add(dictionary);
break;
}
}
else
{
files.Add(dictionary);
}
}
return files;
}
}
}

View File

@ -114,6 +114,28 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var onRequestInsertImage = function (event) {
docEditor.insertImage({
"c": event.data.c,
<%= InsertImageConfig%>
})
};
var onRequestCompareFile = function () {
docEditor.setRevisedFile(<%= compareFileData%>);
};
var onRequestMailMergeRecipients = function (event) {
docEditor.setMailMergeRecipients(<%= dataMailMergeRecipients%>);
};
var config = <%= DocConfig %>;
config.width = "100%";
@ -126,6 +148,10 @@
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
'onMakeActionLink': onMakeActionLink,
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestCompareFile': onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
};
<% if (!string.IsNullOrEmpty(History) && !string.IsNullOrEmpty(HistoryData))
@ -136,7 +162,7 @@
config.events['onRequestHistoryData'] = function (event) {
var ver = event.data;
var histData = <%= HistoryData %>;
docEditor.setHistoryData(histData[ver]);
docEditor.setHistoryData(histData[ver - 1]);
};
config.events['onRequestHistoryClose '] = function () {
document.location.reload();

View File

@ -34,7 +34,12 @@ namespace OnlineEditorsExample
public static string FileUri
{
get { return _Default.FileUri(FileName); }
get { return _Default.FileUri(FileName, true); }
}
public static string FileUriUser
{
get { return _Default.FileUri(FileName, false); }
}
protected string Key
@ -49,18 +54,21 @@ namespace OnlineEditorsExample
protected string DocServiceApiUri
{
get { return WebConfigurationManager.AppSettings["files.docservice.url.api"] ?? string.Empty; }
get { return (WebConfigurationManager.AppSettings["files.docservice.url.site"] ?? string.Empty) + (WebConfigurationManager.AppSettings["files.docservice.url.api"] ?? string.Empty); }
}
protected string DocConfig { get; private set; }
protected string History { get; private set; }
protected string HistoryData { get; private set; }
protected string InsertImageConfig { get; private set; }
protected string compareFileData { get; private set; }
protected string dataMailMergeRecipients { get; private set; }
public static string CallbackUrl
{
get
{
var callbackUrl = _Default.Host;
var callbackUrl = new UriBuilder(_Default.GetServerUrl(true));
callbackUrl.Path =
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
@ -81,7 +89,7 @@ namespace OnlineEditorsExample
}
else
{
FileName = Request["fileID"];
FileName = Path.GetFileName(Request["fileID"]);
}
var type = Request["type"];
@ -100,6 +108,12 @@ namespace OnlineEditorsExample
var jss = new JavaScriptSerializer();
object favorite = null;
if (!string.IsNullOrEmpty(Request.Cookies.GetOrDefault("uid", null)))
{
favorite = Request.Cookies.GetOrDefault("uid", null).Equals("uid-2");
}
var actionLink = Request.GetOrDefault("actionLink", null);
var actionData = string.IsNullOrEmpty(actionLink) ? null : jss.DeserializeObject(actionLink);
@ -117,8 +131,9 @@ namespace OnlineEditorsExample
{
"info", new Dictionary<string, object>
{
{ "author", "Me" },
{ "created", DateTime.Now.ToShortDateString() }
{ "owner", "Me" },
{ "uploaded", DateTime.Now.ToShortDateString() },
{ "favorite", favorite }
}
},
{
@ -152,9 +167,9 @@ namespace OnlineEditorsExample
{
"embedded", new Dictionary<string, object>
{
{ "saveUrl", FileUri },
{ "embedUrl", FileUri },
{ "shareUrl", FileUri },
{ "saveUrl", FileUriUser },
{ "embedUrl", FileUriUser },
{ "shareUrl", FileUriUser },
{ "toolbarDocked", "top" }
}
},
@ -166,7 +181,7 @@ namespace OnlineEditorsExample
{
"goback", new Dictionary<string, object>
{
{ "url", _Default.Host + "default.aspx" }
{ "url", _Default.GetServerUrl(false) + "default.aspx" }
}
}
}
@ -185,8 +200,19 @@ namespace OnlineEditorsExample
try
{
Dictionary<string, object> logoConfig = GetLogoConfig();
InsertImageConfig = jss.Serialize(logoConfig).Replace("{", "").Replace("}", "");
Dictionary<string, object> compareFile = GetCompareFile();
compareFileData = jss.Serialize(compareFile);
Dictionary<string, object> mailMergeConfig = GetMailMergeConfig();
dataMailMergeRecipients = jss.Serialize(mailMergeConfig);
Dictionary<string, object> hist;
Dictionary<string, object> histData;
GetHistory(out hist, out histData);
if (hist != null && histData != null)
{
@ -211,18 +237,18 @@ namespace OnlineEditorsExample
var hist = new List<Dictionary<string, object>>();
var histData = new Dictionary<string, object>();
for (var i = 0; i <= currentVersion; i++)
for (var i = 1; i <= currentVersion; i++)
{
var obj = new Dictionary<string, object>();
var dataObj = new Dictionary<string, object>();
var verDir = _Default.VersionDir(histDir, i + 1);
var verDir = _Default.VersionDir(histDir, i);
var key = i == currentVersion ? Key : File.ReadAllText(Path.Combine(verDir, "key.txt"));
obj.Add("key", key);
obj.Add("version", i);
if (i == 0)
if (i == 1)
{
var infoPath = Path.Combine(histDir, "createdInfo.json");
@ -239,9 +265,9 @@ namespace OnlineEditorsExample
dataObj.Add("key", key);
dataObj.Add("url", i == currentVersion ? FileUri : MakePublicUrl(Directory.GetFiles(verDir, "prev.*")[0]));
dataObj.Add("version", i);
if (i > 0)
if (i > 1)
{
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(Path.Combine(_Default.VersionDir(histDir, i), "changes.json")));
var changes = jss.Deserialize<Dictionary<string, object>>(File.ReadAllText(Path.Combine(_Default.VersionDir(histDir, i - 1), "changes.json")));
var change = ((Dictionary<string, object>)((ArrayList)changes["changes"])[0]);
obj.Add("changes", changes["changes"]);
@ -249,16 +275,20 @@ namespace OnlineEditorsExample
obj.Add("created", change["created"]);
obj.Add("user", change["user"]);
var prev = (Dictionary<string, object>)histData[(i - 1).ToString()];
var prev = (Dictionary<string, object>)histData[(i - 2).ToString()];
dataObj.Add("previous", new Dictionary<string, object>() {
{ "key", prev["key"] },
{ "url", prev["url"] },
});
dataObj.Add("changesUrl", MakePublicUrl(Path.Combine(_Default.VersionDir(histDir, i), "diff.zip")));
dataObj.Add("changesUrl", MakePublicUrl(Path.Combine(_Default.VersionDir(histDir, i - 1), "diff.zip")));
}
if (JwtManager.Enabled)
{
var token = JwtManager.Encode(dataObj);
dataObj.Add("token", token);
}
hist.Add(obj);
histData.Add(i.ToString(), dataObj);
histData.Add((i - 1).ToString(), dataObj);
}
history = new Dictionary<string, object>()
@ -270,10 +300,79 @@ namespace OnlineEditorsExample
}
}
private Dictionary<string, object> GetLogoConfig()
{
var InsertImageUrl = new UriBuilder(_Default.GetServerUrl(true));
InsertImageUrl.Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "App_Themes\\images\\logo.png";
Dictionary<string, object> logoConfig = new Dictionary<string, object>
{
{ "fileType", "png"},
{ "url", InsertImageUrl.ToString()}
};
if (JwtManager.Enabled)
{
var insImageToken = JwtManager.Encode(logoConfig);
logoConfig.Add("token", insImageToken);
}
return logoConfig;
}
private Dictionary<string, object> GetCompareFile()
{
var compareFileUrl = new UriBuilder(_Default.GetServerUrl(true));
compareFileUrl.Path = HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx";
compareFileUrl.Query = "type=download&fileName=" + HttpUtility.UrlEncode("sample.docx");
Dictionary<string, object> dataCompareFile = new Dictionary<string, object>
{
{ "fileType", "docx" },
{ "url", compareFileUrl.ToString() }
};
if (JwtManager.Enabled)
{
var compareFileToken = JwtManager.Encode(dataCompareFile);
dataCompareFile.Add("token", compareFileToken);
}
return dataCompareFile;
}
private Dictionary<string, object> GetMailMergeConfig()
{
var mailmergeUrl = new UriBuilder(_Default.GetServerUrl(true));
mailmergeUrl.Path =
HttpRuntime.AppDomainAppVirtualPath
+ (HttpRuntime.AppDomainAppVirtualPath.EndsWith("/") ? "" : "/")
+ "webeditor.ashx";
mailmergeUrl.Query = "type=csv";
Dictionary<string, object> mailMergeConfig = new Dictionary<string, object>
{
{ "fileType", "csv" },
{ "url", mailmergeUrl.ToString() }
};
if (JwtManager.Enabled)
{
var mailmergeToken = JwtManager.Encode(mailMergeConfig);
mailMergeConfig.Add("token", mailmergeToken);
}
return mailMergeConfig;
}
private string MakePublicUrl(string fullPath)
{
var root = HttpRuntime.AppDomainAppPath + WebConfigurationManager.AppSettings["storage-path"];
return _Default.Host + fullPath.Substring(root.Length).Replace(Path.DirectorySeparatorChar, '/');
return _Default.GetServerUrl(true) + fullPath.Substring(root.Length).Replace(Path.DirectorySeparatorChar, '/');
}
private static void Try(string type, string sample, HttpRequest request)
@ -293,16 +392,18 @@ namespace OnlineEditorsExample
default:
return;
}
var demoName = (string.IsNullOrEmpty(sample) ? "new" : "demo") + ext;
var demoName = (string.IsNullOrEmpty(sample) ? "new" : "sample") + ext;
var demoPath = "assets\\" + (string.IsNullOrEmpty(sample) ? "new\\" : "sample\\");
FileName = _Default.GetCorrectName(demoName);
var filePath = _Default.StoragePath(FileName, null);
File.Copy(HttpRuntime.AppDomainAppPath + "app_data/" + demoName, filePath);
File.Copy(HttpRuntime.AppDomainAppPath + demoPath + demoName, filePath);
var histDir = _Default.HistoryDir(filePath);
Directory.CreateDirectory(histDir);
File.WriteAllText(Path.Combine(histDir, "createdInfo.json"), new JavaScriptSerializer().Serialize(new Dictionary<string, object> {
{ "created", DateTime.Now.ToString() },
{ "created", DateTime.Now.ToString("yyyy'-'MM'-'dd HH':'mm':'ss") },
{ "id", request.Cookies.GetOrDefault("uid", "uid-1") },
{ "name", request.Cookies.GetOrDefault("uname", "John Smith") }
}));

View File

@ -40,7 +40,7 @@ namespace ASC.Api.DocumentConverter
/// </summary>
static ServiceConverter()
{
DocumentConverterUrl = WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "";
DocumentConverterUrl = (WebConfigurationManager.AppSettings["files.docservice.url.site"] ?? "") + (WebConfigurationManager.AppSettings["files.docservice.url.converter"] ?? "");
Int32.TryParse(WebConfigurationManager.AppSettings["files.docservice.timeout"], out ConvertTimeout);
ConvertTimeout = ConvertTimeout > 0 ? ConvertTimeout : 120000;
@ -121,7 +121,8 @@ namespace ASC.Api.DocumentConverter
var payloadToken = JwtManager.Encode(payload);
var bodyToken = JwtManager.Encode(body);
request.Headers.Add("Authorization", "Bearer " + payloadToken);
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
request.Headers.Add(JWTheader, "Bearer " + payloadToken);
body.Add("token", bodyToken);
}

View File

@ -142,16 +142,15 @@
<Content Include="WebEditor.ashx" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Data\demo.docx" />
<Content Include="App_Data\demo.pptx" />
<Content Include="App_Data\demo.xlsx" />
</ItemGroup>
<ItemGroup>
<Content Include="App_Data\new.docx" />
<Content Include="App_Data\new.pptx" />
<Content Include="App_Data\new.xlsx" />
</ItemGroup>
<ItemGroup>
<Content Include="assets\AUTHORS.md" />
<Content Include="assets\LICENSE" />
<Content Include="assets\new\new.docx" />
<Content Include="assets\new\new.pptx" />
<Content Include="assets\new\new.xlsx" />
<Content Include="assets\sample\csv.csv" />
<Content Include="assets\sample\sample.docx" />
<Content Include="assets\sample\sample.pptx" />
<Content Include="assets\sample\sample.xlsx" />
<None Include="packages.config" />
</ItemGroup>
<PropertyGroup>

View File

@ -8,6 +8,11 @@
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
</system.web>
<system.webServer>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
<security>
<requestFiltering>
<requestLimits maxAllowedContentLength="1073741824"/>

View File

@ -25,6 +25,7 @@ using System.Net;
using System.Web;
using System.Web.Script.Serialization;
using System.Web.Services;
using System.Web.Configuration;
namespace OnlineEditorsExample
{
@ -48,6 +49,15 @@ namespace OnlineEditorsExample
case "remove":
Remove(context);
break;
case "download":
Download(context);
break;
case "csv":
GetCsv(context);
break;
case "files":
Files(context);
break;
}
}
@ -89,7 +99,7 @@ namespace OnlineEditorsExample
private static void Track(HttpContext context)
{
var userAddress = context.Request["userAddress"];
var fileName = context.Request["fileName"];
var fileName = Path.GetFileName(context.Request["fileName"]);
string body;
try
@ -111,18 +121,31 @@ namespace OnlineEditorsExample
if (JwtManager.Enabled)
{
string JWTheader = WebConfigurationManager.AppSettings["files.docservice.header"].Equals("") ? "Authorization" : WebConfigurationManager.AppSettings["files.docservice.header"];
string token = null;
if (fileData.ContainsKey("token"))
{
fileData = jss.Deserialize<Dictionary<string, object>>(JwtManager.Decode(fileData["token"].ToString()));
token = JwtManager.Decode(fileData["token"].ToString());
}
else if (context.Request.Headers.AllKeys.Contains("Authorization", StringComparer.InvariantCultureIgnoreCase))
else if (context.Request.Headers.AllKeys.Contains(JWTheader, StringComparer.InvariantCultureIgnoreCase))
{
var headerToken = context.Request.Headers.Get("Authorization").Substring("Bearer ".Length);
fileData = (Dictionary<string, object>)jss.Deserialize<Dictionary<string, object>>(JwtManager.Decode(headerToken))["payload"];
var headerToken = context.Request.Headers.Get(JWTheader).Substring("Bearer ".Length);
token = JwtManager.Decode(headerToken);
}
else
{
throw new Exception("Expected JWT");
context.Response.Write("{\"error\":1,\"message\":\"JWT expected\"}");
}
if (token != null && !token.Equals(""))
{
fileData = (Dictionary<string, object>)jss.Deserialize<Dictionary<string, object>>(token)["payload"];
}
else
{
context.Response.Write("{\"error\":1,\"message\":\"JWT validation failed\"}");
}
}
@ -163,7 +186,7 @@ namespace OnlineEditorsExample
{
var storagePath = _Default.StoragePath(fileName, userAddress);
var histDir = _Default.HistoryDir(storagePath);
var versionDir = _Default.VersionDir(histDir, _Default.GetFileVersion(histDir) + 1);
var versionDir = _Default.VersionDir(histDir, _Default.GetFileVersion(histDir));
if (!Directory.Exists(versionDir)) Directory.CreateDirectory(versionDir);
@ -200,7 +223,7 @@ namespace OnlineEditorsExample
context.Response.ContentType = "text/plain";
try
{
var fileName = context.Request["fileName"];
var fileName = Path.GetFileName(context.Request["fileName"]);
var path = _Default.StoragePath(fileName, HttpUtility.UrlEncode(HttpContext.Current.Request.UserHostAddress));
var histDir = _Default.HistoryDir(path);
@ -215,6 +238,64 @@ namespace OnlineEditorsExample
}
}
private static void Files(HttpContext context)
{
List<Dictionary<string, object>> files = null;
try
{
context.Response.ContentType = "application/json";
var jss = new JavaScriptSerializer();
if (context.Request["fileId"] == null)
{
files = _Default.GetFilesInfo();
context.Response.Write(jss.Serialize(files));
}
else
{
var fileId = context.Request["fileId"];
files = _Default.GetFilesInfo(fileId);
if (files.Count == 0)
{
context.Response.Write("\"File not found\"");
}
else
{
context.Response.Write(jss.Serialize(files));
}
}
}
catch (Exception e)
{
context.Response.Write("{ \"error\": \"" + e.Message + "\"}");
}
}
private static void Download(HttpContext context)
{
var fileName = "sample/" + Path.GetFileName(context.Request["filename"]);
download(fileName, context);
}
private static void GetCsv(HttpContext context)
{
var fileName = "sample/" + "csv.csv";
download(fileName, context);
}
private static void download(string fileName, HttpContext context)
{
var csvPath = HttpRuntime.AppDomainAppPath + "assets/" + fileName;
FileInfo fileinf = new FileInfo(csvPath);
context.Response.AddHeader("Content-Length", "" + fileinf.Length);
context.Response.AddHeader("Content-Type", MimeMapping.GetMimeMapping(csvPath));
var tmp = HttpUtility.UrlEncode(Path.GetFileName(csvPath));
tmp = tmp.Replace("+", "%20");
context.Response.AddHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + tmp);
context.Response.TransmitFile(csvPath);
}
private static void DownloadToFile(string url, string path)
{
if (string.IsNullOrEmpty(url)) throw new ArgumentException("url");

View File

@ -7,11 +7,17 @@
<add key="files.docservice.viewed-docs" value=".pdf|.djvu|.xps"/>
<add key="files.docservice.edited-docs" value=".docx|.xlsx|.csv|.pptx|.txt"/>
<add key="files.docservice.convert-docs" value=".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|.epub"/>
<add key="files.docservice.convert-docs" value=".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|.epub|.fb2"/>
<add key="files.docservice.timeout" value="120000" />
<add key="files.docservice.secret" value="" />
<add key="files.docservice.header" value="Authorization" />
<add key="files.docservice.url.site" value="http://documentserver/"/>
<add key="files.docservice.url.converter" value="https://documentserver/ConvertService.ashx"/>
<add key="files.docservice.url.api" value="https://documentserver/web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="https://documentserver/web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.converter" value="ConvertService.ashx"/>
<add key="files.docservice.url.api" value="web-apps/apps/api/documents/api.js"/>
<add key="files.docservice.url.preloader" value="web-apps/apps/api/documents/cache-scripts.html"/>
<add key="files.docservice.url.example" value=""/>
</appSettings>

View File

@ -14,13 +14,10 @@ Edit the **settings.properties** configuration file. Specify the name of your lo
nano src/main/resources/settings.properties
```
Edit the following lines:
Edit the following line:
```
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.site=https://documentserver/
```
Install Maven:
@ -44,13 +41,10 @@ Edit the **settings.properties** configuration file. Specify the name of your lo
nano src/main/resources/settings.properties
```
Edit the following lines. You need to change `documentserver` to your documentserver:
Edit the following line. You need to change `documentserver` to your documentserver:
```
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.site=https://documentserver/
```
Run next command in java example directory:

View File

@ -18,11 +18,14 @@
package controllers;
import com.google.gson.Gson;
import helpers.ConfigManager;
import helpers.CookieManager;
import helpers.DocumentManager;
import java.io.IOException;
import java.net.URLEncoder;
import java.util.HashMap;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
@ -30,6 +33,7 @@ import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import entities.FileModel;
import helpers.FileUtility;
@WebServlet(name = "EditorServlet", urlPatterns = {"/EditorServlet"})
@ -39,7 +43,7 @@ public class EditorServlet extends HttpServlet
{
DocumentManager.Init(request, response);
String fileName = request.getParameter("fileName");
String fileName = FileUtility.GetFileName(request.getParameter("fileName"));
String fileExt = request.getParameter("fileExt");
String sample = request.getParameter("sample");
@ -64,13 +68,32 @@ public class EditorServlet extends HttpServlet
FileModel file = new FileModel(fileName, cm.getCookie("ulang"), cm.getCookie("uid"), cm.getCookie("uname"), request.getParameter("actionLink"));
file.changeType(request.getParameter("mode"), request.getParameter("type"));
Map<String, Object> dataInsertImage = new HashMap<>();
dataInsertImage.put("fileType", "png");
dataInsertImage.put("url", DocumentManager.GetServerUrl(true) + "/css/img/logo.png");
Map<String, Object> dataCompareFile = new HashMap<>();
dataCompareFile.put("fileType", "docx");
dataCompareFile.put("url", DocumentManager.GetServerUrl(true) + "/IndexServlet?type=download&name=sample.docx");
Map<String, Object> dataMailMergeRecipients = new HashMap<>();
dataMailMergeRecipients.put("fileType", "csv");
dataMailMergeRecipients.put("url", DocumentManager.GetServerUrl(true) + "/IndexServlet?type=csv");
if (DocumentManager.TokenEnabled())
{
file.BuildToken();
dataInsertImage.put("token", DocumentManager.CreateToken(dataInsertImage));
dataCompareFile.put("token", DocumentManager.CreateToken(dataCompareFile));
dataMailMergeRecipients.put("token", DocumentManager.CreateToken(dataMailMergeRecipients));
}
Gson gson = new Gson();
request.setAttribute("file", file);
request.setAttribute("docserviceApiUrl", ConfigManager.GetProperty("files.docservice.url.api"));
request.setAttribute("docserviceApiUrl", ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.api"));
request.setAttribute("dataInsertImage", gson.toJson(dataInsertImage).substring(1, gson.toJson(dataInsertImage).length()-1));
request.setAttribute("dataCompareFile", gson.toJson(dataCompareFile));
request.setAttribute("dataMailMergeRecipients", gson.toJson(dataMailMergeRecipients));
request.getRequestDispatcher("editor.jsp").forward(request, response);
}

View File

@ -18,19 +18,19 @@
package controllers;
import com.google.gson.Gson;
import helpers.ConfigManager;
import helpers.CookieManager;
import helpers.DocumentManager;
import helpers.ServiceConverter;
import java.io.File;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.io.*;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.LinkedHashMap;
import java.util.Scanner;
import java.util.*;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import javax.servlet.ServletException;
import javax.servlet.annotation.MultipartConfig;
import javax.servlet.annotation.WebServlet;
@ -78,6 +78,15 @@ public class IndexServlet extends HttpServlet
case "remove":
Remove(request, response, writer);
break;
case "download":
Download(request, response, writer);
break;
case "csv":
CSV(request, response, writer);
break;
case "files":
Files(request, response, writer);
break;
}
}
@ -150,8 +159,8 @@ public class IndexServlet extends HttpServlet
try
{
String fileName = request.getParameter("filename");
String fileUri = DocumentManager.GetFileUri(fileName);
String fileName = FileUtility.GetFileName(request.getParameter("filename"));
String fileUri = DocumentManager.GetFileUri(fileName, true);
String fileExt = FileUtility.GetFileExtension(fileName);
FileType fileType = FileUtility.GetFileType(fileName);
String internalFileExt = DocumentManager.GetInternalExtension(fileType);
@ -216,7 +225,7 @@ public class IndexServlet extends HttpServlet
private static void Track(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
String userAddress = request.getParameter("userAddress");
String fileName = request.getParameter("fileName");
String fileName = FileUtility.GetFileName(request.getParameter("fileName"));
String storagePath = DocumentManager.StoragePath(fileName, userAddress);
String body = "";
@ -314,7 +323,7 @@ public class IndexServlet extends HttpServlet
try
{
String histDir = DocumentManager.HistoryDir(storagePath);
String versionDir = DocumentManager.VersionDir(histDir, DocumentManager.GetFileVersion(histDir) + 1);
String versionDir = DocumentManager.VersionDir(histDir, DocumentManager.GetFileVersion(histDir));
File ver = new File(versionDir);
File toSave = new File(storagePath);
@ -352,7 +361,7 @@ public class IndexServlet extends HttpServlet
{
try
{
String fileName = request.getParameter("filename");
String fileName = FileUtility.GetFileName(request.getParameter("filename"));
String path = DocumentManager.StoragePath(fileName, null);
File f = new File(path);
@ -369,6 +378,45 @@ public class IndexServlet extends HttpServlet
}
}
private static void Files(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
ArrayList<Map<String, Object>> files = null;
try {
Gson gson = new Gson();
response.setContentType("application/json");
if (request.getParameter("fileId") == null) {
files = DocumentManager.GetFilesInfo();
writer.write(gson.toJson(files));
}else {
String fileId = request.getParameter("fileId");
files = DocumentManager.GetFilesInfo(fileId);
if(files.isEmpty()) {
writer.write("\"File not found\"");
}else {
writer.write(gson.toJson(files));
}
}
}
catch (Exception e)
{
writer.write("{ \"error\": \"" + e.getMessage() + "\"}");
}
}
private static void CSV(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
String fileName = "assets/sample/csv.csv";
download(fileName, response, writer);
}
private static void Download(HttpServletRequest request, HttpServletResponse response, PrintWriter writer)
{
String fileName = "assets/sample/" + FileUtility.GetFileName(request.getParameter("name"));
download(fileName, response, writer);
}
private static void delete(File f) throws Exception {
if (f.isDirectory()) {
for (File c : f.listFiles())
@ -378,6 +426,41 @@ public class IndexServlet extends HttpServlet
throw new Exception("Failed to delete file: " + f);
}
private static void download(String fileName, HttpServletResponse response, PrintWriter writer) {
URL fileUrl = Thread.currentThread().getContextClassLoader().getResource(fileName);
Path filePath = null;
String fileType = null;
try {
filePath = Paths.get(fileUrl.toURI());
fileType = Files.probeContentType(filePath);
} catch (URISyntaxException | IOException e) {
e.printStackTrace();
}
File file = new File(String.valueOf(filePath));
response.setHeader("Content-Length", String.valueOf(file.length()));
response.setHeader("Content-Type", fileType);
response.setHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + file.getName());
BufferedInputStream inputStream = null;
try {
FileInputStream fileInputStream = new FileInputStream(file);
inputStream = new BufferedInputStream(fileInputStream);
int readBytes = 0;
while ((readBytes = inputStream.read()) != -1)
writer.write(readBytes);
}catch (Exception e){
e.printStackTrace();
}finally {
try {
inputStream.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
private static void downloadToFile(String url, File file) throws Exception {
if (url == null || url.isEmpty()) throw new Exception("argument url");
if (file == null) throw new Exception("argument path");

View File

@ -20,11 +20,7 @@ package entities;
import java.io.File;
import java.io.FileInputStream;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Scanner;
import java.util.Set;
import java.util.*;
import helpers.DocumentManager;
import helpers.ServiceConverter;
@ -54,9 +50,12 @@ public class FileModel
document = new Document();
document.title = fileName;
document.url = DocumentManager.GetFileUri(fileName);
document.url = DocumentManager.GetFileUri(fileName, true);
document.urlUser = DocumentManager.GetFileUri(fileName, false);
document.fileType = FileUtility.GetFileExtension(fileName).replace(".", "");
document.key = ServiceConverter.GenerateRevisionId(DocumentManager.CurUserHostAddress(null) + "/" + fileName + "/" + Long.toString(new File(DocumentManager.StoragePath(fileName, null)).lastModified()));
document.info = new Info();
document.info.favorite = uid != null && !uid.isEmpty() ? uid.equals("uid-2") : null;
editorConfig = new EditorConfig(actionData);
editorConfig.callbackUrl = DocumentManager.GetCallback(fileName);
@ -65,7 +64,7 @@ public class FileModel
if (uid != null) editorConfig.user.id = uid;
if (uname != null) editorConfig.user.name = uname;
editorConfig.customization.goback.url = DocumentManager.GetServerUrl() + "/IndexServlet";
editorConfig.customization.goback.url = DocumentManager.GetServerUrl(false) + "/IndexServlet";
changeType(mode, type);
}
@ -86,7 +85,7 @@ public class FileModel
public void InitDesktop()
{
editorConfig.InitDesktop(document.url);
editorConfig.InitDesktop(document.urlUser);
}
public void BuildToken()
@ -107,13 +106,13 @@ public class FileModel
if (DocumentManager.GetFileVersion(histDir) > 0) {
Integer curVer = DocumentManager.GetFileVersion(histDir);
Set<Object> hist = new HashSet<Object>();
List<Object> hist = new ArrayList<>();
Map<String, Object> histData = new HashMap<String, Object>();
for (Integer i = 0; i <= curVer; i++) {
for (Integer i = 1; i <= curVer; i++) {
Map<String, Object> obj = new HashMap<String, Object>();
Map<String, Object> dataObj = new HashMap<String, Object>();
String verDir = DocumentManager.VersionDir(histDir, i + 1);
String verDir = DocumentManager.VersionDir(histDir, i);
try {
String key = null;
@ -123,7 +122,7 @@ public class FileModel
obj.put("key", key);
obj.put("version", i);
if (i == 0) {
if (i == 1) {
String createdInfo = readFileToEnd(new File(histDir + File.separator + "createdInfo.json"));
JSONObject json = (JSONObject) parser.parse(createdInfo);
@ -138,8 +137,8 @@ public class FileModel
dataObj.put("url", i == curVer ? document.url : DocumentManager.GetPathUri(verDir + File.separator + "prev" + FileUtility.GetFileExtension(document.title)));
dataObj.put("version", i);
if (i > 0) {
JSONObject changes = (JSONObject) parser.parse(readFileToEnd(new File(DocumentManager.VersionDir(histDir, i) + File.separator + "changes.json")));
if (i > 1) {
JSONObject changes = (JSONObject) parser.parse(readFileToEnd(new File(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "changes.json")));
JSONObject change = (JSONObject) ((JSONArray) changes.get("changes")).get(0);
obj.put("changes", changes.get("changes"));
@ -147,16 +146,21 @@ public class FileModel
obj.put("created", change.get("created"));
obj.put("user", change.get("user"));
Map<String, Object> prev = (Map<String, Object>) histData.get(Integer.toString(i - 1));
Map<String, Object> prev = (Map<String, Object>) histData.get(Integer.toString(i - 2));
Map<String, Object> prevInfo = new HashMap<String, Object>();
prevInfo.put("key", prev.get("key"));
prevInfo.put("url", prev.get("url"));
dataObj.put("previous", prevInfo);
dataObj.put("changesUrl", DocumentManager.GetPathUri(DocumentManager.VersionDir(histDir, i) + File.separator + "diff.zip"));
dataObj.put("changesUrl", DocumentManager.GetPathUri(DocumentManager.VersionDir(histDir, i - 1) + File.separator + "diff.zip"));
}
if (DocumentManager.TokenEnabled())
{
dataObj.put("token", DocumentManager.CreateToken(dataObj));
}
hist.add(obj);
histData.put(Integer.toString(i), dataObj);
histData.put(Integer.toString(i - 1), dataObj);
} catch (Exception ex) { }
}
@ -191,8 +195,10 @@ public class FileModel
{
public String title;
public String url;
public String urlUser;
public String fileType;
public String key;
public Info info;
public Permissions permissions;
}
@ -218,6 +224,11 @@ public class FileModel
}
}
public class Info
{
Boolean favorite;
}
public class EditorConfig
{
public HashMap<String, Object> actionLink = null;

View File

@ -24,14 +24,12 @@ import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.InetAddress;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import entities.FileType;
@ -134,7 +132,7 @@ public class DocumentManager
public static String StoragePath(String fileName, String userAddress)
{
String directory = FilesRootPath(userAddress);
return directory + fileName;
return directory + FileUtility.GetFileName(fileName);
}
public static String HistoryDir(String storagePath)
@ -165,7 +163,7 @@ public class DocumentManager
}
});
return dirs.length;
return dirs.length + 1;
}
public static int GetFileVersion(String fileName, String userAddress)
@ -224,9 +222,10 @@ public class DocumentManager
public static String CreateDemo(String fileExt, Boolean sample, String uid, String uname) throws Exception
{
String demoName = (sample ? "sample." : "new.") + fileExt;
String demoPath = "assets" + File.separator + (sample ? "sample" : "new") + File.separator;
String fileName = GetCorrectName(demoName);
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(demoName);
InputStream stream = Thread.currentThread().getContextClassLoader().getResourceAsStream(demoPath + demoName);
File file = new File(StoragePath(fileName, null));
@ -246,11 +245,11 @@ public class DocumentManager
return fileName;
}
public static String GetFileUri(String fileName)
public static String GetFileUri(String fileName, Boolean forDocumentServer)
{
try
{
String serverPath = GetServerUrl();
String serverPath = GetServerUrl(forDocumentServer);
String storagePath = ConfigManager.GetProperty("storage-folder");
String hostAddress = CurUserHostAddress(null);
@ -264,9 +263,39 @@ public class DocumentManager
}
}
public static ArrayList<Map<String, Object>> GetFilesInfo(){
ArrayList<Map<String, Object>> files = new ArrayList<>();
for(File file : GetStoredFiles(null)){
Map<String, Object> map = new LinkedHashMap<>();
map.put("version", GetFileVersion(file.getName(), null));
map.put("id", ServiceConverter.GenerateRevisionId(CurUserHostAddress(null) + "/" + file.getName() + "/" + Long.toString(new File(StoragePath(file.getName(), null)).lastModified())));
map.put("contentLength", new BigDecimal(String.valueOf((file.length()/1024.0))).setScale(2, RoundingMode.HALF_UP) + " KB");
map.put("pureContentLength", file.length());
map.put("title", file.getName());
map.put("updated", String.valueOf(new Date(file.lastModified())));
files.add(map);
}
return files;
}
public static ArrayList<Map<String, Object>> GetFilesInfo(String fileId){
ArrayList<Map<String, Object>> file = new ArrayList<>();
for (Map<String, Object> map : GetFilesInfo()){
if (map.get("id").equals(fileId)){
file.add(map);
break;
}
}
return file;
}
public static String GetPathUri(String path)
{
String serverPath = GetServerUrl();
String serverPath = GetServerUrl(true);
String storagePath = ConfigManager.GetProperty("storage-folder");
String hostAddress = CurUserHostAddress(null);
@ -276,14 +305,17 @@ public class DocumentManager
}
public static String GetServerUrl()
{
return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
public static String GetServerUrl(Boolean forDocumentServer) {
if (forDocumentServer && !ConfigManager.GetProperty("files.docservice.url.example").equals("")) {
return ConfigManager.GetProperty("files.docservice.url.example");
} else {
return request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath();
}
}
public static String GetCallback(String fileName)
{
String serverPath = GetServerUrl();
String serverPath = GetServerUrl(true);
String hostAddress = CurUserHostAddress(null);
try
{

View File

@ -72,10 +72,10 @@ public class FileUtility
public static String GetFileName(String url)
{
if (url == null) return null;
if (url == null) return "";
//for external file url
String tempstorage = ConfigManager.GetProperty("files.docservice.url.tempstorage");
String tempstorage = ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.tempstorage");
if (!tempstorage.isEmpty() && url.startsWith(tempstorage))
{
Map<String, String> params = GetUrlParams(url);

View File

@ -40,7 +40,7 @@ import org.json.simple.parser.ParseException;
public class ServiceConverter
{
private static int ConvertTimeout = 120000;
private static final String DocumentConverterUrl = ConfigManager.GetProperty("files.docservice.url.converter");
private static final String DocumentConverterUrl = ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.converter");
private static final String DocumentJwtHeader = ConfigManager.GetProperty("files.docservice.header");
public static class ConvertBody
@ -125,7 +125,7 @@ public class ServiceConverter
if (DocumentManager.TokenEnabled())
{
connection.setRequestProperty(DocumentJwtHeader == "" ? "Authorization" : DocumentJwtHeader, "Bearer " + headerToken);
connection.setRequestProperty(DocumentJwtHeader.equals("") ? "Authorization" : DocumentJwtHeader, "Bearer " + headerToken);
}
connection.connect();

View File

@ -3,12 +3,15 @@ storage-folder=app_data
files.docservice.viewed-docs=.pdf|.djvu|.xps
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|.epub
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|.epub|.fb2
files.docservice.timeout=120000
files.docservice.url.converter=https://documentserver/ConvertService.ashx
files.docservice.url.tempstorage=https://documentserver/ResourceService.ashx
files.docservice.url.api=https://documentserver/web-apps/apps/api/documents/api.js
files.docservice.url.preloader=https://documentserver/web-apps/apps/api/documents/cache-scripts.html
files.docservice.url.site=https://documentserver/
files.docservice.url.converter=ConvertService.ashx
files.docservice.url.tempstorage=ResourceService.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.example=
files.docservice.secret=
files.docservice.header=Authorization

View File

@ -1,13 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.1" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd">
<filter>
<filter-name>CorsFilter</filter-name>
<filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
<init-param>
<param-name>cors.allowed.origins</param-name>
<param-value>*</param-value>
</init-param>
<init-param>
<param-name>cors.allowed.methods</param-name>
<param-value>GET</param-value>
</init-param>
<init-param>
<param-name>cors.support.credentials</param-name>
<param-value>false</param-value>
</init-param>
<init-param>
<param-name>cors.exposed.headers</param-name>
<param-value>Access-Control-Allow-Origin,Access-Control-Allow-Methods</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>CorsFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<session-config>
<session-timeout>
30
</session-timeout>
<session-timeout>30</session-timeout>
</session-config>
<listener>
<listener-class>
controllers.GlobalServletContextListener
</listener-class>
<listener-class>controllers.GlobalServletContextListener</listener-class>
</listener>
</web-app>
</web-app>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -44,10 +44,13 @@ a, a:hover, a:visited {
.top-panel {
background: url("img/logo.png") no-repeat 30px center #3D4A6B;
background: #3D4A6B;
height: 80px;
width: 100%;
}
.top-panel img {
margin: 12px 0 0 16px;
}
.main-panel {
margin: 80px auto;
width: 600px;

View File

@ -86,6 +86,28 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var onRequestInsertImage = function(event) {
docEditor.insertImage({
"c": event.data.c,
${dataInsertImage}
})
};
var onRequestCompareFile = function() {
docEditor.setRevisedFile(${dataCompareFile});
};
var onRequestMailMergeRecipients = function (event) {
docEditor.setMailMergeRecipients(${dataMailMergeRecipients});
};
var config = JSON.parse('<%= FileModel.Serialize(Model) %>');
config.width = "100%";
config.height = "100%";
@ -96,6 +118,10 @@
"onError": onError,
"onOutdatedVersion": onOutdatedVersion,
"onMakeActionLink": onMakeActionLink,
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
};
<%
@ -111,7 +137,7 @@
config.events['onRequestHistoryData'] = function (event) {
var ver = event.data;
var histData = <%= historyData %>;
docEditor.setHistoryData(histData[ver]);
docEditor.setHistoryData(histData[ver - 1]);
};
config.events['onRequestHistoryClose'] = function () {
document.location.reload();

View File

@ -35,7 +35,11 @@
</head>
<body>
<div class="top-panel"></div>
<div class="top-panel">
<a href="">
<img src ="css/img/logo.svg" alt="ONLYOFFICE" />
</a>
</div>
<div class="main-panel">
<span class="portal-name">ONLYOFFICE Document Editors</span>
@ -152,7 +156,7 @@
<a class="stored-edit <%= docType %>" href="EditorServlet?fileName=<%= URLEncoder.encode(files[i].getName(), "UTF-8") %>" target="_blank">
<span title="<%= files[i].getName() %>"><%= files[i].getName() %></span>
</a>
<a href="<%= DocumentManager.GetFileUri(files[i].getName()) %>">
<a href="<%= DocumentManager.GetFileUri(files[i].getName(), false) %>">
<img class="icon-download" src="css/img/download-24.png" alt="Download" title="Download" />
</a>
<a class="delete-file" data-filename="<%= files[i].getName() %>">
@ -278,7 +282,7 @@
<div id="cancelEdit" class="button gray">Cancel</div>
</div>
<span id="loadScripts" data-docs="<%= ConfigManager.GetProperty("files.docservice.url.preloader") %>"></span>
<span id="loadScripts" data-docs="<%= ConfigManager.GetProperty("files.docservice.url.site") + ConfigManager.GetProperty("files.docservice.url.preloader") %>"></span>
<div class="bottom-panel">
&copy; Ascensio System SIA <%= Calendar.getInstance().get(Calendar.YEAR) %>. All rights reserved.

View File

@ -31,7 +31,11 @@
<body>
<div id="page">
<div class="top-panel"></div>
<div class="top-panel">
<a href="">
<img src ="logo.svg" alt="ONLYOFFICE" />
</a>
</div>
<div id="mainPanel" class="main-panel">
<span class="portal-name">ONLYOFFICE Document Editors</span>
<br />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -41,10 +41,13 @@ div {
.top-panel {
background: url("logo.png") no-repeat 30px center #3D4A6B;
background: #3D4A6B;
height: 80px;
width: 100%;
}
.top-panel img{
margin: 12px 0 0 16px;
}
.main-panel {
margin: 105px auto 0;
width: 350px;

View File

@ -292,6 +292,7 @@ app.get("/files", function(req, res) {
try {
docManager.init(storageFolder, req, res);
const filesInDirectoryInfo = docManager.getFilesInfo();
res.setHeader("Content-Type", "application/json");
res.write(JSON.stringify(filesInDirectoryInfo));
} catch (ex) {
console.log(ex);
@ -305,6 +306,7 @@ app.get("/files/file/:fileId", function(req, res) {
docManager.init(storageFolder, req, res);
const fileId = req.params.fileId;
const fileInfoById = docManager.getFilesInfo(fileId);
res.setHeader("Content-Type", "application/json");
res.write(JSON.stringify(fileInfoById));
} catch (ex) {
console.log(ex);
@ -338,6 +340,19 @@ app.delete("/file", function (req, res) {
res.end();
});
app.get("/csv", function (req, res) {
var fileName = "csv.csv";
var csvPath = path.join(__dirname, "public", "assets", "sample", fileName);
res.setHeader("Content-Length", fileSystem.statSync(csvPath).size);
res.setHeader("Content-Type", mime.getType(csvPath));
res.setHeader("Content-Disposition", "attachment; filename*=UTF-8\'\'" + encodeURIComponent(fileName));
var filestream = fileSystem.createReadStream(csvPath);
filestream.pipe(res);
})
app.post("/track", function (req, res) {
docManager.init(storageFolder, req, res);
@ -542,7 +557,7 @@ app.get("/editor", function (req, res) {
var actionData = req.query.action ? req.query.action : "null";
if (fileExt != null) {
var fileName = docManager.createDemo((req.query.sample ? "sample." : "new.") + fileExt, userid, name);
var fileName = docManager.createDemo(!!req.query.sample, fileExt, userid, name);
var redirectPath = docManager.getServerUrl() + "/editor?fileName=" + encodeURIComponent(fileName) + docManager.getCustomParams();
res.redirect(redirectPath);
@ -558,6 +573,7 @@ app.get("/editor", function (req, res) {
}
var key = docManager.getKey(fileName);
var url = docManager.getFileUri(fileName);
var urlUser = docManager.getlocalFileUri(fileName, 0, false)
var mode = req.query.mode || "edit"; //mode: view/edit/review/comment/fillForms/embedded
var type = req.query.type || ""; //type: embedded/mobile/desktop
if (type == "") {
@ -626,8 +642,10 @@ app.get("/editor", function (req, res) {
name: fileName,
ext: fileUtility.getFileExtension(fileName, true),
uri: url,
uriUser: urlUser,
version: countVersion,
created: new Date().toDateString()
created: new Date().toDateString(),
favorite: req.query.userid ? req.query.userid === "uid-2" : "null"
},
editor: {
type: type,
@ -653,7 +671,19 @@ app.get("/editor", function (req, res) {
actionData: actionData
},
history: history,
historyData: historyData
historyData: historyData,
dataInsertImage: {
fileType: "png",
url: docManager.getServerUrl(true) + "/images/logo.png"
},
dataCompareFile: {
fileType: "docx",
url: docManager.getServerUrl(true) + "/assets/sample/sample.docx"
},
dataMailMergeRecipients: {
fileType: "csv",
url: docManager.getServerUrl(true) + "/csv"
}
};
if (cfgSignatureEnable) {
@ -662,6 +692,9 @@ app.get("/editor", function (req, res) {
console.log(err);
} else {
argss.editor.token = jwt.sign(JSON.parse("{"+html+"}"), cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
argss.dataInsertImage.token = jwt.sign(argss.dataInsertImage, cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
argss.dataCompareFile.token = jwt.sign(argss.dataCompareFile, cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
argss.dataMailMergeRecipients.token = jwt.sign(argss.dataMailMergeRecipients, cfgSignatureSecret, {expiresIn: cfgSignatureSecretExpiresIn});
}
res.render("editor", argss);
});

View File

@ -99,10 +99,11 @@ docManager.getCorrectName = function (fileName, userAddress) {
return name;
};
docManager.createDemo = function (demoName, userid, username) {
docManager.createDemo = function (isSample, fileExt, userid, username) {
const demoName = (isSample ? "sample" : "new") + "." + fileExt;
const fileName = docManager.getCorrectName(demoName);
docManager.copyFile(path.join(__dirname, "..","public", "samples", demoName), docManager.storagePath(fileName));
docManager.copyFile(path.join(__dirname, "..","public", "assets", isSample ? "sample" : "new", demoName), docManager.storagePath(fileName));
docManager.saveFileData(fileName, userid, username);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -9,8 +9,9 @@
"fileType": "<%- file.ext %>",
"key": "<%- editor.key %>",
"info": {
"author": "Me",
"created": "<%- file.created %>"
"owner": "Me",
"uploaded": "<%- file.created %>",
"favorite": <%- file.favorite %>
},
"permissions": {
"comment": <%- editor.comment %>,
@ -32,9 +33,9 @@
"name": "<%- editor.name %>"
},
"embedded": {
"saveUrl": "<%- file.uri %>",
"embedUrl": "<%- file.uri %>",
"shareUrl": "<%- file.uri %>",
"saveUrl": "<%- file.uriUser %>",
"embedUrl": "<%- file.uriUser %>",
"shareUrl": "<%- file.uriUser %>",
"toolbarDocked": "top"
},
"customization": {

View File

@ -53,6 +53,13 @@
document.title = title + (event.data ? "*" : "");
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var onRequestEditRights = function () {
location.href = location.href.replace(RegExp("mode=view\&?", "i"), "");
};
@ -109,6 +116,21 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onRequestInsertImage = function(event) {
docEditor.insertImage({
"c": event.data.c,
<%- JSON.stringify(dataInsertImage).substring(1, JSON.stringify(dataInsertImage).length - 1)%>
})
};
var onRequestCompareFile = function() {
docEditor.setRevisedFile(<%- JSON.stringify(dataCompareFile) %>);
};
var onRequestMailMergeRecipients = function (event) {
docEditor.setMailMergeRecipients(<%- JSON.stringify(dataMailMergeRecipients) %>);
};
var connectEditor = function () {
docEditor = new DocsAPI.DocEditor("iframeEditor", {<%- include("config") %>,
@ -122,6 +144,10 @@
"onRequestHistoryClose": onRequestHistoryClose,
"onOutdatedVersion": onOutdatedVersion,
"onMakeActionLink": onMakeActionLink,
"onMetaChange": onMetaChange,
"onRequestInsertImage": onRequestInsertImage,
"onRequestCompareFile": onRequestCompareFile,
"onRequestMailMergeRecipients": onRequestMailMergeRecipients,
}
});

View File

@ -31,7 +31,7 @@
<body>
<header>
<a href="">
<img src ="images/logo.png" alt="ONLYOFFICE" />
<img src ="images/logo.svg" alt="ONLYOFFICE" />
</a>
</header>
<div class="main-panel">

View File

@ -194,8 +194,8 @@ function getStoragePath($fileName, $userAddress = NULL) {
if (!file_exists($directory) && !is_dir($directory)) {
mkdir($directory);
}
sendlog("getStoragePath result: " . $directory . $fileName, "common.log");
return $directory . $fileName;
sendlog("getStoragePath result: " . $directory . basename($fileName), "common.log");
return $directory . basename($fileName);
}
function getHistoryDir($storagePath) {
@ -214,7 +214,7 @@ function getFileVersion($histDir) {
if (!file_exists($histDir) || !is_dir($histDir)) return 0;
$cdir = scandir($histDir);
$ver = 0;
$ver = 1;
foreach($cdir as $key => $fileName) {
if (!in_array($fileName,array(".", ".."))) {
if (is_dir($histDir . DIRECTORY_SEPARATOR . $fileName)) {
@ -304,6 +304,36 @@ function FileUri($file_name, $forDocumentServer = NULL) {
return $uri;
}
function getFileInfo($fileId){
$storedFiles = getStoredFiles();
$result = array();
$resultID = array();
foreach ($storedFiles as $key => $value){
$result[$key] = (object) array(
"version" => getFileVersion(getHistoryDir(getStoragePath($value->name))),
"id" => getDocEditorKey($value->name),
"contentLength" => number_format( filesize(getStoragePath($value->name)) / 1024, 2 )." KB",
"pureContentLength" => filesize(getStoragePath($value->name)),
"title" => $value->name,
"updated" => date( DATE_ATOM, filemtime(getStoragePath($value->name))),
);
if ($fileId != null){
if ($fileId == getDocEditorKey($value->name)){
$resultID[count($resultID)] = $result[$key];
}
}
}
if ($fileId != null){
if (count($resultID) != 0) return $resultID;
else return "File not found";
}
else {
return $result;
}
}
function getFileExts() {
return array_merge($GLOBALS['DOC_SERV_VIEWD'], $GLOBALS['DOC_SERV_EDITED'], $GLOBALS['DOC_SERV_CONVERT']);
}

View File

@ -6,16 +6,19 @@ $GLOBALS['ALONE'] = FALSE;
$GLOBALS['DOC_SERV_VIEWD'] = array(".pdf", ".djvu", ".xps");
$GLOBALS['DOC_SERV_EDITED'] = array(".docx", ".xlsx", ".csv", ".pptx", ".txt");
$GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub");
$GLOBALS['DOC_SERV_CONVERT'] = array(".docm", ".doc", ".dotx", ".dotm", ".dot", ".odt", ".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm", ".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt", ".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot", ".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub", ".fb2");
$GLOBALS['DOC_SERV_TIMEOUT'] = "120000";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "https://documentserver/ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "https://documentserver/web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "https://documentserver/web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['DOC_SERV_SITE_URL'] = "https://documentserver/";
$GLOBALS['DOC_SERV_CONVERTER_URL'] = "ConvertService.ashx";
$GLOBALS['DOC_SERV_API_URL'] = "web-apps/apps/api/documents/api.js";
$GLOBALS['DOC_SERV_PRELOADER_URL'] = "web-apps/apps/api/documents/cache-scripts.html";
$GLOBALS['DOC_SERV_JWT_SECRET'] = "";
$GLOBALS['DOC_SERV_JWT_HEADER'] = "Authorization";
$GLOBALS['EXAMPLE_URL'] = "";

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 2.0 KiB

View File

@ -0,0 +1,15 @@
<svg width="248" height="53" viewBox="0 0 248 53" fill="none" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 46.0096L7.13565 37.771C5.62145 37.0517 5.62145 35.9401 7.13565 35.2863L13.3241 32.4093L24.8453 37.771C26.3595 38.4902 28.7954 38.4902 30.2437 37.771L41.7648 32.4093L47.9533 35.2863C49.4675 36.0055 49.4675 37.1171 47.9533 37.771L30.1779 46.0096C28.7954 46.6635 26.3595 46.6635 24.9111 46.0096Z" fill="#FF6F3D"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 35.8748L7.13565 27.6361C5.62145 26.9169 5.62145 25.8053 7.13565 25.1514L13.1925 22.3398L24.9111 27.7669C26.4253 28.4861 28.8612 28.4861 30.3096 27.7669L42.0282 22.3398L48.085 25.1514C49.5992 25.8707 49.5992 26.9823 48.085 27.6361L30.3096 35.8748C28.7953 36.594 26.3595 36.594 24.9111 35.8748Z" fill="#95C038"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M24.9111 26.0014L7.13565 17.7628C5.62145 17.0435 5.62145 15.9319 7.13565 15.2781L24.9111 7.03944C26.4253 6.32019 28.8612 6.32019 30.3096 7.03944L48.085 15.2781C49.5992 15.9973 49.5992 17.1089 48.085 17.7628L30.3096 26.0014C28.7953 26.6553 26.3595 26.6553 24.9111 26.0014Z" fill="#5DC0E8"/>
<path d="M60.085 26.4189C60.085 23.0116 61.0651 20.44 63.0906 18.7685C65.0509 17.0327 67.4031 16.197 70.0821 16.197C72.7611 16.197 75.048 17.0327 77.0083 18.7685C78.9685 20.5043 79.9486 23.0116 79.9486 26.4832C79.9486 29.8906 78.9685 32.4621 77.0083 34.1336C75.048 35.8695 72.6958 36.7052 70.0821 36.7052C67.4031 36.7052 65.1162 35.8695 63.0906 34.1336C61.0651 32.3978 60.085 29.8263 60.085 26.4189ZM64.3975 26.4189C64.3975 28.7976 64.8548 30.4692 65.7043 31.5621C66.619 32.655 67.5992 33.3622 68.6446 33.6193C68.906 33.6836 69.102 33.7479 69.3634 33.7479C69.5594 33.7479 69.8208 33.8122 70.0168 33.8122C70.2781 33.8122 70.4742 33.8122 70.7355 33.7479C70.9969 33.7479 71.1929 33.6836 71.4543 33.6193C72.4997 33.3622 73.4798 32.655 74.3293 31.5621C75.1787 30.4692 75.6361 28.7334 75.6361 26.4832C75.6361 24.1688 75.1787 22.4973 74.3293 21.4044C73.4798 20.3115 72.4997 19.6043 71.4543 19.3471C71.1929 19.2828 70.9315 19.2186 70.7355 19.2186C70.4742 19.2186 70.2781 19.1543 70.0168 19.1543C69.7554 19.1543 69.5594 19.1543 69.3634 19.2186C69.1673 19.2186 68.906 19.2828 68.6446 19.3471C67.5992 19.6043 66.619 20.3115 65.7043 21.4044C64.8548 22.3687 64.3975 24.1045 64.3975 26.4189Z" fill="white"/>
<path d="M82.105 16.3898H87.4629L94.5198 28.9905L95.5652 31.755H95.6306L95.5652 28.1548V16.3898H99.6817V36.4481H94.3237L87.2669 23.3331L86.2215 21.0829H86.1561L86.2215 24.6188V36.4481H82.105V16.3898Z" fill="white"/>
<path d="M103.929 16.3898H108.045V33.0407H116.147V36.4481H103.929V16.3898Z" fill="white"/>
<path d="M113.599 16.3898H118.369L122.551 23.3974L123.204 24.8117H123.335L123.988 23.3974L128.235 16.3898H132.613L125.23 28.2833V36.4481H121.113V28.219L113.599 16.3898Z" fill="white"/>
<path d="M132.091 26.4189C132.091 23.0116 133.071 20.44 135.096 18.7685C137.057 17.0327 139.409 16.197 142.088 16.197C144.767 16.197 147.054 17.0327 149.014 18.7685C150.974 20.5043 151.954 23.0116 151.954 26.4832C151.954 29.8906 150.974 32.4621 149.014 34.1336C147.054 35.8695 144.702 36.7052 142.088 36.7052C139.409 36.7052 137.122 35.8695 135.096 34.1336C133.136 32.3978 132.091 29.8263 132.091 26.4189ZM136.403 26.4189C136.403 28.7976 136.861 30.4692 137.71 31.5621C138.625 32.655 139.54 33.3622 140.65 33.6193C140.912 33.6836 141.108 33.7479 141.369 33.7479C141.565 33.7479 141.827 33.8122 142.023 33.8122C142.284 33.8122 142.48 33.8122 142.741 33.7479C143.003 33.7479 143.199 33.6836 143.46 33.6193C144.506 33.3622 145.486 32.655 146.335 31.5621C147.185 30.4692 147.642 28.7334 147.642 26.4832C147.642 24.1688 147.185 22.4973 146.335 21.4044C145.486 20.3115 144.506 19.6043 143.46 19.3471C143.199 19.2828 142.937 19.2186 142.741 19.2186C142.48 19.2186 142.284 19.1543 142.023 19.1543C141.761 19.1543 141.565 19.1543 141.369 19.2186C141.173 19.2186 140.912 19.2828 140.65 19.3471C139.605 19.6043 138.625 20.3115 137.71 21.4044C136.861 22.3687 136.403 24.1045 136.403 26.4189Z" fill="white"/>
<path d="M154.829 16.3898H166.198V19.7329H158.946V24.6188H165.872V28.0262H158.946V36.4481H154.829V16.3898Z" fill="white"/>
<path d="M169.27 16.3898H180.639V19.7329H173.386V24.6188H180.312V28.0262H173.386V36.4481H169.27V16.3898Z" fill="white"/>
<path d="M183.057 36.4481V16.3898H187.173V36.4481H183.057Z" fill="white"/>
<path d="M205.311 16.8397V20.3113C204.592 20.0542 203.873 19.8613 203.089 19.7327C202.305 19.6041 201.39 19.5398 200.476 19.5398C198.319 19.5398 196.686 20.1827 195.51 21.5328C194.334 22.8186 193.746 24.4901 193.746 26.4831C193.746 28.4117 194.268 30.019 195.379 31.3048C196.49 32.5905 198.058 33.2977 200.084 33.2977C200.802 33.2977 201.521 33.2334 202.371 33.1692C203.22 33.0406 204.069 32.8477 204.984 32.462L205.246 35.8693C205.115 35.9336 204.919 35.9979 204.723 36.0622C204.462 36.1265 204.2 36.1907 203.873 36.255C203.351 36.3836 202.697 36.4479 201.913 36.5765C201.129 36.6408 200.345 36.7051 199.496 36.7051C199.365 36.7051 199.234 36.7051 199.169 36.7051C199.038 36.7051 198.908 36.7051 198.842 36.7051C196.49 36.5765 194.334 35.6764 192.373 34.1335C190.413 32.5263 189.433 30.019 189.433 26.6759C189.433 23.3972 190.413 20.8256 192.308 19.0255C194.203 17.2254 196.817 16.3254 200.018 16.3254C200.868 16.3254 201.652 16.3254 202.305 16.3897C203.024 16.454 203.677 16.5825 204.396 16.7111C204.527 16.7754 204.723 16.7754 204.854 16.8397C204.984 16.7754 205.115 16.8397 205.311 16.8397Z" fill="white"/>
<path d="M208.578 16.3899H220.797V19.5401H212.76V24.5546H220.013V27.6405H212.76V33.298H220.797V36.4481H208.578V16.3899Z" fill="white"/>
</svg>

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -76,8 +76,9 @@
"fileType" => $filetype,
"key" => $docKey,
"info" => [
"author" => "Me",
"created" => date('d.m.y')
"owner" => "Me",
"uploaded" => date('d.m.y'),
"favorite" => isset($_GET["user"]) ? $_GET["user"] == 1 : null
],
"permissions" => [
"comment" => $editorsMode != "view" && $editorsMode != "fillForms" && $editorsMode != "embedded" && $editorsMode != "blockcontent",
@ -114,15 +115,34 @@
]
];
$dataInsertImage = [
"fileType" => "png",
"url" => serverPath(true) . "/css/images/logo.png"
];
$dataCompareFile = [
"fileType" => "docx",
"url" => serverPath(true) . "/webeditor-ajax.php?type=download&name=sample.docx"
];
$dataMailMergeRecipients = [
"fileType" =>"csv",
"url" => serverPath(true) . "/webeditor-ajax.php?type=csv"
];
if (isJwtEnabled()) {
$config["token"] = jwtEncode($config);
$dataInsertImage["token"] = jwtEncode($dataInsertImage);
$dataCompareFile["token"] = jwtEncode($dataCompareFile);
$dataMailMergeRecipients["token"] = jwtEncode($dataMailMergeRecipients);
}
function tryGetDefaultByType($createExt) {
$demoName = ($_GET["sample"] ? "demo." : "new.") . $createExt;
$demoName = ($_GET["sample"] ? "sample." : "new.") . $createExt;
$demoPath = "assets" . DIRECTORY_SEPARATOR . ($_GET["sample"] ? "sample" : "new") . DIRECTORY_SEPARATOR;
$demoFilename = GetCorrectName($demoName);
if(!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . "app_data" . DIRECTORY_SEPARATOR . $demoName, getStoragePath($demoFilename)))
if(!@copy(dirname(__FILE__) . DIRECTORY_SEPARATOR . $demoPath . $demoName, getStoragePath($demoFilename)))
{
sendlog("Copy file error to ". getStoragePath($demoFilename), "common.log");
//Copy error!!!
@ -150,16 +170,16 @@
$hist = [];
$histData = [];
for ($i = 0; $i <= $curVer; $i++) {
for ($i = 1; $i <= $curVer; $i++) {
$obj = [];
$dataObj = [];
$verDir = getVersionDir($histDir, $i + 1);
$verDir = getVersionDir($histDir, $i);
$key = $i == $curVer ? $docKey : file_get_contents($verDir . DIRECTORY_SEPARATOR . "key.txt");
$obj["key"] = $key;
$obj["version"] = $i;
if ($i == 0) {
if ($i == 1) {
$createdInfo = file_get_contents($histDir . DIRECTORY_SEPARATOR . "createdInfo.json");
$json = json_decode($createdInfo, true);
@ -176,8 +196,8 @@
$dataObj["url"] = $i == $curVer ? $fileuri : getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($prevFileName));
$dataObj["version"] = $i;
if ($i > 0) {
$changes = json_decode(file_get_contents(getVersionDir($histDir, $i) . DIRECTORY_SEPARATOR . "changes.json"), true);
if ($i > 1) {
$changes = json_decode(file_get_contents(getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "changes.json"), true);
$change = $changes["changes"][0];
$obj["changes"] = $changes["changes"];
@ -185,19 +205,23 @@
$obj["created"] = $change["created"];
$obj["user"] = $change["user"];
$prev = $histData[$i -1];
$prev = $histData[$i - 2];
$dataObj["previous"] = [
"key" => $prev["key"],
"url" => $prev["url"]
];
$changesUrl = getVersionDir($histDir, $i) . DIRECTORY_SEPARATOR . "diff.zip";
$changesUrl = getVersionDir($histDir, $i - 1) . DIRECTORY_SEPARATOR . "diff.zip";
$changesUrl = substr($changesUrl, strlen(getStoragePath("")));
$dataObj["changesUrl"] = getVirtualPath(true) . str_replace("%5C", "/", rawurlencode($changesUrl));
}
if (isJwtEnabled()) {
$dataObj["token"] = jwtEncode($dataObj);
}
array_push($hist, $obj);
$histData[$i] = $dataObj;
$histData[$i - 1] = $dataObj;
}
$out = [];
@ -251,7 +275,7 @@
}
</style>
<script type="text/javascript" src="<?php echo $GLOBALS["DOC_SERV_API_URL"] ?>"></script>
<script type="text/javascript" src="<?php echo $GLOBALS["DOC_SERV_SITE_URL"].$GLOBALS["DOC_SERV_API_URL"] ?>"></script>
<script type="text/javascript">
@ -308,6 +332,28 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam));
};
var onMetaChange = function (event) {
var favorite = !!event.data.favorite;
var title = document.title.replace(/^\☆/g, "");
document.title = (favorite ? "☆" : "") + title;
docEditor.setFavorite(favorite);
};
var onRequestInsertImage = function(event) {
docEditor.insertImage({
"c": event.data.c,
<?php echo mb_strimwidth(json_encode($dataInsertImage), 1, strlen(json_encode($dataInsertImage)) - 2)?>
})
};
var onRequestCompareFile = function() {
docEditor.setRevisedFile(<?php echo json_encode($dataCompareFile)?>);
};
var onRequestMailMergeRecipients = function (event) {
docEditor.setMailMergeRecipients(<?php echo json_encode($dataMailMergeRecipients) ?>);
};
var сonnectEditor = function () {
<?php
@ -328,6 +374,10 @@
'onError': onError,
'onOutdatedVersion': onOutdatedVersion,
'onMakeActionLink': onMakeActionLink,
'onMetaChange': onMetaChange,
'onRequestInsertImage': onRequestInsertImage,
'onRequestCompareFile': onRequestCompareFile,
'onRequestMailMergeRecipients': onRequestMailMergeRecipients,
};
<?php
@ -342,7 +392,7 @@
config.events['onRequestHistoryData'] = function (event) {
var ver = event.data;
var histData = <?php echo json_encode($historyData) ?>;
docEditor.setHistoryData(histData[ver]);
docEditor.setHistoryData(histData[ver - 1]);
};
config.events['onRequestHistoryClose'] = function () {
document.location.reload();

View File

@ -133,7 +133,7 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
$document_revision_id = GenerateRevisionId($document_revision_id);
$urlToConverter = $GLOBALS['DOC_SERV_CONVERTER_URL'];
$urlToConverter = $GLOBALS['DOC_SERV_SITE_URL'].$GLOBALS['DOC_SERV_CONVERTER_URL'];
$arr = [
"async" => $is_async,
@ -145,6 +145,8 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
];
$headerToken = "";
$jwtHeader = $GLOBALS['DOC_SERV_JWT_HEADER'] == "" ? "Authorization" : $GLOBALS['DOC_SERV_JWT_HEADER'];
if (isJwtEnabled()) {
$headerToken = jwtEncode([ "payload" => $arr ]);
$arr["token"] = jwtEncode($arr);
@ -157,7 +159,7 @@ function SendRequestToConvertService($document_uri, $from_extension, $to_extensi
'timeout' => $GLOBALS['DOC_SERV_TIMEOUT'],
'header'=> "Content-type: application/json\r\n" .
"Accept: application/json\r\n" .
(empty($headerToken) ? "" : "Authorization: $headerToken\r\n"),
(empty($headerToken) ? "" : $jwtHeader.": Bearer $headerToken\r\n"),
'content' => $data
)
);

View File

@ -60,7 +60,7 @@
<form id="form1">
<header>
<a href="">
<img src ="css/images/logo.png" alt="ONLYOFFICE" />
<img src ="css/images/logo.svg" alt="ONLYOFFICE" />
</a>
</header>
<div class="main-panel">
@ -314,7 +314,7 @@
<div id="cancelEdit" class="button gray">Cancel</div>
</div>
<span id="loadScripts" data-docs="<?php echo $GLOBALS['DOC_SERV_PRELOADER_URL'] ?>"></span>
<span id="loadScripts" data-docs="<?php echo $GLOBALS['DOC_SERV_SITE_URL'].$GLOBALS['DOC_SERV_PRELOADER_URL'] ?>"></span>
<footer>&copy; Ascensio Systems Inc <?php echo date("Y") ?>. All rights reserved.</footer>
<script type="text/javascript" src="js/jscript.js"></script>

View File

@ -7,5 +7,10 @@
<defaultDocument enabled="true" />
<httpErrors errorMode="Detailed"/>
<urlCompression doDynamicCompression="false"/>
<httpProtocol>
<customHeaders>
<add name="Access-Control-Allow-Origin" value="*" />
</customHeaders>
</httpProtocol>
</system.webServer>
</configuration>

View File

@ -64,6 +64,17 @@ if (isset($_GET["type"]) && !empty($_GET["type"])) { //Checks if type value exis
$response_array = delete();
$response_array['status'] = 'success';
die (json_encode($response_array));
case "download":
$response_array = download();
$response_array['status'] = 'success';
die (json_encode($response_array));
case "csv":
$response_array = csv();
$response_array['status'] = 'success';
die (json_encode($response_array));
case "files":
$response_array = files();
die (json_encode($response_array));
default:
$response_array['status'] = 'error';
$response_array['error'] = '404 Method not found';
@ -144,10 +155,12 @@ function track() {
$inHeader = false;
$token = "";
$jwtHeader = $GLOBALS['DOC_SERV_JWT_HEADER'] == "" ? "Authorization" : $GLOBALS['DOC_SERV_JWT_HEADER'];
if (!empty($data["token"])) {
$token = jwtDecode($data["token"]);
} elseif (!empty($_SERVER['HTTP_AUTHORIZATION'])) {
$token = jwtDecode(substr($_SERVER['HTTP_AUTHORIZATION'], strlen("Bearer ")));
} elseif (!empty(apache_request_headers()[$jwtHeader])) {
$token = jwtDecode(substr(apache_request_headers()[$jwtHeader], strlen("Bearer ")));
$inHeader = true;
} else {
sendlog("jwt token wasn't found in body or headers", "webedior-ajax.log");
@ -171,7 +184,7 @@ function track() {
case "Corrupted":
$userAddress = $_GET["userAddress"];
$fileName = $_GET["fileName"];
$fileName = basename($_GET["fileName"]);
$downloadUri = $data["url"];
@ -200,7 +213,7 @@ function track() {
} else {
$storagePath = getStoragePath($fileName, $userAddress);
$histDir = getHistoryDir($storagePath);
$verDir = getVersionDir($histDir, getFileVersion($histDir) + 1);
$verDir = getVersionDir($histDir, getFileVersion($histDir));
mkdir($verDir);
@ -231,7 +244,7 @@ function track() {
}
function convert() {
$fileName = $_GET["filename"];
$fileName = basename($_GET["filename"]);
$extension = strtolower(pathinfo($fileName, PATHINFO_EXTENSION));
$internalExtension = trim(getInternalExtension($fileName),'.');
@ -288,7 +301,7 @@ function convert() {
function delete() {
try {
$fileName = $_GET["fileName"];
$fileName = basename($_GET["fileName"]);
$filePath = getStoragePath($fileName);
@ -302,6 +315,53 @@ function delete() {
}
}
function files() {
try {
@header( "Content-Type", "application/json" );
$fileId = $_GET["fileId"];
$result = getFileInfo($fileId);
return $result;
}
catch (Exception $e) {
sendlog("Files ".$e->getMessage(), "webedior-ajax.log");
$result["error"] = "error: " . $e->getMessage();
return $result;
}
}
function download() {
$fileName = "sample" . DIRECTORY_SEPARATOR . basename($_GET["name"]);
downloadFile($fileName);
}
function csv() {
$fileName = "sample" . DIRECTORY_SEPARATOR . "csv.csv";
downloadFile($fileName);
}
function downloadFile($fileName) {
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR . "assets" . DIRECTORY_SEPARATOR . $fileName;
if (file_exists($file)) {
if (ob_get_level()) {
ob_end_clean();
}
@header('Content-Length: ' . filesize($file));
@header('Content-Disposition: attachment; filename*=UTF-8\'\'' . urldecode(basename($file)));
@header('Content-Type: ' . mime_content_type($file));
if ($fd = fopen($file, 'rb')) {
while (!feof($fd)) {
print fread($fd, 1024);
}
fclose($fd);
}
exit;
}
}
function delTree($dir) {
if (!file_exists($dir) || !is_dir($dir)) return;

View File

@ -10,19 +10,21 @@ DOC_SERV_CONVERT = [
".fodt", ".ott", ".xlsm", ".xls", ".xltx", ".xltm",
".xlt", ".ods", ".fods", ".ots", ".pptm", ".ppt",
".ppsx", ".ppsm", ".pps", ".potx", ".potm", ".pot",
".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub"
".odp", ".fodp", ".otp", ".rtf", ".mht", ".html", ".htm", ".epub", ".fb2"
]
DOC_SERV_TIMEOUT = 120000
DOC_SERV_CONVERTER_URL = 'https://documentserver/ConvertService.ashx'
DOC_SERV_API_URL = 'https://documentserver/web-apps/apps/api/documents/api.js'
DOC_SERV_PRELOADER_URL = 'https://documentserver/web-apps/apps/api/documents/cache-scripts.html'
DOC_SERV_SITE_URL = 'https://documentserver/'
EXAMPLE_DOMAIN = 'https://exampleserver/'
DOC_SERV_CONVERTER_URL = 'ConvertService.ashx'
DOC_SERV_API_URL = 'web-apps/apps/api/documents/api.js'
DOC_SERV_PRELOADER_URL = 'web-apps/apps/api/documents/cache-scripts.html'
EXAMPLE_DOMAIN = None
DOC_SERV_JWT_SECRET = ''
DOC_SERV_JWT_HEADER = 'Authorization'
EXT_SPREADSHEET = [
".xls", ".xlsx", ".xlsm",
@ -45,11 +47,7 @@ EXT_DOCUMENT = [
".pdf", ".djvu", ".fb2", ".epub", ".xps"
]
if os.environ.get("EXAMPLE_DOMAIN"):
EXAMPLE_DOMAIN = os.environ.get("EXAMPLE_DOMAIN")
if os.environ.get("DOC_SERV"):
base = os.environ.get("DOC_SERV").rstrip('/')
DOC_SERV_CONVERTER_URL = base + '/ConvertService.ashx'
DOC_SERV_API_URL = base + '/web-apps/apps/api/documents/api.js'
DOC_SERV_PRELOADER_URL = base + '/web-apps/apps/api/documents/cache-scripts.html'
DOC_SERV_SITE_URL = os.environ.get("DOC_SERV")

View File

@ -4,9 +4,9 @@ Example is written for Python 3.6+
You should also install following dependencies:
```
pip install Django==2.2.6
pip install requests==2.22.0
pip install pyjwt==1.7.1
pip install Django==3.1.6
pip install requests==2.25.1
pip install pyjwt==2.0.1
```
## Configuration

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