pari: trunk r826 - /trunk/config/setup/7.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Mon Apr 30 10:22:34 MST 2007


Author: pari
Date: Mon Apr 30 12:22:34 2007
New Revision: 826

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=826
Log:
Autoincrement for New User Extensions is not working properly during setup wizard 

Modified:
    trunk/config/setup/7.html

Modified: trunk/config/setup/7.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/setup/7.html?view=diff&rev=826&r1=825&r2=826
==============================================================================
--- trunk/config/setup/7.html (original)
+++ trunk/config/setup/7.html Mon Apr 30 12:22:34 2007
@@ -89,16 +89,24 @@
 }
 
 callbacks.newcategory = function() {
+	var nar = [];
+	var _devices = _$('devices') ;
+	var _exten = _$('extensions') ;
+ 
+	for( var f=0; f < _devices.options.length ; f++ ){ nar.push( _devices.options[f].innerHTML.split(' -- ')[0]) ; }
+	for( f=0; f < _exten.options.length ; f++ ){ nar.push( _exten.options[f].innerHTML.split(' -- ')[0]) ; }
+	nar.sort();
+
 	var tmp = null;
-	var x;
+	var x = 6000;
 	if (_$('devices').stored_config.catbyname['general'])
 		tmp = objcopy(_$('devices').stored_config.catbyname['general']);
-	if (tmp) {
-		x = tmp.fieldbyname['userbase'];
-		if (x) {
-			tmp.name = first_free_exten(_$('devices'), x);
-		}
-	}
+	if (tmp) { x = parseInt( tmp.fieldbyname['userbase'],10); }
+	for( f=0; f < nar.length ; f++ ){
+		if( x < parseInt(nar[f]) ){ break; } x++;
+	}
+
+	tmp.name = x;
 	return tmp;
 }
 callbacks.identifier = "extension";



More information about the asterisk-gui-commits mailing list