forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcontacts.php
124 lines (118 loc) · 4.09 KB
/
contacts.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
<?php
require_once( 'db.inc.php' );
require_once( 'facilities.inc.php' );
$contact=new Contact();
$user=new User();
$user->UserID=$_SERVER['REMOTE_USER'];
$user->GetUserRights($facDB);
if(!$user->ContactAdmin){
// No soup for you.
header('Location: '.redirect());
exit;
}
if(isset($_REQUEST['contactid']) && ($_REQUEST['contactid']>0)) {
$contact->ContactID = $_REQUEST['contactid'];
$contact->GetContactByID( $facDB );
}
if(isset($_REQUEST['action']) && (($_REQUEST['action']=='Create') || ($_REQUEST['action']=='Update'))){
$contact->ContactID = $_REQUEST['contactid'];
$contact->UserID = $_REQUEST['UserID'];
$contact->LastName = $_REQUEST['lastname'];
$contact->FirstName = $_REQUEST['firstname'];
$contact->Phone1 = $_REQUEST['phone1'];
$contact->Phone2 = $_REQUEST['phone2'];
$contact->Phone3 = $_REQUEST['phone3'];
$contact->Email = $_REQUEST['email'];
if($_REQUEST['action'] == 'Create'){
if($contact->LastName != null && $contact->LastName != ''){
$contact->CreateContact($facDB);
}
}else{
$contact->UpdateContact( $facDB );
}
}
$contactList = $contact->GetContactList( $facDB );
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>openDCIM Data Center Inventory</title>
<link rel="stylesheet" href="css/inventory.css" type="text/css">
<!--[if lt IE 9]>
<link rel="stylesheet" href="css/ie.css" type="text/css">
<![endif]-->
<script type="text/javascript" src="scripts/jquery.min.js"></script>
</head>
<body>
<div id="header"></div>
<div class="page">
<?php
include( 'sidebar.inc.php' );
?>
<div class="main">
<h2><?php print $config->ParameterArray['OrgName']; ?></h2>
<h3>Data Center Contact Detail</h3>
<div class="center"><div>
<form action="<?php print $_SERVER['PHP_SELF']; ?>" method="POST">
<div class="table">
<div>
<div><label for="contactid">Contact</label></div>
<div><input type="hidden" name="action" value="query"><select name="contactid" id="contactid" onChange="form.submit()">
<option value=0>New Contact</option>
<?php
foreach($contactList as $contactRow ) {
//print "<option value=\"$contactRow->ContactID\" selected>$contactRow->LastName, $contactRow->FirstName</option>";
print "<option value=\"$contactRow->ContactID\"";
if($contact->ContactID == $contactRow->ContactID){print ' selected="selected"';}
print ">$contactRow->LastName, $contactRow->FirstName</option>";
}
?>
</select></div>
</div>
<div>
<div><label for="UserID">UserID</label></div>
<div><input type="text" name="UserID" id="UserID" value="<?php print $contact->UserID; ?>"></div>
</div>
<div>
<div><label for="lastname">Last Name</label></div>
<div><input type="text" name="lastname" id="lastname" value="<?php print $contact->LastName; ?>"></div>
</div>
<div>
<div><label for="firstname">First Name</label></div>
<div><input type="text" name="firstname" id="firstname" value="<?php print $contact->FirstName; ?>"></div>
</div>
<div>
<div><label for="phone1">Phone 1</label></div>
<div><input type="text" name="phone1" id="phone1" value="<?php print $contact->Phone1; ?>"></div>
</div>
<div>
<div><label for="phone2">Phone 2</label></div>
<div><input type="text" name="phone2" id="phone2" value="<?php print $contact->Phone2; ?>"></div>
</div>
<div>
<div><label for="phone3">Phone 3</label></div>
<div><input type="text" name="phone3" id="phone3" value="<?php print $contact->Phone3; ?>"></div>
</div>
<div>
<div><label for="email">Email</label></div>
<div><input type="text" size="50" name="email" id="email" value="<?php print $contact->Email; ?>"></div>
</div>
<div class="caption">
<?php
if($contact->ContactID >0){
echo ' <input type="submit" name="action" value="Update">';
}else{
echo ' <input type="submit" name="action" value="Create">';
}
?>
</div>
</div> <!-- END div.table -->
</form>
</div></div>
<a href="index.php">[ Return to Main Menu ]</a>
</div> <!-- END div.main -->
</div> <!-- END div.page -->
</body>
</html>