pari: branch 2.0 r3668 - /branches/2.0/config/js/astman.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Aug 14 18:27:27 CDT 2008


Author: pari
Date: Thu Aug 14 18:27:27 2008
New Revision: 3668

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=3668
Log:

 minor additions to astman.js
   + debug log can now print Arrays & Objects
   + Array.prototype.containsLike()



Modified:
    branches/2.0/config/js/astman.js

Modified: branches/2.0/config/js/astman.js
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/js/astman.js?view=diff&rev=3668&r1=3667&r2=3668
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Thu Aug 14 18:27:27 2008
@@ -46,6 +46,10 @@
 			if( this[i] === str )return true;
 		}
 		return false;
+	};
+
+	Array.prototype.containsLike = function(str) {
+		return this.indexOfLike(str) != -1;
 	};
 	
 	Array.prototype.each = function(iterator) {
@@ -542,6 +546,15 @@
 
 	debugLog: function(msg, color){ // Ex:		ASTGUI.debugLog('Some debug message', 'get');
 		if(!top.sessionData.DEBUG_MODE ){ return true; }
+
+		if( typeof msg == 'object' ){
+			if( ASTGUI.isArray(msg) ){
+				msg = 'ARRAY : [' + msg.join(',') + ']' ;
+			}else{
+				msg = 'OBJECT : {' + ASTGUI.getObjectPropertiesAsString(msg) + '}' ;
+			}
+		}
+
 		if(!color){ color = '#324176'; }
 		switch(color){
 			case 'get':	// for getconfig and reading html files




More information about the asterisk-gui-commits mailing list