pari: trunk r318 - /trunk/config/users.html

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Thu Feb 1 19:38:27 MST 2007


Author: pari
Date: Thu Feb  1 20:38:26 2007
New Revision: 318

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=318
Log:
Fix: New user extension number

Modified:
    trunk/config/users.html

Modified: trunk/config/users.html
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/users.html?view=diff&rev=318&r1=317&r2=318
==============================================================================
--- trunk/config/users.html (original)
+++ trunk/config/users.html Thu Feb  1 20:38:26 2007
@@ -99,14 +99,23 @@
 	callbacks.newcategory = function() {
 		var tmp = null;
 		var x;
-		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);
-			}
-		}
+		gen = $('devices').stored_config.catbyname['general'];
+		tmp = objcopy(gen);
+		if (gen){
+			x = gen.fieldbyname['userbase'];
+			for( var f=0; f < $('devices').options.length ; f++ ){
+					if( x < $('devices').options[f].innerHTML.split(' -- ')[0] )
+						break;
+					x++;
+			}
+		}else{
+				try{ 
+					x = ( parseInt($('devices').options[$('devices').options.length - 1 ].innerHTML.split(' -- ')[0] ) ) + 1; 
+				}catch(err){
+					x = 6000; // a default value if one is not defined in users.conf's general context
+				}
+		}
+		tmp.name = x
 		return tmp;
 	}
 	callbacks.identifier = "extension";



More information about the asterisk-gui-commits mailing list