Skip to content

Commit

Permalink
Added data validation to cabinets.php part of #11
Browse files Browse the repository at this point in the history
  • Loading branch information
wilpig committed Aug 24, 2012
1 parent 90a45ed commit b1be443
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 17 deletions.
35 changes: 23 additions & 12 deletions cabinets.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,14 @@
$cab->Keylock=$_REQUEST['keylock'];
$cab->MaxKW=$_REQUEST['maxkw'];
$cab->MaxWeight=$_REQUEST['maxweight'];
$cab->InstallationDate=date( "Y-m-d", strtotime($_REQUEST['installationdate']) );
$cab->InstallationDate=$_REQUEST['installationdate'];

if(($cab->CabinetID >0)&&($_REQUEST['action']=='Update')){
$cab->UpdateCabinet($facDB);
}elseif($_REQUEST['action']=='Create'){
$cab->CreateCabinet($facDB);
if($cab->Location!=""){
if(($cab->CabinetID >0)&&($_REQUEST['action']=='Update')){
$cab->UpdateCabinet($facDB);
}elseif($_REQUEST['action']=='Create'){
$cab->CreateCabinet($facDB);
}
}
}

Expand Down Expand Up @@ -63,10 +65,19 @@

<title>Facilities Cabinet Maintenance</title>
<link rel="stylesheet" href="css/inventory.php" 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.validationEngine-en.js"></script>
<script type="text/javascript" src="scripts/jquery.validationEngine.js"></script>

<script type="text/javascript">
$(document).ready(function() {
$('#rackform').validationEngine({});
});
</script>
</head>
<body>
<div id="header"></div>
Expand All @@ -78,7 +89,7 @@
<h2>',$config->ParameterArray["OrgName"],'</h2>
<h3>',_("Data Center Cabinet Inventory"),'</h3>
<div class="center"><div>
<form action="',$_SERVER["PHP_SELF"],'" method="POST">
<form id="rackform" action="',$_SERVER["PHP_SELF"],'" method="POST">
<div class="table">
<div>
<div>',_("Cabinet"),'</div>
Expand All @@ -98,7 +109,7 @@
</div>
<div>
<div>',_("Location"),'</div>
<div><input type="text" name="location" size=8 value="',$cab->Location,'"></div>
<div><input type="text" class="validate[required,minSize[1],maxSize[8]]" name="location" size=8 maxlength=8 value="',$cab->Location,'"></div>
</div>
<div>
<div>',_("Assigned To"),':</div>
Expand All @@ -115,23 +126,23 @@
</div>
<div>
<div>',_("Cabinet Height"),' (U)</div>
<div><input type="text" name="cabinetheight" size=4 value="',$cab->CabinetHeight,'"></div>
<div><input type="text" class="validate[optional,custom[onlyNumberSp]]" name="cabinetheight" size=4 maxlength=4 value="',$cab->CabinetHeight,'"></div>
</div>
<div>
<div>',_("Model"),'</div>
<div><input type="text" name="model" size=30 value="',$cab->Model,'"></div>
<div><input type="text" name="model" size=30 maxlength=80 value="',$cab->Model,'"></div>
</div>
<div>
<div>',_("Key/Lock Information"),'</div>
<div><input type="text" name="keylock" size=30 value="',$cab->Keylock,'"></div>
<div><input type="text" name="keylock" size=30 maxlength=30 value="',$cab->Keylock,'"></div>
</div>
<div>
<div>',_("Maximum"),' kW</div>
<div><input type="text" name="maxkw" size=30 value="',$cab->MaxKW,'"></div>
<div><input type="text" class="validate[optional,custom[onlyNumberSp]]" name="maxkw" size=30 maxlength=11 value="',$cab->MaxKW,'"></div>
</div>
<div>
<div>',_("Maximum Weight"),'</div>
<div><input type="text" name="maxweight" size=30 value="',$cab->MaxWeight,'"></div>
<div><input type="text" class="validate[optional,custom[onlyNumberSp]]" name="maxweight" size=30 maxlength=11 value="',$cab->MaxWeight,'"></div>
</div>
<div>
<div>',_("Date of Installation"),'</div>
Expand Down
12 changes: 7 additions & 5 deletions datacenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,13 @@
$dc->DeliveryAddress=$_REQUEST['deliveryaddress'];
$dc->Administrator=$_REQUEST['administrator'];
$dc->DrawingFileName=$_REQUEST['drawingfilename'];

if($_REQUEST['action']=='Create' && $dc->Name!=""){
$dc->CreateDataCenter($facDB);
}else{
$dc->UpdateDataCenter($facDB);

if($dc->Name!=""){
if($_REQUEST['action']=='Create'){
$dc->CreateDataCenter($facDB);
}else{
$dc->UpdateDataCenter($facDB);
}
}
}

Expand Down

0 comments on commit b1be443

Please sign in to comment.