--- a/src/pyams_content/shared/form/handler.py Fri Jul 26 13:00:24 2019 +0200
+++ b/src/pyams_content/shared/form/handler.py Fri Jul 26 13:02:34 2019 +0200
@@ -72,10 +72,10 @@
class MailtoFormHandler(object):
"""Mailto form handler"""
- label = _("Mailto form handler")
+ label = _("Direct mailto form handler")
target_interface = IMailtoHandlerTarget
handler_info = IMailtoHandlerInfo
- def handle(self, data):
+ def handle(self, form, data):
# TODO: handle form data
pass
--- a/src/pyams_content/shared/form/interfaces.py Fri Jul 26 13:00:24 2019 +0200
+++ b/src/pyams_content/shared/form/interfaces.py Fri Jul 26 13:02:34 2019 +0200
@@ -18,7 +18,7 @@
from pyams_content.shared.common.interfaces import ISharedContent, ISharedToolPortalContext, \
IWfSharedContentPortalContext
-from pyams_i18n.schema import I18nTextField, I18nTextLineField
+from pyams_i18n.schema import I18nTextField, I18nTextLineField, I18nHTMLField
from pyams_utils.schema import MailAddressField, TextLineListField
@@ -107,6 +107,9 @@
def get_fields(self):
"""Get schema fields matching current fields"""
+ def find_fields(self, factory):
+ """Find fields matching given factory (defined by it's utility name)"""
+
class IFormFieldContainerTarget(Interface):
"""Form fields container target marker interface"""
@@ -118,23 +121,44 @@
user_title = I18nTextLineField(title=_("Form title"),
required=True)
- handler = Choice(title=_("Form handler"),
- description=_("Select how form data is transmitted"),
- vocabulary='PyAMS form handlers')
-
auth_only = Bool(title=_("Authenticated only?"),
description=_("If 'yes', only authenticated users will be able to see and submit form"),
required=True,
default=False)
+ form_header = I18nTextField(title=_("Form header"),
+ description=_("This header is displayed just above form fields"),
+ required=False)
+
+ submit_label = I18nTextLineField(title=_("Submit button"),
+ description=_("Label of form submit button"),
+ required=True)
+
+ submit_message = I18nHTMLField(title=_("Submit message"),
+ description=_("This message will be displayed after form submission"),
+ required=True)
+
+ handler = Choice(title=_("Form handler"),
+ description=_("Select how form data is transmitted"),
+ vocabulary='PyAMS form handlers')
+
use_captcha = Bool(title=_("Use captcha?"),
description=_("If 'yes', a captcha will be added automatically to the form"),
- required=True,
+ required=False,
default=True)
- submit_label = I18nTextLineField(title=_("Submit label"),
- description=_("Label of form submit button"),
- required=True)
+ client_captcha_key = TextLine(title=_("Site key"),
+ description=_("This key is included into HTML code and submitted with form data"),
+ required=False)
+
+ server_captcha_key = TextLine(title=_("Secret key"),
+ description=_("This key is used to communicate with Google's reCaptcha services"),
+ required=False)
+
+ captcha_proxy = TextLine(title=_("Recaptcha proxy"),
+ description=_("If your server is behind a proxy, please set it's address here; "
+ "captcha verification requires HTTPS support..."),
+ required=False)
def query_handler(self, handler=None):
"""Get form handler utility"""
@@ -159,7 +183,7 @@
target_interface = Attribute("Handler target marker interface")
handler_info = Attribute("Handler info interface")
- def handle(self, data):
+ def handle(self, form, data):
"""Handle entered data"""
@@ -172,7 +196,7 @@
source_address = MailAddressField(title=_("Source address"),
description=_("Mail address from which form data is sent"),
- required=True)
+ required=False)
source_name = TextLine(title=_("Source name"),
description=_("Name of mail data sender"),
@@ -180,7 +204,7 @@
target_address = MailAddressField(title=_("Recipient address"),
description=_("Mail address to which form data is sent"),
- required=True)
+ required=False)
target_name = TextLine(title=_("Recipient name"),
description=_("Name of data recipient"),