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> <webscript>
<shortname>doclist</shortname> <shortname>doclist</shortname>
<description>Document List Component - doclist data webscript</description> <description>Document List Component - doclist data webscript</description>
<url>/slingshot/doclib/doclist?nodeRef={nodeRef}</url> <url>/slingshot/doclib/doclist?nodeRef={nodeRef?}&amp;path={path?}</url>
<authentication>user</authentication> <authentication>guest</authentication>
<transaction>required</transaction> <transaction>required</transaction>
</webscript> </webscript>

View File

@@ -7,10 +7,10 @@
* Outputs: * Outputs:
* doclist - object containing list of child folders and documents in the parent space * 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 */ /* Create collection of documents and folders in the given space */
function getDoclist(nodeRef) function getDoclist(nodeRef, path, type)
{ {
var items = new Array(); var items = new Array();
@@ -20,15 +20,34 @@ function getDoclist(nodeRef)
{ {
parentSpace = search.findNode(nodeRef); parentSpace = search.findNode(nodeRef);
} }
else if ((path != null) && path != "")
{
parentSpace = companyhome.childByNamePath(path);
}
if (parentSpace == null) 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) for each(item in parentSpace.children)
{
if ((item.isContainer && showFolders) || (!item.isContainer && showDocs))
{ {
items.push(item); items.push(item);
} }
}
items.sort(sortByType);
return ({ return ({
"items": items "items": items
@@ -46,3 +65,12 @@ function jsonError(errorString)
return obj; 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);
}