function l_sites_peer ($peer_id) { return "/db/sites/index.php?peerscope=$peer_id"; }
function l_site ($site_id) { return "/db/sites/index.php?id=$site_id"; }
function l_site_t ($site_id,$text) { return href (l_site($site_id),$text); }
-function l_site_update($site_id) { return "/xxx-undefined"; }
+function l_site_update($site_id) { return "/db/sites/site_update.php?site_id=$site_id"; }
function l_slices () { return "/db/slices/index.php"; }
function l_slices_peer ($peer_id) { return "/db/slices/index.php?peerscope=$peer_id"; }
function l_slice_add () { return "/db/slices/add_slice.php"; }
function l_slices_site($site_id) { return "/db/slices/index.php?site_id=$site_id"; }
// from an object
-function l_slice_text ($slice) { return l_slice_t ($slice['slice_id'],$slice['name']); }
+function l_slice_obj ($slice) { return l_slice_t ($slice['slice_id'],$slice['name']); }
function l_sliver ($node_id,$slice_id) { return "/db/nodes/slivers.php?node_id=$node_id&slice_id=$slice_id"; }
function l_sliver_t ($node_id,$slice_id,$text) {
<table width="100%" cellspacing="0" cellpadding="4" border="0">
<tr>
-<td valign='top' width="250">Addressing Method</td>
+<td valign='top' width="250">Addressing method</td>
<td>
<input type="radio" name="method" value="dhcp" onChange='updateStaticFields()'
<?php if($method == 'dhcp') { echo "checked"; } ?>>DHCP
</tr>
<tr>
-<td valign='top'>IP Address</td>
+<td valign='top'>IP address</td>
<td><input type="text" name="ip" value="<?php print($ip); ?>"></td>
</tr>
</tr>
<tr>
-<td valign='top'>Gateway Address</td>
+<td valign='top'>Gateway address</td>
<td><input type="text" name="gateway" value="<?php print($gateway); ?>"></td>
</tr>
$_roles= $_person['role_ids'];
// redirect if no site id is set add instead
-if( !$_GET['id'] )
- $do= 'Add';
-else {
- $site_id= $_GET['id'];
+if( $_GET['site_id'] ) {
+ $site_id= $_GET['site_id'];
$do= 'Update';
-}
+ } else {
+ $do= 'Add';
+ }
// if form not submitted get data from API
if( $_POST['submitted'] ) {
// if no errors add/update site
- if( $do == 'Add' ) {
- $fields= array( "name" => $name, "url" => $url, "longitude" => floatval( $longitude ), "login_base" => $login_base, "latitude" => floatval( $latitude ), "is_public" => true, "abbreviated_name" => $abbrev_name, "max_slices" => 0 );
- $api->AddSite( $fields );
- //echo "<pre>"; print_r( $fields ); echo "</pre>";
+ if ( $do == 'Add' ) {
+ $fields= array( "name" => $name,
+ "abbreviated_name" => $abbrev_name,
+ "url" => $url,
+ "login_base" => $login_base,
+ "latitude" => floatval( $latitude ),
+ "longitude" => floatval( $longitude ),
+ "max_slices" => 0,
+ "is_public" => true);
+ $site_id=$api->AddSite( $fields );
+ plc_redirect(l_site($site_id));
}
- if( $do == 'Update' ) {
- $fields= array( "name" => $name, "url" => $url, "longitude" => floatval( $longitude ), "login_base" => $login_base, "latitude" => floatval( $latitude ), "is_public" => true, "abbreviated_name" => $abbrev_name, "max_slices" => intval( $max_slices ) );
+ if ( $do == 'Update' ) {
+ $fields= array( "name" => $name,
+ "abbreviated_name" => $abbrev_name,
+ "url" => $url,
+ "login_base" => $login_base,
+ "latitude" => floatval( $latitude ),
+ "longitude" => floatval( $longitude ),
+ "max_slices" => intval( $max_slices ),
+ "is_public" => true);
$api->UpdateSite( intval( $site_id ), $fields );
// Thierry aug 31 07 - redirect to the site's details page
plc_redirect(l_site($site_id));
$max_err= " style='border: 1px solid red;'";
// start form
+require_once 'plc_forms.php';
+
+plc_
echo "<form action='update_site.php?id=$site_id' method='post'>\n";
echo "<h2>$do $name</h2>\n";
echo "<tr><td></td><td colspan=2><input type=submit name='submitted' value='$do Site'></td></tr>\n";
echo "</tbody></table><br />\n";
-
-echo "<p><a href='index.php?id=$site_id'>Back to Site</a>\n";
-
echo "</form>\n";
+if ($do == "Update")
+ print href(l_site($site_id),"Back to site");
+ else
+ print href(l_sites(),"Back to sites");
+
// Print footer
include 'plc_footer.php';