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 if ( what.form.<% $opt{'prefix'} %>phonenum.type != 'select-multiple' ){
34 opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
38 // add the new phonenums
39 var phonenumArray = eval('(' + phonenums + ')' );
40 for ( var s = 0; s < phonenumArray.length; s++ ) {
41 var phonenumLabel = phonenumArray[s];
42 if ( phonenumLabel == "" )
43 phonenumLabel = '(n/a)';
44 opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
47 //var phonenumFormLabel = document.getElementById('<% $opt{'prefix'} %>phonenumlabel');
49 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
51 phonenumwait.style.display = 'none';
52 if ( phonenumArray.length >= 1 ) {
53 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
54 what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
56 var phonenumerror = document.getElementById('<% $opt{'prefix'} %>phonenumerror');
57 phonenumerror.style.display = '';
61 if ( callback != null )
64 var phonenum_sel = what.form.<% $opt{'prefix'} %>phonenum;
65 var bulkdid = document.getElementById('bulkdid');
66 if ( bulkdid != null ) {
67 var numCheckboxes = Math.min(phonenum_sel.options.length-1,<% $opt{'bulknum'} %>);
69 for(i = 0; i < numCheckboxes; i++){
70 document.getElementById('bulkdid_'+i).style.display = 'block';
71 document.getElementById('checkbox_bulkdid_'+i).checked = false;
72 var tn = phonenum_sel.options[i+1].value;
73 document.getElementById('checkbox_bulkdid_'+i).value = tn;
74 document.getElementById('label_bulkdid_'+i).innerHTML = tn;
76 for(i = numCheckboxes; i < <% $opt{'bulknum'} %>; i++){
77 document.getElementById('bulkdid_'+i).style.display = 'none';
78 document.getElementById('checkbox_bulkdid_'+i).value = '';
79 document.getElementById('checkbox_bulkdid_'+i).checked = false;
80 document.getElementById('label_bulkdid_'+i).innerHTML = '';
86 // go get the new phonenums
87 <% $opt{'prefix'} %>get_phonenums( exchange, <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
91 % if ( $opt{'tollfree'} ) {
92 function <% $opt{'prefix'} %>update_phonenums(phonenums) {
93 // lame hack so I can copy the code from above
94 what = document.getElementById('<% $opt{prefix} %>phonenum');
96 // blank the current phonenum
97 for ( var i = what.form.<% $opt{'prefix'} %>phonenum.length; i >= 0; i-- )
98 what.form.<% $opt{'prefix'} %>phonenum.options[i] = null;
101 opt(what.form.<% $opt{'prefix'} %>phonenum, '', '<% $opt{empty} %>');
104 // add the new phonenums
105 var phonenumArray = eval('(' + phonenums + ')' );
106 for ( var s = 0; s < phonenumArray.length; s++ ) {
107 var phonenumLabel = phonenumArray[s];
108 if ( phonenumLabel == "" )
109 phonenumLabel = '(n/a)';
110 opt(what.form.<% $opt{'prefix'} %>phonenum, phonenumArray[s], phonenumLabel);
113 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
115 if ( phonenumArray.length >= 1 ) {
116 what.form.<% $opt{'prefix'} %>phonenum.disabled = '';
117 what.form.<% $opt{'prefix'} %>phonenum.style.display = '';
121 <% $opt{'prefix'} %>get_phonenums( 'tollfree', <% $opt{'svcpart'} %>, <% $opt{'prefix'} %>update_phonenums );
126 % unless ( $opt{'tollfree'} ) {
127 <DIV ID="phonenumwait" STYLE="display:none"><IMG SRC="<%$fsurl%>images/wait-orange.gif"> <B>Finding phone numbers</B></DIV>
129 <DIV ID="phonenumerror" STYLE="display:none"><IMG SRC="<%$fsurl%>images/cross.png"> <B>Select a different city/exchange</B></DIV>
132 <SELECT <% $opt{multiple} ? 'MULTIPLE SIZE=25' : '' %>
133 ID = "<% $opt{'prefix'} %>phonenum"
134 NAME = "<% $opt{'prefix'} %>phonenum"
135 <% $opt{'disabled'} %>
136 %# notonChange="<% $opt{'prefix'} %>phonenum_changed(this); <% $opt{'onchange'} %>"
138 % unless ( $opt{multiple} ) {
139 <OPTION VALUE="">Select phone number</OPTION>
147 $opt{disabled} = 'disabled' unless exists $opt{disabled};