[Zope] Help with tree tag and localfs

AM list_subscriber@neurobs.com
Mon, 31 Mar 2003 09:09:26 -0800


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