|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opencms.frontend.templateone.form.CmsForm
public class CmsForm
Represents an input form with all configured fields and options.
Provides the necessary information to create an input form, email messages and confirmation outputs.
| Field Summary | |
|---|---|
static java.lang.String |
MAILTYPE_HTML
Mail type: html mail. |
static java.lang.String |
MAILTYPE_TEXT
Mail type: text mail. |
static java.lang.String |
NODE_CAPTCHA
Configuration node name for the optional captcha. |
static java.lang.String |
NODE_CAPTCHA_CHARACTERS
Configuration node name for the optional captcha. |
static java.lang.String |
NODE_CAPTCHA_PRESET
Configuration node name for the optional captcha. |
static java.lang.String |
NODE_CONFIRMATIONMAILCHECKBOXLABEL
Configuration node name for the confirmation mail checkbox label text. |
static java.lang.String |
NODE_CONFIRMATIONMAILENABLED
Configuration node name for the confirmation mail enabled node. |
static java.lang.String |
NODE_CONFIRMATIONMAILFIELD
Configuration node name for the confirmation mail input field node. |
static java.lang.String |
NODE_CONFIRMATIONMAILOPTIONAL
Configuration node name for the confirmation mail optional flag node. |
static java.lang.String |
NODE_CONFIRMATIONMAILSUBJECT
Configuration node name for the confirmation mail subject node. |
static java.lang.String |
NODE_CONFIRMATIONMAILTEXT
Configuration node name for the confirmation mail text node. |
static java.lang.String |
NODE_EMAIL
Configuration node name for the Email node. |
static java.lang.String |
NODE_FIELDDEFAULTVALUE
Configuration node name for the field value node. |
static java.lang.String |
NODE_FIELDERRORMESSAGE
Configuration node name for the field error message node. |
static java.lang.String |
NODE_FIELDITEM
Configuration node name for the field item node. |
static java.lang.String |
NODE_FIELDLABEL
Configuration node name for the field description node. |
static java.lang.String |
NODE_FIELDMANDATORY
Configuration node name for the field mandatory node. |
static java.lang.String |
NODE_FIELDTYPE
Configuration node name for the field type node. |
static java.lang.String |
NODE_FIELDVALIDATION
Configuration node name for the field validation node. |
static java.lang.String |
NODE_FORMATTRIBUTES
Configuration node name for the form attributes node. |
static java.lang.String |
NODE_FORMCHECKTEXT
Configuration node name for the form check page text node. |
static java.lang.String |
NODE_FORMCONFIRMATION
Configuration node name for the form confirmation text node. |
static java.lang.String |
NODE_FORMFIELDATTRIBUTES
Configuration node name for the form field attributes node. |
static java.lang.String |
NODE_FORMTEXT
Configuration node name for the form text node. |
static java.lang.String |
NODE_INPUTFIELD
Configuration node name for the input field node. |
static java.lang.String |
NODE_ITEMDESCRIPTION
Configuration node name for the item description node. |
static java.lang.String |
NODE_ITEMSELECTED
Configuration node name for the item selected node. |
static java.lang.String |
NODE_ITEMVALUE
Configuration node name for the item value node. |
static java.lang.String |
NODE_MAILBCC
Configuration node name for the Email bcc recipient(s) node. |
static java.lang.String |
NODE_MAILCC
Configuration node name for the Email cc recipient(s) node. |
static java.lang.String |
NODE_MAILFROM
Configuration node name for the Email sender address node. |
static java.lang.String |
NODE_MAILSUBJECT
Configuration node name for the Email subject node. |
static java.lang.String |
NODE_MAILTEXT
Configuration node name for the Email text node. |
static java.lang.String |
NODE_MAILTO
Configuration node name for the Email recipient(s) node. |
static java.lang.String |
NODE_MAILTYPE
Configuration node name for the Email type node. |
static java.lang.String |
NODE_OPTIONALCONFIGURATION
Configuration node name for the optional form configuration. |
static java.lang.String |
NODE_OPTIONALCONFIRMATION
Configuration node name for the optional confirmation mail configuration. |
static java.lang.String |
NODE_SHOWCHECK
Configuration node name for the Show check page node. |
static java.lang.String |
NODE_TARGET_URI
Configuration node name for the optional target URI. |
static java.lang.String |
PARAM_SENDCONFIRMATION
Request parameter name for the optional send confirmation email checkbox. |
| Constructor Summary | |
|---|---|
CmsForm(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial)
Default constructor which parses the configuration file. |
|
CmsForm(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial,
java.lang.String formConfigUri,
java.lang.String formAction)
Constructor which parses the configuration file using a given configuration file URI. |
|
| Method Summary | |
|---|---|
protected void |
addField(I_CmsField field)
Adds a field to the form. |
boolean |
captchaFieldIsOnCheckPage()
Tests, if the captcha field (if configured at all) should be displayed on the check page. |
boolean |
captchaFieldIsOnInputPage()
Tests, if the captcha field (if configured at all) should be displayed on the input page. |
CmsCaptchaField |
getCaptchaField()
Returns the (opt.) captcha field of this form. |
java.util.List |
getConfigurationErrors()
Returns the form configuration errors. |
java.lang.String |
getConfirmationMailCheckboxLabel()
Returns the label for the optional confirmation mail checkbox on the input form. |
int |
getConfirmationMailField()
Returns the index number of the input field containing the email address for the optional confirmation mail. |
java.lang.String |
getConfirmationMailSubject()
Returns the subject of the optional confirmation mail. |
java.lang.String |
getConfirmationMailText()
Returns the text of the optional confirmation mail. |
java.lang.String |
getConfirmationMailTextPlain()
Returns the plain text of the optional confirmation mail. |
java.util.List |
getFields()
Returns a list of field objects for the online form. |
java.lang.String |
getFieldStringValueByName(java.lang.String fieldName)
Returns the value for a field specified by it's name (Xpath). |
java.lang.String |
getFormAttributes()
Returns the global form attributes. |
java.lang.String |
getFormCheckText()
Returns the form check text. |
java.lang.String |
getFormConfirmationText()
Returns the form confirmation text. |
java.lang.String |
getFormFieldAttributes()
Returns the optional form input field attributes. |
java.lang.String |
getFormText()
Returns the form text. |
java.lang.String |
getMailBCC()
Returns the mail bcc recipient(s). |
java.lang.String |
getMailCC()
Returns the mail cc recipient(s). |
java.lang.String |
getMailFrom()
Returns the mail sender address. |
java.lang.String |
getMailSubject()
Returns the mail subject. |
java.lang.String |
getMailSubjectPrefix()
Returns the mail subject prefix. |
java.lang.String |
getMailText()
Returns the mail text. |
java.lang.String |
getMailTextPlain()
Returns the mail text as plain text. |
java.lang.String |
getMailTo()
Returns the mail recipient(s). |
java.lang.String |
getMailType()
Returns the mail type ("text" or "html"). |
boolean |
getShowCheck()
Returns if the check page should be shown. |
static java.lang.String |
getStaticType()
Returns the resource type name of XML content forms. |
java.lang.String |
getTargetUri()
Returns the target URI of this form. |
boolean |
hasCaptchaField()
Tests if a captcha field is configured for this form. |
boolean |
hasConfigurationErrors()
Returns if the form has configuration errors. |
boolean |
hasMandatoryFields()
Returns true if at least one of the configured fields is mandatory. |
boolean |
hasTargetUri()
Tests if this form has a target URI specified. |
void |
init(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial,
java.lang.String formConfigUri,
java.lang.String formAction)
Initializes the form configuration and creates the necessary form field objects. |
boolean |
isCheckPageSubmitted()
Tests if the check page was submitted. |
boolean |
isConfirmationMailEnabled()
Returns if the optional confirmation mail is enabled. |
boolean |
isConfirmationMailOptional()
Returns if the confirmation mail if optional, i.e. selectable by the form submitter. |
boolean |
isInputFormSubmitted()
Tests if the input page was submitted. |
protected java.lang.String |
readSelectedFromRequest(I_CmsField field,
java.lang.String value)
Marks the individual items of checkboxes, selectboxes and radiobuttons as selected depending on the given request parameters. |
I_CmsField |
removeCaptchaField()
Removes the captcha field from the list of all fields, if present. |
protected void |
removeField(I_CmsField field)
Removes a field from the form fields. |
protected void |
setConfigurationErrors(java.util.List configurationErrors)
Sets the form configuration errors. |
protected void |
setConfirmationMailCheckboxLabel(java.lang.String confirmationMailCheckboxLabel)
Sets the label for the optional confirmation mail checkbox on the input form. |
protected void |
setConfirmationMailEnabled(boolean confirmationMailEnabled)
Sets if the optional confirmation mail is enabled. |
protected void |
setConfirmationMailField(int confirmationMailFieldName)
Sets the index number of the input field containing the email address for the optional confirmation mail. |
protected void |
setConfirmationMailOptional(boolean confirmationMailOptional)
Sets if the confirmation mail if optional, i.e. selectable by the form submitter. |
protected void |
setConfirmationMailSubject(java.lang.String confirmationMailSubject)
Sets the subject of the optional confirmation mail. |
protected void |
setConfirmationMailText(java.lang.String confirmationMailText)
Sets the text of the optional confirmation mail. |
protected void |
setConfirmationMailTextPlain(java.lang.String confirmationMailTextPlain)
Sets the plain text of the optional confirmation mail. |
protected void |
setFormAttributes(java.lang.String formAttributes)
Sets the global form attributes. |
protected void |
setFormCheckText(java.lang.String formCheckText)
Sets the form check text. |
protected void |
setFormConfirmationText(java.lang.String formConfirmationText)
Sets the form confirmation text. |
protected void |
setFormFieldAttributes(java.lang.String formFieldAttributes)
Sets the optional form input field attributes. |
protected void |
setFormText(java.lang.String formText)
Sets the form text. |
protected void |
setHasMandatoryFields(boolean hasMandatoryFields)
Sets if at least one of the configured fields is mandatory. |
protected void |
setMailBCC(java.lang.String mailBCC)
Sets the mail bcc recipient(s). |
protected void |
setMailCC(java.lang.String mailCC)
Sets the mail cc recipient(s). |
protected void |
setMailFrom(java.lang.String mailFrom)
Sets the mail sender address. |
protected void |
setMailSubject(java.lang.String mailSubject)
Sets the mail subject. |
protected void |
setMailSubjectPrefix(java.lang.String mailSubjectPrefix)
Sets the mail subject prefix. |
protected void |
setMailText(java.lang.String mailText)
Sets the mail text. |
protected void |
setMailTextPlain(java.lang.String mailTextPlain)
Sets the mail text as plain text. |
protected void |
setMailTo(java.lang.String mailTo)
Sets the mail recipient(s). |
protected void |
setMailType(java.lang.String mailType)
Sets the mail type ("text" or "html"). |
protected void |
setShowCheck(boolean showCheck)
Sets if the check page should be shown. |
protected void |
setTargetUri(java.lang.String targetUri)
Sets the target URI of this form. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String MAILTYPE_HTML
public static final java.lang.String MAILTYPE_TEXT
public static final java.lang.String NODE_CAPTCHA
public static final java.lang.String NODE_CONFIRMATIONMAILCHECKBOXLABEL
public static final java.lang.String NODE_CONFIRMATIONMAILENABLED
public static final java.lang.String NODE_CONFIRMATIONMAILFIELD
public static final java.lang.String NODE_CONFIRMATIONMAILOPTIONAL
public static final java.lang.String NODE_CONFIRMATIONMAILSUBJECT
public static final java.lang.String NODE_CONFIRMATIONMAILTEXT
public static final java.lang.String NODE_EMAIL
public static final java.lang.String NODE_FIELDDEFAULTVALUE
public static final java.lang.String NODE_FIELDERRORMESSAGE
public static final java.lang.String NODE_FIELDITEM
public static final java.lang.String NODE_FIELDLABEL
public static final java.lang.String NODE_FIELDMANDATORY
public static final java.lang.String NODE_FIELDTYPE
public static final java.lang.String NODE_FIELDVALIDATION
public static final java.lang.String NODE_FORMATTRIBUTES
public static final java.lang.String NODE_FORMCHECKTEXT
public static final java.lang.String NODE_FORMCONFIRMATION
public static final java.lang.String NODE_FORMFIELDATTRIBUTES
public static final java.lang.String NODE_FORMTEXT
public static final java.lang.String NODE_INPUTFIELD
public static final java.lang.String NODE_ITEMDESCRIPTION
public static final java.lang.String NODE_ITEMSELECTED
public static final java.lang.String NODE_ITEMVALUE
public static final java.lang.String NODE_MAILBCC
public static final java.lang.String NODE_MAILCC
public static final java.lang.String NODE_MAILFROM
public static final java.lang.String NODE_MAILSUBJECT
public static final java.lang.String NODE_MAILTEXT
public static final java.lang.String NODE_MAILTO
public static final java.lang.String NODE_MAILTYPE
public static final java.lang.String NODE_OPTIONALCONFIGURATION
public static final java.lang.String NODE_OPTIONALCONFIRMATION
public static final java.lang.String NODE_SHOWCHECK
public static final java.lang.String NODE_TARGET_URI
public static final java.lang.String PARAM_SENDCONFIRMATION
public static final java.lang.String NODE_CAPTCHA_PRESET
public static final java.lang.String NODE_CAPTCHA_CHARACTERS
| Constructor Detail |
|---|
public CmsForm(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial)
throws java.lang.Exception
jsp - the initialized CmsJspActionElement to access the OpenCms APImessages - the localized messagesinitial - if true, field values are filled with values specified in the configuration file, otherwise from the request
java.lang.Exception - if parsing the configuration fails
public CmsForm(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial,
java.lang.String formConfigUri,
java.lang.String formAction)
throws java.lang.Exception
jsp - the initialized CmsJspActionElement to access the OpenCms APImessages - the localized messagesinitial - if true, field values are filled with values specified in the configuration file, otherwise from the requestformConfigUri - URI of the form configuration file, if not provided, current URI is used for configurationformAction - the desired action submiktted by the form
java.lang.Exception - if parsing the configuration fails| Method Detail |
|---|
public static java.lang.String getStaticType()
public boolean captchaFieldIsOnCheckPage()
public boolean captchaFieldIsOnInputPage()
public CmsCaptchaField getCaptchaField()
public java.util.List getConfigurationErrors()
public java.lang.String getConfirmationMailCheckboxLabel()
public int getConfirmationMailField()
public java.lang.String getConfirmationMailSubject()
public java.lang.String getConfirmationMailText()
public java.lang.String getConfirmationMailTextPlain()
public java.util.List getFields()
public java.lang.String getFieldStringValueByName(java.lang.String fieldName)
fieldName - the field's name (Xpath)
public java.lang.String getFormAttributes()
public java.lang.String getFormCheckText()
public java.lang.String getFormConfirmationText()
public java.lang.String getFormFieldAttributes()
public java.lang.String getFormText()
public java.lang.String getMailBCC()
public java.lang.String getMailCC()
public java.lang.String getMailFrom()
public java.lang.String getMailSubject()
public java.lang.String getMailSubjectPrefix()
public java.lang.String getMailText()
public java.lang.String getMailTextPlain()
public java.lang.String getMailTo()
public java.lang.String getMailType()
public boolean getShowCheck()
public java.lang.String getTargetUri()
This optional target URI can be used to redirect the user to an OpenCms page instead of displaying a confirmation text from the form's XML content.
public boolean hasCaptchaField()
public boolean hasConfigurationErrors()
public boolean hasMandatoryFields()
public boolean hasTargetUri()
This optional target URI can be used to redirect the user to an OpenCms page instead of displaying a confirmation text from the form's XML content.
public void init(CmsFormHandler jsp,
org.opencms.i18n.CmsMessages messages,
boolean initial,
java.lang.String formConfigUri,
java.lang.String formAction)
throws java.lang.Exception
jsp - the initialized CmsJspActionElement to access the OpenCms APImessages - the localized messagesinitial - if true, field values are filled with values specified in the XML configurationformConfigUri - URI of the form configuration file, if not provided, current URI is used for configurationformAction - the desired action submitted by the form
java.lang.Exception - if parsing the configuration failspublic boolean isCheckPageSubmitted()
public boolean isConfirmationMailEnabled()
public boolean isConfirmationMailOptional()
public boolean isInputFormSubmitted()
public I_CmsField removeCaptchaField()
protected void addField(I_CmsField field)
field - the field to be added to the form
protected java.lang.String readSelectedFromRequest(I_CmsField field,
java.lang.String value)
field - the current fieldvalue - the value of the input field
"true" if the current item is selected or checked, otherwise falseprotected void removeField(I_CmsField field)
field - the field to be removedprotected void setConfigurationErrors(java.util.List configurationErrors)
configurationErrors - the form configuration errorsprotected void setConfirmationMailCheckboxLabel(java.lang.String confirmationMailCheckboxLabel)
confirmationMailCheckboxLabel - the label for the optional confirmation mail checkbox on the input formprotected void setConfirmationMailEnabled(boolean confirmationMailEnabled)
confirmationMailEnabled - true if the optional confirmation mail is enabled, otherwise falseprotected void setConfirmationMailField(int confirmationMailFieldName)
confirmationMailFieldName - the name of the input field containing the email address for the optional confirmation mailprotected void setConfirmationMailOptional(boolean confirmationMailOptional)
confirmationMailOptional - true if the confirmation mail if optional, i.e. selectable by the form submitter, otherwise falseprotected void setConfirmationMailSubject(java.lang.String confirmationMailSubject)
confirmationMailSubject - the subject of the optional confirmation mailprotected void setConfirmationMailText(java.lang.String confirmationMailText)
confirmationMailText - the text of the optional confirmation mailprotected void setConfirmationMailTextPlain(java.lang.String confirmationMailTextPlain)
confirmationMailTextPlain - the plain text of the optional confirmation mailprotected void setFormAttributes(java.lang.String formAttributes)
formAttributes - the global form attributesprotected void setFormCheckText(java.lang.String formCheckText)
formCheckText - the form confirmation textprotected void setFormConfirmationText(java.lang.String formConfirmationText)
formConfirmationText - the form confirmation textprotected void setFormFieldAttributes(java.lang.String formFieldAttributes)
formFieldAttributes - the optional form input field attributesprotected void setFormText(java.lang.String formText)
formText - the form textprotected void setHasMandatoryFields(boolean hasMandatoryFields)
hasMandatoryFields - true if at least one of the configured fields is mandatory, otherwise falseprotected void setMailBCC(java.lang.String mailBCC)
mailBCC - the mail bcc recipient(s)protected void setMailCC(java.lang.String mailCC)
mailCC - the mail cc recipient(s)protected void setMailFrom(java.lang.String mailFrom)
mailFrom - the mail sender addressprotected void setMailSubject(java.lang.String mailSubject)
mailSubject - the mail subjectprotected void setMailSubjectPrefix(java.lang.String mailSubjectPrefix)
mailSubjectPrefix - the mail subject prefixprotected void setMailText(java.lang.String mailText)
mailText - the mail textprotected void setMailTextPlain(java.lang.String mailTextPlain)
mailTextPlain - the mail text as plain textprotected void setMailTo(java.lang.String mailTo)
mailTo - the mail recipient(s)protected void setMailType(java.lang.String mailType)
mailType - the mail typeprotected void setShowCheck(boolean showCheck)
showCheck - true if the check page should be shown, otherwise falseprotected void setTargetUri(java.lang.String targetUri)
This optional target URI can be used to redirect the user to an OpenCms page instead of displaying a confirmation text from the form's XML content.
targetUri - the target URI
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||