[Vtigercrm-commits] [vtiger-commits] r6709 - in /vtigercrm/trunk/modules/Webmails: ListView.php WebmailsAjax.php webmails.js
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Mon May 29 15:50:32 EDT 2006
Author: mmbrich
Date: Mon May 29 13:50:31 2006
New Revision: 6709
Log:
fix for bug in new and old message count
Modified:
vtigercrm/trunk/modules/Webmails/ListView.php
vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
vtigercrm/trunk/modules/Webmails/webmails.js
Modified: vtigercrm/trunk/modules/Webmails/ListView.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/ListView.php (original)
+++ vtigercrm/trunk/modules/Webmails/ListView.php Mon May 29 13:50:31 2006
@@ -145,7 +145,7 @@
// draw a row for the listview entry
function show_msg($mails,$start_message) {
- global $mbox,$displayed_msgs,$show_hidden;
+ global $mbox,$displayed_msgs,$show_hidden,$new_msgs;
$num = $mails[$start_message]->msgno;
// TODO: scan the current db tables to find a
@@ -166,9 +166,10 @@
$displayed_msgs--;
} elseif ($mails[$start_message]->deleted && $show_hidden)
$flags = "<tr id='row_".$num."' class='deletedRow'><td width='2px'><input type='checkbox' name='checkbox_".$num."' class='msg_check'></td><td colspan='1'>";
- elseif (!$mails[$start_message]->seen || $mails[$start_message]->recent)
+ elseif (!$mails[$start_message]->seen || $mails[$start_message]->recent) {
$flags = "<tr class='unread_email' id='row_".$num."'><td width='2px'><input type='checkbox' name='checkbox_".$num."' class='msg_check'></td><td colspan='1'>";
- else
+ $new_msgs++;
+ } else
$flags = "<tr id='row_".$num."'><td width='2px'><input type='checkbox' name='checkbox_".$num."' class='msg_check'></td><td colspan='1'>";
// Attachment Icons
@@ -245,6 +246,7 @@
// MAIN LOOP
// Main loop to create listview entries
$displayed_msgs=0;
+$new_msgs=0;
$i=1;
while ($i<$c) {
if(is_array($searchlist)) {
@@ -261,7 +263,7 @@
}
-
+// Build folder list and move_to dropdown box
$list = imap_getmailboxes($mbox, "{".$imapServerAddress."}", "*");
sort($list);
$i=0;
@@ -276,16 +278,18 @@
else
$img = "webmail_downarrow.gif";
- $_SESSION["mailboxes"][$i] = $tmpval;
$i++;
- if ($mailbox == $tmpval) {
+ if ($_REQUEST["mailbox"] == $tmpval) {
$boxes .= '<option value="'.$tmpval.'" SELECTED>'.$tmpval;
- $box = imap_mailboxmsginfo($mbox);
- $folders .= '<li><img src="'.$image_path.'/'.$img.'" align="absmiddle" /> <a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu" onmouseover="show_remfolder(\''.$tmpval.'\');" onmouseout="show_remfolder(\''.$tmpval.'\');">'.$tmpval.'</a> <span id="'.$tmpval.'_count" style="font-weight:bold">(<span id="'.$tmpval.'_unread">'.$box->Unread.'</span> of <span id="'.$tmpval.'_read">'.$box->Nmsgs.'</span>)</span> <span id="remove_'.$tmpval.'" style="position:relative;display:none">Remove</span></li>';
+ $_SESSION["mailboxes"][$tmpval] = $new_msgs;
+
+ $folders .= '<li><img src="'.$image_path.'/'.$img.'" align="absmiddle" /> <a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu" onmouseover="show_remfolder(\''.$tmpval.'\');" onmouseout="show_remfolder(\''.$tmpval.'\');">'.$tmpval.'</a> <span id="'.$tmpval.'_count" style="font-weight:bold">(<span id="'.$tmpval.'_unread">'.$new_msgs.'</span> of <span id="'.$tmpval.'_read">'.$numEmails.'</span>)</span> <span id="remove_'.$tmpval.'" style="position:relative;display:none">Remove</span></li>';
} else {
- $tmpbox = getImapMbox($tmpval,$temprow);
+ $tmpbox = getImapMbox($tmpval,$temprow,"true");
$box = imap_mailboxmsginfo($tmpbox);
+ $_SESSION["mailboxes"][$tmpval] = $box->Unread;
+
$boxes .= '<option value="'.$tmpval.'">'.$tmpval;
$folders .= '<li><img src="'.$image_path.'/'.$img.'" align="absmiddle" /> <a href="javascript:changeMbox(\''.$tmpval.'\');" class="webMnu">'.$tmpval.'</a> <span id="'.$tmpval.'_count" style="font-weight:bold">(<span id="'.$tmpval.'_unread">'.$box->Unread.'</span> of <span id="'.$tmpval.'_read">'.$box->Nmsgs.'</span>)</span></li>';
imap_close($tmpbox);
Modified: vtigercrm/trunk/modules/Webmails/WebmailsAjax.php
==============================================================================
--- vtigercrm/trunk/modules/Webmails/WebmailsAjax.php (original)
+++ vtigercrm/trunk/modules/Webmails/WebmailsAjax.php Mon May 29 13:50:31 2006
@@ -67,14 +67,18 @@
$boxes = array();
$i=0;
foreach ($_SESSION["mailboxes"] as $key => $val) {
- $mailbox=$val;
- $mbox = getImapMbox($mailbox,$temprow);
+ $mailbox=$key;
+ $mbox = getImapMbox($mailbox,$temprow,"true");
$search = imap_search($mbox, "NEW ALL");
if($search != false) {
$boxes[$i]["name"] = $mailbox;
- $boxes[$i]["newmsgs"] = sizeof($search);
-
+ if($val == sizeof($search))
+ $boxes[$i]["newmsgs"] = 0;
+ else {
+ $boxes[$i]["newmsgs"] = (sizeof($search)-$val);
+ $_SESSION["mailboxes"][$mailbox] = ($val+sizeof($search));
+ }
$i++;
}
imap_close($mbox);
Modified: vtigercrm/trunk/modules/Webmails/webmails.js
==============================================================================
--- vtigercrm/trunk/modules/Webmails/webmails.js (original)
+++ vtigercrm/trunk/modules/Webmails/webmails.js Mon May 29 13:50:31 2006
@@ -2,7 +2,8 @@
var node = $("row_"+mid);
if(node.className == "unread_email") {
var unread = parseInt($(mailbox+"_unread").innerHTML);
- $(mailbox+"_unread").innerHTML = (unread-1);
+ if(unread != 0)
+ $(mailbox+"_unread").innerHTML = (unread-1);
$("unread_img_"+mid).removeChild($("unread_img_"+mid).firstChild);
$("unread_img_"+mid).appendChild(Builder.node('a',
More information about the vtigercrm-commits
mailing list