[Zope-CMF] Workflow issue? - or how to customize

Meilicke, Scott scott.meilicke@intp.com
Fri, 3 May 2002 08:03:15 -0700


No, I didn't do anything with metadata_edit.py.  I took pieces from that
file, and incorporated those into my newsitem_edit.py, attached.  Then I
changed the dtml newsitem_edit_form.dtml to add those properties from the
metadata that I wanted to use, such as subject, effective_date, etc.  

Note: I have replaced in the parameter list 'text' with 'data', to account
for the IE wysiwig editor I'm using.  Then in the script, on the first line,
there is text=data, so the rest of the script works.  You can undo those two
changes to use the regular text box editing that is default with the cmf.

I don't mind the direct mail, although I will be cc'ing the list on this so
others may benefit.

-Scott

newsitem_edit.py:

----------------------------------------------

## Script (Python) "newsitem_edit"
##parameters=data, description,
title=None,subject=None,contributors=None,effective_date=None,expiration_dat
e=None,format=None,language=None,rights=None
##title=Edit a news item

text=data

def tuplify( value ):

    if not same_type( value, () ):
        value = tuple( value )

    temp = filter( None, value )
    return tuple( temp )

if title is None:
    title = context.Title()

if subject is None:
    subject = context.Subject()
else:
    subject = tuplify( subject )

if contributors is None:
    contributors = context.Contributors()
else:
    contributors = tuplify( contributors )

if effective_date is None:
    effective_date = context.EffectiveDate()

if expiration_date is None:
    expiration_date = context.expires()

if format is None:
    format = context.Format()

if language is None:
    language = context.Language()

if rights is None:
    rights = context.Rights()

context.editMetadata( title=title
                    , subject=subject
                    , contributors=contributors
                    , effective_date=effective_date
                    , expiration_date=expiration_date
                    , format=format
                    , language=language
                    , rights=rights
                    )

context.edit(text, description)


"""
if context.REQUEST.get( 'change_and_edit', 0 ):
    action_id = 'edit'
elif context.REQUEST.get( 'change_and_view', 0 ):
    action_id = 'view'
else:
    action_id = 'metadata'
"""

action_id = 'edit'

action_path = context.getTypeInfo().getActionById( action_id )

action_method = context.restrictedTraverse( action_path )

return action_method( context
                    , context.REQUEST
                    , portal_status_message='Item changed.'
                    )

"""
>From the newsitem_edit.py script

qst='?portal_status_message=News+Item+changed.'
 
context.REQUEST.RESPONSE.redirect( context.absolute_url() +
'/newsitem_edit_form' + qst )
"""

--------end file-----------

-----Original Message-----
From: Antonio Orlando [mailto:aorlando2002@yahoo.com.br]
Sent: Friday, May 03, 2002 7:19 AM
To: Scott Meilicke
Subject: Re: [Zope-CMF] Workflow issue? - or how to customize


(sorry if this direct mail borrow you...)

First - I want to customize my "news item" entry form.

I supposed that you changed the Python Script "metadata_edit", or you 
create a new one (something like that), and you put some code like:

context.editMetadata( title=title
                         , description=description
                         , subject=subject
                         , contributors=contributors
                         , effective_date=effective_date
                         , expiration_date=expiration_date
                         , format=format
                         , language=language
                         , rights=rights
                         )

and after that something like:

context.edit(text, description)

Is that right? I only need to call this two methods, or Do I need to do 
something different?

Best Regards,


anTONIo



> Meilicke, Scott wrote:
> 
>> My Intranet combines some of the metadata elements and the main edit
>> elements onto a single form.  I had to do the same thing with the python
>> scripts - put aspects of both the metadata script and the object's edit
>> script into a single script so the data would actually stick.  I can send
>> you an example type if you like.
>>
>> Scott



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
The information contained in this email message may be privileged and is
confidential information intended only for the use of the recipient or any
employee or agent responsible for delivering it to the intended recipient.
Any unauthorized use, distribution or copying of this information is
strictly prohibited and may be unlawful.  If you have received this
communication in error, please notify the sender immediately and destroy the
original message and all attachments from your electronic files.