parent $user_interfaces
object $tree_ui
var $root dbref 'tree_ui
var $root child_index 0
var $root fertile 0
var $root manager $tree_ui
var $root owned [$tree_ui]
var $root owners [$]
var $root writable []
var $root readable ['parameters, 'methods, 'code]
var $old_command_environment verb_cache #[]
var $old_command_environment command_cache []
var $old_command_environment shortcuts_cache []
var $has_commands commands [["@tparents * tree *", 'parents_by_tree_cmd], ["@tparents *", 'parents_by_tree_cmd], ["@tkids|@tchildren * tree *", 'children_by_tree_cmd], ["@tkids|@tchildren *", 'children_by_tree_cmd]]
var $has_commands shortcuts []
var $root inited 1
method parents_by_tree_cmd
arg com, obj, [tree];
var parents, line, par, colx, col, x;
if (!tree)
tree = "tree inheritance";
tree = tosym(sublist(tree.to_list(" "), 2).to_string());
obj = .match_env_nice(obj);
if (tree == 'inheritance)
parents = obj.parents();
else
parents = obj.parents_by_tree(tree);
col = (.linelen()) / 8;
colx = col * 3;
line = "Parent" + ((listlen(parents) > 1) ? "s" | "");
.tell(((((line + " of ") + (obj.namef('ref))) + " in tree ") + tostr(tree)) + ":");
line = pad(" Name", colx + 2) + pad(" Perms", col - 2);
.tell((line + pad("Size ", -col)) + "Manager");
for par in (parents) {
line = " " + (par.namef('xref));
line = pad(line, colx + 2);
line = line + pad(" " + ($object.see_perms(par)), col - 2);
line = line + pad(tostr(par.size()) + " ", -col);
line = line + pad($object.get_name(par.manager(), 'namef, ['xref]), colx);
}
.tell(line);
.
method children_by_tree_cmd
arg com, obj, [tree];
var children, line, child, colx, col, x;
tree = [@tree, "", "inheritance"][2];
tree = tosym(tree);
obj = .match_env_nice(obj);
if (tree == 'inheritance) {
children = obj.children();
} else {
catch ~treenf {
children = obj.children_by_tree(tree);
} with handler {
children = [];
}
}
if (!children) {
.tell(((("Children of " + (obj.namef('xref))) + "in tree ") + tostr(tree)) + ": ** None **");
} else {
col = (.linelen()) / 8;
colx = col * 3;
line = "Children" + ((listlen(children) > 1) ? "s" | "");
.tell(((((line + " of ") + (obj.namef('ref))) + " in tree ") + tostr(tree)) + ":");
line = pad(" Name", colx + 2) + pad(" Perms", col - 2);
.tell((line + pad("Size ", -col)) + "Manager");
for child in (children) {
line = " " + (child.namef('xref));
line = pad(line, colx + 2);
line = line + pad(" " + ($object.see_perms(child)), col - 2);
line = line + pad(tostr(child.size()) + " ", -col);
line = line + pad($object.get_name(child.manager(), 'namef, ['xref]), colx);
.tell(line);
}
}
.