openkm5.x
=========solution==add new parameter "docUuid"============================
1. change the url content
com.openkm.frontend.client.widget.properties.Document.java
goto line 298
Code: Select allurl += "?docPath=" + URL.encodeComponent(document.getPath());
change to
Code: Select all// url += "?docPath=" + URL.encodeComponent(document.getPath());
url += "?docUuid=" + URL.encodeComponent(document.getUuid());
2.com.openkm.frontend.client.Main.java
add new code
Code: Select all private final OKMRepositoryServiceAsync repositoryService = (OKMRepositoryServiceAsync) GWT
.create(OKMRepositoryService.class);
public String docUuid = ""; //added by wangmj 为了实现拷贝url就能浏览文档
Code: Select all /**
* 通过uuid获取到文档的节点的全路径
*/
final AsyncCallback<String> callbackGetNodePath = new AsyncCallback<String>() {
public void onSuccess(String result) {
if (result!= null && !result.trim().equals("")){
Main.get().docPath = result;
Main.get().fldPath = Main.get().docPath.substring(0, Main.get().docPath.lastIndexOf("/"));
}else{
Main.get().docPath = null;
Main.get().fldPath = null;
}
}
public void onFailure(Throwable caught) {
// On error must reset variables too
Main.get().docPath = null;
Main.get().fldPath = null;
Main.get().showError("isValid", caught);
}
};
in method onModuleLoad()
Code: Select all //added by wangmj 获取到文档的uuid
if (loc.getParameter("docUuid")!=null && !loc.getParameter("docUuid").equals("")) {
docUuid = loc.getParameter("docUuid");
}
if (Main.get().docUuid != null && !Main.get().docUuid.equals("")){
//首先获取到节点的全路径,然后调用下面的方法
ServiceDefTarget endPoint = (ServiceDefTarget) repositoryService;
endPoint.setServiceEntryPoint(Config.OKMRepositoryService);
repositoryService.getPathByUUID(Main.get().docUuid, callbackGetNodePath);
}