rbrindley: branch rbrindley/astman_revamp r4624 - /team/rbrindley/astman_reva...

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Thu Mar 12 11:27:46 CDT 2009


Author: rbrindley
Date: Thu Mar 12 11:27:43 2009
New Revision: 4624

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

- changed Object.prototype.getProperties() to getProperties(obj)
- theres evidently a huge side-effect to using prototype on Object


Modified:
    team/rbrindley/astman_revamp/config/js/object.customs.js

Modified: team/rbrindley/astman_revamp/config/js/object.customs.js
URL: http://svn.digium.com/svn-view/asterisk-gui/team/rbrindley/astman_revamp/config/js/object.customs.js?view=diff&rev=4624&r1=4623&r2=4624
==============================================================================
--- team/rbrindley/astman_revamp/config/js/object.customs.js (original)
+++ team/rbrindley/astman_revamp/config/js/object.customs.js Thu Mar 12 11:27:43 2009
@@ -157,24 +157,25 @@
 /**
  * Get Properties As String.
  * Gets Object's properties and returns them as a string. Use to be ASTGUI.getObjectPropertiesAsString.
+ * Its important to note that the Object shouldn't EVER be prototype'd, it breaks Object as a hash.
  * @returns a string of the object's properties
  */
-Object.prototype.getProperties = function() {
+getProperties = function(obj) {
 	var props = [];
 
-	for (var d in this) {
-		if (!this.hasOwnProperty(d)) {
+	for (var d in obj) {
+		if (!obj.hasOwnProperty(d)) {
 			continue;
 		}
 
-		if (typeof this[d] === 'object') {
-			if (this[d] instanceof Array) {
-				props.push(d + ': [' + this[d].join(',') + ']');
+		if (typeof obj[d] === 'object') {
+			if (obj[d] instanceof Array) {
+				props.push(d + ': [' + obj[d].join(',') + ']');
 			} else {
-				props.push(d + ': ' + this[d].getProperties());
+				props.push(d + ': ' + obj[d].getProperties());
 			}
 		} else {
-			props.push(d + ': ' + this[d]);
+			props.push(d + ': ' + obj[d]);
 		}
 	}
 	return '{' + props.join(' ,') + '}';
@@ -356,6 +357,8 @@
 	if (day && (day < 0 || day > 31)) {
 		return false;
 	}
+
+	return true;
 };
 
 




More information about the asterisk-gui-commits mailing list