[Vtigercrm-commits] [vtiger-commits] r7904 - /branches/VTIGERCRM-5.0.2-MMBRICH/include/js/objects/CommSystem.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Sat Jul 8 15:27:42 EDT 2006


Author: mmbrich
Date: Sat Jul  8 13:27:41 2006
New Revision: 7904

Log:
function comments to help developers or feature creators find their way around this class.


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

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 Sat Jul  8 13:27:41 2006
@@ -18,9 +18,9 @@
     	},
 
 	/* 
-	 * Timer function to fire @ refreshtime
-	 * updates the element used during creation time
-	 *
+	 * Update function to fire @ refreshtime
+	 * Calls the HandleEvent function which
+	 * will react on the JSON data passed to it.
 	 */
     	CommUpdate: function() {
 		globalCommSystem = this;
@@ -101,6 +101,9 @@
 		this.CommUpdate();
 	},
 
+	/*
+	 * Called when this window is focused or un-focused
+	 */
 	OnFocusEvent: function(evt) {
 		if(evt.type == "focus")
 			this.Focused='true';
@@ -108,6 +111,9 @@
 			this.Focused='false';
 	},
 
+	/*
+	 * Send a "User is typing" or "Done typing" message
+	 */
 	SendStatusMessage: function(period,users) {
 	        new Ajax.Request(
                 	'index.php',
@@ -154,6 +160,10 @@
         	);
 	},
 
+	/*
+	 * Called prior to SendChatMessage so that proper variables
+	 * can be populated
+	 */
 	SendMsg: function(evt) {
 		try {
 			var dat = $("msg_input_"+Event.element(evt).name);
@@ -181,6 +191,7 @@
 	 */
 	ShowNewChatMessage: function(msg,header_msg) {
 		Try.these (
+			/* Try to open a window from past messaging with this user */
 			function() {
 				new Effect.Appear("msgwindow_"+msg.sending_user,{duration:'0.2'});
 				if(msg.user_name == "")
@@ -193,6 +204,7 @@
 				$("chat_data_"+msg.sending_user).innerHTML += msg.msg_data;
 				globalCommSystem.ScrollChatWindow($("chat_data_"+msg.sending_user));
 			},
+			/* Build a new chat window */
 			function() {
 				if(msg.msg_type == "P2PIM")
 					var clsname = "chatWindow";
@@ -248,7 +260,7 @@
 				var chat_data = Builder.node(
 					'tr',
 					{
-						valign:'top',align:'center'
+						valign:'top',align:'center',id:'chatd_row_'+msg.sending_user
 					},
 					[ Builder.node(
 						'td',
@@ -264,7 +276,7 @@
 
 				var msg_input = Builder.node(
 					'tr',
-					{valign:'top',align:'center'},
+					{valign:'top',align:'center',id:'bchat_row_'+msg.sending_user},
 					[ Builder.node(
 						'td',
 						[ Builder.node(
@@ -305,6 +317,10 @@
 		);
 	},
 
+	/*
+	 * call this function with any old message 
+	 * to have it appear in the alert slider
+	 */
 	ShowAlertSlider: function(msg) {
 		$("alert_display").innerHTML = "<b><a href='index.php?module=Webmails&action=index'>"+msg+"</a></b>";
 		$("alert_display").style.display = "block";
@@ -325,6 +341,9 @@
 		},4500);
 	},
 
+	/*
+	 * Hide the alert slider
+	 */
 	HideAlertSlider: function() {
 		new Effect.Squish($("alert_display"), {
 				queue: {position: 'end', scope: 'commsys'},
@@ -335,6 +354,12 @@
 		);
 	},
 
+	/*
+	 * Call this any time you suspect the chat window
+	 * content has changed.  Can either be called with
+	 * the prototype event listener or with the actual
+	 * element passed to this function
+	 */
 	ScrollChatWindow: function(evt) {
 		//$("debug_win").innerHTML += "<br>Scrolling";
 		Try.these (
@@ -348,6 +373,10 @@
 		);
 	},
 
+	/*
+	 * called from event listeners.  This will send a user typing
+	 * status message to the other user
+	 */
 	UserTyping: function(evt) {
 		window.clearTimeout(this.keytimer);
 		var tname = "status_bar_"+Event.element(evt).name;
@@ -360,12 +389,22 @@
 		}
 	},
 
+	/*
+	 * stop your last UserTyping() message
+	 */
 	UserStopTyping: function(sending_user) {
 		window.clearTimeout(globalCommSystem.keytimer);
 		globalCommSystem.keycount=0;
 		globalCommSystem.SendStatusMessage('end',sending_user);
 	},
 
+	/*
+	 * Call this function (n) seconds after your message
+	 * was first opened.  This is for session tracking.
+	 * If this function isn't called after a message is
+	 * displayed it will appear again the next time the
+	 * receiving user opens a CRM window of any kind.
+	 */
 	MarkAsRead: function(msgid) {
 	        new Ajax.Request(
                 	'index.php',
@@ -387,7 +426,6 @@
 		//$("debug_win").innerHTML += "<BR>"+responseData.responseText;
 		try {
 		if(!responseData.responseText.match(/none/)) {
-			//alert(responseData.responseText);
 			var msgs = eval('(' + responseData.responseText + ')');
                         for (var i=0;i<msgs.CommSysMessages.length;i++) {
 			try {





More information about the vtigercrm-commits mailing list