[Vtigercrm-commits] [vtiger-commits] r10724 - 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 modules/Webmails/WebmailsAjax.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed Apr 18 12:18:46 EDT 2007


Author: richie
Date: Wed Apr 18 10:18:37 2007
New Revision: 10724

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
    vtigercrm/branches/5.0.3/modules/Webmails/WebmailsAjax.php

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 Wed Apr 18 10:18:37 2007
@@ -1,6 +1,19 @@
 <!-- Table to display the mails list -  Starts -->
-				<div id="navTemp" style="display:none">{$NAVIGATION}</div>
+				<div id="navTemp" style="display:none">
+					<span style="float:left">{$ACCOUNT} &gt; {$MAILBOX}</span> <span style="float:right">{$NAVIGATION}</span>	
+				</div>
 				<span id="{$MAILBOX}_tempcount" style="display:none" >{$UNREAD_COUNT}</span>
+				<div id="temp_boxlist" style="display:none">
+					<ul style="list-style-type:none;">
+					{foreach item=row from=$BOXLIST}
+						{foreach item=row_values from=$row}                                                                                                 {$row_values}                                                                                                       {/foreach}                                                                                                          {/foreach}
+					</ul>
+				</div>
+				<div id="temp_movepane" style="display:none">
+					<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>	
                                 <form name="massdelete" method="post">
                                 <table class="rssTable" cellspacing="0" cellpadding="0" border="0" width="100%" id="message_table">
                                    <tr>
@@ -14,6 +27,6 @@
                                                         {$row_values}
                                                 {/foreach}
                                         {/foreach}
-                                </table>
+				</table>
                                 </form>
                                 <!-- Table to display the mails list - Ends -->

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 Wed Apr 18 10:18:37 2007
@@ -50,12 +50,12 @@
 				   </tr>
 				   <tr>
 					<td width="20%" class="big mailSubHeader"><b>{$MOD.LBL_EMAIL_FOLDERS}</b></td>
-					<td width="80%" class="big mailSubHeader"><span style="float:left">{$ACCOUNT} &gt; {$MAILBOX}</span> <span style="float:right"><div id="nav">{$NAVIGATION}</div></span></td>
+					<td width="80%" class="big mailSubHeader"><div id="nav"><span style="float:left">{$ACCOUNT} &gt; {$MAILBOX}</span> <span style="float:right">{$NAVIGATION}</span></div></td>
 				   </tr>
 				   <tr>
 					<td rowspan="6" valign="top" class="hdrNameBg">
 						<img src="{$IMAGE_PATH}webmail_root.gif" align="absmiddle" />&nbsp;<span style="cursor:pointer;"><b class="txtGreen">{$MOD.LBL_MY_MAILS}</b>&nbsp;&nbsp;<span id="folderOpts" style="position:absolute;display:none">{$MOD.ADD_FOLDER}</span></span>
-
+						<div id="box_list">
 						<ul style="list-style-type:none;">
 
 							{foreach item=row from=$BOXLIST}
@@ -63,7 +63,7 @@
 									{$row_values}
 								{/foreach}
 							{/foreach}
-						</ul><br />
+						</ul></div> <br />
 
 						<img src="{$IMAGE_PATH}webmail_root.gif" align="absmiddle" />&nbsp;<b class="txtGreen">{$MOD.LBL_SENT_MAILS}</b>
 						<ul style="list-style-type:none;">
@@ -108,7 +108,7 @@
 			<!-- Table to display Delete, Move To and Search buttons and options - Starts -->
 			<table width="100%"  border="0" cellspacing="0" cellpadding="0">
                 	   <tr>
-                        	<td width="45%">
+                        	<td width="45%" id="move_pane">
 					<input type="button" name="mass_del" value=" {$MOD.LBL_DELETE} "  class="crmbutton small delete" onclick="mass_delete();"/>
 					{$FOLDER_SELECT}
                         	</td>
@@ -132,7 +132,8 @@
 					<!-- td style="padding:1px;" align="left" -->
 					<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>
 				<!-- 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">
@@ -148,6 +149,7 @@
 						{/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 -->
 

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 Wed Apr 18 10:18:37 2007
@@ -174,7 +174,7 @@
 var timer;
 var command;
 var id;
-
+var move_mail,change_box,mvmbox;
 
 addOnloadEvent(function() {
 		window.setTimeout("periodic_event()",box_refresh);
@@ -243,12 +243,12 @@
 	$numPages = ceil($numEmails/$MailBox->mails_per_page);
 	if($numPages > 1) {
 		if($start != 1){
-		$navigationOutput = "<a href='index.php?module=Webmails&action=index&start=1&mailbox=".$mailbox."'><img src='modules/Webmails/images/start.gif' border='0'></a>&nbsp;&nbsp;";
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start-1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/previous.gif' border='0'></a> &nbsp;";
+			 $navigationOutput = "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',1);\" ><img src='modules/Webmails/images/start.gif' border='0'></a>&nbsp;&nbsp;";
+                        $navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start-1).");\" ><img src='modules/Webmails/images/previous.gif' border='0'></a> &nbsp;";
 		}
 		if($start <= ($numPages-1)){
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start+1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/next.gif' border='0'></a>&nbsp;&nbsp;";
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".$numPages."&mailbox=".$mailbox."'><img src='modules/Webmails/images/end.gif' border='0'></a>";
+			$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start+1).");\" ><img src='modules/Webmails/images/next.gif' border='0'></a>&nbsp;&nbsp;";
+                        $navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".$numPages.");\"><img src='modules/Webmails/images/end.gif' border='0'></a> &nbsp;";	
 		}
 	}
 }

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 Wed Apr 18 10:18:37 2007
@@ -79,12 +79,16 @@
 	$numPages = ceil($numEmails/$MailBox->mails_per_page);
 	if($numPages > 1) {
 		if($start != 1){
-		$navigationOutput = "<a href='index.php?module=Webmails&action=index&start=1&mailbox=".$mailbox."'><img src='modules/Webmails/images/start.gif' border='0'></a>&nbsp;&nbsp;";
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start-1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/previous.gif' border='0'></a> &nbsp;";
+			$navigationOutput = "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',1);\" ><img src='modules/Webmails/images/start.gif' border='0'></a>&nbsp;&nbsp;";
+			$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start-1).");\" ><img src='modules/Webmails/images/previous.gif' border='0'></a> &nbsp;";
+		//$navigationOutput = "<a href='index.php?module=Webmails&action=index&start=1&mailbox=".$mailbox."'><img src='modules/Webmails/images/start.gif' border='0'></a>&nbsp;&nbsp;";
+		//$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start-1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/previous.gif' border='0'></a> &nbsp;";
 		}
 		if($start <= ($numPages-1)){
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start+1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/next.gif' border='0'></a>&nbsp;&nbsp;";
-		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".$numPages."&mailbox=".$mailbox."'><img src='modules/Webmails/images/end.gif' border='0'></a>";
+			$navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".($start+1).");\" ><img src='modules/Webmails/images/next.gif' border='0'></a>&nbsp;&nbsp;";
+        	        $navigationOutput .= "<a href='javascript:;' onClick=\"cal_navigation('".$mailbox."',".$numPages.");\"><img src='modules/Webmails/images/end.gif' border='0'></a> &nbsp;";
+//		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".($start+1)."&mailbox=".$mailbox."'><img src='modules/Webmails/images/next.gif' border='0'></a>&nbsp;&nbsp;";
+//		$navigationOutput .= "<a href='index.php?module=Webmails&action=index&start=".$numPages."&mailbox=".$mailbox."'><img src='modules/Webmails/images/end.gif' border='0'></a>";
 		}
 	}
 }
@@ -109,7 +113,9 @@
 $listview_entries = array();
 
 $displayed_msgs=0;
-$new_msgs=0;
+$info = imap_mailboxmsginfo($MailBox->mbox);
+$unread_msgs = $info->Unread;
+//$new_msgs=0;
 if(($numEmails) <= 0)
 	$listview_entries[0][] = '<td colspan="6" width="100%" align="center"><b>'.$mod_strings['LBL_NO_EMAILS'].'</b></td>';
 else {
@@ -193,6 +199,8 @@
 		/*	if($tmpval != "INBOX")
 				$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
 		 */
+			if(!isset($_SESSION["image_path"]))
+				$_SESSION["image_path"] = $image_path;
 			$_SESSION["mailboxes"][$tmpval] = $new_msgs;
 
 			if($numEmails==0) {$num=$numEmails;} else {$num=($numEmails-1);}
@@ -213,16 +221,14 @@
 	}
         $boxes .= '</select>';
 }
-$check = imap_mailboxmsginfo($MailBox->mbox);
-$unread_count = $check->Unread; 
 imap_close($MailBox->mbox);
 
 $smarty = new vtigerCRM_Smarty;
 //$smarty->assign("USERID", $current_user->id);
-//$smarty->assign("MOD", $mod_strings);
+$smarty->assign("MOD", $mod_strings);
 //$smarty->assign("APP", $app_strings);
 //$smarty->assign("IMAGE_PATH",$image_path);
-$smarty->assign("UNREAD_COUNT",$unread_count);
+$smarty->assign("UNREAD_COUNT",$unread_msgs);
 $smarty->assign("LISTENTITY", $listview_entries);
 $smarty->assign("LISTHEADER", $listview_header);
 //$smarty->assign("SEARCH_HTML", $search_html);
@@ -231,11 +237,11 @@
 //$smarty->assign("BUTTONS",$other_text);
 //$smarty->assign("CATEGORY","My Home Page");
 $smarty->assign("NAVIGATION", $navigationOutput);
-//$smarty->assign("FOLDER_SELECT", $boxes);
+$smarty->assign("FOLDER_SELECT", $boxes);
 $smarty->assign("NUM_EMAILS", $numEmails);
 $smarty->assign("MAILBOX", $MailBox->mailbox);
-//$smarty->assign("ACCOUNT", $MailBox->display_name);
-//$smarty->assign("BOXLIST",$folders);
+$smarty->assign("ACCOUNT", $MailBox->display_name);
+$smarty->assign("BOXLIST",$folders);
 //$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 Wed Apr 18 10:18:37 2007
@@ -373,9 +373,10 @@
 	var nid = '';
 	$("status").style.display = "block";
 	var chkname=document.getElementsByName("selected_id");
-	var mvmbox = $("mailbox_select").value;
+	mvmbox = $("mailbox_select").value;
 	var nid = Array();
 	var i=0;
+	move_mail = 1;
 	for(var m=0;m<chkname.length;m++)
 	{
 		if(chkname[m].checked)
@@ -388,8 +389,17 @@
 				'index.php',
 				{queue: {position: 'end', scope: 'command'},
 					method: 'post',
-					postBody: 'module=Webmails&action=WebmailsAjax&mailbox='+gCurrentFolder+'&start='+start+'&command=move_msg&ajax=true&mailid='+nid.join(":")+'&mvbox='+mvmbox,
+					postBody: 'module=Webmails&action=WebmailsAjax&mailbox='+mailbox+'&start='+start+'&command=move_msg&ajax=true&mailid='+nid.join(":")+'&mvbox='+mvmbox,
 					onComplete: function(t) {
+						sh = $("show_msg");
+						var leftSide = findPosX(sh);
+					        var topSide = findPosY(sh);
+					        sh.style.left= leftSide + 400+'px';
+					        sh.style.top= topSide + 350 +'px';
+						sh.innerHTML = "Moving mail(s) from "+mailbox+" folder to "+mvmbox+" folder";
+                                                sh.style.display = "block";
+						sh.classname = "delete_email";
+                                                new Effect.Fade(sh,{queue: {position: 'end', scope: 'effect'},duration: '50'});
 						for(i=0;i<nid.length;i++)
 						{
 							var oRow = $('row_'+nid[i]);
@@ -444,21 +454,28 @@
 function runEmailCommand(com,id) {
         command=com;
         id=id;
-	if(com=="reload")
-		var file="ListViewAjax";
-	else
-		var file="";
 	if(com == 'delete_msg')
 	{
 		if(!confirm(alert_arr.DELETE+" "+alert_arr.MAIL+" ?"))
 			return;
 	}
+	if(com=="reload")
+                var file="ListViewAjax";
+        else
+                var file="";
+	
+	if(move_mail == 1){
+		var qry_str = "&mvbox="+mvmbox;
+		move_mail = 0;
+	}
+	else
+		qry_str = "";
         $("status").style.display="block";
         new Ajax.Request(
                 'index.php',
                 {queue: {position: 'end', scope: 'command'},
                         method: 'post',
-                        postBody: 'module=Webmails&action=WebmailsAjax&start='+start+'&command='+command+'&mailid='+id+'&file='+file+'&mailbox='+mailbox,
+                        postBody: 'module=Webmails&action=WebmailsAjax&start='+start+'&command='+command+'&mailid='+id+'&file='+file+'&mailbox='+mailbox+qry_str,
                         onComplete: function(t) {
                                 resp = t.responseText;
 				id=resp;
@@ -467,6 +484,7 @@
 				    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;
 					}
@@ -474,6 +492,13 @@
 						$(mailbox+"_count").innerHTML = "";
 					}
 					$("nav").innerHTML = $("navTemp").innerHTML;
+					if(change_box != 1){
+						$("box_list").innerHTML = $("temp_boxlist").innerHTML;
+						change_box = 0;
+					}
+					$("move_pane").innerHTML = $("temp_movepane").innerHTML;
+					$("temp_boxlist").innerHTML = "";
+					$("temp_movepane").innerHTML = "";
 					$("navTemp").innerHTML = '';
 					$(mailbox+"_tempcount").innerHTML = "";
 					break;
@@ -590,6 +615,11 @@
                 }
         );
 }
+function cal_navigation(box,page){
+	start = page;
+	mailbox = box;
+	runEmailCommand("reload",0);
+}
 function remove(s, t) {
   /*
   **  Remove all occurrences of a token in a string
@@ -604,7 +634,10 @@
   return r;
 }
 function changeMbox(box) {
-        location.href = "index.php?module=Webmails&action=index&mailbox="+box;
+	mailbox=box;
+	start = 0;
+	runEmailCommand("reload",0);
+        //location.href = "index.php?module=Webmails&action=index&mailbox="+box;
 }
 // TODO: these two functions should be tied into a mailbox management panel of some kind.
 // could be a DHTML div with AJAX calls to execute the commands on the mailbox.  

Modified: vtigercrm/branches/5.0.3/modules/Webmails/WebmailsAjax.php
==============================================================================
--- vtigercrm/branches/5.0.3/modules/Webmails/WebmailsAjax.php (original)
+++ vtigercrm/branches/5.0.3/modules/Webmails/WebmailsAjax.php Wed Apr 18 10:18:37 2007
@@ -30,7 +30,7 @@
 	exit();
 }
 if(isset($_REQUEST['file']) && $_REQUEST['file']!='' && !isset($_REQUEST['ajax'])){
-	include("modules/".$_REQUEST['module']."/".$_REQUEST['file'].".php");
+	require_once("modules/".$_REQUEST['module']."/".$_REQUEST['file'].".php");
 	exit();
 }
 $mailid = $_REQUEST["mailid"];





More information about the vtigercrm-commits mailing list