Skip to content

Commit

Permalink
DOI Improvements (#482)
Browse files Browse the repository at this point in the history
* remove unique index, allow admin to define unique data behavior, fixes #477
* pass data to email channel and store double-opt-in main data in mail params, resolves #479
* pass data to email channel and store double-opt-in main data in mail params, resolves #479
* allow to list and manage active sessions, resolves #478
* improve docs, show doi widgets only if feature is enabled
* [test] change chromdriver install
  • Loading branch information
solverat authored Sep 17, 2024
1 parent 3ac08df commit da12290
Show file tree
Hide file tree
Showing 33 changed files with 641 additions and 52 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/codeception.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
- pimcore: ~11.2.0
template_tag: v11.0.0
steps:
- uses: nanasess/setup-chromedriver@v2
with:
chromedriver-version: '127.0.6533.119'
- uses: actions/checkout@v4
with:
path: lib/test-bundle
Expand Down Expand Up @@ -98,7 +101,9 @@ jobs:

- name: Setup Chromium
run: |
nohup $CHROMEWEBDRIVER/chromedriver --url-base=/wd/hub /dev/null 2>&1 &
export DISPLAY=:99
chromedriver --url-base=/wd/hub &
sudo Xvfb -ac :99 -screen 0 1280x1024x24 > /dev/null 2>&1 & # optional
- name: Start Symfony Server
run: |
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

| Release | Supported Pimcore Versions | Supported Symfony Versions | Release Date | Maintained | Branch |
|---------|-----------------------------------|----------------------------|--------------|----------------|----------------------------------------------------------------------------------|
| **5.x** | `11.0` | `6.2` | 18.10.2023 | Feature Branch | master |
| **5.x** | `11.0` | `^6.2` | 18.10.2023 | Feature Branch | master |
| **4.x** | `10.5`, `10.6` | `^5.4` | 13.10.2021 | Unsupported | [4.x](https://github.com/dachcom-digital/pimcore-formbuilder/tree/4.x) |
| **3.x** | `6.0` - `6.9` | `3.4`, `^4.4` | 17.07.2019 | Unsupported | [3.x](https://github.com/dachcom-digital/pimcore-formbuilder/tree/3.x) |
| **2.7** | `5.4`, `5.5`, `5.6`, `5.7`, `5.8` | `3.4` | 27.06.2019 | Unsupported | [2.7](https://github.com/dachcom-digital/pimcore-formbuilder/tree/2.7) |
Expand Down
5 changes: 4 additions & 1 deletion UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# Upgrade Notes

## 5.1.1
## 5.1.2
- **[IMPROVEMENT]** [File Upload] Add Deeplink Option to file upload field [#475](https://github.com/dachcom-digital/pimcore-formbuilder/issues/475)
- **[BUGFIX]** [Double-Opt-In] Remove unique index, allow admin to define unique data behavior [#477](https://github.com/dachcom-digital/pimcore-formbuilder/issues/477)
- **[IMPROVEMENT]** [Double-Opt-In] Allow to list and manage active sessions [#478](https://github.com/dachcom-digital/pimcore-formbuilder/issues/478)
- **[IMPROVEMENT]** [Double-Opt-In] Pass data to email channel and store double-opt-in main data in mail params [#479](https://github.com/dachcom-digital/pimcore-formbuilder/issues/479)

## 5.1.1
- **[BUGFIX]** Fix Migration and Installer
Expand Down
5 changes: 1 addition & 4 deletions config/doctrine/model/DoubleOptInSession.orm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,4 @@ FormBuilderBundle\Model\DoubleOptInSession:
joinColumn:
name: form_definition
referencedColumnName: id
onDelete: CASCADE
uniqueConstraints:
email_form_definition:
columns: [email, form_definition, applied]
onDelete: CASCADE
1 change: 0 additions & 1 deletion config/install/sql/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ CREATE TABLE IF NOT EXISTS `formbuilder_double_opt_in_session` (
`dispatch_location` longtext NULL,
`applied` tinyint(1) DEFAULT 0 NOT null,
`creationDate` datetime NOT NULL,
CONSTRAINT email_form_definition UNIQUE (email, form_definition, applied),
CONSTRAINT FK_88815C4F61F7634C FOREIGN KEY (form_definition) REFERENCES formbuilder_forms (id) ON DELETE CASCADE
);

Expand Down
4 changes: 4 additions & 0 deletions config/install/translations/admin.csv
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@
"form_builder.mail_editor.widget_provider.form_fields.repeater_block_label","Block Label","Block Label"
"form_builder.mail_editor.widget_provider.date.date","Date","Datum"
"form_builder.mail_editor.widget_provider.date.date_format","Date Format","Datum-Format"
"form_builder.mail_editor.widget_provider.double_opt_in_session","Double-Opt-In Session","Double-Opt-In Session"
"form_builder.mail_editor.widget_provider.double_opt_in_session.email","Email","E-Mail"
"form_builder.mail_editor.widget_provider.double_opt_in_session.additional_data","Additional Data","Zusätzliche Daten"
"form_builder.mail_editor.widget_provider.double_opt_in_session.additional_data_field","Field","Feld"
"form_builder_type_field.date_html5","use HTML5 type", "HTML5-Typ benutzen"
"form_builder.output_workflow.channel.email","Email Channel", "E-Mail Channel"
"form_builder.output_workflow.channel.object","Object Channel", "Object Channel"
Expand Down
16 changes: 15 additions & 1 deletion config/pimcore/routing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,24 @@ form_builder.controller.admin.get_preset_description:
path: /admin/formbuilder/settings/get-preset-description/{name}
defaults: { _controller: FormBuilderBundle\Controller\Admin\SettingsController::getPresetDescriptionAction }

form_builder.controller.admin.getData_injection_store:
form_builder.controller.admin.get_data_injection_store:
path: /admin/formbuilder/settings/get-data-injection-store
defaults: { _controller: FormBuilderBundle\Controller\Admin\SettingsController::getDataInjectionStoreAction }

# Double-Opt-In
form_builder.controller.admin.get_double_opt_in_session:
path: /admin/formbuilder/settings/double-opt-in/sessions/{formId}
defaults: { _controller: FormBuilderBundle\Controller\Admin\SettingsController::getDoubleOptInSessionsAction }
options:
expose: true

form_builder.controller.admin.delete_double_opt_in_session:
path: /admin/formbuilder/settings/double-opt-in/delete/{token}
defaults: { _controller: FormBuilderBundle\Controller\Admin\SettingsController::deleteDoubleOptInSessionAction }
methods: [DELETE]
options:
expose: true

# Output Workflows
form_builder.controller.admin.output_workflow.get_output_workflow_tree:
path: /admin/formbuilder/output-workflow/get-output-workflow-tree/{formId}
Expand Down
16 changes: 16 additions & 0 deletions config/serialization/DoubleOptInSession.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
FormBuilderBundle\Model\DoubleOptInSession:
attributes:
token:
groups: [ Default, ExtJs ]
formDefinition:
groups: [ Default ]
email:
groups: [ Default, ExtJs ]
additionalData:
groups: [ Default, ExtJs ]
dispatchLocation:
groups: [ Default, ExtJs ]
applied:
groups: [ Default, ExtJs ]
creationDate:
groups: [ Default, ExtJs ]
6 changes: 0 additions & 6 deletions config/services/double_opt_in.yaml

This file was deleted.

14 changes: 14 additions & 0 deletions config/services/double_opt_in/services.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
services:

_defaults:
autowire: true
autoconfigure: true
public: true

FormBuilderBundle\MailEditor\Widget\DoubleOptInSessionEmailWidget:
tags:
- { name: form_builder.mail_editor.widget, type: double_opt_in_session_email }

FormBuilderBundle\MailEditor\Widget\DoubleOptInSessionAdditionalDataWidget:
tags:
- { name: form_builder.mail_editor.widget, type: double_opt_in_session_additional_data }
25 changes: 24 additions & 1 deletion docs/04_DoubleOptIn.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,27 @@ Additional Info:

## Trash-Mail Protection
The `EmailChecker` Validator is automatically appended to the `emailAddress` field.
This validator only triggers, if you've configured at least one email checker service - read more about it [here](./docs/03_SpamProtection.md#email-checker)
This validator only triggers, if you've configured at least one email checker service - read more about it [here](./docs/03_SpamProtection.md#email-checker)

## Templating
Based on given output workflow, you may want to use the double opt in data in given channel:

### E-Mail Channel
If DOI is active, the submitted mail object will receive two additional parameters:
- _form_builder_double_opt_in_token
- _form_builder_double_opt_in_session_email

#### E-Mail Data Template
DOI information can't be rendered by default since the rendering heavily depends on your implementation.
Checkout out this [part](https://github.com/dachcom-digital/pimcore-formbuilder/blob/a9da6dada95274049d07f920999b57dfc0c9b462/templates/email/form_data.html.twig#L57-L74) in `templates/email/form_data.html.twig`,
to show DOI data within your submitted mail data.

#### E-Mail Editor
![image](https://github.com/user-attachments/assets/30f209a1-231a-4511-bdf9-0c6ccef423d3)
Use the additional fields on the right side to add DOI information to the mail template editor.

### Object Channel
Currently not implemented

### API Channel
Currently not implemented
27 changes: 23 additions & 4 deletions public/js/extjs/_form/tab/configPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,6 +725,7 @@ Formbuilder.extjs.formPanel.config = Class.create({
fieldLabel: t('form_builder_form.double_opt_in.enable'),
inputValue: true,
uncheckedValue: false,
labelWidth: 200,
value: this.formConfig.doubleOptIn ? this.formConfig.doubleOptIn.enabled : false,
listeners: {
change: function (cb, value) {
Expand All @@ -740,13 +741,24 @@ Formbuilder.extjs.formPanel.config = Class.create({
{
xtype: 'container',
hidden: !this.formConfig.doubleOptIn || this.formConfig.doubleOptIn.enabled === false,
defaults: {
labelWidth: 200
},
items: [
{
fieldLabel: false,
xtype: 'displayfield',
style: 'display:block !important; margin-bottom:15px !important; font-weight: 300;',
value: t('form_builder_form.double_opt_in.description')
},
{
xtype: 'checkbox',
name: 'doubleOptIn.allowMultipleUserSessions',
fieldLabel: t('form_builder_form.double_opt_in.allow_multiple_user_sessions'),
inputValue: true,
uncheckedValue: false,
value: this.formConfig.allowMultipleUserSessions ? this.formConfig.doubleOptIn.allowMultipleUserSessions : true,
},
{
xtype: 'textfield',
name: 'doubleOptIn.instructionNote',
Expand All @@ -765,7 +777,13 @@ Formbuilder.extjs.formPanel.config = Class.create({
width: '100%',
inputAttrTpl: ' data-qwidth="250" data-qalign="br-r?" data-qtrackMouse="false" data-qtip="' + t('form_builder_type_field_base.translatable_field') + '"',
},
doubleOptInLocalizedField.getField()
doubleOptInLocalizedField.getField(),
{
xtype: 'button',
text: t('form_builder_form.double_opt_in.show_sessions'),
iconCls: 'pimcore_icon_export',
handler: this.showFormDoubleOptInData.bind(this)
}
]
}
]
Expand Down Expand Up @@ -924,9 +942,10 @@ Formbuilder.extjs.formPanel.config = Class.create({
return toolbar;
},

/**
* Display info window with current form meta information
*/
showFormDoubleOptInData: function() {
new Formbuilder.extjs.extensions.formDoubleOptInData(this.formId, this.formConfig.doubleOptIn);
},

showFormMetaInfo: function () {
new Formbuilder.extjs.extensions.formMetaData(this.formId, this.formMeta);
},
Expand Down
Loading

0 comments on commit da12290

Please sign in to comment.