Browse Source

Making the imported pub email be HTML when sent

spficklin 12 years ago
parent
commit
679304119b

+ 1 - 5
tripal_pub/api/tripal_pub.api.inc

@@ -251,11 +251,7 @@ function tripal_pub_import_publications($report_email = FALSE) {
   // requested a report then we don't want to print any syncing information
   // so pass 'FALSE' to the sync call
   print "Syncing publications with Drupal...\n";
-  if ($do_report) {
-    tripal_pub_sync_pubs(FALSE);
-  } else {
-    tripal_pub_sync_pubs(TRUE);
-  }
+  tripal_pub_sync_pubs();
   
   // iterate through each of the reports and generate a final report with HTML links
   $HTML_report = '';

+ 2 - 4
tripal_pub/includes/pub_sync.inc

@@ -60,7 +60,7 @@ function tripal_pub_sync_pubs($job_id = NULL) {
  *   
  * @ingroup tripal_pub
  */
-function tripal_pub_sync_pub($pub, $report = FALSE) {
+function tripal_pub_sync_pub($pub) {
   global $user;
   
   $new_node = new stdClass();
@@ -79,9 +79,7 @@ function tripal_pub_sync_pub($pub, $report = FALSE) {
     $node = node_submit($new_node);
     node_save($node);
     if ($node->nid) {
-      if ($report) {
-        print "Added " . $pub->pub_id . "\n";
-      }      
+      print "Added " . $pub->pub_id . "\n";      
     }
     else {
       print "ERROR: Unable to create publication node: " . $pub->title . "\n";

+ 2 - 1
tripal_pub/theme/tripal_pub_admin.tpl.php

@@ -50,12 +50,13 @@ been added to Chado database.
     the site by creating a cron job with a <?php print l('Drush', "http://drupal.org/project/drush")?> command. The 
     cron job can be setup to run the importers periodically.  The following
     is an example entry, added to the 'root' crontab, that would run importers on a weekly bases (Friday at 9am):  <br>
-    <pre>0 9 * * 5  su - [web user] -c 'cd [drupal install path]; drush -l http://[site url] tpubs-import --report=Y'
+    <pre>0 9 * * 5  su - [web user] -c 'cd [drupal install path]; drush -l http://[site url] tpubs-import --report=[email]'
     </pre>
     Where:<br>
      [web user] is the name of the user on the system under which the web server runs</br>
      [drupal install path] is the location where drupal is installed</br>
      [site url] is the URL path for the site </br>
+     [email] is the email address of the person who should receive an HTML report of the publications added.  Separate multiple emails with a comma (no spaces).</br>
      The --report=Y option indicates that an HTML style report should be generated listing the publications
      that were added.  If this options is not used then no report is generated.
     </p></li>

+ 9 - 0
tripal_pub/tripal_pub.module

@@ -810,6 +810,15 @@ function tripal_pub_mail($key, &$message, $params) {
   $variables = user_mail_tokens($params['account'], $language);
   switch($key) {
     case 'import_report':
+      $headers = array(
+        'MIME-Version' => '1.0',
+        'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
+        'Content-Transfer-Encoding' => '8Bit',
+        'X-Mailer' => 'Drupal'
+      );
+      foreach ($headers as $key => $value) {
+        $message['headers'][$key] = $value;
+      }
       $message['subject'] = t('Publication import from !site', $variables, $language->language);
       $message['body'][] = $params['message'];
       break;