mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
New template format and Freemarker macros. Improved YUILoader wrapper. Placeholder doclist using YUI DataTable for testing.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@8883 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
<webscript>
|
||||
<shortname>doclist</shortname>
|
||||
<description>Document List Component - doclist data webscript</description>
|
||||
<url>/slingshot/doclib/doclist?nodeRef={nodeRef}</url>
|
||||
<authentication>user</authentication>
|
||||
<url>/slingshot/doclib/doclist?nodeRef={nodeRef?}&path={path?}</url>
|
||||
<authentication>guest</authentication>
|
||||
<transaction>required</transaction>
|
||||
</webscript>
|
@@ -7,10 +7,10 @@
|
||||
* Outputs:
|
||||
* doclist - object containing list of child folders and documents in the parent space
|
||||
*/
|
||||
model.doclist = getDoclist(args["nodeRef"]);
|
||||
model.doclist = getDoclist(args["nodeRef"], args["path"], args["type"]);
|
||||
|
||||
/* Create collection of documents and folders in the given space */
|
||||
function getDoclist(nodeRef)
|
||||
function getDoclist(nodeRef, path, type)
|
||||
{
|
||||
var items = new Array();
|
||||
|
||||
@@ -20,15 +20,34 @@ function getDoclist(nodeRef)
|
||||
{
|
||||
parentSpace = search.findNode(nodeRef);
|
||||
}
|
||||
else if ((path != null) && path != "")
|
||||
{
|
||||
parentSpace = companyhome.childByNamePath(path);
|
||||
}
|
||||
if (parentSpace == null)
|
||||
{
|
||||
return jsonError("Parent space nodeRef not supplied");
|
||||
// return jsonError("Parent space nodeRef not supplied");
|
||||
parentSpace = companyhome;
|
||||
}
|
||||
|
||||
var showDocs = true,
|
||||
showFolders = true;
|
||||
|
||||
if ((type != null) && (type != ""))
|
||||
{
|
||||
showDocs = (type == "documents");
|
||||
showFolders = (type == "folders");
|
||||
}
|
||||
|
||||
for each(item in parentSpace.children)
|
||||
{
|
||||
if ((item.isContainer && showFolders) || (!item.isContainer && showDocs))
|
||||
{
|
||||
items.push(item);
|
||||
}
|
||||
}
|
||||
|
||||
items.sort(sortByType);
|
||||
|
||||
return ({
|
||||
"items": items
|
||||
@@ -46,3 +65,12 @@ function jsonError(errorString)
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
function sortByType(a, b)
|
||||
{
|
||||
if (a.isContainer == b.isContainer)
|
||||
{
|
||||
return (b.name.toLowerCase() > a.name.toLowerCase() ? -1 : 1);
|
||||
}
|
||||
return (a.isContainer ? -1 : 1);
|
||||
}
|
Reference in New Issue
Block a user