mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
Merge pull request #105 from ONLYOFFICE/feature/favorite
Feature/favorite
This commit is contained in:
@ -57,6 +57,8 @@ public class FileModel
|
||||
document.url = DocumentManager.GetFileUri(fileName);
|
||||
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);
|
||||
@ -193,6 +195,7 @@ public class FileModel
|
||||
public String url;
|
||||
public String fileType;
|
||||
public String key;
|
||||
public Info info;
|
||||
public Permissions permissions;
|
||||
}
|
||||
|
||||
@ -218,6 +221,11 @@ public class FileModel
|
||||
}
|
||||
}
|
||||
|
||||
public class Info
|
||||
{
|
||||
Boolean favorite;
|
||||
}
|
||||
|
||||
public class EditorConfig
|
||||
{
|
||||
public HashMap<String, Object> actionLink = null;
|
||||
|
||||
@ -86,6 +86,13 @@
|
||||
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 config = JSON.parse('<%= FileModel.Serialize(Model) %>');
|
||||
config.width = "100%";
|
||||
config.height = "100%";
|
||||
@ -96,6 +103,7 @@
|
||||
"onError": onError,
|
||||
"onOutdatedVersion": onOutdatedVersion,
|
||||
"onMakeActionLink": onMakeActionLink,
|
||||
"onMetaChange": onMetaChange,
|
||||
};
|
||||
|
||||
<%
|
||||
|
||||
Reference in New Issue
Block a user