[Vtigercrm-commits] [vtiger-commits] r6578 - in /vtigercrm/trunk: Smarty/templates/Webmails.tpl modules/Emails/EditView.php modules/Emails/Save.php modules/Emails/mailsend.php modules/Webmails/Save.php modules/Webmails/Webmail.php modules/Webmails/webmails.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sun May 28 02:15:05 EDT 2006


Author: mmbrich
Date: Sun May 28 00:15:02 2006
New Revision: 6578

Log:
better reply/replyall/forward functions, misc fixups

Modified:
    vtigercrm/trunk/Smarty/templates/Webmails.tpl
    vtigercrm/trunk/modules/Emails/EditView.php
    vtigercrm/trunk/modules/Emails/Save.php
    vtigercrm/trunk/modules/Emails/mailsend.php
    vtigercrm/trunk/modules/Webmails/Save.php
    vtigercrm/trunk/modules/Webmails/Webmail.php
    vtigercrm/trunk/modules/Webmails/webmails.js

Modified: vtigercrm/trunk/Smarty/templates/Webmails.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/Webmails.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/Webmails.tpl Sun May 28 00:15:02 2006
@@ -152,7 +152,7 @@
 						  <span id="qualify_button"><input type="button" name="Qualify2" value=" {$MOD.LBL_QUALIFY_BUTTON} " class="classWebBtn" /></span>&nbsp;
 						  <span id="reply_button"><input type="button" name="reply" value=" {$MOD.LBL_REPLY_TO_SENDER} " class="classWebBtn" /></span>&nbsp;
 						  <span id="reply_button_all"><input type="button" name="reply" value=" {$MOD.LBL_REPLY_ALL} " class="classWebBtn" /></span>&nbsp;
-						  <input type="button" name="forward" value=" {$MOD.LBL_FORWARD_BUTTON} " class="classWebBtn" />&nbsp;
+						  <span id="forward_button"><input type="button" name="forward" value=" {$MOD.LBL_FORWARD_BUTTON} " class="classWebBtn" /></span>&nbsp;
 						  <span id="download_attach_button"><input type="button" name="download" value=" {$MOD.LBL_DOWNLOAD_ATTCH_BUTTON} " class="classWebBtn" /></span>
 						</td>
 						<td width="25%" align="right"><span id="delete_button"><input type="button" name="Button" value=" {$APP.LBL_DELETE_BUTTON} "  class="classWebBtn" /></span></td>
@@ -198,16 +198,19 @@
 			url = 'index.php?module=Emails&action=EmailsAjax&file=EditView';
                         break;
                 case 'forward':
-                        url = 'index.php?module=Webmails&action=EditView&record='+id+'&forward=true';
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&forward=true&webmail=true&file=EditView';
                         break;
                 case 'reply':
-                        url = 'index.php?module=Webmails&action=EditView&record='+id+'&reply=true';
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=single&webmail=true&file=EditView';
+                        break;
+                case 'replyall':
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=all&webmail=true&file=EditView';
                         break;
                 case 'attachments':
                         url = 'index.php?module=Webmails&action=dlAttachments&mailid='+id;
                         break;
                 {rdelim}
-        openPopUp('xComposeEmail',this,url,'createemailWin',820,652,'menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
+        openPopUp('xComposeEmail',this,url,'createemailWin',830,662,'menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
 {rdelim}
 </script>
 <!-- END -->

Modified: vtigercrm/trunk/modules/Emails/EditView.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/EditView.php (original)
+++ vtigercrm/trunk/modules/Emails/EditView.php Sun May 28 00:15:02 2006
@@ -81,6 +81,46 @@
 	$focus->mode = '';
 }
 
+// Webmails
+if(isset($_REQUEST["mailid"]) && $_REQUEST["mailid"] != "") {
+	$mailid = $_REQUEST["mailid"];
+	$mailbox = $_REQUEST["mailbox"];
+	require_once('include/utils/UserInfoUtil.php');
+	require_once("modules/Webmails/Webmail.php");
+	require_once("modules/Webmails/MailParse.php");
+
+	$mailInfo = getMailServerInfo($current_user);
+	$temprow = $adb->fetch_array($mailInfo);
+
+	global $mbox;
+	$mbox = getImapMbox($mailbox,$temprow);
+
+	$webmail = new Webmail($mbox,$mailid);
+	$webmail->loadMail();
+
+	$smarty->assign('WEBMAIL',"true");
+	if($_REQUEST["reply"] == "all") {
+		$smarty->assign('TO_MAIL',$webmail->fromaddr);	
+		if(is_array($webmail->cc_list))
+			$smarty->assign('CC_MAIL',implode(",".$webmail->cc_list).implode(",",$webmail->to));
+		else
+			$smarty->assign('CC_MAIL',implode(",",$webmail->to));
+		$smarty->assign('SUBJECT',"RE: ".$webmail->subject);
+
+	} elseif($_REQUEST["reply"] == "single") {
+		$smarty->assign('TO_MAIL',$webmail->reply_to[0]);	
+		$smarty->assign('BCC_MAIL',$webmail->to[0]);
+		$smarty->assign('SUBJECT',"RE: ".$webmail->subject);
+
+	} elseif($_REQUEST["forward"] == "true") {
+		$smarty->assign('TO_MAIL',$webmail->reply_to[0]);	
+		$smarty->assign('BCC_MAIL',$webmail->to[0]);
+		$smarty->assign('SUBJECT',"FW: ".$webmail->subject);
+	}
+	$smarty->assign('DESCRIPTION',$webmail->replyBody());
+	$focus->mode='';
+}
+
 global $theme;
 $theme_path="themes/".$theme."/";
 $image_path=$theme_path."images/";
@@ -200,11 +240,11 @@
 ?>
 <script type="text/javascript" defer="1">
 addOnloadEvent(function () {
-var oFCKeditor = null;
-oFCKeditor = new FCKeditor( "description" ) ;
-oFCKeditor.BasePath  = "include/fckeditor/" ;
-oFCKeditor.Height = 500;
-oFCKeditor.Width = "100%";
-oFCKeditor.ReplaceTextarea() ;
+	var oFCKeditor = null;
+	oFCKeditor = new FCKeditor("description") ;
+	oFCKeditor.BasePath  = "include/fckeditor/" ;
+	oFCKeditor.Height = 500;
+	oFCKeditor.Width = "100%";
+	oFCKeditor.ReplaceTextarea() ;
 });
 </script>

Modified: vtigercrm/trunk/modules/Emails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/Save.php (original)
+++ vtigercrm/trunk/modules/Emails/Save.php Sun May 28 00:15:02 2006
@@ -198,9 +198,9 @@
 $local_log->debug("Saved record with id of ".$return_id);
 
 if( isset($_REQUEST['send_mail']) && $_REQUEST['send_mail'])
-{
-	include("modules/Emails/mailsend.php");
-}
+{
+	include("modules/Emails/mailsend.php");
+}
 elseif(isset($_REQUEST['return_action']) && $_REQUEST['return_action'] == 'mailbox')
 {
 	header("Location: index.php?module=$return_module&action=index");
@@ -209,9 +209,9 @@
 {
 	//code added for returning back to the current view after edit from list view
 	if($_REQUEST['return_viewname'] == '') $return_viewname='0';
-	if($_REQUEST['return_viewname'] != '')$return_viewname=$_REQUEST['return_viewname'];
-	$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
-	echo $inputs;
+	if($_REQUEST['return_viewname'] != '')$return_viewname=$_REQUEST['return_viewname'];
+	$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
+	echo $inputs;
 	//header("Location: index.php?action=$return_action&module=$return_module&parent_id=$parent_id&record=$return_id&filename=$filename&viewname=$return_viewname");
-}
-?>
+}
+?>

Modified: vtigercrm/trunk/modules/Emails/mailsend.php
==============================================================================
--- vtigercrm/trunk/modules/Emails/mailsend.php (original)
+++ vtigercrm/trunk/modules/Emails/mailsend.php Sun May 28 00:15:02 2006
@@ -185,7 +185,8 @@
 $adb->println("Mail Sending Process has been finished.\n\n");
 if(isset($_REQUEST['popupaction']) && $_REQUEST['popupaction'] != '')
 {
-	$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
+	//$inputs="<script>window.opener.location.href=window.opener.location.href;window.self.close();</script>";
+	$inputs="<script>window.self.close();</script>";
 	echo $inputs;
 }
 //header("Location:index.php?module=$returnmodule&action=$returnaction&record=$returnid&$returnset&$mail_error_str");

Modified: vtigercrm/trunk/modules/Webmails/Save.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/Save.php (original)
+++ vtigercrm/trunk/modules/Webmails/Save.php Sun May 28 00:15:02 2006
@@ -78,14 +78,12 @@
 
 //to save the email details in emaildetails tables
 $fieldid = $adb->query_result($adb->query('select fieldid from field where tablename="contactdetails" and fieldname="email" and columnname="email"'),0,'fieldid');
-if($email->relationship != 0)
-{
+if($email->relationship != 0) {
 	$focus->column_fields['parent_id']=$email->relationship["id"].'@'.$fieldid.'|';
 
 	if($email->relationship["type"] == "Contacts")
 		add_attachment_to_contact($email->relationship["id"],$email);
-}else
-{
+}else {
 	//if relationship is not available create a contact and relate the email to the contact
 	require_once('modules/Contacts/Contact.php');
 	$contact_focus = new Contact();	

Modified: vtigercrm/trunk/modules/Webmails/Webmail.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/Webmail.php (original)
+++ vtigercrm/trunk/modules/Webmails/Webmail.php Sun May 28 00:15:02 2006
@@ -75,6 +75,12 @@
 		$this->inline = $this->email["inline"];
 		$this->attachments = $this->email["attachments"];
 		$this->body = $this->email["content"]["body"];
+	}
+
+	function replyBody() {
+		$tmp = "<br><br><p style='font-weight:bold'>In reply to the message sent by ".$this->reply_name." on ".$this->date."</p>";
+		$tmp .= "<blockquote style='border-left:1px solid blue;padding-left:5px'>".$this->body."</blockquote>";
+		return $tmp;
 	}
 
 	function unDeleteMsg() {

Modified: vtigercrm/trunk/modules/Webmails/webmails.js
==============================================================================
--- vtigercrm/trunk/modules/Webmails/webmails.js (original)
+++ vtigercrm/trunk/modules/Webmails/webmails.js Sun May 28 00:15:02 2006
@@ -29,10 +29,13 @@
         $("delete_button").appendChild(Builder.node('input',{type: 'button', name: 'Button', value: 'Delete', className: 'classWebBtn', onclick: 'runEmailCommand(\'delete_msg\','+mid+')'}));
 
         $("reply_button_all").removeChild($("reply_button_all").firstChild);
-        $("reply_button_all").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To All ', className: 'classWebBtn', onclick: 'window.location = \'index.php?module=Webmails&action=EditView&mailid='+mid+'&reply=all&return_action=index&return_module=Webmails\''}));
+        $("reply_button_all").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To All ', className: 'classWebBtn', onclick: 'OpenCompose('+mid+',\'replyall\')'}));
 
         $("reply_button").removeChild($("reply_button").firstChild);
-        $("reply_button").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To Sender ', className: 'classWebBtn', onclick: 'window.location = \'index.php?module=Webmails&action=EditView&mailid='+mid+'&reply=single&return_action=index&return_module=Webmails\''}));
+        $("reply_button").appendChild(Builder.node('input',{type: 'button', name: 'reply', value: ' Reply To Sender ', className: 'classWebBtn', onclick: 'OpenCompose('+mid+',\'reply\')'}));
+
+        $("forward_button").removeChild($("forward_button").firstChild);
+        $("forward_button").appendChild(Builder.node('input',{type: 'button', name: 'forward', value: ' Forward ', className: 'classWebBtn', onclick: 'OpenCompose('+mid+',\'forward\')'}));
 
         $("qualify_button").removeChild($("qualify_button").firstChild);
         $("qualify_button").appendChild(Builder.node('input',{type: 'button', name: 'Qualify2', value: ' Qualify ', className: 'classWebBtn', onclick: 'showRelationships('+mid+')'}));





More information about the vtigercrm-commits mailing list