1 | <!-- a layout_lib macro --> |
---|
2 | <!-- $Id: layout_waeup_edit.pt 686 2006-10-13 11:27:44Z joachim $ --> |
---|
3 | <metal:block define-macro="default_edit" |
---|
4 | tal:define="layout options/layout; |
---|
5 | ds options/datastructure; |
---|
6 | dm ds/getDataModel; |
---|
7 | creation creation|nothing; |
---|
8 | metadata metadata|nothing; |
---|
9 | type_name request/type_name|nothing; |
---|
10 | ti python:type_name and getattr(here.portal_types,type_name,None) or getattr(here.portal_types,here.portal_type,None); |
---|
11 | creation_form python:ti and ti.getActionById('create', 'cpsdocument_create_form') or 'cpsdocument_create_form' ; |
---|
12 | edit_form python:ti and ti.getActionById('edit', 'cpsdocument_edit_form') or 'cpsdocument_edit_form'; |
---|
13 | metadata_form python:ti and ti.getActionById('metadata', 'cpsdocument_metadata') or 'cpsdocument_metadata'; |
---|
14 | formaction formaction|python: test(creation, creation_form, |
---|
15 | test(metadata, metadata_form, |
---|
16 | edit_form)); |
---|
17 | first_layout options/first_layout|python:0; |
---|
18 | last_layout options/last_layout|python:0; |
---|
19 | is_flexible options/is_flexible; |
---|
20 | cpsmcat nocall:here/translation_service; |
---|
21 | "> |
---|
22 | <tal:block condition="python:first_layout"> |
---|
23 | <tal:block |
---|
24 | content="structure string:<form id='editForm' action='${formaction}' method='post' |
---|
25 | enctype='multipart/form-data' class='workflow'> |
---|
26 | <div class='group'><div class='documentFields'>" /> |
---|
27 | <input type="hidden" name="type_name" value="." |
---|
28 | tal:condition="creation" tal:attributes="value request/type_name" /> |
---|
29 | </tal:block> |
---|
30 | |
---|
31 | <table cellpadding="2" cellspacing="2" summary="Form layout" |
---|
32 | tal:condition="layout/rows"> |
---|
33 | <tr tal:repeat="row layout/rows" valign="top"> |
---|
34 | <td tal:repeat="cell row" |
---|
35 | tal:attributes="colspan cell/ncols"> |
---|
36 | <tal:block define="widget cell/widget; |
---|
37 | wid widget/getWidgetId; |
---|
38 | err python:ds.getError(wid); |
---|
39 | err_mapping python:ds.getErrorMapping(wid); |
---|
40 | is_required widget/is_required|nothing; |
---|
41 | tooltip_id python:wid + '_help'; |
---|
42 | widget_css_class cell/widget_css_class|nothing; |
---|
43 | widget_css_class python:test(is_flexible, 'group', widget_css_class); |
---|
44 | css_class python:test(err, 'row error', |
---|
45 | test(is_flexible, 'group', 'row'))"> |
---|
46 | <div tal:attributes="class widget_css_class; |
---|
47 | id python:widget.getHtmlWidgetId()+'_widget'; |
---|
48 | "> |
---|
49 | <div class="label" tal:condition="widget/label_edit" |
---|
50 | tal:attributes="class python:test(is_required, 'label required', |
---|
51 | 'label')"> |
---|
52 | <label i18n:translate="" tal:condition="widget/is_i18n" |
---|
53 | tal:content="widget/label_edit" |
---|
54 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
---|
55 | <label tal:condition="not:widget/is_i18n" |
---|
56 | tal:content="widget/label_edit" |
---|
57 | tal:attributes="for cell/widget_input_area_id|nothing;">label</label> |
---|
58 | |
---|
59 | <button type="button" class="tooltipControl" |
---|
60 | tal:condition="widget/help" |
---|
61 | tal:attributes="onclick python:'toggleElementVisibility(\'%s\')' % tooltip_id;"> ? </button> |
---|
62 | </div> |
---|
63 | <div class="field"> |
---|
64 | <div tal:replace="structure cell/widget_rendered"/> |
---|
65 | </div> |
---|
66 | <div class="tooltipArea" style="visibility: hidden;" |
---|
67 | tal:condition="widget/help" |
---|
68 | tal:attributes="id tooltip_id; |
---|
69 | onclick python:'showElement(false, \'%s\')' % tooltip_id;"> |
---|
70 | <tal:block i18n:translate="" tal:condition="widget/is_i18n" |
---|
71 | tal:content="widget/help">i18_key-help_for_this_field</tal:block> |
---|
72 | <tal:block tal:condition="not:widget/is_i18n" |
---|
73 | tal:content="widget/help">This is the help for this field</tal:block> |
---|
74 | </div> |
---|
75 | <tal:block condition="err"> |
---|
76 | <tal:block define="msg python:cpsmcat(err, mapping=err_mapping)"> |
---|
77 | <br /><em style="color: red" |
---|
78 | tal:content="msg">err</em> |
---|
79 | </tal:block> |
---|
80 | </tal:block> |
---|
81 | <div style="float: right;" tal:condition="is_flexible"> |
---|
82 | <input type="button" value="button_move_up" |
---|
83 | tal:condition="not:repeat/row/start" |
---|
84 | tal:attributes="name string:uprow_${repeat/row/index}; |
---|
85 | onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'" |
---|
86 | class="context moveUp" i18n:attributes="value" /> |
---|
87 | <input type="button" value="button_move_down" |
---|
88 | tal:condition="not:repeat/row/end" |
---|
89 | tal:attributes="name string:downrow_${repeat/row/index}; |
---|
90 | onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'" |
---|
91 | class="context moveDown" i18n:attributes="value" /> |
---|
92 | <input type="button" value="button_delete" |
---|
93 | class="destructive" i18n:attributes="value" |
---|
94 | tal:attributes="name string:deleterow_${repeat/row/index}; |
---|
95 | onclick python:'CPSFlexibleEdit.buttonClick(this, \'%s\')' % |
---|
96 | (cpsmcat('description_confirm_delete'), )" /> |
---|
97 | </div> |
---|
98 | </div> |
---|
99 | </tal:block> |
---|
100 | </td> |
---|
101 | </tr> |
---|
102 | </table> |
---|
103 | |
---|
104 | <tal:block condition="is_flexible"> |
---|
105 | <div tal:define="flexible_widgets options/flexible_widgets"> |
---|
106 | <input type="hidden" name="layout_id" value="." |
---|
107 | tal:attributes="value layout/layout_id" /> |
---|
108 | <tal:select condition="python:len(flexible_widgets)>1"> |
---|
109 | <select name="widget_type"> |
---|
110 | <tal:block repeat="widget options/flexible_widgets"> |
---|
111 | <option value="." |
---|
112 | tal:condition="widget/is_i18n" |
---|
113 | i18n:translate="" |
---|
114 | tal:attributes="value widget/getWidgetId" |
---|
115 | tal:content="widget/title_or_id">Type</option> |
---|
116 | <option value="." |
---|
117 | tal:condition="not:widget/is_i18n" |
---|
118 | tal:attributes="value widget/getWidgetId" |
---|
119 | tal:content="widget/title_or_id">Type</option> |
---|
120 | </tal:block> |
---|
121 | </select> |
---|
122 | <input type="button" id="addwidget_button" |
---|
123 | name="addwidget_button" value="button_add" |
---|
124 | class="context" |
---|
125 | i18n:attributes="value" |
---|
126 | tal:attributes="onclick python:'CPSFlexibleEdit.buttonClick(this, \'\')'" /> |
---|
127 | </tal:select> |
---|
128 | <tal:button condition="python:len(flexible_widgets) == 1"> |
---|
129 | <tal:block define="widget python:flexible_widgets[0]"> |
---|
130 | <input type="hidden" name="widget_type" |
---|
131 | tal:attributes="value widget/getWidgetId"> |
---|
132 | <input type="submit" name="addwidget_button" |
---|
133 | id="addwidget_button" |
---|
134 | tal:define="button_add python:cpsmcat('button_add'); |
---|
135 | widget_title python:cpsmcat(widget.title_or_id())" |
---|
136 | tal:attributes="value string:${button_add} ${widget_title}" |
---|
137 | class="context" /> |
---|
138 | </tal:block> |
---|
139 | </tal:button> |
---|
140 | </div> |
---|
141 | </tal:block> |
---|
142 | |
---|
143 | <tal:block condition="python: last_layout"> |
---|
144 | <tal:block content="structure string:</div>" /> |
---|
145 | <metal:block define-slot="additional_content" /> |
---|
146 | |
---|
147 | <tal:block condition="not:creation"> |
---|
148 | <div class="tooltipArea" style="visibility: hidden;" |
---|
149 | id="transition_comments_help" |
---|
150 | onclick="showElement(false, 'transition_comments_help')" |
---|
151 | i18n:translate="help_transition_comments_modification"> |
---|
152 | In this filed you can give the reason of the modification that you are doing on this document. |
---|
153 | Your comments may be used to notify other users. |
---|
154 | </div> |
---|
155 | <dl> |
---|
156 | <dt><label for="comments" |
---|
157 | i18n:translate="transition_comments_modification">Reason of the modification</label> |
---|
158 | <button type="button" class="tooltipControl" |
---|
159 | onclick="toggleElementVisibility('transition_comments_help')"> ? </button> |
---|
160 | </dt> |
---|
161 | <dd> |
---|
162 | <textarea name="comments" id="comments" cols="60" rows="3" |
---|
163 | tal:content="nothing"> |
---|
164 | </textarea> |
---|
165 | </dd> |
---|
166 | </dl> |
---|
167 | </tal:block> |
---|
168 | <input type="submit" class="standalone" name="cpsdocument_edit_button" |
---|
169 | value="button_change" i18n:attributes="value" id="cpsdocument_edit_button" |
---|
170 | tal:condition="not:creation" /> |
---|
171 | <input type="submit" class="standalone" name="cpsdocument_edit_and_view_button" |
---|
172 | value="button_change_and_view" i18n:attributes="value" |
---|
173 | id="cpsdocument_edit_and_view_button" |
---|
174 | tal:condition="not:creation" /> |
---|
175 | <input type="submit" class="standalone" name="cpsdocument_create_button" |
---|
176 | value="button_create" i18n:attributes="value" tal:condition="creation" /> |
---|
177 | <tal:block content="structure string:</div></form>" /> |
---|
178 | </tal:block> |
---|
179 | |
---|
180 | </metal:block> |
---|