partition = "";
$this->action_id = 0;
$this->basic_interval = 0;
$this->normal_interval = 0;
$this->full_interval = 0;
$this->ta_threshold = 3;
$this->ta_scan_type = 0;
$this->import_scan_type = 0;
$this->suspect_count_scan_type = 0;
$this->post_ras_fail_type = 0;
$this->concurrent_scans = 0;
$this->priority = 1;
$this->export_media_fail_type = 0;
$this->request_copy_fail_type = 0;
$this->report_media_inaccessible = 0;
$this->paused = 0;
}
function setFromPostdata($postdata)
{
$this->action_id = intval($postdata["action_id"]);
$this->request_copy_fail_type = intval($postdata["request_copy_fail_type"]);
$this->suspect_count_scan_type = intval($postdata["suspect_count_scan_type"]);
$this->basic_interval = intval($postdata["basic_interval"]);
$this->normal_interval = intval($postdata["normal_interval"]);
$this->full_interval = intval($postdata["full_interval"]);
$this->ta_scan_type = intval($postdata["ta_scan_type"]);
$this->ta_threshold = intval($postdata["ta_threshold"]);
$this->import_scan_type = intval($postdata["import_scan_type"]);
$this->post_ras_fail_type = $postdata["post_ras_fail_type"] == "true";
$this->concurrent_scans = intval($postdata["concurrent_scans"]);
$this->priority = 1;
$this->export_media_fail_type = 0;
$this->report_media_inaccessible = $postdata["report_media_inaccessible"] == "true";
$this->paused = 0;
}
}
// Get EKM license counts so we make sure the user doesn't exceed them.
$ekmMax = get_ekm_drive_cnt($user);
$ekmUsed = get_ekm_used_count($user);
// Same for DPS licenses
$dpsMax = get_max_dps_drive_cnt($user);
$dpsUsed = get_dps_used_count($user);
$hasEdlm = is_feature_licensed($user, "EDLM");
if ($_SERVER[REQUEST_METHOD] == "POST")
{
$operationInProgress = true;
$status = new ReturnStatus();
$action = $_POST["action"];
if($action == "delete")
{
// Release DPS licenses used by the partition.
// XXX I don't think we should be handling this in PHP code, but
// I'm taking the path of least resistence for now.
$drives = get_all_drives_by_library($user, $_POST["guid"], $sortCriteria, (int)0, (int)MEDIA_TYPE_ANY);
if($dpsMax != 0)
{
foreach($drives as $drive )
{
$DPSLicense = get_dps_license($user, $drive->guid);
if($DPSLicense->UsesFeature)
{
submit_dps_license($user, $drive->guid, 0, 0, 0, 0);
}
}
}
// Now delete the partition.
delete_logical_library($user, $_POST["guid"]);
}
else if($action == "auto")
{
auto_partition($user, $_POST["count"]);
}
else if($action == "create")
{
// Create Partition
$libraryManaged = intval($_POST['library_managed']);
$libName = $_POST['name'];
$autoClean = 0;
$drives = explode(":", $_POST['selected_drives']);
$slotCount = intval($_POST['slots']);
error_log("POST DATA: ".print_r($_POST, true));
$emulationType = intval($_POST['emulation']);
$barcodePolicy = intval($_POST['barcode_format']);
create_logical_library($user, $libName, $emulationType, $barcodePolicy, $autoClean, $drives, $slotCount, $libraryManaged);
$guid = get_partition_id_from_name($user, $libName);
// Create EDLM Policy (only if EDLM is licensed)
if($hasEdlm)
{
error_log("Setting edlm config");
$config = new EdlmPolicy();
$config->partition = $guid;
$config->setFromPostdata($_POST);
error_log("Comitting edlm config");
edlm_set_partition_config($user, $config);
}
}
else if($action == "modify")
{
$libGUID = $_POST['guid'];
$libName = $_POST['name'];
$autoClean = 0;
$newDrives = explode(":", $_POST['selected_drives']);
$slotCount = intval($_POST['slots']);
$emulationType = intval($_POST['emulation']);
$barcodePolicy = intval($_POST['barcode_format']);
$drives = get_all_drives_by_library($user, $libGUID, $sortCriteria, (int)0,(int)MEDIA_TYPE_ANY);
// Commit the basic changes
modify_logical_library($user, $libGUID, $libName, $emulationType, $barcodePolicy, $autoClean, $newDrives, $slotCount);
// Update DPS licenses, if necessary
if( $dpsMax != 0 )
{
// Release all FIPS Licensing for the OLD drives
foreach($drives as $drive )
{
$DPSLicense = get_dps_license($user, $drive->guid);
submit_dps_license($user, $drive->guid, $DPSLicense->CPFEnabled, $DPSLicense->LMEnabled, $DPSLicense->DPFEnabled, 0);
}
// Get the new Drive List and Set Fips accordingly
$drives = get_all_drives_by_library($user, $libGUID, $sortCriteria, (int)0,(int)MEDIA_TYPE_ANY);
$encryption = get_partition_enryption( $user, $libGUID );
foreach($drives as $drive )
{
$DPSLicense = get_dps_license($user, $drive->guid);
submit_dps_license($user, $drive->guid, $DPSLicense->CPFEnabled, $DPSLicense->LMEnabled, $DPSLicense->DPFEnabled, $encryption->fips_mode);
}
}
// Update EDLM Policy (only if EDLM is licensed)
if($hasEdlm)
{
$new_policy = new EdlmPolicy();
$new_policy->partition = $libGUID;
$new_policy->setFromPostdata($_POST);
edlm_set_partition_config($user, $new_policy);
}
}
print $status->out();
return;
}
$emulationMap = get_emulation_map($user);
$barcodeFormatMap = get_barcodeformat_map($user);
$typeMap = array(0 => "Standard", 1 => "Library Managed (EDLM)");
$scanTypeMap = edlm_get_scan_type_map();
$copyTriggerMap = array(0 => "[Disabled]", 1 => "Suspect Only", 2 => "Bad Only", 3 => "Bad or Suspect");
$taThresholdArray = range(0, 15);
unset($taThresholdArray[0]); // Remove because zero is not a valid selection.
$edlmApps = edlm_get_external_apps();
// Create a mapping of id -> app name for the extapps
$appMap = array(0 => "None");
foreach($edlmApps as $app)
{
$appMap[$app->id] = $app->name;
}
$ekm_type = get_ekm_type($user);
$counts = get_library_summary_info($user);
$libs = $counts->libs;
// Host partitions must use licensed slots
$hostLibAvailSlots = $counts->unassigned_slot_count;
// EDLM partitions can use any unassigned slot
$edlmLibAvailSlots = $counts->edlm_unassigned_slot_count;
$edlmDefaultSlots = $counts->unlicensed_slot_count - $counts->edlm_assigned_slot_count;
if($edlmDefaultSlots < 0) $edlmDefaultSlots = 0;
// Determine if we have resources to create partitions
$edlmDrivesAvailable = count(edlm_get_drives($user, true));
$hostDrivesAvailable = $counts->unassigned_drive_count - $edlmDrivesAvailable;
// Can we auto create?
$canAutoPartition = (($hostLibAvailSlots > 0) and ($hostDrivesAvailable > 0));
// Can we create EDLM partitions?
$canCreateEdlmLib = $hasEdlm && ($edlmDrivesAvailable > 0);
// Can we create Host partitions?
$canCreateHostLib = $canAutoPartition;
// Determine if LME is available on an EDLM partition, and count the
// number of EDLM LME partitions, and the nubmer of standard partitions with policies and LME
$edlmHasLME = false;
$edlmLMEPartitionCount = 0;
$stdPartWithLMEandEDLMCount = 0;
foreach($libs as $lib)
{
if($lib->libraryManaged)
{
if($lib->method == 4)
{
$edlmHasLME = true;
$edlmLMEPartitionCount++;
}
}
else
{
if($lib->method == 4 && $lib->edlm_policy->active)
{
$stdPartWithLMEandEDLMCount++;
}
}
}
// Iterate through libraries to see if we have an EDLM partition.
// If not, we will display a warning on the EDLM policy settings page.
// Also determine if any non-edlm partitions have policies configured.
// Also, count the number of edlm partitions
$hasEdlmPartition = false;
$hasEdlmPolicy = false;
$edlmPartitionCount = 0;
foreach($libs as $lib)
{
if($lib->libraryManaged)
{
$hasEdlmPartition = true;
$edlmPartitionCount++;
}
else if($lib->edlm_policy->active)
{
$hasEdlmPolicy = true;
}
}
function getNewLibDefaultName($type)
{
// The default name is either library_X or edlm_X, where "X"
// is the next available letter in alphabetic sequence.
global $libs;
// Because of PHP retardedness, we need to keep a junk char in the 0-index position.
$letters = array('*','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r');
$prefix = $type ? "edlm_" : "library_";
foreach($libs as $lib)
{
// Delete letters that are used from the array
if((strlen($lib->name) == (strlen($prefix) + 1)) and (startsWith($lib->name, $prefix)))
{
$letter = $lib->name[strlen($prefix)];
$key = array_search($letter, $letters);
if($key != false)
{
unset($letters[$key]);
}
}
}
// Now the first letter in the array is the first unused one.
$first = array_slice($letters, 1, 2);
return $prefix.($first[0]);
}
?>
Setup Partition
css("style");
js("common");
js("loading");
js("validate");
?>
Setup - Partitions
Create, Modify, or Delete a Library Partition.
if(count($libs) == 0) { ?>
There are currently no partitions on the library.
} else { ?>
} // end if count $libs > 0 ?>
button("Modify", "modifyButton", "modifyPartition()", count($libs) == 0); ?>
button("Delete", "deleteButton", "deletePartition()", count($libs) == 0); ?>
button("Create", "createButton", "createPartition()", !($canCreateEdlmLib || $canCreateHostLib)); ?>
button("Auto", "autoButton", "autoPartition()", !$canAutoPartition); ?>
cancelButton("cancel1") ?>
Automatically Create Partitions
Automatic partitioning assigns library resources proportionately among the partitions, see online help for more information.
Enter the number of partitions you would like to create.
= $hostDrivesAvailable ?>
= $counts->unassigned_slot_count ?>
= $counts->mailbox_count ?>
= $counts->cleaning_count ?>
button("Back", "nextButton1", "goToDiv('partitionsDiv')"); ?>
button("Apply", "applyButton1", "doAutoPartition()"); ?>
cancelButton("cancel_auto") ?>