bkruse: branch 1.4 r1544 - in /branches/1.4: config/ config/scripts/ tools/
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Fri Sep 7 17:02:53 CDT 2007
Author: bkruse
Date: Fri Sep 7 17:02:53 2007
New Revision: 1544
URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=1544
Log:
This is getting intense.
Added some more logic and features.
Modified:
branches/1.4/config/digital.html
branches/1.4/config/scripts/tooltip.js
branches/1.4/tools/ztscan.c
Modified: branches/1.4/config/digital.html
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/digital.html?view=diff&rev=1544&r1=1543&r2=1544
==============================================================================
--- branches/1.4/config/digital.html (original)
+++ branches/1.4/config/digital.html Fri Sep 7 17:02:53 2007
@@ -131,11 +131,19 @@
var old_zap = 0;
var isrefresh = 0;
var widgets = {};
-var fieldnames = [ 'active', 'alarms', 'description', 'name', 'totchans', 'fac', 'lbo' ];
-var fieldnames_clickable = [ 'active', 'fac', 'lbo' ];
-var fieldnames_proper = [ 'Out Of Alarm:', 'Alarms:', 'Card Description:', 'Card Name:', 'Total Channels:', 'Framing/Coding:', 'Line Build Out:' ];
+var fieldnames_clickable = [ 'fac', 'lbo', 'syncsrc' ];
+var fieldnames = [ 'alarms', 'syncsrc', 'description', 'totchans', 'fac', 'lbo' ];
+var fieldnames_proper = [ 'Alarms:', 'Sync Source:', 'Card Description:', 'Total Channels:', 'Framing/Coding:', 'Line Build Out:' ];
var fieldnames_zap_opts = [ 'loadzone', 'defaultzone'];
+
+/* Our select boxes for framing/coding and line build out */
var framing_and_coding = [ "esf,b8zs", "d4,ami", "cas,ami", "ccs,hdb3", "ccs,crc4,hdb3"];
+var framing_and_coding_nice = [ "ESF/B8ZS", "D4/AMI", "CAS/AMI", "CCS/HDB3", "CCS/CRC4/HDB3"];
+
+/* _______________________________________________________ */
+
+var line_build_out = [ 0, 1, 2, 3, 4, 5, 6, 7];
+var line_build_out_nice = [ "0 db (CSU)/0-133 feet (DSX-1)", "133-266 feet (DSX-1)", "266-399 feet (DSX-1)", "399-533 feet (DSX-1)", "533-655 feet (DSX-1)", "-7.5db (CSU)", "-15db (CSU)", "-22.5db (CSU)" ];
/* This page is based off of sample.html, the gui tutorial on writing a page */
@@ -168,7 +176,7 @@
}
zt_cb.format = function(t) {
- return t.fieldbyname['active'];
+ return t.fieldbyname['alarms'];
};
zt_cb.loaded = function() {
@@ -270,6 +278,12 @@
function run_zt_and_restart() {
/* this function will run ztcfg and reload the page. */
+ gui_feedback("Save Completed.", 'blue');
+
+}
+
+function get_params_and_ztcfg() {
+ /* this function will get all the values out of all the fields, build a zaptel.conf file, then write it and run ztcfg */
gui_alert("This is a place holder, if you see this its probably because you need to run ztcfg, and running it is not in this page yet.");
}
@@ -301,8 +315,8 @@
}
if(n[l]['continue'] && n[l]['continue'] == "yes") {
total_spans = (n[l]['totalspans']) ? n[l]['totalspans'] : 'Unknown';
- for(var z=1; z < total_spans; z++) {
- SPANS[z] = new Array();
+ for(var z=0; z < total_spans; z++) {
+ SPANS[(1 + z)] = new Object;
}
has_spans=1;
if(n[l]['isnew'] && n[l]['isnew'] == "yes") {
@@ -324,6 +338,10 @@
/* if alarms is red, make cell red, else make cell green/yellow etc. */
for(var i=0; i < fieldnames.length; i++) {
var td = document.createElement("td");
+ /* save our information for global use... */
+ SPANS[l].en = new Array;
+ SPANS[l].en[fieldnames[i]] = n[l][fieldnames[i]];
+ /* dumb hack because we cannot use multidimentional arrays */
if(fieldnames[i] == 'lbo' && n[l][fieldnames[i]] == "NODEF") {
old_zap = 1;
td.appendChild(document.createTextNode("N/A"));
@@ -368,7 +386,14 @@
break;
}
}
-
+ if(fieldnames[i] == 'totchans') {
+ var type = parseInt(n[l][fieldnames[i]]);
+ if(type > 1 && type < 30) {
+ n[l][fieldnames[i]] = "24 / T1";
+ } else {
+ n[l][fieldnames[i]] = "31 / E1";
+ }
+ }
td.appendChild(document.createTextNode(n[l][fieldnames[i]]));
td.setAttribute("id", l + '-' + fieldnames[i]);
tr.appendChild(td);
@@ -398,19 +423,70 @@
var tmp_sel = "";
for(var y=0; y < framing_and_coding.length; y++) {
tmp_sel += '<option value='+framing_and_coding[y]+'>'
- tmp_sel += framing_and_coding[y];
+ tmp_sel += framing_and_coding_nice[y];
tmp_sel += '</option>'
}
tmp_sel += '</select>';
var tmp_id = i+'-'+fieldnames_clickable[x];
var ofid = _$(tmp_id);
if(ofid) {
- ofid.innerHTML = '<select class="input9" id="'+i+'-'+fieldnames_clickable[x]+'-sel">'+tmp_sel;
- }
+ ofid.innerHTML = '<select style="font-family: Verdana, Arial, Helvetica, Sans-Serif;" id="'+i+'-'+fieldnames_clickable[x]+'-sel">'+tmp_sel;
+ }
+ }
+ if(fieldnames_clickable[x] == "lbo") {
+ var tmp_sel = "";
+ for(var y=0; y < line_build_out.length; y++) {
+ tmp_sel += '<option value='+line_build_out[y]+'>'
+ tmp_sel += line_build_out_nice[y];
+ tmp_sel += '</option>'
+ }
+ tmp_sel += '</select>';
+ var tmp_id = i+'-'+fieldnames_clickable[x];
+ var ofid = _$(tmp_id);
+ if(ofid) {
+ ofid.innerHTML = '<select style="font-family: Verdana, Arial, Helvetica, Sans-Serif;" id="'+i+'-'+fieldnames_clickable[x]+'-sel">'+tmp_sel;
+ }
+
+ }
+ if(fieldnames_clickable[x] == "syncsrc") {
+ var tmp_sel = "<option value='0'>0</option>";
+ var ll = (parseInt(total_spans) + 1);
+ for(var y=1; y < ll; y++) {
+ tmp_sel += '<option value='+y+'>'
+ tmp_sel += y;
+ tmp_sel += '</option>'
+ }
+ tmp_sel += '</select>';
+ var tmp_id = i+'-'+fieldnames_clickable[x];
+ var ofid = _$(tmp_id);
+ if(ofid) {
+ ofid.innerHTML = '<select style="font-family: Verdana, Arial, Helvetica, Sans-Serif;" id="'+i+'-'+fieldnames_clickable[x]+'-sel">'+tmp_sel;
+ }
+
}
}
}
- return true;
+ select_correct_index();
+ return true;
+}
+
+/* function to select the proper framing/coding || lbo and sync source as specified */
+function select_correct_index() {
+ for(var i=1; i < (total_spans + 1); i++ ){
+ for(var x=0; x < fieldnames_clickable.length; x++) {
+ var tmp_id = i+'-'+fieldnames_clickable[x]+'-sel';
+ var ofid = _$(tmp_id);
+ if(ofid) {
+ for(var w=0; w < fieldnames.length; w++) {
+ alert(ofid.options[w].value + SPAN[i].en['fac']);
+ if(ofid.options[w].value.length) {
+ if(ofid.options[w].value == SPAN[i].en['fac'])
+ alert("zomgz");
+ }
+ }
+ }
+ }
+ }
}
function save_changes() {
/* function to grab the values of fields, and call the bash script to apply the changes and run ztcfg */
@@ -464,13 +540,13 @@
ASTGUI.events.add(document, 'mouseover', show_tooltip);
showdiv_statusmessage();
_$('status_message').style.display="block";
- setTimeout("_$('status_message').style.display='none'", 5000);
+ setTimeout("_$('status_message').style.display='none'", 1000);
_$('message_text').innerHTML = "Detecting Digital Cards ... (Beta)";
setWindowTitle("Digital Setup Wizard");
parent.loadscreen(this);
/* Give ztscan 4 seconds to detect and write to ztscan.conf */
parent.astmanEngine.run_tool(asterisk_guiZtscan, function(t) {
- setTimeout('load_config_tool()', 4000);
+ setTimeout('load_config_tool()', 500);
});
for (var x=0; x < fieldnames.length; x++ ) {
widgets[fieldnames[x]] = _$(fieldnames[x]);
@@ -499,13 +575,12 @@
<center>
<font size="+1">Digital Card Setup</font><br>
<span style="cursor: pointer; cursor: hand;" onclick="refresh_alarms();" > Click to refresh alarms. <img src="images/refresh.png" title=" Refresh " border=0 ></span>
-<div style="width:500;height:250; overflow :auto;">
- <table class="taglist" id="digitalcardstable" cellpadding=2 cellspacing=1 border=0 align=center width=500></table>
+<div style="width:525;height:250;overflow:auto;">
+ <table class="taglist" id="digitalcardstable" cellpadding=2 cellspacing=1 border=0 align=center width=525></table>
</div>
<div id="save_changes_id">
<span type='button' onclick="save_changes();" class="downmenubutton" value='Save Changes'>Save Changes</span>
</div>
-<br><br>
__________________________________________________________________________________________________
<br>
<div><fieldset style="width: 190px;">
@@ -519,9 +594,6 @@
</center>
<div id="mymenu" class="mymenu" style="display:none"></div>
<div style="display:none;visibility:hidden">
- <tr> <td class="field_text">Active:</td>
- <td><input id="active" size=14 class="input8"></td>
- </tr>
<tr> <td class="field_text">Alarms:</td>
<td><input id="alarms" size=14 class="input8"></td>
</tr>
@@ -543,6 +615,10 @@
<tr> <td class="field_text">Line Build Out:</td>
<td><input type="text" id="lbo" size=14 class="input8"></td>
</tr>
+ <tr> <td class="field_text">Sync Source:</td>
+ <td><input type="text" id="syncsrc" size=14 class="input8"></td>
+ </tr>
+
</div>
</body>
Modified: branches/1.4/config/scripts/tooltip.js
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/config/scripts/tooltip.js?view=diff&rev=1544&r1=1543&r2=1544
==============================================================================
--- branches/1.4/config/scripts/tooltip.js (original)
+++ branches/1.4/config/scripts/tooltip.js Fri Sep 7 17:02:53 2007
@@ -339,5 +339,6 @@
tooltips['digital'].en['Total Channels:'] = "<B>Total Channels:</B> This is the count of the TOTAL channels availible on a particular span, not just the configured ones.";
tooltips['digital'].en['Framing/Coding:'] = "<B>Framing/Coding:</B> Drop down box for enabling the changing of Framing/Coding. The first option is your current Framing/Coding";
tooltips['digital'].en['Line Build Out:'] = "<B>Line Build Out:</B> The current LBO (Line Build Out) of the span.";
+ tooltips['digital'].en['Sync Source:'] = "<B>Sync Source:</B> Your Zaptel Sync Source. Can be one of any spans, or 0 for non master";
Modified: branches/1.4/tools/ztscan.c
URL: http://svn.digium.com/view/asterisk-gui/branches/1.4/tools/ztscan.c?view=diff&rev=1544&r1=1543&r2=1544
==============================================================================
--- branches/1.4/tools/ztscan.c (original)
+++ branches/1.4/tools/ztscan.c Fri Sep 7 17:02:53 2007
@@ -248,19 +248,19 @@
snprintf(lbos, sizeof(lbos), "%s", lbostr[s[x].lbo]);
if(!strncmp(ret, "OK", 2)) {
printf("Span %d has Alarm: %s\n", x, ret);
- fprintf(conf, "\n[%d]\nactive=yes\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=%s\nlbo=%s\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, fac, lbos);
+ fprintf(conf, "\n[%d]\nactive=yes\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=%s\nlbo=%s\nsyncsrc=%d\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, fac, lbos, s[x].syncsrc);
} else {
printf("Span %d has Alarm: %s\n", x, ret);
- fprintf(conf, "\n[%d]\nactive=no\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=%s\nlbo=%s\n\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, fac, lbos);
+ fprintf(conf, "\n[%d]\nactive=no\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=%s\nlbo=%s\nsyncsrc=%d\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, fac, lbos, s[x].syncsrc);
}
#else
if(!strncmp(ret, "OK", 2)) {
printf("Span %d has Alarm: %s\n", x, ret);
- fprintf(conf, "\n[%d]\nactive=yes\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=NODEF\nlbo=NODEF\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans);
+ fprintf(conf, "\n[%d]\nactive=yes\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=NODEF\nlbo=NODEF\nsyncsrc=%d\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, s[x].syncsrc);
} else {
printf("Span %d has Alarm: %s\n", x, ret);
- fprintf(conf, "\n[%d]\nactive=no\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=NODEF\nlbo=NODEF\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans );
+ fprintf(conf, "\n[%d]\nactive=no\nalarms=%s\ndescription=%s\nname=%s\ntotchans=%d\nusedchans=%d\nfac=NODEF\nlbo=NODEF\nsyncsrc=%d\n", x, ret, s[x].desc, s[x].name, s[x].totalchans, s[x].numchans, s[x].syncsrc);
}
#endif
span++;
More information about the asterisk-gui-commits
mailing list