a bunch of refactoring of back end templating wizards. removing the chiba-web stuff as it is no longer used. more updates to dojo generator. adding in an XFormsBean to handle ajax requests from the form.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3500 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-08-14 18:14:21 +00:00
parent 129728f447
commit 0cffbc7aa1
196 changed files with 1245 additions and 28013 deletions

View File

@@ -36,6 +36,7 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.data.IDataContainer;
import org.alfresco.web.data.QuickSort;
import org.alfresco.web.templating.*;
import org.alfresco.web.bean.ajax.XFormsBean;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -44,6 +45,8 @@ 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;
import org.alfresco.web.app.servlet.FacesHelper;
import org.chiba.xml.xforms.exception.XFormsException;
/**
* Bean implementation for the "Create Content Wizard" dialog
@@ -53,7 +56,7 @@ import java.io.OutputStreamWriter;
public class CreateContentWizard extends BaseContentWizard
{
protected String content = null;
protected String templateType;
protected String templateTypeName;
protected List<SelectItem> createMimeTypes;
private static final Log LOGGER =
@@ -71,12 +74,12 @@ public class CreateContentWizard extends BaseContentWizard
{
LOGGER.debug("saving file content to " + this.fileName);
saveContent(null, this.content);
if (this.templateType != null)
if (this.templateTypeName != null)
{
LOGGER.debug("generating template output for " + this.templateType);
this.nodeService.setProperty(this.createdNode, TT_QNAME, this.templateType);
LOGGER.debug("generating template output for " + this.templateTypeName);
this.nodeService.setProperty(this.createdNode, TT_QNAME, this.templateTypeName);
TemplatingService ts = TemplatingService.getInstance();
TemplateType tt = ts.getTemplateType(this.templateType);
TemplateType tt = this.getTemplateType();
if (tt.getOutputMethods().size() != 0)
{
try {
@@ -104,7 +107,7 @@ public class CreateContentWizard extends BaseContentWizard
new OutputStreamWriter(writer.getContentOutputStream());
tom.generate(ts.parseXML(this.content), tt, out);
out.close();
this.nodeService.setProperty(fileNodeRef, TT_QNAME, this.templateType);
this.nodeService.setProperty(fileNodeRef, TT_QNAME, this.templateTypeName);
LOGGER.debug("generated " + fileName + " using " + tom);
}
@@ -127,7 +130,7 @@ public class CreateContentWizard extends BaseContentWizard
this.content = null;
this.inlineEdit = true;
this.templateType = null;
this.templateTypeName = null;
this.mimeType = MimetypeMap.MIMETYPE_HTML;
}
@@ -253,17 +256,23 @@ public class CreateContentWizard extends BaseContentWizard
return this.createMimeTypes;
}
public String getTemplateType()
public String getTemplateTypeName()
{
return this.templateType;
return this.templateTypeName;
}
public TemplateType getTemplateType()
{
final TemplatingService ts = TemplatingService.getInstance();
return ts.getTemplateType(this.getTemplateTypeName());
}
/**
* @param templateType Sets the currently selected template type
*/
public void setTemplateType(String templateType)
public void setTemplateTypeName(final String templateTypeName)
{
this.templateType = templateType;
this.templateTypeName = templateTypeName;
}
/**

View File

@@ -49,6 +49,7 @@ import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
/**
* Bean implementation for the "Create Content Wizard" dialog
*
@@ -292,44 +293,10 @@ public class CreateXmlContentTypeWizard extends BaseWizardBean
final TemplateType result = ts.newTemplateType(rootTagName, d);
if (this.getPresentationTemplateFile() != null)
{
result .addOutputMethod(new XSLTOutputMethod(this.getPresentationTemplateFile()));
result.addOutputMethod(new XSLTOutputMethod(this.getPresentationTemplateFile()));
}
return result;
}
public String getFormURL()
{
try
{
final TemplateType tt = this.getTemplateType();
final TemplateInputMethod tim = tt.getInputMethods().get(0);
return tim.getInputURL(tt.getSampleXml(tt.getName()), 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