如何在Alfresco Share中获取已打开文档的NodeRef

时间:2013-06-20 05:34:04

标签: yui alfresco alfresco-share

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

1 个答案:

答案 0 :(得分:1)

对你而言,我已经为客户做过这件事了。

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

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

        <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 /',''); }

相关问题