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