src/pyams_content/shared/form/interfaces.py
changeset 1346 88b5ce31afdc
parent 1344 646ec926f14a
child 1370 87bcbf37ad6d
--- a/src/pyams_content/shared/form/interfaces.py	Mon Sep 16 16:57:01 2019 +0200
+++ b/src/pyams_content/shared/form/interfaces.py	Tue Sep 17 12:03:03 2019 +0200
@@ -19,7 +19,7 @@
 from pyams_content.component.paragraph import IBaseParagraph
 from pyams_content.shared.common.interfaces import ISharedContent, ISharedToolPortalContext, \
     IWfSharedContentPortalContext
-from pyams_i18n.schema import I18nTextField, I18nTextLineField, I18nHTMLField
+from pyams_i18n.schema import I18nHTMLField, I18nTextField, I18nTextLineField
 from pyams_utils.schema import MailAddressField, TextLineListField
 
 
@@ -99,6 +99,13 @@
         """Get schema field matching given form field"""
 
 
+class IFormFieldDataConverter(Interface):
+    """Interface of a converter adapter which can be used to convert form data"""
+
+    def convert(self, value):
+        """Convert given input value"""
+
+
 FORM_FIELDS_PARAGRAPH_TYPE = 'form-fields'
 FORM_FIELDS_PARAGRAPH_NAME = _("Form fields")
 FORM_FIELDS_PARAGRAPH_RENDERERS = 'PyAMS.paragraph.formfields.renderers'
@@ -145,6 +152,8 @@
                                 required=False)
 
     user_title = I18nTextLineField(title=_("Form title"),
+                                   description=_("If set, this title will be displayed above input "
+                                                 "fields"),
                                    required=False)
 
     auth_only = Bool(title=_("Authenticated only?"),
@@ -187,6 +196,27 @@
                                            "support..."),
                              required=False)
 
+    rgpd_consent = Bool(title=_("Required RGPD consent?"),
+                        description=_("If 'yes', an RGPD compliance warning will be displayed "
+                                      "above form's submit button; form can't be submitted as long "
+                                      "as the associated checkbox will not be checked explicitly "
+                                      "by the user"),
+                        required=True,
+                        default=True)
+
+    rgpd_warning = I18nTextField(title=_("RGPD consent text"),
+                                 description=_("User consent must be explicit, and user must be "
+                                               "warned about usage which will be made of submitted "
+                                               "data; text samples are given below"),
+                                 required=False)
+
+    rgpd_user_rights = I18nHTMLField(title=_("RGPD user rights"),
+                                     description=_("The internet user must be able to easily "
+                                                   "revoke his consent later on, so it is "
+                                                   "important to inform him how to proceed; below "
+                                                   "are examples of possible formulations"),
+                                     required=False)
+
     def query_handler(self, handler=None):
         """Get form handler utility"""
 
@@ -210,8 +240,13 @@
     target_interface = Attribute("Handler target marker interface")
     handler_info = Attribute("Handler info interface")
 
-    def handle(self, form, data):
-        """Handle entered data"""
+    def handle(self, form, data, user_data):
+        """Handle entered data
+
+        :param form: input form
+        :param data: raw form data
+        :param user_data: user friendly form input data
+        """
 
 
 class IFormHandlerInfo(Interface):