newly created node can be declared 'reservable'
[www-register-wizard.git] / application / views / stage3_node_choose.php
index 0330f39..abe54c7 100644 (file)
@@ -1,19 +1,21 @@
 <?php
 if( isset($errors) && count($errors) > 0 )
 {
-  print( "<p><strong>The following errors occured:</strong>" );
-  print( "<font color='red' size='-1'><ul>\n" );
-  foreach( $errors as $err )
-    {
-      print( "<li>$err\n" );
-    }
-  print( "</ul></font>\n" );
 }
 ?>
 <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;
+  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;
@@ -27,8 +29,15 @@ function updateStaticFields()
 <?= form_open("register/stage4_confirmnode/$pcu_id/$site_id") ?>
                <table border=0 cellpadding=3>
                        <tbody>
+
+               <?php if ( isset($error) ): ?>
+              <p><strong>The following errors occured:</strong>
+              <font color='red' size='-1'><ul>
+                       <li><?php echo $error ?></li>
+              </ul></font>
+        <?php else: ?>
                                <tr><td colspan='2'><h3>Choose a Node to Associate with PCU</h3></td></tr>
-               <?php if ( !empty($node_list) ): ?>
+
                                        <tr><th>Node Name: </th><td>
                                                        <select name='node_id'>
                                                                        <option value='0'>--</option>
@@ -56,36 +65,48 @@ function updateStaticFields()
 <div class="plroundedupdate">
                <table border=0 cellpadding=3>
                        <tbody>
-<?php if ( !isset($node_id) || $node_id == 0 ): ?>
+<?php if ( !isset($node_id) || $node_id == 0 || !isset($interface_id) || $interface_id == 0): ?>
 <?= form_open("register/stage3_addnode/$pcu_id/$site_id", array('name'=>'fm', 'method'=>'post')) ?>
                <tr><td colspan='2'><h3>Or, Add a Node</h3></td></tr>
                                        <tr><th>Site: </th><td><?= $site['name'] ?></td>
                                        </tr>
                                <tr>
-                                       <th width=200>Hostname:</td>
+                                       <th width=200>Hostname</td>
                                        <td><input type="text" name="hostname" value="<?= $this->validation->hostname ?>" 
                                                                size="40" maxlength="256">
                                                <?= ( $this->disp_errors ? $this->validation->hostname_error : "")  ?>
                                        </td>
                                </tr>
                                <tr>
-                                       <th>Model:</td>
+                                       <th valign='top' width="200">Node Type</th>
+                                       <td>
+                                               <input type="radio" name="node_type" value="regular" id="regular_checked"
+                                               <?= ( $this->validation->node_type == 'regular' ? "checked" : "" ) ?>>regular 
+                                               <input type="radio" name="node_type" value="reservable" id="reservable_checked"
+                                               <?= ( $this->validation->node_type == 'reservable' ? "checked" : "" ) ?>>reservable 
+                                       </td>
+                               </tr>
+                               <tr>
+                                       <th>Model</td>
                                        <td>
                                                <input type="text" name="model" value="<?= $this->validation->model ?>" 
                                                                size="40" maxlength="256">
                                                <?= ( $this->disp_errors ? $this->validation->model_error : "")  ?>
                                        </td>
                                </tr>
+
+
+
                                <tr>
-                                       <td> <b>Network Settings</b> </td>
+                                       <td colspan=2> <h3>Network Settings</h3> </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()'
                                                <?= ( $this->validation->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()'
                                                <?= ( $this->validation->method == 'static' ? "checked" : "" ) ?>>Static 
                                        </td>
                                </tr>
@@ -166,5 +187,6 @@ function updateStaticFields()
        
        </form>
 <script language="javascript">
-updateStaticFields();
+initNodeTypeFields();
+updateMethodFields();
 </script>