more tweaks for reservable nodes, and other bugfixes
[www-register-wizard.git] / application / views / stage4_node_confirm.php
1 <?php
2 require_once 'plc_functions.php';
3
4 if( isset($errors) && count($errors) > 0 )
5 {
6   print( "<p><strong>The following errors occured:</strong>" );
7   print( "<font color='red' size='-1'><ul>\n" );
8   foreach( $errors as $err )
9     {
10       print( "<li>$err\n" );
11     }
12   print( "</ul></font>\n" );
13 }
14 ?>
15 <script language="javascript">
16 function initNodeTypeFields() {
17   var regular=document.getElementById("regular_checked");
18   var reservable=document.getElementById("reservable_checked");
19   if ( regular.checked || reservable.checked) return;
20   window.console.log('initNodeTypeFields is setting regular mode');
21   regular.checked=true;
22 }
23 function updateMethodFields() {
24   var dhcp=document.getElementById("dhcp_checked");
25   var static=document.getElementById("static_checked");
26   // set dhcp as default
27   if ( ! dhcp.checked && ! static.checked) dhcp.checked=true;
28   var is_dhcp=dhcp.checked;
29
30   document.fm.netmask.disabled= is_dhcp;
31   document.fm.network.disabled= is_dhcp;
32   document.fm.gateway.disabled= is_dhcp;
33   document.fm.broadcast.disabled= is_dhcp;
34   document.fm.dns1.disabled= is_dhcp;
35   document.fm.dns2.disabled= is_dhcp;
36 }
37 </script>
38 <div class="plroundedconfirm">
39 <h3>Confirm Node Information</h3>
40 <?= form_open("register/stage45_mappcu/$pcu_id/$site_id/$node_id", array('method'=>'post')) ?>
41                 <table border=0 cellpadding=3>
42                         <tbody>
43                                 <tr><td colspan='2'>
44 Please review the information below, and if it is correct, then Proceed to the
45 next stage.  Otherwise, please Update the information as appropriate.
46                                 </td></tr>
47                                 <tr><td></td>
48                                         <td>
49                                         <center>
50                                                 <input type=hidden name='pcu_id' value='<?= $pcu_id ?>'>
51                                                 <input type=hidden name='node_id' value='<?= $node_id ?>'>
52                                                 <input type=hidden name='site_id' value='<?= $site_id ?>'>
53                                                 <input type=submit name='node_confirm' value='Confirm & Proceed'>
54                                         </center>
55                                         </td>
56                                 </tr>
57                                         </tr>
58                         </tbody>
59                         </table>
60         </form>
61 </div>
62
63 <br>
64 <div class="plroundedupdate">
65 <?= form_open("register/stage4_confirmnode/$pcu_id/$site_id/$node_id", array('name'=>'fm', 'method'=>'post')) ?>
66                 <table border=0 cellpadding=3>
67                         <tbody>
68                 <tr><td colspan='2'> </td></tr>
69                 <?php if ( !empty($site) ) 
70                         { ?>
71                                         <tr><th>Site: </th><td> <?= $site['name'] ?> </td>
72                                         </tr>
73                 <?php } ?>
74                                 <tr>
75                                         <th width=200>Hostname:</td>
76                                         <td><input type="text" name="hostname" value="<?= $node->hostname ?>" 
77                                                                 size="40" maxlength="256">
78                                                 <?= ( $this->disp_errors ? $this->validation->hostname_error : "")  ?>
79                                         </td>
80                                 </tr>
81                                 <tr>
82                                         <th valign='top' width="200">Node Type</th>
83                                         <td>
84                                                 <input type="radio" name="node_type" value="regular" id="regular_checked"
85                                                 <?= ( $node->node_type == 'regular' ? "checked" : "" ) ?>>regular 
86                                                 <input type="radio" name="node_type" value="reservable" id="reservable_checked"
87                                                 <?= ( $node->node_type == 'reservable' ? "checked" : "" ) ?>>reservable 
88                                         </td>
89                                 </tr>
90                                 <tr>
91                                         <th>Model:</th>
92                                         <td>
93                                                 <input type="text" name="model" value="<?= $node->model ?>" 
94                                                                 size="40" maxlength="256">
95                                                 <?= ( $this->disp_errors ? $this->validation->model_error : "")  ?>
96                                         </td>
97                                 </tr>
98
99                                 <tr>
100                                         <th valign='top' width="200">Addressing Method</th>
101                                         <td>
102                                                 <input type="radio" name="method" value="dhcp" id="dhcp_checked" onChange='updateMethodFields()'
103                                                 <?= ( $node->method == 'dhcp' ? "checked" : "" ) ?>>DHCP 
104                                                 <input type="radio" name="method" value="static" id='static_checked' onChange='updateMethodFields()'
105                                                 <?= ( $node->method == 'static' ? "checked" : "" ) ?>>Static 
106                                         </td>
107                                 </tr>
108                                 <tr>
109                                         <th valign='top'>IP Address</th>
110                                         <td><input type="text" name="ip" value="<?= $node->ip ?>">
111                                                 <?= ( $this->disp_errors ? $this->validation->ip_error : "")  ?>
112                                         </td>
113                                 </tr>
114
115                                 <tr> 
116                                         <th valign='top'>Netmask</font></th>
117                                         <td><input type="text" name="netmask" value="<?= $node->netmask ?>">
118                                                 <?= ( $this->disp_errors ? $this->validation->netmask_error : "")  ?>
119                                         </td>
120                                 </tr>
121
122                                 <tr> 
123                                         <th valign='top'>Network address</th>
124                                         <td><input type="text" name="network" value="<?= $node->network ?>">
125                                                 <?= ( $this->disp_errors ? $this->validation->network_error : "")  ?>
126                                         </td>
127                                 </tr>
128
129                                 <tr> 
130                                         <th valign='top'>Gateway Address</th>
131                                         <td><input type="text" name="gateway" value="<?= $node->gateway ?>">
132                                                 <?= ( $this->disp_errors ? $this->validation->gateway_error : "")  ?>
133                                         </td>
134                                 </tr>
135
136                                 <tr> 
137                                         <th valign='top'>Broadcast address</th>
138                                         <td><input type="text" name="broadcast" value="<?= $node->broadcast ?>">
139                                                 <?= ( $this->disp_errors ? $this->validation->broadcast_error : "")  ?>
140                                         </td>
141                                 </tr>
142
143                                 <tr> 
144                                         <th valign='top'>Primary DNS</th>
145                                         <td><input type="text" name="dns1" value="<?= $node->dns1 ?>">
146                                                 <?= ( $this->disp_errors ? $this->validation->dns1_error : "")  ?>
147                                         </td>
148                                 </tr>
149
150                                 <tr>
151                                         <th valign='top'>Secondary DNS</th>
152                                         <td><input type="text" name="dns2" value="<?= $node->dns2 ?>">
153                                                 <?= ( $this->disp_errors ? $this->validation->dns2_error : "")  ?>
154                                                 (optional)
155                                         </td>
156                                 </tr>
157
158                                 <tr><td></td>
159                                         <td>
160                                                 <input type=hidden name='pcu_id' value='<?= $pcu_id ?>'>
161                                                 <input type=hidden name='node_id' value='<?= $node_id ?>'>
162                                                 <input type=hidden name='site_id' value='<?= $site_id ?>'>
163                                                 <input type=submit name='node_update' value='Update & Return'> 
164                                         </td>
165                                 </tr>
166                         </tbody>
167                         </table>
168 </div>
169         <br /><p>
170                         <a href='/db/sites/index.php?id=<?= $site_id ?>'>Back to Home Site</a>
171         
172         </form>
173 <script language="javascript">
174 initNodeTypeFields();
175 updateMethodFields();
176 </script>