pari: trunk r995 - /trunk/config/scripts/astman.js

asterisk-gui-commits at lists.digium.com asterisk-gui-commits at lists.digium.com
Tue May 29 15:23:16 MST 2007


Author: pari
Date: Tue May 29 17:23:15 2007
New Revision: 995

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=995
Log:
updating astman.js with the select box functions - still needs some more fixing

Modified:
    trunk/config/scripts/astman.js

Modified: trunk/config/scripts/astman.js
URL: http://svn.digium.com/view/asterisk-gui/trunk/config/scripts/astman.js?view=diff&rev=995&r1=994&r2=995
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Tue May 29 17:23:15 2007
@@ -449,16 +449,10 @@
 		for ( var g=0; g < box.options.length  ; g++) {
 			if(	opt_new.text < box.options[g].text  ){ // add before this element in box
 				add = 1;
-				try{
-					box.add(opt_new, box.options[g] );
-					break;
-				}catch(err){
-					box.add(opt_new, g);
-					break;
-				}
-			}
-		}
-		if ( add ==0 ){ try{ box.add(opt_new, null); } catch(err){ box.add(opt_new); }}
+				ASTGUI.selectbox_insertOption_before(box,opt_new, g);
+			}
+		}
+		if ( add ==0 ){ ASTGUI.selectbox_push_option(box,opt_new);}
 	}
 }
 
@@ -761,10 +755,7 @@
 		category.fields = new Array;
 	}
 
-	var newoption = box.ownerDocument.createElement("option");
-	newoption.text = "New Entry";
-	newoption.value = "";
-	box.options.add(newoption);
+	ASTGUI.selectbox_push(box,"New Entry", "");
 	box.selectedIndex = box.options.length - 1;
 	box.oldselect = box.options.length - 1;
 	box.stored_config.catbyname[""] = category;
@@ -814,10 +805,9 @@
 	if (!subcat || !subcat.length || !subname || !subname.length)
 		return;
 
-	box.options.add(newoption);
+	ASTGUI.selectbox_push_option(box,newoption);
 	box.selectedIndex = box.options.length - 1;
 	box.oldselect = box.options.length - 1;
-
 	category = box.stored_config.catbyname[subcat];
 	pos = category.names.length;
 	category.subfields[pos] = subitem;
@@ -1868,17 +1858,12 @@
 		for ( var g=0; g < u.options.length  ; g++) {
 			if(	opt_new.text < u.options[g].text  ){ // add before this element in u 
 				add = 1;
-				try{
-					u.add(opt_new, u.options[g]);
-					break;
-				}catch(err){
-					u.add(opt_new, g);
-					break;
-				}
-			}
-		}
-		if ( add ==0 ){ try{ u.add(opt_new, null); } catch(err){ u.add(opt_new); }}
-	}
-}
-
-
+				ASTGUI.selectbox_insertOption_before(u,opt_new,g);
+				break;
+			}
+		}
+		if ( add ==0 ){ ASTGUI.selectbox_push_option(u,opt_new);}
+	}
+}
+
+



More information about the asterisk-gui-commits mailing list