Howto make a dashlet listing all folders of a site?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-13-2010 08:40 AM
Hi,
I want to make a dashlet, that list all folders from the 'documentLibrary'.
I tried this analog to the 'documentsummary' dashlet, but I dont seem to be able to find out, how to get all folders instead of documents.
'documentsummary.get.js':
now what I tried is the following:
which only returns the nodeRef of the container 'documentLibrary'
I do have the following situation/folder structure:
documentLibrary
- folder1
- some subfolders
- folder2
- folder3
…
What I want to have in my dashlet is a nice list of those folders (folder1, folder2, folder3,… without subfolders) with description etc.
Thanks for your help.
max12
I want to make a dashlet, that list all folders from the 'documentLibrary'.
I tried this analog to the 'documentsummary' dashlet, but I dont seem to be able to find out, how to get all folders instead of documents.
'documentsummary.get.js':
// Get the Documents Modified data for this sitevar url = args.dod5015 ? "/slingshot/doclib/dod5015/doclist/documents/site/" : "/slingshot/doclib/doclist/documents/site/";var json = remote.call(url + page.url.templateArgs.site + "/documentLibrary?filter=recentlyModified&max=10");// Create the modelvar docs = eval('(' + json + ')');model.docs = docs;
now what I tried is the following:
// Get the Foldersvar site, container, theUrl, connector, result, lists; site = page.url.templateArgs.site; container = 'documentLibrary'; theUrl = '/slingshot/doclib/container/' + site + '/' + container; connector = remote.connect("alfresco"); result = connector.get(theUrl); var response = null; if (result.status == 200) { response = eval('(' + result.response + ')'); }model.docs = response;
which only returns the nodeRef of the container 'documentLibrary'
I do have the following situation/folder structure:
documentLibrary
- folder1
- some subfolders
- folder2
- folder3
…
What I want to have in my dashlet is a nice list of those folders (folder1, folder2, folder3,… without subfolders) with description etc.
Thanks for your help.
max12
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2010 07:15 PM
There may already be a webscript that does what you want. I don't know and don't have the service listing in front of me.
What I do know is that there's a method in the java API on the NodeService to list all folders within a space, both deep and shallow. So it would be fairly easy to add a new script if one does not already exist.
What I do know is that there's a method in the java API on the NodeService to list all folders within a space, both deep and shallow. So it would be fairly easy to add a new script if one does not already exist.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-22-2010 09:53 AM
Thanks for your umm helpful reply Mark…
Anyway, yes there are webscripts that can do this, the simplist choice is probably the one used by the TreeView component in the doclib:
/slingshot/doclib/treenode/site/YOUR-SITE-NAME-HERE/documentLibrary?children=false&max=-1
This returns a simple json structure of all the top-level folders in a site.
Something like this:
You can also use the doclist webscript to retrieve folder items:
/slingshot/doclib/doclist/folders/site/YOUR-SITE-NAME-HERE/documentLibrary
It returns a more complex json structure with more detail in it - which you might not need.
Thanks,
Kev
Anyway, yes there are webscripts that can do this, the simplist choice is probably the one used by the TreeView component in the doclib:
/slingshot/doclib/treenode/site/YOUR-SITE-NAME-HERE/documentLibrary?children=false&max=-1
This returns a simple json structure of all the top-level folders in a site.
Something like this:
{ "totalResults": 4, "resultsTrimmed": false, "parent": { "nodeRef": "workspace://SpacesStore/7512f001-fd8e-4b67-9fa6-31c2b8a8b58e", "userAccess": { "create": true, "edit": true, "delete": true } }, "items": [ { "nodeRef": "workspace://SpacesStore/25b959be-4aba-450d-9b79-22f10d0177f3", "name": "test folder", "description": "some description here", "hasChildren": false, "userAccess": { "create": true, "edit": true, "delete": true } }, …
You can also use the doclist webscript to retrieve folder items:
/slingshot/doclib/doclist/folders/site/YOUR-SITE-NAME-HERE/documentLibrary
It returns a more complex json structure with more detail in it - which you might not need.
Thanks,
Kev
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2010 08:55 AM
Thanks for your replies.
I solved this as follows (in the .get.js of the dashlet):
and then using a list in the .get.html.ftl to display the folders.
I solved this as follows (in the .get.js of the dashlet):
var url = args.dod5015 ? "/slingshot/doclib/dod5015/doclist/folders/site/" : "/slingshot/doclib/doclist/folders/site/";var json = remote.call(url + page.url.templateArgs.site + "/documentLibrary/myfolder");
and then using a list in the .get.html.ftl to display the folders.
