[Zope] Re: [Zope-dev] Using propertysheets?

peter sabaini sabaini@inode.at
Fri, 07 Jun 2002 17:04:51 +0200


This is a multi-part message in MIME format.
--------------010601090709050705080705
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Lennart Regebro wrote:
> From: "peter sabaini" <sabaini@inode.at>
> 
>>I think it should work well with PropertyManager
> 
> Thanks, I got a lot further now. Still some things before I'm done though:
> 
>>  - Define your own edit form
> 
> How do I do that? The default edit form /propertysheets/name/manage works
> well, but doesn't have any management tabs. I've done a lot of
> experimenting, but everytime I get management tabs I also get the default
> properties, no matter what view I'm on...

Not sure if I get you correctly...

I had to manage some properties I called "Advanced", so I defined a 
suitable DTML File 'manage_advancedForm' (a copy-paste job from the 
standard Propertiers form plus some customization) -- see attachment.

Then add something like the following:

     manage_advancedForm = DTMLFile('dtml/advancedForm', globals())
     def manage_advanced(self, REQUEST=None):
         """Edit Advanced Settings"""
         adv = self.propertysheets.get('advanced')
         adv.manage_editProperties(REQUEST)
         if REQUEST is not None:
             return self.manage_advancedForm(
                 REQUEST,
                 manage_tabs_message='Advanced Settings updated.',
                 )

Plus you have to tell Zope to draw a management tab "Advanced", so 
you'll add a dict {'label': 'Advanced', 'action': 
'manage_advancedForm'} to your manage_options attribute.

HTH,
peter.

ps.: I've taken this to zope@zope.org instead of zope-dev

> Best Regards
> 
> Lennart Regebro
> Torped Strategi och Kommunikation AB
> 
> 
> 
> 
> 


--------------010601090709050705080705
Content-Type: text/html;
 name="advancedForm.dtml"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="advancedForm.dtml"

<dtml-var manage_page_header> 
<dtml-with "_(management_view='AdvancedSettings')">
<dtml-var manage_tabs>
</dtml-with>
<dtml-if Principia-Version>
<p> <em>You are currently working in version 
  <dtml-var Principia-Version>
  </em> </p>
</dtml-if Principia-Version>
<p class="form-help">Some help text
</p>

 <dtml-with "propertysheets.get('advanced')">
<form action="<dtml-var URL1>">
  <table>
    <tr> 
      <th class="form-label" align="right">Prop1:</th>
      <td> 
        <input name="prop1" value="&dtml-prop1;"/>
      </td>
    </tr>
    <tr> 
      <th class="form-label" align="right">Prop2:</th>
      <td> 
        <p> 
		  <input name="prop2" value="&dtml-prop2;"/>
        </p>
      </td>
    </tr>
    <tr> 
      <td></td>
      <td> 
        <input type="submit" value="Save Changes" name="manage_advanced:method">
      </td>
    </tr>
  </table>
</form>
</dtml-with>
<dtml-var manage_page_footer>

--------------010601090709050705080705--