[Zope] Tree tag and SQL methods?

Tony McDonald tony.mcdonald@ncl.ac.uk
Mon, 28 Jun 1999 16:40:23 +0100


I've been following the dialogue between Alexander and Phillip, and 
today things started to click so I thought I'd have a go... :)

My database consists of two tables, familytree and element. 
familytree holds parentage and element holds the data. My SQL query 
(get_parent_child_topics(theparent:int, flag:int))  is;

<!--#if "flag==0"-->
select thetag, level, header, content, child, child as flag from 
familytree f, element e where tag_id = <!--#var theparent--> and 
f.child = <!--#var theparent --> and thetag='topic' order by child
<!--#else-->
select thetag, level, header, content, child, child as flag from 
familytree f, element e where f.parent= <!--#var theparent--> and 
child = tag_id and thetag='topic' order by child
<!--#/if-->

and the DTML that calls it is ;

<!--#with "_.namespace(child=135,flag=0)"-->
<!--#tree id=level nowrap=1 single=1 
branches_expr="get_parent_child_topics(theparent=child,flag=flag)"-->
<a href="show_headers?child=<!--#var child-->"><!--#var header--></a>
<!--#/tree-->
<!--#/with-->

This works beautifully ... almost. Initially, I get the top level 
line (Theme A:The Cell). Clicking on the 'open box' I get the next 
level;

         Cells and tissues, structure and function
         Molecular Basis Of Medicine
         Gene Expression
         Immunology Course
         Medical Microbiology
         Human Genetics
         Molecular Medicine
         General Pathology

etc...
all with their own 'open boxes'.

Problems start if I click on one of these open boxes (say Medical 
Microbiology). That level expands out, as well as all the others 
(Gene Expression etc.).

I have a gut feeling that I'm close to getting this sorted out, but I 
can't see where I might be going wrong.

Any ideas would of course be appreciated...
ta,
tone.
------
Dr Tony McDonald,  FMCC, Networked Learning Environments Project
The Medical School, Newcastle University Tel: +44 191 222 5888
Fingerprint: 3450 876D FA41 B926 D3DD  F8C3 F2D0 C3B9 8B38 18A2