At 00:34 07/07/99 , Tony.McDonald@newcastle.ac.uk wrote:
Martijn, I'd like to see that patch... I've been thinking about doing just this thing. I created a myTree product just to change the icons, which seems silly. I'd rather have the original treetag do this.
John Eikenberry
I don't want to be a PITA - but, me too. I implemented an SQL-based dynamic tree tag DTML instance based on the 'good stuff' from Phillip Eby et al - one of my users found the totally unreleased 'beta' site where I had it running and (after saying how cool it was) then reeled off a list of cosmetic changes that he wanted doing (open & closed book icons, differently emphasised text for the 'active' leaf etc.) sheesh! ...users.
Okay, here goes: This is a context diff to patch the TreeTag.py file (in lib/python/TreeDisplay), so it supports the opened_decoration and closed_decoration attributes of the tree tag. With this patch applied, you can specify the URL of images to replace the minus (for open branches) and the plus symbol (for closed branches). The URL of each image will be prepended by SCRIPT_NAME. Example: <!--#tree opened_decoration="/HelpSys/hs_obook" closed_decoration="/HelpSys/hs_cbook"--> Here the plus and minus symbols are replaced by the help system opened and closed book icons. Note that I did not implement the 'childless_decoration' attribute. This is a quick patch... PS: DC, I'll post a patch for the current CVS version to the Collector. *** TreeTag.py 1999/06/11 15:56:34 1.29.2.1 --- TreeTag.py 1999/07/07 08:45:05 *************** *** 99,104 **** --- 99,107 ---- tplus=tbl[:ord('+')]+'-'+tbl[ord('+')+1:] tminus=tbl[:ord('-')]+'+'+tbl[ord('-')+1:] + plus_icon = '/p_/pl' + minus_icon = '/p_/mi' + class Tree: name='tree' blockContinuations=() *************** *** 112,120 **** branches=None, branches_expr=None, sort=None, reverse=1, skip_unauthorized=1, id=None, single=1, url=None, ! # opened_decoration=None, ! # closed_decoration=None, ! # childless_decoration=None, assume_children=1) has_key=args.has_key --- 115,122 ---- branches=None, branches_expr=None, sort=None, reverse=1, skip_unauthorized=1, id=None, single=1, url=None, ! opened_decoration=None, ! closed_decoration=None, assume_children=1) has_key=args.has_key *************** *** 132,139 **** if not has_key('id'): args['id']='tpId' if not has_key('url'): args['url']='tpURL' ! if not has_key('childless_decoration'): ! args['childless_decoration']='' self.__name__ = name self.section=section.blocks --- 134,143 ---- if not has_key('id'): args['id']='tpId' if not has_key('url'): args['url']='tpURL' ! if not has_key('opened_decoration'): ! args['opened_decoration']=minus_icon ! if not has_key('closed_decoration'): ! args['closed_decoration']=plus_icon self.__name__ = name self.section=section.blocks *************** *** 377,391 **** script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 output('<A NAME="%s">' '<A HREF="%s?tree-c=%s#%s">' ! '<IMG SRC="%s/p_/mi" BORDER=0></A></A>' % ! (id, root_url, s, id, script)) else: output('<A NAME="%s">' '<A HREF="%s?tree-e=%s#%s">' ! '<IMG SRC="%s/p_/pl" BORDER=0></A></A>' % ! (id, root_url, s, id, script)) output('</TD>\n') else: --- 378,398 ---- script=md['SCRIPT_NAME'] if exp: treeData['tree-item-expanded']=1 + if have_arg('opened_decoration'): + icon=args['opened_decoration'] + else: icon=minus_icon output('<A NAME="%s">' '<A HREF="%s?tree-c=%s#%s">' ! '<IMG SRC="%s%s" BORDER=0></A></A>' % ! (id, root_url, s, id, script, icon)) else: + if have_arg('closed_decoration'): + icon=args['closed_decoration'] + else: icon=plus_icon output('<A NAME="%s">' '<A HREF="%s?tree-e=%s#%s">' ! '<IMG SRC="%s%s" BORDER=0></A></A>' % ! (id, root_url, s, id, script, icon)) output('</TD>\n') else: *************** *** 648,656 **** return r - #icoSpace='<IMG SRC="Blank_icon" BORDER="0">' - #icoPlus ='<IMG SRC="Plus_icon" BORDER="0">' - #icoMinus='<IMG SRC="Minus_icon" BORDER="0">' --- 655,660 ---- -- Martijn Pieters, Web Developer | Antraciet http://www.antraciet.nl | Tel: +31-35-7502100 Fax: +31-35-7502111 | mailto:mj@antraciet.nl http://www.antraciet.nl/~mj | PGP: http://wwwkeys.nl.pgp.net:11371/pks/lookup?op=get&search=0xA8A32149 ------------------------------------------