forked from smcmahon/Products.PloneFormGen
/
fg_edit_macros_p3.pt
253 lines (223 loc) · 10.6 KB
/
fg_edit_macros_p3.pt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<html xmlns="http://www.w3.org/1999/xhtml"
xml:lang="en"
lang="en"
xmlns:tal="http://xml.zope.org/namespaces/tal"
xmlns:metal="http://xml.zope.org/namespaces/metal"
xmlns:i18n="http://xml.zope.org/namespaces/i18n"
i18n:domain="plone">
<head><title></title></head>
<body>
<div metal:define-macro="header">
<metal:block define-slot="title">
<h1 i18n:translate="heading_add_item" class="documentFirstHeading"
tal:condition="python:context.checkCreationFlag()">
Add
<span i18n:name="itemtype"
tal:define="fti python:here.portal_types.getTypeInfo(here)">
<span i18n:translate=""
tal:content="fti/title_or_id"
tal:omit-tag="">Item type</span>
</span>
</h1>
<h1 i18n:translate="heading_edit_item" class="documentFirstHeading"
tal:condition="python: not context.checkCreationFlag()">
Edit
<span i18n:name="itemtype"
tal:define="fti python:here.portal_types.getTypeInfo(here)">
<span i18n:translate=""
tal:content="fti/title_or_id"
tal:omit-tag="">Item type</span>
</span>
</h1>
<dl class="portalMessage info"
tal:condition="here/@@plone/isDefaultPageInFolder">
<dt i18n:translate="">
Info
</dt>
<dd i18n:translate="label_edit_default_view_container">
You are editing the default view of a container. If you wanted to edit the container itself,
<a href=""
i18n:name="go_here"
i18n:translate="label_edit_default_view_container_go_here"
tal:attributes="href python:'/'.join(here.aq_inner.aq_parent.getPhysicalPath()) + '/edit'">go here</a>.
</dd>
</dl>
</metal:block>
<div id="archetypes-schemata-links"
tal:condition="python: fieldsets and not allow_tabbing">
<tal:block repeat="set fieldsets">
<tal:current condition="python:set == fieldset and fieldsets != ['default']">
<strong>[<span tal:content="set" i18n:translate="" />]</strong>
</tal:current>
<tal:others condition="python:set != fieldset">
<a href="#" tal:attributes="href string:${here/absolute_url}/${template/getId}?fieldset=${set}">
[<span tal:content="set" i18n:translate="" />]</a>
</tal:others>
</tal:block>
</div>
<metal:block define-slot="extra_info" />
</div>
<div metal:define-macro="typedescription">
<tal:description tal:define="fti python:here.portal_types.getTypeInfo(here);
desc fti/Description;"
tal:condition="desc">
<p class="discreet" i18n:translate="" tal:content="desc">
type description
</p>
</tal:description>
</div>
<div metal:define-macro="body" class="pfg-form"
tal:attributes="class string:pfg-form formid-${here/getId}">
<form name="edit_form"
method="post"
enctype="multipart/form-data"
class="enableUnloadProtection enableAutoFocus atBaseEditForm fgBaseEditForm"
action=""
id=""
tal:define="enable_unload_protection enable_unload_protection|python:True;
enable_auto_focus enable_auto_focus|python:True;"
tal:attributes="action here/fgGetFormSubmitAction;
id string:fg-base-edit;
class python:'fgBaseEditForm '+ test(enable_unload_protection, 'enableUnloadProtection', '') + test(enable_auto_focus, ' enableAutoFocus', '') + test(path('allow_tabbing|nothing'), 'enableFormTabbing', '');">
<metal:block define-slot="extra_top" />
<div tal:replace="structure provider:archetypes.edit.beforefieldsets|nothing"
tal:on-error="nothing" />
<metal:block define-slot="widgets">
<div id="pfg-fieldwrapper">
<tal:fields repeat="field fields">
<tal:block tal:condition="python:field.widget.macro != 'widget_richlabel'">
<tal:block tal:condition="python:field.widget.visible != -1">
<metal:fieldMacro use-macro="python:here.widget(field.getName(), mode='edit', field=field)" />
</tal:block>
<tal:block tal:condition="python:field.widget.visible == -1">
<div tal:attributes="id string:archetypes-fieldname-${field/getName}" class="field pfgHidden">
<metal:fieldMacro use-macro="python:here.widget(field.getName(), mode='edit', field=field)" />
</div>
</tal:block>
</tal:block>
<div tal:condition="python:field.widget.macro == 'widget_richlabel'"
tal:attributes="id string:archetypes-fieldname-${field/getName}"
class="field PFG-RichLabel"
tal:content="structure python:request.form.get(field.getName(), field.default)">
Rich Label
</div>
</tal:fields>
</div>
</metal:block>
<div tal:replace="structure provider:archetypes.edit.afterfieldsets"
tal:on-error="nothing" />
<metal:block define-slot="extra_bottom" />
<div class="formControls">
<input type="hidden"
name="fieldset"
value="default"
tal:attributes="value fieldset"
/>
<input type="hidden"
name="form.submitted"
value="1"
tal:define="form_submit_marker python:request.form.get('pfg_form_marker', 'form.submitted')"
tal:attributes="name form_submit_marker"
/>
<input type="hidden"
name="add_reference.field:record"
value=""
/>
<input type="hidden"
name="add_reference.type:record"
value=""
/>
<input type="hidden"
name="add_reference.destination:record"
value=""
/>
<tal:env define="env request/controller_state/kwargs">
<tal:loop repeat="varname python:('reference_source_url', 'reference_source_field', 'reference_source_fieldset')">
<tal:reference define="items python:env.get(varname, request.get(varname))"
condition="items">
<input tal:repeat="item items"
type="hidden"
name="form_env.reference_source_url:list:record"
value="value"
tal:attributes="value item;
name string:form_env.${varname}:list:record"
/>
</tal:reference>
</tal:loop>
</tal:env>
<tal:comment replace="nothing">
Turn 'persistent_' variables from controller_state persistent
</tal:comment>
<tal:env repeat="env request/controller_state/kwargs/items">
<input type="hidden"
name="key"
value="value"
tal:define="key python:env[0];
value python:env[1]"
tal:condition="python:key.startswith('persistent_')"
tal:attributes="name string:form_env.${key}:record;
value value"
/>
</tal:env>
<tal:comment replace="nothing">
Turn 'persistent_' variables from forms (GET/POST) persistent
</tal:comment>
<tal:env repeat="env request/form">
<input type="hidden"
name="key"
value="value"
tal:define="key env;
value request/?env"
tal:condition="python:key.startswith('persistent_')"
tal:attributes="name string:form_env.${key}:record;
value value"
/>
</tal:env>
<tal:comment replace="nothing">
Store referrer to remember where to go back
</tal:comment>
<input type="hidden"
name="last_referer"
tal:define="last_referer python:here.session_restore_value('HTTP_REFERER', request.form.get('last_referer', request.get('HTTP_REFERER')))"
tal:attributes="value python:(last_referer and '%s/%s' % (here.absolute_url(), template.id) not in last_referer) and last_referer or (here.getParentNode() and here.getParentNode().absolute_url())"
/>
<input tal:replace="structure context/@@authenticator/authenticator">
<metal:block define-slot="buttons"
tal:define="fieldset_index python:fieldsets.index(fieldset);
n_fieldsets python:len(fieldsets)">
<input tal:condition="python:fieldset_index > 0"
class="context"
type="submit"
name="form_previous"
value="Previous"
i18n:attributes="value label_previous;"
/>
<input tal:condition="python:fieldset_index < n_fieldsets - 1"
class="context"
type="submit"
name="form_next"
value="Next"
i18n:attributes="value label_next;"
/>
<input class="context"
type="submit"
name="form_submit"
value="Save"
tal:attributes="value python:getattr(here,'submitLabel','Submit')"
/>
<input class="standalone"
type="reset"
name="form.button.cancel"
value="Cancel"
tal:condition="python: getattr(here,'useCancelButton',True)"
tal:attributes="value python:getattr(here,'resetLabel','Reset'); tabindex tabindex/next|nothing"
/>
</metal:block>
<metal:block define-slot="extra_buttons" />
</div>
</form>
</div>
<metal:footer_macro define-macro="footer">
</metal:footer_macro>
</body>
</html>