Project

General

Profile

Download (16.7 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php 
2
/*
3
	system_routes_edit.php
4
	part of m0n0wall (http://m0n0.ch/wall)
5
	
6
	Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
7 38936dc7 Ermal Lu?i
	Copyright (C) 2010 Scott Ullrich
8 5b237745 Scott Ullrich
	All rights reserved.
9
	
10
	Redistribution and use in source and binary forms, with or without
11
	modification, are permitted provided that the following conditions are met:
12
	
13
	1. Redistributions of source code must retain the above copyright notice,
14
	   this list of conditions and the following disclaimer.
15
	
16
	2. Redistributions in binary form must reproduce the above copyright
17
	   notice, this list of conditions and the following disclaimer in the
18
	   documentation and/or other materials provided with the distribution.
19
	
20
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
21
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
22
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
24
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29
	POSSIBILITY OF SUCH DAMAGE.
30
*/
31 1d333258 Scott Ullrich
/*
32
	pfSense_MODULE:	routing
33
*/
34 5b237745 Scott Ullrich
35 6b07c15a Matthew Grooms
##|+PRIV
36
##|*IDENT=page-system-staticroutes-editroute
37
##|*NAME=System: Static Routes: Edit route page
38
##|*DESCR=Allow access to the 'System: Static Routes: Edit route' page.
39
##|*MATCH=system_routes_edit.php*
40
##|-PRIV
41
42 4504a769 Ermal Lu?i
function staticroutecmp($a, $b) {
43
	return strcmp($a['network'], $b['network']);
44
}
45
46 0d64af59 Ermal Lu?i
function staticroutes_sort() {
47
        global $g, $config;
48
49
        if (!is_array($config['staticroutes']['route']))
50
                return;
51
52
        usort($config['staticroutes']['route'], "staticroutecmp");
53
}
54 6b07c15a Matthew Grooms
55 4fd2fed2 jim-p
require_once("guiconfig.inc");
56
require_once("filter.inc");
57
require_once("util.inc");
58
require_once("gwlb.inc");
59 5b237745 Scott Ullrich
60
if (!is_array($config['staticroutes']['route']))
61
	$config['staticroutes']['route'] = array();
62
63
$a_routes = &$config['staticroutes']['route'];
64 6fdea6a2 smos
$a_gateways = return_gateways_array(true, true);
65 5b237745 Scott Ullrich
66
$id = $_GET['id'];
67
if (isset($_POST['id']))
68
	$id = $_POST['id'];
69
70 18f7352b Seth Mos
if (isset($_GET['dup'])) {
71
	$id = $_GET['dup'];
72
}
73
74 5b237745 Scott Ullrich
if (isset($id) && $a_routes[$id]) {
75
	list($pconfig['network'],$pconfig['network_subnet']) = 
76
		explode('/', $a_routes[$id]['network']);
77
	$pconfig['gateway'] = $a_routes[$id]['gateway'];
78
	$pconfig['descr'] = $a_routes[$id]['descr'];
79 bfe407e5 Warren Baker
	$pconfig['disabled'] = isset($a_routes[$id]['disabled']);
80 5b237745 Scott Ullrich
}
81
82 18f7352b Seth Mos
if (isset($_GET['dup']))
83
	unset($id);
84
85 5b237745 Scott Ullrich
if ($_POST) {
86
87
	unset($input_errors);
88
	$pconfig = $_POST;
89
90
	/* input validation */
91 dde169d9 Vinicius Coque
	$reqdfields = explode(" ", "network network_subnet gateway");
92 38fb1109 Vinicius Coque
	$reqdfieldsn = explode(",",
93
			gettext("Destination network") . "," .
94
			gettext("Destination network bit count") . "," .
95
			gettext("Gateway"));		
96 5b237745 Scott Ullrich
	
97
	do_input_validation($_POST, $reqdfields, $reqdfieldsn, &$input_errors);
98
	
99 f898c1a9 jim-p
	if (($_POST['network'] && !is_ipaddr($_POST['network']) && !is_alias($_POST['network']))) {
100 ad700f39 Seth Mos
		$input_errors[] = gettext("A valid IPv4 or IPv6 destination network must be specified.");
101 5b237745 Scott Ullrich
	}
102
	if (($_POST['network_subnet'] && !is_numeric($_POST['network_subnet']))) {
103 169e0008 Carlos Eduardo Ramos
		$input_errors[] = gettext("A valid destination network bit count must be specified.");
104 5b237745 Scott Ullrich
	}
105 ad700f39 Seth Mos
	if (($_POST['gateway']) && is_ipaddr($_POST['network'])) {
106 a529aced Ermal
		if (!isset($a_gateways[$_POST['gateway']]))
107 169e0008 Carlos Eduardo Ramos
			$input_errors[] = gettext("A valid gateway must be specified.");
108 1831a00d Seth Mos
		if(!validate_address_family($_POST['network'], lookup_gateway_ip_by_name($_POST['gateway'])))
109
			$input_errors[] = gettext("The gateway '{$a_gateways[$_POST['gateway']]['gateway']}' is a different Address Family as network '{$_POST['network']}'.");
110 5b237745 Scott Ullrich
	}
111
112
	/* check for overlaps */
113 f898c1a9 jim-p
	$current_targets = get_staticroutes(true);
114
	$new_targets = array();
115 14f565b4 Seth Mos
	if(is_ipaddrv6($_POST['network'])) {
116 88cc00db Ermal
		$osn = gen_subnetv6($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
117 f898c1a9 jim-p
		$new_targets[] = $osn;
118 14f565b4 Seth Mos
	}
119 71f4a2b7 smos
	if (is_ipaddrv4($_POST['network'])) {
120 1831a00d Seth Mos
		if($_POST['network_subnet'] > 32)
121
			$input_errors[] = gettext("A IPv4 subnet can not be over 32 bits.");
122 f898c1a9 jim-p
		else {
123 1831a00d Seth Mos
			$osn = gen_subnet($_POST['network'], $_POST['network_subnet']) . "/" . $_POST['network_subnet'];
124 f898c1a9 jim-p
			$new_targets[] = $osn;
125
		}
126
	} elseif (is_alias($_POST['network'])) {
127
		$osn = $_POST['network'];
128
		foreach (filter_expand_alias_array($_POST['network']) as $tgt) {
129
			if (is_ipaddr($tgt))
130
				$tgt .= "/32";
131 71f4a2b7 smos
			if (is_ipaddr($tgt))
132
				$tgt .= "/128";
133 f898c1a9 jim-p
			if (!is_subnet($tgt))
134
				continue;
135 06392e40 jim-p
			if (!is_subnetv6($tgt))
136 71f4a2b7 smos
				continue;
137 f898c1a9 jim-p
			$new_targets[] = $tgt;
138
		}
139 14f565b4 Seth Mos
	}
140 f898c1a9 jim-p
	if (!isset($id))
141
		$id = count($a_routes);
142
	$oroute = $a_routes[$id];
143 71f4a2b7 smos
	$old_targets = array();
144 f898c1a9 jim-p
	if (!empty($oroute)) {
145
		if (is_alias($oroute['network'])) {
146
			foreach (filter_expand_alias_array($oroute['network']) as $tgt) {
147
				if (is_ipaddr($tgt))
148
					$tgt .= "/32";
149
				if (!is_subnet($tgt))
150
					continue;
151
				$old_targets[] = $tgt;
152
			}
153
		} else {
154
			$old_targets[] = $oroute['network'];
155 5b237745 Scott Ullrich
		}
156
	}
157
158 f898c1a9 jim-p
	$overlaps = array_intersect($current_targets, $new_targets);
159
	$overlaps = array_diff($overlaps, $old_targets);
160
	if (count($overlaps)) {
161
		$input_errors[] = gettext("A route to these destination networks already exists") . ": " . implode(", ", $overlaps);
162
	}
163
164 74889b22 Renato Botelho
	if (is_array($config['interfaces'])) {
165
		foreach ($config['interfaces'] as $if) {
166
			if (is_ipaddrv4($_POST['network'])
167
				&& isset($if['ipaddr']) && isset($if['subnet'])
168
				&& is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet'])
169
				&& ($_POST['network_subnet'] == $if['subnet'])
170
				&& (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet'])))
171
					$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
172
173
			else if (is_ipaddrv6($_POST['network'])
174
				&& isset($if['ipaddrv6']) && isset($if['subnetv6'])
175
				&& is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6'])
176
				&& ($_POST['network_subnet'] == $if['subnetv6'])
177
				&& (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6'])))
178
					$input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']);
179
		}
180
	}
181
182 5b237745 Scott Ullrich
	if (!$input_errors) {
183
		$route = array();
184
		$route['network'] = $osn;
185
		$route['gateway'] = $_POST['gateway'];
186
		$route['descr'] = $_POST['descr'];
187 bfe407e5 Warren Baker
		if ($_POST['disabled'])
188
			$route['disabled'] = true;
189
		else
190
			unset($route['disabled']);
191 5b237745 Scott Ullrich
192 f898c1a9 jim-p
		if (file_exists("{$g['tmp_path']}/.system_routes.apply"))
193
			$toapplylist = unserialize(file_get_contents("{$g['tmp_path']}/.system_routes.apply"));
194
		else
195
			$toapplylist = array();
196 e8471084 Ermal
		$a_routes[$id] = $route;
197
198
		if (!empty($oroute)) {
199 f898c1a9 jim-p
			$delete_targets = array_diff($old_targets, $new_targets);
200
			if (count($delete_targets))
201
				foreach ($delete_targets as $dts) {
202
					if(is_ipaddrv6($dts))
203
						$family = "-inet6";
204
					$toapplylist[] = "/sbin/route delete {$family} {$dts}"; 
205
				}
206 e8471084 Ermal
		}
207
		file_put_contents("{$g['tmp_path']}/.system_routes.apply", serialize($toapplylist));
208 0e3aa71c Erik Fonnesbeck
		staticroutes_sort();
209 5b237745 Scott Ullrich
		
210 a368a026 Ermal Lu?i
		mark_subsystem_dirty('staticroutes');
211 5b237745 Scott Ullrich
		
212
		write_config();
213
		
214
		header("Location: system_routes.php");
215
		exit;
216
	}
217
}
218 4df96eff Scott Ullrich
219 169e0008 Carlos Eduardo Ramos
$pgtitle = array(gettext("System"),gettext("Static Routes"),gettext("Edit route"));
220 b32dd0a6 jim-p
$shortcut_section = "routing";
221 4df96eff Scott Ullrich
include("head.inc");
222 5b237745 Scott Ullrich
?>
223 4df96eff Scott Ullrich
224 5b237745 Scott Ullrich
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
225 87744d53 Darren Embry
<script type="text/javascript" src="/javascript/jquery.ipv4v6ify.js"></script>
226 dcdff6fa Colin Fleming
<script type="text/javascript" src="/javascript/autosuggest.js"></script>
227
<script type="text/javascript" src="/javascript/suggestions.js"></script>
228 f898c1a9 jim-p
<?php include("fbegin.inc");?>
229 5b237745 Scott Ullrich
<?php if ($input_errors) print_input_errors($input_errors); ?>
230
            <form action="system_routes_edit.php" method="post" name="iform" id="iform">
231 dcdff6fa Colin Fleming
              <table width="100%" border="0" cellpadding="6" cellspacing="0" summary="system routes edit">
232 0cece4a2 Scott Ullrich
				<tr>
233 169e0008 Carlos Eduardo Ramos
					<td colspan="2" valign="top" class="listtopic"><?=gettext("Edit route entry"); ?></td>
234 0cece4a2 Scott Ullrich
				</tr>	
235 5b237745 Scott Ullrich
                <tr>
236 169e0008 Carlos Eduardo Ramos
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Destination network"); ?></td>
237 5b237745 Scott Ullrich
                  <td width="78%" class="vtable"> 
238 dcdff6fa Colin Fleming
                    <input name="network" type="text" class="formfldalias ipv4v6" id="network" size="20" value="<?=htmlspecialchars($pconfig['network']);?>" />
239 5b237745 Scott Ullrich
				  / 
240 dcdff6fa Colin Fleming
                    <select name="network_subnet" class="formselect ipv4v6" id="network_subnet">
241 bb5a2d0e Seth Mos
                      <?php
242 3d36f9d1 smos
			for ($i = 129; $i >= 1; $i--): ?>
243 dcdff6fa Colin Fleming
                      <option value="<?=$i;?>" <?php if ($i == $pconfig['network_subnet']) echo "selected=\"selected\""; ?>>
244 5b237745 Scott Ullrich
                      <?=$i;?>
245
                      </option>
246
                      <?php endfor; ?>
247
                    </select>
248 dcdff6fa Colin Fleming
                    <br/><span class="vexpl"><?=gettext("Destination network for this static route"); ?></span></td>
249 5b237745 Scott Ullrich
                </tr>
250 300e2c0b Vinicius Coque
                <tr>
251 169e0008 Carlos Eduardo Ramos
                  <td width="22%" valign="top" class="vncellreq"><?=gettext("Gateway"); ?></td>
252 d173230c Seth Mos
                  <td width="78%" class="vtable">
253 38936dc7 Ermal Lu?i
			<select name="gateway" id="gateway" class="formselect">
254 d173230c Seth Mos
			<?php
255 a529aced Ermal
				foreach ($a_gateways as $gateway) {
256 a63d867a Ermal
	                      		echo "<option value='{$gateway['name']}' ";
257
					if ($gateway['name'] == $pconfig['gateway'])
258 dcdff6fa Colin Fleming
						echo "selected=\"selected\"";
259 189ceb32 Chris Buechler
	                      		echo ">" . htmlspecialchars($gateway['name']) . " - " . htmlspecialchars($gateway['gateway']) . "</option>\n";
260 a529aced Ermal
				}
261
			?>
262 38936dc7 Ermal Lu?i
                    </select> <br />
263
			<div id='addgwbox'>
264 dcdff6fa Colin Fleming
				<?=gettext("Choose which gateway this route applies to or"); ?> <a onclick="show_add_gateway();" href="#"><?=gettext("add a new one.");?></a>
265 38936dc7 Ermal Lu?i
								</div>
266
								<div id='notebox'>
267
								</div>
268 dcdff6fa Colin Fleming
								<div style="display:none" id="status">
269 38936dc7 Ermal Lu?i
								</div>								
270 dcdff6fa Colin Fleming
								<div style="display:none" id="addgateway">
271
									<table border="1" style="background:#990000; border-style: none none none none; width:225px;" summary="add gateway"><tr><td>
272
										<table bgcolor="#990000" cellpadding="1" cellspacing="1" summary="add">
273
											<tr><td>&nbsp;</td></tr>
274 38936dc7 Ermal Lu?i
											<tr>
275 dcdff6fa Colin Fleming
												<td colspan="2" align="center"><b><font color="white"><?=gettext("Add new gateway:"); ?></font></b></td>
276 38936dc7 Ermal Lu?i
											</tr>
277 dcdff6fa Colin Fleming
											<tr><td>&nbsp;</td></tr>
278 38936dc7 Ermal Lu?i
											<tr>
279 dcdff6fa Colin Fleming
												<td width="45%" align="right"><font color="white"><?=gettext("Default gateway:"); ?></font></td><td><input type="checkbox" id="defaultgw" name="defaultgw" /></td>
280 38936dc7 Ermal Lu?i
											</tr>												
281
											<tr>
282 dcdff6fa Colin Fleming
												<td width="45%" align="right"><font color="white"><?=gettext("Interface:"); ?></font></td>
283 38936dc7 Ermal Lu?i
												<td><select name="addinterfacegw" id="addinterfacegw">
284
												<?php $gwifs = get_configured_interface_with_descr();
285
													foreach($gwifs as $fif => $dif)
286
														echo "<option value=\"{$fif}\">{$dif}</option>\n";
287
												?>
288
												</select></td>
289
											</tr>
290
											<tr>
291 dcdff6fa Colin Fleming
												<td align="right"><font color="white"><?=gettext("Gateway Name:"); ?></font></td><td><input id="name" name="name" value="GW" /></td>
292 38936dc7 Ermal Lu?i
											</tr>
293
											<tr>
294 dcdff6fa Colin Fleming
												<td align="right"><font color="white"><?=gettext("Gateway IP:"); ?></font></td><td><input id="gatewayip" name="gatewayip" /></td>
295 38936dc7 Ermal Lu?i
											</tr>
296
											<tr>
297 dcdff6fa Colin Fleming
												<td align="right"><font color="white"><?=gettext("Description:"); ?></font></td><td><input id="gatewaydescr" name="gatewaydescr" /></td>
298 38936dc7 Ermal Lu?i
											</tr>
299 dcdff6fa Colin Fleming
											<tr><td>&nbsp;</td></tr>
300 38936dc7 Ermal Lu?i
											<tr>
301 dcdff6fa Colin Fleming
												<td colspan="2" align="center">
302 38936dc7 Ermal Lu?i
														<div id='savebuttondiv'>
303
															<input type="hidden" name="addrtype" id="addrtype" value="IPv4" />
304 dcdff6fa Colin Fleming
															<input id="gwsave" type="button" value="<?=gettext("Save Gateway"); ?>" onclick='hide_add_gatewaysave();' />
305
															<input id="gwcancel" type="button" value="<?=gettext("Cancel"); ?>" onclick='hide_add_gateway();' />
306 38936dc7 Ermal Lu?i
														</div>
307
												</td>
308
											</tr>
309 dcdff6fa Colin Fleming
											<tr><td>&nbsp;</td></tr>
310 38936dc7 Ermal Lu?i
										</table>
311
										</td></tr></table>
312
								</div>
313 dcdff6fa Colin Fleming
                </td></tr>
314 bfe407e5 Warren Baker
		<tr>
315
			<td width="22%" valign="top" class="vncell"><?=gettext("Disabled");?></td>
316
			<td width="78%" class="vtable">
317 dcdff6fa Colin Fleming
				<input name="disabled" type="checkbox" id="disabled" value="yes" <?php if ($pconfig['disabled']) echo "checked=\"checked\""; ?> />
318 bfe407e5 Warren Baker
				<strong><?=gettext("Disable this static route");?></strong><br />
319
				<span class="vexpl"><?=gettext("Set this option to disable this static route without removing it from the list.");?></span>
320
			</td>
321
		</tr>
322 d173230c Seth Mos
		<tr>
323 169e0008 Carlos Eduardo Ramos
                  <td width="22%" valign="top" class="vncell"><?=gettext("Description"); ?></td>
324 5b237745 Scott Ullrich
                  <td width="78%" class="vtable"> 
325 dcdff6fa Colin Fleming
                    <input name="descr" type="text" class="formfld unknown" id="descr" size="40" value="<?=htmlspecialchars($pconfig['descr']);?>" />
326
                    <br/><span class="vexpl"><?=gettext("You may enter a description here for your reference (not parsed)."); ?></span></td>
327 5b237745 Scott Ullrich
                </tr>
328
                <tr>
329
                  <td width="22%" valign="top">&nbsp;</td>
330
                  <td width="78%"> 
331 dcdff6fa Colin Fleming
                    <input id="save" name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" /> <input id="cancel" type="button" value="<?=gettext("Cancel"); ?>" class="formbtn"  onclick="history.back()" />
332 5b237745 Scott Ullrich
                    <?php if (isset($id) && $a_routes[$id]): ?>
333 dcdff6fa Colin Fleming
                    <input name="id" type="hidden" value="<?=htmlspecialchars($id);?>" />
334 5b237745 Scott Ullrich
                    <?php endif; ?>
335
                  </td>
336
                </tr>
337
              </table>
338
</form>
339 38936dc7 Ermal Lu?i
<script type="text/javascript">
340 dcdff6fa Colin Fleming
//<![CDATA[
341 38936dc7 Ermal Lu?i
					var gatewayip;
342
					var name;
343
					function show_add_gateway() {
344
						document.getElementById("addgateway").style.display = '';
345
						document.getElementById("addgwbox").style.display = 'none';
346
						document.getElementById("gateway").style.display = 'none';
347
						document.getElementById("save").style.display = 'none';
348
						document.getElementById("cancel").style.display = 'none';
349
						document.getElementById("gwsave").style.display = '';
350
						document.getElementById("gwcancel").style.display = '';
351 300e2c0b Vinicius Coque
						jQuery('#notebox').html("");
352 38936dc7 Ermal Lu?i
					}
353
					function hide_add_gateway() {
354
						document.getElementById("addgateway").style.display = 'none';
355
						document.getElementById("addgwbox").style.display = '';	
356
						document.getElementById("gateway").style.display = '';
357
						document.getElementById("save").style.display = '';
358
						document.getElementById("cancel").style.display = '';
359
						document.getElementById("gwsave").style.display = '';
360
						document.getElementById("gwcancel").style.display = '';
361
					}
362
					function hide_add_gatewaysave() {
363
						document.getElementById("addgateway").style.display = 'none';
364 300e2c0b Vinicius Coque
						jQuery('#status').html('<img src="/themes/metallic/images/misc/loader.gif"> One moment please...');
365
						var iface = jQuery('#addinterfacegw').val();
366
						name = jQuery('#name').val();
367
						var descr = jQuery('#gatewaydescr').val();
368
						gatewayip = jQuery('#gatewayip').val();
369
						addrtype = jQuery('#addrtype').val();
370 a980df9c Ermal
						var defaultgw = '';
371 300e2c0b Vinicius Coque
						if (jQuery('#defaultgw').checked)
372 a980df9c Ermal
							defaultgw = 'yes';
373 38936dc7 Ermal Lu?i
						var url = "system_gateways_edit.php";
374
						var pars = 'isAjax=true&defaultgw=' + escape(defaultgw) + '&interface=' + escape(iface) + '&name=' + escape(name) + '&descr=' + escape(descr) + '&gateway=' + escape(gatewayip) + '&type=' + escape(addrtype);
375 300e2c0b Vinicius Coque
						jQuery.ajax(
376 38936dc7 Ermal Lu?i
							url,
377
							{
378 300e2c0b Vinicius Coque
								type: 'post',
379
								data: pars,
380
								error: report_failure,
381
								complete: save_callback
382
							});
383 38936dc7 Ermal Lu?i
					}
384
					function addOption(selectbox,text,value)
385
					{
386
						var optn = document.createElement("OPTION");
387
						optn.text = text;
388
						optn.value = value;
389 300e2c0b Vinicius Coque
						selectbox.append(optn);
390
						selectbox.prop('selectedIndex',selectbox.children('option').length-1);
391 dcdff6fa Colin Fleming
						jQuery('#notebox').html("<p><strong><?=gettext("NOTE:");?><\/strong> <?php printf(gettext("You can manage Gateways %shere%s."), "<a target='_blank' href='system_gateways.php'>", "<\/a>");?> <\/strong><\/p>");
392 38936dc7 Ermal Lu?i
					}				
393
					function report_failure() {
394 ea53e38f Renato Botelho
						alert("<?=gettext("Sorry, we could not create your gateway at this time."); ?>");
395 38936dc7 Ermal Lu?i
						hide_add_gateway();
396
					}
397
					function save_callback(transport) {
398
						var response = transport.responseText;
399
						if (response) {
400
							document.getElementById("addgateway").style.display = 'none';
401
							hide_add_gateway();
402 300e2c0b Vinicius Coque
							jQuery('#status').html('');
403
							addOption(jQuery('#gateway'), name, name);
404 38936dc7 Ermal Lu?i
						} else {
405
							report_failure();
406
						}
407
					}
408 4dfd930e Darren Embry
					var addressarray = <?= json_encode(get_alias_list(array("host", "network"))) ?>;
409 f898c1a9 jim-p
					var oTextbox1 = new AutoSuggestControl(document.getElementById("network"), new StateSuggestions(addressarray));
410 dcdff6fa Colin Fleming
//]]>
411 38936dc7 Ermal Lu?i
				</script>
412 5b237745 Scott Ullrich
<?php include("fend.inc"); ?>
413
</body>
414
</html>