Skip to content

Commit

Permalink
Merge pull request #5 from MorinPierre/master
Browse files Browse the repository at this point in the history
Fix some errors
  • Loading branch information
MorinPierre committed Jul 9, 2015
2 parents 478c3b8 + 0212f99 commit 5b07345
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 6 deletions.
4 changes: 2 additions & 2 deletions create.sql
Original file line number Diff line number Diff line change
Expand Up @@ -896,8 +896,8 @@ CREATE TABLE IF NOT EXISTS fac_ElectricalMeasurePoint (
EnergyTypeID int(11) NOT NULL,
Category ENUM('none', 'IT', 'Cooling', 'Other Mechanical', 'UPS Input', 'UPS Output', 'Energy Reuse') NOT NULL,
UPSPowered TINYINT(1) NOT NULL,
PowerMultiplier ENUM('0.1','1','10','100') NOT NULL,
EnergyMultiplier ENUM('0.1','1','10','100') NOT NULL,
PowerMultiplier ENUM('0.01','0.1','1','10','100') NOT NULL,
EnergyMultiplier ENUM('0.01','0.1','1','10','100') NOT NULL,
UNIQUE KEY MPID(MPID),
KEY DataCenterID (DataCenterID)
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Expand Down
40 changes: 40 additions & 0 deletions datacenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@
$dc->Name=trim($_POST['name']);
$dc->SquareFootage=$_POST['squarefootage'];
$dc->DeliveryAddress=$_POST['deliveryaddress'];
$dc->CreationDate=$_POST['creationdate'];
$dc->Administrator=$_POST['administrator'];
$dc->DrawingFileName=$_POST['drawingfilename'];
$dc->MaxkW=$_POST['maxkw'];
$dc->ContainerID=$_POST['container'];
$dc->PUELevel=$_POST['puelevel'];
$dc->PUEFrequency=$_POST['puefrequency'];
$dc->MapX=$_POST['x'];
$dc->MapY=$_POST['y'];

Expand All @@ -54,10 +57,13 @@
$dc->Name=trim($_POST['name']);
$dc->SquareFootage=$_POST['squarefootage'];
$dc->DeliveryAddress=$_POST['deliveryaddress'];
$dc->CreationDate=$_POST['creationdate'];
$dc->Administrator=$_POST['administrator'];
$dc->DrawingFileName=$_POST['drawingfilename'];
$dc->MaxkW=$_POST['maxkw'];
$dc->ContainerID=$_POST['container'];
$dc->PUELevel=$_POST['puelevel'];
$dc->PUEFrequency=$_POST['puefrequency'];
if ($dc->ContainerID==0){
$dc->MapX=0;
$dc->MapY=0;
Expand Down Expand Up @@ -259,6 +265,10 @@ function cambio_container(){
<div><label for="deliveryaddress">',__("Delivery Address"),'</label></div>
<div><input class="validate[optional,minSize[1],maxSize[200]]" type="text" name="deliveryaddress" id="deliveryaddress" size="60" maxlength="200" value="',$dc->DeliveryAddress,'"></div>
</div>
<div>
<div><label for="creationdate">',__("Creation Date"),'</label></div>
<div><input class="validate[optional,minSize[1],maxSize[30]]" type="text" name="creationdate" id="creationdate" size="60" maxlength="200" value="',$dc->CreationDate,'"></div>
</div>
<div>
<div><label for="administrator">',__("Administrator"),'</label></div>
<div><input class="validate[optional,minSize[1],maxSize[80]]" type="text" type="text" name="administrator" id="administrator" size=60 maxlength="80" value="',$dc->Administrator,'"></div>
Expand Down Expand Up @@ -286,6 +296,36 @@ function cambio_container(){

echo ' </select></div>
</div>
<div>
<div><label for="puelevel">',__("PUE Level"),'</label></div>
<div><select name="puelevel" id="puelevel">';

$levelList = array( "L1" => __("Basic"),
"L2" => __("Intermediate"),
"L3" => __("Advanced"));
foreach($levelList as $level => $label){
if($level == $dc->PUELevel){$selected=" selected";}else{$selected="";}
print "<option value=\"$level\"$selected>$level : $label</option>\n";
}

echo ' </select></div>
</div>
<div>
<div><label for="puefrequency">',__("PUE Frequency"),'</label></div>
<div><select name="puefrequency" id="puefrequency">';

$freqList = array( '-' => __("Single Measurement"),
'C' => __("Continuous (less than 15 minutes)"),
'D' => __("Daily"),
'W' => __("Weekly"),
'M' => __("Monthly"));
foreach($freqList as $freq => $label){
if($freq == $dc->PUEFrequency){$selected=" selected";}else{$selected="";}
print "<option value=\"$freq\"$selected>$freq : $label</option>\n";
}

echo ' </select></div>
</div>
<div>
<div><b>X</b></div>
<div><input type="text" name="x" id="x" value="',$dc->MapX,'" onblur="mueve()"></div>
Expand Down
4 changes: 2 additions & 2 deletions db-4.1-to-PUE_DCEM.sql
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ CREATE TABLE IF NOT EXISTS fac_ElectricalMeasurePoint (
EnergyTypeID int(11) NOT NULL,
Category ENUM('none', 'IT', 'Cooling', 'Other Mechanical', 'UPS Input', 'UPS Output', 'Energy Reuse') NOT NULL,
UPSPowered TINYINT(1) NOT NULL,
PowerMultiplier ENUM('0.1','1','10','100') NOT NULL,
EnergyMultiplier ENUM('0.1','1','10','100') NOT NULL,
PowerMultiplier ENUM('0.01','0.1','1','10','100') NOT NULL,
EnergyMultiplier ENUM('0.01','0.1','1','10','100') NOT NULL,
UNIQUE KEY MPID(MPID),
KEY DataCenterID (DataCenterID)
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
Expand Down
2 changes: 1 addition & 1 deletion elec_measure_point.php
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@
<div>
<div><label for="powermultiplier">',__("Power Multiplier"),'</label></div>
<div><select name="powermultiplier" id="powermultiplier">';
$multiplierList = array('0.1', '1', '10', '100');
$multiplierList = array('0.01', '0.1', '1', '10', '100');
foreach($multiplierList as $m) {
if($m == $mp->PowerMultiplier)
$selected=' selected';
Expand Down
2 changes: 2 additions & 0 deletions infrastructure.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,8 @@ class DataCenter {
var $MapY;

function MakeSafe(){
$validPUELevel = array('L1', 'L2', 'L3');
$validPUEFrequency = array('-','C','D','W','M');
$this->DataCenterID=intval($this->DataCenterID);
$this->Name=sanitize($this->Name);
$this->SquareFootage=intval($this->SquareFootage);
Expand Down
2 changes: 1 addition & 1 deletion measure.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ class ElectricalMeasurePoint extends MeasurePoint{
var $EnergyMultiplier; //multiplier to apply to energy measure

protected function MakeSafe() {
$validMultipliers = array('0.1','1','10','100');
$validMultipliers = array('0.01','0.1','1','10','100');
$validCategories = array('none', 'IT', 'Cooling', 'Other Mechanical', 'UPS Input', 'UPS Output', 'Energy Reuse', 'Renewable Energy');

parent::MakeSafe();
Expand Down

0 comments on commit 5b07345

Please sign in to comment.