[Zope] Re: Epoz in "Zope CMF" site?

Wilson, Derek dwilson at abrazohealth.com
Wed Jan 7 12:38:23 EST 2004


Here's what I did to get it to work...

In "portal_skins/Custom" create a python script file called
"epoz_document_edit"
Parameters: text_format, html, file='', SafetyBelt='', choice=' Change
')
----------epoz_document_edit----------
#Note:
#I had to take out the javascript / html stripping.

try:
    from Products.CMFDefault.utils import scrubHTML

    context.edit( text_format
                , html
                , file
                , safety_belt=SafetyBelt
                )
    qst='portal_status_message=Document+changed.'

    if choice == ' Change and View ':
        target_action = context.getTypeInfo().getActionById( 'view' )
    else:
        target_action = context.getTypeInfo().getActionById( 'epozedit'
)

    context.REQUEST.RESPONSE.redirect( '%s/%s?%s' % (
context.absolute_url()
                                                , target_action
                                                , qst
                                                ) )
except Exception, msg:
    target_action = context.getTypeInfo().getActionById( 'epozedit' )
    context.REQUEST.RESPONSE.redirect(
        '%s/%s?portal_status_message=%s' % ( context.absolute_url()
                                           , target_action
                                           , msg
                                           ) )
----------epoz_document_edit----------

In "portal_skins/Custom" create a DTML Method file called "epoz_edit"

----------epoz_edit----------
<dtml-var standard_html_header>
<table>
<tr>
  <dtml-if html>
    <dtml-call "manage_edit('', content_type='text/html',
filedata=_.str(html))">
  </dtml-if>

  <form action="epoz_document_edit" method="post"
enctype="multipart/form-data">
   <dtml-var "Epoz('html:string', data=this().text,
                           toolbox='/toolbox',
                           lang='en',
                           style='width: 620px; height: 250px; border:
1px solid #000000;')">
   <input type="hidden" name="text_format" value="text/html">
   <input type="submit" name="submit" value=" Save Changes " >
   &nbsp;&nbsp;<a href="<dtml-var URL1>">View Document</a>
  </form>
</tr>
</table>
</form>
<dtml-var standard_html_footer>
----------epoz_edit----------

In "portal_types/Document" -> Actions add the following action:

----------Edit (wysiwyg)Action----------
Name: Edit (wysiwyg)
ID: epozedit
Action: epoz_edit
Permission: Modify Portal Content
Category: object
Visible: Yes
----------Edit (wysiwyg)Action----------

Now you should see "Edit (wysiwyg)" on your "Document" types in your CMF
site.

Maik, maybe you should add this to your FAQ for Epoz 0.7.4?

Thanks,
Derek Wilson




More information about the Zope mailing list