[Vtigercrm-commits] [vtiger-commits] r7957 - in /branches/VTIGERCRM-5.0.2-MMBRICH: Smarty/templates/CreateEmailTemplate.tpl modules/Users/detailviewemailtemplate.php modules/Users/editemailtemplate.php modules/Users/saveemailtemplate.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Jul 11 17:21:13 EDT 2006


Author: mmbrich
Date: Tue Jul 11 15:21:12 2006
New Revision: 7957

Log:
new text and html email template system

Modified:
    branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/CreateEmailTemplate.tpl
    branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/detailviewemailtemplate.php
    branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/editemailtemplate.php
    branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/saveemailtemplate.php

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/CreateEmailTemplate.tpl
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/CreateEmailTemplate.tpl (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/CreateEmailTemplate.tpl Tue Jul 11 15:21:12 2006
@@ -11,6 +11,7 @@
 -->*}
 <script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
 <script language="JavaScript" type="text/javascript" src="include/js/menu.js"></script>
+<script type="text/javascript" src="include/fckeditor/fckeditor.js"></script>
 <style type="text/css">@import url(../themes/blue/style.css);</style>
 
 <script language="JavaScript" type="text/javascript">
@@ -226,9 +227,11 @@
                                 </span></td>
                               </tr>
                               <tr>
-                                <td valign="top" width=10% class="cellLabel small">{$UMOD.LBL_MESSAGE}</td>
-                                 <td valign="top" width=60% class="cellText small"><p><textarea name="body" style="width:90%;height:200px" class=small tabindex="5">{$BODY}</textarea></p>
-                                    </td>
+                                <td valign="top" width=10% class="cellLabel small">{$UMOD.LBL_MESSAGE}</td>
+                                 <td valign="top" width=60% class="cellText small"><p><textarea name="body" style="width:90%;height:200px" class=small tabindex="5">{$BODY}</textarea></p>
+				<p><a href="javascript:PopulatePlainTextEmail();">Create plain-text template</a></p>
+				<p><textarea name="text_body" style="width:100%;height:370px;border:1px solid gray" class=small id="text_body">{$TEXT_BODY}</textarea></p>
+                                    </td>
                                 <td valign="top" width=30% class="cellText small" style="border-left:2px dotted #cccccc;"><table width="100%"  border="0" cellspacing="0" cellpadding="5" >
                                   <tr>
                                     <td class="small"><strong>{$UMOD.LBL_MERGE_FIELDS}<br>
@@ -251,12 +254,13 @@
                                   <tr>
                                     <td class="small"><strong>{$UMOD.LBL_STEP} 3. {$UMOD.LBL_COPY_PASTE} </strong></td>
                                   </tr>
-					<tr><td><input type="text"  id="mergeFieldValue" name="variable" value="variable" class="detailedViewTextBoxOn" tabindex="8"/></td></tr>
+					<tr><td><input type="text"  id="mergeFieldValue" name="variable" value="variable" class="detailedViewTextBoxOn" tabindex="8"/></td></tr>
                                 </table></td>
                               </tr>
-                          </table></td>
-                          
-                        </tr>
+                          </table>
+
+			</td>
+                        </tr>
                       </table></td>
 					  </tr>
 					</table>
@@ -320,6 +324,20 @@
 
 {rdelim}
 
-init();
-
+init();
+{literal}
+var oFCKeditor = null;
+oFCKeditor = new FCKeditor( "body" ,"100%","370") ;
+oFCKeditor.BasePath   = "include/fckeditor/" ;
+oFCKeditor.ReplaceTextarea();
+function PopulatePlainTextEmail() {
+        try {
+                $('text_body').innerHTML = "";
+                var el = $('body___Frame').contentWindow.document.getElementById('eEditorArea').contentWindow.document.body;
+                var tmp = el.innerHTML.replace(/\<br\>/g, '\n');
+                $('text_body').innerHTML = (tmp.stripTags());
+        }catch(e){alert(e);}
+}
+
+{/literal}
 </script>

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/detailviewemailtemplate.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/detailviewemailtemplate.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/detailviewemailtemplate.php Tue Jul 11 15:21:12 2006
@@ -49,7 +49,7 @@
 $smarty->assign("TEMPLATEID", $emailtemplateResult["templateid"]);
 
 $smarty->assign("SUBJECT", $emailtemplateResult["subject"]);
-$smarty->assign("BODY", nl2br($emailtemplateResult["body"]));
+$smarty->assign("BODY", nl2br($emailtemplateResult["text_body"]));
 
 $smarty->display("DetailViewEmailTemplate.tpl");
 

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/editemailtemplate.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/editemailtemplate.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/editemailtemplate.php Tue Jul 11 15:21:12 2006
@@ -50,6 +50,7 @@
 $smarty->assign("DESCRIPTION", $emailtemplateResult["description"]);
 $smarty->assign("SUBJECT", $emailtemplateResult["subject"]);
 $smarty->assign("BODY", $emailtemplateResult["body"]);
+$smarty->assign("TEXT_BODY", $emailtemplateResult["text_body"]);
 $smarty->assign("MODULE", 'Settings');
 $smarty->assign("PARENTTAB", $_REQUEST['parenttab']);
 $smarty->assign("EMODE", $mode);

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/saveemailtemplate.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/saveemailtemplate.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/Users/saveemailtemplate.php Tue Jul 11 15:21:12 2006
@@ -25,6 +25,7 @@
 	  $log->debug("the subject is ".$subject);  
 $body = $_REQUEST["body"];
 	  $log->debug("the body is ".$body);  
+$text_body = $_REQUEST["text_body"];
 if ($body !='')
 {
 	$body = to_html($body);
@@ -33,7 +34,7 @@
 if(isset($templateid) && $templateid !='')
 {
 	$log->info("the templateid is set");  
-	$sql = "update vtiger_emailtemplates set foldername = '".$folderName."', templatename ='".$templateName."', subject ='".$subject."', description ='".$description."', body ='".$body."' where templateid =".$templateid;
+	$sql = "update vtiger_emailtemplates set foldername = '".$folderName."', templatename ='".$templateName."', subject ='".$subject."', description ='".$description."', body ='".$body."', text_body='".$text_body."' where templateid =".$templateid;
 	$adb->query($sql);
  
 	$log->info("about to invoke the detailviewemailtemplate file");  
@@ -42,7 +43,7 @@
 else
 {
 	$templateid = $db->getUniqueID('vtiger_emailtemplates');
-	$sql = "insert into vtiger_emailtemplates values ('". $folderName. "','".$templateName."','".$subject."','".$description."','".$body."',0,".$templateid.")";
+	$sql = "insert into vtiger_emailtemplates values ('". $folderName. "','".$templateName."','".$subject."','".$description."','".$body."',0,".$templateid.",'".$text_body."')";
 	$adb->query($sql);
 
 	 $log->info("added to the db the emailtemplate");





More information about the vtigercrm-commits mailing list