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:
Ariel Backenroth
2006-08-09 23:09:35 +00:00
parent fe784a4936
commit 9e0e9626d1
23 changed files with 513 additions and 486 deletions

View File

@@ -636,6 +636,7 @@ create_xml_content_type_step2_title=Edit the XML Schema
create_xml_content_type_step2_desc=This is the generated XForm based on the schema provided.
edit_xml_schema=Edit XML Schema
template_type=Template Type
configure_presentation_templates=Configure Presentation Templates
# Rule and Action Wizard messages
run_action_title=Run Action Wizard

View File

@@ -182,7 +182,7 @@
<step name="configure_presentation_templates"
title-id="configure_presentation_templates"
description-id="create_xml_content_type_step2_desc">
<page path="/jsp/content/create-xml-content-type-wizard/configure_presentation_templates.jsp"
<page path="/jsp/content/create-xml-content-type-wizard/configure-presentation-templates.jsp"
title-id="create_xml_content_type_step2_title"
description-id="create_xml_content_type_step2_desc"
instruction-id="default_instruction" />

View File

@@ -53,6 +53,7 @@ public class UploadFileServlet extends BaseServlet
protected void service(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
String uploadId = null;
String returnPage = null;
boolean isMultipart = ServletFileUpload.isMultipartContent(request);
@@ -92,6 +93,10 @@ public class UploadFileServlet extends BaseServlet
{
returnPage = item.getString();
}
else if (item.getFieldName().equalsIgnoreCase("upload-id"))
{
uploadId = item.getString();
}
}
else
{
@@ -121,9 +126,10 @@ public class UploadFileServlet extends BaseServlet
bean.setFile(tempFile);
bean.setFileName(filename);
bean.setFilePath(tempFile.getAbsolutePath());
session.setAttribute(FileUploadBean.FILE_UPLOAD_BEAN_NAME, bean);
session.setAttribute(FileUploadBean.getKey(uploadId), bean);
if (logger.isDebugEnabled())
logger.debug("Temp file: " + tempFile.getAbsolutePath() + " created from upload filename: " + filename);
logger.debug("Temp file: " + tempFile.getAbsolutePath() +
" created from upload filename: " + filename);
}
}
}

View File

@@ -565,7 +565,9 @@ public class CheckinCheckoutBean
MimetypeMap.MIMETYPE_JAVASCRIPT.equals(mimetype))
{
// make content available to the editing screen
setEditorOutput(reader.getContentString());
String contentString = reader.getContentString();
setDocumentContent(contentString);
setEditorOutput(contentString);
// navigate to appropriate screen
FacesContext fc = FacesContext.getCurrentInstance();

View File

@@ -25,7 +25,15 @@ import java.io.File;
*/
public final class FileUploadBean
{
public static final String FILE_UPLOAD_BEAN_NAME = "alfresco.UploadBean";
public static String getKey(final String id)
{
return (id == null
? FILE_UPLOAD_BEAN_NAME
: FILE_UPLOAD_BEAN_NAME + "-" + id);
}
private File file;
private String fileName;

View File

@@ -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

View File

@@ -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");
}
}

View File

@@ -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);
}
}

View File

@@ -9,6 +9,7 @@ import javax.transaction.UserTransaction;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
@@ -255,4 +256,13 @@ public abstract class BaseDialogBean implements IDialogBean
FacesContext.getCurrentInstance(), getErrorMessageId()),
exception.getMessage());
}
protected NodeRef getContainerNodeRef()
{
String nodeId = this.navigator.getCurrentNodeId();
return (nodeId == null
? this.nodeService.getRootNode(Repository.getStoreRef())
: new NodeRef(Repository.getStoreRef(), nodeId));
}
}

View File

@@ -25,5 +25,6 @@ public interface TemplateOutputMethod
public void generate(final Document xmlContent,
final TemplateType tt,
final Writer out);
final Writer out)
throws Exception;
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.templating;
import org.w3c.dom.Document;
import java.util.List;
public interface TemplateType
{
@@ -27,7 +28,9 @@ public interface TemplateType
public Document getSampleXml(final String rootTagName);
public TemplateInputMethod[] getInputMethods();
public List<TemplateInputMethod> getInputMethods();
public TemplateOutputMethod[] getOutputMethods();
public void addOutputMethod(TemplateOutputMethod output);
public List<TemplateOutputMethod> getOutputMethods();
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.templating.xforms;
import java.io.*;
import java.util.*;
import javax.xml.parsers.ParserConfigurationException;
import org.alfresco.util.TempFileProvider;
@@ -36,6 +37,7 @@ public class TemplateTypeImpl
private final Document schema;
private final String name;
private final LinkedList outputMethods = new LinkedList();
public TemplateTypeImpl(final String name,
final Document schema)
@@ -131,15 +133,20 @@ public class TemplateTypeImpl
}
}
public TemplateInputMethod[] getInputMethods()
public List<TemplateInputMethod> getInputMethods()
{
return new TemplateInputMethod[] {
new XFormsInputMethod()
};
return (List<TemplateInputMethod>)Arrays.asList(new TemplateInputMethod[] {
new XFormsInputMethod()
});
}
public TemplateOutputMethod[] getOutputMethods()
public void addOutputMethod(TemplateOutputMethod output)
{
return new TemplateOutputMethod[0];
this.outputMethods.add(output);
}
public List<TemplateOutputMethod> getOutputMethods()
{
return this.outputMethods;
}
}

View File

@@ -18,9 +18,6 @@ package org.alfresco.web.templating.xforms.schemabuilder;
import org.apache.commons.jxpath.JXPathContext;
import org.apache.commons.jxpath.Pointer;
import org.apache.log4j.ConsoleAppender;
import org.apache.log4j.Layout;
import org.apache.log4j.SimpleLayout;
import org.apache.xerces.xs.*;
import org.chiba.xml.util.DOMUtil;
import org.chiba.xml.xforms.NamespaceCtx;
@@ -32,8 +29,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import java.io.File;
import java.io.IOException;
import java.io.StringWriter;
@@ -581,10 +576,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
else if (o != null)
{
if (LOGGER.isDebugEnabled())
{
LOGGER.debug("DOMImplementation is not a XSImplementation: "
+ o.getClass().getName());
}
throw new RuntimeException(o.getClass().getName() + " is not a XSImplementation");
}
}
@@ -834,13 +827,15 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
public void endFormControl(Element controlElement,
XSTypeDefinition controlType,
int minOccurs,
int maxOccurs) {
int maxOccurs)
{
}
/**
* __UNDOCUMENTED__
*/
public void reset() {
public void reset()
{
//refCounter = 0;
counter = new HashMap();
setProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP);
@@ -1039,35 +1034,26 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
return chibaNSPrefix;
}
/* Increments the xforms:ref attribute counter.
*
*/
/*protected long incRefCounter() {
return refCounter++;
}*/
protected String setXFormsId(Element el) {
//remove the eventuel "id" attribute
if (el.hasAttributeNS(SchemaFormBuilder.XFORMS_NS, "id")) {
if (el.hasAttributeNS(SchemaFormBuilder.XFORMS_NS, "id"))
el.removeAttributeNS(SchemaFormBuilder.XFORMS_NS, "id");
}
//long count=this.incIdCounter();
long count = 0;
String name = el.getLocalName();
Long l = (Long) counter.get(name);
if (l != null) {
if (l != null)
count = l.longValue();
}
String id = name + "_" + count;
//increment the counter
counter.put(name, new Long(count + 1));
el.setAttributeNS(SchemaFormBuilder.XFORMS_NS,
this.getXFormsNSPrefix() + "id",
id);
this.getXFormsNSPrefix() + "id",
id);
return id;
}
@@ -1122,7 +1108,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
Iterator iterator = sortedList.iterator();
while (iterator.hasNext()) {
while (iterator.hasNext())
{
String textValue = (String) iterator.next();
Element item =
xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "item");
@@ -1147,8 +1134,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
protected void addChoicesForSelectSwitchControl(Document xForm,
Element choicesElement,
Vector choiceValues,
HashMap case_types) {
HashMap case_types)
{
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("addChoicesForSelectSwitchControl, values=");
Iterator it = choiceValues.iterator();
@@ -1205,9 +1192,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
action.setAttributeNS(XMLEVENTS_NS, xmleventsNSPrefix + "event", "xforms-select");
Element toggle =
xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "toggle");
Element toggle = xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "toggle");
this.setXFormsId(toggle);
//build the case element
@@ -1277,10 +1263,6 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
return null;
}
private XSModel getSchema() {
return schema;
}
public XSParticle findCorrespondingParticleInComplexType(XSElementDeclaration elDecl) {
XSParticle thisParticle = null;
@@ -2122,7 +2104,7 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
//
//controlType = getSchema().getComplexType((String)enumValues.get(0));
controlType =
getSchema().getTypeDefinition((String) enumValues.get(0),
this.schema.getTypeDefinition((String) enumValues.get(0),
targetNamespace);
}
} else if (LOGGER.isDebugEnabled())
@@ -2544,9 +2526,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
+ ", maxOccurs=" + maxOccurs);
//repeatSection = (Element) formSection.appendChild(xForm.createElementNS(XFORMS_NS,getXFormsNSPrefix() + "repeat"));
repeatSection =
xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "repeat");
repeatSection = xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "repeat");
//bind instead of repeat
//repeatSection.setAttributeNS(XFORMS_NS,getXFormsNSPrefix() + "nodeset",pathToRoot);
@@ -2569,19 +2550,18 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
bind =
DOMUtil.getLastChildElement(modelSection.getParentNode());
if ((bind != null)
&& (bind.getLocalName() != null)
&& bind.getLocalName().equals("bind")) {
bindId =
bind.getAttributeNS(SchemaFormBuilder.XFORMS_NS, "id");
if ((bind != null) &&
(bind.getLocalName() != null) &&
bind.getLocalName().equals("bind")) {
bindId = bind.getAttributeNS(SchemaFormBuilder.XFORMS_NS, "id");
} else {
LOGGER.warn("addRepeatIfNecessary: bind really not found");
}
}
repeatSection.setAttributeNS(XFORMS_NS,
getXFormsNSPrefix() + "bind",
bindId);
getXFormsNSPrefix() + "bind",
bindId);
this.setXFormsId(repeatSection);
//appearance=full is more user friendly
@@ -2591,20 +2571,19 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
//triggers
this.addTriggersForRepeat(xForm,
formSection,
repeatSection,
minOccurs,
maxOccurs,
bindId);
formSection,
repeatSection,
minOccurs,
maxOccurs,
bindId);
Element controlWrapper =
_wrapper.createControlsWrapper(repeatSection);
formSection.appendChild(controlWrapper);
//add a group inside the repeat?
Element group =
xForm.createElementNS(XFORMS_NS,
this.getXFormsNSPrefix() + "group");
Element group = xForm.createElementNS(XFORMS_NS,
this.getXFormsNSPrefix() + "group");
this.setXFormsId(group);
repeatSection.appendChild(group);
repeatSection = group;
@@ -2627,11 +2606,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
int maxOccurs) {
if (LOGGER.isDebugEnabled())
LOGGER.debug("addSimpleType for "
+ controlType.getName()
+ " (owningElementName="
+ owningElementName
+ ")");
LOGGER.debug("addSimpleType for " + controlType.getName() +
" (owningElementName=" + owningElementName + ")");
// create the <xforms:bind> element and add it to the model.
Element bindElement = xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "bind");
@@ -2656,14 +2632,13 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
}
//eventual repeat
Element repeatSection =
addRepeatIfNecessary(xForm,
modelSection,
formSection,
controlType,
minOccurs,
maxOccurs,
pathToRoot);
Element repeatSection = addRepeatIfNecessary(xForm,
modelSection,
formSection,
controlType,
minOccurs,
maxOccurs,
pathToRoot);
// create the form control element
//put a wrapper for the repeat content, but only if it is really a repeat
@@ -2701,14 +2676,13 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
String caption = createCaption(owningElementName);
//Element formControl = (Element) contentWrapper.appendChild(createFormControl(xForm,caption,controlType,bindId,bindElement,minOccurs,maxOccurs));
Element formControl =
createFormControl(xForm,
caption,
controlType,
bindId,
bindElement,
minOccurs,
maxOccurs);
Element formControl = createFormControl(xForm,
caption,
controlType,
bindId,
bindElement,
minOccurs,
maxOccurs);
Element controlWrapper = _wrapper.createControlsWrapper(formControl);
contentWrapper.appendChild(controlWrapper);
@@ -2717,8 +2691,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
//
if (!repeatSection.equals(formSection)) {
formControl.setAttributeNS(XFORMS_NS,
getXFormsNSPrefix() + "ref",
".");
getXFormsNSPrefix() + "ref",
".");
}
Element hint = createHint(xForm, owner);
@@ -2745,14 +2719,14 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
int[] occurance = this.getOccurance(owner);
addSimpleType(xForm,
modelSection,
formSection,
controlType,
owner.getName(),
owner,
pathToRoot,
occurance[0],
occurance[1]);
modelSection,
formSection,
controlType,
owner.getName(),
owner,
pathToRoot,
occurance[0],
occurance[1]);
}
private void addSimpleType(Document xForm,
@@ -2763,14 +2737,14 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
String pathToRoot) {
addSimpleType(xForm,
modelSection,
formSection,
controlType,
owningAttribute.getAttrDeclaration().getName(),
owningAttribute,
pathToRoot,
owningAttribute.getRequired() ? 1 : 0,
1);
modelSection,
formSection,
controlType,
owningAttribute.getAttrDeclaration().getName(),
owningAttribute,
pathToRoot,
owningAttribute.getRequired() ? 1 : 0,
1);
}
/**
@@ -3075,19 +3049,13 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
formControl = createControlForAnyType(xForm, caption, controlType);
}
if (formControl == null) {
// default situation - use an input control
//
formControl =
createControlForAtomicType(xForm,
caption,
(XSSimpleTypeDefinition) controlType);
}
if (formControl == null)
formControl = createControlForAtomicType(xForm,
caption,
(XSSimpleTypeDefinition)controlType);
startFormControl(formControl, controlType);
formControl.setAttributeNS(XFORMS_NS,
getXFormsNSPrefix() + "bind",
bindId);
formControl.setAttributeNS(XFORMS_NS, getXFormsNSPrefix() + "bind", bindId);
//put the label before
// no -> put in the "createControlFor..." methods
@@ -3153,11 +3121,13 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
//if we use XMLSchema types:
//first check if it is a simple type named in the XMLSchema
if (_useSchemaTypes
&& controlType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE
&& typeName != null && !typeName.equals("")
&& schema.getTypeDefinition(typeName, typeNS) != null) { //type is globally defined
//use schema type
if (_useSchemaTypes &&
controlType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE &&
typeName != null && typeName.length() != 0 &&
schema.getTypeDefinition(typeName, typeNS) != null)
{
//type is globally defined
//use schema type
//local type name
String localTypeName = typeName;
@@ -3170,12 +3140,15 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
//completeTypeName = new prefix + local name
result = localTypeName;
if (prefix != null && !prefix.equals(""))
if (prefix != null && prefix.length() != 0)
result = prefix + ":" + localTypeName;
if (LOGGER.isDebugEnabled())
LOGGER.debug("getXFormsTypeName: typeName=" + typeName + ", typeNS=" + typeNS + ", result=" + result);
} else { //use built in type
}
else
{
//use built in type
result = this.getDataTypeName(getBuiltInType(controlType));
}
return result;
@@ -3184,8 +3157,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
private Document createFormTemplate(String formId)
throws IOException, ParserConfigurationException {
return createFormTemplate(formId,
"Form " + formId,
getProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP));
"Form " + formId,
getProperty(CSS_STYLE_PROP, DEFAULT_CSS_STYLE_PROP));
}
private Document createFormTemplate(String formId,
@@ -3254,7 +3227,10 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "group");
groupElement = startFormGroup(groupElement, owner);
if (groupElement != null) {
if (groupElement == null)
groupElement = modelSection;
else
{
this.setXFormsId(groupElement);
Element controlsWrapper =
@@ -3268,17 +3244,7 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
getXFormsNSPrefix() + "label"));
this.setXFormsId(captionElement);
captionElement.appendChild(xForm.createTextNode(createCaption(owner)));
//no hint in groups
/*Element hint = createHint(xForm,owner);
if (hint != null) {
groupElement.appendChild(hint);
}*/
} else {
groupElement = modelSection;
}
return groupElement;
}
@@ -3293,7 +3259,8 @@ public abstract class AbstractSchemaFormBuilder implements SchemaFormBuilder {
private String getElementName(XSElementDeclaration element, Document xForm) {
String elementName = element.getName();
String namespace = element.getNamespace();
if (namespace != null && !namespace.equals("")) {
if (namespace != null && namespace.length() != 0)
{
String prefix;
if ((prefix = (String) namespacePrefixes.get(namespace)) == null) {
String basePrefix = (namespace.substring(namespace.lastIndexOf('/', namespace.length()-2)+1));

View File

@@ -241,14 +241,13 @@ public class BaseSchemaFormBuilder
Element control;
//remove while select1 do not work correctly in repeats
if ((controlType.getName() != null)
&& controlType.getName().equals("boolean")) {
control =
xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "select1");
if ("boolean".equals(controlType.getName()))
{
control = xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "select1");
control.setAttributeNS(XFORMS_NS,
getXFormsNSPrefix() + "appearance",
"full");
getXFormsNSPrefix() + "appearance",
"full");
this.setXFormsId(control);
Element item_true =
@@ -286,16 +285,17 @@ public class BaseSchemaFormBuilder
value_false.appendChild(value_false_text);
item_false.appendChild(value_false);
control.appendChild(item_false);
} else {
control =
xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "input");
}
else
{
control = xForm.createElementNS(XFORMS_NS, getXFormsNSPrefix() + "input");
this.setXFormsId(control);
}
//label
Element captionElement =
(Element) control.appendChild(xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "label"));
Element captionElement = (Element)
control.appendChild(xForm.createElementNS(XFORMS_NS,
getXFormsNSPrefix() + "label"));
this.setXFormsId(captionElement);
captionElement.appendChild(xForm.createTextNode(caption));

View File

@@ -298,16 +298,17 @@ public class ChibaServlet extends HttpServlet {
//set parameters
uiGenerator.setParameter("contextroot",request.getContextPath());
uiGenerator.setParameter("action-url",actionURL);
uiGenerator.setParameter("debug-enabled", true /*String.valueOf(logger.isDebugEnabled()) */);
String selectorPrefix = Config.getInstance().getProperty(HttpRequestHandler.SELECTOR_PREFIX_PROPERTY,
HttpRequestHandler.SELECTOR_PREFIX_DEFAULT);
uiGenerator.setParameter("debug-enabled", String.valueOf(logger.isDebugEnabled()));
String selectorPrefix =
Config.getInstance().getProperty(HttpRequestHandler.SELECTOR_PREFIX_PROPERTY,
HttpRequestHandler.SELECTOR_PREFIX_DEFAULT);
uiGenerator.setParameter("selector-prefix", selectorPrefix);
String removeUploadPrefix = Config.getInstance().getProperty(HttpRequestHandler.REMOVE_UPLOAD_PREFIX_PROPERTY,
HttpRequestHandler.REMOVE_UPLOAD_PREFIX_DEFAULT);
String removeUploadPrefix =
Config.getInstance().getProperty(HttpRequestHandler.REMOVE_UPLOAD_PREFIX_PROPERTY,
HttpRequestHandler.REMOVE_UPLOAD_PREFIX_DEFAULT);
uiGenerator.setParameter("remove-upload-prefix", removeUploadPrefix);
if (css != null) {
if (css != null)
uiGenerator.setParameter("css-file", css);
}
String dataPrefix = Config.getInstance().getProperty("chiba.web.dataPrefix");
uiGenerator.setParameter("data-prefix", dataPrefix);

View File

@@ -29,7 +29,7 @@ CreateContentWizard ccw = (CreateContentWizard)
FacesHelper.getManagedBean(FacesContext.getCurrentInstance(), "CreateContentWizard");
TemplateType tt = ts.getTemplateType(ccw.getTemplateType());
final TemplateInputMethod tim = tt.getInputMethods()[0];
final TemplateInputMethod tim = tt.getInputMethods().get(0);
String url = tim.getInputURL(tt.getSampleXml(tt.getName()), tt);
%>
<f:verbatim>

View File

@@ -84,16 +84,6 @@
<h:panelGrid id="panel_grid_2"
columns="3" cellpadding="3" cellspacing="3" border="0">
<%--
<h:graphicImage id="required_image_name"
value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="output_text_name"
value="#{msg.name}:"/>
<h:inputText id="file-name" value="#{WizardManager.bean.fileName}"
maxlength="1024" size="35"
onkeyup="checkButtonState();"
onchange="checkButtonState();" />
--%>
<h:graphicImage id="required_image_schema"
value="/images/icons/required_field.gif" alt="Required Field" />
<h:outputText id="output_text_schema"
@@ -101,11 +91,12 @@
<h:column id="column_schema">
<%
FileUploadBean upload = (FileUploadBean)
session.getAttribute(FileUploadBean.FILE_UPLOAD_BEAN_NAME);
session.getAttribute(FileUploadBean.getKey("schema"));
if (upload == null || upload.getFile() == null)
{
%>
<f:verbatim>
<input type="hidden" name="upload-id" value="schema"/>
<input type="hidden" name="return-page" value="<%= request.getContextPath() %>/faces<%= request.getServletPath() %>"/>
<input id="wizard:wizard-body:file-input" type="file" size="35" name="alfFileInput" onchange="javascript:upload_file(this)"/>
</f:verbatim>
@@ -128,23 +119,3 @@ if (upload == null || upload.getFile() == null)
%>
</h:column>
</h:panelGrid>
<h:panelGrid id="panel_grid_3"
columns="1" cellpadding="3" cellspacing="3" border="0" style="padding-top: 4px;"
width="100%" rowClasses="wizardSectionHeading, paddingRow"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:outputText id="panel_grid_3_output_text_1"
value="&nbsp;#{msg.other_properties}" escape="false" />
<h:outputText id="panel_grid_3_output_text_2"
value="#{msg.modify_props_help_text}" />
</h:panelGrid>
<h:panelGrid id="panel_grid_4"
style="padding-top: 2px;" columns="2"
rendered="#{WizardManager.bean.otherPropertiesChoiceVisible}">
<h:selectBooleanCheckbox id="panel_grid_3_select_boolean_checkbox"
value="#{WizardManager.bean.showOtherProperties}" />
<h:outputText id="panel_grid_4_output_text_1"
value="#{msg.modify_props_when_wizard_closes}" />
</h:panelGrid>

View File

@@ -25,7 +25,7 @@ function set_edit_mode(on)
{
var iframe = document.getElementById("editor");
editor.setAttribute("src",
on ? "</f:verbatim><h:outputText value="#{WizardManager.bean.schemaFormURL}" escape="false"/><f:verbatim>"
on ? "</f:verbatim><h:outputText value="not_implemented" escape="false"/><f:verbatim>"
: "</f:verbatim><h:outputText value="#{WizardManager.bean.formURL}" escape="false"/><f:verbatim>");
}
</script>

View File

@@ -32,15 +32,14 @@ xml = xml.replaceAll("<", "&lt;");
<html>
<head>
<title>Instance Data submitted</title>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/forms/styles/chiba-styles.css"/>
<link rel="stylesheet" type="text/css" href="<%=request.getContextPath()%>/css/main.css"/>
</head>
<body>
<center>
<font face="sans-serif">XML submitted successfully! you rock! Click next!</font>
</center>
<center><tt>
<div class="mainSubTitle">
XML submitted successfully! you rock! Click next!
</div>
<tt>
<%= xml %>
<tt></center>
<tt>
</body>
</html>

View File

@@ -33,7 +33,6 @@ form{
.inactive{
display:none;
}
#legend{padding:3px;}
a.link{color:#444444;}
a.visited{color:#444444;}
@@ -53,49 +52,26 @@ appearance class 'minimal-group|compact-group|full-group'. */
background: white;
margin-bottom:5px;
}
/* IE */
fieldset{
margin-bottom:5px;
}
/*********** used to render group labels ***********/
fieldset > legend {
padding: 3px;
width: 100%;
border: thin solid rgb(55, 71, 90);
background: white; /*#F0F4EA;*/
color: rgb( 85, 96, 63 );
background-color: #cddbe8;
margin-top:5px;
margin-bottom:5px;
color: #003366;
font-weight: bold;
}
/* IE */
fieldset legend{
padding: 3px;
border: thin solid rgb(55, 71, 90);
color: rgb( 85, 96, 63 );
margin-top:5px;
margin-bottom:5px;
}
/*********** use to render group labels ***********/
.legend{
border:thin groove;
color:#888888;
text-align:center;
}
/*********** nested group ***********/
fieldset > fieldset {
margin:5px;
/* margin:5px; */
background-color: white; /*rgb(82, 90, 99); */
padding-top:0px;
}
/* IE */
fieldset fieldset{
margin:5px;
}
/*********** nested nested group ***********/
fieldset > fieldset > fieldset {
margin:5px;
@@ -192,8 +168,8 @@ fieldset > fieldset > fieldset {
.label{
color:rgb(85, 96, 63);
padding-right: 5px;
color: #003366;
padding-right: 10px;
}
/*
.help-symbol{

View File

@@ -26,7 +26,7 @@
<!-- build input control -->
<xsl:template name="input">
<td>
<xsl:variable name="repeat-id" select="ancestor::*[name(.)='xforms:repeat'][1]/@id" />
<xsl:variable name="pos" select="position()" />
<xsl:variable name="id" select="@id" />
@@ -117,38 +117,7 @@
</xsl:element>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- build image trigger / submit -->
<xsl:template name="image-trigger">
<xsl:element name="input">
<xsl:variable name="id" select="@id"/>
<xsl:variable name="repeat-id" select="ancestor::*[name(.)='xforms:repeat'][1]/@id"/>
<xsl:attribute name="id">
<xsl:value-of select="concat($id,'-value')"/>
</xsl:attribute>
<xsl:attribute name="name">
<xsl:value-of select="concat($trigger-prefix,$id)"/>
</xsl:attribute>
<xsl:attribute name="type">image</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="xforms:label"/>
</xsl:attribute>
<xsl:attribute name="title">
<xsl:value-of select="normalize-space(xforms:hint)"/>
</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="xforms:label/@xlink:href"/>
</xsl:attribute>
<xsl:attribute name="class">value</xsl:attribute>
<xsl:if test="chiba:data/@chiba:readonly='true'">
<xsl:attribute name="disabled">disabled</xsl:attribute>
</xsl:if>
<xsl:if test="$scripted='true'">
<xsl:attribute name="onclick">javascript:activate(this);</xsl:attribute>
</xsl:if>
</xsl:element>
</td>
</xsl:template>
<!-- build output -->
@@ -734,16 +703,11 @@
<xsl:attribute name="name">
<xsl:value-of select="concat($trigger-prefix,$id)"/>
</xsl:attribute>
<xsl:choose>
<xsl:when test="$scripted='true'">
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="onclick">javascript:activate(this);</xsl:attribute>
</xsl:when>
<xsl:otherwise>
<xsl:attribute name="type">submit</xsl:attribute>
</xsl:otherwise>
</xsl:choose>
<xsl:attribute name="type">button</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="concat($contextroot, xforms:label/@xlink:href)"/>
</xsl:attribute>
<xsl:attribute name="onclick">javascript:activate(this);</xsl:attribute>
<xsl:attribute name="value">
<xsl:value-of select="xforms:label"/>
</xsl:attribute>

View File

@@ -78,9 +78,8 @@
<title>
<xsl:value-of select="$form-name"/>
</title>
<link rel="shortcut icon" href="forms/images/favicon.ico.gif"/>
<xsl:call-template name="getCSS"/>
<link type="text/css" rel="stylesheet" href="{concat($contextroot,'/css/main.css')}"></link>
<xsl:if test="$scripted='true'">
<!-- PLEASE DON'T CHANGE THE FORMATTING OF THE XSL:TEXT ELEMENTS - THEY PROVIDE CLEAN LINE BREAKS IN THE OUTPUT -->
<!-- for DateControl - only included if dates are used in the form -->
@@ -200,80 +199,45 @@
<!--<xsl:copy-of select="@*"/>-->
<body>
<xsl:copy-of select="@*"/>
<!--
<div>
<a href="jsp/forms.jsp">
<img src="forms/images/chiba50t.gif" style="border:none;" alt="Chiba Logo" width="113" height="39" id="chiba-logo"/>
</a>
</div>
<table border="0">
<tr>
<td></td>
<td>
-->
<div id="loading">
<img src="{concat($contextroot,'/jsp/content/xforms/forms/images/chiba-logo_klein2.gif')}" class="disabled" id="indicator" alt="loading" />
</div>
<xsl:element name="form">
<xsl:attribute name="name">
<xsl:value-of select="$form-id"/>
</xsl:attribute>
<xsl:attribute name="action">
<xsl:value-of select="$action-url"/>
</xsl:attribute>
<xsl:attribute name="method">POST</xsl:attribute>
<xsl:attribute name="enctype">application/x-www-form-urlencoded</xsl:attribute>
<xsl:if test="$uses-upload">
<xsl:attribute name="enctype">multipart/form-data</xsl:attribute>
<xsl:if test="$scripted = 'true'">
<iframe id="UploadTarget" name="UploadTarget" src="" style="width:0px;height:0px;border:0"></iframe>
</xsl:if>
</xsl:if>
<xsl:if test="$scripted != 'true'">
<input type="submit" value="refresh page" class="refresh-button"/>
</xsl:if>
<xsl:element name="form">
<xsl:attribute name="name">
<xsl:value-of select="$form-id"/>
</xsl:attribute>
<xsl:attribute name="action">
<xsl:value-of select="$action-url"/>
</xsl:attribute>
<xsl:attribute name="method">POST</xsl:attribute>
<xsl:attribute name="enctype">application/x-www-form-urlencoded</xsl:attribute>
<xsl:if test="$uses-upload">
<xsl:attribute name="enctype">multipart/form-data</xsl:attribute>
<xsl:if test="$scripted = 'true'">
<iframe id="UploadTarget" name="UploadTarget" src="" style="width:0px;height:0px;border:0"></iframe>
</xsl:if>
</xsl:if>
<xsl:if test="$scripted != 'true'">
<input type="submit" value="refresh page" class="refresh-button"/>
</xsl:if>
<xsl:apply-templates/>
<xsl:if test="$scripted != 'true'">
<input type="submit" value="refresh page" class="refresh-button"/>
</xsl:if>
</xsl:element>
<!--
</td>
</tr>
<tr>
<td/>
<td>
<table width="100%" border="0">
<tr>
<td>
-->
<span id="legend">
<span style="color:#A42322;">*</span> - required |
<b>?</b> - help
</span>
<div id="chiba-logo">
<a href="jsp/forms.jsp">
<img src="forms/images/poweredby.gif" style="border:none;" alt="powered by Chiba"/>
</a>
</div>
<div id="copyright">
<xsl:text disable-output-escaping="yes">&amp;copy; 2001-2005 Chiba Project</xsl:text>
</div>
<!--
</td>
<td align="right">
-->
<!--
</td>
</tr>
</table>
</td>
</tr>
</table>
-->
<xsl:apply-templates/>
<xsl:if test="$scripted != 'true'">
<input type="submit" value="refresh page" class="refresh-button"/>
</xsl:if>
</xsl:element>
<span id="legend">
<span style="color:#A42322;">*</span> - required |
<b>?</b> - help
</span>
<div id="chiba-logo">
<a href="jsp/forms.jsp">
<img src="forms/images/poweredby.gif" style="border:none;" alt="powered by Chiba"/>
</a>
</div>
<div id="copyright">
<xsl:text disable-output-escaping="yes">&amp;copy; 2001-2005 Chiba Project</xsl:text>
</div>
<xsl:if test="$debug-enabled='true' and $scripted='true'">
<form id="debugform" name="debugform" action="" onsubmit="return false;">
<textarea id="debugarea" name="debugarea" rows="5" cols="15"></textarea>
@@ -359,6 +323,15 @@
<xsl:template match="xforms:label">
<xsl:variable name="group-id" select="ancestor::xforms:group[1]/@id"/>
<xsl:variable name="img" select="@xforms:src"/>
<xsl:if test="../chiba:data/@chiba:required='true'">
<xsl:element name="img">
<xsl:attribute name="class">required-symbol</xsl:attribute>
<xsl:attribute name="style">margin-right: 10px;</xsl:attribute>
<xsl:attribute name="src">
<xsl:value-of select="concat($contextroot, '/images/icons/required_field.gif')"/>
</xsl:attribute>
</xsl:element>
</xsl:if>
<xsl:choose>
<!--
@@ -386,7 +359,6 @@
<xsl:apply-templates/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="../chiba:data/@chiba:required='true'"><span class="required-symbol">*</span></xsl:if>
</xsl:template>
<!-- ### handle hint ### -->

View File

@@ -33,9 +33,9 @@ NodeRef nr = ccb.getDocument().getNodeRef();
String ttName = (String)ccb.getNodeService().getProperty(nr, CreateContentWizard.TT_QNAME);
TemplatingService ts = TemplatingService.getInstance();
TemplateType tt = ts.getTemplateType(ttName);
TemplateInputMethod tim = tt.getInputMethods()[0];
System.out.println("tt " + tt);
TemplateInputMethod tim = tt.getInputMethods().get(0);
String url = tim.getInputURL(ts.parseXML(ccb.getDocumentContent()), tt);
System.out.println("TTTTTT " + tt);
System.out.println("inputurl " + url);
%>
<r:page titleId="title_edit_text_inline">