|
From: Damon B. <da...@hd...> - 2003-03-03 16:18:51
|
> I'm sure that many people would find this useful. It would be very > helpful if you could place this either in Zopelabs or send it to the > Plone-docs list and I will place it in the How-To section of Plone.org OK, then. :-) Here's what I know. Let it be said that I'm something of a newbie myself, and key bits of what I include here should really be credited to Luca Olivetti and Florent Guillaume. Good luck! I think NuxDocument is the bee's knees. --Damon =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D NuxDocument Install ---------- To the best of my knowledge, NuxDocument only functions on Unix/Linux systems. 1. Install the translators NuxDocument uses. * MS Word: wv * MS Excel and PowerPoint: xlhtml (provides xlhtml for Excel, ppthtml for PowerPoint) * OpenOffice: libxml2 (provides xsltproc) * RTF: unrtf * PDF: xpdf * lynx (NuxDocument uses this browser in its conversions)=20 2. Stop Zope. 3. Install the Localizer product from Sourceforge <http://sourceforge.net/projects/lleu>. (Download tarball, extract into the {$ZOPEHOME}/lib/python/Products directory.) As of this writing, the most recent version is 1.0.0. 4. If you're running Zope 2.5.1, you must apply four different Unicode patches <http://www.zope.org/Members/efge/i18n/Unicode-2.5.1>. Look at each patchfile to see what directory it should be run from, change into that directory, copy the patchfile into the directory, and run patch. # cd [directory] # cp [path/to/patchfile] . # patch < [patchfile] 5. Install NuxDocument from zope.org <http://www.zope.org/Members/sf/NuxDocument/>. (Downlaod tarball, extract into the {$ZOPEHOME}/lib/python/Products directory.) As of this writing, the most recent version is 1.1 alpha. 6. Apply Luca Olivetti's NuxDocument.diff patch. (At end of this document and attached to this e-mail; sorry if it doesn't make it through to the general lists.) This patch makes it possible for the user to edit the Title and Description properties of a NuxDocument within the Plone interface (it is otherwise possible only programmatically or from within Zope). # cd {$ZOPEHOME}/lib/python/Products # patch < NuxDocument.diff 8. Edit the {$ZOPEHOME}/lib/python/Products/NuxDocument/locale/en.po file as follows. * Change the text "charset=3DCHARSET" to read "charset=3DUTF-8" (or whatever is more appropriate). * Change the text "content-transfer-encoding: ENCODING" to read "content-transfer-encoding: 8-bit". If there are other languages you need to support, check their en.po files to ensure that they have legitimate values for charset and content-transfer-encoding. 9. Run Localizer's version of zgettext.py to regenerate the en.mo file (and others, as needed) in NuxDocument. # cd {$ZOPEHOME}/lib/python/Products/NuxDocument # python2.1 ../Localizer/zgettext.py -m If you didn't edit all *.po files in NuxDocument, you will see some errors, but they can be ignored if you aren't using those languages in your locale. =20 10. Copy the NuxDocument file icons to the directory where they will actually be found by the product when accessed via Plone. # cd {$ZOPEHOME}/lib/python/Products/NuxDocument/skins # cp *.gif zpt_NuxDocument 11. Restart Zope. You can now add NuxDocument objects to Zope. ---------- NuxDocuments in Plone/CMF Sites ---------- To be able to add NuxDocument objects to a Plone (or CMF) site as you would add any other content type (e.g., Document, News Item, etc.), follow these steps. 1. In the ZMI, at the Plone site root, navigate to portal_types/Contents. 2. Add a "Factory-based Type Information" object. 3. Fill in appropriate text for the new content type's id. If you intend to have separate Plone content types for each type of file you wish to support (e.g., Word, Excel, PDF, etc.), create multiple "Factory-based Type Information" objects, one for each file type. If you want to just use a single NuxDocument object type to stand for any one of the supported file formats, just use "NuxDocument" for the id. 4. Click the Properties tab of the new NuxDocument content type object, and supply an appropriate Title property. In the "Allowed content types" list box, select "NuxDocument" only. 5. In the ZMI, back at the root of the Plone site, navigate to portal_skins/Contents. 6. Add a "Filesystem Directory View" object. 7. In the available list box, select NuxDocument/skins/zpt_NuxDocument. 8. In portal_skins, click on the Properties tab. 9. Add zpt_NuxDocument to each skin in which you wish to be able to add NuxDocument objects. You can now add NuxDocuments to Plone/CMF. ---------- Still Unresolved ---------- * Figure out how to enable the editing of the NuxDocument id property in the Plone interface as LO's NuxDoc patch enables the editing of Title and Description. Some kind of hack similar to those in the NuxDocument.diff are necessary, but apparently you have to invoke the object's container in order to actually modify the id "fully", as it were. Haven't figured that out yet, nor have had the time to investigate how it might be done. Any help would be appreciated. * Figure out why the NuxDocument object icons still don't show up in the ZMI when NuxDocuments are added to Zope. I tried copying the *.gif icons into the NuxDocument/skins/NuxDocument directory, but it doesn't help. =3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D= -=3D NuxDocument.diff, by Luca Olivetti <lu...@we...> ---------- diff --unified --exclude=3D*.pyc --exclude=3D*~ --recursive NuxDocument.orig/CMFNuxDocument.py NuxDocument/CMFNuxDocument.py --- NuxDocument.orig/CMFNuxDocument.py Mon Dec 2 15:42:09 2002 +++ NuxDocument/CMFNuxDocument.py Fri Jan 17 09:06:34 2003 @@ -74,9 +74,14 @@ self.reindexObject() # from PortalContent =20 security.declareProtected(CMFCorePermissions.ModifyPortalContent, 'edit') - def edit(self, title, file, mime_type=3DNone): + def edit(self, title, description, file, mime_type=3DNone): "Edit document" NuxDocument._edit(self, title, file, mime_type) + if title: + self.title=3Dtitle + else: + self.title=3Dself.filename + self.description=3Ddescription self.reindexObject() # from PortalContent =20 def PUT(self, REQUEST, RESPONSE): diff --unified --exclude=3D*.pyc --exclude=3D*~ --recursive NuxDocument.orig/NuxDocument.py NuxDocument/NuxDocument.py --- NuxDocument.orig/NuxDocument.py Mon Dec 2 15:39:51 2002 +++ NuxDocument/NuxDocument.py Wed Jan 22 13:21:56 2003 @@ -65,12 +65,13 @@ =20 def _edit(self, title=3DNone, file=3DNone, mime_type=3DNone): filename =3D getattr(file, 'filename', self.__name__) - self.filename =3D filename if title is not None: self.title =3D title notempty =3D self._isNotEmpty(file) if notempty: self._file =3D File(self.__name__, title, file) + if not self.filename or filename<>self.getId(): + self.filename =3D filename # set a default mime_type that convert() can override user_mime_type =3D '' if mime_type: @@ -156,6 +157,11 @@ """Get MIME type""" return self._mime_type or 'application/octet-stream' =20 + security.declareProtected('View', 'content_type') + def content_type(self): + """Get MIME type""" + return self._mime_type or 'application/octet-stream' + security.declareProtected('View', 'document_src') def document_src(self, REQUEST=3DNone, RESPONSE=3DNone): """Get unprocessed document source""" @@ -192,7 +198,8 @@ "Handle HTTP/FTP PUT requests." self.dav__init(REQUEST, RESPONSE) file =3D REQUEST.get('BODY', '') - self._edit(file=3Dfile) + mime_type =3D REQUEST.get('CONTENT_TYPE',None) + self._edit(file=3Dfile,mime_type=3Dmime_type) RESPONSE.setStatus(204) return '' =20 diff --unified --exclude=3D*.pyc --exclude=3D*~ --recursive NuxDocument.orig/skins/zpt_NuxDocument/NuxDocument_edit.py NuxDocument/skins/zpt_NuxDocument/NuxDocument_edit.py --- NuxDocument.orig/skins/zpt_NuxDocument/NuxDocument_edit.py Mon Dec=20 2 15:33:37 2002 +++ NuxDocument/skins/zpt_NuxDocument/NuxDocument_edit.py Fri Jan 10 15:40:55 2003 @@ -4,14 +4,14 @@ ##bind namespace=3D ##bind script=3Dscript ##bind subpath=3Dtraverse_subpath -##parameters=3Dfile, REQUEST, RESPONSE +##parameters=3Ddescription, file, REQUEST, RESPONSE # # Copyright 2001 St=C3=A9fane Fermigier and Nuxeo SARL # See LICENSE.TXT for licensing information # - +request=3Dcontext.REQUEST try: - context.edit('', file) + context.edit(REQUEST.get('title',None), description, file) except: context.REQUEST.RESPONSE.redirect('%s/NuxDocument_edit_form'=20 % context.absolute_url() + '?portal_status_message=3DOops!' ) diff --unified --exclude=3D*.pyc --exclude=3D*~ --recursive NuxDocument.orig/skins/zpt_NuxDocument/NuxDocument_edit_form.pt NuxDocument/skins/zpt_NuxDocument/NuxDocument_edit_form.pt --- NuxDocument.orig/skins/zpt_NuxDocument/NuxDocument_edit_form.pt Mon Dec 2 15:33:37 2002 +++ NuxDocument/skins/zpt_NuxDocument/NuxDocument_edit_form.pt Wed Jan 22 15:07:48 2003 @@ -7,6 +7,7 @@ =20 <h2>Edit <span tal:replace=3D"here/getId">ID</span></h2> =20 +<div tal:replace=3D"here/filename">filename</div> <form action=3D"NuxDocument_edit" method=3D"post" enctype=3D"multipart/form-data"> =20 <table class=3D"FormLayout"> @@ -15,7 +16,7 @@ Title </th> <td> - <span tal:replace=3D"here/Title">Title</span> + <input type=3D"text" size=3D"30" name=3D"title:ignore_empty" tal:attributes=3D"value here/Title" /> </td> </tr> =20 @@ -24,7 +25,7 @@ Description </th> <td> - <span tal:replace=3D"here/Description">Description</span> + <textarea cols=3D"50" rows=3D"6" name=3D"description" tal:content=3D"here/Description">Description</textarea> </td> </tr> =20 |