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