Skip to content

Commit

Permalink
Set 1 as the minimum value for rack position. Also added in loop to s…
Browse files Browse the repository at this point in the history
…earch for 0 height devices in rack view. #11
  • Loading branch information
wilpig committed Jul 5, 2012
1 parent 5261cfa commit 734c585
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 13 deletions.
42 changes: 31 additions & 11 deletions cabnavigator.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
exit;
}

$head=$legend="";
$head=$legend=$zeroheight="";
$cab=new Cabinet();
$audit=new CabinetAudit();
$pdu=new PowerDistribution();
Expand Down Expand Up @@ -78,9 +78,9 @@
$legend.='<p><span class="reserved border">&nbsp;&nbsp;&nbsp;&nbsp;</span> - Reservation</p>';
}
if($config->ParameterArray["FreeSpaceColor"] != "#FFFFFF"){
$legend.='<p><span class="freespace border">&nbsp;&nbsp;&nbsp;&nbsp;</span> - FreeSpace</p>';
$legend.='<p><span class="freespace border">&nbsp;&nbsp;&nbsp;&nbsp;</span> - Free Space</p>';
}
$legend.='<p><span class="border">&nbsp;&nbsp;&nbsp;&nbsp;</span> - Normal</p>';
$legend.='<p><span class="border">&nbsp;&nbsp;&nbsp;&nbsp;</span> - Occupied Space</p>';
}

?>
Expand Down Expand Up @@ -128,16 +128,22 @@ function verifyDelete(formname) {
<tr><th colspan=2>Cabinet <?php print $cab->Location; ?></th></tr>
<tr><td width="10%">Pos</td><td width="90%">Device</td></tr>
<?php
while ( list( $devID, $device ) = each( $devList ) ) {
$devTop = $device->Position + $device->Height - 1;
while(list($devID,$device)=each($devList)){
$devTop=$device->Position + $device->Height - 1;

$templ->TemplateID = $device->TemplateID;
$templ->GetTemplateByID( $facDB );
$templ->GetTemplateByID($facDB);

if ( $device->NominalWatts > 0 )
$totalWatts += $device->NominalWatts;
else
$totalWatts += $templ->Wattage;
$highlight="<blink><font color=red>";
if($device->TemplateID==0){$highlight.="(T)";}
if($device->Owner==0){$highlight.="(O)";}
$highlight.= "</font></blink>";

if($device->NominalWatts >0){
$totalWatts+=$device->NominalWatts;
}else{
$totalWatts+=$templ->Wattage;
}

$totalWeight += $templ->Weight;
$totalMoment += ( $templ->Weight * ( $device->Position + ( $device->Height / 2 ) ) );
Expand All @@ -159,6 +165,9 @@ function verifyDelete(formname) {
}
}

if($device->Height<1){
$zeroheight.=" <a href=\"devices.php?deviceid=$devID\">$highlight $device->Label</a>\n";
}
for($i = $devTop; $i >= $device->Position; $i--){
if($i==$devTop){
$highlight="<blink><font color=red>";
Expand All @@ -168,9 +177,10 @@ function verifyDelete(formname) {
if ($device->Owner==0) {
$highlight.="(O)";
}

$highlight .= "</font></blink>";
print "<tr><td>$i</td><td class=\"device $reserved\" rowspan=$device->Height><a href=\"devices.php?deviceid=$devID\">$highlight $device->Label</a></td></tr>\n";


}else{
print "<tr><td>$i</td></tr>\n";
}
Expand Down Expand Up @@ -259,6 +269,16 @@ function verifyDelete(formname) {
<?php printf( "%s\n", $cab->Keylock ); ?>
</div>
</fieldset>
<?php
if($zeroheight!=""){
print " <fieldset>
<legend>Zero-U Devices</legend>
<div id=\"zerou\">
$zeroheight
</div>
</fieldset>\n";
}
?>
<fieldset>
<legend>Power Distribution</legend>
<?php
Expand Down
3 changes: 3 additions & 0 deletions css/inventory.css
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ textarea {
white-space: pre;
word-wrap: break-word;
}
#zerou a{
display: block;
}
/* devices.php Device Detail */
div.page.device {
min-width: 1350px; /* 1030 */
Expand Down
5 changes: 3 additions & 2 deletions devices.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ function setPreferredLayout() {<?php if(isset($_COOKIE["layout"]) && strtolower(
</div>
<div>
<div><label for="position">Position</label></div>
<div><input type="number" class="required,validate[custom[onlyNumberSp]]" name="position" id="position" size="4" value="<?php echo $dev->Position; ?>"></div>
<div><input type="number" class="required,validate[custom[onlyNumberSp],min[1]]" name="position" id="position" size="4" value="<?php echo $dev->Position; ?>"></div>
</div>
<div>
<div><label for="height">Height</label></div>
Expand Down Expand Up @@ -496,7 +496,8 @@ function setPreferredLayout() {<?php if(isset($_COOKIE["layout"]) && strtolower(
</fieldset>
<?php
// Do not display ESX block if device isn't a virtual server and the user doesn't have write access
if($user->WriteAccess || $dev->ESX){
// if($user->WriteAccess || $dev->ESX){
if(($user->WriteAccess || $dev->ESX) && ($dev->DeviceType=="Server" || $dev->DeviceType=="")){
echo "<fieldset>\n <legend>VMWare ESX Server Information</legend>";
// If the user doesn't have write access display the list of VMs but not the configuration information.
if($user->WriteAccess){
Expand Down

0 comments on commit 734c585

Please sign in to comment.