cleanup to jsps which render the xform. using a tag to render, removing all the java code. much prettier.

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4168 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ariel Backenroth
2006-10-19 19:14:55 +00:00
parent 1507f7387a
commit 226e840521
9 changed files with 406 additions and 94 deletions

View File

@@ -41,10 +41,13 @@ import org.alfresco.web.bean.FileUploadBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.templating.OutputUtil;
import org.alfresco.web.templating.TemplateType;
import org.alfresco.web.templating.TemplateInputMethod;
import org.alfresco.web.templating.TemplatingService;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
/**
* Bean backing the edit pages for a AVM node content.
@@ -204,7 +207,51 @@ public class AVMEditBean
return MessageFormat.format(msg, new Object[] {getFileName()});
}
/**
* @return Returns the template type when in the context of editing an xml asset.
*/
public TemplateType getTemplateType()
{
final NodeRef ttNodeRef = (NodeRef)
this.nodeService.getProperty(this.getAvmNode().getNodeRef(),
WCMModel.PROP_FORM_DERIVED_FROM);
final TemplatingService ts = TemplatingService.getInstance();
return ts.getTemplateType(ttNodeRef);
}
/**
* @return Returns the wrapper instance data for feeding the xml
* content to the form processor.
*/
public TemplateInputMethod.InstanceData getInstanceData()
{
final TemplateType tt = this.getTemplateType();
final TemplateInputMethod tim = tt.getInputMethods().get(0);
return new TemplateInputMethod.InstanceData()
{
private final TemplatingService ts = TemplatingService.getInstance();
public Document getContent()
{
try
{
final String content = AVMEditBean.this.getEditorOutput();
return content != null ? this.ts.parseXML(content) : null;
}
catch (Exception e)
{
e.printStackTrace();
return null;
}
}
public void setContent(final Document d)
{
AVMEditBean.this.setEditorOutput(this.ts.writeXMLToString(d));
}
};
}
// ------------------------------------------------------------------------------
// Action event handlers