[Vtigercrm-commits] [vtiger-commits] r7900 - in /branches/VTIGERCRM-5.0.2-MMBRICH: Smarty/templates/Header.tpl include/js/objects/CommSystem.js modules/CommSystem/CommSystem.php themes/blue/header.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Fri Jul 7 15:19:33 EDT 2006


Author: mmbrich
Date: Fri Jul  7 13:19:31 2006
New Revision: 7900

Log:
First alpha version of comm system,
This system does statefull p2p chats, email alerts,
Voicemail alerts and more.  Most of the framework is
in place to start pluggin things in but the API is
subject to plenty of change yet.


Modified:
    branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/Header.tpl
    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/header.php

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/Header.tpl
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/Header.tpl (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/Smarty/templates/Header.tpl Fri Jul  7 13:19:31 2006
@@ -146,6 +146,7 @@
 <span id="CommSliderDiv" class="commSlider">
 {$USERLIST}
 </span>
+
 <span id="debug_win"></span>
 
 <div id="calculator_cont" style="position:absolute; z-index:10000" ></div>

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 Fri Jul  7 13:19:31 2006
@@ -98,11 +98,13 @@
 	 * message text.
 	 */
 	SendChatMessage: function(otheruser,msg) {
+		var myDate=new Date();
 		msgStruct = {
 			sending_user: otheruser,
 			msg_data: msg,
 			msg_type: 'P2PIM',
-			user_name: ''
+			user_name: '',
+			timestamp: myDate.getHours()+":"+myDate.getMinutes()+":"+myDate.getSeconds()
 		}
 		globalCommSystem = this;
 	        new Ajax.Request(
@@ -120,8 +122,8 @@
                 		}
 			}
         	);
-	}
-,
+	},
+
 	SendMsg: function(evt) {
 		try {
 			var dat = $("msg_input_"+Event.element(evt).name);
@@ -131,11 +133,13 @@
 	},
 
 	OpenChatSession: function(receivers,usr_name) {
+		var myDate=new Date();
 		msgStruct = {
 			sending_user: receivers,
 			msg_data: '',
 			msg_type: 'P2PIM',
-			user_name: usr_name
+			user_name: usr_name,
+			timestamp: myDate.getHours()+":"+myDate.getMinutes()+":"+myDate.getSeconds()
 		}
 		this.ShowNewChatMessage(msgStruct, "Chatting with "+usr_name);
 	},
@@ -150,9 +154,9 @@
 			function() {
 				new Effect.Appear("msgwindow_"+msg.sending_user,{duration:'0.2'});
 				if(msg.user_name == "")
-					msg.msg_data = "<BR><font color='blue'>"+globalCommSystem.user.user_name+"</font>: "+msg.msg_data;
+					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.msg_data;
+					msg.msg_data = "<BR><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
 				else
 					msg.msg_data = "<br>"+msg.msg_data;
 
@@ -205,7 +209,7 @@
 				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.msg_data;
+						msg.msg_data = "<BR><font color='red'>"+msg.user_name+"</font> ("+msg.timestamp+"): "+msg.msg_data;
 					},
 					function() {
 						msg.msg_data += "<BR>";
@@ -254,7 +258,7 @@
 				    Try.these (
 					function() {
 						if(msg.msg_data != "")
-							$("chat_data_"+msg.sending_user).innerHTML = "<br><font color='red'>"+msg.user_name+"</font>: "+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;
@@ -362,23 +366,23 @@
 				    if(msg.sending_user == globalCommSystem.user.user_id) {return;}
 				    switch(msg_type) {
 					case 'P2PIM':
-						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',2000);
+						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',3000);
 						globalCommSystem.ShowNewChatMessage(msg,"Chatting with "+msg.user_name);
 					break;
 					case 'GRPIM':
-						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',2000);
+						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',3000);
 						alert(msgs.CommSysMessages[i].message.msg_data);
 					break;
 					case 'EMAIL':
-						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',2000);
+						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',3000);
 						globalCommSystem.ShowAlertSlider("<b>New Email:</b><br> "+msgs.CommSysMessages[i].message.recordid);
 					break;
 					case 'INPHONE':
-						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',2000);
+						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',3000);
 						globalCommSystem.ShowAlertSlider("<b>Incoming Call:</b><br> "+msgs.CommSysMessages[i].message.msg_data);
 					break;
 					case 'VOICEMAIL':
-						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',2000);
+						window.setTimeout('globalCommSystem.MarkAsRead("'+msgid+'")',3000);
 						globalCommSystem.ShowAlertSlider("<b>New Voicemial:</b><br> "+msgs.CommSysMessages[i].message.msg_data);
 					break;
 				    }

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 Fri Jul  7 13:19:31 2006
@@ -33,7 +33,7 @@
 	}
 
 	function SendAlert($msg_data,$msg_type,$recordid='0',$sending_user='0',$receivers='0') {
-		//$nowdate=date();
+		$nowdate=date('Y-m-d H:i:s');
 		switch($msg_type) {
 			case 'GRPIM':
 			case 'P2PIM':
@@ -104,7 +104,7 @@
 				$ret[$c]["recordid"] = $row["recordid"];
 				$ret[$c]["sending_user"] = $row["sending_user"];
 				$ret[$c]["user_name"] = $row["user_name"];
-				$ret[$c]["sentdate"] = $row["sentdate"];
+				$ret[$c]["sentdate"] = substr($row["sentdate"],(strlen($row["sentdate"])-8),(strlen($row["sentdate"])));
 				$c++;
 			}
 		}

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/header.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/header.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/themes/blue/header.php Fri Jul  7 13:19:31 2006
@@ -103,10 +103,12 @@
 
 $q = "select user_name,id from vtiger_users";
 $rs = $adb->query($q);
-$list = "<center><b>CRM Users:</b>";
+$list = "<br><center><b><u>CRM Users:</u></b><br>";
 while($row=$adb->fetch_array($rs)) {
-	$list .= "<br><a href='javascript:;' onclick='CS.OpenChatSession(\"".$row["id"]."\",\"".$row["user_name"]."\");'>".$row["user_name"]."</a>";
+	if($row["id"] != $_SESSION["authenticated_user_id"])
+		$list .= "<br><a href='javascript:;' onclick='CS.OpenChatSession(\"".$row["id"]."\",\"".$row["user_name"]."\");'>".$row["user_name"]."</a>";
 }
+$list .= "<br><br><b><u>HelpDesk Users</u></b><br>";
 $list .= "</center>";
 
 $smarty->assign("USERLIST",$list);





More information about the vtigercrm-commits mailing list