valibus_emailpreview - Version 0.0.1

Version Notes

It just fix the email preview bug by surcharging an adminhtml block

Download this release

Release Info

Developer Valibus Patrick
Extension valibus_emailpreview
Version 0.0.1
Comparing to
See all releases


Version 0.0.1

app/code/local/Valibus/Emailpreview/Block/Preview.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Valibus_Emailpreview_Block_Preview extends Mage_Adminhtml_Block_System_Email_Template_Preview{
3
+ protected function _toHtml()
4
+ {
5
+ $template = Mage::getModel('core/email_template');
6
+ if($id = (int)$this->getRequest()->getParam('id')) {
7
+ $template->load($id);
8
+ } else {
9
+ $template->setTemplateType($this->getRequest()->getParam('type'));
10
+ $template->setTemplateText($this->getRequest()->getParam('text'));
11
+ $template->setTemplateStyles($this->getRequest()->getParam('styles'));
12
+ }
13
+ /*Debug Pvalibus 07/08/2012
14
+ * Preview email is only in html format: now ok in preview HTML not escaped
15
+ */
16
+ //$template->setTemplateText(
17
+ //$this->escapeHtml($template->getTemplateText())
18
+ //);
19
+
20
+ Varien_Profiler::start("email_template_proccessing");
21
+ $vars = array();
22
+
23
+ $templateProcessed = $template->getProcessedTemplate($vars, true);
24
+
25
+ if($template->isPlain()) {
26
+ $templateProcessed = "<pre>" . htmlspecialchars($templateProcessed) . "</pre>";
27
+ }
28
+
29
+ Varien_Profiler::stop("email_template_proccessing");
30
+ return $templateProcessed;
31
+ }
32
+ }
app/code/local/Valibus/Emailpreview/etc/config.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Valibus_Emailpreview>
5
+ <version>0.0.1</version>
6
+ </Valibus_Emailpreview>
7
+ </modules>
8
+ <global>
9
+ <blocks>
10
+ <emailpreview><class>Valibus_Emailpreview_Block</class></emailpreview>
11
+ <adminhtml>
12
+ <rewrite>
13
+ <system_email_template_preview>Valibus_Emailpreview_Block_Preview</system_email_template_preview>
14
+ </rewrite>
15
+ </adminhtml>
16
+ </blocks>
17
+ </global>
18
+ </config>
app/etc/modules/Valibus_Emailpreview.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0" ?>
2
+ <config>
3
+ <modules>
4
+ <Valibus_Emailpreview>
5
+ <active>True</active>
6
+ <codePool>local</codePool>
7
+ </Valibus_Emailpreview>>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>valibus_emailpreview</name>
4
+ <version>0.0.1</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.http://opensource.org/licenses/gpl-3.0">GPL-3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Debug the email preview</summary>
10
+ <description>This module rewrite Mage_Adminhtml_Block_System_Email_Template_Preview without the escape html and fix the bug that show only html in the preview's windows</description>
11
+ <notes>It just fix the email preview bug by surcharging an adminhtml block</notes>
12
+ <authors><author><name>Valibus Patrick</name><user>roduce</user><email>pvalibus@gmail.com</email></author></authors>
13
+ <date>2012-08-08</date>
14
+ <time>09:41:41</time>
15
+ <contents><target name="mageetc"><dir name="modules"><file name="Valibus_Emailpreview.xml" hash="a64ca86d92045093a8d4f4dfaab1c493"/></dir></target><target name="magelocal"><dir name="Valibus"><dir name="Emailpreview"><dir name="Block"><file name="Preview.php" hash="735e9072f4f561bc1647665f866b589e"/></dir><dir name="etc"><file name="config.xml" hash="d42625b4b96630921915a3c26c621106"/></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.3.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>