[Vtigercrm-commits] [vtiger-commits] r10741 - in /vtigercrm/branches/5.0.3: Smarty/templates/ListViewAjax.tpl Smarty/templates/Webmails.tpl modules/Webmails/ListView.php modules/Webmails/ListViewAjax.php modules/Webmails/Webmails.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Apr 20 04:23:57 EDT 2007


Author: richie
Date: Fri Apr 20 02:23:45 2007
New Revision: 10741

Log:
* Fixed the issues in webmails

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/ListViewAjax.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl
    vtigercrm/branches/5.0.3/modules/Webmails/ListView.php
    vtigercrm/branches/5.0.3/modules/Webmails/ListViewAjax.php
    vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/ListViewAjax.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/ListViewAjax.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/ListViewAjax.tpl Fri Apr 20 02:23:45 2007
@@ -1,4 +1,4 @@
-<!-- Table to display the mails list -  Starts -->
+				<!-- Table to display the mails list -  Starts -->
 				<div id="navTemp" style="display:none">
 					<span style="float:left">{$ACCOUNT} &gt; {$MAILBOX}</span> <span style="float:right">{$NAVIGATION}</span>	
 				</div>
@@ -13,7 +13,7 @@
 					<input type="button" name="mass_del" value=" {$MOD.LBL_DELETE} "  class="crmbutton small delete" onclick="mass_delete();"/>
                                         {$FOLDER_SELECT}
 				</div>
-			<div id="show_msg" class="layerPopup" align="center" style="padding: 5px;font-weight:bold;font-size:30;width: 400px;display:none;z-index:10000"></div>	
+			<div id="show_msg" class="layerPopup" align="center" style="padding: 5px;font-weight:bold;width: 400px;display:none;z-index:10000"></div>	
                                 <form name="massdelete" method="post">
                                 <table class="rssTable" cellspacing="0" cellpadding="0" border="0" width="100%" id="message_table">
                                    <tr>

Modified: vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/Webmails.tpl Fri Apr 20 02:23:45 2007
@@ -133,7 +133,7 @@
 					<td  align="left" valign="top" style="height:150px;">
 						<div id="rssScroll" style="height:220px;">
 				<!--div added to show info while moving mails-->
-					<div id="show_msg" class="layerPopup" align="center" style="padding: 5px;font-size:20;width: 400px;display:none;z-index:10000"></div>
+					<div id="show_msg" class="layerPopup" align="center" style="padding: 5px;font-weight:bold;width: 400px;display:none;z-index:10000"></div>
 				<!-- Table to display the mails list -	Starts -->
 				<form name="massdelete" method="post">
 				<table class="rssTable" cellspacing="0" cellpadding="0" border="0" width="100%" id="message_table">
@@ -149,7 +149,6 @@
 						{/foreach}
 					{/foreach}
 				</table>
-				<div id="show_msg" align="center" style="border: 1px solid green; padding: 5px; background: rgb(25,34,23);width: 350px;display:none;z-index:10000"></div>
 				</form>
 				<!-- Table to display the mails list - Ends -->
 
@@ -190,7 +189,7 @@
 
 						<tr><td align="right"><b>{$MOD.LBL_SUBJECT}</b></td><td id="webmail_subject"></td></tr>
 		<tr><td	align="right"><b>{$MOD.LBL_DATE}</b></td><td id="webmail_date"></td>
-	<tr><td align="right"><b>{$MOD.LBL_ATTACHMENT}</b></td><td id="webmail_attachment"></td>
+	<tr><td align="right"><b>{$MOD.LBL_ATTACHMENT}:</b></td><td id="webmail_attachment"></td>
 							<td id="full_view"><a href="javascript:;"> Full Email View</a></td></tr>
 						<tr><td align="right" style="border-bottom:1px solid #666666;" colspan="3">&nbsp;</td></tr>
 					</table>
@@ -217,50 +216,4 @@
    </tr>
 </table>
 
-<script>
-function OpenCompose(id,mode)
-{ldelim}
-        switch(mode)
-                {ldelim}
-                case 'edit':
-                        url = 'index.php?module=Webmails&action=EditView&record='+id;
-                        break;
-                case 'create':
-			url = 'index.php?module=Emails&action=EmailsAjax&file=EditView';
-                        break;
-                case 'forward':
-                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&forward=true&webmail=true&file=EditView&mailbox={$MAILBOX}';
-                        break;
-                case 'reply':
-                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=single&webmail=true&file=EditView&mailbox={$MAILBOX}';
-                        break;
-                case 'replyall':
-                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=all&webmail=true&file=EditView&mailbox={$MAILBOX}';
-                        break;
-                case 'attachments':
-                        url = 'index.php?module=Webmails&action=dlAttachments&mailid='+id+'&mailbox={$MAILBOX}';
-                        break;
-                case 'full_view':
-                        url = 'index.php?module=Webmails&action=DetailView&record='+id+'&mailid='+id+'&mailbox={$MAILBOX}';
-                        break;
-                {rdelim}
-        openPopUp('xComposeEmail',this,url,'createemailWin',830,662,'menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
-{rdelim}
-var gselected_mail = '';
-{if $smarty.request.mailbox.value neq ''}
-	var gCurrentFolder = '{$smarty.request.mailbox}';
-{else}	
-	var gCurrentFolder = 'INBOX';
-{/if}
-{literal}
-function makeSelected(rowId)
-{
-	if(gselected_mail != '')
-		$(gselected_mail).className = '';
-		
-	$(rowId).className = 'mailSelected_select';
-	gselected_mail = rowId;
-}
-{/literal}
-</script>
 <!-- END -->

Modified: vtigercrm/branches/5.0.3/modules/Webmails/ListView.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/ListView.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/ListView.php Fri Apr 20 02:23:45 2007
@@ -171,6 +171,7 @@
 var mailbox = "<?php echo $MailBox->mailbox;?>";
 var box_refresh=<?php echo $MailBox->box_refresh;?>;
 var webmail = new Array();
+var webmail2 = new Array();
 var timer;
 var command;
 var id;
@@ -262,6 +263,7 @@
 // during the preview window load instead.
 var msgCount = "<?php echo $numEmails;?>";
 var start = "<?php echo $_REQUEST['start'];?>";
+var gselected_mail = '';
 <?php
 $mails = array();
 if (is_array($overview))

Modified: vtigercrm/branches/5.0.3/modules/Webmails/ListViewAjax.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/ListViewAjax.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/ListViewAjax.php Fri Apr 20 02:23:45 2007
@@ -92,7 +92,7 @@
 		}
 	}
 }
-
+$js_array = "";
 $overview=$elist["overview"];
 $mails = array();
 if (is_array($overview))
@@ -101,11 +101,16 @@
         {
                 $mails[$val->msgno] = $val;
                 $hdr = @imap_headerinfo($MailBox->mbox, $val->msgno);
-                //Added to get the UTF-8 string - 30-11-06 - Mickie
-                //we have to do this utf8 decode for the fields which may contains special characters -- Mickie - 02-02-07
                 $val->from = utf8_decode(imap_utf8(addslashes($val->from)));
                 $val->to = utf8_decode(imap_utf8(addslashes($val->to)));
                 $val->subject = utf8_decode(imap_utf8($val->subject));
+		$list = explode("<",$val->from);
+		$js_array .= "webmail2[".$val->msgno."] = new Array();";
+		$js_array .= "webmail2[".$val->msgno."]['from'] = '".addslashes($list[0])."';";
+		$js_array .= "webmail2[".$val->msgno."]['to'] = '".addslashes($val->to)."';";
+		$js_array .= "webmail2[".$val->msgno."]['subject'] = '".addslashes($val->subject)."';";
+		$js_array .= "webmail2[".$val->msgno."]['date'] = '".addslashes($val->date)."';";
+		$js_array .= "webmail2[".$val->msgno."]['cc'] = '".$hdr->ccaddress."';";
 	}
 }
 $search_fields = Array("SUBJECT","BODY","TO","CC","BCC","FROM");
@@ -205,8 +210,8 @@
 
 			if($numEmails==0) {$num=$numEmails;} else {$num=($numEmails-1);}
 			$folders .= '<li class="tabUnSelected" style="padding-left:0px;"><img src="'.$image_path.'/'.$img.'"align="absmiddle" />&nbsp;&nbsp;<a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu">'.$tmpval.'</a>&nbsp;&nbsp;<span id="'.$tmpval.'_count" style="font-weight:bold">';
-			if($new_msgs > 0)
-				$folders .= '(<span id="'.$tmpval.'_unread">'.$new_msgs.'</span>)</span>&nbsp;&nbsp;<span id="remove_'.$tmpval.'" style="position:relative;display:none">Remove</span></li>';
+			if($unread_msgs > 0)
+				$folders .= '(<span id="'.$tmpval.'_unread">'.$unread_msgs.'</span>)</span>&nbsp;&nbsp;<span id="remove_'.$tmpval.'" style="position:relative;display:none">Remove</span></li>';
 
 		} else {
 			$box = imap_status($MailBox->mbox, "{".$MailBox->imapServerAddress."}".$tmpval, SA_ALL);
@@ -222,7 +227,7 @@
         $boxes .= '</select>';
 }
 imap_close($MailBox->mbox);
-
+echo '<div id="js_arr" style="display:none">'.$js_array.'</div>';
 $smarty = new vtigerCRM_Smarty;
 //$smarty->assign("USERID", $current_user->id);
 $smarty->assign("MOD", $mod_strings);
@@ -242,6 +247,7 @@
 $smarty->assign("MAILBOX", $MailBox->mailbox);
 $smarty->assign("ACCOUNT", $MailBox->display_name);
 $smarty->assign("BOXLIST",$folders);
+$smarty->assign("MAIL_INFO",$js_array);
 //$smarty->assign("DEGRADED_SERVICE",$degraded_service);
        $smarty->display("ListViewAjax.tpl");
 ?>

Modified: vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/Webmails.js Fri Apr 20 02:23:45 2007
@@ -9,6 +9,12 @@
  ********************************************************************************/
 function load_webmail(mid) {
         var node = $("row_"+mid);
+	var webmail2 = new Array();
+	if(getObj("js_arr")){
+		eval(getObj("js_arr").innerHTML);
+	}
+	else
+		webmail2 = null;
 	if(typeof($('fnt_subject_'+mid)) != "undefined" && $('fnt_subject_'+mid).color=="green")
 	{
 		$('fnt_subject_'+mid).color="";
@@ -36,13 +42,20 @@
                 ));
 	}
         node.className='read_email';
-
-        $("from_addy").innerHTML = "&nbsp;"+webmail[mid]["from"];
-        $("to_addy").innerHTML = "&nbsp;"+webmail[mid]["to"];
-        $("webmail_subject").innerHTML = "&nbsp;"+webmail[mid]["subject"];
-        $("webmail_date").innerHTML = "&nbsp;"+webmail[mid]["date"];
-        $("webmail_cc").innerHTML = "&nbsp;"+webmail[mid]["cc"];
-
+	if(webmail2 == null){
+	        $("from_addy").innerHTML = "&nbsp;"+webmail[mid]["from"];
+	        $("to_addy").innerHTML = "&nbsp;"+webmail[mid]["to"];
+	        $("webmail_subject").innerHTML = "&nbsp;"+webmail[mid]["subject"];
+	        $("webmail_date").innerHTML = "&nbsp;"+webmail[mid]["date"];
+	        $("webmail_cc").innerHTML = "&nbsp;"+webmail[mid]["cc"];
+	}
+	else{
+		$("from_addy").innerHTML = "&nbsp;"+webmail2[mid]["from"];
+                $("to_addy").innerHTML = "&nbsp;"+webmail2[mid]["to"];
+                $("webmail_subject").innerHTML = "&nbsp;"+webmail2[mid]["subject"];
+                $("webmail_date").innerHTML = "&nbsp;"+webmail2[mid]["date"];
+                $("webmail_cc").innerHTML = "&nbsp;"+webmail2[mid]["cc"];
+	}
 	//Fix for webmails body display in IE - dartagnanlaf
 	/*
         new Ajax.Request(
@@ -88,13 +101,50 @@
 
         $("full_view").removeChild($("full_view").firstChild);
         $("full_view").appendChild(Builder.node('a',{href: 'javascript:;', onclick: 'OpenCompose('+mid+',\'full_view\')'},'Full Email View'));
-
 	makeSelected(node.id)
 }
 function displayAttachments(mid) {
         var url = "index.php?module=Webmails&action=dlAttachments&mailid="+mid+"&mailbox="+mailbox;
         window.open(url,"Download Attachments",'menubar=no,toolbar=no,location=no,status=no,resizable=no,width=450,height=450');
 }
+function OpenCompose(id,mode)
+{
+        switch(mode)
+                {
+                case 'edit':
+                        url = 'index.php?module=Webmails&action=EditView&record='+id;
+                        break;
+                case 'create':
+                        url = 'index.php?module=Emails&action=EmailsAjax&file=EditView';
+                        break;
+                case 'forward':
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&forward=true&webmail=true&file=EditView&mailbox='+mailbox;
+                        break;
+                case 'reply':
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=single&webmail=true&file=EditView&mailbox='+mailbox;
+                        break;
+                case 'replyall':
+                        url = 'index.php?module=Emails&action=EmailsAjax&mailid='+id+'&reply=all&webmail=true&file=EditView&mailbox='+mailbox;
+                        break;
+                case 'attachments':
+                        url = 'index.php?module=Webmails&action=dlAttachments&mailid='+id+'&mailbox='+mailbox;
+                        break;
+                case 'full_view':
+                        url = 'index.php?module=Webmails&action=DetailView&record='+id+'&mailid='+id+'&mailbox='+mailbox;
+                        break;
+                }
+        openPopUp('xComposeEmail',this,url,'createemailWin',830,662,'menubar=no,toolbar=no,location=no,status=no,resizable=yes,scrollbars=yes');
+}
+
+function makeSelected(rowId)
+{
+        if(gselected_mail != '')
+                $(gselected_mail).className = '';
+
+        $(rowId).className = 'mailSelected_select';
+        gselected_mail = rowId;
+}
+
 function showRelationships(mid) {
 	// TODO: present the user with a simple DHTML div to
 	// choose what type of relationship they would like to create
@@ -166,10 +216,12 @@
 	);
 }
 function check_for_new_mail(mbox) {
-	window.location=window.location;
+	//window.location=window.location;
 	if(degraded_service == 'true') {
 		return;
 	}
+	mailbox = mbox;
+	runEmailCommand("reload",0);
         $("status").style.display="block";
 /*
         new Ajax.Request(
@@ -454,6 +506,7 @@
 function runEmailCommand(com,id) {
         command=com;
         id=id;
+	gselected_mail = '';
 	if(com == 'delete_msg')
 	{
 		if(!confirm(alert_arr.DELETE+" "+alert_arr.MAIL+" ?"))
@@ -470,7 +523,8 @@
 	}
 	else
 		qry_str = "";
-        $("status").style.display="block";
+        
+	$("status").style.display="block";
         new Ajax.Request(
                 'index.php',
                 {queue: {position: 'end', scope: 'command'},
@@ -484,7 +538,6 @@
 				    case 'reload':
 					$("rssScroll").innerHTML = resp;
 					var unread_count = parseInt($(mailbox+"_tempcount").innerHTML);
-					//$("nav").innerHTML = $("navTemp").innerHTML;
 					if(unread_count > 0) {
 						$(mailbox+"_unread").innerHTML = unread_count;
 					}
@@ -492,12 +545,9 @@
 						$(mailbox+"_count").innerHTML = "";
 					}
 					$("nav").innerHTML = $("navTemp").innerHTML;
-					if(change_box != 1){
-						$("box_list").innerHTML = $("temp_boxlist").innerHTML;
-						change_box = 0;
-					}
+					$("box_list").innerHTML = $("temp_boxlist").innerHTML;
 					$("move_pane").innerHTML = $("temp_movepane").innerHTML;
-					$("temp_boxlist").innerHTML = "";
+				//	$("temp_boxlist").innerHTML = "";
 					$("temp_movepane").innerHTML = "";
 					$("navTemp").innerHTML = '';
 					$(mailbox+"_tempcount").innerHTML = "";
@@ -536,7 +586,7 @@
                                         	);
 
 					try {
-                                        	$("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'undelete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-full.png" border="0" width="14" height="14" alt="'+alert_arr.LBL_DEL+'" title="'+alert_arr.LBL_DEL+'"></a>';
+                                        	$("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'undelete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-full.png" border="0" width="14" height="14" alt="del"></a>';
 
                                         	new Effect.Fade(row,{queue: {position: 'end', scope: 'effect'},duration: '0.5'});
                                         	tmp = document.getElementsByClassName("previewWindow");
@@ -573,7 +623,7 @@
 						}
                                         );
 
-                                        $("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'undelete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-full.png" border="0" width="14" height="14" alt="'+alert_arr.LBL_DEL+'" title="'+alert_arr.LBL_DEL+'"></a>';
+                                        $("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'undelete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-full.png" border="0" width="14" height="14" alt="del"></a>';
 
                                         new Effect.Fade(row,{queue: {position: 'end', scope: 'effect'},duration: '1.0'});
                                         tmp = document.getElementsByClassName("previewWindow");
@@ -591,7 +641,7 @@
                                         node.style.display = '';
                                         var newhtml = remove(remove(node.innerHTML,'<s>'),'</s>');
                                         node.innerHTML=newhtml;
-                                        $("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'delete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-empty.png" border="0" width="14" height="14" alt="'+alert_arr.LBL_DEL+'" title="'+alert_arr.LBL_DEL+'"></a>';
+                                        $("del_link_"+id).innerHTML = '<a href="javascript:void(0);" onclick="runEmailCommand(\'delete_msg\','+id+');"><img src="modules/Webmails/images/gnome-fs-trash-empty.png" border="0" width="14" height="14" alt="del"></a>';
                                 	$("status").style.display="none";
                                     break;
                                     case 'clear_flag':
@@ -635,7 +685,8 @@
 }
 function changeMbox(box) {
 	mailbox=box;
-	start = 0;
+	start = 0;	
+	change_box=1;
 	runEmailCommand("reload",0);
         //location.href = "index.php?module=Webmails&action=index&mailbox="+box;
 }





More information about the vtigercrm-commits mailing list