[Zope-CMF] using the subject property

Tres Seaver tseaver@digicool.com
Tue, 3 Apr 2001 08:17:43 -0400 (EDT)


On Mon, 2 Apr 2001, Ben Riga wrote:

> 
> >>>>>
> > >Hmm, this works for me on a customized search form:
> > >
> > > <tr valign="top">
> > >  <th>Subject</th>
> > >  <td>
> > >   <select name="Subject:list" multiple size="4">
> > >    <dtml-in expr="portal_catalog.uniqueValuesFor( 'Subject' )">
> > >     <option value="&dtml-sequence-item;"> &dtml-sequence-item; </option>
> > >    </dtml-in>
> > >   </select>
> > >  </td>
> > > </tr>
> >
> > Cool.  Thanks.  The 'dtml-sequence-item' is what I was looking
> > for.  Looking now at the documentation, I'm embarassed that I
> > missed that.  The next step is to fire a topic/query that lists
> > items in a 'subject'.  I'll play with that over the next couple
> > of days.
> 
> That should be straightforward:  add a "String Criterion" for
> "Subject" on the "Criteria" page of the topic.
> <<<<<
> 
> So the way I'd like to solve this is to have a query that
> builds a list of existing subject keywords.  Then have the user
> click on one to fire another query that lists all objects that
> have that subject in their metadata.  I have the method that
> lists all the subjects (SubjList) and I have a method that can
> list the details of a subject (SubjDetl).  My question is how
> do I pass the 'subject' that the user clicked on.
> 
> SubjList:
>   <dtml-in expr="portal_catalog.uniqueValuesFor( 'Subject' )" >
>     <a href=SubjDetl>&dtml-sequence-item; </a><br>

You need to encode the value into the URL, or else arrange to 
get it to the next method via an HTTP POST.  The first method
would look like:

    <a href="SubjDetl?Subject=&dtml-sequence-item;">

>   <dtml-else>
>     No subjects
>   </dtml-in>

The second method would be like the one I posted above, where
the value was passed via the form variable bound to a '<select'>
element.

> SubjDetl
>   <dtml-in "portal_catalog.searchResults( Subject=  <<<need to know how I
> pass info here>>>

  <dtml-in expr="portal_catalog.searchResults( Subject="REQUEST['Subject']" )">

>     , sort_on='Date'
>     , sort_order='reverse'
>     , review_state='published'
>     )" size="10">
>     <tr class="SubjDetlItemRow">
>       <td valign="top">
>         <a href="<dtml-var "getURL()">"> &dtml-Title; </a><br>
>         &dtml-Date;<br>
>       </td>
>     </tr>
>   <dtml-else>
>     <tr class="SubjDetlItemRow">
>       <td valign="top">
>         There are no details.
>       </td>
>     </tr>
>   </dtml-in>

Hope that helps!

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