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:
Mike Hatfield
2008-04-25 08:25:12 +00:00
parent 3f8d6dacab
commit ae8522df09
2 changed files with 34 additions and 6 deletions

View File

@@ -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?}&amp;path={path?}</url>
<authentication>guest</authentication>
<transaction>required</transaction>
</webscript>

View File

@@ -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,16 +20,35 @@ 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)
{
items.push(item);
if ((item.isContainer && showFolders) || (!item.isContainer && showDocs))
{
items.push(item);
}
}
items.sort(sortByType);
return ({
"items": items
});
@@ -45,4 +64,13 @@ 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);
}