mirror of
				https://github.com/xcat2/xcat-core.git
				synced 2025-11-03 21:02:34 +00:00 
			
		
		
		
	git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/trunk@3990 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd
		
			
				
	
	
		
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
/* 
 | 
						|
 * osi_source.php
 | 
						|
 * to provide the JSON-style data to the function init_ositree();
 | 
						|
 */
 | 
						|
 | 
						|
if(!isset($TOPDIR)) { $TOPDIR="/opt/xcat/ui";}
 | 
						|
 | 
						|
require_once "$TOPDIR/lib/functions.php";
 | 
						|
require_once "$TOPDIR/lib/security.php";
 | 
						|
require_once "$TOPDIR/lib/display.php";
 | 
						|
require_once "$TOPDIR/js/jsonwrapper.php";
 | 
						|
 | 
						|
//get all the groups
 | 
						|
//$xml=docmd("lsdef","",array("-t", "group"));
 | 
						|
//if(getXmlErrors($xml,$errors)) {
 | 
						|
//    echo "<p class=Error>",implode(' ', $errors), "</p>";
 | 
						|
//    exit;
 | 
						|
//}
 | 
						|
//$groups = array();
 | 
						|
//$jdata = array();
 | 
						|
//foreach($xml->children() as $response) foreach($response->children() as $data) {
 | 
						|
    //all the groups are stored into $groups
 | 
						|
//    array_push($groups, $data);
 | 
						|
//}
 | 
						|
 | 
						|
$xml = docmd("lsdef","",array("-t", "node", "-w", "nodetype=~osi"));
 | 
						|
if(getXmlErrors($xml,$errors)) {
 | 
						|
    echo "<p class=Error>", implode(' ', $errors), "</p>";
 | 
						|
    exit;
 | 
						|
}
 | 
						|
 | 
						|
$host = system("hostname|cut -f 1 -d \".\"");
 | 
						|
 | 
						|
//print_r($groups);
 | 
						|
//TODO:
 | 
						|
//rebuild the jsTree
 | 
						|
//echo json_encode($jdata);
 | 
						|
echo <<<TOS3
 | 
						|
[
 | 
						|
{"data":"all","attributes":{
 | 
						|
    "id":",all","rel":"group"
 | 
						|
    },"state":"closed"
 | 
						|
},
 | 
						|
{"data":"another","attributes":{
 | 
						|
    "id":",another","rel":"group"
 | 
						|
    },"state":"open"
 | 
						|
}
 | 
						|
]
 | 
						|
TOS3;
 | 
						|
?>
 |