mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-02-10 18:05:10 +08:00
Merge branch 'feature/chat' into feature/liveview
# Conflicts: # CHANGELOG.md
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
# Change Log
|
||||
|
||||
- anonymous without chat
|
||||
- offline viewer for anonymous
|
||||
- zh-TW, pt-PT
|
||||
|
||||
|
||||
@ -67,7 +67,8 @@ namespace OnlineEditorsExampleMVC.Helpers
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat",
|
||||
};
|
||||
|
||||
private static List<User> users = new List<User>() {
|
||||
|
||||
@ -148,6 +148,7 @@ namespace OnlineEditorsExampleMVC.Models
|
||||
{ "modifyFilter", editorsMode != "filter" },
|
||||
{ "modifyContentControl", editorsMode != "blockcontent" },
|
||||
{ "review", canEdit && (editorsMode == "edit" || editorsMode == "review") },
|
||||
{ "chat", !user.id.Equals("uid-0") },
|
||||
{ "reviewGroups", user.reviewGroups },
|
||||
{ "commentGroups", user.commentGroups },
|
||||
{ "userInfoGroups", user.userInfoGroups }
|
||||
|
||||
@ -166,6 +166,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
|
||||
@ -575,7 +575,15 @@ namespace OnlineEditorsExampleMVC
|
||||
var jss = new JavaScriptSerializer();
|
||||
var body = jss.Deserialize<Dictionary<string, object>>(fileData);
|
||||
var newFileName = (string) body["newfilename"];
|
||||
var docKey = (string) body["dockey"];
|
||||
var docKey = (string) body["dockey"];
|
||||
|
||||
var origExt = '.' + (string) body["ext"];
|
||||
var curExt = Path.GetExtension(newFileName).ToLower();
|
||||
|
||||
if (string.Compare(origExt, curExt, true) != 0)
|
||||
{
|
||||
newFileName += origExt;
|
||||
}
|
||||
var meta = new Dictionary<string, object>() {
|
||||
{ "title", newFileName }
|
||||
};
|
||||
|
||||
@ -178,6 +178,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
|
||||
@ -216,6 +216,7 @@ namespace OnlineEditorsExample
|
||||
{ "modifyFilter", editorsMode != "filter" },
|
||||
{ "modifyContentControl", editorsMode != "blockcontent" },
|
||||
{ "review", canEdit && (editorsMode == "edit" || editorsMode == "review") },
|
||||
{ "chat", !user.id.Equals("uid-0") },
|
||||
{ "reviewGroups", user.reviewGroups },
|
||||
{ "commentGroups", user.commentGroups },
|
||||
{ "userInfoGroups", user.userInfoGroups }
|
||||
|
||||
@ -66,7 +66,8 @@ namespace OnlineEditorsExample
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat",
|
||||
};
|
||||
|
||||
private static List<User> users = new List<User>() {
|
||||
|
||||
@ -394,6 +394,15 @@ namespace OnlineEditorsExample
|
||||
var body = jss.Deserialize<Dictionary<string, object>>(fileData);
|
||||
var newFileName = (string) body["newfilename"];
|
||||
var docKey = (string) body["dockey"];
|
||||
|
||||
var origExt = '.' + (string) body["ext"];
|
||||
var curExt = Path.GetExtension(newFileName).ToLower();
|
||||
|
||||
if (string.Compare(origExt, curExt, true) != 0)
|
||||
{
|
||||
newFileName += origExt;
|
||||
}
|
||||
|
||||
var meta = new Dictionary<string, object>() {
|
||||
{ "title", newFileName }
|
||||
};
|
||||
|
||||
4
web/documentserver-example/java-spring/pom.xml
Executable file → Normal file
4
web/documentserver-example/java-spring/pom.xml
Executable file → Normal file
@ -48,7 +48,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.inversoft</groupId>
|
||||
@ -64,7 +64,7 @@
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.12.2</version>
|
||||
<version>2.12.6.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.modelmapper</groupId>
|
||||
|
||||
@ -42,7 +42,8 @@ public class ExampleData {
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat"
|
||||
);
|
||||
List<String> description_user_1 = List.of( // the description for user 1
|
||||
"File author by default",
|
||||
@ -51,7 +52,8 @@ public class ExampleData {
|
||||
"He can do everything with the comments",
|
||||
"The file favorite state is undefined",
|
||||
"Can create a file from a template with data from the editor",
|
||||
"Can see the information about all users"
|
||||
"Can see the information about all users",
|
||||
"Can view chat"
|
||||
);
|
||||
List<String> description_user_2 = List.of( // the description for user 2
|
||||
"He belongs to Group2",
|
||||
@ -59,7 +61,8 @@ public class ExampleData {
|
||||
"He can view every comment, edit his comments and the comments left by the users who don't belong to any of the groups and remove only his comments",
|
||||
"This file is favorite",
|
||||
"Can create a file from an editor",
|
||||
"Can see the information about users from Group2 and users who don’t belong to any group"
|
||||
"Can see the information about users from Group2 and users who don’t belong to any group",
|
||||
"Can view chat"
|
||||
);
|
||||
List<String> description_user_3 = List.of( // the description for user 3
|
||||
"He belongs to Group3",
|
||||
@ -70,7 +73,8 @@ public class ExampleData {
|
||||
"He can’t download the file",
|
||||
"He can’t print the file",
|
||||
"Can create a file from an editor",
|
||||
"Can see the information about Group2 users"
|
||||
"Can see the information about Group2 users",
|
||||
"Can view chat"
|
||||
);
|
||||
userService.createUser("John Smith", "smith@example.com", // create user 1 with the specified parameters
|
||||
description_user_1, "", List.of(FilterState.NULL.toString()),
|
||||
@ -78,15 +82,18 @@ public class ExampleData {
|
||||
List.of(FilterState.NULL.toString()),
|
||||
List.of(FilterState.NULL.toString()),
|
||||
List.of(FilterState.NULL.toString()),
|
||||
null);
|
||||
null, true);
|
||||
userService.createUser("Mark Pottato", "pottato@example.com", // create user 2 with the specified parameters
|
||||
description_user_2, "group-2", List.of("","group-2"), List.of(FilterState.NULL.toString()),
|
||||
List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true);
|
||||
List.of("group-2", ""), List.of("group-2"), List.of("group-2", ""), true,
|
||||
true);
|
||||
userService.createUser("Hamish Mitchell", "mitchell@example.com", // create user 3 with the specified parameters
|
||||
description_user_3, "group-3", List.of("group-2"), List.of("group-2", "group-3"),
|
||||
List.of("group-2"), new ArrayList<>(), List.of("group-2"), false);
|
||||
List.of("group-2"), new ArrayList<>(), List.of("group-2"), false,
|
||||
true);
|
||||
userService.createUser("Anonymous",null, // create user 0 with the specified parameters
|
||||
description_user_0,"", List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()),
|
||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), new ArrayList<>(),null);
|
||||
List.of(FilterState.NULL.toString()), List.of(FilterState.NULL.toString()), new ArrayList<>(),null,
|
||||
false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -371,6 +371,16 @@ public class FileController {
|
||||
public String rename(@RequestBody JSONObject body) {
|
||||
String newfilename = (String) body.get("newfilename");
|
||||
String dockey = (String) body.get("dockey");
|
||||
String origExt = "." + (String) body.get("ext");
|
||||
String curExt = newfilename;
|
||||
|
||||
if(newfilename.indexOf(".") != -1) {
|
||||
curExt = (String) fileUtility.getFileExtension(newfilename);
|
||||
}
|
||||
|
||||
if(origExt.compareTo(curExt) != 0) {
|
||||
newfilename += origExt;
|
||||
}
|
||||
|
||||
HashMap<String, String> meta = new HashMap<>();
|
||||
meta.put("title", newfilename);
|
||||
|
||||
@ -25,6 +25,7 @@ public enum Action {
|
||||
embedded,
|
||||
filter,
|
||||
comment,
|
||||
chat,
|
||||
fillForms,
|
||||
blockcontent
|
||||
}
|
||||
|
||||
@ -43,6 +43,7 @@ public class Permission extends AbstractModel { // the permission for the docum
|
||||
private Boolean modifyFilter = true; // if the filter can applied globally (true) affecting all the other users, or locally (false)
|
||||
private Boolean modifyContentControl = true; // if the content control settings can be changed
|
||||
private Boolean review = true; // if the document can be reviewed or not
|
||||
private Boolean chat = true; // if a chat can be used
|
||||
@JsonInclude(value = JsonInclude.Include.CUSTOM, valueFilter = SerializerFilter.class)
|
||||
private List<String> reviewGroups; // the groups whose changes the user can accept/reject
|
||||
@Autowired
|
||||
|
||||
@ -38,6 +38,7 @@ public class Permission extends AbstractEntity {
|
||||
private Boolean modifyFilter = true;
|
||||
private Boolean modifyContentControl = true;
|
||||
private Boolean review = true;
|
||||
private Boolean chat = true;
|
||||
private Boolean templates=true;
|
||||
@ManyToMany
|
||||
private List<Group> reviewGroups;
|
||||
|
||||
@ -37,7 +37,8 @@ public class PermissionServices {
|
||||
List<Group> commentViewGroups,
|
||||
List<Group> commentEditGroups,
|
||||
List<Group> commentRemoveGroups,
|
||||
List<Group> userInfoGroups){
|
||||
List<Group> userInfoGroups,
|
||||
Boolean chat){
|
||||
|
||||
Permission permission = new Permission();
|
||||
permission.setReviewGroups(reviewGroups); // define the groups whose changes the user can accept/reject
|
||||
@ -45,6 +46,7 @@ public class PermissionServices {
|
||||
permission.setCommentsEditGroups(commentEditGroups); // defines the groups whose comments the user can edit
|
||||
permission.setCommentsRemoveGroups(commentRemoveGroups); // defines the groups whose comments the user can remove
|
||||
permission.setUserInfoGroups(userInfoGroups);
|
||||
permission.setChat(chat);
|
||||
|
||||
permissionRepository.save(permission); // save new permissions
|
||||
|
||||
|
||||
@ -56,7 +56,9 @@ public class UserServices {
|
||||
List<String> reviewGroups,
|
||||
List<String> viewGroups,
|
||||
List<String> editGroups,
|
||||
List<String> removeGroups, List<String> userInfoGroups, Boolean favoriteDoc){
|
||||
List<String> removeGroups,
|
||||
List<String> userInfoGroups, Boolean favoriteDoc,
|
||||
Boolean chat){
|
||||
User newUser = new User();
|
||||
newUser.setName(name); // set the user name
|
||||
newUser.setEmail(email); // set the user email
|
||||
@ -71,7 +73,7 @@ public class UserServices {
|
||||
List<Group> usInfoGroups = groupServices.createGroups(userInfoGroups);
|
||||
|
||||
Permission permission = permissionService
|
||||
.createPermission(groupsReview, commentGroupsView, commentGroupsEdit, commentGroupsRemove, usInfoGroups); // specify permissions for the current user
|
||||
.createPermission(groupsReview, commentGroupsView, commentGroupsEdit, commentGroupsRemove, usInfoGroups, chat); // specify permissions for the current user
|
||||
newUser.setPermissions(permission);
|
||||
|
||||
userRepository.save(newUser); // save a new user
|
||||
|
||||
@ -149,6 +149,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "rename");
|
||||
|
||||
@ -29,7 +29,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.5</version>
|
||||
<version>2.8.9</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.inversoft</groupId>
|
||||
|
||||
@ -573,6 +573,17 @@ public class IndexServlet extends HttpServlet
|
||||
String newfilename = (String) body.get("newfilename");
|
||||
String dockey = (String) body.get("dockey");
|
||||
|
||||
String origExt = "." + (String) body.get("ext");
|
||||
String curExt = newfilename;
|
||||
|
||||
if(newfilename.indexOf(".") != -1) {
|
||||
curExt = (String) FileUtility.GetFileExtension(newfilename);
|
||||
}
|
||||
|
||||
if(origExt.compareTo(curExt) != 0) {
|
||||
newfilename += origExt;
|
||||
}
|
||||
|
||||
HashMap<String, String> meta = new HashMap<>();
|
||||
meta.put("title", newfilename);
|
||||
|
||||
|
||||
@ -265,6 +265,7 @@ public class FileModel
|
||||
public Boolean modifyFilter;
|
||||
public Boolean modifyContentControl;
|
||||
public Boolean review;
|
||||
public Boolean chat;
|
||||
public List<String> reviewGroups;
|
||||
public CommentGroups commentGroups;
|
||||
public List<String> userInfoGroups;
|
||||
@ -281,6 +282,7 @@ public class FileModel
|
||||
modifyFilter = !mode.equals("filter");
|
||||
modifyContentControl = !mode.equals("blockcontent");
|
||||
review = canEdit && (mode.equals("edit") || mode.equals("review"));
|
||||
chat = !user.id.equals("uid-0");
|
||||
reviewGroups = user.reviewGroups;
|
||||
commentGroups = user.commentGroups;
|
||||
userInfoGroups = user.userInfoGroups;
|
||||
|
||||
@ -65,6 +65,7 @@ public class Users {
|
||||
add("Can't create new files from the editor");
|
||||
add("Can’t see anyone’s information");
|
||||
add("Can't rename files from the editor");
|
||||
add("Can't view chat");
|
||||
}};
|
||||
|
||||
private static List<User> users = new ArrayList<User>() {{
|
||||
|
||||
@ -150,6 +150,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "IndexServlet?type=rename");
|
||||
|
||||
@ -1,28 +0,0 @@
|
||||
FROM node:buster
|
||||
LABEL maintainer Ascensio System SIA <support@onlyoffice.com>
|
||||
|
||||
ENV LANG=en_US.UTF-8 \
|
||||
LANGUAGE=en_US:en \
|
||||
LC_ALL=en_US.UTF-8 \
|
||||
NODE_ENV=production-linux \
|
||||
NODE_CONFIG_DIR=/etc/onlyoffice/documentserver-example/
|
||||
|
||||
WORKDIR /var/www/onlyoffice/documentserver-example/
|
||||
COPY . /var/www/onlyoffice/documentserver-example/
|
||||
|
||||
RUN groupadd --system --gid 1001 ds && \
|
||||
useradd --system -g ds --no-create-home --shell /sbin/nologin --uid 1001 ds && \
|
||||
chown -R ds:ds /var/www/onlyoffice/documentserver-example/ && \
|
||||
mkdir -p /var/lib/onlyoffice/documentserver-example/ && \
|
||||
chown -R ds:ds /var/lib/onlyoffice/ && \
|
||||
mv files /var/lib/onlyoffice/documentserver-example/ && \
|
||||
mkdir -p /etc/onlyoffice/documentserver-example/ && \
|
||||
chown -R ds:ds /etc/onlyoffice/ && \
|
||||
mv config/* /etc/onlyoffice/documentserver-example/ && \
|
||||
npm install
|
||||
|
||||
EXPOSE 3000
|
||||
|
||||
USER ds
|
||||
|
||||
ENTRYPOINT /var/www/onlyoffice/documentserver-example/docker-entrypoint.sh npm start
|
||||
@ -128,9 +128,8 @@ app.get("/download", function(req, res) { // define a handler for downloading f
|
||||
|
||||
var fileName = fileUtility.getFileName(req.query.fileName);
|
||||
var userAddress = req.query.useraddress;
|
||||
var isEmbedded = req.query.dmode;
|
||||
|
||||
if ((cfgSignatureEnable && cfgSignatureUseForRequest) && isEmbedded == null ) {
|
||||
if ((cfgSignatureEnable && cfgSignatureUseForRequest)) {
|
||||
var authorization = req.get(cfgSignatureAuthorizationHeader);
|
||||
if (authorization && authorization.startsWith(cfgSignatureAuthorizationHeaderPrefix)) {
|
||||
var token = authorization.substring(cfgSignatureAuthorizationHeaderPrefix.length);
|
||||
@ -325,7 +324,7 @@ app.post("/convert", function (req, res) { // define a handler for converting f
|
||||
var fileName = fileUtility.getFileName(req.body.filename);
|
||||
var filePass = req.body.filePass ? req.body.filePass : null;
|
||||
var lang = req.body.lang ? req.body.lang : null;
|
||||
var fileUri = req.docManager.getFileUri(fileName);
|
||||
var fileUri = req.docManager.getDownloadUrl(fileName, true);
|
||||
var fileExt = fileUtility.getFileExtension(fileName);
|
||||
var fileType = fileUtility.getFileType(fileName);
|
||||
var internalFileExt = req.docManager.getInternalExtension(fileType);
|
||||
@ -807,8 +806,8 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
};
|
||||
}
|
||||
var key = req.docManager.getKey(fileName);
|
||||
var url = req.docManager.getDownloadUrl(fileName);
|
||||
var urlUser = path.isAbsolute(storageFolder) ? req.docManager.getDownloadUrl(fileName) + "&dmode=emb" : req.docManager.getlocalFileUri(fileName, 0, false);
|
||||
var url = req.docManager.getDownloadUrl(fileName, true);
|
||||
var urlUser = req.docManager.getDownloadUrl(fileName);
|
||||
var mode = req.query.mode || "edit"; // mode: view/edit/review/comment/fillForms/embedded
|
||||
|
||||
var type = req.query.type || ""; // type: embedded/mobile/desktop
|
||||
@ -852,7 +851,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
fileType: fileExt.slice(1),
|
||||
version: i,
|
||||
key: keyVersion,
|
||||
url: i == countVersion ? url : (`${req.docManager.getServerUrl(false)}/history?fileName=${encodeURIComponent(fileName)}&file=prev${fileExt}&ver=${i}&useraddress=${userAddress}`),
|
||||
url: i == countVersion ? url : (`${req.docManager.getServerUrl(true)}/history?fileName=${encodeURIComponent(fileName)}&file=prev${fileExt}&ver=${i}&useraddress=${userAddress}`),
|
||||
};
|
||||
|
||||
if (i > 1 && req.docManager.existsSync(req.docManager.diffPath(fileName, userAddress, i-1))) { // check if the path to the file with document versions differences exists
|
||||
@ -861,7 +860,7 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
key: historyData[i-2].key,
|
||||
url: historyData[i-2].url,
|
||||
};
|
||||
let changesUrl = `${req.docManager.getServerUrl(false)}/history?fileName=${encodeURIComponent(fileName)}&file=diff.zip&ver=${i-1}&useraddress=${userAddress}`;
|
||||
let changesUrl = `${req.docManager.getServerUrl(true)}/history?fileName=${encodeURIComponent(fileName)}&file=diff.zip&ver=${i-1}&useraddress=${userAddress}`;
|
||||
historyD.changesUrl = changesUrl; // get the path to the diff.zip file and write it to the history object
|
||||
}
|
||||
|
||||
@ -978,6 +977,12 @@ app.get("/editor", function (req, res) { // define a handler for editing docume
|
||||
app.post("/rename", function (req, res) { //define a handler for renaming file
|
||||
|
||||
var newfilename = req.body.newfilename;
|
||||
var origExt = req.body.ext;
|
||||
var curExt = fileUtility.getFileExtension(newfilename, true);
|
||||
if (curExt !== origExt) {
|
||||
newfilename += '.' + origExt;
|
||||
}
|
||||
|
||||
var dockey = req.body.dockey;
|
||||
var meta = {title: newfilename};
|
||||
|
||||
|
||||
@ -163,22 +163,6 @@ docManager.prototype.getFileData = function (fileName, userAddress) {
|
||||
return ((fileSystem.readFileSync(history)).toString()).split(",");
|
||||
};
|
||||
|
||||
// get url to the original file
|
||||
docManager.prototype.getFileUri = function (fileName) {
|
||||
return this.getlocalFileUri(fileName, 0, true);
|
||||
};
|
||||
|
||||
// get local file url
|
||||
docManager.prototype.getlocalFileUri = function (fileName, version, forDocumentServer) {
|
||||
const serverPath = this.getServerUrl(forDocumentServer);
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
let url = serverPath + configServer.get("storagePath") + "/" + hostAddress + "/" + encodeURIComponent(fileName); // get full url address to the file
|
||||
if (!version) {
|
||||
return url;
|
||||
}
|
||||
return url + "-history/" + version; // return history path to the specified file version
|
||||
};
|
||||
|
||||
// get server url
|
||||
docManager.prototype.getServerUrl = function (forDocumentServer) {
|
||||
return (forDocumentServer && !!configServer.get("exampleUrl")) ? configServer.get("exampleUrl") : this.getServerPath();
|
||||
@ -218,10 +202,13 @@ docManager.prototype.getCreateUrl = function (docType, userid, type, lang) {
|
||||
}
|
||||
|
||||
// get url to download a file
|
||||
docManager.prototype.getDownloadUrl = function (fileName) {
|
||||
const server = this.getServerUrl(true);
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
const handler = "/download?fileName=" + encodeURIComponent(fileName) + "&useraddress=" + encodeURIComponent(hostAddress);
|
||||
docManager.prototype.getDownloadUrl = function (fileName, forDocumentServer) {
|
||||
const server = this.getServerUrl(forDocumentServer);
|
||||
var handler = "/download?fileName=" + encodeURIComponent(fileName);
|
||||
if (forDocumentServer) {
|
||||
const hostAddress = this.curUserHostAddress();
|
||||
handler += "&useraddress=" + encodeURIComponent(hostAddress);
|
||||
}
|
||||
|
||||
return server + handler;
|
||||
};
|
||||
@ -387,7 +374,7 @@ docManager.prototype.getTemplateImageUrl = function (fileType) {
|
||||
// get document key
|
||||
docManager.prototype.getKey = function (fileName, userAddress) {
|
||||
userAddress = userAddress || this.curUserHostAddress();
|
||||
let key = userAddress + this.getlocalFileUri(fileName); // get document key by adding local file url to the current user host address
|
||||
let key = userAddress + fileName; // get document key by adding local file url to the current user host address
|
||||
|
||||
let historyPath = this.historyPath(fileName, userAddress); // get the path to the file history
|
||||
if (historyPath != ""){ // if the path to the file history exists
|
||||
|
||||
2130
web/documentserver-example/nodejs/npm-shrinkwrap.json
generated
2130
web/documentserver-example/nodejs/npm-shrinkwrap.json
generated
File diff suppressed because it is too large
Load Diff
@ -175,6 +175,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "rename");
|
||||
|
||||
@ -106,6 +106,7 @@
|
||||
"modifyFilter" => $editorsMode != "filter",
|
||||
"modifyContentControl" => $editorsMode != "blockcontent",
|
||||
"review" => $canEdit && ($editorsMode == "edit" || $editorsMode == "review"),
|
||||
"chat" => $user->id != "uid-0",
|
||||
"reviewGroups" => $user->reviewGroups,
|
||||
"commentGroups" => $user->commentGroups,
|
||||
"userInfoGroups" => $user->userInfoGroups
|
||||
@ -474,6 +475,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
|
||||
let xhr = new XMLHttpRequest();
|
||||
|
||||
@ -74,7 +74,8 @@ $descr_user_0 = [
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat",
|
||||
];
|
||||
|
||||
$users = [
|
||||
|
||||
@ -259,7 +259,7 @@ function convert() {
|
||||
$internalExtension = trim(getInternalExtension($fileName),'.');
|
||||
|
||||
// check if the file with such an extension can be converted
|
||||
if (in_array("." + $extension, $GLOBALS['DOC_SERV_CONVERT']) && $internalExtension != "") {
|
||||
if (in_array("." . $extension, $GLOBALS['DOC_SERV_CONVERT']) && $internalExtension != "") {
|
||||
|
||||
$fileUri = $post["fileUri"];
|
||||
if ($fileUri == NULL || $fileUri == "") {
|
||||
@ -469,6 +469,13 @@ function delTree($dir) {
|
||||
function renamefile() {
|
||||
$post = json_decode(file_get_contents('php://input'), true);
|
||||
$newfilename = $post["newfilename"];
|
||||
|
||||
$curExt = strtolower(array_pop(explode('.', $newfilename)));
|
||||
$origExt = $post["ext"];
|
||||
if($origExt !== $curExt){
|
||||
$newfilename .= '.' . $origExt;
|
||||
}
|
||||
|
||||
$dockey = $post["dockey"];
|
||||
$meta = ["title" => $newfilename];
|
||||
|
||||
|
||||
@ -80,7 +80,8 @@ descr_user_0 = [
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat",
|
||||
]
|
||||
|
||||
USERS = [
|
||||
|
||||
@ -153,6 +153,12 @@ def rename(request):
|
||||
|
||||
body = json.loads(request.body)
|
||||
newfilename = body['newfilename']
|
||||
|
||||
origExt = '.' + body['ext']
|
||||
curExt = fileUtils.getFileExt(newfilename)
|
||||
if (origExt != curExt):
|
||||
newfilename += origExt
|
||||
|
||||
dockey = body['dockey']
|
||||
meta = {'title': newfilename}
|
||||
|
||||
@ -240,6 +246,7 @@ def edit(request):
|
||||
'modifyFilter': edMode != 'filter',
|
||||
'modifyContentControl': edMode != "blockcontent",
|
||||
'review': canEdit & ((edMode == 'edit') | (edMode == 'review')),
|
||||
'chat': user.id !='uid-0',
|
||||
'reviewGroups': user.reviewGroups,
|
||||
'commentGroups': user.commentGroups,
|
||||
'userInfoGroups': user.userInfoGroups
|
||||
|
||||
@ -165,6 +165,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "rename");
|
||||
|
||||
@ -83,6 +83,7 @@ GEM
|
||||
debug_inspector (1.1.0)
|
||||
erubi (1.10.0)
|
||||
execjs (2.8.1)
|
||||
ffi (1.15.5)
|
||||
ffi (1.15.5-x64-mingw32)
|
||||
globalid (1.0.0)
|
||||
activesupport (>= 5.0)
|
||||
@ -94,7 +95,7 @@ GEM
|
||||
rails-dom-testing (>= 1, < 3)
|
||||
railties (>= 4.2.0)
|
||||
thor (>= 0.14, < 2.0)
|
||||
json (2.3.0)
|
||||
json (1.8.6)
|
||||
loofah (2.13.0)
|
||||
crass (~> 1.0.2)
|
||||
nokogiri (>= 1.5.9)
|
||||
@ -107,15 +108,10 @@ GEM
|
||||
mini_mime (1.1.2)
|
||||
minitest (5.15.0)
|
||||
nio4r (2.5.8)
|
||||
nokogiri (1.13.3)
|
||||
mini_portile2 (~> 2.8.0)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.3-x64-mingw32)
|
||||
racc (~> 1.4)
|
||||
nokogiri (1.13.3-x86_64-linux)
|
||||
nokogiri (1.13.6-x86_64-linux)
|
||||
racc (~> 1.4)
|
||||
racc (1.6.0)
|
||||
rack (2.2.3)
|
||||
rack (2.2.3.1)
|
||||
rack-cors (1.1.1)
|
||||
rack (>= 2.0.0)
|
||||
rack-test (1.1.0)
|
||||
@ -147,9 +143,11 @@ GEM
|
||||
rake (>= 0.13)
|
||||
thor (~> 1.0)
|
||||
rake (13.0.6)
|
||||
rdoc (6.3.1)
|
||||
rdoc (4.3.0)
|
||||
sass-rails (6.0.0)
|
||||
sassc-rails (~> 2.1, >= 2.1.1)
|
||||
sassc (2.4.0)
|
||||
ffi (~> 1.9)
|
||||
sassc (2.4.0-x64-mingw32)
|
||||
ffi (~> 1.9)
|
||||
sassc-rails (2.1.2)
|
||||
@ -196,6 +194,7 @@ GEM
|
||||
|
||||
PLATFORMS
|
||||
x64-mingw32
|
||||
x86_64-linux
|
||||
|
||||
DEPENDENCIES
|
||||
byebug
|
||||
|
||||
@ -351,6 +351,13 @@ class HomeController < ApplicationController
|
||||
body = JSON.parse(request.body.read)
|
||||
dockey = body["dockey"]
|
||||
newfilename = body["newfilename"]
|
||||
|
||||
orig_ext = '.' + body["ext"]
|
||||
cur_ext = File.extname(newfilename).downcase
|
||||
if orig_ext != cur_ext
|
||||
newfilename += orig_ext
|
||||
end
|
||||
|
||||
meta = {
|
||||
:title => newfilename
|
||||
}
|
||||
|
||||
@ -127,6 +127,7 @@ class FileModel
|
||||
:modifyFilter => !editorsmode.eql?("filter"),
|
||||
:modifyContentControl => !editorsmode.eql?("blockcontent"),
|
||||
:review => canEdit && (editorsmode.eql?("edit") || editorsmode.eql?("review")),
|
||||
:chat => !@user.id.eql?("uid-0"),
|
||||
:reviewGroups => @user.reviewGroups,
|
||||
:commentGroups => @user.commentGroups,
|
||||
:userInfoGroups => @user.userInfoGroups
|
||||
|
||||
@ -73,7 +73,8 @@ class Users
|
||||
"Can't mention others in comments",
|
||||
"Can't create new files from the editor",
|
||||
"Can’t see anyone’s information",
|
||||
"Can't rename files from the editor"
|
||||
"Can't rename files from the editor",
|
||||
"Can't view chat"
|
||||
];
|
||||
|
||||
@@users = [
|
||||
|
||||
@ -140,6 +140,7 @@
|
||||
var data = {
|
||||
newfilename: newfilename,
|
||||
dockey: config.document.key,
|
||||
ext: config.document.fileType
|
||||
};
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", "rename");
|
||||
|
||||
@ -63,7 +63,7 @@ module OnlineEditorsExampleRuby
|
||||
'nl' => 'Dutch',
|
||||
'fi' => 'Finnish',
|
||||
'fr' => 'French',
|
||||
'gl' => 'Galego'
|
||||
'gl' => 'Galego',
|
||||
'de' => 'German',
|
||||
'el' => 'Greek',
|
||||
'hu' => 'Hungarian',
|
||||
|
||||
Reference in New Issue
Block a user