more tweaks for reservable nodes, and other bugfixes
[www-register-wizard.git] / application / views / stage4_node_confirm.php
index dbb4a78..fecf5fd 100644 (file)
@@ -1,4 +1,6 @@
 <?php
+require_once 'plc_functions.php';
+
 if( isset($errors) && count($errors) > 0 )
 {
   print( "<p><strong>The following errors occured:</strong>" );
@@ -11,9 +13,19 @@ if( isset($errors) && count($errors) > 0 )
 }
 ?>
 <script language="javascript">
-function updateStaticFields()
-{
-  var is_dhcp= document.fm.method[0].checked;
+function initNodeTypeFields() {
+  var regular=document.getElementById("regular_checked");
+  var reservable=document.getElementById("reservable_checked");
+  if ( regular.checked || reservable.checked) return;
+  window.console.log('initNodeTypeFields is setting regular mode');
+  regular.checked=true;
+}
+function updateMethodFields() {
+  var dhcp=document.getElementById("dhcp_checked");
+  var static=document.getElementById("static_checked");
+  // set dhcp as default
+  if ( ! dhcp.checked && ! static.checked) dhcp.checked=true;
+  var is_dhcp=dhcp.checked;
 
   document.fm.netmask.disabled= is_dhcp;
   document.fm.network.disabled= is_dhcp;
@@ -29,7 +41,7 @@ function updateStaticFields()
                <table border=0 cellpadding=3>
                        <tbody>
                                <tr><td colspan='2'>
-Please review the information below, and if it is correct, the Proceed to then
+Please review the information below, and if it is correct, then Proceed to the
 next stage.  Otherwise, please Update the information as appropriate.
                                </td></tr>
                                <tr><td></td>
@@ -47,25 +59,34 @@ next stage.  Otherwise, please Update the information as appropriate.
                        </table>
        </form>
 </div>
+
 <br>
 <div class="plroundedupdate">
 <?= form_open("register/stage4_confirmnode/$pcu_id/$site_id/$node_id", array('name'=>'fm', 'method'=>'post')) ?>
                <table border=0 cellpadding=3>
                        <tbody>
-               <tr><td colspan='2'>
-               </td></tr>
+               <tr><td colspan='2'> </td></tr>
                <?php if ( !empty($site) ) 
                        { ?>
                                        <tr><th>Site: </th><td> <?= $site['name'] ?> </td>
                                        </tr>
                <?php } ?>
                                <tr>
-                               </tr>
                                        <th width=200>Hostname:</td>
                                        <td><input type="text" name="hostname" value="<?= $node->hostname ?>" 
                                                                size="40" maxlength="256">
                                                <?= ( $this->disp_errors ? $this->validation->hostname_error : "")  ?>
                                        </td>
+                               </tr>
+                               <tr>
+                                       <th valign='top' width="200">Node Type</th>
+                                       <td>
+                                               <input type="radio" name="node_type" value="regular" id="regular_checked"
+                                               <?= ( $node->node_type == 'regular' ? "checked" : "" ) ?>>regular 
+                                               <input type="radio" name="node_type" value="reservable" id="reservable_checked"
+                                               <?= ( $node->node_type == 'reservable' ? "checked" : "" ) ?>>reservable 
+                                       </td>
+                               </tr>
                                <tr>
                                        <th>Model:</th>
                                        <td>
@@ -74,17 +95,18 @@ next stage.  Otherwise, please Update the information as appropriate.
                                                <?= ( $this->disp_errors ? $this->validation->model_error : "")  ?>
                                        </td>
                                </tr>
+
                                <tr>
                                        <th valign='top' width="200">Addressing Method</th>
                                        <td>
-                                               <input type="radio" name="method" value="dhcp" onChange='updateStaticFields()'
+                                               <input type="radio" name="method" value="dhcp" id="dhcp_checked" onChange='updateMethodFields()'
                                                <?= ( $node->method == 'dhcp' ? "checked" : "" ) ?>>DHCP 
-                                               <input type="radio" name="method" value="static" onChange='updateStaticFields()'
+                                               <input type="radio" name="method" value="static" id='static_checked' onChange='updateMethodFields()'
                                                <?= ( $node->method == 'static' ? "checked" : "" ) ?>>Static 
                                        </td>
                                </tr>
-
-                               <tr><th valign='top'>IP Address</th>
+                               <tr>
+                                       <th valign='top'>IP Address</th>
                                        <td><input type="text" name="ip" value="<?= $node->ip ?>">
                                                <?= ( $this->disp_errors ? $this->validation->ip_error : "")  ?>
                                        </td>
@@ -149,5 +171,6 @@ next stage.  Otherwise, please Update the information as appropriate.
        
        </form>
 <script language="javascript">
-updateStaticFields();
+initNodeTypeFields();
+updateMethodFields();
 </script>