I found quite an easy solution for Zope 2.1.6:

In lib/python/TreeDisplay/TreeTag.py you have to replace the "old 
code" with the "new code". (Blame me - I forgot to make a copy 
beforehands which keeps me from using diff.)

The idea is to "export" the piece of code that puts together the url 
to treeData['tree-item-clickurl'] so that you can access it with 
<dtml-var tree-item-clickurl> within your tree-tag. I haven't checked 
this for unwanted side effects. Perhaps someone more familiar with 
the zope code could do that? For me it works fine!

Ragnar


Line 372:
             ####################################
             # Mostly inline encode_seq for speed
             s=compress(str(diff))
             if len(s) > 57: s=encode_str(s)
             else:
                 s=b2a_base64(s)[:-1]
                 l=find(s,'=')
                 if l >= 0: s=s[:l]
             s=translate(s, tplus)
             ####################################

             script=md['SCRIPT_NAME']

# old code
#            if exp:
#                treeData['tree-item-expanded']=1
#                output('<A NAME="%s" HREF="%s?tree-c=%s#%s">'
#                       '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' %
#                       (id, root_url, s, id, script))
#            else:
#                output('<A NAME="%s" HREF="%s?tree-e=%s#%s">'
#                       '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' %
#                       (id, root_url, s, id, script))
# end of old code

# New code
             if exp:
                treeData['tree-item-clickurl']= '%s?tree-c=%s#%s' % 
(root_url, s, id)
                 treeData['tree-item-expanded']=1
                 output('<A NAME="%s" HREF="%s">'
                        '<IMG SRC="%s/p_/mi" ALT="-" BORDER=0></A>' %
                        (id, treeData['tree-item-clickurl'], script))
             else:
                treeData['tree-item-clickurl']= '%s?tree-e=%s#%s' % 
(root_url, s, id)
                 output('<A NAME="%s" HREF="%s">'
                        '<IMG SRC="%s/p_/pl" ALT="+" BORDER=0></A>' %
                        (id, treeData['tree-item-clickurl'], script))
# end of new code

             output('</TD>\n')

         else:
             if level > 2:   output(_td_colspan % level)
             elif level > 0: output(_td_single  * level)
             output(_td_single)
             output('\n')


>Ragnar Beer wrote:
>>
>>  Howdy!
>>
>>  I've been experimenting with trees for a while and discovered that
>>  almost all innocent first time clickers were clicking on the text
>>  _behind_ the plus and minus images instead on the images themselves.
>>  So I decided to make the text a link with the same url as the image
>>  has but I can't find the right variable. Where is that url stored?
>>  Can anybody help?
>
>Your best bet is to look in the source for the tree tag and see how it's
>done there:
>/lib/python/TreeDisplay/TreeTag.py
>
>cheers,
>
>Chris
>
>PS: Please post back to the list if you find out how ;-)
>
>_______________________________________________
>Zope maillist  -  [EMAIL PROTECTED]
>http://lists.zope.org/mailman/listinfo/zope
>**   No cross posts or HTML encoding!  **
>(Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )


_______________________________________________
Zope maillist  -  [EMAIL PROTECTED]
http://lists.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-announce
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to