* @param rootContainer
* @return
*/
public static VFSLeaf getWikiAsZip(VFSContainer rootContainer){
List folders = rootContainer.getItems();
VFSLeaf indexLeaf =(VFSLeaf)rootContainer.resolve("index.html");
if(indexLeaf != null) indexLeaf.delete();
List filesTozip = new ArrayList();
for (Iterator iter = folders.iterator(); iter.hasNext();) {
VFSItem item = (VFSItem)iter.next();
if (item instanceof VFSContainer) {
VFSContainer folder = (VFSContainer) item;
List items = folder.getItems();
String overviewPage = WikiToZipUtils.createIndexPageForExport(items);
if(overviewPage != null){
VFSLeaf overview = rootContainer.createChildLeaf("index.html");
items.add(overview);
FileUtils.save(overview.getOutputStream(false), overviewPage, "utf-8");
}
filesTozip.addAll(items);
}
}
VFSLeaf zipFile = (VFSLeaf)rootContainer.resolve("wiki.zip");
if(rootContainer.resolve("wiki.zip") != null) zipFile.delete();
ZipUtil.zip(filesTozip, rootContainer.createChildLeaf("wiki.zip"));
return (VFSLeaf)rootContainer.resolve("wiki.zip");
}