sortColumn = LIB_SORT_DEFAULT;
$sortCriteria->ascending = true;
$sortCriteria = new SortCriteria(1, "ASC","","*"); // Sort on GUIDs
$PartList = get_logical_libraries($user, $sortCriteria);
$numPartList = count($PartList);
for ($libIndex = 0; $libIndex < $numPartList; $libIndex++)
{
$libraryNames[$libIndex] = $PartList[$libIndex]->name;
$libraryIndex[$PartList[$libIndex]->name] = $libIndex;
//error_log("Guid:".$PartList[$libIndex]->guid);
$encryptData = get_partition_enryption($user, $PartList[$libIndex]->guid);
$libraryEncryption[$PartList[$libIndex]->name] = $encryptData->method;
//error_log('$libraryEncryption['.$PartList[$libIndex]->name.'] = '.$libraryEncryption[$PartList[$libIndex]->name]);
}
//debug
/*
$libraryNames[6] = "anyname1";
$libraryIndex["anyname1"] = 6;
$libraryNames[7] = "anyname1";
$libraryIndex["anyname2"] = 7;
$libraryNames[8] = "anyname1";
$libraryIndex["anyname3"] = 8;
$numPartList = $numPartList +3;
*/
$PartList[PART_IE] = "IO STATION"; // !?! was MAILBOX
$PartList[PART_CLN] = "CLEANING";
/*#######################################################
# 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_all_slots($user, $sortCriteria);
$physicalSlotList = get_physical_slots($user, $sortCriteria);
// Put all the Slots in a HASH table
foreach( $SlotList as $Slot )
{
if($Slot->name == "" )
$Slot->name = "Unassigned"; //= "Physical Library";
$hSlots[ $Slot->location ] = $Slot;
}
foreach ($physicalSlotList as $pslot)
{
//error_log($pslot->location);
$pslot->name = "Unassigned";
$hSlots[ $pslot->location ] = $pslot;
}
$sortCriteria = new SortCriteria(0, "ASC","","*"); // Sort on GUIDs
$CleanList = get_cleaning_slots($user, $sortCriteria, 0); // Get ALL Cleaning SLOTs
// Add the cleaning Slots to the HASH table
foreach( $CleanList as $Slot )
{
if($Slot->name == "" )
$Slot->name = "Unassigned"; //"Physical Library";
$hSlots[ $Slot->location ] = $Slot;
}
$ChassisList = get_chassis($user);
// 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 );
$sortCriteria->sortColumn = 1; // Location per Drive Attributes
$sortCriteria->ascending = true;
$sortCriteria->filterPattern = "*";
$DriveList = get_all_drives($user, $sortCriteria);
// Put all the Drives in a HASH table so we can draw them as we get to there locations
foreach( $DriveList as $Drv )
{
if($Drv->name == "" )
$Drv->name = "Unassigned"; //"Physical Library";
$hDrives[ $Drv->location ] = $Drv;
}
// get inaccessible slots
$libModel=0;
$x_hidden="";
$bottomChassis = 0;
foreach ($hChass as $chass)
{
if (!isset($firstChass))
$firstChass=$chass;
if ($chass->model=="ControlModule5U")
$libModel+=5;
if ($chass->model=="ExpansionModule9U")
$libModel+=9;
$bottomChassis = $chass->location;
}
if ($libModel>=23)
$x_hidden=$firstChass->location;
$numChass=count($hChass);
$numSlots=array();
for ($i=10; $i>-10;$i--)
{
if ($hChass[$i])
{
if ($hChass[$i]->model=="ControlModule5U")
{
$n1=8;
$n2=6;
$drvs=2;
}
else
if ($hChass[$i]->model=="ExpansionModule9U")
{
$n1=16;
$n2=12;
$drvs=4;
}
$numSlots[$i]=array(0,$n1,$n1,$n1,$n1,$n1,$n2);
$numSlots[$i]["drives"]=$drvs;
}
}
$libNames=array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");
// $blueShades=array("","#007df1","#009df1","#00b9f1","#00d5f1","#00f1f1","00f1cd","#00f1a5","#00f164","#91f100","#c1f100","#ddf100","#f1f100","#f1dd00","#f1c900","#f1b100");
$blueShades=array("","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9","#7DA7D9");
$namesFound=array();
//print_r($hSlots);
//print_r($hDrives);
//print_r($hChass);
function getSlotCss($address,$type)
{
global $hDrives;
global $hSlots;
global $libNames;
global $namesFound;
global $x_hidden;
global $blueShades;
global $libraryIndex;
global $bottomChassis;
global $libraryEncryption;
$className="map_emptyslot";
$info="";
$libName="";
$colorIn="";
$colorOut="";
$onOver="";
$onOut="";
$onClick="";
$title="";
$estimatedHeight=50;
if ($hSlots[$address]!=false )
$slot=$hSlots[$address];
if ($hDrives[$address]!=false )
$slot=$hDrives[$address];
//error_log('Here is slot info: '.print_r($slot, true));
//blue shades for slots
if ($type=="slot")
{
$len=strlen($slot->name);
$name=substr($slot->name,0);//$len-2);
if ($libNames[$name]=="")
{
$name=substr($slot->name,0);//,$len-1);
}
if ($libNames[$name]!="" && $name!="")
{
$blue_shade=$name;
}
}
// end
if (($x_hidden!="" && $address==$x_hidden.",4,1" || $address==$x_hidden.",5,1")||
$address==$bottomChassis.",1,15" || $address==$bottomChassis.",1,16" ||
$address==$bottomChassis.",2,15" || $address==$bottomChassis.",2,16" ||
$address==$bottomChassis.",3,15" || $address==$bottomChassis.",3,16" ||
$address==$bottomChassis.",4,15" || $address==$bottomChassis.",4,16" ||
$address==$bottomChassis.",5,15" || $address==$bottomChassis.",5,16")
{
$title="Physically inaccessible slot ";
$className="map_inaccessibleslot";
$onClick="
";
$onClick.="
Inaccessible Slot
";
$onClick.="
Type:
Storage
";
$onClick.="
Location:
".$address."
";
$onClick.="
Description:
This slot is inaccessible in the current physical configuration.
";
$onClick.="
";
$onClick.="
";
$estimatedHeight=160;
}
else if ($slot!=false)
{
if ($hSlots[$address]!=false) //slot
{
if (($slot->slotType != "Drive") && ($slot->barcode == "") && (($slot->mediaType == 'LTO-1')||($slot->mediaType == 'LTO-2')||($slot->mediaType == 'LTO-3')||($slot->mediaType == 'LTO-4')))
{
$mediaType = 'LTO';
}
else
{
$mediaType = $slot->mediaType;
}
switch ($slot->slotType)
{
case "Storage" :
if ($slot->name == "Unassigned")
{
if ($slot->barcode)
{
$title="Unlicensed/Unassigned library slot : ".$address;
$onClick="
";
$onClick.="
Unlicensed/Unassigned Slot
";
$onClick.="
Location:
".$slot->location."
";
$onClick.="
Barcode:
".$slot->barcode."
";
$onClick.="
This slot (".$address.") is either currently unlicensed and requires a feature license to use or it is unassigned and must be assigned to a logical library before it can be utilized.
This slot (".$address.") is either currently unlicensed and requires a feature license to use or it is unassigned and must be assigned to a logical library before it can be utilized.
";
$onClick.="
";
$onClick.="
";
$setOnClick="setClickedCell('slot_".$address."','#ffffff','#A7A7A7')";
$estimatedHeight=50;
}
break;
}
error_log('$libraryEncryption['.$slot->name.'] = '.$libraryEncryption[$slot->name]);
// if the drive is encryption capable
if (($slot->mediaType == 'LTO-4') || ($slot->mediaTypeCode > 2))
{
error_log('Logical Libray NAME:::::::::::::::::::::::'.$slot->name);
switch ($libraryEncryption[$slot->name])
{
case 2:
$method = "System Managed Encryption";
break;
case 3:
$method = "Application Managed Encryption";
break;
case 4:
$method = "Library Managed Encryption";
break;
case 5:
$method = "Custom";
break;
default:
$method = "None";
//if (!is_ibm_encryption_licensed($user))
{
$addText = "Buy the encryption license!";
}
break;
}
}
else
{
$method = "N/A";
}
case "Drive" :
$className="map_slot";
$colorIn="#7DA7D9";
$blueShades[$blue_shade];
$onClick="
";
$onClick.="
Assigned Slot
";
$onClick.="
Type:
".$slot->slotType."
";
$onClick.="
Logical Library:
".$slot->name."
";
$onClick.="
Location:
".$slot->location."
";
$onClick.="
Barcode:
".$slot->barcode."
";
$onClick.="
MediaType:
".$mediaType."
";
$onClick.="
Element Address:
".$slot->logicalAddress."
";
$onClick.="
Encryption Method:
".$method."
";
$onClick.="
";
$onClick.="
";
$estimatedHeight=160;
break;
case "IE Station" :
case "IO Station" :
$blue_shade="";
$className="map_ieslot";
$theslottype = "I/O";
$info="I/O";
$colorIn="#6381C6";
$colorOut="#6381C6";
if (($slot->name=="Physical Library") && ($slot->barcode!=""))
{ $onClick="
";
$onClick.="
I/O Station Slot: Cartridge Assigned to Physical Library
";
$onClick.="
The cartridge at this location is assigned to physical library.
This slot (".$address.") is either currently unlicensed and requires a feature license to use or it is unassigned and must be assigned to a logical library before it can be utilized.
";
$onClick.="
";
$onClick.="
";
*/
$onClick="
";
$onClick.="
I/O Station Slot: Unassigned Cartridge
";
$onClick.="
Unassigned cartridges in the I/O station may be assigned to a logical library or to the physical library using the Operator Panel.
";
//$onClick.="
Type:
I/O Station
";
//$onClick.="
Location:
".$slot->location."
";
//$onClick.="
Barcode:
".$slot->barcode."
";
//$onClick.="
MediaType:
".$mediaType."
";
//$onClick.="
Element Address:
".$slot->logicalAddress."
";
$onClick.="
";
$onClick.="
";
$setOnClick="setClickedCell('slot_".$address."','#ffffff','#A7A7A7')";
$estimatedHeight=50;
}
if ($type =="drive")
{
}
else if ($colorIn!="")
{
$onOver="changeBgColor('slot_".$hSlots[$address]->location."','".$colorIn."')";
$onOut="changeBgColor('slot_".$hSlots[$address]->location."','".$colorOut."')";
$setOnClick="setClickedCell('slot_".$address."','#ffffff','".$colorOut."')";
}
$classLibName="map_libname";
if ($libName=="")
$classLibName=$className."_info";
if ($onClick!="")
$onClick="showInfo('".$onClick."','slot_".$address."',".$estimatedHeight.");".$setOnClick;
$ret=array();
$ret["className"]=$className;
$ret["classNameInfo"]=$className."_info";
//blue shades for slots
if ($type=="slot")
{
if ($blue_shade!="")
{
$ret["classNameInfo"].="_".$blue_shade;
}
}
// end
$ret["classLibName"]=$classLibName;
$ret["info"]=$info;
//DEBUG
/*$len = strlen($slot->location);
if (substr($slot->location,$len-1) == '1')
{
$slot->name = "anyname1";
}
if (substr($slot->location,$len-1) == '2')
{
$slot->name = "anyname2";
}
if (substr($slot->location,$len-1) == '3')
{
$slot->name = "anyname3";
}
*/
$ret["libName"]=$libNames[$libraryIndex[$slot->name]]; //$libName;
$ret["drvHere"]=$drvHere;
$ret["onOver"]=$onOver;
$ret["onOut"]=$onOut;
$ret["onClick"]=$onClick;
$ret["title"]=$title;
$ret["blue_shade"]=$blue_shade;
return $ret;
}
function getChassCss($address)
{
global $hChass;
$className="map_chassslot";
$onClick="";
$chass=$hChass[$address];
$title="(".$chass->location.")"." ".$chass->model." | SN: ".$chass->serial." | ".$chass->manufacturer;
$onClick="
";
$onClick.="
Enclosure
";
$onClick.="
Manufacturer:
".$chass->manufacturer."
";
$onClick.="
Model:
".$chass->model."
";
$onClick.="
Serial Number:
".$chass->serial."
";
$onClick.="
";
$onClick.="
";
if ($onClick!="")
$onClick="showInfo('".$onClick."','slot_".$address."',100)";
$ret=array();
$ret["onClick"]=$onClick;
$ret["className"]=$className;
$ret["title"]=$title;
return $ret;
}
$lengend="";
function makeLegend()
{
global $legend;
global $namesFound;
global $libraryNames;
global $libNames;
global $numPartList;
$legend="
";
$legend.="
CLN
";
$legend.="
I/O
";
$legend.="
Storage
";
$legend.="
Unlicensed/Unassigned
";
$legend.="
";
$legend.="
";
$legend.="
Logical Library Key:
";
$legend.="
";
for ($i=0;$i<$numPartList;$i++)
{
// if ($namesFound[$i]==1)
{
if (($i%5) == 0)
{
$legend.="
";
}
?>
Drive logs
// Get the time this page was loaded
$lastrefresh = time();
?>
Library Map
Last refresh: =date("l\, F j\, Y G:i:s T", $lastrefresh);?>
$curChass=1;
foreach($hChass as $enc)
{
?>
for ($x=1;$x<=3;$x++)
{
?>
for ($y=1;$y<=$numSlots[$enc->location][$x];$y++)
{
$address=$enc->location.",".$x.",".$y;
$cssInfo=getSlotCss($address,"slot");
$slot_info=$address;
if ($cssInfo["classNameInfo"]=="map_inaccessibleslot_info")
$slot_info="";
?>
for ($y=1;$y<=$numSlots[$enc->location][$x];$y++)
{
$address=$enc->location.",".$x.",".$y;
$cssInfo=getSlotCss($address,"slot");
$slot_info=$address;
if ($cssInfo["classNameInfo"]=="map_inaccessibleslot_info")
$slot_info="";
?>