mirror of
https://github.com/ONLYOFFICE/document-server-integration.git
synced 2026-04-07 14:06:11 +08:00
java-spring: option to send directUrl
This commit is contained in:
committed by
Sergey Linnik
parent
0a390094e5
commit
e40b6b2e28
@ -79,6 +79,7 @@ public class EditorController {
|
||||
@RequestParam(value = "action", required = false) String actionParam,
|
||||
@RequestParam(value = "type", required = false) String typeParam,
|
||||
@RequestParam(value = "actionLink", required = false) String actionLink,
|
||||
@RequestParam(value = "directUrl", required = false) Boolean directUrl,
|
||||
@CookieValue(value = "uid") String uid,
|
||||
@CookieValue(value = "ulang") String lang,
|
||||
Model model) throws JsonProcessingException {
|
||||
@ -115,6 +116,7 @@ public class EditorController {
|
||||
.action(action)
|
||||
.user(user)
|
||||
.actionData(actionLink)
|
||||
.isEnableDirectUrl(directUrl)
|
||||
.build()
|
||||
);
|
||||
|
||||
|
||||
@ -68,7 +68,8 @@ public class IndexController {
|
||||
private String langs;
|
||||
|
||||
@GetMapping("${url.index}")
|
||||
public String index(Model model){
|
||||
public String index(@RequestParam(value = "directUrl", required = false) Boolean directUrl,
|
||||
Model model){
|
||||
java.io.File[] files = storageMutator.getStoredFiles(); // get all the stored files from the storage
|
||||
List<String> docTypes = new ArrayList<>();
|
||||
List<Boolean> filesEditable = new ArrayList<>();
|
||||
@ -107,6 +108,7 @@ public class IndexController {
|
||||
model.addAttribute("tooltip", tooltip);
|
||||
model.addAttribute("users", users);
|
||||
model.addAttribute("languages", languages);
|
||||
model.addAttribute("directUrl", directUrl);
|
||||
|
||||
return "index.html";
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ public class DefaultDocumentConfigurer implements DocumentConfigurer<DefaultDocu
|
||||
document.setTitle(fileName); // set the title to the document config
|
||||
document.setUrl(documentManager.getDownloadUrl(fileName, true)); // set the URL to download a file to the document config
|
||||
document.setUrlUser(documentManager.getFileUri(fileName, false)); // set the file URL to the document config
|
||||
document.setDirectUrl(documentManager.getDownloadUrl(fileName, false));
|
||||
document.setDirectUrl(wrapper.getIsEnableDirectUrl() ? documentManager.getDownloadUrl(fileName, false) : "");
|
||||
document.setFileType(fileUtility.getFileExtension(fileName).replace(".","")); // set the file type to the document config
|
||||
document.getInfo().setFavorite(wrapper.getFavorite()); // set the favorite parameter to the document config
|
||||
|
||||
|
||||
@ -80,6 +80,7 @@ public class DefaultFileConfigurer implements FileConfigurer<DefaultFileWrapper>
|
||||
.fileName(fileName)
|
||||
.permission(updatePermissions(userPermissions, action, canEdit))
|
||||
.favorite(wrapper.getUser().getFavorite())
|
||||
.isEnableDirectUrl(wrapper.getIsEnableDirectUrl())
|
||||
.build();
|
||||
|
||||
defaultDocumentConfigurer.configure(fileModel.getDocument(), documentWrapper); // define the document configurer
|
||||
|
||||
@ -28,4 +28,5 @@ public class DefaultDocumentWrapper {
|
||||
private Permission permission;
|
||||
private String fileName;
|
||||
private Boolean favorite;
|
||||
private Boolean isEnableDirectUrl;
|
||||
}
|
||||
|
||||
@ -36,4 +36,5 @@ public class DefaultFileWrapper {
|
||||
private Action action;
|
||||
private String actionData;
|
||||
private Boolean canEdit;
|
||||
private Boolean isEnableDirectUrl;
|
||||
}
|
||||
|
||||
@ -137,7 +137,7 @@
|
||||
<tr th:each="file,iState : ${files}" class="tableRow" th:title="${files[iState.index].getName() + versions[iState.index]}">
|
||||
<td class="contentCells">
|
||||
<a class="stored-edit" th:classappend="${docTypes[iState.index]}"
|
||||
th:href="@{/editor(fileName=${files[iState.index].getName()})}" target="_blank">
|
||||
th:href="@{/editor(fileName=${files[iState.index].getName()}, directUrl=${directUrl})}" target="_blank">
|
||||
<span th:text="${files[iState.index].getName()}"></span>
|
||||
</a>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user