[Zope] Help with tree tag and localfs
AM
list_subscriber@neurobs.com
Thu, 03 Apr 2003 08:14:09 -0800
If you look at the source of the tree tag, you will find that it looks
for functions called tpValues and tpIds for display purposes. By
default these display container only AFAIK. You can use objectValues and
objectsIds instead as you did.
Also my fault I should have mentioned the Catalog and also the
TreeDisplay properties of the LocalFS product.
You can generate the text that you see in the tree including icons. For
example you can see my attempt here :
http://nbs.neuro-bs.com/ex_files/expt_view?id=46
In my example
<dtml-var "pres_docs_get_url( getId(),hasChildNodes(), _['tree-item-url'], _['tree-item-expanded'])">
is what generates the icons and links. In the link above I use a similar
python script to do the same for me.
hth
AM
sysman wrote:
>Oh, that's OK, I appreciate the input. Besides I learned more by trying your exammples.
>
>I did figure out my problem today, though. Under the LocalFS object's properties, I had to select 'Catalog' to make it work. Once I did that, the dtml-tree worked fine.
>
><dtml-tree zinesfolder branches="objectValues" sort="meta_type">
> <img src="<dtml-var icon>">
> <a href="/zinesfolder/<dtml-var tree-item-url>"><dtml-var id></a>
></dtml-tree>
>
>If I used this: branches_expr="objectIds()"
>it didn't work. (as in nothing displayed, but I didn't get any errors.)
>
>I noticed that the LocalFS objects don't have the same properties(like title) as they do in Zope. I should expect that since they aren't actually "Zope" objects, rather LocalFS objects.
>
>Now I just need to figure out how to get better icons to display, but that's not urgent. Thanks for your help!
>
>Greg
>
>-----Original Message-----
>From: AM [mailto:list_subscriber@neurobs.com]
>Sent: Tuesday, April 01, 2003 3:03 PM
>To: sysman
>Cc: zope@zope.org
>Subject: Re: [Zope] Help with tree tag and localfs
>
>
>I am sorry, I probably didnt explain my setup properly. The functions
>that I use are for my use only. You dont necessarily need to use them to
>do what you want.
>
>The minimal thing yoou can do is the following:
>
><dtml-let root="zinesfolder">
> <dtml-tree name=root branches_expr="objectIds()" nowrap single>
> <dtml-var id>
> </dtml-tree>
></dtml-let>
>
>This will display your tree (with all the members in there).
>
>If you do the following:
>
><dtml-let root="zinesfolder">
> <dtml-tree name=root nowrap single>
> <dtml-var getId>
> </dtml-tree>
></dtml-let>
>
>This wil show all the folders int your LocalFS instance.
>
>If you want more functionality please provide some more specs and mebb I can help
>
>HTH
>AM
>
>
>
>
>sysman wrote:
>
>
>
>>I did as you suggested, but I am afraid I am still a newbie at the python scripting.
>>
>>What I did was setup two scripts:
>>filter_tree_nodes
>>pres_docs_get_url
>>
>>And replaced 'root' with my localfs folder name (zinesfolder).
>>
>>I setup pres_docs_get_url with 4 parameters, but I don't know which to setup for sure. Are these correct?
>>
>>item_id, item_ext_list, item_name, root_url
>>
>>I still get nothing for objects in the folder. Just a thought, could this have something to do with LocalFS and Zope 2.6.0?
>>
>>
>>
>>-----Original Message-----
>>From: AM [mailto:list_subscriber@neurobs.com]
>>Sent: Monday, March 31, 2003 9:09 AM
>>To: Greg Fischer
>>Cc: zope@zope.org
>>Subject: Re: [Zope] Help with tree tag and localfs
>>
>>
>>In my case:
>>
>><dtml-let root="pres_docs_storage">
>> <dtml-tree name=root branches_expr="filter_tree_nodes()" nowrap single>
>> <dtml-var "pres_docs_get_url( getId(),hasChildNodes(),
>>_['tree-item-url'], _['tree-item-expanded'])">
>> </dtml-tree>
>></dtml-let>
>>
>>where pres_docs_storage is the LocalFS instance.
>>
>>filter_tree_nodes:
>>
>>obs = context.objectValues()
>>for ob in obs:
>> if ob.getId() == 'index.html':
>> obs.remove(ob) #not a good idea.. I have since modified this one
>>
>>return obs
>>
>>pres_docs_get_url:
>>
>>#get URL (item_id, children obtained by hasChildNodes())
>>import string
>>
>>item_ext_list = item_id.split('.')
>>item_name = item_ext_list[0][2:]
>>item_name = item_name.replace('_',' ')
>>
>>root_url = container.REQUEST.BASE0
>>html = ''
>>
>>if int(children) != 0:
>> if not expanded:
>> html = '<img
>>src=\''+context.images.absolute_url()+'/help_book_closed_icon\'> <a
>>href=\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'
>>target=\'content\'
>>class=\'help_menu_folder\'>'+string.capwords(item_name)+'</a>'
>> else:
>> html = '<img
>>src=\''+context.images.absolute_url()+'/help_book_open_icon\'> <a
>>href=\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'
>>target=\'content\'
>>class=\'help_menu_folder\'>'+string.capwords(item_name)+'</a>'
>>
>>else:
>> html = '<img
>>src=\''+context.images.absolute_url()+'/help_page_icon\'> <a
>>href=\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'
>>target=\'content\'
>>class=\'help_menu_item\'>'+string.capwords(item_name)+'</a>'
>>
>>return html
>>
>>
>>The sample can be viewed at:
>>http://nbs.neuro-bs.com/presentation/docs
>>
>>HTH
>>AM
>>
>>
>>Greg Fischer wrote:
>>
>>
>>
>>
>>
>>>I installed LocalFS, which is pretty cool because I need to add large files for users, but I need to use the dtml-tree tag to list the folders contents. When I use it normally it doesn't work:
>>>
>>><dtml-tree LocalFSFolder branches="objectValues" sort="id">
>>> <dtml-var id>
>>></dtml-tree>
>>>
>>>I have tried several different options, and I have searched the internet and newsgroups, but I haven't found much. Any help is appreciated.
>>>
>>>Thanks!
>>>
>>>Greg
>>>sysman@techgroupinc.com
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>
>
>
--
==================================================================
Aseem Mohanty
Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706
(R) 510 7696011 (M) 510 3014871 (O) 510 5279231
==================================================================
"I saw `cout' being shifted "Hello world" times to the left and
stopped right there!!" -- Steve Gonedes
==================================================================