/**
*
*
*/
public void archiveWikiToCP() {
LocalFolderImpl tempFolder = new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
if (tempFolder.resolve("imsmanifest.xml") != null) {
tempFolder.delete(); //delete all content if already exists...
tempFolder = new OlatRootFolderImpl("/tmp/"+ident.getKey()+"-"+ores.getResourceableId(), null);
}
Wiki wiki = WikiManager.getInstance().getOrLoadWiki(ores);
String dateStamp = Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
LocalFolderImpl exportDir = new OlatRootFolderImpl(FolderConfig.getUserHomes() +"/"+ ident.getName() +"/private/archive/wiki-export-"+dateStamp+".zip", null);
//create the ims manifest
StringBuilder sb = createIMSManifest(wiki, ident);
VFSLeaf manifest = tempFolder.createChildLeaf("imsmanifest.xml");
copyMediaFiles(WikiManager.getInstance().getMediaFolder(ores), tempFolder);
FileUtils.save(manifest.getOutputStream(false), sb.toString(), "utf-8");
//create the javascript mapping file
StringBuilder jsContent = createJsMappingContent(wiki);
VFSLeaf jsFile = tempFolder.createChildLeaf("mapping.js");
FileUtils.save(jsFile.getOutputStream(false), jsContent.toString(), "utf-8");
renderWikiToHtmlFiles(ores, tempFolder);
CPOfflineReadableManager.getInstance().makeCPOfflineReadable(tempFolder.getBasefile(), exportDir.getBasefile(), null);
tempFolder.delete();
}