feat(java): close editor. Fix Bug 69915

This commit is contained in:
sshakndr
2024-10-09 17:05:35 +07:00
parent 6ad97aebc7
commit 00f43b6ecd
6 changed files with 82 additions and 5 deletions

View File

@ -3,6 +3,7 @@
- filename in editor page title - filename in editor page title
- csharp: close editor - csharp: close editor
- csharp-mvc: close editor - csharp-mvc: close editor
- java: close editor
- he-IL skin language - he-IL skin language
- ConvertService.ashx address replaced with converter - ConvertService.ashx address replaced with converter
- coauthoring/CommandService.ashx address replaced with command - coauthoring/CommandService.ashx address replaced with command

View File

@ -0,0 +1,47 @@
/**
*
* (c) Copyright Ascensio System SIA 2024
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package entities;
public class Close {
private String text;
private Boolean visible;
public Close() { }
public Close(final String textParam, final Boolean visibleParam) {
this.text = textParam;
this.visible = visibleParam;
}
public String getText() {
return text;
}
public void setText(final String textParam) {
this.text = textParam;
}
public Boolean isVisible() {
return visible;
}
public void setVisible(final Boolean visibleParam) {
this.visible = visibleParam;
}
}

View File

@ -124,6 +124,10 @@ public class FileModel {
.setBlank(user.getGoback().getBlank()); .setBlank(user.getGoback().getBlank());
} }
if (user.getClose() != null) {
editorConfig.getCustomization().setClose(user.getClose());
}
changeType(mode, type, user, fileName); changeType(mode, type, user, fileName);
} }
@ -566,6 +570,7 @@ public class FileModel {
// customization parameters // customization parameters
public class Customization { public class Customization {
private Goback goback; private Goback goback;
private Close close;
private Boolean forcesave; private Boolean forcesave;
private Boolean submitForm; private Boolean submitForm;
private Boolean about; private Boolean about;
@ -576,18 +581,27 @@ public class FileModel {
this.submitForm = submitFormParam; this.submitForm = submitFormParam;
} }
public void setClose(final Close closeParam) {
this.close = closeParam;
}
public Customization() { public Customization() {
about = true; about = true;
comments = true; comments = true;
feedback = true; feedback = true;
forcesave = false; forcesave = false;
goback = new Goback(); goback = new Goback();
close = new Close();
} }
public Goback getGoback() { public Goback getGoback() {
return goback; return goback;
} }
public Close getClose() {
return close;
}
public Boolean getForcesave() { public Boolean getForcesave() {
return forcesave; return forcesave;
} }

View File

@ -34,12 +34,14 @@ public class User {
private final List<String> userInfoGroups; private final List<String> userInfoGroups;
private final Boolean avatar; private final Boolean avatar;
private final Goback goback; private final Goback goback;
private final Close close;
public User(final String idParam, final String nameParam, final String emailParam, final String groupParam, public User(final String idParam, final String nameParam, final String emailParam, final String groupParam,
final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam, final List<String> reviewGroupsParam, final CommentGroups commentGroupsParam,
final List<String> userInfoGroupsParam, final Boolean favoriteParam, final List<String> userInfoGroupsParam, final Boolean favoriteParam,
final List<String> deniedPermissionsParam, final List<String> descriptionsParam, final List<String> deniedPermissionsParam, final List<String> descriptionsParam,
final Boolean templatesParam, final Boolean avatarParam, final Goback gobackParam) { final Boolean templatesParam, final Boolean avatarParam, final Goback gobackParam,
final Close closeParam) {
this.id = idParam; this.id = idParam;
this.name = nameParam; this.name = nameParam;
this.email = emailParam; this.email = emailParam;
@ -53,6 +55,7 @@ public class User {
this.userInfoGroups = userInfoGroupsParam; this.userInfoGroups = userInfoGroupsParam;
this.avatar = avatarParam; this.avatar = avatarParam;
this.goback = gobackParam; this.goback = gobackParam;
this.close = closeParam;
} }
public String getId() { public String getId() {
@ -106,4 +109,8 @@ public class User {
public Goback getGoback() { public Goback getGoback() {
return goback; return goback;
} }
public Close getClose() {
return close;
}
} }

View File

@ -18,6 +18,7 @@
package helpers; package helpers;
import entities.Close;
import entities.CommentGroups; import entities.CommentGroups;
import entities.Goback; import entities.Goback;
import entities.User; import entities.User;
@ -88,20 +89,21 @@ public final class Users {
private static List<User> users = new ArrayList<User>() {{ private static List<User> users = new ArrayList<User>() {{
add(new User("uid-1", "John Smith", "smith@example.com", add(new User("uid-1", "John Smith", "smith@example.com",
"", null, new CommentGroups(), null, "", null, new CommentGroups(), null,
null, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false))); null, new ArrayList<String>(), descriptionUserFirst, true, true, new Goback(null, false),
new Close(null, false)));
add(new User("uid-2", "Mark Pottato", "pottato@example.com", add(new User("uid-2", "Mark Pottato", "pottato@example.com",
"group-2", Arrays.asList("group-2", ""), new CommentGroups(null, "group-2", Arrays.asList("group-2", ""), new CommentGroups(null,
Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""), Arrays.asList("group-2", ""), Arrays.asList("group-2")), Arrays.asList("group-2", ""),
true, new ArrayList<String>(), descriptionUserSecond, false, true, true, new ArrayList<String>(), descriptionUserSecond, false, true,
new Goback("Go to Documents", false))); new Goback("Go to Documents", false), new Close(null, true)));
add(new User("uid-3", "Hamish Mitchell", null, add(new User("uid-3", "Hamish Mitchell", null,
"group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"), "group-3", Arrays.asList("group-2"), new CommentGroups(Arrays.asList("group-3", "group-2"),
Arrays.asList("group-2"), null), Arrays.asList("group-2"), Arrays.asList("group-2"), null), Arrays.asList("group-2"),
false, Arrays.asList("copy", "download", "print"), false, Arrays.asList("copy", "download", "print"),
descriptionUserThird, false, false, null)); descriptionUserThird, false, false, null, new Close(null, true)));
add(new User("uid-0", null, null, add(new User("uid-0", null, null,
"", null, null, null, "", null, null, null,
null, Arrays.asList("protect"), descriptionUserZero, false, false, null)); null, Arrays.asList("protect"), descriptionUserZero, false, false, null, null));
}}; }};
private Users() { } private Users() { }

View File

@ -96,6 +96,11 @@
docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark docEditor.setActionLink(replaceActionLink(location.href, linkParam)); // set the link to the document which contains a bookmark
}; };
var onRequestClose = function () { // close editor
docEditor.destroyEditor();
innerAlert("Document editor closed successfully");
};
// the meta information of the document is changed via the meta command // the meta information of the document is changed via the meta command
var onMetaChange = function (event) { var onMetaChange = function (event) {
if (event.data.favorite !== undefined) { if (event.data.favorite !== undefined) {
@ -315,6 +320,7 @@
}; };
if (config.editorConfig.user.id) { if (config.editorConfig.user.id) {
config.events['onRequestClose'] = onRequestClose;
// add mentions for not anonymous users // add mentions for not anonymous users
config.events['onRequestUsers'] = onRequestUsers; config.events['onRequestUsers'] = onRequestUsers;
config.events['onRequestSaveAs'] = onRequestSaveAs; config.events['onRequestSaveAs'] = onRequestSaveAs;