forked from opendcim/openDCIM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
device_manufacturers.php
105 lines (94 loc) · 3.36 KB
/
device_manufacturers.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
<?php
require_once( "db.inc.php" );
require_once( "facilities.inc.php" );
if(!$user->SiteAdmin){
// No soup for you.
header('Location: '.redirect());
exit;
}
$mfg=new Manufacturer();
if(isset($_REQUEST["manufacturerid"]) && $_REQUEST["manufacturerid"] >0){
$mfg->ManufacturerID=(isset($_POST['manufacturerid']) ? $_POST['manufacturerid'] : $_GET['manufacturerid']);
$mfg->GetManufacturerByID();
}
$status="";
if(isset($_POST["action"])&&(($_POST["action"]=="Create")||($_POST["action"]=="Update"))){
$mfg->ManufacturerID=$_POST["manufacturerid"];
$mfg->Name=trim($_POST["name"]);
if($mfg->Name != null && $mfg->Name != ""){
if($_POST["action"]=="Create"){
$mfg->AddManufacturer();
}else{
$status="Updated";
$mfg->UpdateManufacturer();
}
}
//We either just created a manufacturer or updated it so reload from the db
$mfg->GetManufacturerByID();
}
$mfgList=$mfg->GetManufacturerList();
?>
<!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 Device Class Templates</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/validationEngine.jquery.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.validationEngine-en.js"></script>
<script type="text/javascript" src="scripts/jquery.validationEngine.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#mform').validationEngine({});
});
</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 Manufacturer Listing"),'</h3>
<h3>',$status,'</h3>
<div class="center"><div>
<form id="mform" action="',$_SERVER["PHP_SELF"],'" method="POST">
<div class="table">
<div>
<div><label for="manufacturerid">',__("Manufacturer"),'</label></div>
<div><input type="hidden" name="action" value="query"><select name="manufacturerid" id="manufacturerid" onChange="form.submit()">
<option value=0>',__("New Manufacturer"),'</option>';
foreach($mfgList as $mfgRow){
if($mfg->ManufacturerID==$mfgRow->ManufacturerID){$selected=" selected";}else{$selected="";}
echo "<option value=\"$mfgRow->ManufacturerID\"$selected>$mfgRow->Name</option>\n";
}
echo ' </select></div>
</div>
<div>
<div><label for="name">',__("Name"),'</label></div>
<div><input type="text" class="validate[required,minSize[1],maxSize[40]]" name="name" id="name" maxlength="40" value="',$mfg->Name,'"></div>
</div>
<div class="caption">';
if($mfg->ManufacturerID >0){
echo ' <button type="submit" name="action" value="Update">',__("Update"),'</button>';
}else{
echo ' <button type="submit" name="action" value="Create">',__("Create"),'</button>';
}
?>
</div>
</div><!-- END div.table -->
</form>
</div></div>
<?php echo '<a href="index.php">[ ',__("Return to Main Menu"),' ]</a>'; ?>
</div><!-- END div.main -->
</div><!-- END div.page -->
</body>
</html>