mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
checkpoint of templating as used in the virgin money demo.
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3475 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -77,16 +77,9 @@ public abstract class BaseContentWizard extends BaseWizardBean
|
||||
@Override
|
||||
public boolean getFinishButtonDisabled()
|
||||
{
|
||||
if (this.fileName == null ||
|
||||
this.fileName.length() == 0 ||
|
||||
this.mimeType == null)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return (this.fileName == null ||
|
||||
this.fileName.length() == 0 ||
|
||||
this.mimeType == null);
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -331,7 +324,7 @@ public abstract class BaseContentWizard extends BaseWizardBean
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper methods
|
||||
|
||||
|
||||
/**
|
||||
* Save the specified content using the currently set wizard attributes
|
||||
*
|
||||
@@ -341,21 +334,12 @@ public abstract class BaseContentWizard extends BaseWizardBean
|
||||
protected void saveContent(File fileContent, String strContent) throws Exception
|
||||
{
|
||||
// get the node ref of the node that will contain the content
|
||||
NodeRef containerNodeRef;
|
||||
String nodeId = this.navigator.getCurrentNodeId();
|
||||
if (nodeId == null)
|
||||
{
|
||||
containerNodeRef = this.nodeService.getRootNode(Repository.getStoreRef());
|
||||
}
|
||||
else
|
||||
{
|
||||
containerNodeRef = new NodeRef(Repository.getStoreRef(), nodeId);
|
||||
}
|
||||
NodeRef containerNodeRef = this.getContainerNodeRef();
|
||||
|
||||
FileInfo fileInfo = this.fileFolderService.create(
|
||||
containerNodeRef,
|
||||
this.fileName,
|
||||
Repository.resolveToQName(this.objectType));
|
||||
FileInfo fileInfo =
|
||||
this.fileFolderService.create(containerNodeRef,
|
||||
this.fileName,
|
||||
Repository.resolveToQName(this.objectType));
|
||||
NodeRef fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
// set the author aspect
|
||||
@@ -395,13 +379,9 @@ public abstract class BaseContentWizard extends BaseWizardBean
|
||||
{
|
||||
writer.putContent(fileContent);
|
||||
}
|
||||
else if (strContent != null)
|
||||
else
|
||||
{
|
||||
writer.putContent(strContent);
|
||||
}
|
||||
else
|
||||
{
|
||||
writer.putContent("");
|
||||
writer.putContent(strContent == null ? "" : strContent);
|
||||
}
|
||||
|
||||
// remember the created node now
|
||||
|
@@ -39,6 +39,12 @@ import org.alfresco.web.templating.*;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.NodeRef;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
import java.io.OutputStreamWriter;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Create Content Wizard" dialog
|
||||
*
|
||||
@@ -46,11 +52,13 @@ import org.apache.commons.logging.LogFactory;
|
||||
*/
|
||||
public class CreateContentWizard extends BaseContentWizard
|
||||
{
|
||||
protected String content = null;
|
||||
protected String content = null;
|
||||
protected String templateType;
|
||||
protected List<SelectItem> createMimeTypes;
|
||||
|
||||
private static Log logger = LogFactory.getLog(CreateContentWizard.class);
|
||||
protected List<SelectItem> createMimeTypes;
|
||||
|
||||
private static final Log LOGGER =
|
||||
LogFactory.getLog(CreateContentWizard.class);
|
||||
|
||||
public static final org.alfresco.service.namespace.QName TT_QNAME =
|
||||
org.alfresco.service.namespace.QName.createQName(org.alfresco.service.namespace.NamespaceService.CONTENT_MODEL_1_0_URI, "tt");
|
||||
|
||||
@@ -61,12 +69,55 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
LOGGER.debug("saving file content to " + this.fileName);
|
||||
saveContent(null, this.content);
|
||||
if (templateType != null)
|
||||
this.nodeService.setProperty(createdNode, TT_QNAME, templateType);
|
||||
if (this.templateType != null)
|
||||
{
|
||||
LOGGER.debug("generating template output for " + this.templateType);
|
||||
this.nodeService.setProperty(this.createdNode, TT_QNAME, this.templateType);
|
||||
TemplatingService ts = TemplatingService.getInstance();
|
||||
TemplateType tt = ts.getTemplateType(this.templateType);
|
||||
if (tt.getOutputMethods().size() != 0)
|
||||
{
|
||||
try {
|
||||
// get the node ref of the node that will contain the content
|
||||
NodeRef containerNodeRef = this.getContainerNodeRef();
|
||||
final String fileName = this.fileName + "-generated.html";
|
||||
FileInfo fileInfo =
|
||||
this.fileFolderService.create(containerNodeRef,
|
||||
fileName,
|
||||
ContentModel.TYPE_CONTENT);
|
||||
NodeRef fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
fileName);
|
||||
|
||||
// get a writer for the content and put the file
|
||||
ContentWriter writer = contentService.getWriter(fileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/html");
|
||||
writer.setEncoding("UTF-8");
|
||||
TemplateOutputMethod tom = tt.getOutputMethods().get(0);
|
||||
OutputStreamWriter out =
|
||||
new OutputStreamWriter(writer.getContentOutputStream());
|
||||
tom.generate(ts.parseXML(this.content), tt, out);
|
||||
out.close();
|
||||
this.nodeService.setProperty(fileNodeRef, TT_QNAME, this.templateType);
|
||||
|
||||
// return the default outcome
|
||||
return outcome;
|
||||
LOGGER.debug("generated " + fileName + " using " + tom);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// return the default outcome
|
||||
return outcome;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -189,12 +240,12 @@ public class CreateContentWizard extends BaseContentWizard
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("Could not find 'create-mime-types' configuration element");
|
||||
LOGGER.warn("Could not find 'create-mime-types' configuration element");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
logger.warn("Could not find 'Content Wizards' configuration section");
|
||||
LOGGER.warn("Could not find 'Content Wizards' configuration section");
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -17,44 +17,51 @@
|
||||
package org.alfresco.web.bean.content;
|
||||
|
||||
import java.io.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import java.util.*;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.event.ValueChangeEvent;
|
||||
import javax.faces.model.SelectItem;
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import org.alfresco.config.Config;
|
||||
import org.alfresco.config.ConfigElement;
|
||||
import org.alfresco.config.ConfigService;
|
||||
import org.alfresco.model.ContentModel;
|
||||
import org.alfresco.repo.content.MimetypeMap;
|
||||
import org.alfresco.service.cmr.model.FileInfo;
|
||||
import org.alfresco.service.cmr.repository.ContentService;
|
||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||
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.FileUploadBean;
|
||||
import org.alfresco.web.bean.repository.Node;
|
||||
import org.alfresco.web.bean.repository.Repository;
|
||||
import org.alfresco.web.bean.wizard.BaseWizardBean;
|
||||
import org.alfresco.web.data.IDataContainer;
|
||||
import org.alfresco.web.data.QuickSort;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.alfresco.web.templating.*;
|
||||
|
||||
import org.alfresco.web.templating.xforms.*;
|
||||
import org.alfresco.web.ui.common.Utils;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
import org.xml.sax.SAXException;
|
||||
|
||||
/**
|
||||
* Bean implementation for the "Create Content Wizard" dialog
|
||||
*
|
||||
* @author arielb
|
||||
*/
|
||||
public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
public class CreateXmlContentTypeWizard extends BaseWizardBean
|
||||
{
|
||||
|
||||
private final static Log logger = LogFactory.getLog(CreateXmlContentTypeWizard.class);
|
||||
private TemplateType tt;
|
||||
private final static Log LOGGER =
|
||||
LogFactory.getLog(CreateXmlContentTypeWizard.class);
|
||||
|
||||
private String presentationTemplateType;
|
||||
protected ContentService contentService;
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Wizard implementation
|
||||
@@ -63,10 +70,47 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
protected String finishImpl(FacesContext context, String outcome)
|
||||
throws Exception
|
||||
{
|
||||
// get the node ref of the node that will contain the content
|
||||
NodeRef containerNodeRef = this.getContainerNodeRef();
|
||||
|
||||
FileInfo fileInfo =
|
||||
this.fileFolderService.create(containerNodeRef,
|
||||
this.getSchemaFileName(),
|
||||
ContentModel.TYPE_CONTENT);
|
||||
NodeRef fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
this.getSchemaFileName());
|
||||
|
||||
saveContent(this.getSchemaFile(), null);
|
||||
// get a writer for the content and put the file
|
||||
ContentWriter writer = contentService.getWriter(fileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/xml");
|
||||
writer.setEncoding("UTF-8");
|
||||
writer.putContent(this.getSchemaFile());
|
||||
|
||||
fileInfo = this.fileFolderService.create(containerNodeRef,
|
||||
this.getPresentationTemplateFileName(),
|
||||
ContentModel.TYPE_CONTENT);
|
||||
fileNodeRef = fileInfo.getNodeRef();
|
||||
|
||||
if (LOGGER.isDebugEnabled())
|
||||
LOGGER.debug("Created file node for file: " +
|
||||
this.getPresentationTemplateFileName());
|
||||
|
||||
// get a writer for the content and put the file
|
||||
writer = contentService.getWriter(fileNodeRef,
|
||||
ContentModel.PROP_CONTENT, true);
|
||||
// set the mimetype and encoding
|
||||
writer.setMimetype("text/xml");
|
||||
writer.setEncoding("UTF-8");
|
||||
writer.putContent(this.getPresentationTemplateFile());
|
||||
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
ts.registerTemplateType(tt);
|
||||
ts.registerTemplateType(this.getTemplateType());
|
||||
|
||||
// return the default outcome
|
||||
return outcome;
|
||||
}
|
||||
@@ -76,14 +120,15 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
{
|
||||
super.init(parameters);
|
||||
|
||||
this.mimeType = "text/xml";
|
||||
this.clearUpload();
|
||||
this.removeUploadedSchemaFile();
|
||||
this.removeUploadedPresentationTemplateFile();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String cancel()
|
||||
{
|
||||
this.clearUpload();
|
||||
this.removeUploadedSchemaFile();
|
||||
this.removeUploadedPresentationTemplateFile();
|
||||
return super.cancel();
|
||||
}
|
||||
|
||||
@@ -100,7 +145,8 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
{
|
||||
case 1:
|
||||
{
|
||||
disabled = (this.fileName == null || this.fileName.length() == 0);
|
||||
disabled = (this.getSchemaFileName() == null ||
|
||||
this.getSchemaFileName().length() == 0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -108,32 +154,43 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
return disabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
// @Override
|
||||
// protected String doPostCommitProcessing(FacesContext context, String outcome)
|
||||
// {
|
||||
// // as we were successful, go to the set properties dialog if asked
|
||||
// // to otherwise just return
|
||||
// if (this.showOtherProperties)
|
||||
// {
|
||||
// // we are going to immediately edit the properties so we need
|
||||
// // to setup the BrowseBean context appropriately
|
||||
// this.browseBean.setDocument(new Node(this.createdNode));
|
||||
//
|
||||
// return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
|
||||
// "dialog:setContentProperties";
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// return outcome;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* Action handler called when the user wishes to remove an uploaded file
|
||||
*/
|
||||
public String removeUploadedSchemaFile()
|
||||
{
|
||||
// as we were successful, go to the set properties dialog if asked
|
||||
// to otherwise just return
|
||||
if (this.showOtherProperties)
|
||||
{
|
||||
// we are going to immediately edit the properties so we need
|
||||
// to setup the BrowseBean context appropriately
|
||||
this.browseBean.setDocument(new Node(this.createdNode));
|
||||
clearUpload("schema");
|
||||
|
||||
return getDefaultFinishOutcome() + AlfrescoNavigationHandler.OUTCOME_SEPARATOR +
|
||||
"dialog:setContentProperties";
|
||||
}
|
||||
else
|
||||
{
|
||||
return outcome;
|
||||
}
|
||||
// refresh the current page
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Action handler called when the user wishes to remove an uploaded file
|
||||
*/
|
||||
public String removeUploadedFile()
|
||||
public String removeUploadedPresentationTemplateFile()
|
||||
{
|
||||
clearUpload();
|
||||
clearUpload("pt");
|
||||
|
||||
// refresh the current page
|
||||
return null;
|
||||
@@ -141,38 +198,50 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Bean Getters and Setters
|
||||
|
||||
/**
|
||||
* @return Returns the mime type currenty selected
|
||||
*/
|
||||
public String getPresentationTemplateType()
|
||||
{
|
||||
return this.presentationTemplateType;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param presentationTemplateType Sets the currently selected mime type
|
||||
*/
|
||||
public void setPresentationTemplateType(String presentationTemplateType)
|
||||
{
|
||||
this.presentationTemplateType = presentationTemplateType;
|
||||
}
|
||||
|
||||
private FileUploadBean getFileUploadBean()
|
||||
private FileUploadBean getFileUploadBean(final String id)
|
||||
{
|
||||
final FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
final Map sessionMap = ctx.getExternalContext().getSessionMap();
|
||||
return (FileUploadBean)sessionMap.get(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
|
||||
return (FileUploadBean)sessionMap.get(FileUploadBean.getKey(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the name of the file
|
||||
*/
|
||||
public String getFileName()
|
||||
private String getFileName(final String id)
|
||||
{
|
||||
// try and retrieve the file and filename from the file upload bean
|
||||
// representing the file we previously uploaded.
|
||||
final FileUploadBean fileBean = this.getFileUploadBean();
|
||||
if (fileBean != null)
|
||||
this.fileName = fileBean.getFileName();
|
||||
return this.fileName;
|
||||
final FileUploadBean fileBean = this.getFileUploadBean(id);
|
||||
return fileBean == null ? null : fileBean.getFileName();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param fileName The name of the file
|
||||
* @return Returns the schema file or <tt>null</tt>
|
||||
*/
|
||||
public void setFileName(String fileName)
|
||||
private File getFile(final String id)
|
||||
{
|
||||
this.fileName = fileName;
|
||||
|
||||
// we also need to keep the file upload bean in sync
|
||||
final FileUploadBean fileBean = this.getFileUploadBean();
|
||||
if (fileBean != null)
|
||||
fileBean.setFileName(this.fileName);
|
||||
// try and retrieve the file and filename from the file upload bean
|
||||
// representing the file we previously uploaded.
|
||||
final FileUploadBean fileBean = this.getFileUploadBean(id);
|
||||
return fileBean != null ? fileBean.getFile() : null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,19 +249,9 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
*/
|
||||
public File getSchemaFile()
|
||||
{
|
||||
// try and retrieve the file and filename from the file upload bean
|
||||
// representing the file we previously uploaded.
|
||||
final FileUploadBean fileBean = this.getFileUploadBean();
|
||||
return fileBean != null ? fileBean.getFile() : null;
|
||||
return this.getFile("schema");
|
||||
}
|
||||
|
||||
public void setSchemaFile(File f)
|
||||
{
|
||||
// we also need to keep the file upload bean in sync
|
||||
final FileUploadBean fileBean = this.getFileUploadBean();
|
||||
if (fileBean != null)
|
||||
fileBean.setFile(f);
|
||||
}
|
||||
/**
|
||||
* @return Returns the schema file or <tt>null</tt>
|
||||
*/
|
||||
@@ -200,25 +259,51 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
{
|
||||
// try and retrieve the file and filename from the file upload bean
|
||||
// representing the file we previously uploaded.
|
||||
return getFileName();
|
||||
return this.getFileName("schema");
|
||||
}
|
||||
|
||||
public void setSchemaFileName(String s)
|
||||
/**
|
||||
* @return Returns the schema file or <tt>null</tt>
|
||||
*/
|
||||
public String getPresentationTemplateFileName()
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
return this.getFileName("pt");
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the presentationTemplate file or <tt>null</tt>
|
||||
*/
|
||||
public File getPresentationTemplateFile()
|
||||
{
|
||||
return this.getFile("pt");
|
||||
}
|
||||
|
||||
public TemplateType getTemplateType()
|
||||
throws ParserConfigurationException,
|
||||
SAXException,
|
||||
IOException
|
||||
{
|
||||
if (this.getSchemaFile() == null)
|
||||
return null;
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
final String rootTagName =
|
||||
this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
final Document d = ts.parseXML(this.getSchemaFile());
|
||||
final TemplateType result = ts.newTemplateType(rootTagName, d);
|
||||
if (this.getPresentationTemplateFile() != null)
|
||||
{
|
||||
result .addOutputMethod(new XSLTOutputMethod(this.getPresentationTemplateFile()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public String getFormURL()
|
||||
{
|
||||
try
|
||||
{
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
final String rootTagName =
|
||||
this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
final Document d = ts.parseXML(this.getSchemaFile());
|
||||
this.tt = ts.newTemplateType(rootTagName, d);
|
||||
final TemplateInputMethod tim = tt.getInputMethods()[0];
|
||||
return tim.getInputURL(tt.getSampleXml(rootTagName), tt);
|
||||
final TemplateType tt = this.getTemplateType();
|
||||
final TemplateInputMethod tim = tt.getInputMethods().get(0);
|
||||
return tim.getInputURL(tt.getSampleXml(tt.getName()), tt);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
@@ -227,24 +312,35 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
}
|
||||
}
|
||||
|
||||
public String getSchemaFormURL()
|
||||
{
|
||||
try
|
||||
{
|
||||
final TemplatingService ts = TemplatingService.getInstance();
|
||||
final String rootTagName =
|
||||
this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
final Document d = ts.parseXML(this.getSchemaFile());
|
||||
this.tt = ts.newTemplateType(rootTagName, d);
|
||||
final TemplateInputMethod tim = tt.getInputMethods()[0];
|
||||
return tim.getSchemaInputURL(tt);
|
||||
}
|
||||
catch (Throwable t)
|
||||
{
|
||||
t.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// public String getSchemaFormURL()
|
||||
// {
|
||||
// try
|
||||
// {
|
||||
// final TemplatingService ts = TemplatingService.getInstance();
|
||||
// final String rootTagName =
|
||||
// this.getSchemaFileName().replaceAll("([^\\.])\\..+", "$1");
|
||||
// final Document d = ts.parseXML(this.getSchemaFile());
|
||||
// this.tt = ts.newTemplateType(rootTagName, d);
|
||||
// final TemplateInputMethod tim = tt.getInputMethods()[0];
|
||||
// return tim.getSchemaInputURL(tt);
|
||||
// }
|
||||
// catch (Throwable t)
|
||||
// {
|
||||
// t.printStackTrace();
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
|
||||
/**
|
||||
* @return Returns a list of mime types to allow the user to select from
|
||||
*/
|
||||
public List<SelectItem> getCreatePresentationTemplateTypes()
|
||||
{
|
||||
return (List<SelectItem>)Arrays.asList(new SelectItem[] {
|
||||
new SelectItem("freemarker", "FreeMarker"),
|
||||
new SelectItem("xslt", "XSLT")
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the summary data for the wizard.
|
||||
@@ -254,12 +350,16 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
ResourceBundle bundle = Application.getBundle(FacesContext.getCurrentInstance());
|
||||
|
||||
// TODO: show first few lines of content here?
|
||||
return buildSummary(
|
||||
new String[] {bundle.getString("file_name"),
|
||||
bundle.getString("type"),
|
||||
bundle.getString("content_type")},
|
||||
new String[] {this.fileName, getSummaryObjectType(),
|
||||
getSummaryMimeType(this.mimeType)});
|
||||
return buildSummary(new String[] {
|
||||
"Schema File",
|
||||
"Presentation Template Type",
|
||||
"Presentation Template"
|
||||
},
|
||||
new String[] {
|
||||
this.getSchemaFileName(),
|
||||
this.getPresentationTemplateType(),
|
||||
this.getPresentationTemplateFileName()
|
||||
});
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
@@ -268,20 +368,28 @@ public class CreateXmlContentTypeWizard extends BaseContentWizard
|
||||
// ------------------------------------------------------------------------------
|
||||
// Service Injection
|
||||
|
||||
/**
|
||||
* @param contentService The contentService to set.
|
||||
*/
|
||||
public void setContentService(ContentService contentService)
|
||||
{
|
||||
this.contentService = contentService;
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
// Helper Methods
|
||||
|
||||
/**
|
||||
*/
|
||||
protected void clearUpload()
|
||||
protected void clearUpload(final String id)
|
||||
{
|
||||
// remove the file upload bean from the session
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
FileUploadBean fileBean = (FileUploadBean)ctx.getExternalContext().getSessionMap().
|
||||
get(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
|
||||
FileUploadBean fileBean = (FileUploadBean)
|
||||
ctx.getExternalContext().getSessionMap().
|
||||
get(FileUploadBean.getKey(id));
|
||||
if (fileBean != null)
|
||||
fileBean.setFile(null);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user