[Vtigercrm-commits] [vtiger-commits] r7918 - in /branches/VTIGERCRM-5.0.2-MMBRICH: include/js/objects/CommSystem.js modules/CommSystem/CommSystemAjax.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sun Jul 9 19:19:44 EDT 2006


Author: mmbrich
Date: Sun Jul  9 17:19:43 2006
New Revision: 7918

Log:
delete messages from database when window is closed.  This keeps the system from pulling the records when they shouldn't be and also keeps the DB from getting too large.

Modified:
    branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js
    branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystemAjax.php

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:19:43 2006
@@ -261,7 +261,7 @@
 							[ Builder.node(
 								'img',
 								{src:'themes/blue/images/close.gif',
-								onClick: 'new Effect.Fade(\'msgwindow_'+msg.sending_user+'\',{duration:\'0.2\'})}'
+								onClick: 'globalCommSystem.CloseSession(\''+msg.sending_user+'\')'
 								}
 							)]
 						)]
@@ -373,6 +373,17 @@
 		);
 	},
 
+	CloseSession: function(sending_user) {
+		new Effect.Fade($("msgwindow_"+sending_user),{duration:'0.2'});
+	        new Ajax.Request(
+                	'index.php',
+                	{queue: {position: 'end', scope: 'commsys'},
+                        	method: 'post',
+                        	postBody: 'module=CommSystem&action=CommSystemAjax&command=closeSession&sending_user='+sending_user
+			}
+        	);
+	},
+
 	/*
 	 * Call this any time you suspect the chat window
 	 * content has changed.  Can either be called with

Modified: branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystemAjax.php
==============================================================================
--- branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystemAjax.php (original)
+++ branches/VTIGERCRM-5.0.2-MMBRICH/modules/CommSystem/CommSystemAjax.php Sun Jul  9 17:19:43 2006
@@ -117,11 +117,14 @@
 	$ret = send_typing_message($_REQUEST["receivers"]);
 	echo $ret;
 }
-
 if($_REQUEST["command"] == "markAsRead") {
 	$q="Update vtiger_comm_system set viewed='2' where msgid='".$_REQUEST["msgid"]."'";
 	$adb->query($q);
 	echo "success";
+}
+if($_REQUEST["command"] == "closeSession") {
+	$q="DELETE FROM vtiger_comm_system WHERE receivers='".$_SESSION["authenticated_user_id"]."' AND sending_user='".$_REQUEST["sending_user"]."' AND msg_type='P2PIM' OR msg_type='STATUS'";
+	$adb->query($q);
 }
 function send_typing_message($receivers) {
 	require_once("modules/CommSystem/CommSystem.php");





More information about the vtigercrm-commits mailing list