forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
departments.php
146 lines (136 loc) · 4.93 KB
/
departments.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<?php
require_once('db.inc.php');
require_once('facilities.inc.php');
if(!$user->ContactAdmin){
// No soup for you.
header('Location: '.redirect());
exit;
}
$dept=new Department();
if(isset($_REQUEST['deptid'])&&($_REQUEST['deptid']>0)){
$dept->DeptID=(isset($_POST['deptid']) ? $_POST['deptid'] : $_GET['deptid']);
$dept->GetDeptByID();
}
if(isset($_POST['action'])&& (($_POST['action']=='Create') || ($_POST['action']=='Update'))){
$dept->DeptID=$_POST['deptid'];
$dept->Name=trim($_POST['name']);
$dept->ExecSponsor=$_POST['execsponsor'];
$dept->SDM=$_POST['sdm'];
$dept->Classification=$_POST['classification'];
$dept->DeptColor=$_POST['deptcolor'];
if($dept->Name!=''){
if($_POST['action']=='Create'){
$dept->CreateDepartment();
}else{
$dept->UpdateDepartment();
}
}
// Refresh object
$dept->GetDeptByID();
}
$deptList=$dept->GetDepartmentList();
?>
<!doctype html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>openDCIM Department Information</title>
<link rel="stylesheet" href="css/inventory.php" type="text/css">
<link rel="stylesheet" href="css/jquery-ui.css" type="text/css">
<link rel="stylesheet" href="css/jquery.miniColors.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>
<script type="text/javascript" src="scripts/jquery-ui.min.js"></script>
<script type="text/javascript" src="scripts/jquery.miniColors.js"></script>
<script type="text/javascript">
function showgroup(obj){
self.frames['groupadmin'].location.href='dept_groups.php?deptid='+obj;
document.getElementById('groupadmin').style.display = "block";
document.getElementById('deptname').readOnly = true
document.getElementById('deptsponsor').readOnly = true
document.getElementById('deptmgr').readOnly = true
document.getElementById('deptcolor').readOnly = true
document.getElementById('deptclass').disabled = true
document.getElementById('controls').id = "displaynone";
$('.color-picker').minicolors('destroy');
}
$(document).ready( function() {
$(".color-picker").minicolors({
letterCase: 'uppercase',
change: function(hex, rgb) {
logData(hex, rgb);
}
});
});
</script>
</head>
<body>
<div id="header"></div>
<div class="page">
<?php
include( 'sidebar.inc.php' );
echo '<div class="main">
<h2>',$config->ParameterArray["OrgName"],'</h2>
<h3>',__("Data Center Department Detail"),'</h3>
<div class="center"><div>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<div class="table centermargin">
<div>
<div>',__("Department"),'</div>
<div><input type="hidden" name="action" value="query"><select name="deptid" onChange="form.submit()">
<option value=0>',__("New Department"),'</option>';
foreach($deptList as $deptRow){
if($dept->DeptID == $deptRow->DeptID){$selected=" selected";}else{$selected="";}
print " <option value=\"$deptRow->DeptID\"$selected>$deptRow->Name</option>\n";
}
echo ' </select></div>
</div>
<div>
<div><label for="deptname">',__("Department Name"),'</label></div>
<div><input type="text" size="50" name="name" id="deptname" maxlength="80" value="',$dept->Name,'"></div>
</div>
<div>
<div><label for="deptsponsor">',__("Executive Sponsor"),'</label></div>
<div><input type="text" size="50" name="execsponsor" id="deptsponsor" maxlength="80" value="',$dept->ExecSponsor,'"></div>
</div>
<div>
<div><label for="deptmgr">',__("Account Manager"),'</label></div>
<div><input type="text" size="50" name="sdm" id="deptmgr" maxlength="80" value="',$dept->SDM,'"></div>
</div>
<div>
<div><label for="deptcolor">',__("Department Color"),'</label></div>
<div><div class="cp"><input type="text" class="color-picker" size="50" name="deptcolor" id="deptcolor" maxlength="7" value="',$dept->DeptColor,'"></div></div>
</div>
<div>
<div><label for="deptclass">',__("Classification"),'</label></div>
<div><select name="classification" id="deptclass">';
foreach($config->ParameterArray['ClassList'] as $className){
if($dept->Classification==$className){$selected=" selected";}else{$selected="";}
print " <option value=\"$className\"$selected>$className</option>\n";
}
?>
</select>
</div>
</div>
<div class="caption" id="controls">
<?php
if($dept->DeptID > 0){
echo '<button type="submit" name="action" value="Update">',__("Update"),'</button><button type="button" onClick="showgroup(',$dept->DeptID,')">',__("Assign Contacts"),'</button>';
}else{
echo '<button type="submit" name="action" value="Create">',__("Create"),'</button>';
}
?>
</div>
</div> <!-- END div.table -->
</form>
<iframe name="groupadmin" id="groupadmin" frameborder=0 scrolling="no"></iframe>
<br>
</div></div>
<?php echo '<a href="index.php">[ ',__("Return to Main Menu"),' ]</a>'; ?>
</div> <!-- END div.main -->
</div> <!-- END div.page -->
</body>
</html>