diff --git a/booking.emails.inc b/booking.emails.inc
index 260f22c..fec5fc7 100644
--- a/booking.emails.inc
+++ b/booking.emails.inc
@@ -1,5 +1,46 @@
'booking',
+ 'key' => 'registration_mail',
+ 'body' => $body,
+ 'subject' => $subject,
+ 'footer' => $message_footer,
+ 'colors' => $colors,
+ 'header_links' => $header_links,
+ 'social_links' => $social_links,
+ ));
+ }
+ else {
+ $output_text = $body;
+ }
+
+ watchdog('booking_debug', "
HTML body themed\n@info
", array('@info' => print_r($output_text, true)));
+ return $output_text;
+}
+
/**
* Function to send email to registrant after completing registration process
*
@@ -41,6 +82,11 @@ function _booking_registration_email($nid, $balance_payment, $manual = false) {
}
$params['subject'] = $subject;
+ $raw_body = _booking_registration_email_generate($node, $tokens, $waiting_list, $balance_payment, $manual);
+ $themed_body = _booking_generate_html_body($subject, $raw_body, $tokens);
+ $params['body'] = $themed_body;
+
+ /*
//get the footer text
$message_footer = variable_get('booking_html_mail_footer');
$message_footer = isset($message_footer['format']) ? $message_footer['value'] : $message_footer;
@@ -64,6 +110,7 @@ function _booking_registration_email($nid, $balance_payment, $manual = false) {
$body = _booking_registration_email_generate($node, $tokens, $waiting_list, $balance_payment, $manual);
$params['body'] = $body;
}
+ */
if (variable_get('booking_bcc_notify_email_workflow', 0) == 1) {
$params['headers']['Bcc'] = variable_get('booking_notify_email', variable_get('site_mail', ini_get('sendmail_from')));
diff --git a/booking.install b/booking.install
index 47619f9..9b53514 100644
--- a/booking.install
+++ b/booking.install
@@ -737,20 +737,10 @@ function booking_update_7249() {
}
/**
-* Create table to store configuration for HTML email templates
+* Deprecated - Create table to store configuration for HTML email templates
*/
-function booking_update_7250() {
/*
-* Add fields for this:
- Up to 3 instances of
- - link text
- - link URL
-
- Up to 4 instances of
- - social media title
- - social media icon URL
- - social media link
-*/
+function booking_update_7250() {
$booking_mailtemplate_fields = array(
'fields' => array(
'mid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
@@ -768,6 +758,7 @@ function booking_update_7250() {
//update the view to match the new table definition
_booking_node_create_mysqlview();
}
+*/
/**
* Implementation of hook_install().
diff --git a/booking.mailtemplate_admin.inc b/booking.mailtemplate_admin.inc
index c86fea7..39829cc 100644
--- a/booking.mailtemplate_admin.inc
+++ b/booking.mailtemplate_admin.inc
@@ -13,7 +13,12 @@
$social_media_link_max_count = 5;
$prefix = "Configure HTML email template
";
-
+
+ $colors = json_decode(variable_get('booking_mailtemplate_colors'), TRUE);
+ $header_links = json_decode(variable_get('booking_mailtemplate_header_links'), TRUE);
+ $social_links = json_decode(variable_get('booking_mailtemplate_social_links'), TRUE);
+
+ /*
//query for existing header links
$query = db_select('booking_mailtemplate_fields', 'm');
$query->condition('m.booking_mailtemplate_media_type', 'header', '=');
@@ -25,6 +30,7 @@
$query->condition('m.booking_mailtemplate_media_type', 'socialmedia', '=');
$query->fields('m');
$social_media_links = $query->execute()->fetchAllAssoc('mid');
+ */
$form['colors'] = array(
'#type' => 'fieldset',
@@ -38,7 +44,7 @@
'#description' => t('Specify CSS compatible value'),
'#size' => 10,
'#maxlength' => 50,
- '#default_value' => variable_get('booking_mailtemplate_background_color','#FFFFFF'),
+ '#default_value' => empty($colors['booking_mailtemplate_background_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_background_color'],
);
$form['colors']['booking_mailtemplate_content_background_color'] = array (
'#type' => 'textfield',
@@ -46,7 +52,7 @@
'#description' => t('Specify CSS compatible value'),
'#size' => 10,
'#maxlength' => 50,
- '#default_value' => variable_get('booking_mailtemplate_content_background_color','#FFFFFF'),
+ '#default_value' => empty($colors['booking_mailtemplate_content_background_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_content_background_color'],
);
$form['colors']['booking_mailtemplate_header_background_color'] = array (
'#type' => 'textfield',
@@ -54,7 +60,7 @@
'#description' => t('Specify CSS compatible value'),
'#size' => 10,
'#maxlength' => 50,
- '#default_value' => variable_get('booking_mailtemplate_header_background_color','#FFFFFF'),
+ '#default_value' => empty($colors['booking_mailtemplate_header_background_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_header_background_color'],
);
$form['colors']['booking_mailtemplate_text_color'] = array (
'#type' => 'textfield',
@@ -62,7 +68,7 @@
'#description' => t('Specify CSS compatible value'),
'#size' => 10,
'#maxlength' => 50,
- '#default_value' => variable_get('booking_mailtemplate_text_color','#FFFFFF'),
+ '#default_value' => empty($colors['booking_mailtemplate_text_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_text_color'],
);
$form['colors']['booking_mailtemplate_link_color'] = array (
'#type' => 'textfield',
@@ -70,7 +76,7 @@
'#description' => t('Specify CSS compatible value'),
'#size' => 10,
'#maxlength' => 50,
- '#default_value' => variable_get('booking_mailtemplate_link_color','#FFFFFF'),
+ '#default_value' => empty($colors['booking_mailtemplate_link_color']) ? '#FFFFFF' : $colors['booking_mailtemplate_link_color'],
);
$form['booking_mailtemplate_header_image_url'] = array (
@@ -164,4 +170,35 @@
),
'form' => $form,
);
+}
+
+function booking_mailtemplate_form_submit($form, &$form_state)
+{
+ global $event;
+ $values = $form_state['input'];
+ $colors_variable_list = array('booking_mailtemplate_background_color', 'booking_mailtemplate_content_background_color',
+ 'booking_mailtemplate_header_background_color', 'booking_mailtemplate_text_color', 'booking_mailtemplate_link_color',
+ );
+ $header_links_variable_list = array();
+ $social_links_variable_list = array();
+
+ $color_data = array();
+ $header_data = array();
+ $social_data = array();
+ // 'booking_mailtemplate_header_image_url', 'booking_mailtemplate_header_link_url');
+
+ //set all the values that are just using the builtin drupal variable definitions
+ foreach ($values as $key => $value) {
+ if (in_array($key, $colors_variable_list, FALSE)) {
+ //variable_set($key, $value);
+ $color_data[$key] = $value;
+ }
+ }
+
+ variable_set('booking_mailtemplate_colors', json_encode($color_data));
+
+ //update header links
+
+ //update social media links
+
}
\ No newline at end of file
diff --git a/booking.module b/booking.module
index 9b7591a..11281ae 100644
--- a/booking.module
+++ b/booking.module
@@ -895,9 +895,15 @@ function booking_theme($existing, $type, $theme, $path) {
'template' => 'mimemail-message' // extension of .tpl.php automatically added
),
'booking_htmlmail_registration_mail' => array(
- 'variables' => array('subject' => NULL, 'body' => NULL, 'footer' => NULL, 'links' => NULL),
+ 'variables' => array('subject' => NULL,
+ 'body' => NULL,
+ 'footer' => NULL,
+ 'colors' => NULL,
+ 'header_links' => NULL,
+ 'social_links' => NULL
+ ),
'path' => $theme_path,
- 'image_path' => drupal_get_path('module', 'booking'). '/images',
+ //'image_path' => drupal_get_path('module', 'booking'). '/images',
'template' => $template_file,
),
);