/
field.pt
150 lines (141 loc) · 7.02 KB
/
field.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
<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>
<!-- Base Field Widgets -->
<metal:base_view_macro
define-macro="base_view"
tal:define="widget_view python:context.widget(field.getName(), mode=mode, use_label=1);
field_macros context/widgets/field/macros;
label_macro view_macros/label | label_macro | field_macros/label;
data_macro view_macros/data | data_macro | field_macros/data;
visState python:widget.isVisible(here, mode);
portal python:context.portal_url.getPortalObject();
visCondition python:field.widget.testCondition(context.aq_inner.getParentNode(), portal, context);">
<tal:condition
condition="python:visState == 'visible' and visCondition">
<tal:if_perm
condition="python:'view' in widget.modes and 'r' in field.mode and field.checkPermission('r',here)">
<tal:if_use_label condition="use_label | nothing">
<metal:use_label use-macro="label_macro" />
</tal:if_use_label>
<metal:use_data use-macro="data_macro|default" />
</tal:if_perm>
</tal:condition>
</metal:base_view_macro>
<metal:label_macro define-macro="label">
<label class="formQuestion"><span i18n:translate="" tal:content="python:widget.Label(here)">Field</span>:</label>
<span tal:condition="field/workflowable | nothing"
tal:omit-tag="">
(
<a href="#"
tal:define="wf_tool context/portal_workflow;
obj python:accessor();
review_state python:wf_tool.getInfoFor(obj, 'review_state', '')"
tal:attributes="href string:${obj/absolute_url}/content_status_history;
class python:test(review_state, review_state, 'private')"
tal:content="review_state">
review_state
</a>
)
</span>
<br />
</metal:label_macro>
<metal:data_macro define-macro="data">
<metal:block use-macro="widget_view" />
</metal:data_macro>
<div metal:define-macro="view" tal:define="fieldName fieldName|field/getName;
fieldtypename python:field.getType().split('.')[-1];"
tal:attributes="class string:field ArchetypesField-${fieldtypename};
id string:archetypes-fieldname-${fieldName}-${UID}">
<metal:use_base_view use-macro="context/widgets/field/macros/base_view" />
</div>
<metal:define
define-macro="edit"
tal:define="visState python:widget.isVisible(here, mode);
edit_accessor python:field.getEditAccessor(here);
getMethod python:(widget.populate and (edit_accessor or accessor)) or None;
value python:getMethod and getMethod();
value python:widget.postback and request.get(fieldName, value) or value;
portal python:context.portal_url.getPortalObject();
visCondition python:field.widget.testCondition(context.aq_inner.getParentNode(), portal, context);
error_id python:errors.get(fieldName)">
<tal:condition
condition="python:visState == 'visible' and visCondition">
<div class="field"
tal:define="kssClassesView context/@@kss_field_decorator_view;
getKssClasses nocall:kssClassesView/getKssClasses;
kss_class python:getKssClasses(fieldName);"
tal:condition="python:('edit' in widget.modes and 'w' in field.mode and field.checkPermission('w',here))
or (mode=='search' and field.checkPermission('r',here))"
tal:attributes="class python: test(error_id, 'field error ' + 'Archetypes' + widget.getName(), 'field ' + 'Archetypes' + widget.getName()) + ' ' + kss_class;
id python: 'archetypes-fieldname-' + fieldName">
<span metal:define-slot="widget_body_label_prefix"></span>
<tal:comment tal:condition="nothing">
Label insertion for the selection and multi-selection widgets is deferred to the widget, as they must
consider their format (checkbox, radio, select box ...) to correctly format the label to meet
accessibility standards.
</tal:comment>
<tal:ifLabel tal:condition="not: widget/render_own_label | nothing">
<label class="formQuestion"
tal:attributes="for python:fieldName">
<span tal:replace="python:widget.Label(here)"
i18n:translate="" />
<span class="required"
tal:condition="field/required"
title="Required"
i18n:attributes="title title_required;"
style="color: #f00;">
■
</span>
</label>
<div class="formHelp"
tal:define="description python:widget.Description(here)"
tal:content="structure description"
tal:attributes="id string:${fieldName}_help"
i18n:translate="">
Help
</div>
</tal:ifLabel>
<span tal:condition="field/workflowable | nothing"
tal:omit-tag="">
State:
<a href="#"
tal:define="wf_tool context/portal_workflow;
obj python:accessor();
review_state python:wf_tool.getInfoFor(obj, 'review_state', '')"
tal:attributes="href string:${obj/absolute_url}/content_status_history;
class python:test(review_state, review_state, 'private')"
tal:content="review_state">
review_state
</a>
</span>
<div class="fieldErrorBox"
tal:content="error_id" i18n:translate="">Validation Error</div>
<div metal:define-slot="widget_body"></div>
</div>
</tal:condition>
<tal:condition condition="python: visState == 'hidden'">
<metal:hiddenmacro
tal:define="widget_macro python:path('context/%s/macros' % widget.macro);
default_hidden_macro context/widgets/field/macros/hidden;
hidden_macro widget_macro/hidden | default_hidden_macro;
">
<metal:use use-macro="hidden_macro" />
</metal:hiddenmacro>
</tal:condition>
</metal:define>
<metal:hidden_macro define-macro="hidden">
<input type="hidden"
name=""
value=""
tal:attributes="name fieldName;
value value;" />
</metal:hidden_macro>
</body>
</html>