[Zope-CMF] Subject field in metadata

Tres Seaver tseaver@digicool.com
Fri, 18 May 2001 07:24:09 -0400


Norman Khine wrote:
> 
> Hello,
> How can I update the Subject select list in the advanced search form -- what
> I have is that during a post I did not enter a subject, thus created an
> empty field. So now the first select is just an empty line. Is there a way
> to update this.

I would do something like:

 - Customize 'full_metadata_edit' to add a text input field for adding
   "additional" subject keywords, , e.g.::

    <input type="text" name="added_subject:tokens">

 - Add a PythonScript to the skin, 'fixupSubject'::

     subject = []
     for subject_org in context.REQUEST.get( 'subject', () ):
         if subject_org:
             subject.append( subject_org )
     for subject_add in context.REQUEST.get( 'added_subject', () ):
         if subject_add:
             subject.append( subject_add )
     context.REQUEST.set( 'subject', subject )

   Note that this script also cleans out any unintended "empty"
   values.

 - Customize 'metadata_edit' to call the PythonScript before
   calling 'editMetdata'::

   
   <dtml-call fixupSubject>
   <dtml-call expr="editMetadata( ...

Tres.
-=
===============================================================
Tres Seaver                                tseaver@digicool.com
Digital Creations     "Zope Dealers"       http://www.zope.org