Robin Becker writes:
I would like to add properties in a property sheet, but cannot find a neat way to see the properties on the base object and on the propertySheet.
So I would like my properties to show id title
and the properties on my basic properties sheet.
I can easily add properties directly to the object during the Thing_add and Thing_addForm and these appear on the properties tab for added objects.
How do I get a tab for the property sheets?
I am not sure, I understand precisely, what you want to reach. ZClass properties are managed on distinct property sheets. I do not know of a neat way to present (and change) properties from different property sheets (other than adapting the "manage_PropertiesForm" manually). To get a tab for a single property sheet (other than the default one), you define a "View" (in the ZClass) for it. I agree with you, that there should be a way to add properties to the "inherited" or "default" property sheet (or, more generally, any inherited property sheets, e.g. from inherited ZClasses). When I read the code, I had the impression that access to the default property sheet should be able via the property sheet name 'default'. Unfortunately, it did not work (Zope 2.2.2). Apparently, there is some missing link. Dieter
Dieter Maurer wrote:
Robin Becker writes:
I would like to add properties in a property sheet, but cannot find a neat way to see the properties on the base object and on the propertySheet.
So I would like my properties to show id title
and the properties on my basic properties sheet.
I can easily add properties directly to the object during the Thing_add and Thing_addForm and these appear on the properties tab for added objects.
How do I get a tab for the property sheets?
I am not sure, I understand precisely, what you want to reach.
ZClass properties are managed on distinct property sheets. I do not know of a neat way to present (and change) properties from different property sheets (other than adapting the "manage_PropertiesForm" manually).
I wrote up some code (dated) to present generic forms for changing zclass properties, code to follow. i generally use it just to get a fast prototype for a system, example: picking a property sheet and harding coding a link to the second method. yes this code does find base class properties (including stuff like webdav, etc), or at least it did last time i used it (era 2.1.6). hope this helps Kapil three methods one to select a property sheet one to edit a property one to change a property sheet 1. edit_properties <dtml-var standard_html_header> <center><b>Please Pick A Property Category</b></center> <table align="center"> <form action="edit_propertyCategory" method="POST"> <tr><td> <SELECT name="PropertyCategory"> <dtml-in "propertysheets.items()"> <OPTION value="<dtml-var sequence-key>"><dtml-var sequence-key></OPTION> </dtml-in> </SELECT> </tr></td> <tr><td><INPUT TYPE="SUBMIT" value="Edit Properties"></td></tr> </form> </table> <dtml-var standard_html_footer> 2. edit_PropertyCategory <dtml-var standard_html_header> <dtml-if "REQUEST.has_key('PropertyCategory')"> <dtml-in "propertysheets.items()"> <dtml-let y=sequence-key> <dtml-if "REQUEST.PropertyCategory==y"> <dtml-let x=sequence-item> <table border="1" align="center" cellspacing="0" cellpadding="4"> <tr><th colspan="2" align="center">Edit <dtml-var y> Properties</th></tr> <form action="edit_propertiesChange" method="POST"> <dtml-in "x.propertyItems()"> <tr><td> <dtml-var sequence-key> </td><td> <input type="text" name="<dtml-var sequence-key>" value="<dtml-var sequence-item>"> </td></tr> </dtml-in> <tr><td colspan="2" align="center"><input type="SUBMIT" value="Change Properties"></td></tr> <input type=hidden name="PropertyCategory" value="<dtml-var PropertyCategory>"> </form> </table> </dtml-let> </dtml-if> </dtml-let> </dtml-in> <dtml-else> You have reached this page in error </dtml-if> <dtml-var standard_html_footer> 3. edit_propertiesChange <dtml-var standard_html_header> <dtml-if "REQUEST.has_key('PropertyCategory')"> <dtml-in "propertysheets.items()"> <dtml-let y=sequence-key> <dtml-if "REQUEST.PropertyCategory==y"> <dtml-let x=sequence-item> <dtml-call "x.manage_changeProperties(REQUEST)"> <dtml-var PropertyCategory> Properties Changed<br> <a href="<dtml-var URL1>">Back To Object</a><br> <a href="<dtml-var URL2>">Back To Container</a> </dtml-let> </dtml-if> </dtml-let> </dtml-in> <dtml-else> You have reached this page in error </dtml-if> <dtml-var standard_html_footer>
In article <39E0CF28.41D4C00A@earthlink.net>, Kapil Thangavelu <kthangavelu@earthlink.net> writes ... One of the things I wanted to do was to add a multiple selection property to the default properties in the Thing_add method. In order to do this in multiple zclasses I wanted to have a product wide variable/property/method to use as the allowed list. I could find no way to do that. As always with Zope there seem to be different inheritances/scopes at different times. Statically I can add a property to the product say projectList and it is visible when I add properties to a property sheet. So product wide things are visible statically, however projectList doesn't seem to be visible to my Thing_add method when I use manage_addProperty('projects','projectList','multiple selection') ie I get an error saying projectList isn't known. Clearly product wide methods are intended to be known at create time so why not properties? -- Robin Becker
participants (3)
-
Dieter Maurer -
Kapil Thangavelu -
Robin Becker