pari: trunk r400 - /trunk/config/scripts/astman.js
asterisk-gui-commits at lists.digium.com
asterisk-gui-commits at lists.digium.com
Mon Mar 5 17:50:00 MST 2007
Author: pari
Date: Mon Mar 5 18:50:00 2007
New Revision: 400
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=400
Log:
Critical fix in core astman - fieldbyname, catbyname are declared as Arrays and used as Objects through out the script. Declaring them Objects instead.
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=400&r1=399&r2=400
==============================================================================
--- trunk/config/scripts/astman.js (original)
+++ trunk/config/scripts/astman.js Mon Mar 5 18:50:00 2007
@@ -738,7 +738,7 @@
for (;y<box.stored_config.catcnt;y++) {
box.stored_config.categories[y] = null;
}
- box.stored_config.catbyname[value] = null;
+ delete box.stored_config.catbyname[value];
--box.stored_config.catcnt;
if (updatebox && box.options[box.selectedIndex].value == "") {
if (box.widgets['status'])
@@ -809,7 +809,7 @@
}
if (!category) {
category = new Object;
- category.fieldbyname = new Array;
+ category.fieldbyname = { };
category.fields = new Array;
}
@@ -1024,10 +1024,19 @@
tmp = box.callbacks.format(box.stored_config.catbyname[tmp[0]], tmp[1]);
if (tmp) {
box.options[box.selectedIndex].innerHTML = tmp;
+ var tmp_newopt = document.createElement('option');
+ tmp_newopt.text = box.options[box.selectedIndex].innerHTML ;
+ tmp_newopt.value = box.options[box.selectedIndex].value;
+
for (var y = 0; y < box.options.length + 1; y++) {
if (!box.options[y] ||
do_compare(box, box.options[box.selectedIndex], box.options[y])) {
+ try{
box.options.add(box.options[box.selectedIndex], y);
+ }catch(e){
+ box.remove(box.selectedIndex);
+ box.add(tmp_newopt, y);
+ }
break;
}
}
@@ -1717,7 +1726,7 @@
box.innerHTML = '';
cfg.categories = new Array;
- cfg.catbyname = new Array;
+ cfg.catbyname = { };
cfg.names = new Array;
for (x=0;t[0].names[x];x++) {
map = t[0].names[x].split('-');
@@ -1727,7 +1736,7 @@
cfg.categories[catcnt] = new Object;
cfg.categories[catcnt].fields = new Array;
- cfg.categories[catcnt].fieldbyname = new Array;
+ cfg.categories[catcnt].fieldbyname = { };
cfg.categories[catcnt].names = new Array;
cfg.categories[catcnt].subfields = new Array;
cfg.categories[catcnt].name = t[0].headers[t[0].names[x]];
More information about the asterisk-gui-commits
mailing list