[Zope-dev] Re: [Zope] Container Class questions

Kapil Thangavelu kthangavelu@earthlink.net
Sun, 08 Oct 2000 12:46:48 -0700


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>