pari: branch 2.0 r4204 - /branches/2.0/config/js/index.js

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Mon Nov 24 12:57:52 CST 2008


Author: pari
Date: Mon Nov 24 12:57:51 2008
New Revision: 4204

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

 making 'getAllExtensions()' out of 'ifExtensionAlreadyExists()'



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

Modified: branches/2.0/config/js/index.js
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/js/index.js?view=diff&rev=4204&r1=4203&r2=4204
==============================================================================
--- branches/2.0/config/js/index.js (original)
+++ branches/2.0/config/js/index.js Mon Nov 24 12:57:51 2008
@@ -878,44 +878,53 @@
 		return tmp;
 	},
 
+	getAllExtensions : function(){ // miscFunctions.getAllExtensions() - returns Array of all Extensions
+		var tmp = [] ;
+		try{
+			tmp = tmp.concat( astgui_manageusers.listOfUsers() );
+			if( sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain') ){
+				tmp.push( ASTGUI.parseContextLine.getExten( sessionData.pbxinfo['localextensions']['VoiceMailMain'] ) ) ;
+			}
+			var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
+				y.each( function( item ){
+					var tmp_thisVMenu = ASTGUI.cloneObject(sessionData.pbxinfo.voicemenus[item]);
+					if( tmp_thisVMenu.getProperty('alias_exten') ){
+						tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisVMenu.alias_exten) );
+					}
+				} );
+			var y = sessionData.pbxinfo.conferences.getOwnProperties();
+				y.each( function( item ){
+					var tmp_thisMeetMe = ASTGUI.cloneObject(sessionData.pbxinfo.conferences[item]);
+					if( tmp_thisMeetMe.getProperty('configOptions') ){
+						tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisMeetMe.configOptions) );
+					}
+					if( tmp_thisMeetMe.getProperty('adminOptions') ){
+						tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisMeetMe.adminOptions) );
+					}
+				} );
+			var y = sessionData.pbxinfo.ringgroups.getOwnProperties();
+				y.each( function( item ){
+					var tmp_thisRg = ASTGUI.cloneObject(sessionData.pbxinfo.ringgroups[item]);
+					if( tmp_thisRg.getProperty('extension') ){
+						tmp.push( tmp_thisRg.extension );
+					}
+				} );
+			tmp = tmp.concat( astgui_managePageGroups.getPGsList() );
+			var tmp_LE = ASTGUI.cloneObject(sessionData.pbxinfo['localextensions']);
+			if( tmp_LE.getProperty('defaultDirectory') ){
+				tmp.push( tmp_LE.getProperty('defaultDirectory') );
+			}
+			tmp = tmp.concat( sessionData.pbxinfo.vmgroups.getOwnProperties() );
+			tmp = tmp.concat( sessionData.pbxinfo.queues.getOwnProperties() );
+		}catch(err){ 
+
+		}finally{
+			return tmp;
+		}
+	},
+
 	ifExtensionAlreadyExists: function(a){ // miscFunctions.ifExtensionAlreadyExists() - returns true if an extension already exists, false Other wise
-		var tmp = [] ;
-		tmp = tmp.concat( astgui_manageusers.listOfUsers() );
-		if( sessionData.pbxinfo['localextensions'].hasOwnProperty('VoiceMailMain') ){
-			tmp.push( ASTGUI.parseContextLine.getExten( sessionData.pbxinfo['localextensions']['VoiceMailMain'] ) ) ;
-		}
-		var y = sessionData.pbxinfo.voicemenus.getOwnProperties();
-			y.each( function( item ){
-				var tmp_thisVMenu = ASTGUI.cloneObject(sessionData.pbxinfo.voicemenus[item]);
-				if( tmp_thisVMenu.getProperty('alias_exten') ){
-					tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisVMenu.alias_exten) );
-				}
-			} );
-		var y = sessionData.pbxinfo.conferences.getOwnProperties();
-			y.each( function( item ){
-				var tmp_thisMeetMe = ASTGUI.cloneObject(sessionData.pbxinfo.conferences[item]);
-				if( tmp_thisMeetMe.getProperty('configOptions') ){
-					tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisMeetMe.configOptions) );
-				}
-				if( tmp_thisMeetMe.getProperty('adminOptions') ){
-					tmp.push( ASTGUI.parseContextLine.getExten(tmp_thisMeetMe.adminOptions) );
-				}
-			} );
-		var y = sessionData.pbxinfo.ringgroups.getOwnProperties();
-			y.each( function( item ){
-				var tmp_thisRg = ASTGUI.cloneObject(sessionData.pbxinfo.ringgroups[item]);
-				if( tmp_thisRg.getProperty('extension') ){
-					tmp.push( tmp_thisRg.extension );
-				}
-			} );
-		tmp = tmp.concat( astgui_managePageGroups.getPGsList() );
-		var tmp_LE = ASTGUI.cloneObject(sessionData.pbxinfo['localextensions']);
-		if( tmp_LE.getProperty('defaultDirectory') ){
-			tmp.push( tmp_LE.getProperty('defaultDirectory') );
-		}
-		tmp = tmp.concat( sessionData.pbxinfo.vmgroups.getOwnProperties() );
-		tmp = tmp.concat( sessionData.pbxinfo.queues.getOwnProperties() );
-		return tmp.contains(a) ;
+		return this.getAllExtensions().contains(a);
 	}
 };
 




More information about the asterisk-gui-commits mailing list