mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
. WCM UI
- Create Web Content action (HTML, plain text and XML forms !) now creates content in the current AVM store+folder - Edit inline content for HTML, plain text and XML forms . Applied web.xml error patch as suggested by Gav git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3873 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
@@ -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)
|
||||
|
@@ -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)
|
||||
{
|
||||
|
@@ -648,6 +648,10 @@
|
||||
<property-name>navigationBean</property-name>
|
||||
<value>#{NavigationBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
@@ -669,6 +673,10 @@
|
||||
<property-name>avmBrowseBean</property-name>
|
||||
<value>#{AVMBrowseBean}</value>
|
||||
</managed-property>
|
||||
<managed-property>
|
||||
<property-name>nodeService</property-name>
|
||||
<value>#{NodeService}</value>
|
||||
</managed-property>
|
||||
</managed-bean>
|
||||
|
||||
<managed-bean>
|
||||
|
@@ -274,7 +274,7 @@
|
||||
</welcome-file-list>
|
||||
|
||||
<error-page>
|
||||
<error-code>500</error-code>
|
||||
<exception-type>java.lang.Exception</exception-type>
|
||||
<location>/jsp/error.jsp</location>
|
||||
</error-page>
|
||||
|
||||
|
@@ -75,7 +75,7 @@
|
||||
<div class="mainSubText"><h:outputText value="#{NavigationBean.nodeProperties.description}" id="msg4" /></div>
|
||||
</td>
|
||||
<td align=right>
|
||||
<a:actionLink value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" actionListener="#{AVMBrowseBean.setupSandboxAction}" action="wizard:createWebContent" />
|
||||
<a:actionLink value="#{msg.sandbox_create}" image="/images/icons/new_content.gif" action="wizard:createWebContent" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@@ -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()
|
||||
<td height="100%">
|
||||
<table cellspacing="0" cellpadding="3" border="0" width="100%" height="100%">
|
||||
<tr>
|
||||
<td valign="top" rowspan=2>
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton id="save-button" value="#{msg.save}" action="#{CheckinCheckoutBean.editInlineOK}" styleClass="dialogControls" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="dialogButtonSpacing"></td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel}" action="browse" styleClass="dialogControls" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<%-- Inline editor --%>
|
||||
<tr>
|
||||
<td width="100%" valign="top" height="100%">
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
|
||||
|
||||
@@ -158,6 +138,23 @@ final InstanceData instanceData = new InstanceData()
|
||||
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "white"); %>
|
||||
</td>
|
||||
<td valign="top" rowspan=2>
|
||||
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "blue", "#D3E6FE"); %>
|
||||
<table cellpadding="1" cellspacing="1" border="0">
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton id="save-button" value="#{msg.save}" action="#{AVMEditBean.editInlineOK}" styleClass="dialogControls" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr><td class="dialogButtonSpacing"></td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<h:commandButton value="#{msg.cancel}" action="dialog:close" styleClass="dialogControls" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% PanelGenerator.generatePanelEnd(out, request.getContextPath(), "blue"); %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
Reference in New Issue
Block a user