\n"; //echo "\n"; // Get the noderange $noderange = @$_REQUEST['noderange']; //echo "

noderange=$noderange.

\n"; if (empty($noderange)) { echo "

Select one or more groups or nodes.

\n"; exit; } // Get the attributes $xml = docmd('lsdef',NULL,array($noderange,'-t','node','-l')); //echo "

"; print_r($xml); echo "

\n"; $errors = array(); if (getXmlErrors($xml,$errors)) { echo "

lsdef failed: ", implode(' ',$errors), "

\n"; exit; } // Process the lsdef output to get column headers and attributes for each node $headers = array(); $attrs = array(); //echo "

"; foreach ($xml->children() as $response) foreach ($response->children() as $k => $v) { $line = (string)$v; // we assume $k is info //echo "$line
"; if (preg_match('/^\s$/', $line)) { continue; } // ignore blank line $matches = array(); if (preg_match('/^Object name:\s*(.*)$/', $line, $matches)) { $nodename = $matches[1]; // all the attributes following will be for this node until we hit another line like this $attrs[$nodename] = array(); //echo "

New node: $nodename.

\n"; continue; } // If we get here, the line is just attr=val list($key, $value) = preg_split('/\s*=\s*/', $line, 2); //echo "

$key = $value.

\n"; $attrs[$nodename][$key] = $value; $headers[$key] = 1; } //echo "

\n"; // Now display the table with the data we gathered echo "
\n"; //insertButtons(array('label' => 'Show Attributes', 'id' => 'attrButton', 'onclick' => '')); // Display links to column descriptions echo "\n"; // Display the column headings echo "\n"; echo "\n"; $headers2 = array_keys($headers); sort($headers2); echo ""; foreach($headers2 as $colHead) { echo ""; } echo "\n"; # close header row // Save the width of the table for adding a new row when they click that button //$tableWidth = count($headers); // Display table contents. Todo: remember its contents in a session variable. $ooe = 0; // alternates the background of the table //$item = 0; // the column # //$line = 0; //$editable = array(); foreach ($attrs as $node => $attrarray) { $cl = "ListLine$ooe"; // 1st the column for the node name echo ""; // Now go thru the column names and display the value if there is one for this node foreach($headers2 as $colHead) { if (isset($attrarray[$colHead])) $cell = $attrarray[$colHead]; else $cell = ''; echo ""; //$editable[$line][$item++] = $v; } echo "\n"; //$line++; //$item = 0; $ooe = 1 - $ooe; } echo "
Node$colHead
$node$cell
\n"; echo "
\n"; echo "\n"; //insertNotDoneYet(); ?>