root/contributed_modules/modules/inventorydb/page.inventorydb.php

Revision 10138, 11.0 kB (checked in by mickecarlsson, 2 years ago)

Removed executable bit from files in inventorydb

  • Property svn:mime-type set to text/plain
  • Property svn:eol-style set to native
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 // Dirty fix for localization
88 _("Add");
89 $inventorys=inventorydb_list();
90 drawListMenu($inventorys, $skip, $type, $dispnum, $extdisplay, _("inventory"));
91 ?>
92 </div>
93
94
95 <div class="content">
96 <?php
97 if($action=='del'){
98   echo "<br><h3>ID ".$extdisplay." "._("deleted")."!</h3><br><Br><br><br><br><br><br>";
99 }
100 else if(!isset($extdisplay)) {
101
102
103   echo "<h2>"._("Add a user")."</h2>";
104 //  echo "<li><a href=\"".$_SERVER['PHP_SELF']."?$action=add\";>Add</a><br>";
105
106 }
107 else {
108   $delURL = $_SERVER['PHP_SELF']."?".$_SERVER['QUERY_STRING']."&action=del&extdisplay=$extdisplay";
109
110   //If we have some data, load it up... this means we are editing.
111   if($extdisplay!=""){
112     $inventoryInfo=inventorydb_get($extdisplay);
113     $empnum=$inventoryInfo['empnum'];
114     $empname=$inventoryInfo['empname'];
115     $building=$inventoryInfo['building'];
116     $floor=$inventoryInfo['floor'];
117     $room=$inventoryInfo['room'];
118     $section=$inventoryInfo['section'];
119     $cubicle=$inventoryInfo['cubicle'];
120     $desk=$inventoryInfo['desk'];
121     $exten=$inventoryInfo['exten'];
122     $phusername=$inventoryInfo['phusername'];
123     $phpassword=$inventoryInfo['phpassword'];
124     $mac=$inventoryInfo['mac'];
125     $serial=$inventoryInfo['serial'];
126     $device=$inventoryInfo['device'];
127     $distdate=$inventoryInfo['distdate'];   
128     $ip=$inventoryInfo['ip'];
129     $pbxbox=$inventoryInfo['pbxbox'];
130     $extrainfo=$inventoryInfo['extrainfo'];
131   }
132
133   if(isset($inventoryInfo) && is_array($inventoryInfo)){
134     $action="edit";
135     echo "<h2> ".$extdisplay." ".$empname."</h2>";
136     echo "<p><a href=\"".$delURL."\">"._("Delete inventory")."</a></p>";
137   }
138   else {
139     echo "<h2>"._("Add inventory")."</h2>";
140   }
141
142 }
143
144 echo "<form name=\"addNew\" action=\"".$_SERVER['PHP_SELF']."\" method=\"post\" onsubmit=\"return addNew_onsubmit();\">";
145 echo "<input type=hidden name=extdisplay value=$extdisplay>\n";
146 echo "<input type=hidden name=action value=\"";
147 echo ($action=="" ? "add" : $action);
148 echo "\">\n";
149 echo "<input type=hidden name=display value=\"inventorydb\">";
150 echo "<input type=hidden name=type value=\"tool\">";
151
152 echo "<table>";
153
154 echo "<tr><td colspan=2><h5>";
155 echo ($extdisplay ? _('Edit inventory') : _('Add inventory'));
156 echo "</h5></td></tr>\n";
157
158 //empnum
159 $employee = _("Employee #");
160 $employeehelp = _("Employee Number");
161 echo "<tr ";
162 echo ($extdisplay ? '' : '');
163 echo "><td>";
164 echo "<a href=\"#\" class=\"info\">".$employee."\n";
165 echo "<span>".$employeehelp."</span></a>\n";
166 echo "</td><td>\n";
167 echo "<input name=\"empnum\" value=\"$empnum\" tabindex=".++$tabindex.">\n";
168 echo "</td></tr>\n";
169
170 //empname
171 $employeename = _("Employee Name");
172 $employeenamehelp = _("The Name for the Employee");
173 echo "<tr><td>\n";
174 echo "<a href=\"#\" class=\"info\">".$employeename."\n";
175 echo "<span>".$employeenamehelp."</span></a>\n";
176 echo "</td>";
177 echo "<td>";
178 echo "<input type=text name=\"empname\" value=\"$empname\" tabindex=".++$tabindex.">\n";
179 echo "</td></tr>\n";
180
181 //building
182 $buildingloc = _("Building Located");
183 $buildinglochelp = _("Building where the phone is located");
184 echo "<tr><td>\n";
185 echo "<a href=\"#\" class=\"info\">".$buildingloc."\n";
186 echo "<span>".$buildinglochelp."</span></a>\n";
187 echo "</td><td>\n";
188 echo "<input name=\"building\" value=\"$building\" tabindex=".++$tabindex.">\n";
189 echo "</td></tr>\n";
190
191 //floor
192 $floorno = _("Floor #");
193 $floornohelp = _("Floor # phone is on");
194 echo "<tr><td>\n";
195 echo "<a href=\"#\" class=\"info\">".$floorno."\n";
196 echo "<span>".$floornohelp."</span></a>\n";
197 echo "</td><td>\n";
198 echo "<input name=\"floor\" value=\"$floor\" tabindex=".++$tabindex.">\n";
199 echo "</td><tr>\n";
200
201 //room
202 $roomno = _("Room #");
203 $roomnohelp = _("Room phone is in");
204 echo "<tr><td>\n";
205 echo "<a href=\"#\" class=\"info\">".$roomno."\n";
206 echo "<span>".$roomnohelp."</span></a>\n";
207 echo "</td><td>\n";
208 echo "<input name=\"room\" value=\"$room\" tabindex=".++$tabindex.">\n";
209 echo "</td></tr>\n";
210
211 //section
212 $sectionno = _("Floor Section #");
213 $sectionnohelp = _("Floor Section # the phone is in");
214 echo "<tr><td>\n";
215 echo "<a href=\"#\" class=\"info\">".$sectionno."\n";
216 echo "<span>".$sectionnohelp."</span></a>\n";
217 echo "</td><td>\n";
218 echo "<input name=\"section\" value=\"$section\" tabindex=".++$tabindex.">\n";
219 echo "</td></tr>\n";
220
221 //cubicle
222 $cubicleno = _("Cubicle #");
223 $cubiclenohelp = _("Cubicle phone is in");
224 echo "<tr><td>\n";
225 echo "<a href=\"#\" class=\"info\">".$cubicleno."\n";
226 echo "<span>".$cubiclenohelp."</span></a>\n";
227 echo "</td><td>\n";
228 echo "<input name=\"cubicle\" value=\"$cubicle\" tabindex=".++$tabindex.">\n";
229 echo "</td></tr>\n";
230
231 //desk
232 $deskno = _("Desk #");
233 $desknohelp = _("Desk Number phone is on");
234 echo "<tr><td>\n";
235 echo "<a href=\"#\" class=\"info\">".$deskno."\n";
236 echo "<span>".$desknohelp."</span></a>\n";
237 echo "</td><td>\n";
238 echo "<input name=\"desk\" value=\"$desk\" tabindex=".++$tabindex.">\n";
239 echo "</td></tr>\n";
240
241 //exten
242 $extenno = _("Extension #");
243 $extennohelp = _("Exten Assigned to the phone");
244 echo "<tr><td>\n";
245 echo "<a href=\"#\" class=\"info\">".$extenno."\n";
246 echo "<span>".$extennohelp."</span></a>\n";
247 echo "</td><td>\n";
248 echo "<input name=\"exten\" value=\"$exten\" tabindex=".++$tabindex.">\n";
249 echo "</td></tr>\n";
250
251 //phusername
252 $phuser = _("Phone UserName");
253 $phuserhelp = _("Phone Admin Username");
254 echo "<tr><td>\n";
255 echo "<a href=\"#\" class=\"info\">".$phuser."\n";
256 echo "<span>".$phuserhelp."</span></a>\n";
257 echo "</td><td>\n";
258 echo "<input name=\"phusername\" value=\"$phusername\" tabindex=".++$tabindex.">\n";
259 echo "</td></tr>\n";
260
261 //phpassword
262 $phpass = _("Phone Password");
263 $phpasshelp = _(" Phone Admin Password");
264 echo "<tr><td>\n";
265 echo "<a href=\"#\" class=\"info\">".$phpass."\n";
266 echo "<span>".$phpasshelp."</span></a>\n";
267 echo "</td><td>\n";
268 echo "<input name=\"phpassword\" value=\"$phpassword\" tabindex=".++$tabindex.">\n";
269 echo "</td></tr>\n";
270
271 //mac
272 $macaddr = _("MAC Address");
273 $macaddrhelp = _("MAC Address of the phone");
274 echo "<tr><td>\n";
275 echo "<a href=\"#\" class=\"info\">".$macaddr."\n";
276 echo "<span>".$macaddrhelp."</span></a>\n";
277 echo "</td><td>\n";
278 echo "<input name=\"mac\" value=\"$mac\" tabindex=".++$tabindex.">\n";
279 echo "</td></tr>\n";
280
281 //Serial
282 $serialno = _("Serial #");
283 $serialnohelp = _("Serial Number of the phone");
284 echo "<tr><td>\n";
285 echo "<a href=\"#\" class=\"info\">".$serialno."\n";
286 echo "<span>".$serialnohelp."</span></a>\n";
287 echo "</td><td>\n";
288 echo "<input name=\"serial\" value=\"$serial\" tabindex=".++$tabindex.">\n";
289 echo "</td></tr>\n";
290
291 //Device
292 $phdevice = _("Phone/Device");
293 $phdevicehelp = _("Device, example... Linksys PAP-2, Sipura");
294 echo "<tr><td>\n";
295 echo "<a href=\"#\" class=\"info\">".$phdevice."\n";
296 echo "<span>".$phdevicehelp."</span></a>\n";
297 echo "</td><td>\n";
298 echo "<input type=text name=\"device\" value=\"$device\" tabindex=".++$tabindex.">\n";
299 echo "</td></tr>\n";
300
301 //DistDate
302 $dateinst = _("Distributed Date");
303 $dateinsthelp = _("Distribution Date");
304 echo "<tr><td>\n";
305 echo "<a href=\"#\" class=\"info\">".$dateinst."\n";
306 echo "<span>".$dateinsthelp."</font></span></a>\n";
307 echo "</td><td>\n";
308 echo "<input name=\"distdate\" value=\"$distdate\" tabindex=".++$tabindex.">\n";
309 echo "</td></tr>\n";
310
311 //IP
312 $ipaddr = _("IP Address");
313 $ipaddrhelp = _("IP Address Assigned If not DHCP");
314 echo "<tr><td>\n";
315 echo "<a href=\"#\" class=\"info\">".$ipaddr."\n";
316 echo "<span>".$ipaddrhelp."</span></a>\n";
317 echo "</td><td>\n";
318 echo "<input name=\"ip\" value=\"$ip\" tabindex=".++$tabindex.">\n";
319 echo "</td></tr>\n";
320
321 //pbxbox
322 $pbxname = _("PBX Box Name");
323 $pbxnamehelp = _("PBX Box Name");
324 echo "<tr><td>\n";
325 echo "<a href=\"#\" class=\"info\">".$pbxname."\n";
326 echo "<span>".$pbxnamehelp."</span></a>\n";
327 echo "</td><td>\n";
328 echo "<input type=text name=\"pbxbox\" value=\"$pbxbox\" tabindex=".++$tabindex.">\n";
329 echo "</td></tr>\n";
330
331 //extrainfo
332 $extra = _("Extra Info");
333 $extrahelp = _("Extra Information");
334 echo "<tr><td>\n";
335 echo "<a href=\"#\" class=\"info\">".$extra."\n";
336 echo "<span>".$extrahelp."</span></span></a>\n";
337 echo "</td><td>\n";
338 echo "<input name=\"extrainfo\" value=\"$extrainfo\" tabindex=".++$tabindex.">\n";
339 echo "</td></tr>\n";
340
341
342 ?>
343 <tr><td></td><td><input type=submit Value="<?php echo _("Submit Changes")?>" tabindex="<?php echo ++$tabindex;?>"></td></tr></table>
344
345 </script>
346
347
348
349 </form>
Note: See TracBrowser for help on using the browser.