root/modules/branches/2.2/inventorydb/page.inventorydb.php

Revision 2570, 9.2 kB (checked in by qldrob, 7 years ago)

More fixes

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
  • Property svn:executable set to *
Line 
1
2 <?php
3 //inventoryDB 1.0.0 written by Richard Neese 2006-05-24
4 //Copyright (C) 2006 Richard Neese (r.neese@gmail.com)
5 //
6 //This program is free software; you can redistribute it and/or
7 //modify it under the terms of the GNU General Public License
8 //as published by the Free Software Foundation; either version 2
9 //of the License, or (at your option) any later version.
10 //
11 //This program is distributed in the hope that it will be useful,
12 //but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 //GNU General Public License for more details.
15
16 //Set all the vars so there arent a ton of errors in the httpd error_log
17
18 $display = isset($_REQUEST['display'])?$_REQUEST['display']:'inventorydb';
19 $extdisplay = isset($_REQUEST['extdisplay'])?$_REQUEST['extdisplay']]:'';
20 $type = isset($_REQUEST['type'])?$_REQUEST['type']:'setup';
21 $action = isset($_REQUEST['action'])?$_REQUEST['action']:'';
22 $empnum = isset($_REQUEST['empnum'])?$_REQUEST['empnum']:'';
23 $empname = isset($_REQUEST['empname'])?$_REQUEST['empname']:'';
24 $building = isset($_REQUEST['building'])?$_REQUEST['building']:'';
25 $floor = isset($_REQUEST['floor'])?$_REQUEST['floor']:'';
26 $room = isset($_REQUEST['room'])?$_REQUEST['room']:'';
27 $section = isset($_REQUEST['section'])?$_REQUEST['section']:'';
28 $cubicle = isset($_REQUEST['cubicle'])?$_REQUEST['cubicle']:'';
29 $desk = isset($_REQUEST['desk'])?$_REQUEST['desk']:'';
30 $exten = isset($_REQUEST['exten'])?$_REQUEST['exten']:'';
31 $phusername = isset($_REQUEST['phusername'])?$_REQUEST['phusername']:'';
32 $phpassword = isset($_REQUEST['phpassword'])?$_REQUEST['phpassword']:'';
33 $mac = isset($_REQUEST['mac'])?$_REQUEST['mac']:'';
34 $serial = isset($_REQUEST['serial'])?$_REQUEST['serial']:'';
35 $device = isset($_REQUEST['device'])?$_REQUEST['device']:'';
36 $distdate = isset($_REQUEST['distdate'])?$_REQUEST['distdate']:'';
37 $ip = isset($_REQUEST['ip'])?$_REQUEST['ip']:'';
38 $pbxbox = isset($_REQUEST['pbxbox'])?$_REQUEST['pbxbox']:'';
39 $extrainfo = isset($_REQUEST['extrainfo'])?$_REQUEST['extrainfo']:'';
40
41 include 'common/php-asmanager.php';
42
43 extract($_REQUEST);
44
45 $dispnum='inventorydb';
46
47 if(!isset($action))
48   $action='';
49 switch($action) {
50   case "add":
51     inventorydb_add($empnum, $empname, $building, $floor, $room, $section, $cubicle, $desk, $exten, $phusername, $phpassword, $mac, $serial, $device, $distdate, $ip, $pbxbox, $extrainfo);
52     $empnum='';
53     $empname='';
54     $building='';
55     $floor='';
56     $room='';
57     $section='';
58     $cubicle='';
59     $desk='';
60     $exten='';
61     $phusername='';
62     $phpassword='';
63     $mac='';
64     $serial='';
65     $device='';
66     $distdate='';
67     $ip='';
68     $pbxbox='';
69     $extrainfo='';
70     //needreload();
71     //right now... not writing config files... don't need to reload
72   break;
73   case "del":
74     inventorydb_del($extdisplay);
75     //needreload();
76   break;
77   case "edit":
78     inventorydb_edit($extdisplay, $empnum, $empname, $building, $floor, $room, $section, $cubicle, $desk, $exten, $phusername, phpassword, $mac, $serial, $device, $distdate, $ip, $pbxbox, $extrainfo);
79     //needreload();
80   break;
81
82 }
83 ?>
84 </div>
85 <div class="rnav">
86 <?php
87 $inventorys=inventorydb_list();
88 drawListMenu($inventorys, isset($_REQUEST['skip'])?$_REQUEST['skip']:0, $dispnum, isset($extdisplay)?$extdisplay:null, _("inventory"));
89 ?>
90 </div>
91
92
93 <div class="content">
94 <?php
95 if($action=='del'){
96   echo "<br><h3>ID ".$extdisplay." "._("deleted")."!</h3><br><Br><br><br><br><br><br>";
97 }
98 else if(!isset($extdisplay)) {
99
100
101   echo "<h2>Add a user</h2>";
102 //  echo "<li><a href=\"".$_SERVER['PHP_SELF']."?$action=add\";>Add</a><br>";
103
104 }
105 else {
106   $delURL = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&action=del&extdisplay=$extdisplay";
107
108   //If we have some data, load it up... this means we are editing.
109   if($extdisplay!=""){
110     $inventoryInfo=inventorydb_get($extdisplay);
111     $empnum=$inventoryInfo['empnum'];
112     $empname=$inventoryInfo['empname'];
113     $building=$inventoryInfo['building'];
114     $floor=$inventoryInfo['floor'];
115     $room=$inventoryInfo['room'];
116     $section=$inventoryInfo['section'];
117     $cubicle=$inventoryInfo['cubicle'];
118     $desk=$inventoryInfo['desk'];
119     $exten=$inventoryInfo['exten'];
120     $phusername=$inventoryInfo['phusername'];
121     $phpassword=$inventoryInfo['phpassword'];
122     $mac=$inventoryInfo['mac'];
123     $serial=$inventoryInfo['serial'];
124     $device=$inventoryInfo['device'];
125     $distdate=$inventoryInfo['distdate'];   
126     $ip=$inventoryInfo['ip'];
127     $pbxbox=$inventoryInfo['pbxbox'];
128     $extrainfo=$inventoryInfo['extrainfo'];
129   }
130
131   if(is_array($inventoryInfo)){
132     $action="edit";
133     echo "<h2> ".$extdisplay." ".$empname."</h2>";
134     echo "<p><a href=\"".$delURL."\">Delete inventory</a></p>";
135   }
136   else {
137     echo "<h2>Add inventory</h2>";
138   }
139
140 }
141
142 echo "<form name=\"addNew\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" onsubmit=\"return addNew_onsubmit();\">";
143 echo "<input type=hidden name=extdisplay value=$extdisplay>\n";
144 echo "<input type=hidden name=action value=\"";
145 echo ($action=="" ? "add" : $action);
146 echo "\">\n";
147 echo "<input type=hidden name=display value=\"inventorydb\">";
148
149 echo "<table>";
150
151 echo "<tr><td colspan=2><h5>";
152 echo ($extdisplay ? _('Edit inventory') : _('Add inventory'));
153 echo "</h5></td></tr>\n";
154
155 //empnum
156 echo "<tr ";
157 echo ($extdisplay ? '' : '');
158 echo "><td>";
159 echo "<a href=\"#\" class=\"info\">Employee #\n";
160 echo "<span>Employee Number</span></a>\n";
161 echo "</td><td>\n";
162 echo "<input name=\"empnum\" value=\"$empnum\">\n";
163 echo "</td></tr>\n";
164
165 //empname
166 echo "<tr><td>\n";
167 echo "<a href=\"#\" class=\"info\">Employee Name\n";
168 echo "<span>Employee Name</span></a>\n";
169 echo "</td>";
170 echo "<td>";
171 echo "<input type=text name=\"empname\" value=\"$empname\">\n";
172 echo "</td></tr>\n";
173
174 //building
175 echo "<tr><td>\n";
176 echo "<a href=\"#\" class=\"info\">Building Located\n";
177 echo "<span>Building where the phone is located</span></a>\n";
178 echo "</td><td>\n";
179 echo "<input name=\"building\" value=\"$building\"\n";
180 echo "</td></tr>\n";
181
182 //floor
183 echo "<tr><td>\n";
184 echo "<a href=\"#\" class=\"info\">Floor #\n";
185 echo "<span>Floor # phone is on</span></a>\n";
186 echo "</td><td>\n";
187 echo "<input name=\"floor\" value=\"$floor\">\n";
188 echo "</td><tr>\n";
189
190 //room
191 echo "<tr><td>\n";
192 echo "<a href=\"#\" class=\"info\">Room #\n";
193 echo "<span>Room phone is in</span></a>\n";
194 echo "</td><td>\n";
195 echo "<input name=\"room\" value=\"$room\">\n";
196 echo "</td></tr>\n";
197
198 //section
199 echo "<tr><td>\n";
200 echo "<a href=\"#\" class=\"info\">Floor Section #\n";
201 echo "<span>Floor Section # the phone is in</span></a>\n";
202 echo "</td><td>\n";
203 echo "<input name=\"section\" value=\"$section\">\n";
204 echo "</td></tr>\n";
205
206 //cubicle
207 echo "<tr><td>\n";
208 echo "<a href=\"#\" class=\"info\">Cubicle #\n";
209 echo "<span>Cubicle phone is in</span></a>\n";
210 echo "</td><td>\n";
211 echo "<input name=\"cubicle\" value=\"$cubicle\">\n";
212 echo "</td></tr>\n";
213
214 //desk
215 echo "<tr><td>\n";
216 echo "<a href=\"#\" class=\"info\">Desk #\n";
217 echo "<span>Desk Number phone is on</span></a>\n";
218 echo "</td><td>\n";
219 echo "<input name=\"desk\" value=\"$desk\">\n";
220 echo "</td></tr>\n";
221
222 //exten
223 echo "<tr><td>\n";
224 echo "<a href=\"#\" class=\"info\">Extension #\n";
225 echo "<span>Exten Assigned to the phone</span></a>\n";
226 echo "</td><td>\n";
227 echo "<input name=\"exten\" value=\"$exten\">\n";
228 echo "</td></tr>\n";
229
230 //phusername
231 echo "<tr><td>\n";
232 echo "<a href=\"#\" class=\"info\">Phone UserName\n";
233 echo "<span>Phone Admin Username</span></a>\n";
234 echo "</td><td>\n";
235 echo "<input name=\"phusername\" value=\"$phusername\">\n";
236 echo "</td></tr>\n";
237
238 //phpassword
239 echo "<tr><td>\n";
240 echo "<a href=\"#\" class=\"info\">Phone Password\n";
241 echo "<span>Phone Admin Password </span></a>\n";
242 echo "</td><td>\n";
243 echo "<input name=\"phpassword\" value=\"$phpassword\">\n";
244 echo "</td></tr>\n";
245
246 //mac
247 echo "<tr><td>\n";
248 echo "<a href=\"#\" class=\"info\">MAC Address\n";
249 echo "<span>MAC Address of phone</span></a>\n";
250 echo "</td><td>\n";
251 echo "<input name=\"mac\" value=\"$mac\">\n";
252 echo "</td></tr>\n";
253
254 //Serial
255 echo "<tr><td>\n";
256 echo "<a href=\"#\" class=\"info\">Serial #\n";
257 echo "<span>Serial Number of the phone</span></a>\n";
258 echo "</td><td>\n";
259 echo "<input name=\"serial\" value=\"$serial\">\n";
260 echo "</td></tr>\n";
261
262 //Device
263 echo "<tr><td>\n";
264 echo "<a href=\"#\" class=\"info\">Phone/Device\n";
265 echo "<span>Device <font size=-1>(example... Linksys PAP-2, Sipura)</font></span></a>\n";
266 echo "</td><td>\n";
267 echo "<input type=text name=\"device\" value=\"$device\">\n";
268 echo "</td></tr>\n";
269
270 //DistDate
271 echo "<tr><td>\n";
272 echo "<a href=\"#\" class=\"info\">Distributed Date\n";
273 echo "<span>Distribution Date</font></span></a>\n";
274 echo "</td><td>\n";
275 echo "<input name=\"distdate\" value=\"$distdate\">\n";
276 echo "</td></tr>\n";
277
278 //IP
279 echo "<tr><td>\n";
280 echo "<a href=\"#\" class=\"info\">IP Address\n";
281 echo "<span>IP Address Assigned If not DHCP</font></span></a>\n";
282 echo "</td><td>\n";
283 echo "<input name=\"ip\" value=\"$ip\">\n";
284 echo "</td></tr>\n";
285
286 //pbxbox
287 echo "<tr><td>\n";
288 echo "<a href=\"#\" class=\"info\">PBX Box Name\n";
289 echo "<span>PBX Box Name</span></a>\n";
290 echo "</td><td>\n";
291 echo "<input type=text name=\"pbxbox\" value=\"$pbxbox\">\n";
292 echo "</td></tr>\n";
293
294 //extrainfo
295 echo "<tr><td>\n";
296 echo "<a href=\"#\" class=\"info\">Extra Info\n";
297 echo "<span>Extra Information</span></span></a>\n";
298 echo "</td><td>\n";
299 echo "<input name=\"extrainfo\" value=\"$extrainfo\">\n";
300 echo "</td></tr>\n";
301
302
303 ?>
304 <tr><td></td><td><input type=submit Value="Submit Changes"></td></tr></table>
305
306 </script>
307
308
309
310 </form>
Note: See TracBrowser for help on using the browser.