newly created node can be declared 'reservable'
[www-register-wizard.git] / application / views / stage3_node_choose.php
1 <?php
2 if( isset($errors) && count($errors) > 0 )
3 {
4 }
5 ?>
6 <script language="javascript">
7 function initNodeTypeFields() {
8   var regular=document.getElementById("regular_checked");
9   var reservable=document.getElementById("reservable_checked");
10   if ( regular.checked || reservable.checked) return;
11   regular.checked=true;
12 }
13 function updateMethodFields() {
14   var dhcp=document.getElementById("dhcp_checked");
15   var static=document.getElementById("static_checked");
16   // set dhcp as default
17   if ( ! dhcp.checked && ! static.checked) dhcp.checked=true;
18   var is_dhcp=dhcp.checked;
19
20   document.fm.netmask.disabled= is_dhcp;
21   document.fm.network.disabled= is_dhcp;
22   document.fm.gateway.disabled= is_dhcp;
23   document.fm.broadcast.disabled= is_dhcp;
24   document.fm.dns1.disabled= is_dhcp;
25   document.fm.dns2.disabled= is_dhcp;
26 }
27 </script>
28 <div class="plroundedconfirm">
29 <?= form_open("register/stage4_confirmnode/$pcu_id/$site_id") ?>
30                 <table border=0 cellpadding=3>
31                         <tbody>
32
33                 <?php if ( isset($error) ): ?>
34               <p><strong>The following errors occured:</strong>
35               <font color='red' size='-1'><ul>
36                         <li><?php echo $error ?></li>
37               </ul></font>
38         <?php else: ?>
39                                 <tr><td colspan='2'><h3>Choose a Node to Associate with PCU</h3></td></tr>
40
41                                         <tr><th>Node Name: </th><td>
42                                                         <select name='node_id'>
43                                                                         <option value='0'>--</option>
44                                                         <?php foreach ( $node_list as $node): ?>
45                                                                         <option value='<?= $node->data['node_id'] ?>' <?= ( $this->node_id == $node->data['node_id'] ? "selected" : "" ) ?>>
46                                                                                 <?= $node->hostname ?>
47                                                                         </option>
48                                                         <?php endforeach; ?>
49                                                         </select>
50                                                 </td>
51                                                 <td>
52                                                 </td>
53                                 <tr><td></td>
54                                         <td>
55                                                 <input type=submit name='node_choose' value='Continue'>
56                                         </td>
57                                 </tr>
58                                         </tr>
59                 <?php endif; ?>
60                         </tbody>
61                         </table>
62         </form>
63 </div>
64 <br>
65 <div class="plroundedupdate">
66                 <table border=0 cellpadding=3>
67                         <tbody>
68 <?php if ( !isset($node_id) || $node_id == 0 || !isset($interface_id) || $interface_id == 0): ?>
69 <?= form_open("register/stage3_addnode/$pcu_id/$site_id", array('name'=>'fm', 'method'=>'post')) ?>
70                 <tr><td colspan='2'><h3>Or, Add a Node</h3></td></tr>
71                                         <tr><th>Site: </th><td><?= $site['name'] ?></td>
72                                         </tr>
73                                 <tr>
74                                         <th width=200>Hostname</td>
75                                         <td><input type="text" name="hostname" value="<?= $this->validation->hostname ?>" 
76                                                                 size="40" maxlength="256">
77                                                 <?= ( $this->disp_errors ? $this->validation->hostname_error : "")  ?>
78                                         </td>
79                                 </tr>
80                                 <tr>
81                                         <th valign='top' width="200">Node Type</th>
82                                         <td>
83                                                 <input type="radio" name="node_type" value="regular" id="regular_checked"
84                                                 <?= ( $this->validation->node_type == 'regular' ? "checked" : "" ) ?>>regular 
85                                                 <input type="radio" name="node_type" value="reservable" id="reservable_checked"
86                                                 <?= ( $this->validation->node_type == 'reservable' ? "checked" : "" ) ?>>reservable 
87                                         </td>
88                                 </tr>
89                                 <tr>
90                                         <th>Model</td>
91                                         <td>
92                                                 <input type="text" name="model" value="<?= $this->validation->model ?>" 
93                                                                 size="40" maxlength="256">
94                                                 <?= ( $this->disp_errors ? $this->validation->model_error : "")  ?>
95                                         </td>
96                                 </tr>
97
98
99
100                                 <tr>
101                                         <td colspan=2> <h3>Network Settings</h3> </td>
102                                 </tr>
103
104                                 <tr>
105                                         <th valign='top' width="200">Addressing Method</th>
106                                         <td>
107                                                 <input type="radio" name="method" value="dhcp" id="dhcp_checked" onChange='updateMethodFields()'
108                                                 <?= ( $this->validation->method == 'dhcp' ? "checked" : "" ) ?>>DHCP 
109                                                 <input type="radio" name="method" value="static" id='static_checked' onChange='updateMethodFields()'
110                                                 <?= ( $this->validation->method == 'static' ? "checked" : "" ) ?>>Static 
111                                         </td>
112                                 </tr>
113
114                                 <tr><th valign='top'>IP Address</td>
115                                         <td><input type="text" name="ip" value="<?= $this->validation->ip ?>">
116                                                 <?= ( $this->disp_errors ? $this->validation->ip_error : "")  ?>
117                                         </td>
118                                 </tr>
119
120                                 <tr> 
121                                         <th valign='top'>Netmask</font></td>
122                                         <td><input type="text" name="netmask" value="<?= $this->validation->netmask ?>">
123                                                 <?= ( $this->disp_errors ? $this->validation->netmask_error : "")  ?>
124                                         </td>
125                                 </tr>
126
127                                 <tr> 
128                                         <th valign='top'>Network address</td>
129                                         <td><input type="text" name="network" value="<?= $this->validation->network ?>">
130                                                 <?= ( $this->disp_errors ? $this->validation->network_error : "")  ?>
131                                         </td>
132                                 </tr>
133
134                                 <tr> 
135                                         <th valign='top'>Gateway Address</td>
136                                         <td><input type="text" name="gateway" value="<?= $this->validation->gateway ?>">
137                                                 <?= ( $this->disp_errors ? $this->validation->gateway_error : "")  ?>
138                                         </td>
139                                 </tr>
140
141                                 <tr> 
142                                         <th valign='top'>Broadcast address</td>
143                                         <td><input type="text" name="broadcast" value="<?= $this->validation->broadcast ?>">
144                                                 <?= ( $this->disp_errors ? $this->validation->broadcast_error : "")  ?>
145                                         </td>
146                                 </tr>
147
148                                 <tr> 
149                                         <th valign='top'>Primary DNS</td>
150                                         <td><input type="text" name="dns1" value="<?= $this->validation->dns1 ?>">
151                                                 <?= ( $this->disp_errors ? $this->validation->dns1_error : "")  ?>
152                                         </td>
153                                 </tr>
154
155                                 <tr>
156                                         <th valign='top'>Secondary DNS</td>
157                                         <td><input type="text" name="dns2" value="<?= $this->validation->dns2 ?>">
158                                                 <?= ( $this->disp_errors ? $this->validation->dns2_error : "")  ?>
159                                                 (optional)
160                                         </td>
161                                 </tr>
162
163                                 <tr><td></td>
164                                         <td>
165                                                 <input type=hidden name='pcu_id' value='<?= $pcu_id ?>'>
166                                                 <input type=hidden name='site_id' value='<?= $site_id ?>'>
167                                                 <input type=submit name='register_node' value='Add New Node'>
168                                         </td>
169                                 </tr>
170                 </tbody>
171         </table>
172 <?php else: ?>
173         <table border=0 cellpadding=3>
174                 <tbody>
175                         <tr><td></td><td><h3>Node Added Successfully!!!!</h3></td></tr>
176                         <?php if ( isset($errors) and ! empty ($errors) ): ?>
177                                 <?php foreach ( $errors as $error ): ?>
178                                         <tr><td></td><td><?= $error ?></td></tr>
179                                 <?php endforeach; ?>
180                         <?php endif; ?>
181                 </tbody>
182         </table>
183 <?php endif; ?>
184 </div>
185         <br /><p>
186                         <a href='/db/sites/index.php?id=<?= $default_site_list[0] ?>'>Back to Home Site</a>
187         
188         </form>
189 <script language="javascript">
190 initNodeTypeFields();
191 updateMethodFields();
192 </script>