Skip to content

Commit

Permalink
Merge branch 'release/1.5.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
aschempp committed Oct 22, 2018
2 parents e643073 + 94428fa commit 4255119
Show file tree
Hide file tree
Showing 141 changed files with 9,968 additions and 2,124 deletions.
20 changes: 2 additions & 18 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,18 +1,2 @@
# OS
.DS_Store
Thumbs.db

# IDEs
.buildpath
.project
.settings/
.build/
.idea/
nbproject/

# Transifex
.tx/

# Composer
vendor/
composer.lock
/vendor/
/composer.lock
48 changes: 48 additions & 0 deletions .tx/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
[main]
host = https://www.transifex.com
type = XLIFF

[notification_center.master-notification_center-modules]
source_file = languages/en/modules.xlf
source_lang = en
file_filter = languages/<lang>/modules.xlf

[notification_center.master-notification_center-tl_form]
source_file = languages/en/tl_form.xlf
source_lang = en
file_filter = languages/<lang>/tl_form.xlf

[notification_center.master-notification_center-tl_module]
source_file = languages/en/tl_module.xlf
source_lang = en
file_filter = languages/<lang>/tl_module.xlf

[notification_center.master-notification_center-tl_nc_gateway]
source_file = languages/en/tl_nc_gateway.xlf
source_lang = en
file_filter = languages/<lang>/tl_nc_gateway.xlf

[notification_center.master-notification_center-tl_nc_language]
source_file = languages/en/tl_nc_language.xlf
source_lang = en
file_filter = languages/<lang>/tl_nc_language.xlf

[notification_center.master-notification_center-tl_nc_message]
source_file = languages/en/tl_nc_message.xlf
source_lang = en
file_filter = languages/<lang>/tl_nc_message.xlf

[notification_center.master-notification_center-tl_nc_notification]
source_file = languages/en/tl_nc_notification.xlf
source_lang = en
file_filter = languages/<lang>/tl_nc_notification.xlf

[notification_center.master-notification_center-tl_nc_queue]
source_file = languages/en/tl_nc_queue.xlf
source_lang = en
file_filter = languages/<lang>/tl_nc_queue.xlf

[notification_center.master-notification_center-tokens]
source_file = languages/en/tokens.xlf
source_lang = en
file_filter = languages/<lang>/tokens.xlf
18 changes: 18 additions & 0 deletions classes/tl_nc_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ public function loadSettingsLanguageFile()
\System::loadLanguageFile('tl_settings');
}

/**
* Validate the queue delay
*
* @param string $value
*
* @return string
*
* @throws \RuntimeException
*/
public function validateQueueDelay($value)
{
if ($value && strtotime($value) === false) {
throw new \InvalidArgumentException(sprintf($GLOBALS['TL_LANG']['ERR']['invalidDate'], $value));
}

return $value;
}

/**
* Check the FTP connection
*
Expand Down
15 changes: 15 additions & 0 deletions classes/tl_nc_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,24 @@
namespace NotificationCenter;

use NotificationCenter\Model\QueuedMessage;
use NotificationCenter\Queue\QueueManager;

class tl_nc_queue extends \Backend
{
/**
* On delete callback.
*
* @param \DataContainer $dc
*/
public function onDeleteCallback(\DataContainer $dc)
{
$queueManager = new $GLOBALS['NOTIFICATION_CENTER']['QUEUE_MANAGER']();

if ($queueManager instanceof QueueManager) {
$queueManager->removeMessageFiles($dc->id);
}
}

/**
* label_callback
*
Expand Down
14 changes: 7 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"terminal42/dcawizard":"2.*"
},
"require-dev": {
"cyberspectrum/contao-toolbox": "^0.7.2"
"contao/newsletter-bundle":"~3.5 || ~4.1"
},
"autoload":{
"psr-0": {
Expand All @@ -33,19 +33,19 @@
"replace": {
"contao-legacy/notification_center": "self.version"
},
"suggest": {
"contao/newsletter-bundle": "Send notifications using the newsletter bundle of Contao"
},
"conflict": {
"contao/newsletter-bundle": "<3.5 || >= 5.0"
},
"extra":{
"branch-alias": {
"dev-develop": "1.4.x-dev"
},
"contao": {
"sources":{
"": "system/modules/notification_center"
},
"transifex": {
"project": "notification_center",
"prefix": "master-notification_center-",
"languages_cto": "languages",
"languages_tx": ".tx"
}
}
}
Expand Down
6 changes: 5 additions & 1 deletion config/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,9 @@
*/
ClassLoader::addClasses(array
(
'Contao\ModulePasswordNotificationCenter' => 'system/modules/notification_center/modules/ModulePasswordNotificationCenter.php',
'Contao\ModulePasswordNotificationCenter' => 'system/modules/notification_center/modules/ModulePasswordNotificationCenter.php',
'Contao\NewsletterModuleTrait' => 'system/modules/notification_center/modules/NewsletterModuleTrait.php',
'Contao\ModuleNewsletterSubscribeNotificationCenter' => 'system/modules/notification_center/modules/ModuleNewsletterSubscribeNotificationCenter.php',
'Contao\ModuleNewsletterActivateNotificationCenter' => 'system/modules/notification_center/modules/ModuleNewsletterActivateNotificationCenter.php',
'Contao\ModuleNewsletterUnsubscribeNotificationCenter' => 'system/modules/notification_center/modules/ModuleNewsletterUnsubscribeNotificationCenter.php',
));
47 changes: 46 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@
*/
$GLOBALS['FE_MOD']['user']['lostPasswordNotificationCenter'] = 'ModulePasswordNotificationCenter';

if (in_array('newsletter', \ModuleLoader::getActive(), true)) {
$GLOBALS['FE_MOD']['newsletter']['newsletterSubscribeNotificationCenter'] = 'ModuleNewsletterSubscribeNotificationCenter';
$GLOBALS['FE_MOD']['newsletter']['newsletterActivateNotificationCenter'] = 'ModuleNewsletterActivateNotificationCenter';
$GLOBALS['FE_MOD']['newsletter']['newsletterUnsubscribeNotificationCenter'] = 'ModuleNewsletterUnsubscribeNotificationCenter';
}

/**
* Models
*/
Expand Down Expand Up @@ -164,7 +170,46 @@
'email_recipient_cc' => array('recipient_email'),
'email_recipient_bcc' => array('recipient_email'),
'email_replyTo' => array('recipient_email'),
)
),
'newsletter_subscribe' => array(
'recipients' => array('recipient_email', 'admin_email'),
'email_subject' => array('domain', 'link', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'subject'),
'email_text' => array('domain', 'link', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'token'),
'email_html' => array('domain', 'link', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'token'),
'file_name' => array('domain', 'link', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'file_content' => array('domain', 'link', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'token'),
'email_sender_name' => array('recipient_email', 'admin_email', 'admin_name'),
'email_sender_address' => array('recipient_email', 'admin_email'),
'email_recipient_cc' => array('recipient_email', 'admin_email'),
'email_recipient_bcc' => array('recipient_email', 'admin_email'),
'email_replyTo' => array('recipient_email', 'admin_email'),
),
'newsletter_activate' => array(
'recipients' => array('recipient_email', 'admin_email'),
'email_subject' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'subject'),
'email_text' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'email_html' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'file_name' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'file_content' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'email_sender_name' => array('recipient_email', 'admin_email', 'admin_name'),
'email_sender_address' => array('recipient_email', 'admin_email'),
'email_recipient_cc' => array('recipient_email', 'admin_email'),
'email_recipient_bcc' => array('recipient_email', 'admin_email'),
'email_replyTo' => array('recipient_email', 'admin_email'),
),
'newsletter_unsubscribe' => array(
'recipients' => array('recipient_email', 'admin_email'),
'email_subject' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids', 'subject'),
'email_text' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'email_html' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'file_name' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'file_content' => array('domain', 'recipient_email', 'admin_email', 'channels', 'channel_ids'),
'email_sender_name' => array('recipient_email', 'admin_email', 'admin_name'),
'email_sender_address' => array('recipient_email', 'admin_email'),
'email_recipient_cc' => array('recipient_email', 'admin_email'),
'email_recipient_bcc' => array('recipient_email', 'admin_email'),
'email_replyTo' => array('recipient_email', 'admin_email'),
),
)
)
);
13 changes: 12 additions & 1 deletion dca/tl_module.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
*/
$GLOBALS['TL_DCA']['tl_module']['palettes']['registration'] = str_replace('reg_activate;', 'reg_activate,nc_notification,nc_activation_notification;', $GLOBALS['TL_DCA']['tl_module']['palettes']['registration']);
$GLOBALS['TL_DCA']['tl_module']['palettes']['lostPasswordNotificationCenter'] = str_replace('reg_password', 'nc_notification', $GLOBALS['TL_DCA']['tl_module']['palettes']['lostPassword']);
$GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterSubscribeNotificationCenter'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels,disableCaptcha;{text_legend},nl_text{notification_legend},nc_notification;{redirect_legend},jumpTo;{template_legend:hide},nl_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
$GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterActivateNotificationCenter'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels;{notification_legend},nc_notification;{redirect_legend},jumpTo;{template_legend:hide},customTpl;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';
$GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterUnsubscribeNotificationCenter'] = '{title_legend},name,headline,type;{config_legend},nl_channels,nl_hideChannels,disableCaptcha;{notification_legend},nc_notification;{redirect_legend},jumpTo;{template_legend:hide},nl_template;{protected_legend:hide},protected;{expert_legend:hide},guests,cssID';

if (version_compare(VERSION, '4.1', '<')) {
$GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterSubscribeNotificationCenter'] = str_replace(',disableCaptcha', '', $GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterSubscribeNotificationCenter']);
$GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterUnsubscribeNotificationCenter'] = str_replace(',disableCaptcha', '', $GLOBALS['TL_DCA']['tl_module']['palettes']['newsletterUnsubscribeNotificationCenter']);
}

if (strpos($GLOBALS['TL_DCA']['tl_module']['palettes']['personalData'], 'newsletters')) {
$GLOBALS['TL_DCA']['tl_module']['palettes']['personalData'] = str_replace('newsletters;', 'newsletters,nc_notification;', $GLOBALS['TL_DCA']['tl_module']['palettes']['personalData']);
Expand Down Expand Up @@ -44,4 +52,7 @@
*/
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['registration'] = array('member_registration');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['lostPasswordNotificationCenter'] = array('member_password');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_activation_notification']['eval']['ncNotificationChoices']['registration'] = array('member_activation');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['newsletterSubscribeNotificationCenter'] = array('newsletter_subscribe');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['newsletterActivateNotificationCenter'] = array('newsletter_activate');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_notification']['eval']['ncNotificationChoices']['newsletterUnsubscribeNotificationCenter'] = array('newsletter_unsubscribe');
$GLOBALS['TL_DCA']['tl_module']['fields']['nc_activation_notification']['eval']['ncNotificationChoices']['registration'] = array('member_activation');
14 changes: 13 additions & 1 deletion dca/tl_nc_gateway.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
(
'__selector__' => array('type', 'queue_cronEnable', 'email', 'email_overrideSmtp', 'file_connection'),
'default' => '{title_legend},title,type',
'queue' => '{title_legend},title,type;{gateway_legend},queue_targetGateway;{cronjob_legend},queue_cronExplanation,queue_cronEnable',
'queue' => '{title_legend},title,type;{gateway_legend},queue_targetGateway,queue_delay;{cronjob_legend},queue_cronExplanation,queue_cronEnable',
'email' => '{title_legend},title,type;{gateway_legend},email_overrideSmtp,',
'file' => '{title_legend},title,type;{gateway_legend},file_type,file_connection',
'postmark' => '{title_legend},title,type;{gateway_legend},postmark_key,postmark_test,postmark_ssl',
Expand Down Expand Up @@ -164,6 +164,18 @@
'eval' => array('mandatory'=>true, 'includeBlankOption'=>true, 'tl_class'=>'w50'),
'sql' => "int(10) NOT NULL default '0'"
),
'queue_delay' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_gateway']['queue_delay'],
'exclude' => true,
'inputType' => 'text',
'eval' => array('maxlength' => 64, 'tl_class'=>'w50'),
'sql' => "varchar(64) NOT NULL default ''",
'save_callback' => array
(
array('NotificationCenter\tl_nc_gateway', 'validateQueueDelay')
),
),
'queue_cronExplanation' => array
(
'exclude' => true,
Expand Down
11 changes: 9 additions & 2 deletions dca/tl_nc_language.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
'ptable' => 'tl_nc_message',
'dataContainer' => 'Table',
'enableVersioning' => true,
'nc_type_query' => "SELECT type FROM tl_nc_notification WHERE id=(SELECT pid FROM tl_nc_message WHERE id=(SELECT pid FROM tl_nc_language WHERE id=?))",
'oncreate_callback' => array
(
array('NotificationCenter\tl_nc_language', 'insertGatewayType'),
Expand Down Expand Up @@ -102,7 +101,7 @@
(
'__selector__' => array('gateway_type', 'email_mode'),
'default' => '{general_legend},language,fallback',
'email' => '{general_legend},language,fallback;{meta_legend},email_sender_name,email_sender_address,recipients,email_recipient_cc,email_recipient_bcc,email_replyTo;{content_legend},email_subject,email_mode;{attachments_legend},attachments,attachment_tokens',
'email' => '{general_legend},language,fallback;{meta_legend},email_sender_name,email_sender_address,recipients,email_recipient_cc,email_recipient_bcc,email_replyTo;{content_legend},email_subject,email_mode;{attachments_legend},attachments,attachment_templates,attachment_tokens',
'file' => '{general_legend},language,fallback;{meta_legend},file_name,file_storage_mode;{content_legend},file_content',
'postmark' => '{general_legend},language,fallback;{meta_legend},email_sender_name,email_sender_address,recipients,email_recipient_cc,email_recipient_bcc,email_replyTo;{content_legend},email_subject,email_mode',
),
Expand Down Expand Up @@ -190,6 +189,14 @@
'eval' => array('multiple'=>true, 'fieldType'=>'checkbox', 'files'=>true, 'filesOnly'=>true, 'tl_class'=>'clr'),
'sql' => "blob NULL"
),
'attachment_templates' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_language']['attachment_templates'],
'exclude' => true,
'inputType' => 'fileTree',
'eval' => array('multiple'=>true, 'fieldType'=>'checkbox', 'files'=>true, 'filesOnly'=>true, 'tl_class'=>'clr', 'extensions'=>'xml,txt'),
'sql' => "blob NULL"
),
'email_sender_name' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_language']['email_sender_name'],
Expand Down
13 changes: 11 additions & 2 deletions dca/tl_nc_notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
(
'__selector__' => array('type'),
'default' => '{title_legend},title,type;',
'core_form' => '{title_legend},title,type;{config_legend},flatten_delimiter',
'core_form' => '{title_legend},title,type;{config_legend},flatten_delimiter;{templates_legend:hide},templates',
),

// Fields
Expand Down Expand Up @@ -138,6 +138,15 @@
'default' => ',',
'eval' => array('doNotTrim'=>true),
'sql' => "varchar(255) NOT NULL default ''"
)
),
'templates' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_notification']['templates'],
'exclude' => true,
'inputType' => 'select',
'options' => \Backend::getTemplateGroup('notification_'),
'eval' => array('multiple'=>true, 'includeBlankOption'=>true, 'chosen'=>true, 'tl_class'=>'clr'),
'sql' => "blob NULL",
),
)
);
16 changes: 15 additions & 1 deletion dca/tl_nc_queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
'notEditable' => true,
'notCopyable' => true,
'notSortable' => true,
'ondelete_callback' => [
['NotificationCenter\tl_nc_queue', 'onDeleteCallback'],
],
'sql' => array
(
'keys' => array
Expand Down Expand Up @@ -112,6 +115,12 @@
'flag' => 6,
'sql' => "int(10) unsigned NOT NULL default '0'"
),
'dateDelay' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_queue']['dateDelay'],
'flag' => 6,
'sql' => "int(10) unsigned NULL"
),
'dateSent' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_queue']['dateSent'],
Expand All @@ -136,6 +145,11 @@
'label' => &$GLOBALS['TL_LANG']['tl_nc_queue']['language'],
'filter' => true,
'sql' => "varchar(5) NOT NULL default ''"
)
),
'attachments' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_nc_queue']['attachments'],
'sql' => "blob NULL"
),
)
);
Loading

0 comments on commit 4255119

Please sign in to comment.