[Zope-CMF] 'portal_metadata' tool in CVS

marc lindahl marc@bowery.com
Sat, 05 May 2001 04:02:03 -0400


This tool is the BOMB!

A key TO-DO is hooking it into the UI (obviously, it's brand new).  I think
that the 'subject' field is a prime candidate for organizing the content on
a site, but to work right, the list of subjects has to be enforced.  To see
how well this might work, I modified metadata_edit_form.dtml (in generic
skin) to multiple-select the subject from a list defined with the
portal_metadata tool.  I'll put the code at the end of the message - to try
it:
1. just 'cusomize' metadata_edit_form (from basic/content skin) into, say,
custom, and paste this code in.
2. add a portal_metadata tool to your portal if you don't already have one.
3. in the portal metadata tool, under the 'elements' tab, pick 'subject' and
put some stuff into the 'vocabulary' list.  E.G.: member, homepage, photo,
essay, diatribe, former cia.  Now update.  Notice how you can make different
lists for different content types.  Way cool!
4. pick 'metadata' from the actions box, for some document or file, and you
should see this list presented, instead of the usual blank box.

The cool thing about this is, then I can use PortalTopics to give me
meaningful directories in my site.

One thing occured to me.  That is, it might be nice to have a different (or
concatenated) vocabulary based on ROLE.  In other words, in the above
example, to allow only Managers the choice of 'former cia' and 'diatribe'.

This DTML is just an illustration, it should at least have stuff to handle
the case of no portal_metadata tool around or an empty list.

I put this file on
http://cmf.zope.org/Members/bowerymarc/metadata_edit_form.dtml/view
once it goes public you can download it from there.  Until then, here's a
page of DTML:

<dtml-var standard_html_header>

<div class="Desktop">

<dtml-if message>
 <p>&dtml-message;</p>
 <hr>
</dtml-if>

<div class="Metadata">

<h2>Standard Resource Metadata </h2>

<form action="metadata_edit" method="post">
<table class="FormLayout">
 <tr valign="top">
  <th align="right"> Identifier
  </th>
  <td>
   <dtml-var Identifier>
  </td>
  <td colspan="2" align="right">
   <a href="full_metadata_edit_form"> Edit all metadata </a>
  </td>
 </tr>
 <tr valign="top">
  <th align="right"> Title
  </th>
  <td colspan="3">
   <input type="text"
          name="title"
          value="&dtml-Title;"
          size="65">
  </td>
 </tr>
 <tr valign="top">
  <th align="right"> Description
  </th>
  <td colspan="3">
   <textarea name="description:text" rows="5"
             cols="65">&dtml-Description;</textarea>
  </td>
 </tr>
 <tr valign="top">
  <th align="right"> Subject <br> <font
size="-1"><br>(multiple<br>selection)</font>
  </th>
  <dtml-comment> Support portal_metadata limiting of subjects
  </dtml-comment>
  <td>
    <select name="subject:list" multiple size="<dtml-var
            "_.len(portal_metadata.listAllowedSubjects())">">
        <dtml-in "portal_metadata.listAllowedSubjects()">
                 <option <dtml-if "Subject() and (_['sequence-item'] in
Subject())"> 
                    SELECTED</dtml-if>>
                <dtml-var sequence-item>
            </option>
        </dtml-in>
    </select>
<dtml-comment>
   <textarea name="subject:lines" rows="5"
             cols="30"><dtml-in Subject><dtml-var sequence-item>
   </dtml-in></textarea>
</dtml-comment>
  </td>
  <th align="right"> Format
  </th>
  <td> <input type="text" name="format" value="&dtml-Format;">
  <br> <input type="submit" name="change_and_edit" value=" Change & Edit ">
  <br> <input type="submit" name="change_and_view" value=" Change & View ">
  </td>
 </tr>
</table>
</form>

</div>

</div>

<dtml-var standard_html_footer>