From 558365325c97a09209b47de6a9f25bdc5873d7cc Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 18 Mar 2024 14:28:30 +0300 Subject: [PATCH 01/25] nodejs: format max length # Conflicts: # web/documentserver-example/nodejs/helpers/users.js --- .../nodejs/helpers/users.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/web/documentserver-example/nodejs/helpers/users.js b/web/documentserver-example/nodejs/helpers/users.js index 8d7bd7f6f..beeb60c94 100644 --- a/web/documentserver-example/nodejs/helpers/users.js +++ b/web/documentserver-example/nodejs/helpers/users.js @@ -99,7 +99,20 @@ const descrUser0 = [ ]; const users = [ - new User('uid-1', 'John Smith', 'smith@example.com', null, null, {}, null, null, [], descrUser1, true, true), + new User( + 'uid-1', + 'John Smith', + 'smith@example.com', + null, + null, + {}, + null, + null, + [], + descrUser1, + true, + true, + ), new User( 'uid-2', 'Mark Pottato', From 495ba9814ff22c23a22fd3820ff2d66e128c2621 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 18 Mar 2024 14:24:32 +0300 Subject: [PATCH 02/25] nodejs: close editor # Conflicts: # CHANGELOG.md # web/documentserver-example/nodejs/app.js # web/documentserver-example/nodejs/helpers/users.js --- CHANGELOG.md | 2 ++ web/documentserver-example/nodejs/app.js | 1 + web/documentserver-example/nodejs/helpers/users.js | 7 ++++++- web/documentserver-example/nodejs/views/config.ejs | 1 + web/documentserver-example/nodejs/views/editor.ejs | 6 ++++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 79fe928aa..600a706dc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,7 @@ # Change Log +- nodejs: close editor + ## 1.8.0 - nodejs: pdf, djvu, xps, oxps as pdf documentType - nodejs: filling pdf diff --git a/web/documentserver-example/nodejs/app.js b/web/documentserver-example/nodejs/app.js index a3d77cfee..95819b91c 100755 --- a/web/documentserver-example/nodejs/app.js +++ b/web/documentserver-example/nodejs/app.js @@ -1067,6 +1067,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document ? JSON.stringify({ fileName, userAddress: req.DocManager.curUserHostAddress() }) : null, instanceId: userid !== 'uid-0' ? req.DocManager.getInstanceId() : null, protect: !user.deniedPermissions.includes('protect'), + close: user.close, }, dataInsertImage: { fileType: 'png', diff --git a/web/documentserver-example/nodejs/helpers/users.js b/web/documentserver-example/nodejs/helpers/users.js index beeb60c94..301cc3079 100644 --- a/web/documentserver-example/nodejs/helpers/users.js +++ b/web/documentserver-example/nodejs/helpers/users.js @@ -30,6 +30,7 @@ class User { descriptions, templates, avatar, + close, ) { this.id = id; this.name = name; @@ -43,6 +44,7 @@ class User { this.descriptions = descriptions; this.templates = templates; this.avatar = avatar; + this.close = close; } } @@ -112,6 +114,7 @@ const users = [ descrUser1, true, true, + { visible: false }, ), new User( 'uid-2', @@ -130,6 +133,7 @@ const users = [ descrUser2, false, true, + {}, ), new User( 'uid-3', @@ -148,8 +152,9 @@ const users = [ descrUser3, false, false, + {}, ), - new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false), + new User('uid-0', null, null, null, null, {}, [], null, ['protect'], descrUser0, false, false, null), ]; // get a list of all the users diff --git a/web/documentserver-example/nodejs/views/config.ejs b/web/documentserver-example/nodejs/views/config.ejs index fbfd44221..57614b948 100755 --- a/web/documentserver-example/nodejs/views/config.ejs +++ b/web/documentserver-example/nodejs/views/config.ejs @@ -39,6 +39,7 @@ "customization": { "about": true, "comments": true, + "close": <%- JSON.stringify(editor.close) %>, "feedback": true, "forcesave": false, "goback": { diff --git a/web/documentserver-example/nodejs/views/editor.ejs b/web/documentserver-example/nodejs/views/editor.ejs index 8d6032aec..8e7c416bb 100644 --- a/web/documentserver-example/nodejs/views/editor.ejs +++ b/web/documentserver-example/nodejs/views/editor.ejs @@ -57,6 +57,11 @@ document.title = title + (event.data ? "*" : ""); }; + var onRequestClose = function () { // close editor + docEditor.destroyEditor(); + innerAlert("Document editor closed successfully"); + }; + var onMetaChange = function (event) { // the meta information of the document is changed via the meta command if (event.data.favorite) { var favorite = !!event.data.favorite; @@ -372,6 +377,7 @@ }; if (<%- JSON.stringify(editor.userid) %> != null) { + config.events.onRequestClose = onRequestClose; config.events.onRequestEditRights = onRequestEditRights; config.events.onRequestHistory = onRequestHistory; config.events.onRequestHistoryData = onRequestHistoryData; From ad39fb7c19b6bf146b55d0b47907f822e492ac2b Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Fri, 15 Mar 2024 11:18:15 +0300 Subject: [PATCH 03/25] nodejs: wopi formsubmit icon # Conflicts: # CHANGELOG.md --- CHANGELOG.md | 1 + .../nodejs/public/images/wopi-formsubmit.svg | 4 ++++ 2 files changed, 5 insertions(+) create mode 100644 web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg diff --git a/CHANGELOG.md b/CHANGELOG.md index 600a706dc..d97fc4b86 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log +- nodejs: wopi formsubmit icon - nodejs: close editor ## 1.8.0 diff --git a/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg b/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg new file mode 100644 index 000000000..8d58f94e1 --- /dev/null +++ b/web/documentserver-example/nodejs/public/images/wopi-formsubmit.svg @@ -0,0 +1,4 @@ + + + + From 04143198932e929d04f9274a545b90a748738de3 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Tue, 19 Mar 2024 15:08:42 +0300 Subject: [PATCH 04/25] nodejs: fill permission in embedded mode --- CHANGELOG.md | 1 + web/documentserver-example/csharp-mvc/Models/FileModel.cs | 2 +- web/documentserver-example/csharp/DocEditor.aspx.cs | 2 +- .../configurers/implementations/DefaultFileConfigurer.java | 1 - .../java/src/main/java/entities/FileModel.java | 2 +- web/documentserver-example/nodejs/app.js | 2 +- web/documentserver-example/php/src/views/DocEditorView.php | 2 +- web/documentserver-example/python/src/views/actions.py | 2 +- web/documentserver-example/ruby/app/models/file_model.rb | 2 +- 9 files changed, 8 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d97fc4b86..faa51cba8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log +- fill permission in embedded mode - nodejs: wopi formsubmit icon - nodejs: close editor diff --git a/web/documentserver-example/csharp-mvc/Models/FileModel.cs b/web/documentserver-example/csharp-mvc/Models/FileModel.cs index 2438ffcd7..e77f4b86f 100755 --- a/web/documentserver-example/csharp-mvc/Models/FileModel.cs +++ b/web/documentserver-example/csharp-mvc/Models/FileModel.cs @@ -157,7 +157,7 @@ public string GetDocConfig(HttpRequest request, UrlHelper url) { "download", !user.deniedPermissions.Contains("download") }, { "edit", canEdit && (editorsMode == "edit" || editorsMode == "view" || editorsMode == "filter" || editorsMode == "blockcontent") }, { "print", !user.deniedPermissions.Contains("print") }, - { "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "embedded" && editorsMode != "blockcontent" }, + { "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "blockcontent" }, { "modifyFilter", editorsMode != "filter" }, { "modifyContentControl", editorsMode != "blockcontent" }, { "review", canEdit && (editorsMode == "edit" || editorsMode == "review") }, diff --git a/web/documentserver-example/csharp/DocEditor.aspx.cs b/web/documentserver-example/csharp/DocEditor.aspx.cs index c492ba11f..260246d66 100755 --- a/web/documentserver-example/csharp/DocEditor.aspx.cs +++ b/web/documentserver-example/csharp/DocEditor.aspx.cs @@ -225,7 +225,7 @@ protected void Page_Load(object sender, EventArgs e) { "download", !user.deniedPermissions.Contains("download") }, { "edit", canEdit && (editorsMode == "edit" || editorsMode =="view" || editorsMode == "filter" || editorsMode == "blockcontent") }, { "print", !user.deniedPermissions.Contains("print") }, - { "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "embedded" && editorsMode != "blockcontent" }, + { "fillForms", editorsMode != "view" && editorsMode != "comment" && editorsMode != "blockcontent" }, { "modifyFilter", editorsMode != "filter" }, { "modifyContentControl", editorsMode != "blockcontent" }, { "review", canEdit && (editorsMode == "edit" || editorsMode == "review") }, diff --git a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/configurers/implementations/DefaultFileConfigurer.java b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/configurers/implementations/DefaultFileConfigurer.java index 9651dcb8d..798e895f4 100755 --- a/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/configurers/implementations/DefaultFileConfigurer.java +++ b/web/documentserver-example/java-spring/src/main/java/com/onlyoffice/integration/services/configurers/implementations/DefaultFileConfigurer.java @@ -120,7 +120,6 @@ private Permission updatePermissions(final Permission userPermissions, final Act userPermissions.setFillForms( !action.equals(Action.view) && !action.equals(Action.comment) - && !action.equals(Action.embedded) && !action.equals(Action.blockcontent) ); diff --git a/web/documentserver-example/java/src/main/java/entities/FileModel.java b/web/documentserver-example/java/src/main/java/entities/FileModel.java index 5c6e9f972..f79db8549 100755 --- a/web/documentserver-example/java/src/main/java/entities/FileModel.java +++ b/web/documentserver-example/java/src/main/java/entities/FileModel.java @@ -291,7 +291,7 @@ public Permissions(final String modeParam, final String typeParam, final Boolean edit = canEdit && (modeParam.equals("edit") || modeParam.equals("view") || modeParam.equals("filter") || modeParam.equals("blockcontent")); print = !user.getDeniedPermissions().contains("print"); - fillForms = !modeParam.equals("view") && !modeParam.equals("comment") && !modeParam.equals("embedded") + fillForms = !modeParam.equals("view") && !modeParam.equals("comment") && !modeParam.equals("blockcontent"); modifyFilter = !modeParam.equals("filter"); modifyContentControl = !modeParam.equals("blockcontent"); diff --git a/web/documentserver-example/nodejs/app.js b/web/documentserver-example/nodejs/app.js index 95819b91c..90963b9ae 100755 --- a/web/documentserver-example/nodejs/app.js +++ b/web/documentserver-example/nodejs/app.js @@ -1041,7 +1041,7 @@ app.get('/editor', (req, res) => { // define a handler for editing document chat: userid !== 'uid-0', coEditing: mode === 'view' && userid === 'uid-0' ? { mode: 'strict', change: false } : null, comment: mode !== 'view' && mode !== 'fillForms' && mode !== 'embedded' && mode !== 'blockcontent', - fillForms: mode !== 'view' && mode !== 'comment' && mode !== 'embedded' && mode !== 'blockcontent', + fillForms: mode !== 'view' && mode !== 'comment' && mode !== 'blockcontent', modifyFilter: mode !== 'filter', modifyContentControl: mode !== 'blockcontent', copy: !user.deniedPermissions.includes('copy'), diff --git a/web/documentserver-example/php/src/views/DocEditorView.php b/web/documentserver-example/php/src/views/DocEditorView.php index 861165e4d..f492f5956 100644 --- a/web/documentserver-example/php/src/views/DocEditorView.php +++ b/web/documentserver-example/php/src/views/DocEditorView.php @@ -128,7 +128,7 @@ public function __construct($request, $tempName = "docEditor") $editorsMode == "view" || $editorsMode == "filter" || $editorsMode == "blockcontent"), "print" => !in_array("print", $user->deniedPermissions), "fillForms" => $editorsMode != "view" && $editorsMode != "comment" - && $editorsMode != "embedded" && $editorsMode != "blockcontent", + && $editorsMode != "blockcontent", "modifyFilter" => $editorsMode != "filter", "modifyContentControl" => $editorsMode != "blockcontent", "review" => $canEdit && ($editorsMode == "edit" || $editorsMode == "review"), diff --git a/web/documentserver-example/python/src/views/actions.py b/web/documentserver-example/python/src/views/actions.py index 02e2f949e..2969aeb38 100755 --- a/web/documentserver-example/python/src/views/actions.py +++ b/web/documentserver-example/python/src/views/actions.py @@ -272,7 +272,7 @@ def edit(request): 'edit': canEdit & ((edMode == 'edit') | (edMode == 'view') | (edMode == 'filter') \ | (edMode == "blockcontent")), 'print': 'print' not in user.deniedPermissions, - 'fillForms': (edMode != 'view') & (edMode != 'comment') & (edMode != 'embedded') \ + 'fillForms': (edMode != 'view') & (edMode != 'comment') \ & (edMode != "blockcontent"), 'modifyFilter': edMode != 'filter', 'modifyContentControl': edMode != "blockcontent", diff --git a/web/documentserver-example/ruby/app/models/file_model.rb b/web/documentserver-example/ruby/app/models/file_model.rb index d4772bc32..20bce82fc 100755 --- a/web/documentserver-example/ruby/app/models/file_model.rb +++ b/web/documentserver-example/ruby/app/models/file_model.rb @@ -143,7 +143,7 @@ def config download: @user.denied_permissions.exclude?('download'), edit: can_edit && ['edit', 'view', 'filter', 'blockcontent'].include?(editors_mode), print: @user.denied_permissions.exclude?('print'), - fillForms: ['view', 'comment', 'embedded', 'blockcontent'].exclude?(editors_mode), + fillForms: ['view', 'comment', 'blockcontent'].exclude?(editors_mode), modifyFilter: !editors_mode.eql?('filter'), modifyContentControl: !editors_mode.eql?('blockcontent'), review: can_edit && (editors_mode.eql?('edit') || editors_mode.eql?('review')), From 1b8f60d5dd76328895fd7e555538f85acecff807 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Thu, 21 Mar 2024 14:21:29 +0300 Subject: [PATCH 05/25] nodejs: update formats --- .../nodejs/public/assets/document-formats | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/documentserver-example/nodejs/public/assets/document-formats b/web/documentserver-example/nodejs/public/assets/document-formats index d81437e6d..7b7c406cc 160000 --- a/web/documentserver-example/nodejs/public/assets/document-formats +++ b/web/documentserver-example/nodejs/public/assets/document-formats @@ -1 +1 @@ -Subproject commit d81437e6d35d8d8fda23cee3e30312302046da33 +Subproject commit 7b7c406cc69b3239693cf4c0ac59b4817b5485eb From abf382a03b5084c5db1d501bab96ccec01123e80 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 18 Mar 2024 18:21:10 +0300 Subject: [PATCH 06/25] nodejs: creating pdf form --- .gitmodules | 4 ++-- CHANGELOG.md | 1 + .../nodejs/public/assets/document-formats | 2 +- .../nodejs/public/assets/document-templates | 2 +- .../nodejs/public/images/{file_docxf.svg => file_pdf.svg} | 0 .../nodejs/public/stylesheets/stylesheet.css | 2 +- web/documentserver-example/nodejs/views/index.ejs | 2 +- web/documentserver-example/nodejs/views/wopiIndex.ejs | 2 +- 8 files changed, 8 insertions(+), 7 deletions(-) rename web/documentserver-example/nodejs/public/images/{file_docxf.svg => file_pdf.svg} (100%) diff --git a/.gitmodules b/.gitmodules index 43b3007ad..588e6d462 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,11 +1,11 @@ [submodule "web/documentserver-example/nodejs/public/assets/document-templates"] path = web/documentserver-example/nodejs/public/assets/document-templates url = https://github.com/ONLYOFFICE/document-templates - branch = main/en + branch = main/en-8.1 [submodule "web/documentserver-example/nodejs/public/assets/document-formats"] path = web/documentserver-example/nodejs/public/assets/document-formats url = https://github.com/ONLYOFFICE/document-formats - branch = feature/v8.0 + branch = feature/v8.1 [submodule "web/documentserver-example/csharp-mvc/assets/document-templates"] path = web/documentserver-example/csharp-mvc/assets/document-templates url = https://github.com/ONLYOFFICE/document-templates diff --git a/CHANGELOG.md b/CHANGELOG.md index faa51cba8..77fd43152 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # Change Log +- nodejs: creating pdf instead docxf - fill permission in embedded mode - nodejs: wopi formsubmit icon - nodejs: close editor diff --git a/web/documentserver-example/nodejs/public/assets/document-formats b/web/documentserver-example/nodejs/public/assets/document-formats index 7b7c406cc..d754dc9e6 160000 --- a/web/documentserver-example/nodejs/public/assets/document-formats +++ b/web/documentserver-example/nodejs/public/assets/document-formats @@ -1 +1 @@ -Subproject commit 7b7c406cc69b3239693cf4c0ac59b4817b5485eb +Subproject commit d754dc9e6725043d0b9374bb59ac13501aae7333 diff --git a/web/documentserver-example/nodejs/public/assets/document-templates b/web/documentserver-example/nodejs/public/assets/document-templates index 1fc823afa..cd3c20237 160000 --- a/web/documentserver-example/nodejs/public/assets/document-templates +++ b/web/documentserver-example/nodejs/public/assets/document-templates @@ -1 +1 @@ -Subproject commit 1fc823afa909e4c49551e4e5b945189a21ff1999 +Subproject commit cd3c2023779bc53c4aef255f6a9459ad6c3ce9e7 diff --git a/web/documentserver-example/nodejs/public/images/file_docxf.svg b/web/documentserver-example/nodejs/public/images/file_pdf.svg similarity index 100% rename from web/documentserver-example/nodejs/public/images/file_docxf.svg rename to web/documentserver-example/nodejs/public/images/file_pdf.svg diff --git a/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css b/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css index 2be31b736..0247a96f5 100644 --- a/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css +++ b/web/documentserver-example/nodejs/public/stylesheets/stylesheet.css @@ -162,7 +162,7 @@ label .checkbox { } .try-editor.form { - background-image: url("../images/file_docxf.svg"); + background-image: url("../images/file_pdf.svg"); } .side-option { diff --git a/web/documentserver-example/nodejs/views/index.ejs b/web/documentserver-example/nodejs/views/index.ejs index b69de87ca..7202f2940 100755 --- a/web/documentserver-example/nodejs/views/index.ejs +++ b/web/documentserver-example/nodejs/views/index.ejs @@ -58,7 +58,7 @@ Presentation
  • - PDF form + PDF form