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>
|
<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?}&path={path?}</url>
|
||||||
<authentication>user</authentication>
|
<authentication>guest</authentication>
|
||||||
<transaction>required</transaction>
|
<transaction>required</transaction>
|
||||||
</webscript>
|
</webscript>
|
@@ -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);
|
||||||
|
}
|
Reference in New Issue
Block a user