Bugfix for Foundry: FormItem did not work due to missing hidden fields for the page state
git-svn-id: https://svn.libreccm.org/ccm/trunk@3725 8810af33-2d31-482b-a856-94f89814c4dfmaster
parent
e34ac38a63
commit
6976da93ab
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
package com.arsdigita.cms.formbuilder;
|
package com.arsdigita.cms.formbuilder;
|
||||||
|
|
||||||
|
|
||||||
import com.arsdigita.bebop.Component;
|
import com.arsdigita.bebop.Component;
|
||||||
import com.arsdigita.bebop.Form;
|
import com.arsdigita.bebop.Form;
|
||||||
import com.arsdigita.bebop.Page;
|
import com.arsdigita.bebop.Page;
|
||||||
|
|
@ -56,15 +55,15 @@ import com.arsdigita.web.Web;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
public class FormItem extends ContentPage implements XMLGenerator {
|
public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
public static final String BASE_DATA_OBJECT_TYPE =
|
|
||||||
"com.arsdigita.cms.formbuilder.FormItem";
|
public static final String BASE_DATA_OBJECT_TYPE
|
||||||
|
= "com.arsdigita.cms.formbuilder.FormItem";
|
||||||
|
|
||||||
public static final String REMOTE = "remote";
|
public static final String REMOTE = "remote";
|
||||||
public static final String REMOTE_URL = "remoteUrl";
|
public static final String REMOTE_URL = "remoteUrl";
|
||||||
public static final String FORM = "form";
|
public static final String FORM = "form";
|
||||||
public static final String CSS = "css";
|
public static final String CSS = "css";
|
||||||
|
|
||||||
|
|
||||||
public FormItem() {
|
public FormItem() {
|
||||||
this(BASE_DATA_OBJECT_TYPE);
|
this(BASE_DATA_OBJECT_TYPE);
|
||||||
}
|
}
|
||||||
|
|
@ -73,7 +72,6 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
super(typeName);
|
super(typeName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public FormItem(DataObject obj) {
|
public FormItem(DataObject obj) {
|
||||||
super(obj);
|
super(obj);
|
||||||
}
|
}
|
||||||
|
|
@ -147,18 +145,17 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This returns a string that can be used to locate a
|
* This returns a string that can be used to locate a Cascading Style Sheet
|
||||||
* Cascading Style Sheet that can be used to style this item.
|
* that can be used to style this item. This returns null if no style sheet
|
||||||
* This returns null if no style sheet has been set.
|
* has been set.
|
||||||
*/
|
*/
|
||||||
public String getCSS() {
|
public String getCSS() {
|
||||||
return (String) get(CSS);
|
return (String) get(CSS);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Denotes whether the form is to submit locally or remotely.
|
* Denotes whether the form is to submit locally or remotely. If the form is
|
||||||
* If the form is to be remotely submitted, no validation can be
|
* to be remotely submitted, no validation can be performed.
|
||||||
* performed.
|
|
||||||
*/
|
*/
|
||||||
public boolean isRemote() {
|
public boolean isRemote() {
|
||||||
return Boolean.TRUE.equals(get(REMOTE));
|
return Boolean.TRUE.equals(get(REMOTE));
|
||||||
|
|
@ -194,6 +191,7 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
c.setMethod(Form.GET);
|
c.setMethod(Form.GET);
|
||||||
if (readOnly) {
|
if (readOnly) {
|
||||||
Traversal t = new Traversal() {
|
Traversal t = new Traversal() {
|
||||||
|
|
||||||
public void act(Component c) {
|
public void act(Component c) {
|
||||||
try {
|
try {
|
||||||
Widget widget = (Widget) c;
|
Widget widget = (Widget) c;
|
||||||
|
|
@ -203,6 +201,7 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
// Nada
|
// Nada
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
t.preorder(c);
|
t.preorder(c);
|
||||||
}
|
}
|
||||||
|
|
@ -247,7 +246,6 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
Traversal t = new VisibleTraverse(fake);
|
Traversal t = new VisibleTraverse(fake);
|
||||||
t.preorder(c);
|
t.preorder(c);
|
||||||
|
|
||||||
|
|
||||||
// Simply embed the bebop xml as a child of the cms:item tag
|
// Simply embed the bebop xml as a child of the cms:item tag
|
||||||
Element element = parent.newChildElement("cms:item", CMS.CMS_XML_NS);
|
Element element = parent.newChildElement("cms:item", CMS.CMS_XML_NS);
|
||||||
generateXMLBody(fake, element, c);
|
generateXMLBody(fake, element, c);
|
||||||
|
|
@ -264,8 +262,7 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
|
|
||||||
element.addAttribute(FormBuilderUtil.FORM_ACTION, action);
|
element.addAttribute(FormBuilderUtil.FORM_ACTION, action);
|
||||||
|
|
||||||
FormBuilderXMLRenderer renderer =
|
FormBuilderXMLRenderer renderer = new FormBuilderXMLRenderer(element);
|
||||||
new FormBuilderXMLRenderer(element);
|
|
||||||
renderer.setWrapAttributes(true);
|
renderer.setWrapAttributes(true);
|
||||||
renderer.setWrapRoot(false);
|
renderer.setWrapRoot(false);
|
||||||
renderer.setRevisitFullObject(true);
|
renderer.setRevisitFullObject(true);
|
||||||
|
|
@ -279,13 +276,13 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
// that does not work because we don't pass in the page state
|
// that does not work because we don't pass in the page state
|
||||||
// although that can always we updated.
|
// although that can always we updated.
|
||||||
if (c instanceof Form) {
|
if (c instanceof Form) {
|
||||||
Element infoElement =
|
Element infoElement = element.newChildElement(
|
||||||
element.newChildElement(FormBuilderUtil.FORMBUILDER_FORM_INFO,
|
FormBuilderUtil.FORMBUILDER_FORM_INFO,
|
||||||
FormBuilderUtil.FORMBUILDER_XML_NS);
|
FormBuilderUtil.FORMBUILDER_XML_NS);
|
||||||
Form f = (Form) c;
|
Form f = (Form) c;
|
||||||
|
|
||||||
Traversal infoTraversal =
|
Traversal infoTraversal = new ComponentTraverse(state, ((Form) c)
|
||||||
new ComponentTraverse(state, ((Form)c).getFormData(state),
|
.getFormData(state),
|
||||||
infoElement);
|
infoElement);
|
||||||
infoTraversal.preorder(f);
|
infoTraversal.preorder(f);
|
||||||
}
|
}
|
||||||
|
|
@ -296,8 +293,8 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
// seem like a good idea to just cut and paste the code out
|
// seem like a good idea to just cut and paste the code out
|
||||||
// of the PageState class
|
// of the PageState class
|
||||||
fake.setControlEvent(c);
|
fake.setControlEvent(c);
|
||||||
fake.generateXML(element.newChildElement
|
fake.generateXML(element.newChildElement(
|
||||||
(FormBuilderUtil.FORMBUILDER_PAGE_STATE,
|
FormBuilderUtil.FORMBUILDER_PAGE_STATE,
|
||||||
FormBuilderUtil.FORMBUILDER_XML_NS));
|
FormBuilderUtil.FORMBUILDER_XML_NS));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -310,9 +307,11 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
private class VisibleTraverse extends Traversal {
|
private class VisibleTraverse extends Traversal {
|
||||||
|
|
||||||
PageState m_state;
|
PageState m_state;
|
||||||
|
|
||||||
VisibleTraverse(PageState state) {
|
VisibleTraverse(PageState state) {
|
||||||
m_state = state;
|
m_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void act(Component c) {
|
public void act(Component c) {
|
||||||
try {
|
try {
|
||||||
m_state.setVisible(c, true);
|
m_state.setVisible(c, true);
|
||||||
|
|
@ -320,5 +319,7 @@ public class FormItem extends ContentPage implements XMLGenerator {
|
||||||
// Nada
|
// Nada
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,16 +69,16 @@
|
||||||
<xsl:param name="contentitem-tree" tunnel="yes"/>
|
<xsl:param name="contentitem-tree" tunnel="yes"/>
|
||||||
|
|
||||||
<form method="post"
|
<form method="post"
|
||||||
name="{./name}"
|
name="{$contentitem-tree/name}"
|
||||||
action="{if(./remote = 'true')
|
action="{if($contentitem-tree/remote = 'true')
|
||||||
then ./remoteUrl
|
then $contentitem-tree/remoteUrl
|
||||||
else ./@formAction}"
|
else $data-tree//cms:item/@formAction}"
|
||||||
accept-charset="utf-8">
|
accept-charset="utf-8">
|
||||||
|
|
||||||
<xsl:if test="not(./remote = 'true')">
|
<xsl:if test="not($contentitem-tree/remote = 'true')">
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
value="visited"
|
value="visited"
|
||||||
name="{concat('form.', ./name)}"/>
|
name="{concat('form.', $contentitem-tree/name)}"/>
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
|
|
||||||
<xsl:for-each select="$contentitem-tree/form/component[
|
<xsl:for-each select="$contentitem-tree/form/component[
|
||||||
|
|
@ -97,7 +97,7 @@
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
<!-- Hidden internal information fields -->
|
<!-- Hidden internal information fields -->
|
||||||
<xsl:for-each select="./formbuilder:pageState/bebop:pageState">
|
<xsl:for-each select="$contentitem-tree/formbuilder:pageState/bebop:pageState">
|
||||||
<input type="hidden"
|
<input type="hidden"
|
||||||
name="{./@name}"
|
name="{./@name}"
|
||||||
value="{./@value}"/>
|
value="{./@value}"/>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,95 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
This file controls which CSS files are included for which application.
|
||||||
|
For more details please refer to the Foundry documentation which should
|
||||||
|
available at $address-of-your-ccm-installation/themes/foundry/doc/index.jsp
|
||||||
|
|
||||||
|
If you only provide a file (a path without a slash in it) Foundry expects
|
||||||
|
the css file to be found in the styles directory. If you provide a path
|
||||||
|
with at least one slash in it Foundry uses that relative to the themes root
|
||||||
|
directory.
|
||||||
|
|
||||||
|
For example the file public.css is expected to be found at
|
||||||
|
styles/public.css. The file /bootstrap/css/bootstrap.min.css is expected to
|
||||||
|
be found at bootstrap/css/bootstrap.min.css.
|
||||||
|
|
||||||
|
If you want to limit the CSS file to a specific media type you can use the
|
||||||
|
media attribute. In that case, the file is expected in the sub folder
|
||||||
|
of the styles folder with the name of the media type. For example
|
||||||
|
|
||||||
|
<css-file media="screen">portal.css</css-file>
|
||||||
|
|
||||||
|
In this case Foundry expects to find the portal.css file at
|
||||||
|
styles/screen/portal.css.
|
||||||
|
|
||||||
|
If you want to use the Less style language you can also set the attribute
|
||||||
|
less to true. If the also set the setting less-onthefly in conf/global.xml
|
||||||
|
to true, Foundry will include the Less JavaScript file and transform the
|
||||||
|
Less file on the fly to CSS if your are in the debug/development mode. If
|
||||||
|
you enable this feature you have to provide the filename without the
|
||||||
|
extension. Foundry will add the extension depending if the theme is viewed
|
||||||
|
in development or producation mode. In development mode, .less is added, in
|
||||||
|
producation mode .css.
|
||||||
|
|
||||||
|
The last attribute is the origin attribute. If set to internal the CSS
|
||||||
|
file is not loaded from the theme but from Foundry itself. In this theme
|
||||||
|
this feature is used for the CSS file for the admin applications.
|
||||||
|
-->
|
||||||
|
<css-files>
|
||||||
|
<!-- CSS file used for admin applications like the Content Centre -->
|
||||||
|
<application name="admin">
|
||||||
|
<css-file origin="internal">admin.css</css-file>
|
||||||
|
</application>
|
||||||
|
<application name="login">
|
||||||
|
<!-- CSS file used for the Login application -->
|
||||||
|
<css-file origin="internal">admin.css</css-file>
|
||||||
|
</application>
|
||||||
|
<application name="navigation">
|
||||||
|
<!--
|
||||||
|
Include CSS files for the navigation application. For our own
|
||||||
|
CSS file we are using the Less stylesheet language as described
|
||||||
|
above.
|
||||||
|
-->
|
||||||
|
<css-file>fancybox/jquery.fancybox.css?v=2.1.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7</css-file>
|
||||||
|
<css-file>font-awesome/css/font-awesome.min.css</css-file>
|
||||||
|
<css-file less="true">libre-blue-flex</css-file>
|
||||||
|
</application>
|
||||||
|
<application name="navigation" class="portalGridPage">
|
||||||
|
<!--
|
||||||
|
For a portalGridPage we use the same CSS files as for normal
|
||||||
|
navigation pages, but add the portal.css file.
|
||||||
|
-->
|
||||||
|
<css-file>fancybox/jquery.fancybox.css?v=2.1.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7</css-file>
|
||||||
|
<css-file>font-awesome/css/font-awesome.min.css</css-file>
|
||||||
|
<css-file media="screen">portal.css</css-file>
|
||||||
|
<css-file less="true">libre-blue-flex</css-file>
|
||||||
|
</application>
|
||||||
|
<application name="none" class="cms-admin">
|
||||||
|
<!-- Other admin applications -->
|
||||||
|
<css-file origin="internal">admin.css</css-file>
|
||||||
|
</application>
|
||||||
|
<application name="portal">
|
||||||
|
<!-- Portal pages -->
|
||||||
|
<css-file>fancybox/jquery.fancybox.css?v=2.1.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7</css-file>
|
||||||
|
<css-file>font-awesome/css/font-awesome.min.css</css-file>
|
||||||
|
<css-file origin="internal">portal.css</css-file>
|
||||||
|
<css-file less="true">libre-blue-flex</css-file>
|
||||||
|
</application>
|
||||||
|
<default>
|
||||||
|
<!--
|
||||||
|
If there is no entry for the current application we load the
|
||||||
|
default CSS files and our own.
|
||||||
|
-->
|
||||||
|
<css-file>fancybox/jquery.fancybox.css?v=2.1.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-buttons.css?v=1.0.5</css-file>
|
||||||
|
<css-file>fancybox/helpers/jquery.fancybox-thumbs.css?v=1.0.7</css-file>
|
||||||
|
<css-file>font-awesome/css/font-awesome.min.css</css-file>
|
||||||
|
<css-file less="true">libre-blue-flex</css-file>
|
||||||
|
</default>
|
||||||
|
</css-files>
|
||||||
Loading…
Reference in New Issue