[Vtigercrm-commits] [vtiger-commits] r7917 - in /branches/VTIGERCRM-5.0.2-MMBRICH: include/js/objects/CommSystem.js modules/CommSystem/CommSystem.php themes/blue/style.css
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sun Jul 9 19:10:05 EDT 2006
Author: mmbrich
Date: Sun Jul 9 17:10:04 2006
New Revision: 7917
Log:
retrieve last 5 minutes worth of messages for page reloads (still need to terminate session)
Modified:
branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js
branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystem.php
branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/style.css
Modified: branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js Sun Jul 9 17:10:04 2006
@@ -25,6 +25,7 @@
this.Focused='true';
this.ChattingWith=chatWith;
this.SendValue=sendValue;
+ this.reloadMsg="This is reloaded content:";
},
/*
@@ -39,13 +40,7 @@
globalCommSystem.timer = window.setTimeout('globalCommSystem.CommUpdate()',globalCommSystem.refreshtime);
} else {
window.clearTimeout(globalCommSystem.timer);
- if(globalCommSystem.tmpCount == 0 || typeof(globalCommSystem.tmpCount) == "undefined") {
- var first = 'true';
- globalCommSystem.tmpCount++;
- } else {
- var first = 'false';
- globalCommSystem.tmpCount++;
- }
+ var first = globalCommSystem.IsPageReload();
new Ajax.Request(
'index.php',
{queue: {position: 'end', scope: 'commsys'},
@@ -59,6 +54,19 @@
}
);
}
+ },
+
+ IsPageReload: function() {
+ if(typeof(globalCommSystem.tmpCount) == "undefined") {
+ globalCommSystem.tmpCount++;
+ var answer = 'true';
+ } else if(globalCommSystem.tmpCount < 1) {
+ globalCommSystem.tmpCount++;
+ var answer = 'true';
+ } else
+ var answer = 'false';
+
+ return answer;
},
/*
@@ -209,9 +217,9 @@
new Effect.Appear("msgwindow_"+msg.sending_user,{duration:'0.2'});
if(msg.user_name == "" || typeof(msg.user_name) == "undefined" || msg.user_name == globalCommSystem.user.user_name) {
msg.msg_data = "<BR><font color='blue'>"+globalCommSystem.user.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
- } else if(msg.user_name != globalCommSystem.user.user_name)
- msg.msg_data = "<BR><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
- else
+ } else if(msg.user_name != globalCommSystem.user.user_name && msg.msg_data != "") {
+ msg.msg_data = "<br><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
+ } else if(msg.msg_data != "")
msg.msg_data = "<br>"+msg.msg_data;
$("chat_data_"+msg.sending_user).innerHTML += msg.msg_data;
@@ -253,7 +261,7 @@
[ Builder.node(
'img',
{src:'themes/blue/images/close.gif',
- onClick: 'new Effect.Fade(\'msgwindow_'+msg.sending_user+'\',{duration:\'0.2\'})'
+ onClick: 'new Effect.Fade(\'msgwindow_'+msg.sending_user+'\',{duration:\'0.2\'})}'
}
)]
)]
@@ -264,12 +272,13 @@
Try.these (
function() {
if(msg.user_name != globalCommSystem.user.user_name) {return false;}
- msg.msg_data = "<BR><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
+ msg.msg_data = "<BR><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
},
function() {
msg.msg_data += "<BR>";
}
);
+
var chat_data = Builder.node(
'tr',
{
@@ -309,15 +318,12 @@
main_table.style.display = "none";
$("comm_sys").appendChild(main_table);
- Try.these (
- function() {
- if(msg.msg_data != "")
- $("chat_data_"+msg.sending_user).innerHTML = "<br><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
- },
- function() {
- $("chat_data_"+msg.sending_user).innerHTML += "<br>"+msg.msg_data;
- }
- );
+ if(globalCommSystem.IsPageReload() != 'true' && msg.sending_user != globalCommSystem.user.user_name && msg.msg_data != "") {
+ $("chat_data_"+msg.sending_user).innerHTML = "<font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
+ } else if(msg.msg_data != "") {
+ $("chat_data_"+msg.sending_user).innerHTML = "<font color='red'>"+globalCommSystem.reloadMsg+"<BR>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
+ }
+
try {
$("msg_wrapper_"+msg.sending_user).innerHTML += '<input type="submit" class="button" value="'+globalCommSystem.SendValue+'" id="send_button_'+msg.sending_user+'" name="'+msg.sending_user+'">';
Event.observe($("msg_input_"+msg.sending_user), 'keypress', globalCommSystem.UserTyping.bindAsEventListener(this));
Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystem.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystem.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystem.php Sun Jul 9 17:10:04 2006
@@ -117,16 +117,31 @@
* array=($num=>'msgid',$num=>'msg_type',$num=>'msg_data',$num=>'recordid',$num=>'sending_user',$num=>'user_name',$num=>'sentdate');
*/
function GetNewAlerts($userid,$get_old='') {
+ if($get_old == 'true') {
+ $ymd=date('Y-m-d');
+ $h=date('H');
+ $m=date('i');
+ $s=date('s');
+
+ // get the last 5 minutes worth of messages
+ if($m <= 04)
+ $m=(($m-05)+60);
+ else
+ $m=($m-05);
+
+ $pastdate = $ymd." ".$h.":".$m.":".$s;
+ }
+
// This query will get all non-group/non-broadcast messages
if($get_old == 'true')
- $q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers='".$userid."' AND viewed = '0' OR viewed = '1' AND msg_type='P2PIM' ORDER BY sentdate";
+ $q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers='".$userid."' AND sentdate > '".$pastdate."' AND msg_type='P2PIM' ORDER BY sentdate";
else
$q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers='".$userid."' AND viewed = '0' AND msg_type='P2PIM' ORDER BY sentdate";
$p2p = $this->db->query($q);
// This query will get all group/broadcast messages
if($get_old == 'true')
- $q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers LIKE '%,".$userid.",%' OR receivers LIKE '".$userid.",%' OR receivers LIKE '%,".$userid."' AND viewed = '0' OR viewed = '1' AND msg_type='GRPIM' ORDER BY sentdate";
+ $q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers LIKE '%,".$userid.",%' OR receivers LIKE '".$userid.",%' OR receivers LIKE '%,".$userid."' AND sentdate > '".$pastdate."' AND msg_type='GRPIM' ORDER BY sentdate";
else
$q = "SELECT vtiger_comm_system.*,vtiger_users.user_name FROM vtiger_comm_system INNER JOIN vtiger_users ON vtiger_users.id=vtiger_comm_system.sending_user WHERE receivers LIKE '%,".$userid.",%' OR receivers LIKE '".$userid.",%' OR receivers LIKE '%,".$userid."' AND viewed = '0' AND msg_type='GRPIM' ORDER BY sentdate";
$grp = $this->db->query($q);
Modified: branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/style.css
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/style.css (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/style.css Sun Jul 9 17:10:04 2006
@@ -2925,6 +2925,7 @@
border: 1px solid gray;
background-color: white;
z-index:1900000;
+ display: block;
}
.alertDisplay {
position: absolute;
@@ -2938,3 +2939,6 @@
z-index:2000000;
display: none;
}
+.button {
+ border: 1px solid gray;
+}
More information about the vtigercrm-commits
mailing list