1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<% include('/elements/xmlhttp.html',
'url' => $p.'misc/svc_acct-domains.cgi',
'subs' => [ $opt{'prefix'}. 'get_domains' ],
)
%>
<SCRIPT TYPE="text/javascript">
function selopt(what,value,text,selected) {
var optionName = new Option(text, value, false, selected);
var length = what.length;
what.options[length] = optionName;
}
function <% $opt{'prefix'} %>pkgpart_svcpart_changed(what,selected) {
pkgpart_svcpart = what.options[what.selectedIndex].value;
function <% $opt{'prefix'} %>update_domains(domains) {
// blank the current domain list
for ( var i = what.form.<% $opt{'prefix'} %>domsvc.length; i >= 0; i-- )
what.form.<% $opt{'prefix'} %>domsvc.options[i] = null;
// add the new domains
var domainArray = eval('(' + domains + ')' );
for ( var s = 0; s < domainArray.length; s=s+2 ) {
var domainLabel = domainArray[s+1];
if ( domainLabel == "" )
domainLabel = '(n/a)';
selopt(what.form.<% $opt{'prefix'} %>domsvc, domainArray[s], domainLabel, (domainArray[s] == selected) ? true : false);
}
}
// go get the new domains
<% $opt{'prefix'} %>get_domains( pkgpart_svcpart, <% $opt{'prefix'} %>update_domains );
}
</SCRIPT>
<SELECT NAME="<% $opt{'prefix'} %>pkgpart_svcpart" onchange="<% $opt{'prefix'} %>pkgpart_svcpart_changed(this,0);" >
<OPTION VALUE="">(none)
% foreach my $part_pkg ( @part_pkg ) {
<OPTION VALUE="<% $part_pkg->pkgpart. "_". $part_pkg->svcpart('svc_acct') %>"<% ( $opt{saved_pkgpart} && $part_pkg->pkgpart == $opt{saved_pkgpart} ) ? ' SELECTED' : '' %>><% $part_pkg->pkg. " - ". $part_pkg->comment %>
% }
</SELECT>
<SCRIPT>
pkgpart_svcpart_changed(document.bottomform.pkgpart_svcpart, <% $opt{saved_domsvc} %>);
</SCRIPT>
<%init>
my %opt = @_;
foreach my $opt (qw( svc_part pkgparts saved_pkgpart saved_domsvc prefix)) {
$opt{$_} = '' unless exists($opt{$_}) && defined($opt{$_});
}
$opt{saved_domsvc} = 0 unless $opt{saved_domsvc};
my @part_pkg = @{$opt{'pkgparts'}};
</%init>
|