diff --git a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java index bf27b87550..48e9ffb68e 100644 --- a/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java +++ b/source/java/org/alfresco/web/bean/wcm/AVMBrowseBean.java @@ -140,6 +140,11 @@ public class AVMBrowseBean implements IContextListener this.nodeService = nodeService; } + /** + * Getter used by the Inline Edit XML JSP + * + * @return The NodeService + */ public NodeService getNodeService() { return this.nodeService; @@ -369,6 +374,29 @@ public class AVMBrowseBean implements IContextListener this.avmNode = new AVMNode(avmRef); } + /** + * @return the internal AVM path to the current folder for browsing + */ + public String getCurrentPath() + { + if (this.currentPath == null) + { + this.currentPath = AVMConstants.buildAVMStoreRootPath(getSandbox()); + } + return this.currentPath; + } + + /** + * @param path the internal AVM path to the current folder for browsing + */ + public void setCurrentPath(String path) + { + this.currentPath = path; + + // update UI state ready for screen refresh + UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); + } + /** * @return Breadcrumb location list */ @@ -542,29 +570,6 @@ public class AVMBrowseBean implements IContextListener // ------------------------------------------------------------------------------ // Private helpers - /** - * @return the internal AVM path to the current folder for browsing - */ - private String getCurrentPath() - { - if (this.currentPath == null) - { - this.currentPath = AVMConstants.buildAVMStoreRootPath(getSandbox()); - } - return this.currentPath; - } - - /** - * @param path the internal AVM path to the current folder for browsing - */ - private void setCurrentPath(String path) - { - this.currentPath = path; - - // update UI state ready for screen refresh - UIContextService.getInstance(FacesContext.getCurrentInstance()).notifyBeans(); - } - /** * Update the breadcrumb with the clicked Group location */ diff --git a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java index 4605554080..2cff791a29 100644 --- a/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java +++ b/source/java/org/alfresco/web/bean/wcm/CreateWebContentWizard.java @@ -20,11 +20,8 @@ import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.File; import java.io.FileInputStream; -import java.io.Serializable; -import java.io.StringReader; import java.util.ArrayList; import java.util.Collection; -import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.ResourceBundle; @@ -36,20 +33,11 @@ import javax.faces.model.SelectItem; import org.alfresco.config.Config; import org.alfresco.config.ConfigElement; import org.alfresco.config.ConfigService; -import org.alfresco.model.ContentModel; import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.repo.content.MimetypeMap; import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.model.FileInfo; -import org.alfresco.service.cmr.repository.ContentWriter; -import org.alfresco.service.cmr.repository.MimetypeService; -import org.alfresco.service.cmr.repository.NodeRef; -import org.alfresco.service.namespace.QName; -import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.Application; import org.alfresco.web.bean.content.BaseContentWizard; -import org.alfresco.web.bean.repository.Node; -import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.data.IDataContainer; import org.alfresco.web.data.QuickSort; import org.alfresco.web.templating.OutputUtil; @@ -137,20 +125,7 @@ public class CreateWebContentWizard extends BaseContentWizard protected void saveContent(File fileContent, String strContent) throws Exception { // get the parent path of the location to save the content - String path; - AVMNode avmNode = this.avmBrowseBean.getAvmNode(); - if (avmNode == null) - { - // create in root of current website - Node websiteNode = this.navigator.getCurrentNode(); - String storeRoot = (String)websiteNode.getProperties().get(ContentModel.PROP_AVMSTORE); - path = AVMConstants.buildAVMStoreRootPath(AVMConstants.buildAVMStagingStoreName(storeRoot)); - } - else - { - // create in current folder path - path = avmNode.getPath(); - } + String path = this.avmBrowseBean.getCurrentPath(); // put the content of the file into the AVM store if (fileContent != null) diff --git a/source/java/org/alfresco/web/templating/OutputUtil.java b/source/java/org/alfresco/web/templating/OutputUtil.java index ed97d1f6fa..1cd7f834bb 100644 --- a/source/java/org/alfresco/web/templating/OutputUtil.java +++ b/source/java/org/alfresco/web/templating/OutputUtil.java @@ -20,10 +20,8 @@ import java.io.OutputStream; import java.io.OutputStreamWriter; import org.alfresco.model.ContentModel; -import org.alfresco.repo.avm.AVMContext; import org.alfresco.repo.avm.AVMNodeConverter; import org.alfresco.service.cmr.avm.AVMService; -import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentService; import org.alfresco.service.cmr.repository.ContentWriter; @@ -49,27 +47,6 @@ public class OutputUtil return s.replaceAll("(.+)\\..*", "$1"); } - private static String getAVMParentPath(NodeRef nodeRef, - NodeService nodeService) - throws Exception - { - ChildAssociationRef caf = nodeService.getPrimaryParent(nodeRef); - final String parentName = (String) - nodeService.getProperty(caf.getParentRef(), ContentModel.PROP_NAME); - LOGGER.debug("computed avm path " + PARENT_AVM_PATH + "/" + parentName); - final String result = PARENT_AVM_PATH + "/" + parentName; - AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); - if (avmService.lookup(-1, result) != null) - { - return result; - } - else - { - // avmService.createDirectory(PARENT_AVM_PATH, parentName); - return PARENT_AVM_PATH; - } - } - public static void generate(String parentPath, Document xml, TemplateType tt, @@ -108,20 +85,6 @@ public class OutputUtil nodeService.setProperty(createdNodeRef, TemplatingService.TT_GENERATED_OUTPUT_QNAME, outputNodeRef.toString()); - - // TODO: should this output go anywhere in the AVM world now we are writing directly? - /*try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); - } - LOGGER.debug("writing xml " + fileName + " to avm"); - final TemplatingService ts = TemplatingService.getInstance(); - ts.writeXML(xml, out); - out.close();*/ } catch (Exception e) { @@ -173,33 +136,6 @@ public class OutputUtil out.close(); LOGGER.debug("generated " + fileName + " using " + tom); - - // TODO: do we need these now - as the NodeRef's above are now AVM NodeRefs...? - /*AVMService avmService = (AVMService)AVMContext.fgInstance.fAppContext.getBean("avmService"); - final String parentAVMPath = getAVMParentPath(nodeRef, nodeService); - try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, generatedFileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + generatedFileName)); - } - LOGGER.debug("generating " + generatedFileName + " to avm"); - tom.generate(xml, tt, out); - out.close();*/ - - /*try - { - out = new OutputStreamWriter(avmService.createFile(parentAVMPath, fileName)); - } - catch (AVMExistsException e) - { - out = new OutputStreamWriter(avmService.getFileOutputStream(parentAVMPath + "/" + fileName)); - } - LOGGER.debug("writing xml " + fileName + " to avm"); - ts.writeXML(xml, out); - out.close();*/ } catch (Exception e) { diff --git a/source/web/WEB-INF/faces-config-beans.xml b/source/web/WEB-INF/faces-config-beans.xml index d2d6afd9b3..031a8ecf51 100644 --- a/source/web/WEB-INF/faces-config-beans.xml +++ b/source/web/WEB-INF/faces-config-beans.xml @@ -648,6 +648,10 @@ navigationBean #{NavigationBean} + + nodeService + #{NodeService} + @@ -669,6 +673,10 @@ avmBrowseBean #{AVMBrowseBean} + + nodeService + #{NodeService} + diff --git a/source/web/WEB-INF/web.xml b/source/web/WEB-INF/web.xml index bd3412c338..dbbafb9a69 100644 --- a/source/web/WEB-INF/web.xml +++ b/source/web/WEB-INF/web.xml @@ -274,7 +274,7 @@ - 500 + java.lang.Exception /jsp/error.jsp diff --git a/source/web/jsp/wcm/browse-sandbox.jsp b/source/web/jsp/wcm/browse-sandbox.jsp index 0e51f70d21..4dbc0d1274 100644 --- a/source/web/jsp/wcm/browse-sandbox.jsp +++ b/source/web/jsp/wcm/browse-sandbox.jsp @@ -75,7 +75,7 @@
- + diff --git a/source/web/jsp/wcm/edit-xml-inline.jsp b/source/web/jsp/wcm/edit-xml-inline.jsp index 7e3b645589..9bf2cab543 100644 --- a/source/web/jsp/wcm/edit-xml-inline.jsp +++ b/source/web/jsp/wcm/edit-xml-inline.jsp @@ -33,10 +33,10 @@ <%@ page import="org.alfresco.web.templating.*" %> <%@ page import="org.w3c.dom.Document" %> <% -final AVMBrowseBean ccb = (AVMBrowseBean)session.getAttribute("AVMBrowseBean"); -NodeRef nr = ccb.getAvmNode().getNodeRef(); -final AVMEditBean aeb = (AVMEditBean)session.getAttribute("AVMEditBean"); -String ttName = (String)ccb.getNodeService().getProperty(nr, TemplatingService.TT_QNAME); +final AVMBrowseBean browseBean = (AVMBrowseBean)session.getAttribute("AVMBrowseBean"); +NodeRef nr = browseBean.getAvmNode().getNodeRef(); +final AVMEditBean editBean = (AVMEditBean)session.getAttribute("AVMEditBean"); +String ttName = (String)browseBean.getNodeService().getProperty(nr, TemplatingService.TT_QNAME); final TemplatingService ts = TemplatingService.getInstance(); final TemplateType tt = ts.getTemplateType(ttName); TemplateInputMethod tim = tt.getInputMethods().get(0); @@ -46,7 +46,7 @@ final InstanceData instanceData = new InstanceData() { try { - return aeb.getEditorOutput() != null ? ts.parseXML(aeb.getEditorOutput()) : null; + return editBean.getEditorOutput() != null ? ts.parseXML(editBean.getEditorOutput()) : null; } catch (Exception e) { @@ -57,7 +57,7 @@ final InstanceData instanceData = new InstanceData() public void setContent(final Document d) { - aeb.setEditorOutput(ts.writeXMLToString(d)); + editBean.setEditorOutput(ts.writeXMLToString(d)); } }; %> @@ -130,27 +130,7 @@ final InstanceData instanceData = new InstanceData() - - - - <%-- Inline editor --%> - + <%-- Inline editor --%> +
- <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> - - - - - - - - -
- -
- -
- <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> -
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> @@ -158,6 +138,23 @@ final InstanceData instanceData = new InstanceData() <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %> + <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %> + + + + + + + + +
+ +
+ +
+ <% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %> +