2009-08-05 16:23:52 +00:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
* osi_source.php
|
|
|
|
* to provide the JSON-style data to the function init_ositree();
|
|
|
|
*/
|
|
|
|
|
2009-09-01 20:25:18 +00:00
|
|
|
if(!isset($TOPDIR)) { $TOPDIR="..";}
|
2009-08-05 16:23:52 +00:00
|
|
|
|
|
|
|
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
|
2009-08-13 06:45:39 +00:00
|
|
|
//$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"));
|
2009-08-05 16:23:52 +00:00
|
|
|
if(getXmlErrors($xml,$errors)) {
|
2009-08-13 06:45:39 +00:00
|
|
|
echo "<p class=Error>", implode(' ', $errors), "</p>";
|
2009-08-05 16:23:52 +00:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2009-08-13 06:45:39 +00:00
|
|
|
$host = system("hostname|cut -f 1 -d \".\"");
|
|
|
|
|
|
|
|
//print_r($groups);
|
|
|
|
//TODO:
|
|
|
|
//rebuild the jsTree
|
2009-08-05 16:23:52 +00:00
|
|
|
//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;
|
|
|
|
?>
|