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