1 <% include('/elements/xmlhttp.html',
2 'url' => $p.'misc/phonenums.cgi',
3 'subs' => [ $opt{'prefix'}. 'get_phonenums' ],
7 <SCRIPT TYPE="text/javascript">
9 function opt(what,value,text) {
10 var optionName = new Option(text, value, false, false);
11 var length = what.length;
12 what.options[length] = optionName;
15 function <% $opt{'prefix'} %>exchange_changed(what, callback) {
17 what.form.<% $opt{'prefix'} %>phonenum.disabled = 'disabled';
18 what.form.<% $opt{'prefix'} %>phonenum.style.display = 'none';
19 var phonenumwait = document.getElementById('<% $opt{'prefix'} %>phonenumwait');
20 phonenumwait.style.display = '';
21 var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
22 phonenumerror.style.display = 'none';
24 exchange = what.options[what.selectedIndex].value;
26 function <% $opt{'prefix'} %>update_phonenums(phonenums) {
28 // blank the current phonenum
29 for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
30 what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
33 opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
36 // add the new phonenums
37 var phonenumArray = eval('(' + phonenums + ')' );
38 for ( var s = 0; s < phonenumArray.length; s++ ) {
39 var phonenumLabel = phonenumArray[s];
40 if ( phonenumLabel == "" )
41 phonenumLabel = '(n/a)';
42 opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
45 //var phonenumFormLabel = document.getElementById('<% $opt{'prefix'} %>phonenumlabel');
47 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
49 phonenumwait.style.display = 'none';
50 if ( phonenumArray.length >= 1 ) {
51 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
52 what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
54 var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
55 phonenumerror.style.display = '';
59 if ( callback != null )
62 var phonenum_sel = what.form.<% $opt{'prefix'} %>phonenum;
63 var bulkdid = document.getElementById('bulkdid');
64 if ( bulkdid != null ) {
65 var numCheckboxes = Math.min(phonenum_sel.options.length-1,<% $opt{'bulknum'} %>);
67 for(i = 0; i < numCheckboxes; i++){
68 document.getElementById('bulkdid_'+i).style.display = 'block';
69 document.getElementById('checkbox_bulkdid_'+i).checked = false;
70 var tn = phonenum_sel.options[i+1].value;
71 document.getElementById('checkbox_bulkdid_'+i).value = tn;
72 document.getElementById('label_bulkdid_'+i).innerHTML = tn;
74 for(i = numCheckboxes; i < <% $opt{'bulknum'} %>; i++){
75 document.getElementById('bulkdid_'+i).style.display = 'none';
76 document.getElementById('checkbox_bulkdid_'+i).value = '';
77 document.getElementById('checkbox_bulkdid_'+i).checked = false;
78 document.getElementById('label_bulkdid_'+i).innerHTML = '';
84 // go get the new phonenums
85 <% $opt{'prefix'} %>get_phonenums( exchange, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
89 % if ( $opt{'tollfree'} ) {
90 function <% $opt{'prefix'} %>update_phonenums(phonenums) {
91 // lame hack so I can copy the code from above
92 what = document.getElementById('<% $opt{prefix} %>phonenum');
94 // blank the current phonenum
95 for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
96 what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
99 opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
102 // add the new phonenums
103 var phonenumArray = eval('(' + phonenums + ')' );
104 for ( var s = 0; s < phonenumArray.length; s++ ) {
105 var phonenumLabel = phonenumArray[s];
106 if ( phonenumLabel == "" )
107 phonenumLabel = '(n/a)';
108 opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
111 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
113 if ( phonenumArray.length >= 1 ) {
114 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
115 what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
119 <% $opt{'prefix'} %>get_phonenums( 'tollfree', <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
124 % unless ( $opt{'tollfree'} ) {
125 <DIV ID="phonenumwait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding phone numbers</B></DIV>
127 <DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV>
130 <SELECT ID="<% $opt{'prefix'} %>phonenum" NAME="<% $opt{'prefix'} %>phonenum"
131 notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>"
132 <% $opt{'disabled'} %>>
133 <OPTION VALUE="">Select phone number</OPTION>
140 $opt{disabled} = 'disabled' unless exists $opt{disabled};