size = $aSize;
$this->type = $aType;
}
};
$sortCriteria = new SortCriteria(1, "ASC","","*"); // Sort on GUIDs
$PartList = get_logical_libraries($user, $sortCriteria);
$numPartList = count($PartList);
error_log("Logical Libraies are:\n". print_r($PartList, true ) );
// Load up the data for showing encryption etc....
error_log("\n\n\n\nLoading ENCRYPTION DATA");
for ($libIndex = 0; $libIndex < $numPartList; $libIndex++)
{
$libraryNames[$libIndex] = $PartList[$libIndex]->name;
$libraryIndex[$PartList[$libIndex]->name] = $libIndex;
// Make sure the parition has drive that allow encrytipn
$libraryDrives = get_all_drives_by_library($user, $PartList[$libIndex]->guid, $sortCriteria, (int) 0, (int) MEDIA_TYPE_ANY);
// Check that encryption is supported by the partition. if not,
// show the method as "unsupported".
if(!GetEncryptionSupported($libraryDrives))
{
$libraryEncryption[$PartList[$libIndex]->name]="Unsupported";
}
else
{
error_log("Guid:".$PartList[$libIndex]->guid);
$encryptData = get_partition_enryption($user, $PartList[$libIndex]->guid);
//error_log("encryptData = ". print_r($encryptData, true));
$libraryEncryption[$PartList[$libIndex]->name] = $encryptData->method;
error_log('libraryEncryption['.$PartList[$libIndex]->name.'] = '.$libraryEncryption[$PartList[$libIndex]->name]);
}
}
//error_log("libraryEncryption = ". print_r($libraryEncryption, true) );
$PartList[PART_IE] = "I/E STATION"; // !?! was MAILBOX
$PartList[PART_CLN] = "CLEANING";
/* echo "";
//echo getObjData( $PartList );
*/
/*#######################################################
# Slot addressing:
# The model states that the Slot location Address is:
# chassis, magazine, slot
#######################################################*/
$sortCriteria->sortColumn = 3; // Location per Slot Attributes
$sortCriteria->ascending = true;
$sortCriteria->filterPattern = "*";
//$SlotList = get_all_slots_and_mailbox($user, $sortCriteria);
$SlotList = get_slot_statistics($user, $sortCriteria);
//$SlotList = get_all_slots($user, $sortCriteria);
//echo getObjData( $SlotList );
// error_log( print_r($SlotList, true) );
error_log( "Number of SLOTs Read was: ". sizeof($SlotList) );
error_log( "Last SLOT Read was: ". print_r( $SlotList[sizeof($SlotList)-1], true ) );
error_log("-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-\n\n\n\n");
// Put all the Slots in a HASH table
$lastChass = 0;
$lastSlot = 0;
foreach( $SlotList as $Slot )
{
if($Slot->name == "" )
$Slot->name = "System Partition";
if($Slot->name == "Physical Library" )
$Slot->name = "System Partition";
// Fix incase branded for IBM
if($Slot->slotType == 'I/O Station')
$Slot->slotType = 'I/E Station';
$hSlots[ $Slot->location ] = $Slot;
}
//error_log("lastSlot = $lastSlot | lastChass = $lastChass");
//echo getObjData($hSlots);
// Is this an Apollo robot?
$descriptions = get_firmware_versions($user);
error_log("get_firmware_versions = ". print_r($descriptions, true) );
$isApollo = false;
foreach($descriptions as $description)
{
// CR 19990 Do not diaply the Apollo imager version
if( $description->component == "Imager Firmware" )
{
$isApollo = true;
break;
}
}
/*
We are now getting the cleaning slots with the first call to get_slot_statistics
$sortCriteria = new SortCriteria(0, "ASC","","*"); // Sort on GUIDs
$CleanList = get_cleaning_slots($user, $sortCriteria, 0); // Get ALL Cleaning SLOTs
//echo getObjData($CleanList);
// Add the cleaning Slots to the HASH table
foreach( $CleanList as $Slot )
{
if($Slot->name == "" )
$Slot->name = "System Partition";
if($Slot->name == "Physical Library" )
$Slot->name = "System Partition";
$hSlots[ $Slot->location ] = $Slot;
}
//echo getObjData($hSlots);
*/
$ChassisList = get_chassis($user);
//echo getObjData($ChassisList);
// Put all the Chassis in a HASH table so We can sort the the way we want.
foreach( $ChassisList as $Chass )
{
$hChass[ $Chass->location ] = $Chass;
}
krsort( $hChass );
//echo getObjData($hChass);
$sortCriteria->sortColumn = 1; // Location per Drive Attributes
$sortCriteria->ascending = true;
$sortCriteria->filterPattern = "*";
$DriveList = get_all_drives($user, $sortCriteria);
//echo getObjData($DriveList);
// Put all the Drives in a HASH table so we can draw them as we get to there locations
foreach( $DriveList as $Drv )
{
if($Slot->name == "" )
$Slot->name = "System Partition";
if($Slot->name == "Physical Library" )
$Slot->name = "System Partition";
$hDrives[ $Drv->location ] = $Drv;
}
//echo getObjData($hDrives);
// Now that we have gathered all the Data Lets Display it in the logs
error_log( "################################## Library Data Totals #################################");
error_log( "Chassis = ". sizeof($hChass) );
error_log( "Drives = ". sizeof($hDrives) );
error_log( "Slots = ". sizeof($hSlots) );
error_log( "#########################################################################################");
error_log( "Chassis = \n". print_r( $hChass, true ) );
error_log( "Drives = \n". print_r( $hDrives, true ) );
error_log( "Slots = \n". print_r( $hSlots, true ) );
error_log( "################################## End of Library Data ##################################");
$partCur = 0; // The Global to keep the current partition in
$partDrive = 1; // The global for the Drive We are drawing
$DriveNum = 0; // The position in DriveList that hold our next Valid Drive.
$SlotID = 0; // So each Slot has a uniqe ID for mouseover.
$DriveID = 0; // So each Drive has a uniqe ID.
$modType; // Global to be set so module's onClick works
$bShowLoc; // Flag to show Location in each slot
$bPartsOnly; // Flag for showing only valid partition locations
$bShowBarCode = 0; // Flag to show barcode instead of locations
// NOTE: Not really using bShowBarCode at this time. Instead the lib config report shows the barcodes and the map shows the locs
$slotWidth;
$slotHeight;
/*############################################################################
# The Globals that hold the current chassis, Magazine and Slot being drawn.
# These are used to compare the location of the slot object in SlotList if
# it's a match the slot object is used to draw the current slot - else the
# current slot is drawn as a unused slot.
############################################################################*/
$loc_chassis = 0;
$loc_mag = 1;
$loc_slot = 1;
/*############################################################################
# Convert the Data for the Slot to User readable.
############################################################################*/
function getSlotData( $aObj )
{
$EncryptString = array("Unknown", "Not Encrypted", "Encrypted");
$l = "
".
"Type: | ". $aObj->slotType. "
|
".
"Partition Name: | ". $aObj->name ."
|
" .
"Location: | ". $aObj->location ."
|
" .
"Barcode: | ". $aObj->barcode ."
|
" .
"MediaType: | ". $aObj->mediaType. "
|
" .
"Element Address: | ". $aObj->logicalAddress. "
|
" .
"Encryption: | ". $EncryptString[$aObj->encryption]. "
|
" .
"Get Count: | ". $aObj->getCounts. "
|
" .
"Get Retries: | ". $aObj->getRetries. "
|
" .
"Put Count: | ". $aObj->putCounts. "
|
" .
"Put Retries: | ". $aObj->putRetries. "
|
" .
"";
if( $aObj->slotType == "Cleaning" )
{
if($aObj->mediaPresent == "1")
$tStr = ($aObj->cleanStatus ? "Expired" : "Usable");
else
$tStr = "N/A";
$l = $l . "Cleaning Status: | ". $tStr ."
|
" ;
if( $aObj->cleanCount == -1 )
$tStr = "N/A";
else
$tStr = $aObj->cleanCount;
$l = $l . "Cleaning Count: | ". $tStr ."
|
" ;
}
$l = $l . "
";
return $l;
}
/*############################################################################
# Convert the Data for the Drive to User readable.
############################################################################*/
function getDriveData( $aObj )
{
$l = "".
"Interface: | ". $aObj->interfaceType ."
|
".
"Type: | ". $aObj->driveType ."
|
" .
"State: | ". ($aObj->isReady == '1' ? 'Ready' : 'Not-Ready') ."
|
" .
"Mode: | ". $aObj->status ."
|
" .
"Partition Name: | ". $aObj->name ."
|
" .
"Location: | ". $aObj->location ."
|
";
if($aObj->mediaPresent == 1 || $aObj->barcode != "")
{
$theMediaType = "Unknown";
$MediaType = array("L1" => "LTO-1", "L2" => "LTO-2", "L3" => "LTO-3", "L4" => "LTO-4", "L5" => "LTO-5");
$sTmp = substr($aObj->barcode, -2);
if( $MediaType[$sTmp] )
$theMediaType = $MediaType[$sTmp];
$l = $l . "Barcode: | ". $aObj->barcode ."
|
" .
"MediaType: | ". $theMediaType ."
|
";
}
$l = $l ."Element Address: | ". $aObj->logicalAddress ."
|
" .
"Vendor: | ". $aObj->vendor ."
|
" .
"Model: | ". $aObj->model ."
|
" .
"Physical SN: | ". $aObj->serialNumber ."
|
" .
"Logical SN: | ". $aObj->logicalSerialNumber ."
|
";
if( $aObj->interfaceType == "Fibre" )
{
$l = $l . "WWNN: | ". $aObj->wwnn ."
|
";
$l = $l . "WWPN: | ". $aObj->wwpn ."
|
";
// Port 1
$l = $l . "Loop ID: | ". $aObj->loopId ."
|
";
$sTopo = array("Unknown", "Auto (LN)", "Loop (L)", "Point to Point", "Auto (NL)");
$l = $l . "Topology Request: | ". $sTopo[$aObj->topology] ."
|
";
$sSpeed = array("Auto", "1 Gb/s", "2 Gb/s", "4 Gb/s", "8 Gb/s" );
$sSpeedAct = array("Unknown", "1 Gb/s", "2 Gb/s", "4 Gb/s", "8 Gb/s" );
$l = $l . "Speed Request: | ". $sSpeed[$aObj->speed] ."
|
";
$l = $l . "Topology Actual: | ". $sTopo[$aObj->topologyAct] ."
|
";
$l = $l . "Speed Actual: | ". $sSpeedAct[$aObj->speedAct] ."
|
";
$l = $l . "Speed Max: | ". $sSpeedAct[$aObj->speedMax] ."
|
";
if( $aObj->driveType == "LTO-5")
{
$l = $l . "Active Port: | 1
|
";
$l = $l . "SNW Licenses: | ";
global $user;
$DPSLicense = get_dps_license($user, $aObj->guid);
error_log( "DPSLicense for Drive ". $aObj->guid ." = ". print_r($DPSLicense, true) );
$tmpText = "";
if( !$DPSLicense->LMEnabled && !$DPSLicense->CPFEnabled )
$tmpText = "None";
else if ( $DPSLicense->LMEnabled && $DPSLicense->CPFEnabled )
$tmpText = "Control Path Failover
Access Control";
else if( $DPSLicense->CPFEnabled )
$tmpText = "Control Path Failover";
else if( $DPSLicense->LMEnabled )
$tmpText = "Access Control";
$l= $l . " $tmpText
|
";
}
// Port 2 if Avalible
if( $aObj->portCount == 2 && false ) // Not showing port two for now. But may for DELL
{
$l = $l . " |
";
$l = $l . "Loop ID: | ". $aObj->loopId2 ."
|
";
$sTopo = array("Unknown", "Auto (LN)", "Loop (L)", "Point to Point", "Auto (NL)");
$l = $l . "Topology Request: | ". $sTopo[$aObj->topology2] ."
|
";
$sSpeed = array("Auto", "1 Gb/s", "2 Gb/s", "4 Gb/s", "8 Gb/s" );
$sSpeedAct = array("Unknown", "1 Gb/s", "2 Gb/s", "4 Gb/s", "8 Gb/s" );
$l = $l . "Speed Request: | ". $sSpeed[$aObj->speed2] ."
|
";
$l = $l . "Topology Actual: | ". $sTopo[$aObj->topologyAct2] ."
|
";
$l = $l . "Speed Actual: | ". $sSpeedAct[$aObj->speedAct2] ."
|
";
$l = $l . "Speed Max: | ". $sSpeedAct[$aObj->speedMax2] ."
|
";
$l = $l . "
|
";
}
}
else if( $aObj->interfaceType == "SAS" )
{
// Remove the colon from the SAS Address (pcr 18226)
$sasWwpn = $aObj->wwpn ? str_replace(":", "", $aObj->wwpn) : "";
$l = $l . "SAS Address: | ". $sasWwpn ."
|
";
}
else
$l = $l . "SCSI ID: | ". $aObj->scsiId ."
|
";
// "Error Code: | ". $aObj->errorCode ."
|
" .
// "Ras Status: | ". $aObj->rasStatus ."
|
" .
$l = $l . "Firmware Level: | ". $aObj->firmwareLevel ."
|
";
$l = $l . "Control Path: | ". ($aObj->controlPath?'Yes':'No') ."
|
";
// if the drive is encryption capable
global $libraryEncryption;
$altText = "";
//error_log( print_r($aObj,true) );
//error_log( "\n\n\n\naObj->mediaType = $aObj->mediaType | aObj->mediaTypeCode = $aObj->mediaTypeCode");
// Before CR 70432 if (($aObj->mediaType == 'LTO-4') || ($aObj->mediaTypeCode > 3))
if ($aObj->encryptionSupported)
{
//error_log('Logical Libray NAME:'.$aObj->name ." | libraryEncryption[$aObj->name] = ". $libraryEncryption[$aObj->name]);
switch ($aObj->encryptionMethod)
{
case 2:
$method = "System Managed";
break;
case 3:
$method = "Application Managed";
break;
case 4:
$method = "Library Managed";
break;
case 5:
$method = "Custom";
break;
default:
$method = "N/A";
//if (!is_ibm_encryption_licensed($user))
$altText = "Please purchase the encryption license to activate.";
break;
}
}
else
{
$method = "N/A";
$altText = "The drive does not support Encryption.";
}
$l = $l .="
Encryption Method: | ".$method."
|
";
// $l = $l . "Encryption Method: | ". ($aObj->controlPath?'Yes':'No') ."
| ";
$l = $l ."
".
"";
return $l;
}
/*############################################################################
# Convert the Data for the Chassis to User readable.
############################################################################*/
function getChassisData( $aObj )
{
$l = "".
"Manufacturer: | ". $aObj->manufacturer ."
|
" .
"Model: | ". $aObj->model ."
|
" .
"Serial Number: | ". $aObj->serial ."
|
" .
"
".
"";
return $l;
}
/*############################################################################
# Convert the Data for the Partition to User readable.
############################################################################*/
function getPartitionData( $aObj )
{
global $Brand;
global $libraryEncryption;
switch ($libraryEncryption[$aObj->name])
{
case 2:
$method = "System Managed";
break;
case 3:
$method = "Application Managed";
break;
case 4:
$method = "Library Managed";
break;
case 5:
$method = "Custom";
break;
default:
$method = "N/A";
$altText = "Buy the encryption license to activate.";
break;
}
$l = "".
"Partition Name: | ". $aObj->name ."
|
" .
"Mode: | ". $aObj->status ."
|
";
if( $Brand != 'dell' )
$l = $l. "Emulation Type: | ". $aObj->emulationType ."
|
";
$l = $l. "Barcode Policy: | ". $aObj->barcodePolicy ."
|
" .
"Total Drives: | ". $aObj->totalDrives ."
|
" .
"Active Drives: | ". $aObj->activeDrives ."
|
" .
"Total Media: | ". $aObj->totalMedia ."
|
" .
"Mounted Media: | ". $aObj->mountedMedia ."
|
" .
"Total Slots: | ". $aObj->totalSlots ."
|
" .
"Full Slots: | ". $aObj->fullSlots ."
|
" .
"Total I/E Station: | ". $aObj->totalMailbox ."
|
" .
"Full I/E Station: | ". $aObj->fullMailbox ."
|
" .
//"AutoClean: | ". ($aObj->autoClean ? "Yes" : "No") ."
|
" .
"
Encryption Method: | ".$method."
|
" .
"
".
"";
return $l;
}
/*############################################################################
# Decrement the Slot
############################################################################*/
function getPartitionNum($aName)
{
global $PartList;
foreach( $PartList as $theCount => $part )
if( $part->name == $aName )
return $theCount+1; // List is 0 based our partition numbers are 1 based
return 0;
}
/*############################################################################
# Increment the Slot
############################################################################*/
function incSlot()
{
global $loc_slot;
global $loc_mag;
// Decrement to the Next slot.
$loc_slot++;
// if( $loc_slot > 8 )
// {
// $loc_slot = 1;
// $loc_mag++;
// $loc_mag += 3; //!?!?!Adjust the for the lower Magazine
// }
}
/*############################################################################
# NOTE: Drive do not use this function to display the location
# see drwDrives below.
# NOTE: $aTapePresent is the barcode is a tape is present.
############################################################################*/
function displayLoc( $aPartNum, $aType, $aTapePresent=false )
{
global $loc_chassis;
global $loc_mag;
global $loc_slot;
global $bShowLoc;
global $bPartsOnly;
global $slotHeight;
global $slotWidth;
global $bShowBarCode;
$myPartNum = $aPartNum==null ? ' ' : $aPartNum;
if( ! $aTapePresent )
$tmpWidth = 42;
else
$tmpWidth = 1;
$mySlotHeight = $slotHeight + 2;
if( $bShowLoc )
{
if( $myPartNum==' ' && $bPartsOnly )
{
//echo " ". $aTapePresent ."
\n\n";
// echo " ";
//pcr 20981 show tape cartridges in unassigned slots
if( $aTapePresent )
{
echo "";
if( $aTapePresent == "No_Label" )
echo "
";
else
echo "
";
if( $bShowBarCode )
{
echo "". $aTapePresent ."
\n\n";
}
else
{
if( (int)$loc_chassis >= 0 )
{
$nloc_chassis = (string)(" " . (string)$loc_chassis);
}
else
{
$nloc_chassis = $loc_chassis;
}
echo "". $magType ."". $myPartNum .": ". $nloc_chassis .",". $loc_mag .",". $loc_slot ."\n\n";
}
}
else
echo " ". $aTapePresent ."
\n\n";
}
else
{
// Figure out what kind of Magazine this is.
switch( $loc_mag )
{
case 6: // MailBox Magazine
if( $aType == 'mb' )
{
$myPartNum = 'IE'; // Don't Change this to I/E - It wont fit.
}
else
{
// Add a SPACE so the partition owned IE slot lines up with the Non-owned IE slots
$sTmp = (string)$myPartNum . ' ';
$myPartNum = $sTmp;
}
break;
case 7: // Drive Magazine
// Not doing anything for this for now.
break;
}
// See if its a Cleaning Slot
if( $aPartNum == PART_CLN )
{
error_log("-=-=-=-=- Partiton was PART_CLN so this must be a cleaning slot");
$myPartNum = 'C';
}
// Note: At one point I was displying the Magazing number in red. I left the code to beable to do this agin in. But now changed it to black
// That's why there are font tags in the echo below
echo "";
if( $aTapePresent == "No_Label" )
echo "
";
else if( $aTapePresent )
echo "
";
else
echo "
";
if( $bShowBarCode )
{
echo "". $aTapePresent ."
\n\n";
}
else
{
if( (int)$loc_chassis >= 0 )
{
$nloc_chassis = (string)(" " . (string)$loc_chassis);
}
else
$nloc_chassis = $loc_chassis;
/*###############################################################
# NOTE: Drives do not use this function to display the location
# see drwDrives below.
###############################################################*/
echo "". $magType ."". $myPartNum .": ". $nloc_chassis .",". $loc_mag .",". $loc_slot ."\n\n";
}
}
}
else
{
echo "";
if( $aTapePresent == "No_Label" )
echo "
";
else if( $aTapePresent )
echo "
";
else
echo "
";
echo " ". $aTapePresent ."
\n\n";
// echo "
";
}
echo "\n\n\n";
}
/*############################################################################
# Note the table needs to be defined as follows:
#
# The Cellpadding and spacing need to be defined in the tag for it to look
# correct.
############################################################################*/
function drwSlot( $aType )
{
global $SlotColors;
global $SlotColorsHover;
global $SlotID;
global $SlotList;
global $hSlots;
global $loc_chassis;
global $loc_mag;
global $loc_slot;
global $bShowLoc;
global $bPartsOnly;
global $PartList;
$curLoc = sprintf( "%d,%d,%d", $loc_chassis, $loc_mag, $loc_slot );
if($hSlots[ $curLoc ] != false )
{
$class = $aType=='mb' ? 'MbFoundSlot' : 'FoundSlot';
$partNum = getPartitionNum($hSlots[ $curLoc ]->name);
// Make sure the partition is valid if Not a Mailbox Slot
if( $aType!='mb' )
{
if( $partNum >= 1 && $partNum <= PART_MAX )
$sTmp = "(" . $PartList[$partNum-1]->name . ") ";
else if( $hSlots[ $curLoc ]->slotType == 'Cleaning' )
{
$sTmp = "(Cleaning Slot) ";
$partNum = PART_CLN; // So we can use the Partition Color Array for Cleaning Slots
}
else
{
error_log("------------- Got an Invalid partition of ". $partNum ." for call to drwSlot( ". $aType ." )");
$sTmp = sprintf( "(Invalid partition!) %d,%d,%d", $loc_chassis, $loc_mag, $loc_slot);
}
}
else
{
$sTmp = "(I/E Station Slot) ";
$partNum = PART_IE; // So we can use the Partition Color Array for Cleaning Slots
}
// CR 45104 - Have empty slots just show media domain - not type.
// NOTE: The Media object we use for slots in the library.cpp php extension
// Does not have a mediaDomain member like the library does.
if( $hSlots[ $curLoc ]->mediaPresent != "1" )
{
//error_log(" Making an empty slot = domain | " . $hSlots[ $curLoc ]->mediaType ."=". $PartList[$partNum]->mediaDomain);
//!?! mediaDomain is always blank $hSlots[ $curLoc ]->mediaType = $PartList[$partNum]->mediaDomain;
// !?! Since we have to reload the arrays if a tape is moved this will do the job for now until MediaDomain is populated.
//$hSlots[ $curLoc ]->mediaType = $hSlots[ $curLoc ]->domainType;
}
$slotTitle = sprintf( "%sLocation: %s | Barcode: %s", $sTmp, $hSlots[ $curLoc ]->location, $hSlots[ $curLoc ]->barcode );
$slotData = getSlotData($hSlots[ $curLoc ] );
if( $aType=='mb' )
$myType='mb';
}
else
{
// It's a unused slot
$slotData = $slotTitle = sprintf( "This is an unused %s slot. (%d,%d,%d)", $aType=='mb' ? 'I/E Station' : 'Library', $loc_chassis, $loc_mag, $loc_slot );
$class = $aType=='mb' ? 'MbSlot' : 'LibSlot';
//! $outColor = $aType=='mb' ? '#93C4CC' : '#A4A9C5';
//! $inColor = $aType=='mb' ? '#B2F4FF' : '#C6CBE7';
$partNum = 0; // So we can use the Partition Color Array for Cleaning Slots
}
/* Per CR 48705 NOW they want the IE slots to ALWAY be the IE color */
if($hSlots[ $curLoc ]->slotType == 'IE Station')
{
$outColor = $SlotColors[PART_IE];
$inColor = $SlotColorsHover[PART_IE];
}
else
{
$outColor = $SlotColors[(int)$partNum];
$inColor = $SlotColorsHover[(int)$partNum];
}
//$sWidth = $bShowLoc ? 'width=42' : '';
$sWidth = 'width=56';
echo " \n";
$l = print_r($hSlots[ $curLoc ], TRUE);
//!?! error_log("hSlots[curLoc] = ". $l);
displayLoc( $partNum, $myType, $hSlots[ $curLoc ]->barcode );
$SlotID++;
incSlot();
}
/*############################################################################
Unavailable slot
############################################################################*/
function drwBlankSlot()
{
global $loc_chassis;
global $loc_mag;
global $loc_slot;
global $bShowLoc;
echo " | \n";
displayLoc(false, false);
// Decrement to the Next slot. Slots are ALWAYS 7 - 0
incSlot();
}
/*############################################################################
############################################################################*/
function drwEmptySlot()
{
global $loc_chassis;
global $loc_mag;
global $loc_slot;
global $bShowLoc;
global $slotHeight;
echo " | \n";
// This is a hack - but it gets the job done.
// We do NOT want locations to disply in EMPTY slots - they cannot be used and have no displays.
echo " \n\n";
//displayLoc( false, false );
// Note: We do not want to Inc the Slot here because the unusable slots above and below the mailbox have no location.
}
/*############################################################################
############################################################################*/
function drwSlots( $aCnt )
{
if( $aCnt == null )
{
$aCnt = 6;
}
for( $i=0; $i < $aCnt; ++$i )
{
echo " | ";
drwSlot('lib');
echo "
";
}
}
/*############################################################################
############################################################################*/
function drwMbSlots( $aCnt )
{
global $loc_chassis;
global $loc_mag;
global $hSlots;
if( $aCnt == null )
{
$aCnt = 6;
}
for( $i=0; $i < $aCnt; ++$i )
{
echo "";
// Need to determin if this Chassis has IE stations as Storage or Mail box
$curLoc = sprintf( "%d,%d,%d", $loc_chassis, $loc_mag, $i+1 );
$defType = ($hSlots[ $curLoc ]->slotType == 'IE Station' ? 'mb' : 'lib');
// See if the IE slot is configured as Storage or belongs to a single partition.
//error_log("******* hSlots[". $curLoc. "]->name = \"". $hSlots[ $curLoc ]->slotType ."\" *******" );
if(($hSlots[ $curLoc ]->slotType == 'IE Station') &&
($hSlots[ $curLoc ]->name == "System Partition" || $hSlots[ $curLoc ]->name == "") )
$myType = 'mb';
else
$myType = 'lib';
drwSlot( $myType );
echo "
";
}
}
/*############################################################################
Unavailable slots
############################################################################*/
function drwBlanks( $aCnt )
{
if( $aCnt == null )
$aCnt = 2;
for( $i=0; $i < $aCnt; $i++ )
{
echo "";
drwBlankSlot();
echo "
";
}
}
/*############################################################################
############################################################################*/
function drwEmptys( $aCnt )
{
if( $aCnt == null )
$aCnt = 1;
for( $i=0; $i < $aCnt; $i++ )
{
echo "";
drwEmptySlot();
echo "
";
}
}
/*############################################################################
############################################################################*/
function drwMag( $aIsBot, $aSlotRows )
{
global $loc_mag;
global $loc_slot;
global $bShowLoc;
global $isApollo;
$loc_slot = 1; // Reset slot count for this magazine
// !?! This was needed when we had a report that had no text in the cells.
// if( $bShowLoc )
// $borderSize = 1;
// else
// $borderSize = 0;
echo " \n";
if( $isApollo )
$tRows = 1;
else
$tRows = 2;
drwSlots( $aSlotRows - $tRows );
if( $aIsBot == 1 )
drwBlanks( $tRows );
else
drwSlots( $tRows );
echo "
\n";
}
/*############################################################################
############################################################################*/
function drwMailBoxes( $aSlotRows )
{
global $loc_mag;
global $loc_slot;
global $bShowLoc;
$loc_slot = 1; // Reset slot count for this magazine
echo " \n";
drwEmptys( 1 );
drwMbSlots( $aSlotRows );
// On 9U modules there are 3 unused slots at the bottom of the MailBox rack
// On 5U modules there is only 1.
if( $aSlotRows > 6 )
drwEmptys( $bShowLoc ? 3 : 2 ); // To make things look better only Draw two on the bottom of mailboxes if not showing positions.
else
drwEmptys( 1 );
echo "
\n";
$loc_mag++;
}
/*############################################################################
############################################################################*/
function drwRack( $aHasMb, $aIsBot, $aSlotRows )
{
global $loc_mag;
global $user;
$is9U = $aSlotRows > 8 ? true : false;
echo " \n";
//$loc_mag = $is9U ? ($aHasMb ? 12 : 4) : ($aHasMb ? 9 : 1);
$loc_mag = ($aHasMb ? 4 : 1);
drwMag($aIsBot, $aSlotRows );
echo " | \n";
//$loc_mag = $is9U ? ($aHasMb ? 11 : 5) : ($aHasMb ? 8 : 2);
$loc_mag = ($aHasMb ? 5 : 2);
drwMag($aIsBot, $aSlotRows );
echo " | \n";
//$loc_mag = $is9U ? ($aHasMb ? 10 : 6) : ($aHasMb ? 7 : 3);
$loc_mag = ($aHasMb ? 6 : 3);
if( $aHasMb == 1 )
{
// Adjust the number of Slots passed for the Mailbox
if( $aSlotRows > 8 )
$mSlots = $aSlotRows - 4;
else
$mSlots = $aSlotRows - 2;
drwMailBoxes( $mSlots );
}
else
drwMag($aIsBot, $aSlotRows);
echo " |
\n";
}
/*############################################################################
############################################################################*/
function drwDrives( $aNumDrives, $chassData )
{
global $SlotID;
global $SlotColors;
global $SlotColorsHover;
global $partCur;
global $partDrive;
global $modType;
global $DriveList;
global $DriveNum;
global $loc_chassis;
global $hDrives;
global $bShowLoc;
global $slotWidth;
global $slotHeight;
global $hSlots;
global $bPartsOnly;
global $user;
echo " \n";
echo " \n";
echo " | \n";
echo " \n";
for( $i=1; $i <= $aNumDrives; $i++, $DriveNum++ )
{
// Set All Colors to the defaults incase there is NO drive in the current Sled.
$theBgColor = '#b8bdbf';
$inColor = '#cccccc';
$outColor = '#b8bdbf';
// See if we have a drive that goes in the current location
$theLoc = sprintf("%d,%d", $loc_chassis, $i );
// pcr26420 Null the drive
$theDrive = null;
if( $hDrives[$theLoc] != false )
{
$theDrive = $hDrives[$theLoc];
// Figure out the partition fr the drive we are about to draw
$partName = '';
$driveInfo = 'Drive';
// !?! ADD THE TO HOST STUFF HERE
// if( $partStart[$partCur + 1] == $partDrive )
// {
// $partCur++; // Set to the next partition.
// $partName = 'To host';
// $driveInfo = 'Drive connected to a host';
// }
$partNum = getPartitionNum($hSlots[ $theLoc ]->name);
// Make sure the partition is valid if Not a Mailbox Slot
{
if( $partNum >= 1 && $partNum <= PART_MAX )
$sTmp = "(" . $PartList[$partNum-1]->name . ") ";
else
$sTmp = sprintf( "(Invalid partition!) %d,%d,%d", $loc_chassis, $loc_mag, $loc_slot);
}
$thePartition = getPartitionNum($theDrive->name);
$pNum = $thePartition; // used to select which background image to display
//!?! error_log("theDrive = ". print_r($theDrive, true ));
if( $thePartition > 0 )
{
$theTitle = sprintf("%s | Partition %s | %s", $driveInfo, $thePartition, $hSlots[ $theLoc ]->barcode);
$slotData = getDriveData($theDrive);
$theBgColor = $SlotColors[$thePartition];
$outColor = $SlotColors[$thePartition];
$inColor = $SlotColorsHover[$thePartition];
}
else if( $theDrive->serialNumber != '' )
{
$theTitle = "Unassigned Drive";
$slotData = getDriveData($theDrive);
$theBgColor = $SlotColors[$thePartition];
$outColor = $SlotColors[$thePartition];
$inColor = $SlotColorsHover[$thePartition];
}
else
{
$theTitle = $slotData = "Empty drive slot";
}
}
else
{
$thePartition = ' ';
$pNum = ""; // used to select which background image to display
$theTitle = $slotData = sprintf("Empty drive slot (%s)", $theLoc);
}
// The resizing has been taken out for now. I left the code in - incase we use it in the future.
// if( (int)$slotHeight < 15 )
// {
// $dHeight = 15;
// }
// else
// {
// $dHeight = (int)$slotHeight + 4;
// }
//
// if( (int)$slotWidth < 40 )
// {
// $dWidth = 40;
// }
// else
// {
$dWidth = 60;
// }
echo " \n";
$SlotID++;
echo "";
// pcr24621 Display tapes in unassigned slots, but only if in the user hash
// or if the user has ADMIN/SERVICE role
$theDevice = $hSlots[ $theLoc ];
if( $user->role == ADMIN_ROLE || $user->role == SERVICE_ROLE)
{
$theDevice = $theDrive;
}
if($theDevice->barcode)
{
if($theDevice->barcode == "No_Label")
echo " ";
else
echo " ";
}
else
echo " ";
// Display the Control Path indicater.
if( $theDevice->controlPath && $hDrives[$theLoc] != false )
echo "c";
else
echo " ";
$theLoc = sprintf("%d,%d", $loc_chassis, $i );
if( (($bShowLoc && ($thePartition != 0 || $theDevice->barcode)) || $bPartsOnly == 0 ))
{
if( (int)$loc_chassis >= 0 )
{
$nloc_chassis = (string)(" " . (string)$loc_chassis);
}
else
$nloc_chassis = $loc_chassis;
echo " ". ($thePartition ? $thePartition : " ") .": ". $nloc_chassis .",". $i ." | \n";
}
else
{
if ($theDevice->mediaPresent != "1")
$myBarCode = " ";
else
$myBarCode = $theDevice->barcode;
echo " ". $myBarCode ." ";
}
$partDrive++; // Inc the drive to the next one we will draw
echo " \n";
}
echo " \n";
echo " | | \n";
echo "
\n";
}
/*############################################################################
############################################################################*/
function drwChassis( $aChassis, $aIsBot )
{
global $loc_chassis;
global $loc_mag;
global $bShowLoc;
global $partCur;
global $partDrive;
// Seperate the Model String in to Module type and size
// The data is ControlModule5U or ExpansionModule9U now
$moduleArray = explode( '_', $aChassis->model );
$module = new Cmodule( "Module", substr($aChassis->model, -2, 2) );
$loc_chassis = $aChassis->location;
$rows = $module->size == "9U" ? 16 : 8;
$tDrives = $module->size == "9U" ? 4 : 2;
$is9U = $module->size == "9U" ? true : false;
$isCM = $module->type == "Control" ? true : false;
global $modType;
$modType = $isCM==true ? "cm" : "em";
// error_log( "=============== aChassis->model = $aChassis->model | module->size = $module->size | is9U = $is9U | rows = $rows | isCM = $isCM" );
// Load the Chassis Data that will be displayed when it's clicked on
$chassData = getChassisData($aChassis);
echo " \n";
drwRack( 0, $aIsBot, $rows );
// By Adding the Onlick here it superseds onClicks for all Children like for Drives
// So the Drives tell you they are Expansion or Control Modules
// To get pass this problem I did NOT nest any onclicks - they are all on the lowest level |
echo " | \n";
drwDrives( $tDrives, $chassData );
// Add an area to the bottom of the Module that the onClick works for.
echo " \n";
if( $bShowLoc )
echo ' '. $loc_chassis .'';
else if( $isCM == true )
echo '(CM)';
echo "";
echo " | \n";
$loc_mag = $is9U ? 10 : 5;
drwRack( 1, $aIsBot, $rows );
echo " |
\n";
$loc_chassis++; // Inc for each Chassis we draw.
}
?>