1 |
56472ded
|
Bill Marquette
|
/*
|
2 |
|
|
pool.js
|
3 |
|
|
part of pfSense (http://www.pfsense.com/)
|
4 |
|
|
|
5 |
|
|
Copyright (C) 2005 Bill Marquette <bill.marquette@gmail.com>.
|
6 |
|
|
All rights reserved.
|
7 |
|
|
|
8 |
|
|
Redistribution and use in source and binary forms, with or without
|
9 |
|
|
modification, are permitted provided that the following conditions are met:
|
10 |
|
|
|
11 |
|
|
1. Redistributions of source code must retain the above copyright notice,
|
12 |
|
|
this list of conditions and the following disclaimer.
|
13 |
|
|
|
14 |
|
|
2. Redistributions in binary form must reproduce the above copyright
|
15 |
|
|
notice, this list of conditions and the following disclaimer in the
|
16 |
|
|
documentation and/or other materials provided with the distribution.
|
17 |
|
|
|
18 |
|
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
19 |
|
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
20 |
|
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
21 |
|
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
22 |
|
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
23 |
|
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
24 |
|
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
25 |
|
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
26 |
|
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
27 |
|
|
POSSIBILITY OF SUCH DAMAGE.
|
28 |
|
|
*/
|
29 |
|
|
|
30 |
c7451dda
|
Bill Marquette
|
/* Add server to virtual server pool
|
31 |
|
|
* operates on whatever form is passed to it
|
32 |
|
|
*/
|
33 |
41901fa6
|
Bill Marquette
|
function AddServerToPool(form) {
|
34 |
08874812
|
Erik Kristensen
|
|
35 |
401452ec
|
Seth Mos
|
var IntOrIp
|
36 |
08874812
|
Erik Kristensen
|
var theSel = form['servers[]'];
|
37 |
401452ec
|
Seth Mos
|
if (form.type.selectedIndex == 0)
|
38 |
|
|
IntOrIp = form.ipaddr;
|
39 |
|
|
else
|
40 |
|
|
IntOrIp = form.interface;
|
41 |
|
|
|
42 |
|
|
for(i = theSel.length - 1; i >= 0; i--)
|
43 |
08874812
|
Erik Kristensen
|
{
|
44 |
401452ec
|
Seth Mos
|
if(theSel.options[i].value == IntOrIp.value) {
|
45 |
08874812
|
Erik Kristensen
|
alert("IP Address Already In List");
|
46 |
|
|
return true;
|
47 |
|
|
}
|
48 |
|
|
}
|
49 |
|
|
|
50 |
|
|
if (form.type.selectedIndex == 1) {
|
51 |
|
|
if (!form.monitorip.value) {
|
52 |
|
|
alert("Monitor IP Required First!");
|
53 |
|
|
return true;
|
54 |
|
|
}
|
55 |
|
|
}
|
56 |
|
|
|
57 |
401452ec
|
Seth Mos
|
var ServerPort = IntOrIp.value;
|
58 |
08874812
|
Erik Kristensen
|
if(form.type.selectedIndex == 0)
|
59 |
401452ec
|
Seth Mos
|
var ServerPort = IntOrIp.value;
|
60 |
45a1a1e7
|
Scott Ullrich
|
else
|
61 |
401452ec
|
Seth Mos
|
var ServerPort = IntOrIp.value + "|" + form.monitorip.value;
|
62 |
41901fa6
|
Bill Marquette
|
form['servers[]'].options[form['servers[]'].options.length] = new Option(ServerPort,ServerPort);
|
63 |
|
|
}
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
function AllServers(id, selectAll) {
|
67 |
|
|
var opts = document.getElementById(id).getElementsByTagName('option');
|
68 |
|
|
for (i = 0; i < opts.length; i++)
|
69 |
|
|
{
|
70 |
|
|
opts[i].selected = selectAll;
|
71 |
|
|
}
|
72 |
|
|
}
|
73 |
2726d695
|
Erik Kristensen
|
|
74 |
|
|
|
75 |
|
|
function RemoveServerFromPool(form)
|
76 |
|
|
{
|
77 |
|
|
var theSel = form['servers[]'];
|
78 |
|
|
var selIndex = theSel.selectedIndex;
|
79 |
|
|
if (selIndex != -1) {
|
80 |
|
|
for(i=theSel.length-1; i>=0; i--)
|
81 |
|
|
{
|
82 |
|
|
if(theSel.options[i].selected)
|
83 |
|
|
{
|
84 |
|
|
theSel.options[i] = null;
|
85 |
|
|
}
|
86 |
|
|
}
|
87 |
|
|
if (theSel.length > 0) {
|
88 |
|
|
theSel.selectedIndex = selIndex == 0 ? 0 : selIndex - 1;
|
89 |
|
|
}
|
90 |
|
|
}
|
91 |
56472ded
|
Bill Marquette
|
}
|