f1021cb3f9a521ac8830bf9ab002b27d73d45dd8
[MosaicDocument.git] / dtml / properties.dtml
1 <dtml-if management_page_charset>
2 <dtml-comment>
3 A site-global encoding specification in a property.
4 Note that this feature only works if there are no unicode objects
5 around. This means that this feature is not likely to be supported
6 in all future versions of zope.
7 </dtml-comment>
8 <dtml-call "REQUEST.set('management_page_charset',
9 _['management_page_charset'])">
10 <dtml-call "REQUEST.set('management_page_charset_tag','')">
11 <dtml-else>
12 <dtml-comment>
13 Thankfully no site-global encoding specification in a property.
14 We can set UTF-8, and unicode properties will work.
15 </dtml-comment>
16 <dtml-call "REQUEST.set('management_page_charset','UTF-8')">
17 <dtml-call "REQUEST.set('management_page_charset_tag','UTF-8:')">
18 </dtml-if>
19
20 <dtml-if "REQUEST.get('management_page_charset',None)=='UTF-8'">
21 <dtml-var "u' '">
22 </dtml-if>
23 <dtml-var manage_page_header>
24 <dtml-with "_(management_view='Properties')">
25 <dtml-var manage_tabs>
26 </dtml-with>
27
28 <dtml-if Principia-Version>
29 <p>
30 <em>You are currently working in version &dtml-Principia-Version;</em>
31 </p>
32 </dtml-if Principia-Version>
33
34 <form action="&dtml-URL1;" method="post">
35 <dtml-if propertyMap>
36 <p class="form-help">
37 Properties allow you to assign simple values to Zope objects. To change
38 property values, edit the values and click &quot;Save Changes&quot;.
39 </p>
40
41 <table cellspacing="0" cellpadding="2" border="0">
42 <tr class="list-header">
43 <td align="left" valign="top" width="16">
44 &nbsp;
45 </td>
46 <td align="left" valign="top">
47 <div class="form-label">
48 Name
49 </div>
50 </td>
51 <td align="left" valign="top">
52 <div class="form-label">
53 Value
54 </div>
55 </td>
56 <td align="left" valign="top">
57 <div class="form-label">
58 Type
59 </div>
60 </td>
61 </tr>
62
63 <dtml-in propertyMap mapping>
64 <dtml-let type="not _.has_key('type') and 'string' or type">
65 <tr>
66 <td align="left" valign="top" width="16">
67 <dtml-if "'d' in _['sequence-item'].get('mode', 'awd')">
68 <input type="checkbox" name="_ids:<dtml-var "REQUEST['management_page_charset_tag']">string:list" value="&dtml-id;"
69 id="cb-&dtml-id;">
70 <dtml-else>
71 </dtml-if>
72 </td>
73 <td align="left" valign="top">
74 <div class="form-label">
75 <label for="cb-&dtml-id;"><dtml-var "propertyLabel(id)" html_quote></label>
76 </div>
77 </td>
78 <td align="left" valign="top">
79
80 <dtml-if "'w' in _['sequence-item'].get('mode', 'awd')">
81 <dtml-if "type == 'int'">
82 <input type="text" name="&dtml-id;:&dtml-type;"
83 size="35" value="<dtml-if "hasProperty(id)"><dtml-var "'%s' % getProperty(id)" html_quote></dtml-if>">
84 <dtml-elif "type == 'long'">
85 <input type="text" name="&dtml-id;:&dtml-type;" size="35"
86 value="<dtml-if "hasProperty(id)"><dtml-var "('%s' % getProperty(id))" html_quote></dtml-if>">
87 <dtml-elif "type in ('float', 'date')">
88 <input type="text" name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">&dtml-type;" size="35"
89 value="<dtml-var "getProperty(id)" html_quote>">
90 <dtml-elif "type in ['string','ustring']">
91 <input type="text" name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">&dtml-type;" size="35"
92 value="<dtml-var "getProperty(id)" html_quote>">
93 <dtml-elif "type=='boolean'">
94 <input type="checkbox" name="&dtml-id;:boolean" size="35"
95 <dtml-if "getProperty(id)">CHECKED</dtml-if>>
96 <dtml-elif "type in ['tokens','utokens']">
97 <input type="text" name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">&dtml-type;" size="35"
98 value="<dtml-in "getProperty(id)">&dtml-sequence-item; </dtml-in>">
99 <dtml-elif "type in ['text','utext']">
100 <textarea name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">&dtml-type;" rows="6" cols="35"><dtml-var "getProperty(id)" html_quote></textarea>
101 <dtml-elif "type in ['lines','ulines']">
102 <textarea name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">&dtml-type;" rows="6" cols="35"><dtml-in
103 "getProperty(id)">&dtml-sequence-item;<dtml-if
104 sequence-end><dtml-else><dtml-var "'\n'"></dtml-if></dtml-in></textarea>
105
106 <dtml-elif "type=='selection'">
107
108 <dtml-if "hasProperty(select_variable)">
109 <div class="form-element">
110 <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">text">
111 <dtml-in "getProperty(select_variable)">
112 <option
113 <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if>
114 >&dtml-sequence-item;</option>
115 </dtml-in>
116 </select>
117 </div>
118 <dtml-elif "_.has_key(select_variable)">
119 <div class="form-element">
120 <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">text">
121 <dtml-in "_[select_variable]">
122 <option
123 <dtml-if "_['sequence-item']==getProperty(id)">SELECTED</dtml-if>
124 >&dtml-sequence-item;</option>
125 </dtml-in>
126 </select>
127 </div>
128 <dtml-else>
129 <div class="form-text">
130 No value for &dtml-select_variable;.
131 </div>
132 </dtml-if>
133
134 <dtml-elif "type=='multiple selection'">
135
136 <dtml-if "hasProperty(select_variable)">
137 <div class="form-element">
138 <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">list:string" multiple
139 size="<dtml-var "_.min(7, _.len(getProperty(select_variable)))">">
140 <dtml-in "getProperty(select_variable)">
141 <option<dtml-if
142 "getProperty(id) and (_['sequence-item'] in getProperty(id))"
143 > SELECTED</dtml-if
144 >>&dtml-sequence-item;</option>
145 </dtml-in>
146 </select>
147 </div>
148 <dtml-elif "_.has_key(select_variable)">
149 <div class="form-element">
150 <select name="&dtml-id;:<dtml-var "REQUEST['management_page_charset_tag']">list:string" multiple
151 size="<dtml-var "_.min(7, _.len(_[select_variable]))">">
152 <dtml-in "_[select_variable]">
153 <option<dtml-if
154 "getProperty(id) and (_['sequence-item'] in getProperty(id))"
155 > SELECTED</dtml-if
156 >>&dtml-sequence-item;</option>
157 </dtml-in>
158 </select>
159 </div>
160 <dtml-else>
161 <div class="form-text">
162 No value for &dtml-select_variable;.
163 </div>
164 </dtml-if>
165 <dtml-elif "type=='expr'">
166 <input type="text" name="<dtml-var id>:<dtml-var "REQUEST['management_page_charset_tag']"><dtml-var type>" size="35"
167 value="<dtml-var "getProperty(id).text" html_quote>">
168 <dtml-else>
169 <em>Unknown property type</em>
170 </dtml-if>
171 <dtml-else>
172 <table border="1">
173 <tr><td><dtml-var "getProperty(id)" html_quote></td></tr>
174 </table>
175 </dtml-if>
176 </td>
177 <td align="left" valign="top">
178 <div class="list-item">
179 &dtml-type;
180 </div>
181 </td>
182
183 <dtml-if "id=='title'">
184 <td align="center" valign="top">
185 <div class="list-item"><b>Warning:</b> be aware that removing 'title' without re-adding it might be dangerous.</div>
186 </td>
187 </dtml-if>
188 </tr>
189 </dtml-let>
190 </dtml-in>
191 <tr>
192 <td colspan="2">&nbsp;</td>
193 <td align="left" valign="top">
194 <div class="form-element">
195 <input name="manage_editProperties:method" type="submit"
196 class="form-element" value="Save Changes" />
197 <dtml-if property_extensible_schema__>
198 <input name="manage_delProperties:method" type="submit"
199 class="form-element" value="Delete" />
200 </div>
201 </td>
202 <td>
203 <dtml-comment>
204 This needs some community review before exposing it officially.
205 <input type="submit" name="manage_propertyTypeForm:method" value="Change Names/Types">
206 </dtml-comment>
207 </td>
208 <dtml-else>
209 <td>&nbsp;</td>
210 </dtml-if>
211 </td>
212 </tr>
213 </table>
214
215 <dtml-else>
216 <p class="form-help">
217 Properties allow you to assign simple values to Zope objects. There are
218 currently no properties defined for this item. <dtml-if
219 property_extensible_schema__>To add a property, enter a name, type
220 and value and click the &quot;Add&quot; button.
221 </dtml-if>
222 </p>
223
224 </dtml-if>
225 </form>
226
227 <dtml-if property_extensible_schema__>
228
229 <form action="&dtml-URL1;/manage_addProperty" method="post">
230
231 <p class="form-help">
232 To add a new property, enter a name, type and value for the new
233 property and click the &quot;Add&quot; button.
234 </p>
235
236 <table>
237 <tr>
238 <td align="left" valign="top">
239 <div class="form-label">
240 Name
241 </div>
242 </td>
243 <td align="left" valign="top">
244 <input type="text" name="id:<dtml-var "REQUEST['management_page_charset_tag']">string" size="30" value=""/>
245 </td>
246 <td align="left" valign="top" class="form-label">
247 Type
248 </td>
249 <td align="left" valign="top">
250 <div class="form-element">
251 <select name="type">
252 <option>boolean</option>
253 <option>date</option>
254 <option>float</option>
255 <option>int</option>
256 <option>lines</option>
257 <option>long</option>
258 <option>expr</option>
259 <option selected>string</option>
260 <dtml-if "REQUEST['management_page_charset'] == 'UTF-8'">
261 <option>ustring</option>
262 <option>text</option>
263 <option>tokens</option>
264 <option>utext</option>
265 <option>utokens</option>
266 <option>ulines</option>
267 </dtml-if>
268 <option>selection</option>
269 <option>multiple selection</option>
270 </select>
271 </div>
272 </td>
273 </tr>
274 <tr>
275 <td align="left" valign="top">
276 <div class="form-label">
277 Value
278 </div>
279 </td>
280 <td colspan=2 align="left" valign="top">
281 <dtml-if "REQUEST['management_page_charset'] == 'UTF-8'">
282 <input type="text" name="value:UTF-8:ustring" size="30" />
283 <dtml-else>
284 <input type="text" name="value:string" size="30" />
285 </dtml-if>
286 </td>
287 <td align="right" valign="top">
288 <div class="form-element">
289 <input class="form-element" type="submit" name="submit" value=" Add " />
290 </div>
291 </td>
292 </tr>
293 </table>
294 </form>
295 </dtml-if>
296
297 <dtml-var manage_page_footer>
298
299