[Zope-CMF] Re: [Zope] CMF : customize actions/user

Ausum Studio ausum_studio@hotmail.com
Fri, 18 Oct 2002 02:04:46 -0500


I use the following python script:

## Script (Python) "actions_universal_provider"
##bind container=container
##bind context=context
##bind namespace=
##bind script=script
##bind subpath=traverse_subpath
##parameters=what_action, providers, action_display_name=None,
a_other_string='', spacer_string=''
##title=Isolates and renders the link by the action name, when applicable.
Renders an empty string or a preset spacer when not.
##
obj=context.this()
actions=context.portal_actions.listFilteredActionsFor(obj)

def a_hrefize(the_url):
    if action_display_name is not None:
        link = """<a href='%s' %s>%s</a>""" %
(the_url,a_other_string,action_display_name)
    else:
        link = """<a href='%s' %s>%s</a>""" %
(the_url,a_other_string,what_action)
    return link

if providers == 'user_actions':
    actions_list = actions['user']
elif providers == 'folder_actions':
    actions_list = actions['folder']
elif providers == 'object_actions':
    actions_list = actions['object'] + actions['workflow']
elif providers == 'global_actions':
    actions_list = actions['global']
elif len(providers)== 1:
    actions_list = actions[providers[0]]
else:
    actions_list = []
    for cat in providers:
        actions_list = actions[cat] + actions_list
if actions_list !=[]:
    for k in range(len(actions_list)):
        if what_action in actions_list[k].values():
            the_url = actions_list[k]['url']
            hRef = a_hrefize(the_url)
            break
        else:
            hRef = ''
else:
    hRef = ''


if hRef == '':
    return hRef
else:
    return hRef + spacer_string

#end


You can also format your link text using the 'action_display_name' variable.



Ausum



p.s. Please take into account this is a subject for the zope-cmf list



----- Original Message -----
From: "cyrille" <cyrilleml@kbuilder.net>
To: <zope@zope.org>
Sent: Friday, October 18, 2002 1:17 AM
Subject: [Zope] CMF : customize actions/user


> hello
>
> I try to find how to customize the "actions" label.
> they are used for writing : Login, Join, My stuff, ...
> ZPT skin define some :
>     user_actions actions/user
>     folder_actions actions/folder
>
> I'd have a look in all document in CMF Site, but found nothing.
> Perjaps that Labels are hardcoded ... I'm shure we can customize them !
> ;o)
>
> Thanks
>
>
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists -
>  http://lists.zope.org/mailman/listinfo/zope-announce
>  http://lists.zope.org/mailman/listinfo/zope-dev )
>