[opencms-dev] Create a txt file with fixed header/footer
Schliemann, Kai
K.Schliemann at comundus.com
Wed Nov 19 14:48:10 CET 2014
Hi Corrado,
I am running out of ideas.
Some hints to try:
Create new schema file with the same content as simple-text.xsd.
Create new schema file with just one element of type OpenCmsString (remove annotation section).
Do other schemas you created work?
-->Add the TextareaWidgetPlaintext to one of your working schemas.
There's one other thing. This shouldn't concern the problem you are facing not being able to edit but displaying your page.
Did you add a template into template property or is it inherited from a parent folder?
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: Mittwoch, 19. November 2014 11:22
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi,
I tried yours suggestion even reloading Tomcat but I have same error.
A working example is found in:
/alkacon-documentation/documentation_xmlcontent/simpleexample/
and so I have copied its XSD and JSP code into my simple-text.xsd and simple-text.jsp. Error still remains. So I'm missing something but what?
Thanks,
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 18:07
To: The OpenCms mailing list
Subject: Re: [opencms-dev] Create a txt file with fixed header/footer
Hi Corrado,
I have modified the XSD file using both OpenCmsString and OpenCmsHtml but the problem still remains.
-->Hmm, after applying those changes, did you create a new file of the new type? Editing the old file will probably not work.
You should also clear the core cache or restart Tomcat.
OK, one more idea. In older version you had to define all nodes in the annotation node, even if they are empty.
So try this please:
<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>
<mappings/>
<layouts>
<layout element="SimpleText" widget="TextareaWidgetPlaintext" />
</layouts>
<searchsettings/>
<validationrules/>
<defaults />
<relations/>
</xsd:appinfo>
</xsd:annotation>
</xsd:schema>
-----
I do not understand why you introduced <xsd:annotation> but I have trust in you! ;-)
--> Thanks for trusting me. The reason is, that you cannot use the "TextareaWidgetPlaintext" as type of your element name directly.
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 17:37
An: The OpenCms mailing list
Betreff: Re: [opencms-dev] Create a txt file with fixed header/footer
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
_______________________________________________
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