[Zope] Help with tree tag and localfs
sysman
sysman@techgroupinc.com
Thu, 3 Apr 2003 11:50:01 -0800
It's all good! I found the Tree property options in my searches, but =
nothing said you also had to check Catalog, which is what threw me off.
I plan on reviewing your scripts as examples for my own use, but I have =
to learn more Python. For someone coming from a VB background, it's =
confusing, but I'll figure it out.
I appreciate the time you took to help!
Thanks,
Greg
-----Original Message-----
From: AM [mailto:list_subscriber@neurobs.com]
Sent: Thursday, April 03, 2003 8:14 AM
To: sysman
Cc: zope@zope.org
Subject: Re: [Zope] Help with tree tag and localfs
If you look at the source of the tree tag, you will find that it looks=20
for functions called tpValues and tpIds for display purposes. By=20
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=20
TreeDisplay properties of the LocalFS product.
You can generate the text that you see in the tree including icons. For=20
example you can see my attempt here :
http://nbs.neuro-bs.com/ex_files/expt_view?id=3D46
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=3D"objectValues" sort=3D"meta_type">
> <img src=3D"<dtml-var icon>">=20
> <a href=3D"/zinesfolder/<dtml-var tree-item-url>"><dtml-var id></a>
></dtml-tree>
>
>If I used this: branches_expr=3D"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=20
>that I use are for my use only. You dont necessarily need to use them =
to=20
>do what you want.
>
>The minimal thing yoou can do is the following:
>
><dtml-let root=3D"zinesfolder">
> <dtml-tree name=3Droot branches_expr=3D"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=3D"zinesfolder">
> <dtml-tree name=3Droot 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:
>
> =20
>
>>I did as you suggested, but I am afraid I am still a newbie at the =
python scripting. =20
>>
>>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?=20
>>
>>
>>
>>-----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=3D"pres_docs_storage">
>> <dtml-tree name=3Droot branches_expr=3D"filter_tree_nodes()" nowrap =
single>
>> <dtml-var "pres_docs_get_url( getId(),hasChildNodes(),=20
>>_['tree-item-url'], _['tree-item-expanded'])">
>> </dtml-tree>
>></dtml-let>
>>
>>where pres_docs_storage is the LocalFS instance.
>>
>>filter_tree_nodes:
>>
>>obs =3D context.objectValues()
>>for ob in obs:
>> if ob.getId() =3D=3D '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 =3D item_id.split('.')
>>item_name =3D item_ext_list[0][2:]
>>item_name =3D item_name.replace('_',' ')
>>
>>root_url =3D container.REQUEST.BASE0
>>html =3D ''
>>
>>if int(children) !=3D 0:
>> if not expanded:
>> html =3D '<img=20
>>src=3D\''+context.images.absolute_url()+'/help_book_closed_icon\'> =
;<a=20
>>href=3D\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'=20
>>target=3D\'content\'=20
>>class=3D\'help_menu_folder\'>'+string.capwords(item_name)+'</a>'
>> else:
>> html =3D '<img=20
>>src=3D\''+context.images.absolute_url()+'/help_book_open_icon\'> <=
a=20
>>href=3D\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'=20
>>target=3D\'content\'=20
>>class=3D\'help_menu_folder\'>'+string.capwords(item_name)+'</a>'
>>
>>else:
>> html =3D '<img=20
>>src=3D\''+context.images.absolute_url()+'/help_page_icon\'> <a=20
>>href=3D\'http://www.neuro-bs.com/pres_docs/html/'+item_url+'\'=20
>>target=3D\'content\'=20
>>class=3D\'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:
>>
>>=20
>>
>> =20
>>
>>>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=3D"objectValues" sort=3D"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
>>>
>>>
>>>
>>>
>>>
>>> =20
>>>
>>> =20
>>>
>>=20
>>
>> =20
>>
>
> =20
>
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Aseem Mohanty =20
Neurobehavioral Systems Inc, 828 San Pablo Ave, Albany, CA 94706=20
(R) 510 7696011 (M) 510 3014871 (O) 510 5279231 =09
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=09
"I saw `cout' being shifted "Hello world" times to the left and =20
stopped right there!!" -- Steve Gonedes =20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=20