source: waeup_product/trunk/skins/waeup_default/waeup_layout_lib.pt @ 125

Last change on this file since 125 was 96, checked in by joachim, 19 years ago

=adding and editing of several types

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