pari: branch 2.0 r3957 - in /branches/2.0/config: cdr.html js/astman.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Wed Oct 8 06:56:10 CDT 2008


Author: pari
Date: Wed Oct  8 06:56:10 2008
New Revision: 3957

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

Removing duplicate functions,
already have string prototypes - isAstTrue() & trim()


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

Modified: branches/2.0/config/cdr.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/cdr.html?view=diff&rev=3957&r1=3956&r2=3957
==============================================================================
--- branches/2.0/config/cdr.html (original)
+++ branches/2.0/config/cdr.html Wed Oct  8 06:56:10 2008
@@ -172,10 +172,9 @@
 		
 		var jc = context2json({filename: "cdr.conf", context: "general", usf:1 });
 		
-		if (!ASTGUI.is_true(jc['enable'])) {
+		if( jc.hasOwnProperty('enable') && !jc['enable'].isAstTrue() ) {
 			alert("You do not have CDR enabled. Set enabled = yes in cdr.conf");
 		}
-
 		
 		var c = context2json({ filename:'http.conf', context: 'general', usf:1 });
 
@@ -183,9 +182,9 @@
 			prefix = "/" + c['prefix'] + "/";
 		}
 
-		if (!ASTGUI.is_true(c['enablestatic'].trim())) {
+		if( c.hasOwnProperty('enablestatic') && !c['enablestatic'].isAstTrue() ) {
 			alert("You do not have static file support in http.conf. Set 'enablestatic' = yes in http.conf");
-		} 
+		}
 
 		parent.ASTGUI.dialog.waitWhile(' Grabbing your Records... ');
 

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=3957&r1=3956&r2=3957
==============================================================================
--- branches/2.0/config/js/astman.js (original)
+++ branches/2.0/config/js/astman.js Wed Oct  8 06:56:10 2008
@@ -224,7 +224,7 @@
 	};
 
 	String.prototype.isAstTrue = function () {
-		return ( this == 'yes' || this == 'true' || this == 'y' || this == 't' || this == '1' || this == 'on' ) ? true : false;
+		return ["yes", "true", "y", "t", "1", "on"].contains(this.toLowerCase().trim());
 	};
 
 	String.prototype.getNoOp = function(){
@@ -444,17 +444,6 @@
 	cliCommand : function(cmd) { // ASTGUI.cliCommand(cmd);
 		ASTGUI.debugLog("Executing manager command : '" + cmd + "'" , 'manager');
 		return makeSyncRequest ( { action :'command', command: cmd } );
-	},
-
-	is_true: function(str) {
-		if (typeof(str) != 'string' || str.length < 1 ) {
-			return false;
-		}
-        	return ["yes", "true", "y", "t", "1", "on"].contains(str.toLowerCase().trim());
-	},
-
-	trim: function(str) {
-	        return str.replace(/^[\s]+/, "").replace(/[\s]+$/, "");
 	},
 
 	getUser_DeviceStatus : function( usr ){ // ASTGUI.getUser_DeviceStatus(usr) 




More information about the asterisk-gui-commits mailing list