← Back to team overview

mvhub-dev team mailing list archive

[Merge] lp:~leegoodrich/mvhub/add_text_wrap_to_reminders into lp:mvhub

 

Lee Goodrich has proposed merging lp:~leegoodrich/mvhub/add_text_wrap_to_reminders into lp:mvhub.

Requested reviews:
  mvhub-dev (mvhub-dev)


Took Dan's text wrap branch and fixed the kludge for the quick login URL 
and added two more to properly format the contact info and signature.
-- 
https://code.launchpad.net/~leegoodrich/mvhub/add_text_wrap_to_reminders/+merge/22721
Your team mvhub-dev is subscribed to branch lp:mvhub.
=== modified file 'app-mvhub/bin/notification_email.pl'
--- app-mvhub/bin/notification_email.pl	2010-03-31 20:04:36 +0000
+++ app-mvhub/bin/notification_email.pl	2010-04-02 19:10:32 +0000
@@ -34,13 +34,13 @@
     /;
 
 # Config File Variables
-my $CFG
-    = MVHub::Utils::ConfigSimple::create_config_from( $ENV{MV_CONFIG_FILE} );
+my $cfg_filename = $ARGV[0] || $ENV{MV_CONFIG_FILE};
+my $CFG = MVHub::Utils::ConfigSimple::create_config_from($cfg_filename);
 
 my $MAX_NOTIFICATIONS = $CFG->param('NOTIFICATION.max_notifications');
 my $EXPIRE_MONTHS     = $CFG->param('NOTIFICATION.expire_months');
 
-my $DBH = MVHub::Utils::DB::get_dbh( $ENV{MV_CONFIG_FILE} );
+my $DBH = MVHub::Utils::DB::get_dbh($cfg_filename);
 
 # Email Template Paths
 my $TEMPLATE_PATH = $CFG->param('ABSOLUTE_PATH.template_text_dir');

=== modified file 'app-mvhub/conf/templates/text/reminder_email_01.tmpl'
--- app-mvhub/conf/templates/text/reminder_email_01.tmpl	2010-03-31 20:04:36 +0000
+++ app-mvhub/conf/templates/text/reminder_email_01.tmpl	2010-04-02 19:10:32 +0000
@@ -23,11 +23,10 @@
 of its programs, let us know and we will stop emailing you. 
 You can reach us at:
 
-  <!--TMPL_VAR name="contact_us_email"--> 
-  <!--TMPL_VAR name="contact_us_phone"-->
+<!--TMPL_VAR name="contact_info"--> 
 
 Please let us know if you have any other questions or concerns.
 	
 Thanks so much,
-<!--TMPL_VAR name="signer"-->
-<!--TMPL_VAR name="team_name"-->
+<!--TMPL_VAR name="signature"-->
+

=== modified file 'app-mvhub/conf/templates/text/reminder_email_02.tmpl'
--- app-mvhub/conf/templates/text/reminder_email_02.tmpl	2010-03-31 20:04:36 +0000
+++ app-mvhub/conf/templates/text/reminder_email_02.tmpl	2010-04-02 19:10:32 +0000
@@ -19,11 +19,9 @@
 of its programs, let us know and we will stop emailing you. 
 You can reach us at:
 
-  <!--TMPL_VAR name="contact_us_email"--> 
-  <!--TMPL_VAR name="contact_us_phone"-->
+<!--TMPL_VAR name="contact_info"--> 
 
 Please let us know if you have questions or concerns.
 	
 Thank you very much. 
-<!--TMPL_VAR name="signer"-->
-<!--TMPL_VAR name="team_name"-->
+<!--TMPL_VAR name="signature"-->

=== modified file 'app-mvhub/conf/templates/text/reminder_email_03.tmpl'
--- app-mvhub/conf/templates/text/reminder_email_03.tmpl	2010-03-31 20:04:36 +0000
+++ app-mvhub/conf/templates/text/reminder_email_03.tmpl	2010-04-02 19:10:32 +0000
@@ -18,11 +18,10 @@
 of its programs, let us know and we will stop emailing you. 
 You can reach us at:
 
-  <!--TMPL_VAR name="contact_us_email"--> 
-  <!--TMPL_VAR name="contact_us_phone"-->
+<!--TMPL_VAR name="contact_info"--> 
 
 Please let us know if you have any other questions or concerns.
 	
 Thanks,
-<!--TMPL_VAR name="signer"-->
-<!--TMPL_VAR name="team_name"-->
+<!--TMPL_VAR name="signature"-->
+

=== modified file 'app-mvhub/conf/templates/text/reminder_email_04.tmpl'
--- app-mvhub/conf/templates/text/reminder_email_04.tmpl	2010-03-31 20:04:36 +0000
+++ app-mvhub/conf/templates/text/reminder_email_04.tmpl	2010-04-02 19:10:32 +0000
@@ -24,11 +24,10 @@
 of its programs, let us know and we will stop emailing you. 
 You can reach us at:
 
-  <!--TMPL_VAR name="contact_us_email"--> 
-  <!--TMPL_VAR name="contact_us_phone"-->
+<!--TMPL_VAR name="contact_info"--> 
 
 Please let us know if you have any other questions or concerns.
 	
 Thank you,
-<!--TMPL_VAR name="signer"-->
-<!--TMPL_VAR name="team_name"-->
+<!--TMPL_VAR name="signature"-->
+

=== modified file 'app-mvhub/conf/templates/text/reminder_email_05.tmpl'
--- app-mvhub/conf/templates/text/reminder_email_05.tmpl	2010-03-31 20:04:36 +0000
+++ app-mvhub/conf/templates/text/reminder_email_05.tmpl	2010-04-02 19:10:32 +0000
@@ -19,11 +19,9 @@
 If you are receiving this email in error, let us know and we 
 will stop emailing you. You can reach us at:
   
-  <!--TMPL_VAR name="contact_us_email"--> 
-  <!--TMPL_VAR name="contact_us_phone"-->
+<!--TMPL_VAR name="contact_info"--> 
 
 Please let us know if you have any other questions or concerns.
 
 Thanks so much,
-<!--TMPL_VAR name="signer"-->
-<!--TMPL_VAR name="team_name"-->
+<!--TMPL_VAR name="signature"-->

=== modified file 'lib-mvhub/lib/MVHub/Notifications.pm'
--- lib-mvhub/lib/MVHub/Notifications.pm	2010-03-30 21:00:29 +0000
+++ lib-mvhub/lib/MVHub/Notifications.pm	2010-04-02 19:10:32 +0000
@@ -10,6 +10,7 @@
 use MVHub::Utils::DB qw/get_sql_select_statement get_sql_update_statement/;
 
 use HTML::Template;
+use Text::Wrap qw/ fill $columns/;
 
 our ($VERSION) = '$Revision: 1334 $' =~ /([.\d]+)/;
 
@@ -42,24 +43,51 @@
     my $notice_href          = shift;
 
     my $tmpl = HTML::Template->new( filename => $template_file );
-
     my $quick_login_url
         = MVHub::Utils::generate_quick_login_url(
         $email_constants_href->{website_name},
         $notice_href->{agency_id} );
+    $tmpl->param(
+        first_name  => $notice_href->{contact_first_name},
+        agency_name => $notice_href->{agency_name},
+
+        #       contact_us_email => $email_constants_href->{admin_email},
+        #       contact_us_phone => $email_constants_href->{admin_phone},
+        contact_info    => '<!--TMPL_VAR name="contact_info"-->',
+        signature       => '<!--TMPL_VAR name="signature"-->',
+        expired_records => '<!--TMPL_VAR name="expired_records"-->',
+
+        #        signer           => $email_constants_href->{admin_name},
+        #        team_name        => $email_constants_href->{team_name},
+        website_name    => $email_constants_href->{website_name},
+        quick_login_url => $quick_login_url,
+    );
+
+    # wrap text to 75 columns
+    $Text::Wrap::columns = 75;
+    $Text::Wrap::huge    = 'overflow';
+    my @paragraphs = split /\n/, $tmpl->output();
+    my @text = Text::Wrap::fill( '', '', @paragraphs );
+    my $text = join "\n", @text;
+
+    # we jump through this hoop because we
+    # we don't want to wrap the indented list
+    # of expired records
+    $tmpl = HTML::Template->new( scalarref => \$text );
     my $expired_records
         = _format_expired_record_list( $notice_href->{expired_record_list} );
 
+    # we jump through this hoop because we
+    # NEVER want wrap a URL and break it
+    my $contact_info
+        = "   $email_constants_href->{admin_email}\n   $email_constants_href->{admin_phone}";
+    my $signature
+        = "\n$email_constants_href->{admin_name}\n$email_constants_href->{team_name}";
+
     $tmpl->param(
-        first_name       => $notice_href->{contact_first_name},
-        agency_name      => $notice_href->{agency_name},
-        contact_us_email => $email_constants_href->{admin_email},
-        contact_us_phone => $email_constants_href->{admin_phone},
-        expired_records  => $expired_records,
-        signer           => $email_constants_href->{admin_name},
-        team_name        => $email_constants_href->{team_name},
-        website_name     => $email_constants_href->{website_name},
-        quick_login_url  => $quick_login_url,
+        expired_records => $expired_records,
+        contact_info    => $contact_info,
+        signature       => $signature,
     );
 
     return $tmpl->output();


Follow ups