/******************************************************************************
* Copyright 1991-2006 by Quantum, Inc. All rights reserved.
* No part of this work may be reproduced or transmitted in any
* form or by any means, electronic or mechanical, including
* photocopying and recording, or by any information storage
* or retrieval system, except as may be expressly permitted by
* the 17 U.S.C. section 101, et. seq., or in writing by
* Quantum, Inc.
*******************************************************************************/
/*##############################################################################
# NOTE: The XAJAX stuff MUST be before any Code.
# You MUST use both the name and id in all form data to use it in xajax.
# Groups of controls like raidoButtons need to all have the SAME name
# but different IDs.
##############################################################################*/
require_once("xajax_core/xajax.inc.php");
$xajax = new xajax();
$xajax->registerFunction("getZoning");
session_start();
$user = $_SESSION['user'];
$in_xAjax = false;
$xAjax_objResponse;
include('common_admin_inc.htm');
include('IOB_inc.htm');
// The php function that is called from JavaScript tough xAjax when the user selects a Blade.
function getZoning($aBladeID)
{
global $in_xAjax;
global $xAjax_objResponse;
$user = $_SESSION['user'];
$xAjax_objResponse = new xajaxResponse();
$in_xAjax = true;
// Get the HostPortFailover data first.
error_log("Calling get_host_port_failover($user, $aBladeID);");
$hpfData = get_host_port_failover($user, $aBladeID);
error_log("hpfData = ". print_r($hpfData, true) );
if( $hpfData->enabled == 1 )
{
error_log("HostPortFaileOver IS enabled");
// Get rid of the Apply button and pop the caution with the link to HPF.
$theText = '
' .
'You must disable Host Port Failover for this blade before you can configure channel zoning. ' .
'Please Click here to cofigure Host Port Failover.
';
$xAjax_objResponse->assign('hpfWarn', 'innerHTML', $theText );
$xAjax_objResponse->assign('ApplyDiv', 'style.visibility', 'hidden' );
}
error_log("Calling get_blade_zoning($user, $aBladeID);");
$theData = get_blade_zoning($user, $aBladeID);
error_log("theData = ". print_r($theData, true) );
// Load up the zones for the first target
$target = 1;
foreach( $theData as $zones )
{
// Data returned is in a 0-5 array
for($i = 2; $i<6; $i++)
{
error_log("Channel ". ($i+1) ." = ".$zones[$i]);
$id = $target."chan".($i+1);
$xAjax_objResponse->assign($id, "checked", $zones[$i]==1?true:false );
}
$target++;
}
// First load the original values so we know if there was a change.
// $xAjax_objResponse->assign("primPortIdOrig", "value", $theData->port_id );
// $xAjax_objResponse->assign("featureEnabledOrig", "value", $theData->enabled );
// $xAjax_objResponse->script('alert(xajax.$("primPortIdOrig").value);');
// $xAjax_objResponse->script('alert(xajax.$("featureEnabledOrig").value);');
// Some Debug examples
//$xAjax_objResponse->script('alert(xajax.$("testlevel[1]").value);');
//$xAjax_objResponse->script('alert(xajax.viewSource());');
$in_xAjax = false;
return $xAjax_objResponse;
}
$xajax->processRequest();
/*******************************************************************************************/
// Handle the progress screen if opened and get the NEW data
if ($_SERVER[REQUEST_METHOD] == "POST")
{
$operationInProgress = true;
$status = new ReturnStatus();
error_log("_POST = ". print_r($_POST, true) );
// Build the Array from the post data to send to the php extension.
$string = "";
$data = array(array(0,0,0,0,0,0),array(0,0,0,0,0,0));
for($target=0; $target<2; $target++)
{
for($chan=3; $chan<=6; $chan++)
{
$id = $target+1 ."chan". $chan ;
if(isset($_POST[$id]))
{
error_log("Setting $id to 1");
$data[$target][$chan-1] = 1;
$string .= "1";
}
else
$string .= "0";
}
}
error_log("string = ". $string );
error_log("NEW data = ". print_r($data, true) );
error_log("set_blade_zoning( $user, ".$_POST['bladId'].", $data );");
set_blade_zoning( $user, $_POST['bladeId'], $string );
print $status->out();
return;
}
/*#############################################################
# Only Channels 1 and 2 can be tagets. All chanhels can be
# Initiators. But NO targets Make No Since. So pop up a
# message when there are no targets.
#############################################################*/
$channels = array('', 'T', 'T', 'I', 'I', 'I', 'I', 'I'); // No 0 !?!
?>
$xajax->printJavascript();
?>
Blade Channel Zoning
include('progressWin_inc.htm');
?>