Forum OpenACS Development: Re: dotWRK: Project Manager

Collapse
Posted by Ola Hansson on
Nick, you may find it easier to let the db (and templating system) do the indentation work for the visual tree structure, rather than to let the Tcl layer do it. I believe that's what you're trying to do.
.tcl:

set indent_pattern [parameter::get \
			-parameter IndentationPattern -default " "]
set indent_factor [parameter::get -parameter IndentationFactor -default 5]

db_multirow projects select_projects {*SQL*} {
}



.xql:

select   item_id,
	 project_name,
	 repeat(:indent_pattern,(tree_level(tree_sortkey) - 5) * :indent_factor)
	 || project_name as indented_name
from     projectsx
order by tree_sortkey


The above example should yield a result similar to your snippet, with proper indentation depending on hierarchy etc.

(My query is based on the CR and queries the 'content_type'x view, which does the proper joins for you so that you get the tree_sortkey. The idea is similar for acs objects only you'll have to do an explicit join against acs objects. *I think*)

Or did I miss something...?

/Ola