diff -urp -N simplenews_template/CHANGELOG.txt simplenews_template_6/CHANGELOG.txt
--- simplenews_template/CHANGELOG.txt	1970-01-01 01:00:00.000000000 +0100
+++ simplenews_template_6/CHANGELOG.txt	2008-10-23 15:33:50.000000000 +0200
@@ -0,0 +1,34 @@
+// $Id: CHANGELOG.txt,v 1.5 2008/10/19 21:24:11 tbarregren Exp $
+
+
+Simplenews Template x.x-x.x, xxxx-xx-xx
+---------------------------------------
+
+
+Simplenews Template 5.x-1.x, xxxx-xx-xx
+---------------------------------------
+
+
+Simplenews Template 5.x-1.2, 2008-10-19
+---------------------------------------
+#152819: Module .info files should not define 'version' in CVS.
+Replaced the HTML version of README with a text dito.
+#273089 by tizzo: Pass entire node to theme_simplenews_template_mail_content.
+#322905 by sun: Added link to preview HTML newsletters in browser.
+Minor improvements of the code itself, such as removing a lot of trailing
+  spaces.
+#317976 by enboig: Added support for
+  Emogrifier <http://www.pelagodesign.com/sidecar/emogrifier/>.
+#240562 by Sixcolored: Fixed a typo in the default template.
+Minor improvements of the code itself.
+Updated simplenews_template.pot.
+
+
+Simplenews Template 5.x-1.1, 2007-04-09
+---------------------------------------
+#132288 by polar-bear: Fixed a stupid mistake in phptemplate_mimemail_message().
+
+
+Simplenews Template 5.x-1.0, 2007-03-22
+---------------------------------------
+Initial release of Simplenews Template.
diff -urp -N simplenews_template/README.html simplenews_template_6/README.html
--- simplenews_template/README.html	2007-03-22 21:27:54.000000000 +0100
+++ simplenews_template_6/README.html	1970-01-01 01:00:00.000000000 +0100
@@ -1,266 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
-    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<!-- Copyright (C) 2007 Thomas Barregren <mailto:thomas@webbredaktoren.se> -->
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
-  <head>
-    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
-    <meta name="generator" content="HTML Tidy for Windows (vers 14 February 2006), see www.w3.org" />
-    <title>
-      README: Simplenews Template
-    </title>
-  </head>
-  <body>
-    <h1>
-      Simplenews Template
-    </h1>
-    <p>
-      Simplenews Template is a Drupal module that extends the <a href="http://drupal.org/project/simplenews">Simplenews module</a> by providing a themable template with configurable header, footer and style. Header, footer and style are configurable for each newsletter independently.
-    </p>
-    <p>
-      Simplenews Template can with advantage be used in conjunction with <a href="http://drupal.org/project/relatedcontent">RelatedContent</a>.
-    </p><!-- break -->
-    <!--h2>
-      Background
-    </h2>
-    <p>
-      TODO
-    </p-->
-    <h2>
-      Requirements
-    </h2>
-    <p>
-      To install Simplenews Template you need:
-    </p>
-    <ul>
-      <li>
-        <a href="http://drupal.org/project/drupal">Drupal 5.x</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/project/simplenews">Simplenews</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/project/mimemail">Mime Mail</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/phptemplate">PHPTemplate</a> based theme
-      </li>
-    </ul>
-    <h2>
-      Installation
-    </h2>
-    <p>
-      Install Simplenews Template as follows:
-    </p>
-    <ol>
-      <li>
-        <p>
-          Download, install and configure the <a href="http://drupal.org/project/mimemail">Mime Mail module</a>, following the instructions for that module.
-        </p>
-      </li>
-      <li>
-        <p>
-          Download, install and configure the <a href="http://drupal.org/project/mimemail">Simplenews module</a>, following the instructions for that module.
-        </p>
-      </li>
-      <li>
-        <p>
-          Download the archive file with the latest stable version from <a href="http://drupal.org/project/simplenews_template">Simplenews Template</a>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Unpack the downloaded archive into your Drupal's <em>modules</em> directory.
-        </p>
-      </li>
-      <li>
-        <p>
-          Verify that the <em>modules</em> directory contains a <em>simplenews_template</em> directory with <em>simplenews_template.module</em> and other files.
-        </p>
-      </li>
-      <li>
-        <p>
-          Go to <code>admin/build/modules</code> and enable the module.
-        </p>
-      </li>
-    </ol>
-    <h2>
-      Configuration
-    </h2>
-    <p>
-      There is no configuration for the Simplenews Template module itself.
-    </p>
-    <h2>
-      Usage
-    </h2>
-    <p>
-      Header, footer and style is setup for each newsletter individually as follows:
-    </p>
-    <ol>
-      <li>
-        <p>
-          If not already existing, go to <code>admin/content/newsletters/types</code> and add at least one newsletter.
-        </p>
-      </li>
-      <li>
-        <p>
-          Go to <code>admin/content/newsletters/settings</code>, and select the newsletter to be configured.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Header</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area with the content to be shown at the beginning of each issue of the newsletter. Leave blank to not include a header. Do not forget to choose appropriate input format.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Footer</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area with the content to be shown at the end of each issue of the newsletter. Leave blank to not include a footer. Do not forget to choose appropriate input format.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Style</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text field called <em>Body background color</em> with any valid HTML <a href="http://www.w3.org/TR/html4/types.html#h-6.5">color value</a>, e.g. <code>#ff00ff</code> and <code>fuchsia</code>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area called <em>CSS</em> with style sheet rules valid within the HTML tags <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.3"><code>&lt;style type="text/css"&gt;</code>...<code>&lt;/style&gt;</code></a>, e.g. <code>div.message { color: red }</code>.
-        </p>
-      </li>
-    </ol>
-    <!--h2>
-      Theming
-    </h2>
-    <p>
-      The Simplenews Template module provides following themable functions:
-    </p>
-    <ul>
-      <li>
-        <p>
-          <code>theme_simplenews_template_content(\$newsletter_name, \$issue_title, \$header, \$body, \$footer)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$newsletter_name</code> is TODO,
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO,
-          </li>
-          <li>
-            <code>\$header</code> is TODO,
-          </li>
-          <li>
-            <code>\$body</code> is TODO, and
-          </li>
-          <li>
-            <code>\$footer</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mail_subject(\$newsletter_name, \$issue_title)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$newsletter_name</code> is TODO, and
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mail_content(\$content, \$newsletter_name, \$issue_title, \$style, \$bgcolor)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$content</code>is TODO,
-          </li>
-          <li>
-            <code>\$newsletter_name</code> is TODO,
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO,
-          </li>
-          <li>
-            <code>\$style</code> is TODO, and
-          </li>
-          <li>
-            <code>\$bgcolor</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mimemail_message(\$body)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$body</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-    </ul>
-    <h2>
-      Plans for the future
-    </h2>
-    <p>
-      The Simplenews Template module will be further developed. Following issues are known and will be dealt with in future versions of the module:
-    </p>
-    <ul>
-      <li>
-        <p>
-          TODO: VALIDATE STYLE.
-        </p>
-      </li>
-      <li>
-        <p>
-          TODO: POSSIBLE TO OVERRIDE FOR EACH ISSUE.
-        </p>
-      </li>
-    </ul-->
-    <h2>
-      License
-    </h2>
-    <p>
-      Simplenews Template. Copyright © <a href="mailto:thomas@webbredaktoren.se">Thomas Barregren</a>.
-    </p>
-    <p>
-      Simplenews Template is free software; you can redistribute it and/or modify it under the terms of the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-    </p>
-    <p>
-      Simplenews Template is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> for more details.
-    </p>
-    <p>
-      You should have received a copy of the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-    </p>
-  </body>
-</html>
diff -urp -N simplenews_template/README.txt simplenews_template_6/README.txt
--- simplenews_template/README.txt	1970-01-01 01:00:00.000000000 +0100
+++ simplenews_template_6/README.txt	2008-10-23 23:08:34.000000000 +0200
@@ -0,0 +1,151 @@
+// $Id: README.txt,v 1.3 2008/10/19 18:21:42 tbarregren Exp $
+
+Additions for D6 update
+===================
+
+First attempt at a D6 port.
+Emogrifier not currently working.
+Per newsletter CSS not working. You can add a mail.css file to your theme folder which will be picked up if you add the following code to the template.php file in your theme folder.
+
+/**
+ *  Override mimemail message theme so that mail.css is 
+ *  called from this theme folder rather than the module folder.
+ */
+function phptemplate_simplenews_template_mimemail_message($body) {
+  return theme_mimemail_message($body);
+}
+
+Instructions below may need to be updated for D6 version.
+
+
+
+Simplenews Template
+===================
+
+Simplenews Template is a Drupal module that extends the Simplenews module by
+providing a themable template with configurable header, footer and style.
+Header, footer and style are configurable for each newsletter independently.
+
+Simplenews Template can with advantage be used in conjunction with
+RelatedContent <http://drupal.org/project/relatedcontent>.
+
+Developed by
+
+  * Thomas Barregren <http://drupal.org/user/16678>
+
+Sponsored by
+
+  * Spoon Media <http://www.spoon.com.au/>
+  * Webbredaktören <http://www.webbredaktoren.se/>
+
+
+Requirements
+------------
+
+To install Simplenews Template you need:
+
+  * Drupal 5.x
+  * Simplenews
+  * Mime Mail
+  * PHPTemplate based theme
+
+
+Installation
+------------
+
+Install Simplenews Template as follows:
+
+  1. Download, install and configure the Mime Mail module.
+     See http://drupal.org/project/mimemail.
+
+  2. Download, install and configure the Simplenews module.
+     See http://drupal.org/project/simplenews.
+
+  3. Download the latest stable version of Simplenews Template.
+     See http://drupal.org/project/simplenews_template.
+
+  4. Unpack the downloaded file into sites/all/modules or the modules directory
+     of your site.
+
+  5. Go to Administer » Site building » Modules and enable the module.
+  
+  6. OPTIONAL: To enable automatic insertion of the Simplenews Template style
+     definitions into HTML-tags of e-mails, download the Emogrifier from
+     http://www.pelagodesign.com/sidecar/emogrifier/ and extract the file
+     emogrifier.php file into the Simplenews Template folder. More information
+     below.
+
+
+Configuration
+-------------
+
+There is no configuration for the Simplenews Template module itself.
+
+
+Usage
+-----
+
+Header, footer and style is setup for each newsletter individually as follows:
+
+  1. If not already existing, go to admin/content/newsletters/types and add at
+     least one newsletter.
+
+  2. Go to admin/content/newsletters/settings, and select the newsletter to be
+     configured.
+
+  3. Fill out the text area with the content to be shown at the beginning of
+     each issue of the newsletter. Leave blank to not include a header. Do not 
+     forget to choose appropriate input format.
+
+  4. Locate and open the collapsible section called Footer. Fill out the text 
+     area with the content to be shown at the end of each issue of the 
+     newsletter. Leave blank to not include a footer. Do not forget to choose
+      appropriate input format.
+
+  5. Locate and open the collapsible section called Style. Fill out the text 
+     field called Body background color with any valid HTML color value,
+     e.g. #ff00ff and fuchsia.
+
+  6. Fill out the text area called CSS with style sheet rules valid within the
+     HTML tags <style type="text/css">...</style>,
+     e.g. div.message { color: red }.
+
+
+Emogrifier
+----------
+
+Some e-mail clients, notably Microsoft Outlook 2007 and Google Gmail, discharge
+CSS defintions within <style> tags. The solution is to put the style definitions
+into the e-mail HTML-tags. Simplenews Template can do this automagically
+if Emogrifier <http://www.pelagodesign.com/sidecar/emogrifier/> is installed
+as described above.
+
+Emogrifier supports not all CSS2 selectors, e.g. including pseudo selectors. All
+CSS1 selectors works.
+
+Emogrifier parses the CSS selectors in order. Later selectors will therefore
+override earlier selectors that apply to the same element.
+
+Notice that even with Emogrifier certain e-mail clients will ignore certain CSS
+properties. For more information, see http://www.email-standards.org/.
+
+The 15 August 2008 version of Emogrifier has a minor bug, which is easily fixed
+by replacing $body with $html on lines 35 and 38. Alternatively, you can apply
+following patch:
+
+  --- emogrifier.php	2008-08-15 13:33:22.000000000 +0200
+  +++ emogrifier.php	2008-10-19 16:51:00.000000000 +0200
+  @@ -32,10 +32,10 @@ class Emogrifier {
+   	public function emogrify() {
+   	    // process the CSS here, turning the CSS style blocks into inline css
+   		$unprocessableHTMLTags = implode('|',$this->unprocessableHTMLTags);
+  -		$body = preg_replace("/<($unprocessableHTMLTags)[^>]*>/i",'',$this->body);
+  +		$html = preg_replace("/<($unprocessableHTMLTags)[^>]*>/i",'',$this->html);
+   
+   		$xmldoc = new DOMDocument();
+  -		$xmldoc->loadHTML($body);
+  +		$xmldoc->loadHTML($html);
+   
+   		$xpath = new DOMXPath($xmldoc);
+
+The bug is reported to the creator of Emogrifier and will eventually be fixed.
diff -urp -N simplenews_template/simplenews_template.info simplenews_template_6/simplenews_template.info
--- simplenews_template/simplenews_template.info	2007-04-10 00:00:24.000000000 +0200
+++ simplenews_template_6/simplenews_template.info	2008-10-23 23:09:32.000000000 +0200
@@ -1,9 +1,14 @@
-; $Id: simplenews_template.info,v 1.1 2007/03/22 20:27:54 tbarregren Exp $
-name = "Simplenews Template"
-description = "Extends Simplenews by providing a themable template with configurable header, footer and style."
-version = "$Name: DRUPAL-5--1-1 $"
-dependencies = simplenews mimemail
-; Information added by drupal.org packaging script on 2007-04-09
-version = "5.x-1.1"
+; $Id: simplenews_template.info,v 1.3 2008/10/19 09:15:48 tbarregren Exp $
+name = "Simplenews Template"
+description = "Extends Simplenews by providing a themable template with configurable header, footer and style."
+dependencies[] = simplenews
+dependencies[] = mimemail
+package = Mail
+
+; Information added by drupal.org packaging script on 2008-10-19
+version = "6.x-1.x-dev"
 project = "simplenews_template"
+datestamp = "1224451824"
+
 
+core = 6.x
\ No newline at end of file
diff -urp -N simplenews_template/simplenews_template.install simplenews_template_6/simplenews_template.install
--- simplenews_template/simplenews_template.install	2007-03-22 21:27:54.000000000 +0100
+++ simplenews_template_6/simplenews_template.install	2008-10-23 15:33:50.000000000 +0200
@@ -1,55 +1,34 @@
 <?php
 
-/* $Id: simplenews_template.install,v 1.1 2007/03/22 20:27:54 tbarregren Exp $ */
+// $Id: simplenews_template.install,v 1.3 2008/10/19 09:15:48 tbarregren Exp $
 
-/* Simplenews Template installation script.   
- *
- * Copyright (C) 2007 Thomas Barregren.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
+
+/**
+ * @file
+ * Installs Simplenews Template.
+ */
 
-function simplenews_template_install() {
-  _simplenews_template_install_message(t('!module was succefully installed.', array('!module' => l('Simplenews Template', 'admin/help/simplenews_template'))));  
-}
 
 function simplenews_template_uninstall() {
-  
-  // Deleted Simplenews Template's variables
+  // Remove tables.
+  drupal_uninstall_schema('simplenews_template');
+
+
   global $conf;
-  $result = db_query("SELECT name FROM {variable} WHERE name LIKE 'simplenews_template_%'");
+
+  // Delete variables.
+  if (!($result = _simplenews_template_install_db_query("SELECT name FROM {variable} WHERE name LIKE 'simplenews_template_%'"))) return;
   while ($row = db_fetch_array($result)) {
     unset($conf[$row['name']]);
   }
-  $result = $result && db_query("DELETE FROM {variable} WHERE name LIKE 'simplenews_template_%'");
-  _simplenews_template_install_message(t('Failed to delete variables for Simplenews Template.'), $result);
-  cache_clear_all('variables', 'cache');
-  
-  _simplenews_template_install_message();
-
-}
-
-function _simplenews_template_install_message($message = '', $result = NULL) {
-  static $success = true;
-  if (isset($result)) {
-    if(!$result) {
-      drupal_set_message($message, 'error');
-      $success = false;
-    }
-  }
-  elseif($success) {
-    drupal_set_message($message);
-  }
-}
\ No newline at end of file
+  if (!($result = _simplenews_template_install_db_query("DELETE FROM {variable} WHERE name LIKE 'simplenews_template_%'"))) return;
+  cache_clear_all('variables', 'cache');
+
+}
+
+function _simplenews_template_install_db_query($sql) {
+  if (!($result = db_query($sql))) {
+    drupal_set_mesage("Simplenews Template failed to execute following SQL-query: $sql");
+  }
+  return $result;
+}
diff -urp -N simplenews_template/simplenews_template.module simplenews_template_6/simplenews_template.module
--- simplenews_template/simplenews_template.module	2007-04-09 23:52:23.000000000 +0200
+++ simplenews_template_6/simplenews_template.module	2008-11-18 14:45:56.000000000 +0100
@@ -1,42 +1,81 @@
 <?php
+// $Id: simplenews_template.module,v 1.9 2008/10/19 20:45:10 tbarregren Exp $
 
-/* $Id: simplenews_template.module,v 1.2 2007/04/09 21:52:23 tbarregren Exp $ */
-
-/* Simplenews Template - a Drupal module that extends the Simplenews module
- * by providing a themable template with configurable header, footer and style.
- *
- * Copyright (C) 2007 Thomas Barregren.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
+/**
+ * @file
+ * Extends the Simplenews module by providing a themable template with
+ * configurable header, footer and style.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * Author:
+ *   Thomas Barregren <http://drupal.org/user/16678>.
  *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ * Sponsors:
+ *   Sppon Media <http://www.spoon.com.au/>
+ *   Webbredaktören <http://www.webbredaktoren.se>
  */
 
+/* TODO New user_mail_tokens() method may be useful.
+   user.module now provides a user_mail_tokens() function to return an array
+   of the tokens available for the email notification messages it sends when
+   accounts are created, activated, blocked, etc. Contributed modules that
+   wish to make use of the same tokens for their own needs are encouraged
+   to use this function. */
+
 
 /******************************************************************************
  * THEMEABLE FUNCTIONS
  ******************************************************************************/
 
+/* TODO Implement the hook_theme registry. Combine all theme registry entries
+   into one hook_theme function in each corresponding module file.
+*/
+function simplenews_template_theme() {
+  return array(
+    'simplenews_template_content' => array(
+      'file' => 'simplenews_template.module',
+      'arguments' => array(
+        'newsletter_name' => NULL,
+        'issue_title' => NULL,
+        'header' => NULL,
+        'body' => NULL,
+        'footer' => NULL,
+      ),
+    ),
+    'simplenews_template_mail_subject' => array(
+      'file' => 'simplenews_template.module',
+      'arguments' => array(
+        'newsletter_name' => NULL,
+        'issue_title' => NULL,
+      ),
+    ),
+    'simplenews_template_mail_content' => array(
+      'file' => 'simplenews_template.module',
+      'arguments' => array(
+        'node' => NULL,
+        'newsletter_name' => NULL,
+        'issue_title' => NULL,
+        'style' => NULL,
+        'bgcolor' => NULL,
+      ),
+    ),
+    'simplenews_template_mimemail_message' => array(
+      'file' => 'simplenews_template.module',
+      'arguments' => array(
+        'body' => NULL,
+      ),
+    ),
+  );
+}
+
 /**
- * Themeable function for the content itself.  
+ * Themeable function for the content itself.
  */
 function theme_simplenews_template_content($newsletter_name, $issue_title, $header, $body, $footer) {
-
   // Theme the header
   if ($header) {
     $content = "<div class=\"simplenews-template-header\">\n$header\n</div>\n";
   }
-  
+
   // Theme the body
   if ($header || $footer) {
     $content .= "<div class=\"simplenews-template-body\">\n<h1>$issue_title</h1>\n$body\n</div>\n";
@@ -44,14 +83,13 @@ function theme_simplenews_template_conte
   else {
     $content .= $body;
   }
-  
+
   // Theme the footer
   if ($footer) {
     $content .= "<div class=\"simplenews-template-footer\">\n$footer\n</div>\n";
   }
 
   return $content;
-
 }
 
 /**
@@ -65,27 +103,27 @@ function theme_simplenews_template_mail_
  * Themeable function for the HTML e-mail content.
  * Based on http://www.mailchimp.com/resources/templates/.
  */
-function theme_simplenews_template_mail_content($content, $newsletter_name, $issue_title, $style, $bgcolor) {
-	return <<<EOT
+function theme_simplenews_template_mail_content($node, $newsletter_name, $issue_title, $style, $bgcolor) {
+  return <<<EOT
 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<HTML>
-<HEAD>
-<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
-<TITLE>$newsletter_name: $issue_title</TITLE>
-</HEAD>
-<BODY bgcolor="$bgcolor">
-<STYLE TYPE="text/css">
+<html>
+<head>
+<meta HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8">
+<title>$newsletter_name: $issue_title</title>
+</head>
+<body bgcolor="$bgcolor">
+<style type="text/css">
 <!--
 $style
 -->
-</STYLE>
-<TABLE class="simplenews-template-background" width="100%" bgcolor="$bgcolor" cellpadding="0" cellspacing="0"><TR><TD valign="top" align="center">
-<TABLE class="simplenews-template-content" cellpadding="0" cellspacing="0"><TR><TD>
-$content
-</TD></TR></TABLE>
-</TD></TR></TABLE>
-</BODY>
-</HTML>
+</style>
+<table class="simplenews-template-background" width="100%" bgcolor="$bgcolor" cellpadding="0" cellspacing="0"><tr><td valign="top" align="center">
+<table class="simplenews-template-content" cellpadding="0" cellspacing="0"><tr><td>
+$node->body
+</td></tr></table>
+</Td></Tr></table>
+</body>
+</html>
 EOT;
 }
 
@@ -104,66 +142,98 @@ function theme_simplenews_template_mimem
 
 /**
  * Overriding theme_simplenews_newsletter().
+ * Not currently being called as Simplenews for D6 doesn't call this theme function.
+ * To enable the emogrify function again, would probably have to call it from
+ * theme_simplenews_template_mimemail_message function above.
  */
-function phptemplate_simplenews_newsletter($node, $tid) {
-  
+function phptemplate_simplenews_newsletter($body, $title, $tid) {
+
   // Theme the subject
-  $term = taxonomy_get_term($tid);  
-  $node->subject = theme('simplenews_template_mail_subject', $term->name, $node->title);
-  
+  //$term = taxonomy_get_term($tid);
+  //$node->subject = theme('simplenews_template_mail_subject', $term->name, $node->title);
+
   // Theme the e-mail
   $css = _simplenews_template_get_css($tid);
   $bgcolor = _simplenews_template_get_bgcolor($tid);
-  $node->body = theme('simplenews_template_mail_content', $node->body, $term->name, $node->title, $css, $bgcolor);
-  
+  $node = theme('simplenews_template_mail_content', $node, $css, $bgcolor);
+
+  // If the Emogrifier <http://www.pelagodesign.com/sidecar/emogrifier/> exists,
+  // insert the CSS definitions into the HTML tags.
+  $node->body = _simplenews_template_emogrify($node->body, $css);
+
   return $node;
 
 }
 
 /**
+ * Overriding theme_simplenews_newsletter_body().
+ * Added for D6 compatability.
+ * A simple override to stop the title being added before the header.
+ */
+function phptemplate_simplenews_newsletter_body($body, $title) {
+  return $body;
+}
+
+/**
  * Overriding theme_mimemail_message().
  */
 function phptemplate_mimemail_message($content) {
-  
+
   // If content already is a complete html page, just return it.
   if (_simplenews_template_starts_with($content, '<!DOCTYPE', '<html', '<?xml')) {
     return $content;
   }
-  
+
   // Embedd the content in a html page.
   return theme('simplenews_template_mimemail_message', $content);
 }
 
 /**
- * Returns true iff $text starts with any of the arguments following $text,   
+ * If the Emogrifier <http://www.pelagodesign.com/sidecar/emogrifier/> exists,
+ * the CSS definitions in $css are inserted into tags within $html based on the
+ * CSS selectors.
+ */
+function _simplenews_template_emogrify($html, $css) {
+  $path = drupal_get_path('module', 'simplenews_template');
+  $path = "./$path/emogrifier.php";
+  if (is_file($path)) {
+    include_once $path;
+    $emogrifier = new Emogrifier();
+    $emogrifier->setHTML($html);
+    $emogrifier->setCSS($css);
+    $html = $emogrifier->emogrify();
+  }
+  return $html;
+}
+
+/**
+ * Returns true iff $text starts with any of the arguments following $text,
  * whitespaces and comments excluded.
  */
-function _simplenews_template_starts_with($text) {  
-  
+function _simplenews_template_starts_with($text) {
+
   // White space characters.
   static $ws = " \t\n\r\0\x0B";
-  
+
   // Skip whitespaces and comments.
   $pos = 0;
-  while(true) {
+  while (true) {
     $pos += strspn($text, $ws, $pos);
-    $is_comment = strcmp(substr($text, $pos, 4), '<!--') == 0;
-    if (!$is_comment) break;
+    if (drupal_substr($text, $pos, 4) !== '<!--') break;
     $pos = strpos($text, '-->', $pos) + 3;
   }
-  
-  // Return true if any of the strings to look for are found.  
+
+  // Return true if any of the strings to look for are found.
   $args = func_get_args();
   array_shift($args);
-  foreach($args as $start) {
-    if (strcasecmp(substr($text, $pos, strlen($start)), $start) == 0) {
-      return true;
-    }
+  foreach ($args as $start) {
+    $start = drupal_strtolower($start);
+    if (drupal_substr($text, $pos, drupal_strlen($start)) === $start) return true;
   }
-  
+
   // Return false since none of the strings to look for was found.
   return false;
-    
+
 }
 
 
@@ -172,96 +242,64 @@ function _simplenews_template_starts_wit
  ******************************************************************************/
 
 /**
- * Implementation of hook_form_alter().
+ * Implementation of hook_perm().
  */
-function simplenews_template_form_alter($form_id, &$form) {
-  if ($form_id == 'simplenews_admin_settings') {
-    $tid = $form['#validate']['simplenews_admin_settings_validate'][0];
-    if ($tid) {
-      _simplenews_template_form_alter_newsletter_settings($form, $tid);
-    }
-  }
+function simplenews_template_perm() {
+  return array('access newsletter preview');
 }
 
 /**
- * Implementation of hook_nodeapi().
+ * Implementation of hook_menu().
  */
-function simplenews_template_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
-  if ($node->type == 'simplenews') {
-    $function = "_simplenews_template_node_$op";
-    if (function_exists($function)) {
-      return $function($node, $a3, $a4);
-    }
-  }
-}
+function simplenews_template_menu() {
+  $items = array();
 
-/**
- * Implementation of hook_help().
- */
-function simplenews_template_help($section='admin/help#simplenews_template') {
-  switch ($section) {
-    case 'admin/help#simplenews_template':
-      return _simplenews_template_help();
-  }
+  $items['simplenews_template/preview/%'] = array(
+    'title' => 'Simplenews Template preview',
+    'page callback' => 'simplenews_template_preview',
+    'page arguments' => array(2),
+    'access arguments' => array('access newsletter preview'),
+    'type' => MENU_CALLBACK,
+  );
+  
+  return $items;
 }
 
-
-/******************************************************************************
- * ALTER SIMPLENEWS ADMIN SETTINGS FORM (NEWSLETTER SETTINGS)
- ******************************************************************************/
-
 /**
- * Add Simplenews Template settings to the node type forms. 
+ * Implementation of hook_form_alter().
  */
-function _simplenews_template_form_alter_newsletter_settings(&$form, $tid) {
-  $form['simplenews_template']['#weight'] = -10;
-  _simplenews_template_form_alter_header($form, $tid);
-  _simplenews_template_form_alter_footer($form, $tid);
-  _simplenews_template_form_alter_style($form, $tid);
+function simplenews_template_form_simplenews_admin_types_form_alter(&$form, &$form_state) {
+  $tid = $form['tid']['#value'];  
   
-}
-
-function _simplenews_template_form_alter_header(&$form, $tid) {
+  $form['simplenews_template']['#weight'] = 10;
   
-  // Header filedset
+  // Header fieldset
   $form['simplenews_template']['simplenews_template_header'] = array(
     '#type' => 'fieldset',
     '#title' => t('Header'),
-    '#description' => t(
-      'Enter a header common for all issues of this newsletter. For more information, see the !help.',
-      array('!help' => l(t('help page'), 'admin/help/simplenews_template#header'))
-    ),
+    '#description' => t('The header common for all issues of this newsletter.'),
     '#collapsible' => true,
     '#collapsed' => true,
   );
-
   // Header
   $form['simplenews_template']['simplenews_template_header']["simplenews_template_header_$tid"] = array(
     '#type' => 'textarea',
     '#title' => t('Header'),
+		'#weight' => -10,
     '#description' => t('Enter the content of the newsletter\'s header.'),
-    '#default_value' => _simplenews_template_get_header($tid),
+    '#default_value' => variable_get("simplenews_template_header_$tid", ''),
   );
-  
   // Header input format
-  $form['simplenews_template']['simplenews_template_header']['simplenews_template_header_format_$tid'] = filter_form(_simplenews_template_get_header_format($tid), 1, array("simplenews_template_header_format_$tid"));
-    
-}
+  $form['simplenews_template']['simplenews_template_header']["simplenews_template_header_format_$tid"] = filter_form(_simplenews_template_get_header_format($tid), 1, array("simplenews_template_header_format_$tid"));
 
-function _simplenews_template_form_alter_footer(&$form, $tid) {
-  
   // Footer filedset
   $form['simplenews_template']['simplenews_template_footer'] = array(
     '#type' => 'fieldset',
     '#title' => t('Footer'),
-    '#description' => t(
-      'Enter a footer common for all issues of this newsletter. For more information, see the !help.',
-      array('!help' => l(t('help page'), 'admin/help/simplenews_template#footer'))
-    ),
+    '#description' => t('The footer common for all issues of this newsletter.'),
     '#collapsible' => true,
     '#collapsed' => true,
-    );
-
+  );
   // Footer
   $form['simplenews_template']['simplenews_template_footer']["simplenews_template_footer_$tid"] = array(
     '#type' => 'textarea',
@@ -269,76 +307,118 @@ function _simplenews_template_form_alter
     '#description' => t('Enter the content of the newsletter\'s footer.'),
     '#default_value' => _simplenews_template_get_footer($tid),
   );
-  
   // Footer input format
-  $form['simplenews_template']['simplenews_template_footer']['simplenews_template_footer_format_$tid'] = filter_form(_simplenews_template_get_footer_format($tid), 1, array("simplenews_template_footer_format_$tid"));
-  
-}
+  $form['simplenews_template']['simplenews_template_footer']["simplenews_template_footer_format_$tid"] = filter_form(_simplenews_template_get_footer_format($tid), 1, array("simplenews_template_footer_format_$tid"));
 
-function _simplenews_template_form_alter_style(&$form, $tid) {
-  
   // Style fieldset
   $form['simplenews_template']['simplenews_template_style'] = array(
     '#type' => 'fieldset',
     '#title' => t('Style'),
-    '#description' => t(
-      'For more information, see the !help.',
-      array('!help' => l(t('help page'), 'admin/help/simplenews_template#style'))
-        ),
+    '#description' => t('To add CSS styles to the email, add a file called mail.css to your theme folder. Also see the readme file for a code snippet to add to the template.php file in your theme folder'),
     '#collapsible' => true,
     '#collapsed' => true,
   );
 
-  // Background color
-  $form['simplenews_template']['simplenews_template_style']["simplenews_template_bgcolor_$tid"] = array(
-    '#type' => 'textfield',
-    '#title' => t('Body background color'),
-    '#description' => t('Enter the body background color to be used in all issues of this newsletter.'),
-    '#default_value' => _simplenews_template_get_bgcolor($tid),
-  );
+  $form['#submit'][] = 'simplenews_template_save_newsletter_settings';
+}
 
-  // CSS
-  $form['simplenews_template']['simplenews_template_style']["simplenews_template_css_$tid"] = array(
-    '#type' => 'textarea',
-    '#title' => t('CSS'),
-    '#description' => t('Enter the CSS code to be included in all issues of this newsletter.'),
-    '#default_value' => _simplenews_template_get_css($tid),
-  );
+/**
+ * Submit function for the settings form.
+ */
+function simplenews_template_save_newsletter_settings($form_state) {
+  $tid = $form_state['tid']['#value'];
+  // header
+  variable_set("simplenews_template_header_$tid", $form_state['#post']['simplenews_template_header_'.$tid]);
+  variable_set("simplenews_template_header_format_$tid", $form_state['#post']["simplenews_template_header_format_$tid"]);
+  // footer
+  variable_set("simplenews_template_footer_$tid", $form_state['#post']["simplenews_template_footer_$tid"]);
+  variable_set("simplenews_template_footer_format_$tid", $form_state['#post']["simplenews_template_footer_format_$tid"]);
+}
 
+/**
+ * Implementation of hook_nodeapi().
+ */
+function simplenews_template_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
+  if ($node->type == 'simplenews') {
+    $function = "_simplenews_template_node_$op";
+    if (function_exists($function)) {
+      return $function($node, $a3, $a4);
+    }
+  }
+}
+
+/**
+ * Implementation of hook_link_alter(&$links, $node).
+ */
+function simplenews_template_link_alter(&$node, &$links) {
+  if ($node->type == 'simplenews' && $node->s_format == 'html' && user_access('access newsletter preview')) {
+    $links['simplenews_preview'] = array(
+      'title' => t('Preview'),
+      'href' => "simplenews_template/preview/$node->nid",
+      'attributes' => array(
+        'target' => '_blank',
+      ),
+    );
+  }
 }
 
 
 /******************************************************************************
+ * MENU CALLBACKS
+ ******************************************************************************/
+
+/**
+ * Output a Simplenews template'd newsletter node like in a mail.
+ *
+ * @param $nid
+ *   The simplenews node id to render.
+ * @param $vid
+ *   (optional) A revision id to use; most recent is used if omitted.
+ *
+ * @return
+ *   A full HTML page containing the same markup as in outgoing mails.
+ */
+function simplenews_template_preview($nid = 0, $vid = NULL) {
+  $node = node_load($nid, $vid);
+  if (!$node || $node->type != 'simplenews') {
+    return drupal_not_found();
+  }
+  $node = simplenews_node_prepare($nid, $vid, $node->tid);
+  $node = theme('simplenews_newsletter_footer', $node, '');
+  echo $node->body;
+}
+
+/******************************************************************************
  * IMPLEMENTING THE NODE API
  ******************************************************************************/
 
 /**
  * A newsletter issue is being viewed.
- */ 
+ */
 function _simplenews_template_node_view(&$node, $teaser, $page) {
-  
+
   // Don't include header and footer if this is a teaser.
   if ($teaser) return;
-    
+
   // Get taxonomy id
-  $tid = $node->tid; 
-  
+  $tid = $node->simplenews['tid'];
+
   // Retrive and filter the header content.
   $header = _simplenews_template_get_header($tid);
   $header = check_markup($header, _simplenews_template_get_header_format($tid), false);
-  
+
   // Retrive the body. It is already filtered since it is part of a node.
   $body .= $node->content['body']['#value'];
-  
+
   // Retrive and filter the footer content.
   $footer = _simplenews_template_get_footer($tid);
   $footer = check_markup($footer, _simplenews_template_get_footer_format($tid), false);
-  
+
   // Theme the content
   $content = theme('simplenews_template_content', $term->name, $node->title, $header, $body, $footer);
-
+  
   // Update the node's content
-  $node->content['body']['#value'] = $content; 
+  $node->content['body']['#value'] = $content;
 
 }
 
@@ -350,320 +430,41 @@ function _simplenews_template_node_view(
 /**
  * Returns the header.
  */
-function _simplenews_template_get_header($tid)
-{
+function _simplenews_template_get_header($tid) {
   return variable_get("simplenews_template_header_$tid", '');
 }
 
 /**
  * Returns header format.
  */
-function _simplenews_template_get_header_format($tid)
-{
+function _simplenews_template_get_header_format($tid) {
   return variable_get("simplenews_template_header_format_$tid", FILTER_FORMAT_DEFAULT);
 }
 
 /**
  * Returns the footer.
  */
-function _simplenews_template_get_footer($tid)
-{
+function _simplenews_template_get_footer($tid) {
   return variable_get("simplenews_template_footer_$tid", '');
 }
 
 /**
  * Returns footer format.
  */
-function _simplenews_template_get_footer_format($tid)
-{
+function _simplenews_template_get_footer_format($tid) {
   return variable_get("simplenews_template_footer_format_$tid", FILTER_FORMAT_DEFAULT);
 }
 
 /**
  * Returns the background color.
  */
-function _simplenews_template_get_bgcolor($tid)
-{
+function _simplenews_template_get_bgcolor($tid) {
   return variable_get("simplenews_template_bgcolor_$tid", '#ffffff');
 }
 
 /**
  * Returns the CSS.
  */
-function _simplenews_template_get_css($tid)
-{
+function _simplenews_template_get_css($tid) {
   return variable_get("simplenews_template_css_$tid", '');
 }
-
-
-/******************************************************************************
- * HELP
- *****************************************************************************/
-
-/**
- * Returns full help text.
- */
-function _simplenews_template_help() {
-  $help = <<<EOT
-    <!-- Copyright (C) !year Thomas Barregren <mailto:thomas@webbredaktoren.se> -->
-    <style type="text/css" media="all">
-/*<![CDATA[*/
-      code, kbd, pre { padding: 1px; font-family: "Bitstream Vera Sans Mono", Monaco, "Lucida Console", monospace; background-color: #EDF1F3; }
-    /*]]>*/
-    </style>
-    <p>
-      Simplenews Template is a Drupal module that extends the <a href="http://drupal.org/project/simplenews">Simplenews module</a> by providing a themable template with configurable header, footer and style. Header, footer and style are configurable for each newsletter independently.
-    </p>
-    <p>
-      Simplenews Template can with advantage be used in conjunction with <a href="http://drupal.org/project/relatedcontent">RelatedContent</a>.
-    </p><!-- break -->
-    <!--h2>
-      Background
-    </h2>
-    <p>
-      TODO
-    </p-->
-    <h2>
-      Requirements
-    </h2>
-    <p>
-      To install Simplenews Template you need:
-    </p>
-    <ul>
-      <li>
-        <a href="http://drupal.org/project/drupal">Drupal 5.x</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/project/simplenews">Simplenews</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/project/mimemail">Mime Mail</a>
-      </li>
-      <li>
-        <a href="http://drupal.org/phptemplate">PHPTemplate</a> based theme
-      </li>
-    </ul>
-    <h2>
-      Installation
-    </h2>
-    <p>
-      Install Simplenews Template as follows:
-    </p>
-    <ol>
-      <li>
-        <p>
-          Download, install and configure the <a href="http://drupal.org/project/mimemail">Mime Mail module</a>, following the instructions for that module.
-        </p>
-      </li>
-      <li>
-        <p>
-          Download, install and configure the <a href="http://drupal.org/project/mimemail">Simplenews module</a>, following the instructions for that module.
-        </p>
-      </li>
-      <li>
-        <p>
-          Download the archive file with the latest stable version from <a href="http://drupal.org/project/simplenews_template">Simplenews Template</a>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Unpack the downloaded archive into your Drupal's <em>modules</em> directory.
-        </p>
-      </li>
-      <li>
-        <p>
-          Verify that the <em>modules</em> directory contains a <em>simplenews_template</em> directory with <em>simplenews_template.module</em> and other files.
-        </p>
-      </li>
-      <li>
-        <p>
-          Go to <code>admin/build/modules</code> and enable the module.
-        </p>
-      </li>
-    </ol>
-    <h2>
-      Configuration
-    </h2>
-    <p>
-      There is no configuration for the Simplenews Template module itself.
-    </p>
-    <h2>
-      Usage
-    </h2>
-    <p>
-      Header, footer and style is setup for each newsletter individually as follows:
-    </p>
-    <ol>
-      <li>
-        <p>
-          If not already existing, go to <code>admin/content/newsletters/types</code> and add at least one newsletter.
-        </p>
-      </li>
-      <li>
-        <p>
-          Go to <code>admin/content/newsletters/settings</code>, and select the newsletter to be configured.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Header</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area with the content to be shown at the beginning of each issue of the newsletter. Leave blank to not include a header. Do not forget to choose appropriate input format.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Footer</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area with the content to be shown at the end of each issue of the newsletter. Leave blank to not include a footer. Do not forget to choose appropriate input format.
-        </p>
-      </li>
-      <li>
-        <p>
-          Locate and open the collapsible section called <em>Style</em>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text field called <em>Body background color</em> with any valid HTML <a href="http://www.w3.org/TR/html4/types.html#h-6.5">color value</a>, e.g. <code>#ff00ff</code> and <code>fuchsia</code>.
-        </p>
-      </li>
-      <li>
-        <p>
-          Fill out the text area called <em>CSS</em> with style sheet rules valid within the HTML tags <a href="http://www.w3.org/TR/html4/present/styles.html#h-14.2.3"><code>&lt;style type="text/css"&gt;</code>...<code>&lt;/style&gt;</code></a>, e.g. <code>div.message { color: red }</code>.
-        </p>
-      </li>
-    </ol>
-    <!--h2>
-      Theming
-    </h2>
-    <p>
-      The Simplenews Template module provides following themable functions:
-    </p>
-    <ul>
-      <li>
-        <p>
-          <code>theme_simplenews_template_content(\$newsletter_name, \$issue_title, \$header, \$body, \$footer)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$newsletter_name</code> is TODO,
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO,
-          </li>
-          <li>
-            <code>\$header</code> is TODO,
-          </li>
-          <li>
-            <code>\$body</code> is TODO, and
-          </li>
-          <li>
-            <code>\$footer</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mail_subject(\$newsletter_name, \$issue_title)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$newsletter_name</code> is TODO, and
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mail_content(\$content, \$newsletter_name, \$issue_title, \$style, \$bgcolor)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$content</code>is TODO,
-          </li>
-          <li>
-            <code>\$newsletter_name</code> is TODO,
-          </li>
-          <li>
-            <code>\$issue_title</code> is TODO,
-          </li>
-          <li>
-            <code>\$style</code> is TODO, and
-          </li>
-          <li>
-            <code>\$bgcolor</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-      <li>
-        <p>
-          <code>theme_simplenews_template_mimemail_message(\$body)</code>, where
-        </p>
-        <ul>
-          <li>
-            <code>\$body</code> is TODO.
-          </li>
-        </ul>
-        <p>
-          TODO.
-        </p>
-      </li>
-    </ul>
-    <h2>
-      Plans for the future
-    </h2>
-    <p>
-      The Simplenews Template module will be further developed. Following issues are known and will be dealt with in future versions of the module:
-    </p>
-    <ul>
-      <li>
-        <p>
-          TODO: VALIDATE STYLE.
-        </p>
-      </li>
-      <li>
-        <p>
-          TODO: POSSIBLE TO OVERRIDE FOR EACH ISSUE.
-        </p>
-      </li>
-    </ul-->
-    <h2>
-      License
-    </h2>
-    <p>
-      Simplenews Template !version. Copyright © !year <a href="mailto:thomas@webbredaktoren.se">Thomas Barregren</a>.
-    </p>
-    <p>
-      Simplenews Template is free software; you can redistribute it and/or modify it under the terms of the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
-    </p>
-    <p>
-      Simplenews Template is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> for more details.
-    </p>
-    <p>
-      You should have received a copy of the <a href="http://www.gnu.org/licenses/gpl.html#SEC1">GNU General Public License</a> along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-    </p>
-EOT;
-
-  $version = str_replace(array('$Re'.'vision:', ' $'), array('', ''), '$Revision: 1.2 $');
-  $year = substr('$Date: 2007/04/09 21:52:23 $', 7, 4);
-	return t($help, array('!version' => $version, '!year' => $year));
-	
-}
\ No newline at end of file
diff -urp -N simplenews_template/translations/fr.po simplenews_template_6/translations/fr.po
--- simplenews_template/translations/fr.po	1970-01-01 01:00:00.000000000 +0100
+++ simplenews_template_6/translations/fr.po	2008-10-23 15:33:50.000000000 +0200
@@ -0,0 +1,100 @@
+# $Id: fr.po,v 1.1 2008/10/18 02:22:49 sun Exp $
+#
+# French translation of Drupal (general)
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+# Generated from files:
+#  simplenews_template.module,v 1.2 2007/04/09 21:52:23 tbarregren
+#  simplenews_template.install,v 1.1 2007/03/22 20:27:54 tbarregren
+#  simplenews_template.info,v 1.1 2007/03/22 20:27:54 tbarregren
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2008-10-06 20:36+0200\n"
+"PO-Revision-Date: 2008-10-06 20:36+0200\n"
+"Last-Translator: NAME <EMAIL@ADDRESS>\n"
+"Language-Team: French <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
+
+#: simplenews_template.module:229;241
+msgid "Header"
+msgstr "Titre"
+
+#: simplenews_template.module:230
+msgid "Enter a header common for all issues of this newsletter. For more information, see the !help."
+msgstr ""
+"Entrez une entête commune pour toutes les newsletters. Pour plus "
+"d'information, voir l'!help."
+
+#: simplenews_template.module:232;259;286
+msgid "help page"
+msgstr "page d'aide"
+
+#: simplenews_template.module:242
+msgid "Enter the content of the newsletter's header."
+msgstr "Entrez le contenu de l'entête de la newsletter."
+
+#: simplenews_template.module:256;268
+msgid "Footer"
+msgstr "Pied de page"
+
+#: simplenews_template.module:257
+msgid "Enter a footer common for all issues of this newsletter. For more information, see the !help."
+msgstr ""
+"Entrez un pied de page commun pour toutes les newsletter. Pour plus "
+"d'information, voir l'!help."
+
+#: simplenews_template.module:269
+msgid "Enter the content of the newsletter's footer."
+msgstr "Entrez le contenu du pied de page de la newsletter."
+
+#: simplenews_template.module:283
+msgid "Style"
+msgstr "Style"
+
+#: simplenews_template.module:284
+msgid "For more information, see the !help."
+msgstr "Pour plus d'information, voir l'!help."
+
+#: simplenews_template.module:295
+msgid "Body background color"
+msgstr "Couleur de fond du <body>"
+
+#: simplenews_template.module:296
+msgid "Enter the body background color to be used in all issues of this newsletter."
+msgstr ""
+"Entrez la couleur de fond qui doit être utilisée pour les éditions "
+"de cette newsletter."
+
+#: simplenews_template.module:303
+msgid "CSS"
+msgstr "CSS"
+
+#: simplenews_template.module:304
+msgid "Enter the CSS code to be included in all issues of this newsletter."
+msgstr ""
+"Entrez le code CSS qui doit être inclus dans toutes les éditions de "
+"cette newsletter."
+
+#: simplenews_template.install:25
+msgid "!module was succefully installed."
+msgstr "!module a été installé avec succès."
+
+#: simplenews_template.install:37
+msgid "Failed to delete variables for Simplenews Template."
+msgstr "Echec lors de la suppresion des variables de Simplenews Template."
+
+#: simplenews_template.info:0
+msgid "Simplenews Template"
+msgstr "Simplenews Template"
+
+#: simplenews_template.info:0
+msgid "Extends Simplenews by providing a themable template with configurable header, footer and style."
+msgstr ""
+"Étend Simplenews en fournissant un template \"thémable\" avec "
+"entête, pied de page et styles configurables."
+
diff -urp -N simplenews_template/translations/no.po simplenews_template_6/translations/no.po
--- simplenews_template/translations/no.po	1970-01-01 01:00:00.000000000 +0100
+++ simplenews_template_6/translations/no.po	2008-10-23 15:33:50.000000000 +0200
@@ -0,0 +1,96 @@
+# $Id: no.po,v 1.1 2008/10/18 02:22:18 sun Exp $
+#
+# Norwegian translation of Drupal (general)
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+# Generated from files:
+#  simplenews_template.module,v 1.2 2007/04/09 21:52:23 tbarregren
+#  simplenews_template.install,v 1.1 2007/03/22 20:27:54 tbarregren
+#  simplenews_template.info,v 1.1 2007/03/22 20:27:54 tbarregren
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: Simplenews Template 5.x-1.1\n"
+"POT-Creation-Date: 2007-10-19 12:42+0200\n"
+"PO-Revision-Date: 2007-10-19 12:57+0100\n"
+"Last-Translator: Sten Johnsen <sten@bedre-bilder.no>\n"
+"Language-Team: THINEA Webteknologi <sten@thinea.no>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=(n!=1);\n"
+"X-Poedit-Language: Norwegian Bokmal\n"
+"X-Poedit-Country: NORWAY\n"
+"X-Poedit-SourceCharset: utf-8\n"
+
+#: simplenews_template.module:229;241
+msgid "Header"
+msgstr "Tittel"
+
+#: simplenews_template.module:230
+msgid "Enter a header common for all issues of this newsletter. For more information, see the !help."
+msgstr "Legg inn en header felles for alle utsendelsene av dette nyhetsbrevet. For mer informasjon, se !help."
+
+#: simplenews_template.module:232;259;286
+msgid "help page"
+msgstr "hjelpeside"
+
+#: simplenews_template.module:242
+msgid "Enter the content of the newsletter's header."
+msgstr "Skriv inn innholdet i nyhetsbrevet header."
+
+#: simplenews_template.module:256;268
+msgid "Footer"
+msgstr "Bunntekst"
+
+#: simplenews_template.module:257
+msgid "Enter a footer common for all issues of this newsletter. For more information, see the !help."
+msgstr "Legg inn en bunntekst felles for alle utgaver av dette nyhetsbrevet. For mer informasjon se !help."
+
+#: simplenews_template.module:269
+msgid "Enter the content of the newsletter's footer."
+msgstr "Legg inn innholdet i nyhetsbrevets bunntekst."
+
+#: simplenews_template.module:283
+msgid "Style"
+msgstr "Stil"
+
+#: simplenews_template.module:284
+msgid "For more information, see the !help."
+msgstr "For mer informasjon, se !help."
+
+#: simplenews_template.module:295
+msgid "Body background color"
+msgstr "Hovedtekst bakgrunn farge"
+
+#: simplenews_template.module:296
+msgid "Enter the body background color to be used in all issues of this newsletter."
+msgstr "Legg in hovedtekstens bakgrunnsfarge. Blir benyttet i alle utgaver av dette nyhetsbrevet."
+
+#: simplenews_template.module:303
+msgid "CSS"
+msgstr "CSS"
+
+#: simplenews_template.module:304
+msgid "Enter the CSS code to be included in all issues of this newsletter."
+msgstr "Legg inn CSS koden som skal legges ved alle utgaver av dette nyhetsbrevet."
+
+#: simplenews_template.module:0
+msgid "simplenews_template"
+msgstr "simplenews_template"
+
+#: simplenews_template.install:25
+msgid "!module was succefully installed."
+msgstr "!module ble installert."
+
+#: simplenews_template.install:37
+msgid "Failed to delete variables for Simplenews Template."
+msgstr "Kunne ikke slette variabler for Simplenews Template."
+
+#: simplenews_template.info:0
+msgid "Simplenews Template"
+msgstr "Simplenews Template"
+
+#: simplenews_template.info:0
+msgid "Extends Simplenews by providing a themable template with configurable header, footer and style."
+msgstr "Utvider Simplenews ved å legge til en mal med konfigurerbar topptekst og bunntekst og stil."
+
diff -urp -N simplenews_template/translations/simplenews_template.pot simplenews_template_6/translations/simplenews_template.pot
--- simplenews_template/translations/simplenews_template.pot	1970-01-01 01:00:00.000000000 +0100
+++ simplenews_template_6/translations/simplenews_template.pot	2008-10-23 15:33:50.000000000 +0200
@@ -0,0 +1,97 @@
+# $Id: simplenews_template.pot,v 1.2 2008/10/19 20:47:56 tbarregren Exp $
+#
+# LANGUAGE translation of Drupal (general)
+# Copyright YEAR NAME <EMAIL@ADDRESS>
+# Generated from files:
+#  simplenews_template.module,v 1.9 2008/10/19 20:45:10 tbarregren
+#  simplenews_template.info,v 1.3 2008/10/19 09:15:48 tbarregren
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PROJECT VERSION\n"
+"POT-Creation-Date: 2008-10-19 22:46+0200\n"
+"PO-Revision-Date: YYYY-mm-DD HH:MM+ZZZZ\n"
+"Last-Translator: NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <EMAIL@ADDRESS>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
+
+#: simplenews_template.module:203
+msgid "Simplenews Template preview"
+msgstr ""
+
+#: simplenews_template.module:242
+msgid "Preview"
+msgstr ""
+
+#: simplenews_template.module:298;307
+msgid "Header"
+msgstr ""
+
+#: simplenews_template.module:299
+msgid "The header common for all issues of this newsletter."
+msgstr ""
+
+#: simplenews_template.module:308
+msgid "Enter the content of the newsletter's header."
+msgstr ""
+
+#: simplenews_template.module:322;331
+msgid "Footer"
+msgstr ""
+
+#: simplenews_template.module:323
+msgid "The footer common for all issues of this newsletter."
+msgstr ""
+
+#: simplenews_template.module:332
+msgid "Enter the content of the newsletter's footer."
+msgstr ""
+
+#: simplenews_template.module:346
+msgid "Style"
+msgstr ""
+
+#: simplenews_template.module:347
+msgid "The style to be applied to all issues of this newsletter"
+msgstr ""
+
+#: simplenews_template.module:355
+msgid "Body background color"
+msgstr ""
+
+#: simplenews_template.module:356
+msgid "Enter the backgound color of the body."
+msgstr ""
+
+#: simplenews_template.module:363
+msgid "CSS"
+msgstr ""
+
+#: simplenews_template.module:364
+msgid "Enter the CSS rules of the body."
+msgstr ""
+
+#: simplenews_template.module:192
+msgid "access newsletter preview"
+msgstr ""
+
+#: simplenews_template.module:0
+msgid "simplenews_template"
+msgstr ""
+
+#: simplenews_template.info:0
+msgid "Simplenews Template"
+msgstr ""
+
+#: simplenews_template.info:0
+msgid "Extends Simplenews by providing a themable template with configurable header, footer and style."
+msgstr ""
+
+#: simplenews_template.info:0
+msgid "Mail"
+msgstr ""
+
