Index: CHANGELOG.txt
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/publicbookings/CHANGELOG.txt,v
retrieving revision 1.6.2.13
diff -r1.6.2.13 CHANGELOG.txt
2a3
> feature #468168 by tirsales: Text of email-confirmations now configurable
Index: publicbookings.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/publicbookings/publicbookings.admin.inc,v
retrieving revision 1.15.2.2
diff -r1.15.2.2 publicbookings.admin.inc
16,18d15
<   //echo '<pre>';
<   //print_r($view);
<   //echo '</pre>';
455a453,616
>   $form['mail'] = array(
>     '#type' => 'fieldset',
>     '#title' => t('Content of client-mails'),
>     '#description' => t('Contains settings for the content of Emails, send to clients. A couple of 
>     parameters can be used:
>     <ul><li>%passphrase: Contains the passphrase of this booking</li>
>     <li>%url: Contains an URL where the client can view and edit the booking</li>
>     <li>%name: Contains the name of the booking</li>
>     <li>%resource_name: Contains the name of the resource booked</li>
>     <li>%start: Contains the start date and time</li>
>     <li>%end: Contains the end date and time</li>
>     <li>%prefix: Contains the subject-prefix</li>
>     <li>%postfix: Contains the subject-postfix</li>
>     <li>%header: Contains the body header</li>
>     <li>%footer: Contains the body footer</li></ul>'),
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['all'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Content of every client-mail',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['all']['_publicbookings_all_body_header'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Email Header'),
>     '#description' => t('Header that will be printed with %header and in front of each mail-body.'),
>     '#default_value' => variable_get('publicbookings_all_body_header',''),
>   );
>   $form['mail']['all']['_publicbookings_all_body_footer'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Email Footer'),
>     '#description' => t('Footer that will be printed with %footer and after each mail-body.'),
>     '#default_value' => variable_get('publicbookings_all_body_footer',''),
>   );
>   $form['mail']['all']['_publicbookings_all_subject_prefix'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Email subject prefix'),
>     '#description' => t('Prefix that will be printed with %prefix and in front of each subject.'),
>     '#default_value' => variable_get('publicbookings_all_subject_prefix',''),
>   );
>   $form['mail']['all']['_publicbookings_all_subject_postfix'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Email subject postfix'),
>     '#description' => t('Postfix that will be printed with %postfix and after each subject.'),
>     '#default_value' => variable_get('publicbookings_all_subject_postfix',''),
>   );
> 
> 
>   $form['mail']['confirm'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Content of confirmation requests',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['confirm']['_publicbookings_request_confirm_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject of requests for confirmation'),
>     '#default_value' => variable_get('publicbookings_request_confirm_subject',''),
>   );
>   $form['mail']['confirm']['_publicbookings_request_confirm_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body of requests for confirmation'),
>     '#default_value' => variable_get('publicbookings_request_confirm_body',''),
>   );
> 
>   $form['mail']['pending'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Booking request now pending review',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['pending']['_publicbookings_request_pending_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject'),
>     '#default_value' => variable_get('publicbookings_request_pending_subject',''),
>   );
>   $form['mail']['pending']['_publicbookings_request_pending_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body'),
>     '#default_value' => variable_get('publicbookings_request_pending_body',''),
>   );
> 
>   $form['mail']['finalized'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Booking request finalized',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['finalized']['_publicbookings_request_finalized_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject'),
>     '#default_value' => variable_get('publicbookings_request_finalized_subject',''),
>   );
>   $form['mail']['finalized']['_publicbookings_request_finalized_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body'),
>     '#default_value' => variable_get('publicbookings_request_finalized_body',''),
>   );
> 
>   $form['mail']['denied'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Booking request denied',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['denied']['_publicbookings_request_denied_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject'),
>     '#default_value' => variable_get('publicbookings_request_denied_subject',''),
>   );
>   $form['mail']['denied']['_publicbookings_request_denied_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body'),
>     '#default_value' => variable_get('publicbookings_request_denied_body',''),
>   );
> 
>   $form['mail']['updated'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Booking request updated',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['updated']['_publicbookings_request_updated_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject'),
>     '#default_value' => variable_get('publicbookings_request_updated_subject',''),
>   );
>   $form['mail']['updated']['_publicbookings_request_updated_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body'),
>     '#default_value' => variable_get('publicbookings_request_updated_body',''),
>   );
> 
>   $form['mail']['cancelled'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Booking request now cancelled',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['cancelled']['_publicbookings_request_cancelled_subject'] = array(
>     '#type'  => 'textfield',
>     '#title' => t('Subject'),
>     '#default_value' => variable_get('publicbookings_request_cancelled_subject',''),
>   );
>   $form['mail']['cancelled']['_publicbookings_request_cancelled_body'] = array(
>     '#type'  => 'textarea',
>     '#title' => t('Body'),
>     '#default_value' => variable_get('publicbookings_request_cancelled_body',''),
>   );
> 
>   $form['mail']['reset'] = array(
>     '#type' => 'fieldset',
>     '#title' => 'Reset mail content',
>     '#collapsible' => TRUE,
>     '#collapsed' => TRUE,
>   );
>   $form['mail']['reset']['publicbookings_mail_reset'] = array(
>     '#type' => 'checkbox',
>     '#title' => 'Reset every mail to its default',
>     '#default_value' => FALSE,
>   );
> 
473a635,636
> 
>   $form['#submit'][] = 'publicbookings_settings_submit';
482d644
<   watchdog('foo','<pre>'.print_r($form_state,true).'</pre>');
500a663,684
>   if ($form_state['values']['publicbookings_mail_reset']) {
>     require_once('publicbookings.install');
>     publicbookings_variable_init();
>   }
>   else {
>     variable_set('publicbookings_all_subject_prefix', $form_state['values']['_publicbookings_all_subject_prefix']);
>     variable_set('publicbookings_all_subject_postfix', $form_state['values']['_publicbookings_all_subject_postfix']);
>     variable_set('publicbookings_all_body_header', $form_state['values']['_publicbookings_all_body_header']);
>     variable_set('publicbookings_all_body_footer', $form_state['values']['_publicbookings_all_body_footer']);
>     variable_set('publicbookings_request_confirm_subject', $form_state['values']['_publicbookings_request_confirm_subject']);
>     variable_set('publicbookings_request_confirm_body', $form_state['values']['_publicbookings_request_confirm_body']);
>     variable_set('publicbookings_request_pending_subject', $form_state['values']['_publicbookings_request_pending_subject']);
>     variable_set('publicbookings_request_pending_body', $form_state['values']['_publicbookings_request_pending_body']);
>     variable_set('publicbookings_request_finalized_subject', $form_state['values']['_publicbookings_request_finalized_subject']);
>     variable_set('publicbookings_request_finalized_body', $form_state['values']['_publicbookings_request_finalized_body']);
>     variable_set('publicbookings_request_denied_subject', $form_state['values']['_publicbookings_request_denied_subject']);
>     variable_set('publicbookings_request_denied_body', $form_state['values']['_publicbookings_request_denied_body']);
>     variable_set('publicbookings_request_updated_subject', $form_state['values']['_publicbookings_request_updated_subject']);
>     variable_set('publicbookings_request_updated_body', $form_state['values']['_publicbookings_request_updated_body']);
>     variable_set('publicbookings_request_cancelled_subject', $form_state['values']['_publicbookings_request_cancelled_subject']);
>     variable_set('publicbookings_request_cancelled_body', $form_state['values']['_publicbookings_request_cancelled_body']);
>   }
Index: publicbookings.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/publicbookings/publicbookings.install,v
retrieving revision 1.5.2.1
diff -r1.5.2.1 publicbookings.install
14a15,16
>   publicbookings_variable_init();
> 
28a31,82
>   variable_del('publicbookings_all_body_header');
>   variable_del('publicbookings_all_body_footer');
>   variable_del('publicbookings_all_subject_prefix');
>   variable_del('publicbookings_all_subject_postfix');
>   variable_del('publicbookings_request_confirm_subject');
>   variable_del('publicbookings_request_confirm_body');
>   variable_del('publicbookings_request_pending_subject');
>   variable_del('publicbookings_request_pending_body');
>   variable_del('publicbookings_request_finalized_subject');
>   variable_del('publicbookings_request_finalized_body');
>   variable_del('publicbookings_request_denied_subject');
>   variable_del('publicbookings_request_denied_body');
>   variable_del('publicbookings_request_updated_subject');
>   variable_del('publicbookings_request_updated_body');
>   variable_del('publicbookings_request_cancelled_subject');
>   variable_del('publicbookings_request_cancelled_body');
> }
> 
> function publicbookings_variable_init() {
>   $default_header = '';
>   $default_footer = "\n".t('The details of your booking request follow.');
>   $default_footer .= "\n". t("Booking name: %name") ."\n";
>   $default_footer .= "\n". t('Resource: %resource_name') ."\n";
>   $default_footer .= "\n". t("Start: %start") ."\n";
>   $default_footer .= "\n". t("End: %end") ."\n";
>   $default_prefix = '';
>   $default_postfix = '';
>   variable_set('publicbookings_all_body_header',$default_header);
>   variable_set('publicbookings_all_body_footer',$default_footer);
>   variable_set('publicbookings_all_subject_prefix',$default_prefix);
>   variable_set('publicbookings_all_subject_postfix',$default_postfix);
>   variable_set('publicbookings_request_confirm_subject','%prefix '.t('Confirm your booking request').' %postfix');
>   $body = t('Please visit the link below to confirm your booking request:') ."\n\n";
>   $body .= "%url\n\n";
>   $body .= t('Your passphrase is %passphrase.');
>   $body .= t('You can use this passphrase to return to your booking request and make changes if necessary.') ."\n\n";
>   variable_set('publicbookings_request_confirm_body', "%header\n".$body."\n%footer");
>   variable_set('publicbookings_request_pending_subject','%prefix '.t('Your booking request is now pending review').' %postfix');
>   $body .= t('Your email address has been successfully confirmed. A booking manager will review your request as soon as possible.');
>   variable_set('publicbookings_request_pending_body',"%header\n".$body."\n%footer");
>   variable_set('publicbookings_request_finalized_subject','%prefix '.t('Your booking request is now finalized').' %postfix');
>   $body .= t('Your booking request was approved, and is now finalized.');
>   variable_set('publicbookings_request_finalized_body',"%header\n".$body."\n%footer");
>   variable_set('publicbookings_request_denied_subject','%prefix '.t('Your booking request was denied'.' %postfix'));
>   $body = t('Your booking request was denied.');
>   variable_set('publicbookings_request_denied_body',"%header\n".$body."\n%footer");
>   variable_set('publicbookings_request_updated_subject','%prefix '.t('Your booking request was updated').' %postfix');
>   $body = t('Your booking request was updated.');
>   variable_set('publicbookings_request_updated_body',"%header\n".$body."\n%footer");
>   variable_set('publicbookings_request_cancelled_subject','%prefix '.t('Your booking request was cancelled').' %postfix');
>   $body = t('Your booking request was cancelled.');
>   variable_set('publicbookings_request_cancelled_body',"%header\n".$body."\n%footer");
204a259,266
> 
> /**
>  * Update from ALPHA4
>  */
> function publicbookings_update_6002() {
>   publicbookings_variable_init();
>   return array();
> }
Index: publicbookings.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/publicbookings/publicbookings.module,v
retrieving revision 1.13.2.7
diff -r1.13.2.7 publicbookings.module
402,436d401
<   switch ($key) {
<     case 'request_confirm':
<       $subject = t('Confirm your booking request');
<       $body = t('Please visit the link below to confirm your booking request:') ."\n\n";
<       $body .= 'http://'. $_SERVER['SERVER_NAME'] . url('publicbookings/request/confirm/'.$params['passphrase'])."\n\n";
<       $body .= t('Your passphrase is %passphrase.');
<       $body .= t('You can use this passphrase to return to your booking request and make changes if necessary.') ."\n\n";
<       break;
<     case 'request_pending':
<       $subject = t('Your booking request is now pending review');
<       $body = t('Your email address has been successfully confirmed. A booking manager will review your request as soon as possible.');
<       break;
<     case 'request_finalized':
<       $subject = t('Your booking is now finalized');
<       $body = t('Your booking request was approved, and is now finalized.');
<       break;
<     case 'request_denied':
<       $subject = t('Your booking request was denied');
<       $body = t('Your booking request was denied.');
<       break;
<     case 'request_updated':
<       $subject = t('Your booking request was updated');
<       $body = t('Your booking request was updated.');
<       break;
<     case 'request_cancelled':
<       $subject = t('Your booking request was cancelled');
<       $body = t('Your booking request was cancelled.');
<       break;
<   }
<   $body .= t('The details of your booking request follow.');
<   $body .= "\n". t("Booking name: %name") ."\n";
<   $body .= "\n". t('Resource: %resource_name') ."\n";
<   $body .= "\n". t("Start: %start") ."\n";
<   $body .= "\n". t("End: %end") ."\n";
< 
441c406,423
<   $message['subject'] = $subject;
---
>   if ( array_key_exists('passphrase',$params) ) {
>     $vars['%url'] = 'http://'. $_SERVER['SERVER_NAME'] . url('publicbookings/request/confirm/'.$params['passphrase']);
>   }
> 
>   $config_header  = variable_get('publicbookings_all_body_header','');
>   $config_footer  = variable_get('publicbookings_all_body_footer','');
>   $config_prefix  = variable_get('publicbookings_all_subject_prefix','');
>   $config_postfix = variable_get('publicbookings_all_subject_postfix','');
> 
>   $vars['%header'] = strtr($config_header, $vars);
>   $vars['%footer'] = strtr($config_footer, $vars);
>   $vars['%prefix'] = strtr($config_prefix, $vars);
>   $vars['%postfix'] = strtr($config_postfix, $vars);
> 
>   $subject = variable_get('publicbookings_'.$key.'_subject','');
>   $body    = variable_get('publicbookings_'.$key.'_body','');
> 
>   $message['subject'] = strtr($subject,$vars);
