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

Revision 3829, 9.3 kB (checked in by naftali5, 6 years ago)

Merged revisions 3828 via svnmerge from
https://amportal.svn.sourceforge.net/svnroot/amportal/modules/branches/2.2

........

r3828 | naftali5 | 2007-02-26 15:30:20 -0500 (Mon, 26 Feb 2007) | 1 line


fix #1783 let inventorydb display page by setting type to tool

........

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