[Zope] Help with tree tag and localfs

sysman sysman@techgroupinc.com
Tue, 1 Apr 2003 11:31:05 -0800


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\'>&nbsp;<=
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\'>&nbsp;<a =

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\'>&nbsp;<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>'
=20
return html


The sample can be viewed at:
http://nbs.neuro-bs.com/presentation/docs

HTH
AM


Greg Fischer wrote:

>=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:
>=20
><dtml-tree LocalFSFolder branches=3D"objectValues" sort=3D"id">
>    <dtml-var id>
></dtml-tree>
>=20
>I have tried several different options, and I have searched the =
internet and newsgroups, but I haven't found much.  Any help is =
appreciated.
>=20
>Thanks!
>=20
>Greg
>sysman@techgroupinc.com
>=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



_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists -=20
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )