source: WAeUP_SRP/branches/srpp_branch/skins/waeup_default/waeup_layout_lib.pt @ 17941

Last change on this file since 17941 was 186, checked in by Henrik Bettermann, 19 years ago
File size: 17.0 KB
Line 
1<!-- WAeUP layout_lib  -->
2<!-- $Id: layout_lib_div_view.pt 24721 2005-07-08 13:04:38Z dwyart $ -->
3
4<!-- div_view  -->
5
6<metal:block define-macro="div_view"
7             tal:define="layout options/layout">
8  <tal:block repeat="row layout/rows">
9    <tal:block repeat="cell row">
10      <tal:block define="widget cell/widget">
11        <div tal:define="dm options/datastructure/getDataModel;"
12             tal:attributes="class cell/widget_css_class|nothing;
13             id python:widget.getHtmlWidgetId()+'_widget';"
14             >
15          <tal:block condition="widget/label">
16            <span class="dlabel" i18n:translate="" tal:condition="widget/is_i18n"
17                  tal:content="widget/label">label</span>
18            <span class="dlabel" tal:condition="not:widget/is_i18n"
19                  tal:content="widget/label">label</span>
20          </tal:block>
21          <tal:block replace="structure cell/widget_rendered" />
22        </div>
23      </tal:block>
24    </tal:block>
25  </tal:block>
26</metal:block>
27
28<!-- table view -->
29<metal:block define-macro="table_view"
30             tal:define="layout options/layout">
31<table border="0">
32    <tal:block repeat="row layout/rows">
33      <tr>
34        <tal:block repeat="cell row">
35          <tal:block define="widget cell/widget">
36            <div tal:omit-tag=""
37                 tal:define="dm options/datastructure/getDataModel;"
38                 tal:attributes="class cell/widget_css_class|nothing;
39                 id python:widget.getHtmlWidgetId()+'_widget';"
40                 >
41              <tal:block condition="widget/label">
42              <td valign="top">
43                <span i18n:translate="" tal:condition="widget/is_i18n">
44                    <span tal:content="widget/label" />:</span>
45                <span tal:condition="not:widget/is_i18n">
46                    <span tal:content="widget/label" />:</span>
47              </td>
48              </tal:block>
49              <tal:block condition="not: widget/label">
50              <td>
51                <div valign="top"> no label </div>
52              </td>
53              </tal:block>             
54              <td>
55               <div class="ddescription"  tal:condition="cell" tal:content="structure cell/widget_rendered"></div>
56               <div class="ddescription" tal:condition="not:cell/widget_rendered"> none </div>
57             </td>
58            </div>
59          </tal:block>
60        </tal:block>
61      </tr>
62    </tal:block>
63  </table>
64</metal:block>
65
66<!-- default edit  -->
67
68<metal:block define-macro="default_edit"
69  tal:define="layout options/layout;
70              ds options/datastructure;
71              creation creation|nothing;
72              metadata metadata|nothing;
73              type_name request/type_name|nothing;
74              ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
75              creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ;
76              edit_form     python:ti and ti.getActionById('edit',   'cpsdocument_edit_form') or  'cpsdocument_edit_form';
77              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
78              formaction python: test(creation, creation_form,
79                                 test(metadata, metadata_form,
80                                                edit_form));
81              first_layout options/first_layout|python:0;
82              last_layout options/last_layout|python:0;
83              is_flexible options/is_flexible;
84              cpsmcat nocall:here/translation_service;
85              ">
86<tal:block condition="first_layout">
87  <tal:block
88  content="structure string:<form action='${formaction}' method='post'
89  enctype='multipart/form-data' class='workflow'>
90  <div class=''><div class=''>" />
91  <input type="hidden" name="type_name" value="."
92    tal:condition="creation" tal:attributes="value request/type_name" />
93</tal:block>
94
95<table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
96  <tr tal:repeat="row layout/rows" valign="top">
97    <td tal:repeat="cell row"
98      tal:attributes="colspan cell/ncols">
99      <tal:block define="widget cell/widget;
100                         wid widget/getWidgetId;
101                         dm options/datastructure/getDataModel;
102                         err python:ds.getError(wid);
103                         err_mapping python:ds.getErrorMapping(wid);
104                         is_required widget/is_required|nothing;
105                         tooltip_id python:wid + '_help';
106                         widget_css_class cell/widget_css_class|nothing;
107                         widget_css_class python:test(is_flexible, 'group', widget_css_class);
108                         css_class python:test(err, 'row error',
109                                               test(is_flexible, 'group', 'row'))">
110        <div tal:attributes="class widget_css_class;
111                             id python:widget.getHtmlWidgetId()+'_widget';
112                            ">
113          <div class="label" tal:condition="widget/label_edit"
114            tal:attributes="class python:test(is_required, 'label required',
115                                              'label')">
116            <label i18n:translate="" tal:condition="widget/is_i18n"
117              tal:content="widget/label_edit"
118              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
119            <label tal:condition="not:widget/is_i18n"
120              tal:content="widget/label_edit"
121              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
122          </div>
123          <button type="button" class="tooltipControl"
124                  tal:condition="widget/help"
125                  tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
126          <div class="field">
127            <div tal:replace="structure cell/widget_rendered"/>
128          </div>
129          <div class="tooltipArea" style="visibility: hidden;"
130               tal:condition="widget/help"
131               tal:attributes="id tooltip_id;
132                               onclick python:'showElement(false, \'%s\')' % tooltip_id;">
133            <tal:block i18n:translate="" tal:condition="widget/is_i18n"
134              tal:content="widget/help">i18_key-help_for_this_field</tal:block>
135            <tal:block tal:condition="not:widget/is_i18n"
136              tal:content="widget/help">This is the help for this field</tal:block>
137          </div>
138          <tal:block condition="err">
139              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
140                <br /><em style="color: red"
141                  tal:content="msg">err</em>
142              </tal:block>
143          </tal:block>
144          <div style="float: right;" tal:condition="is_flexible">
145            <input type="submit" value="button_move_up"
146              tal:condition="not:repeat/row/start"
147              tal:attributes="name string:uprow_${repeat/row/index}"
148              class="context moveUp" i18n:attributes="value" />
149            <input type="submit" value="button_move_down"
150              tal:condition="not:repeat/row/end"
151              tal:attributes="name string:downrow_${repeat/row/index}"
152              class="context moveDown" i18n:attributes="value" />
153            <input type="submit" value="button_delete"
154              class="destructive" i18n:attributes="value"
155              tal:attributes="name string:deleterow_${repeat/row/index};
156                              onclick python:'return window.confirm(\'%s\')' %
157                                (cpsmcat('description_confirm_delete'), )" />
158          </div>
159        </div>
160      </tal:block>
161    </td>
162  </tr>
163</table>
164
165<tal:block condition="is_flexible">
166<div style="float: right;"
167    tal:define="flexible_widgets options/flexible_widgets">
168  <input type="hidden" name="layout_id" value="."
169    tal:attributes="value layout/layout_id" />
170  <tal:select condition="python:len(flexible_widgets)>1">
171    <select name="widget_type">
172      <tal:block repeat="widget options/flexible_widgets">
173      <option value="."
174        tal:condition="widget/is_i18n"
175        i18n:translate=""
176        tal:attributes="value widget/getWidgetId"
177        tal:content="widget/title_or_id">Type</option>
178      <option value="."
179        tal:condition="not:widget/is_i18n"
180        tal:attributes="value widget/getWidgetId"
181        tal:content="widget/title_or_id">Type</option>
182      </tal:block>
183    </select>
184    <input type="submit" name="addwidget_button" value="button_add"
185     class="context"
186     i18n:attributes="value" />
187  </tal:select>
188  <tal:button condition="python:len(flexible_widgets) == 1">
189    <tal:block define="widget python:flexible_widgets[0]">
190      <input type="hidden" name="widget_type"
191        tal:attributes="value widget/getWidgetId">
192      <input type="submit" name="addwidget_button"
193        tal:define="button_add python:cpsmcat('button_add');
194          widget_title python:cpsmcat(widget.title_or_id())"
195        tal:attributes="value string:${button_add} ${widget_title}"
196        class="context" />
197    </tal:block>
198  </tal:button>
199</div>
200</tal:block>
201
202<tal:block condition="last_layout">
203  <tal:block content="structure string:</div>" />
204  <metal:block define-slot="additional_content" />
205
206  <input type="submit" class="standalone" name="cpsdocument_edit_button"
207    value="button_change" i18n:attributes="value"
208    tal:condition="not:creation" />
209  <input type="submit" class="standalone" name="cpsdocument_create_button"
210    value="button_create" i18n:attributes="value" tal:condition="creation" />
211  <tal:block content="structure string:</div></form>" />
212</tal:block>
213
214</metal:block>
215<!-- default edit  -->
216
217<metal:block define-macro="common_edit"
218  tal:define="layout options/layout;
219              ds options/datastructure;
220              creation creation|nothing;
221              metadata metadata|nothing;
222              type_name request/type_name|nothing;
223              ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None);
224              tin python:type_name and getattr(here.portal_types,type_name,None);
225              creation_form options/create_action|string:create_common;
226              edit_form    options/edit_action|string:cpsdocument_edit_form;
227              metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata';
228              formaction python: test(creation, creation_form,
229                                 test(metadata, metadata_form,
230                                                edit_form));
231              first_layout python:1;
232              last_layout python:1;
233              is_flexible options/is_flexible;
234              cpsmcat nocall:here/translation_service;
235              ">
236<tal:block condition="first_layout">
237    <span tal:condition="python: 0">
238      <span tal:content="request/type_name|string:No Typename" /><br />
239      <span tal:content="creation_form" /><br />
240      <span tal:content="ti" /><br />
241      <span tal:content="python:ti.getActionById('create', 'cpsdocument_create_form')" /><br />
242      <span tal:content="python:getattr(here.portal_types,type_name,'no type')" /><br />
243    </span>
244  <tal:block
245  content="structure string:<form action='${formaction}' method='post'
246  enctype='multipart/form-data' class='workflow'>
247  <div class=''><div class='documentFields'>" />
248  <input type="hidden" name="type_name" value="."
249    tal:condition="creation" tal:attributes="value request/type_name" />
250</tal:block>
251
252<table width="100%" cellpadding="2" cellspacing="2" summary="Form layout">
253  <tr tal:repeat="row layout/rows" valign="top">
254    <td tal:repeat="cell row"
255      tal:attributes="colspan cell/ncols">
256      <tal:block define="widget cell/widget;
257                         wid widget/getWidgetId;
258                         dm options/datastructure/getDataModel;
259                         err python:ds.getError(wid);
260                         err_mapping python:ds.getErrorMapping(wid);
261                         is_required widget/is_required|nothing;
262                         tooltip_id python:wid + '_help';
263                         widget_css_class cell/widget_css_class|nothing;
264                         widget_css_class python:test(is_flexible, 'group', widget_css_class);
265                         css_class python:test(err, 'row error',
266                                               test(is_flexible, 'group', 'row'))">
267        <div tal:attributes="class widget_css_class;
268                             id python:widget.getHtmlWidgetId()+'_widget';
269                            ">
270          <div class="label" tal:condition="widget/label_edit"
271            tal:attributes="class python:test(is_required, 'label required',
272                                              'label')">
273            <label i18n:translate="" tal:condition="widget/is_i18n"
274              tal:content="widget/label_edit"
275              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
276            <label tal:condition="not:widget/is_i18n"
277              tal:content="widget/label_edit"
278              tal:attributes="for cell/widget_input_area_id|nothing;">label</label>
279          </div>
280          <button type="button" class="tooltipControl"
281                  tal:condition="widget/help"
282                  tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button>
283          <div class="field">
284            <div tal:replace="structure cell/widget_rendered"/>
285          </div>
286          <div class="tooltipArea" style="visibility: hidden;"
287               tal:condition="widget/help"
288               tal:attributes="id tooltip_id;
289                               onclick python:'showElement(false, \'%s\')' % tooltip_id;">
290            <tal:block i18n:translate="" tal:condition="widget/is_i18n"
291              tal:content="widget/help">i18_key-help_for_this_field</tal:block>
292            <tal:block tal:condition="not:widget/is_i18n"
293              tal:content="widget/help">This is the help for this field</tal:block>
294          </div>
295          <tal:block condition="err">
296              <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)">
297                <br /><em style="color: red"
298                  tal:content="msg">err</em>
299              </tal:block>
300          </tal:block>
301          <div style="float: right;" tal:condition="is_flexible">
302            <input type="submit" value="button_move_up"
303              tal:condition="not:repeat/row/start"
304              tal:attributes="name string:uprow_${repeat/row/index}"
305              class="context moveUp" i18n:attributes="value" />
306            <input type="submit" value="button_move_down"
307              tal:condition="not:repeat/row/end"
308              tal:attributes="name string:downrow_${repeat/row/index}"
309              class="context moveDown" i18n:attributes="value" />
310            <input type="submit" value="button_delete"
311              class="destructive" i18n:attributes="value"
312              tal:attributes="name string:deleterow_${repeat/row/index};
313                              onclick python:'return window.confirm(\'%s\')' %
314                                (cpsmcat('description_confirm_delete'), )" />
315          </div>
316        </div>
317      </tal:block>
318    </td>
319  </tr>
320</table>
321
322<tal:block condition="is_flexible">
323<div style="float: right;"
324    tal:define="flexible_widgets options/flexible_widgets">
325  <input type="hidden" name="layout_id" value="."
326    tal:attributes="value layout/layout_id" />
327  <tal:select condition="python:len(flexible_widgets)>1">
328    <select name="widget_type">
329      <tal:block repeat="widget options/flexible_widgets">
330      <option value="."
331        tal:condition="widget/is_i18n"
332        i18n:translate=""
333        tal:attributes="value widget/getWidgetId"
334        tal:content="widget/title_or_id">Type</option>
335      <option value="."
336        tal:condition="not:widget/is_i18n"
337        tal:attributes="value widget/getWidgetId"
338        tal:content="widget/title_or_id">Type</option>
339      </tal:block>
340    </select>
341    <input type="submit" name="addwidget_button" value="button_add"
342     class="context"
343     i18n:attributes="value" />
344  </tal:select>
345  <tal:button condition="python:len(flexible_widgets) == 1">
346    <tal:block define="widget python:flexible_widgets[0]">
347      <input type="hidden" name="widget_type"
348        tal:attributes="value widget/getWidgetId">
349      <input type="submit" name="addwidget_button"
350        tal:define="button_add python:cpsmcat('button_add');
351          widget_title python:cpsmcat(widget.title_or_id())"
352        tal:attributes="value string:${button_add} ${widget_title}"
353        class="context" />
354    </tal:block>
355  </tal:button>
356</div>
357</tal:block>
358
359<tal:block condition="last_layout">
360  <tal:block content="structure string:</div>" />
361  <metal:block define-slot="additional_content" />
362
363  <input type="submit" class="standalone" name="cpsdocument_edit_button"
364    value="button_change" i18n:attributes="value"
365    tal:condition="not:creation" />
366  <input type="submit" class="standalone" name="cpsdocument_create_button"
367    value="button_create" i18n:attributes="value" tal:condition="creation" />
368  <tal:block content="structure string:</div></form>" />
369</tal:block>
370
371</metal:block>
372   
Note: See TracBrowser for help on using the repository browser.