[Zope] properties UI suggestion

Rik Hoekstra hoekstra@fsw.leidenuniv.nl
Mon, 22 Nov 1999 22:10:49 +0100


--Message-Boundary-13119
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Mail message body

Hi Evan,

i just downloaded your changed property.dtml file (and the rest). It 
seems it was somehow (slightly) mutilated in the transfer to 
zope.org. A new version is appended. It works ok now.

Rik


--Message-Boundary-13119
Content-type: text/plain; charset=US-ASCII
Content-transfer-encoding: 7BIT
Content-description: Text from file 'properties.dtml'

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html lang="en">
<head>
<title>Properties</title>
	<base href="http://www.zope.org/Members/4am/ChangePropertyTypes/properties.dtml/">
</head>
<body bgcolor="#FFFFFF" link="#000099" vlink="#555555">
<dtml-var manage_tabs>

<dtml-if Principia-Version>
<p>
<em>You are currently working in version <dtml-var Principia-Version></em>
</p>
</dtml-if Principia-Version>

<P>
Properties allow you to assign simple values to Zope objects.
</P>

<form action="<dtml-var URL1>" method="POST">
<dtml-if propertyMap>
<p>
The following properties are defined for this item. 
<dtml-if property_extensible_schema__>
To <a href="#addpropform">
add a new property</a>, enter a name, type and value for the new property 
and click the &quot;Add&quot; button. 
</dtml-if>
To change property values, edit the 
values and click "Save Changes". 
</p>
<table border="0" cellspacing="0" cellpadding="2">
<dtml-in propertyMap mapping>
<tr>
  <td align="left" valign="top" width="16">
  <dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
  <input type="checkbox" name="ids:list" value="<dtml-var id html_quote>" ID="cb-<dtml-var id>">
  <dtml-else>
  </dtml-if>
  </td>
  <td align="left" valign="top">
  <strong><LABEL FOR="cb-<dtml-var id>"><dtml-var "propertyLabel(id)"></LABEL></strong>
  </td>
  <td align="left" valign="top">
  <dtml-if "'w' in _['sequence-item'].get('mode', 'awd')">
  <dtml-if "type == 'int'">
  <input type="text" name="<dtml-var id>:<dtml-var type>" size="35"
   value="<dtml-if "hasProperty(id)"><dtml-var 
   "'%s' % getProperty(id)" html_quote></dtml-if>">
  <dtml-elif "type == 'long'">
  <input type="text" name="<dtml-var id>:<dtml-var type>" size="35"
   value="<dtml-if "hasProperty(id)"><dtml-var 
   "('%s' % getProperty(id))[:-1]" html_quote></dtml-if>">
  <dtml-elif "type in ('float', 'date')">
  <input type="text" name="<dtml-var id>:<dtml-var type>" size="35"
   value="<dtml-var "getProperty(id)" html_quote>">
  <dtml-elif "type=='string'">
  <input type="text" name="<dtml-var id>:string" size="35"
   value="<dtml-var "getProperty(id)" html_quote>">
  <dtml-elif "type=='boolean'">
  <input type="checkbox" name="<dtml-var id>:boolean" size="35"
   <dtml-if "getProperty(id)">CHECKED</dtml-if>>
  <dtml-elif "type=='tokens'">
  <input type="text" name="<dtml-var id>:tokens" size="35"
   value="<dtml-in "getProperty(id)"><dtml-var sequence-item html_quote> </dtml-in>">
  <dtml-elif "type=='text'">
  <textarea name="<dtml-var id>:text" rows="6" cols="35"><dtml-var 
   "getProperty(id)" html_quote></textarea>
  <dtml-elif "type=='lines'">
  <textarea name="<dtml-var id>:lines" rows="6" cols="35"><dtml-in
  "getProperty(id)"><dtml-var sequence-item html_quote><dtml-if
   sequence-end><dtml-else><dtml-var "'\n'"></dtml-if></dtml-in></textarea>
  <dtml-elif "type=='selection'">
    <dtml-if "_.has_key(select_variable)">
    <select name="<dtml-var id>">
      <dtml-in "_[select_variable]">
         <option
          <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if>
          ><dtml-var sequence-item html_quote></option>
      </dtml-in>
    </select>
    <dtml-else>
       No value for <dtml-var select_variable>.
    </dtml-if>
  <dtml-elif "type=='multiple selection'">
    <dtml-if "_.has_key(select_variable)">
    <select name="<dtml-var id>:list" multiple
      size="<dtml-var "_.min(7, _.len(_[select_variable]))">">
      <dtml-in "_[select_variable]">
         <option<dtml-if 
         "_['sequence-item'] in getProperty(id)"> SELECTED</dtml-if
         >><dtml-var sequence-item html_quote></option>
      </dtml-in>
    </select>
    <dtml-else>
    No value for <dtml-var select_variable>.
    </dtml-if>
  <dtml-else>
  <em>Unknown property type</em>
  </dtml-if>
  <dtml-else>
  <table border="1">
  <tr><td><dtml-var "getProperty(id)" html_quote></td></tr>
  </table>
  </dtml-if>
  </td>
  <td align="left" valign="top">
  <dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
  <select name="&dtml-id;-type">
<dtml-in expr="('boolean', 'date', 'float', 'int', 'lines', 'long', 'string'
               , 'text', 'tokens', 'selection', 'multiple selection')">
  <dtml-let SELECTED="('', 'SELECTED')[type==_['sequence-item']]">
    <option &dtml-SELECTED;>&dtml-sequence-item;</option>
  </dtml-let>
</dtml-in>
  </select>
  <dtml-else>(&dtml-type;)
  </dtml-if>
</td>
</tr>
</dtml-in>
<tr>
  <td align="left" valign="top" colspan="2">&nbsp;</td>
  <td align="left" valign="top" colspan="2">
  <input type="submit" name="manage_editProperties:method" 
   value="Save Changes">
  <input type="submit" name="manage_delProperties:method" value="Delete">
  <input type="submit" name="manage_propertyTypeForm:method" value="Change Types">
  </td>
</tr>
</table>

<dtml-else>
<p>
There are currently no properties defined for this item. 
<dtml-if property_extensible_schema__>
To add a property, click the &quot;Add...&quot; button.
</dtml-if>
</p>

</dtml-if>
</form>

<dtml-if property_extensible_schema__>
<a name="addpropform">
<form action="<dtml-var URL1>/manage_addProperty" method="POST">
<p>
To add a new property, enter a name, type and value for the new 
property and click the &quot;Add&quot; 
button. For &quot;selection&quot; and &quot;multiple selection&quot;
properties enter the name of a selection variable in the &quot;Value&quot;
field. The selection variable is a property or method that returns a list
of strings from which the selection(s) can be chosen.
</p>
<table>
<tr>
  <th align="left" valign="top">Id</th>
  <td align="left" valign="top"><input type="text" name="id" size="20"></td>
  <th align="left" valign="top">Type</th>
  <td align="left" valign="top">
    <select name="type">
      <option>boolean</option>
      <option>date</option>
      <option>float</option>
      <option>int</option>
      <option>lines</option>
      <option>long</option>
      <option SELECTED>string</option>
      <option>text</option>
      <option>tokens</option>
      <option>selection</option>
      <option>multiple selection</option>
    </select>
  </td>
</tr>
<tr>
  <th align="left" valign="top">Value</th>
  <td colspan=2 align="left" valign="top">
    <input type="text" name="value" size="30">
  </td>
  <td align="right" valign="top">
  <input type=type="submit" value=" Add ">
  </td>
</tr>
</table>
</form>
</dtml-if>

</body>
</html>

--Message-Boundary-13119--