As we transition to the new Hyland Community, some post links may be temporarily disrupted as we finalize redirects. We apologize for the inconvenience and are working to resolve this as quickly as possible. Details.
actionListener="#{CheckinCheckoutBean.inlineFile}"
DocumentDetailsBean docDetails = (DocumentDetailsBean) FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("DocumentDetailsBean");
public String getVersionOverviewHTML() { String html = ""; if (getDocument().hasAspect(ContentModel.ASPECT_VERSIONABLE)) { VersionHistory history = this.versionService .getVersionHistory(getDocument().getNodeRef()); StringBuilder builder = new StringBuilder(Application.getMessage( FacesContext.getCurrentInstance(), MSG_HAS_FOLLOWING_CATEGORIES)); builder.append("<ul>"); if (history != null) { for (Version version : history.getAllVersions()) { builder.append("<li>"); builder.append(version.getVersionLabel() + " "); builder.append(version.getDescription() + " "); builder.append(version.getCreator() + " "); builder.append("</li>"); } builder.append("</ul>"); html = builder.toString(); } } return html; }
VersionHistory history = this.versionService.getVersionHistory(getDocument().getNodeRef());
public void inlineFile(ActionEvent event) { UIActionLink link = (UIActionLink) event.getComponent(); Map<String, String> params = link.getParameterMap(); String id = params.get("id"); if (id != null && id.length() != 0) { setCurrentNode(id); Node node = setupContentDocument(id); // retrieve the content reader for this node ContentReader reader = getContentService().getReader( node.getNodeRef(), ContentModel.PROP_CONTENT); String mimetype = reader.getMimetype(); // retrieve string to show image or downloadlink String url = (String) node.getProperties().get("url"); String img = (String) node.getProperties().get("fileType32"); String name = (String) node.getProperties().get("name"); String title = (String) node.getProperties().get("title"); String description = (String) node.getProperties().get( "description"); // looking for the type of file if (MimetypeMap.MIMETYPE_TEXT_PLAIN.equals(mimetype) || MimetypeMap.MIMETYPE_XML.equals(mimetype) || MimetypeMap.MIMETYPE_TEXT_CSS.equals(mimetype) || MimetypeMap.MIMETYPE_HTML.equals(mimetype) || MimetypeMap.MIMETYPE_XHTML.equals(mimetype)) { // make content available if (reader != null) { // replace(strBericht,vbcrlf,"<br>") String text = reader.getContentString(); text = text.replaceAll("\n", "<br>"); setInlineContent("<b>" + name + "</b><br><br>" + text); } else { setInlineContent(""); } // navigate to appropriate screen FacesContext fc = FacesContext.getCurrentInstance(); fc.getApplication().getNavigationHandler().handleNavigation(fc, null, "browse"); } else { if (MimetypeMap.MIMETYPE_IMAGE_JPEG.equals(mimetype) || MimetypeMap.MIMETYPE_IMAGE_GIF.equals(mimetype) || MimetypeMap.MIMETYPE_IMAGE_RGB.equals(mimetype)) { // make content available if (reader != null) { setInlineContent("<b>" + name + "</b><br><br><img src='/alfresco" + url + "'>"); } else { setInlineContent(""); } // navigate to appropriate screen FacesContext fc = FacesContext.getCurrentInstance(); fc.getApplication().getNavigationHandler() .handleNavigation(fc, null, "browse"); } else { // make content available if (reader != null) { setInlineContent("<img src='/alfresco" + img + "'> <A HREF='/alfresco" + url + "'>Download " + name + "</A>"); } else { setInlineContent(""); } // normal downloadable document FacesContext fc = FacesContext.getCurrentInstance(); fc.getApplication().getNavigationHandler() .handleNavigation(fc, null, "browse"); } } setInlineDetail("<img src='/alfresco" + img + "'><br>Name: " + name + "<br>Title: " + title + "<br>Description: " + description + "<br>Format: " + mimetype + "<br><A HREF='/alfresco" + url + "'><b>Download " + name + "</b></A>"); setInlineCategory(getCategoriesOverviewHTML()); setInlineVersion(getVersionOverviewHTML()); } }
public String getVersionOverviewHTML() { String html = null; UserTransaction tx = null; // Start a transaction try { // Use the Repository helper class to obtain a new transaction FacesContext context = FacesContext.getCurrentInstance(); tx = Repository.getUserTransaction(context, true); tx.begin(); Node node = setupContentDocument(currentNode); String name = (String) node.getProperties().get("name"); VersionService versionService = (VersionService) FacesContextUtils .getRequiredWebApplicationContext(context).getBean( "versionService"); if (getDocument().hasAspect(ContentModel.ASPECT_VERSIONABLE)) { VersionHistory history = versionService .getVersionHistory(getDocument().getNodeRef()); StringBuilder builder = new StringBuilder(Application .getMessage(FacesContext.getCurrentInstance(), MSG_HAS_FOLLOWING_CATEGORIES)); builder.append("<ul>"); if (history != null) { for (Version version : history.getAllVersions()) { String url = DownloadContentServlet.generateBrowserURL( version.getFrozenStateNodeRef(), name); builder.append("<li>"); builder.append("<A HREF='/alfresco" + url + "'>Download v" + version.getVersionLabel() + "</A>" + " "); builder.append(version.getDescription() + " "); builder.append(version.getCreator() + " "); builder.append("</li>"); } builder.append("</ul>"); html = builder.toString(); } } // Commit the transaction tx.commit(); } catch (Exception e) { e.printStackTrace(); } return html; }