You are not logged in Log in Join
You are here: Home » Members » Greg's Zope Software » How to create tabs for user pages » Python Script to create tabs for each Object in a Folder » View File

Log in
Name

Password

 

Python Script to create tabs for each Object in a Folder

File details
Size
1 K
File type
text/plain

File contents

## Script (Python) "FileListTabs"
##bind container=container
##bind context=context
##bind namespace=_
##bind script=script
##bind subpath=traverse_subpath
##parameters=target="right"
##title=Filelist for Tabs
##
"""
FileListTabs.py

This script creates tabs for each object in the current folder.  

For this script to function properly, the dtml-method "MakeTabs" must be 
available from the current context. 
"""

# Import a standard function, and get the HTML request and response objects.
from Products.PythonScripts.standard import html_quote
request = container.REQUEST
RESPONSE =  request.RESPONSE

tabs=[]
for object in context.objectValues():

#  if(object.hasProperty('ShowTab') or object.hasProperty('TabLabel') ):

   # get tab label
   label = object.getProperty('ShowTab',d=object.title)
   if label==None:
      label = object.id;
    
   tabs.append( {'label' : label,
                 'action': object.id , 
                 'target': target} )
   
return context.MakeTabs(RESPONSE=RESPONSE,REQUEST=request,tabs=tabs)