AnsweredAssumed Answered

Web Script download de documents of a spaces and subspaces

Question asked by berenicestr69 on Aug 3, 2010
Hello, i´m trying to do a web script in Alfresco for a portlet in liferay, y send the argument for the rpincipal space for serach the documents tha exisits of this spaces and the docuents in subspaces recursivity,  and i show the link to download.
Somewone can help me??


I´m trying to do this, I send the argument of a space, and add the documents that find there, but in subspaces don´t do nothing, here is the code, if somewone can help me and find the solution fot this problem:

Thanks!!


var carpeta = args.carpeta;
var resultados = new Array();
var espacio = roothome.childByNamePath(carpeta);

var i=0;
for(var j=0; j<espacio.children.length; j++){
var hijo = espacio.children[j];

if(hijo.isDocument){
resultados[i]=hijo;
i++;
}
if(hijo.isContainer){
var espacio2 = roothome.childByNamePath(carpeta+"/"+hijo.name);
for(var x=0; x<espacio2.children.length; x++){
var hijo2=espacio2.childen[x];

if(hijo2.isDocument){
resultados[i]=hijo2;
i++;
}
}
}
}

model.resultados=resultados;

Outcomes