display path of node from noderef
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2014 10:41 AM
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.
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>
Labels:
- Labels:
-
Archive
1 REPLY 1
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-14-2014 05:06 AM
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>'; } }
