protected Importable getCompanionForCompoundDocument(Document resourceDescriptor, Folder folder) { HtmlDocument html = new HtmlDocument(); StringBuffer content = new StringBuffer(); List<Node> fileNodes = XPathHelper.selectNodes("/CONTENT/FILES/FILE", resourceDescriptor); content.append("<html>\n"); content.append(" <head><title>" + folder.getTitle() + "</title></head>\n"); content.append(" <body>\n"); content.append(" <p>" + XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", resourceDescriptor) + "</p>\n"); content.append(" <table border=\"1\">\n"); for (Node fileNode : fileNodes) { String fileName = XPathHelper.getNodeValue("./NAME", fileNode); content.append(" <tr><td><a href=\""+ folder.getTitle() + "/" + fileName + "\">" + fileName + "</a></td></tr>\n"); } content.append(" </table>\n"); content.append(" </body>\n"); content.append("</html>"); html.setContent(content.toString()); html.setTitle(folder.getTitle()); html.setContextPath(folder.getPath() + folder.getTitle() + "_manifest"); html.setLegacyGroup(folder.getLegacyGroup()); // we want the html document to come before the folder in sequence html.setSequenceNum(folder.getSequenceNum() - 1); return html; }
public Importable translate(Node resourceNode, Document descriptor, String contextPath, String archiveBasePath) { String content = XPathHelper.getNodeValue("/CONTENT/BODY/TEXT", descriptor); String title = XPathHelper.getNodeValue("/CONTENT/TITLE/@value", descriptor).trim().replaceAll("\\<.*?\\>", "").replaceAll("/", "_"); int priority = Integer.parseInt(((Element)resourceNode).getAttribute("priority")); // SmartText replaces the double-quote with the HTML entity equivalent content.replaceAll(""", "\""); contextPath = contextPath + title; //Validator.escapeResourceName(title); //Some smart text has files, frequently zipped up 'learning modules' if (!XPathHelper.selectNode("/CONTENT/FILES", descriptor).hasChildNodes()) { TextDocument text = new TextDocument(); text.setContent(content); text.setTitle(title); text.setContextPath(contextPath); text.setSequenceNum(priority); return text; } else { Folder folder = new Folder(); folder.setDescription(content); folder.setTitle(title); folder.setPath(contextPath); folder.setSequenceNum(priority); return folder; } }
)) { String folderTitle = getTitleForNode(node); Folder folder = new Folder(); folder.setPath(contextPath); folder.setTitle(folderTitle); folder.setDescription(getDescriptionForNode(node)); folder.setSequenceNum(priority); if (parent != null) { folder.setParent(parent); folder.setLegacyGroup(parent.getLegacyGroup()); } else folder.setLegacyGroup(folderTitle); if (wantsCompanionForCompoundDocument()) { priority++; folder.setSequenceNum(priority); branchOfImportables.add(getCompanionForCompoundDocument(resourceDescriptor, folder)); if (resourceNode != null) { if (parent == null) { parent = new Folder(); parent.setLegacyGroup(itemHelper.getTitle(node));
title = ((Folder)thing).getTitle(); description = ((Folder)thing).getDescription(); resourceProps.put(ResourceProperties.PROP_DISPLAY_NAME, title); resourceProps.put(ResourceProperties.PROP_DESCRIPTION, description); String path = contentHostingService.getSiteCollection(siteId) + ((Folder)thing).getPath(); addContentCollection(path,resourceProps);
)) { String folderTitle = getTitleForNode(node); Folder folder = new Folder(); folder.setPath(contextPath); folder.setTitle(folderTitle); folder.setDescription(getDescriptionForNode(node)); folder.setSequenceNum(priority); if (parent != null) { folder.setParent(parent); folder.setLegacyGroup(parent.getLegacyGroup()); } else folder.setLegacyGroup(folderTitle); if (wantsCompanionForCompoundDocument()) { priority++; folder.setSequenceNum(priority); branchOfImportables.add(getCompanionForCompoundDocument(resourceDescriptor, folder)); if (resourceNode != null) { if (parent == null) { parent = new Folder(); parent.setLegacyGroup(itemHelper.getTitle(node));
title = ((Folder)thing).getTitle(); description = ((Folder)thing).getDescription(); resourceProps.put(ResourceProperties.PROP_DISPLAY_NAME, title); resourceProps.put(ResourceProperties.PROP_DESCRIPTION, description); String path = contentHostingService.getSiteCollection(siteId) + ((Folder)thing).getPath(); addContentCollection(path,resourceProps);
String documentText = XPathHelper.getNodeValue("//TEXT", resourceDescriptor); content.append("<html>\n"); content.append(" <head><title>" + folder.getTitle() + "</title></head>\n"); content.append(" <body>\n"); content.append(" <p>" + documentText + "</p>\n"); for (Node fileNode : embedFileNodes) { content.append(imgTagFromFileNode(fileNode, folder.getTitle()) + "<br/>\n"); for (Node fileNode : linkFileNodes) { String fileName = XPathHelper.getNodeValue("./RELFILE/@value", fileNode); content.append(" <tr><td><a href=\""+ folder.getTitle() + "/" + fileName + "\">" + fileName + "</a></td></tr>\n"); content.append("</html>"); html.setContent(content.toString()); html.setTitle(folder.getTitle()); html.setContextPath(folder.getPath() + folder.getTitle() + "_manifest"); html.setLegacyGroup(folder.getLegacyGroup()); html.setSequenceNum(folder.getSequenceNum() - 1); return html;