Example #1
0
function getUserResourcesDown(&$nodeprivs, $nodeid, $userid, $resourceprivs)
{
    # FIXME can we check for cascading and if not there, don't descend?
    $children = getChildNodes($nodeid);
    foreach (array_keys($children) as $id) {
        addNodeUserResourcePrivs($nodeprivs, $id, $nodeid, $userid, $resourceprivs);
        getUserResourcesDown($nodeprivs, $id, $userid, $resourceprivs);
    }
}
Example #2
0
function JSONprivnodelist2($nodelist)
{
    $data = '';
    foreach (array_keys($nodelist) as $id) {
        $data .= "{name:'{$id}', display:'{$nodelist[$id]['name']}' ";
        $children = getChildNodes($id);
        if (count($children)) {
            $data .= ", children: [ " . JSONprivnodelist2($children) . "]},";
        } else {
            $data .= "},";
        }
    }
    $data = rtrim($data, ',');
    return $data;
}
Example #3
0
function recursivePrintNodes2($nodelist, $openNodes, $activeNode = "")
{
    foreach (array_keys($nodelist) as $id) {
        $opentext = "";
        if (in_array($id, $openNodes)) {
            $opentext = "expandLevel=1";
        }
        print "  <div dojoType=\"TreeNode\" title=\"{$nodelist[$id]['name']}\" widgetId={$id} {$opentext}>\n";
        $children = getChildNodes($id);
        if (count($children)) {
            recursivePrintNodes2($children, $openNodes);
        }
        print "  </div>\n";
    }
    return;
}
Example #4
0
function XMLRPCgetNodes($root = NULL)
{
    global $user;
    if (in_array("userGrant", $user["privileges"]) || in_array("resourceGrant", $user["privileges"]) || in_array("nodeAdmin", $user["privileges"])) {
        $root = processInputData($root, ARG_NUMERIC);
        $topNodes = $root ? getChildNodes($root) : getChildNodes();
        $nodes = array();
        $stack = array();
        foreach ($topNodes as $id => $node) {
            $node['id'] = $id;
            array_push($nodes, $node);
            array_push($stack, $node);
        }
        while (count($stack)) {
            $item = array_shift($stack);
            $children = getChildNodes($item['id']);
            foreach ($children as $id => $node) {
                $node['id'] = $id;
                array_push($nodes, $node);
                array_push($stack, $node);
            }
        }
        return array('status' => 'success', 'nodes' => $nodes);
    } else {
        return array('status' => 'error', 'errorcode' => 70, 'errormsg' => 'User cannot access node content');
    }
}