0

当用户在文档详细信息窗口中打开文档时,我计划从客户端生成直接下载链接。为此,我想访问已打开文档的 noderef。有人可以提一下如何从露天共享客户端(javascript)访问打开文档的noderef。

4

1 回答 1

1

对你有好处,我过去曾为客户做过这件事。

您需要更改以下文件(创建一个模块或只是覆盖它们)

  • document-links.get.properties(添加新标签以供下载)
  • document-links.get.head.ftl(包括新的覆盖客户端 JavaScript)
  • document-links.get.html.ftl(添加一个新字段,如当前页面 url)

        <h3 class="thin dark">${msg("page.download")}</h3>
        <div class="link-info">
           <input id="${el}-download" value="${document.node.contentURL}"/>
           <a href="#" name=".onCopyLinkClick" class="${el} hidden">${msg("page.copy")}</a>
        </div>
    
  • document-links.js(客户端 JavaScript)

onReady: function DocumentLinks_onReady() { // 显示复制链接 if (this.hasClipboard) { Dom.removeClass(Selector.query("a.hidden", this.id), "hidden"); }

 // Make sure text fields auto select the text on focus
 Event.addListener(Selector.query("input", this.id), "focus", this._handleFocus);

 // Prefix some of the urls with values from the client
 Dom.get(this.id + "-page").value = document.location.href;

 // added Download link
 var contentURL = Dom.get(this.id + "-download").value;
 Dom.get(this.id + "-download").value = window.location.protocol + "//" + window.location.host + "/alfresco/d/a" +

contentURL.replace('api/node/content/', ''); }

于 2013-06-20T08:32:24.677 回答