cancel
Showing results for 
Search instead for 
Did you mean: 

display path of node from noderef

ayubalfresco
Champ in-the-making
Champ in-the-making
I want to show the display path of noderef in share control ftl which I have developed.

Currently its showing as workspace/SpacesStore/8ab12916-4897-47fb-94eb-1ab699822ecb. how can I get the path similar to site/doclibrary/MyFolder ? is there an api to call using noderefstring to get the path in javascript which is part of share custom ftl?

below is my costum script which is part of ftl.


<script type="text/javascript">//<![CDATA[
(function() {

    YAHOO.util.Event.onContentReady("${controlId}-targetPath", function() {
    var params = Alfresco.util.getQueryStringParameters();
    var nodeRef = params.nodeRef;
   
    if(nodeRef!=null){
     var node=Alfresco.util.NodeRef(nodeRef);
     document.getElementById('${controlId}-path').value=node.uri;
     document.getElementById('${controlId}-targetPath').value=nodeRef;
    
    }
});

})();
//]]></script>
1 REPLY 1

ayubalfresco
Champ in-the-making
Champ in-the-making
I used the script from share.js as shown below:



displayByNodeRef: function Location_displayByNodeRef(nodeRef)
      {
         // Find the path for the nodeRef
         if (YAHOO.lang.isString(nodeRef))
         {
            nodeRef = Alfresco.util.NodeRef(nodeRef);
         }
         if (nodeRef)
         {
            var url = Alfresco.constants.PROXY_URI + "slingshot/doclib/node/" + nodeRef.uri + "/location";
            if (this.options.siteId === "" && this.options.rootNode)
            {
               // Repository mode
               url += "?libraryRoot=" + encodeURIComponent(this.options.rootNode.toString());
            }
            Alfresco.util.Ajax.jsonGet(
            {
               url: url,
               successCallback:
               {
                  fn: function(response)
                  {
                     if (response.json !== undefined)
                     {
                        var locations = response.json;
                        this._locations = locations;
                        if (locations.site)
                        {
                           this.displayByPath($combine(locations.site.path, locations.site.file), locations.site.site, locations.site.siteTitle);
                        }
                        else
                        {
                           this.displayByPath($combine(locations.repo.path, locations.repo.file));
                        }

                        YAHOO.Bubbling.fire("itemLocationLoaded",
                        {
                           eventGroup: this,
                           locations: locations
                        });

                     }
                  },
                  scope: this
               },
               failureCallback:
               {
                  fn: function(response)
                  {
                     if (this.widgets.spanEl)
                     {
                        this.widgets.spanEl.innerHTML = '<span class="location error">' + this.msg("message.failure") + '</span>';
                     }
                  },
                  scope: this
               }
            });
         }
         else
         {
            this.widgets.spanEl.innerHTML = '<span class="location-none">' + this.msg("location.label.none") + '</span>';
         }
      }