[opencms-dev] Create a txt file with fixed header/footer
Paoletti Corrado
c.paoletti at fineco.it
Tue Nov 18 17:36:51 CET 2014
Hi,
I have modified the XSD file using both OpenCmsString and OpenCmsHtml but the problem still remains.
I do not understand why you introduced <xsd:annotation> but I have trust in you! ;-)
Corrado
-----Original Message-----
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Schliemann, Kai
Sent: martedì 18 novembre 2014 14:28
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi Corrado,
two things:
a. There is a space before TextareaWidget (type=" TextareaWidget") change to type="TextareaWidget") b. Anyway I think you have to define the type "TextareaWidget" in the layouts section.
So your simple-text.xsd should look like this:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="XmlContentDocSimpleTypes" type="OpenCmsXmlContentDocSimpleTypes"/>
<xsd:complexType name="OpenCmsXmlContentDocSimpleTypes">
<xsd:sequence>
<xsd:element name="XmlContentDocSimpleType" type="OpenCmsXmlContentDocSimpleType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsXmlContentDocSimpleType">
<xsd:sequence>
<xsd:element name="SimpleText" type="OpenCmsString" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
</xsd:complexType>
<xsd:annotation>
<xsd:appinfo>
<layouts>
<layout element="SimpleText" widget="TextareaWidgetPlaintext" />
</layouts>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
Please note, that I changed the type to TextareaWidgetPlaintext. Compared to TextareaWidget it strips all HTML code from your Textarea field.
I am not sure about the type="OpenCmsString" in the element section. You possibly need OpenCmsHtml. You have to check that out.
HTH.
Best regards
Kai
-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Paoletti Corrado
Gesendet: Dienstag, 18. November 2014 13:54
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi Kai,
I'm following your suggestion.
1) I have created a XSD (simple-text.xsd) starting by page you suggested:
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xsd:include schemaLocation="opencms://opencms-xmlcontent.xsd"/>
<xsd:element name="XmlContentDocSimpleTypes" type="OpenCmsXmlContentDocSimpleTypes"/>
<xsd:complexType name="OpenCmsXmlContentDocSimpleTypes">
<xsd:sequence>
<xsd:element name="XmlContentDocSimpleType" type="OpenCmsXmlContentDocSimpleType" minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="OpenCmsXmlContentDocSimpleType">
<xsd:sequence>
<xsd:element name="SimpleText" type=" TextareaWidget" />
</xsd:sequence>
<xsd:attribute name="language" type="OpenCmsLocale" use="required"/>
</xsd:complexType>
</xsd:schema>
2) I have created a JSP (simple-text.jsp):
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
<div class="element">
<cms:contentload collector="singleFile" param="%(opencms.uri)" editable="true">
<p>
<cms:contentshow element="SimpleText" /> </p>
</cms:contentload>
</div>
3) then I have created a html file with xmlcontent type and template-elements = "simple-text.jsp ". When I try to edit it I have "An unexpected error happened, but no error message has been provided. " and error log is:
java.lang.NullPointerException
at org.opencms.xml.content.CmsXmlContent.getContentDefinition(CmsXmlContent.java:786)
at org.opencms.xml.content.CmsXmlContent.<init>(CmsXmlContent.java:132)
at org.opencms.xml.content.CmsXmlContentFactory.unmarshal(CmsXmlContentFactory.java:224)
at org.opencms.xml.content.CmsXmlContentFactory.unmarshal(CmsXmlContentFactory.java:160)
at org.opencms.workplace.editors.CmsXmlContentEditor.initWorkplaceRequestValues(CmsXmlContentEditor.java:1524)
at org.opencms.workplace.CmsWorkplace.initWorkplaceMembers(CmsWorkplace.java:1946)
at org.opencms.workplace.CmsWorkplace.<init>(CmsWorkplace.java:250)
at org.opencms.workplace.tools.CmsToolDialog.<init>(CmsToolDialog.java:93)
at org.opencms.workplace.CmsDialog.<init>(CmsDialog.java:260)
at org.opencms.workplace.editors.CmsEditorBase.<init>(CmsEditorBase.java:51)
at org.opencms.workplace.editors.CmsEditor.<init>(CmsEditor.java:201)
at org.opencms.workplace.editors.CmsXmlContentEditor.<init>(CmsXmlContentEditor.java:230)
at org.apache.jsp.WEB_002dINF.jsp.offline.system.workplace.editors.xmlcontent.editor_005fform_jsp._jspService(editor_005fform_jsp.java:59)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:336)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:654)
at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:557)
at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:481)
at org.opencms.flex.CmsFlexRequestDispatcher.includeExternal(CmsFlexRequestDispatcher.java:188)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:163)
at org.opencms.loader.CmsJspLoader.service(CmsJspLoader.java:619)
at org.opencms.flex.CmsFlexRequestDispatcher.includeInternalWithCache(CmsFlexRequestDispatcher.java:417)
at org.opencms.flex.CmsFlexRequestDispatcher.include(CmsFlexRequestDispatcher.java:167)
at org.opencms.loader.CmsJspLoader.dispatchJsp(CmsJspLoader.java:893)
at org.opencms.loader.CmsJspLoader.load(CmsJspLoader.java:524)
at org.opencms.loader.CmsResourceManager.loadResource(CmsResourceManager.java:1049)
at org.opencms.main.OpenCmsCore.showResource(OpenCmsCore.java:1596)
at org.opencms.main.OpenCmsServlet.doGet(OpenCmsServlet.java:153)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
at org.apache.coyote.ajp.AjpProcessor.process(AjpProcessor.java:437)
at org.apache.coyote.ajp.AjpProtocol$AjpConnectionHandler.process(AjpProtocol.java:366)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
at java.lang.Thread.run(Thread.java:595)
Where am I doing wrong?
Many thanks,
Corrado
-----Original Message-----
From: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] On Behalf Of Schliemann, Kai
Sent: venerdì 14 novembre 2014 13:35
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi Corrado,
you could create a XML Content type with just one element. This element uses the TextareaWidget type (more info: https://opencms.cse.unsw.edu.au/alkacon-documentation/documentation_xmlcontent/step3-advancedxsd.html).
HTH
Best regards
Kai
-----Ursprüngliche Nachricht-----
Von: opencms-dev-bounces at opencms.org [mailto:opencms-dev-bounces at opencms.org] Im Auftrag von Paoletti Corrado
Gesendet: Freitag, 14. November 2014 12:06
An: opencms-dev at opencms.org
Betreff: [opencms-dev] Create a txt file with fixed header/footer
Hi all,
I would like to create a template with which to allow editors to create a simple text file (.txt). Each file will have a header and footer and variabile body.
I have created the following simple code (JSP):
<%@ page session="false" %>
<%@ taglib prefix="cms" uri="http://www.opencms.org/taglib/cms" %>
***HEADER***
<cms:include element="body" />
***FOOTER***
When I create a "Page with free text" the editor inserts <p></p> tags around text I'm writing but... I do not want html tags! The best would be have an editor very simple as if I choose to create a "text file".
How can I do it?
I use OpenCms 8.0.1.
Thanks
Corrado
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
_______________________________________________
This mail is sent to you from the opencms-dev mailing list To change your list options, or to unsubscribe from the list, please visit http://lists.opencms.org/cgi-bin/mailman/listinfo/opencms-dev
More information about the opencms-dev
mailing list