include('common_admin_inc.htm'); if (isset($_GET['method'])) { // Required to support the operation in progress dialog. $operationInProgress = true; $status = new ReturnStatus(); $method = $_GET['method']; if ($method == "createLibrary") { error_log("* * * We are creating logical library(s)"); $libName = $_POST['libName']; $emulationType = $_POST['emulationType']; $barcodePolicy = $_POST['barcodePolicy']; $autoClean = isset($_POST['autoClean']) ? 1 : 0; $drives = explode(":", $_POST['selectedDrives']); $slotCount = $_POST['slotCount']; create_logical_library($user, $libName, $emulationType, $barcodePolicy, $autoClean, $drives, $slotCount); if( is_cmd_path_failover_licensed($user) != true ) //!?!CPF Leave this in, it may change back to this method set_cmd_path_failover_enabled($user, $libGUID, isset($_POST['CPF']) ? 1 : 0 ); set_cmd_path_failover_enabled($user, $libGUID, 1 ); } else if ($method == "autoPartition") { error_log("* * * We are Autocreating logical library(s)"); $partitionCount = $_POST['partitionCount']; auto_partition($user, $partitionCount); } else if ($method == "deleteLibrary") { error_log("* * * We are deleting logical library(s)"); $libInfo = explode(":", $_POST['selectedLibrary']); delete_logical_library($user, $libInfo[1]); } else if ($method == "modifyLibrary") { error_log("* * * We are modifying logical library(s) * * * * * * NOTE: THIS SHOULD NEVER BE IN THE LOGS FROM A TESTER - This is a Development only operation"); $libName = $_POST['libName']; $libGUID = $_POST['libGUID']; $emulationType = $_POST['emulationType']; $barcodePolicy = $_POST['barcodePolicy']; $autoClean = isset($_POST['autoClean']) ? 1 : 0; $drives = explode(":", $_POST['selectedDrives']); $slotCount = $_POST['slotCount']; modify_logical_library($user, $libGUID, $libName, $emulationType, $barcodePolicy, $autoClean, $drives, $slotCount); } print $status->out(); return; } $libs = get_logical_libraries($user, $sortCriteria); $lib_count = count($libs); $counts = get_all_resource_counts($user); $libNames = array(); $libDrives = array(); $sParExt = 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'); foreach ($libs as $lib) { $libNames[] = $lib->name; // Get only the drives that have tapes in them (So we know when to disable modify) // We'll save the library GUID off to compare in modifyLib() $drives = get_all_drives_by_library($user, $lib->guid, $sortCriteria,(int)2,(int)MEDIA_TYPE_ANY); if( $drives ) $libDrives[] = $lib->guid; else $libDrives[] = '0'; } // Now find the next name will will use automaticly $newLibName = ""; for( $i=0; $i < sizeof($sParExt)-1; $i++) { //error_log( "Looking for ". "library_".$sParExt[$i] ); if( ! in_array( "library_".$sParExt[$i], $libNames ) ) { //error_log("Found one not being used ". "library_".$sParExt[$i] ); $newLibName = "library_".$sParExt[$i]; break; } } //error_log("New Library name will be ". $newLibName); $selectOpClass = "visibleDiv"; $initBackDiv = "'selectOperation'"; $autoManualInqDiv = "hiddenDiv"; $showAutoCreate = false; // If there are available resources, // then we show the auto partition mode if( $counts->unassigned_slot_count > 0 && $counts->unassigned_drive_count > 0) { if( $lib_count <= 0 ) { // Only show the autocreate stuff $autoManualInqDiv = "visibleDiv"; $selectOpClass = "hiddenDiv"; $initBackDiv = "'autoManualInqDiv'"; } else { // Show the Autocreate button along with the Create, Modify, Delete $showAutoCreate = true; } } $nSlots = get_num_cleaning_slots($user); $autoCleanEnabled = true; if( $nSlots == 0 ) $autoCleanEnabled = false; else $settings = get_settings($user); //!?!CPF $cpfFlag = ""; // if( is_cmd_path_failover_licensed($user) != true ) // $cpfFlag = "DISABLED"; // else if( get_cmd_path_failover_enabled($user, $libGUID ) == true ) //!?! I don't think this is needed - we are not persisting this value // $cpfFlag = "CHECKED"; $emulationMap = get_emulation_map($user); ksort($emulationMap); $barcodeFormatMap = get_barcodeformat_map($user); ksort($barcodeFormatMap); // Get the avlible Drive types so we can chose the default number of partitions in Autocreate. $drives = get_all_drives($user, $sortCriteria); error_log("\n\n\nALL Drives = ". print_r($drives, true) ); $interfaceType = array(0,0,0,0,0,0); // "Unknown", "Fibre", "SCSI", "Serial", "Ethernet", "SAS" foreach($drives as $drive) { if( $drive->name == "Physical Library" ) { // It's an Avalible drive - log it's interface type // Just set this to 1 so we can use it to add up the number of Different interface types. // At this point we don't care how many of each there are. $interfaceType[$drive->interfaceTypeEnum] = 1; } } $AvalibleInterfaceType = $interfaceType[1] + $interfaceType[2] + $interfaceType[5]; // Only Fibre, SCSI and SAS for now error_log(" There were ". $AvalibleInterfaceType ." avalible InterfaceTypes found.\n\n\n\n"); ?>