1
|
|
|
# -*- coding: utf-8 -*- |
2
|
|
|
# |
3
|
|
|
# This file is part of SENAITE.CORE. |
4
|
|
|
# |
5
|
|
|
# SENAITE.CORE is free software: you can redistribute it and/or modify it under |
6
|
|
|
# the terms of the GNU General Public License as published by the Free Software |
7
|
|
|
# Foundation, version 2. |
8
|
|
|
# |
9
|
|
|
# This program is distributed in the hope that it will be useful, but WITHOUT |
10
|
|
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
11
|
|
|
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
12
|
|
|
# details. |
13
|
|
|
# |
14
|
|
|
# You should have received a copy of the GNU General Public License along with |
15
|
|
|
# this program; if not, write to the Free Software Foundation, Inc., 51 |
16
|
|
|
# Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
17
|
|
|
# |
18
|
|
|
# Copyright 2018-2024 by it's authors. |
19
|
|
|
# Some rights reserved, see README and LICENSE. |
20
|
|
|
|
21
|
|
|
from plone.app.z3cform.interfaces import IPloneFormLayer |
22
|
|
|
from plone.protect.interfaces import IDisableCSRFProtection |
23
|
|
|
from senaite.core.interfaces.catalog import * # noqa:F401,F403 |
24
|
|
|
from senaite.core.interfaces.datamanager import IDataManager # noqa:F401 |
25
|
|
|
from senaite.core.interfaces.widget import * # noqa:F401,F403 |
26
|
|
|
from zope.interface import Interface |
27
|
|
|
|
28
|
|
|
|
29
|
|
|
class ISenaiteCore(IDisableCSRFProtection): |
30
|
|
|
"""Marker interface that defines a Zope 3 browser layer. |
31
|
|
|
|
32
|
|
|
NOTE: We disable CSRF protection site-wide. |
33
|
|
|
""" |
34
|
|
|
|
35
|
|
|
|
36
|
|
|
class ISenaiteFormLayer(IPloneFormLayer): |
37
|
|
|
"""Used to override plone.app.z3cform forms |
38
|
|
|
|
39
|
|
|
Inherits from `z3c.form.interfaces.IFormLayer` |
40
|
|
|
""" |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
class IShowDisplayMenu(Interface): |
44
|
|
|
"""Marker interface that can be applied for contents that should display |
45
|
|
|
the "Display" menu |
46
|
|
|
""" |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
class IShowFactoriesMenu(Interface): |
50
|
|
|
"""Marker interface that can be applied for contents that should display |
51
|
|
|
the "Add" menu |
52
|
|
|
""" |
53
|
|
|
|
54
|
|
|
|
55
|
|
|
class IHideActionsMenu(Interface): |
56
|
|
|
"""Marker interface that can be applied for contents that should not |
57
|
|
|
display the content actions menu |
58
|
|
|
""" |
59
|
|
|
|
60
|
|
|
|
61
|
|
|
class IAjaxEditForm(Interface): |
62
|
|
|
"""Ajax edit form adapter |
63
|
|
|
""" |
64
|
|
|
|
65
|
|
|
def initialized(data): |
66
|
|
|
"""Called once after the edit form was rendered |
67
|
|
|
|
68
|
|
|
:param data: JSON payload of the edit form. |
69
|
|
|
Contains at least `form`, `name`, `value` |
70
|
|
|
:returns: A dictionary with update instructions for the frontend logic |
71
|
|
|
""" |
72
|
|
|
|
73
|
|
|
def modified(data): |
74
|
|
|
"""Called for each field modification |
75
|
|
|
|
76
|
|
|
:param data: JSON payload of the edit form. |
77
|
|
|
Contains at least `form`, `name`, `value` |
78
|
|
|
:returns: A dictionary with update instructions for the frontend logic |
79
|
|
|
""" |
80
|
|
|
|
81
|
|
|
|
82
|
|
|
class IMultiCatalogBehavior(Interface): |
83
|
|
|
"""Support multiple catalogs for Dexterity contents |
84
|
|
|
""" |
85
|
|
|
|
86
|
|
|
|
87
|
|
|
class IAutoGenerateID(Interface): |
88
|
|
|
"""Auto-generate ID with ID server |
89
|
|
|
""" |
90
|
|
|
|
91
|
|
|
|
92
|
|
|
class IIdServer(Interface): |
93
|
|
|
"""Marker Interface for ID server |
94
|
|
|
""" |
95
|
|
|
|
96
|
|
|
def generate_id(self, portal_type, batch_size=None): |
97
|
|
|
"""Generate a new id for 'portal_type' |
98
|
|
|
""" |
99
|
|
|
|
100
|
|
|
|
101
|
|
|
class IIdServerVariables(Interface): |
102
|
|
|
"""Marker interfaces for variables generator for ID Server |
103
|
|
|
""" |
104
|
|
|
|
105
|
|
|
def get_variables(self, **kw): |
106
|
|
|
"""Returns a dict with variables |
107
|
|
|
""" |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
class IIdServerTypeID(Interface): |
111
|
|
|
"""Marker interface for type id resolution for ID Server |
112
|
|
|
""" |
113
|
|
|
|
114
|
|
|
def get_type_id(self, **kw): |
115
|
|
|
"""Returns the type id for the context passed in the constructor, that |
116
|
|
|
is used for custom ID formatting, regardless of the real portal type of |
117
|
|
|
the context. Return None if no type id can be resolved by this adapter |
118
|
|
|
""" |
119
|
|
|
|
120
|
|
|
|
121
|
|
|
class INumberGenerator(Interface): |
122
|
|
|
"""A utility to generates unique numbers by key |
123
|
|
|
""" |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
class IContainer(Interface): |
127
|
|
|
"""SENAITE Base Container |
128
|
|
|
""" |
129
|
|
|
|
130
|
|
|
|
131
|
|
|
class IItem(Interface): |
132
|
|
|
"""SENAITE Base Item |
133
|
|
|
""" |
134
|
|
|
|
135
|
|
|
|
136
|
|
|
class ITemporaryObject(Interface): |
137
|
|
|
"""Marker interface for temporary objects |
138
|
|
|
|
139
|
|
|
This is similar to the `creationFlag`, but skips indexing for any object |
140
|
|
|
that implements this interface. |
141
|
|
|
|
142
|
|
|
Also see: `senaite.core.patches.catalog.catlog_object` |
143
|
|
|
""" |
144
|
|
|
|
145
|
|
|
|
146
|
|
|
class ISetup(Interface): |
147
|
|
|
"""Marker interface for setup folder |
148
|
|
|
""" |
149
|
|
|
|
150
|
|
|
|
151
|
|
|
class ISamples(Interface): |
152
|
|
|
"""Marker interface for samples main folder |
153
|
|
|
""" |
154
|
|
|
|
155
|
|
|
|
156
|
|
|
class ISamplesView(Interface): |
157
|
|
|
"""Marker interface for samples listing view |
158
|
|
|
""" |
159
|
|
|
|
160
|
|
|
|
161
|
|
|
class IHaveUIDReferences(Interface): |
162
|
|
|
"""Marker interface when the object contains UID references |
163
|
|
|
""" |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
class IAnalysisProfile(Interface): |
167
|
|
|
"""Marker interface for analysis profiles |
168
|
|
|
""" |
169
|
|
|
|
170
|
|
|
|
171
|
|
|
class IAnalysisProfiles(Interface): |
172
|
|
|
"""Marker interface for analysis profiles setup folder |
173
|
|
|
""" |
174
|
|
|
|
175
|
|
|
|
176
|
|
|
class ISampleContainers(Interface): |
177
|
|
|
"""Marker interface for sample container setup folder |
178
|
|
|
""" |
179
|
|
|
|
180
|
|
|
|
181
|
|
|
class ISampleContainer(Interface): |
182
|
|
|
"""Marker interface for sample containers |
183
|
|
|
""" |
184
|
|
|
|
185
|
|
|
|
186
|
|
|
class IDepartments(Interface): |
187
|
|
|
"""Marker interface for departments setup folder |
188
|
|
|
""" |
189
|
|
|
|
190
|
|
|
|
191
|
|
|
class IDepartment(Interface): |
192
|
|
|
"""Marker interface for departments |
193
|
|
|
""" |
194
|
|
|
|
195
|
|
|
|
196
|
|
|
class ISampleConditions(Interface): |
197
|
|
|
"""Marker interface for sample conditions setup folder |
198
|
|
|
""" |
199
|
|
|
|
200
|
|
|
|
201
|
|
|
class ISampleCondition(Interface): |
202
|
|
|
"""Marker interface for sample conditions |
203
|
|
|
""" |
204
|
|
|
|
205
|
|
|
|
206
|
|
|
class ISamplePreservations(Interface): |
207
|
|
|
"""Marker interface for preservations setup folder |
208
|
|
|
""" |
209
|
|
|
|
210
|
|
|
|
211
|
|
|
class ISamplePreservation(Interface): |
212
|
|
|
"""Marker interface for preservations |
213
|
|
|
""" |
214
|
|
|
|
215
|
|
|
|
216
|
|
|
class IContentMigrator(Interface): |
217
|
|
|
"""Marker interface for content migrator |
218
|
|
|
""" |
219
|
|
|
|
220
|
|
|
|
221
|
|
|
class IFieldMigrator(Interface): |
222
|
|
|
"""Marker interface for field migrator |
223
|
|
|
""" |
224
|
|
|
|
225
|
|
|
|
226
|
|
|
class IDynamicLocalRoles(Interface): |
227
|
|
|
"""Marker interface for objects with dynamic assignment of local roles |
228
|
|
|
""" |
229
|
|
|
|
230
|
|
|
|
231
|
|
|
class IInterpretationTemplate(Interface): |
232
|
|
|
"""Marker interface for interpretation template objects |
233
|
|
|
""" |
234
|
|
|
|
235
|
|
|
|
236
|
|
|
class ILabels(Interface): |
237
|
|
|
"""Marker interface for labels container |
238
|
|
|
""" |
239
|
|
|
|
240
|
|
|
|
241
|
|
|
class ILabel(Interface): |
242
|
|
|
"""Marker interface for labels |
243
|
|
|
""" |
244
|
|
|
|
245
|
|
|
|
246
|
|
|
class ICanHaveLabels(Interface): |
247
|
|
|
"""Marker interface for labeled capable objects |
248
|
|
|
""" |
249
|
|
|
|
250
|
|
|
|
251
|
|
|
class IHaveLabels(ICanHaveLabels): |
252
|
|
|
"""Marker interface for labeled objects |
253
|
|
|
|
254
|
|
|
NOTE: We inherit from `ICanHaveLabels` to always show the schema extended |
255
|
|
|
fields for already labeled objects |
256
|
|
|
""" |
257
|
|
|
|
258
|
|
|
|
259
|
|
|
class IASTMImporter(Interface): |
260
|
|
|
"""Marker interface for ASTM Wrappers |
261
|
|
|
""" |
262
|
|
|
|
263
|
|
|
def import_data(data): |
264
|
|
|
"""Import the processed JSON data from the wrapper |
265
|
|
|
""" |
266
|
|
|
|
267
|
|
|
|
268
|
|
|
class IClientAwareMixin(Interface): |
269
|
|
|
"""Marker interface for objects that can be bound to a Client, either |
270
|
|
|
because they can be added inside a Client folder or because it can be |
271
|
|
|
assigned through a Reference field |
272
|
|
|
""" |
273
|
|
|
|
274
|
|
|
def getClient(self): |
275
|
|
|
"""Returns the client this object is bound to, if any |
276
|
|
|
""" |
277
|
|
|
|
278
|
|
|
def getClientUID(self): |
279
|
|
|
"""Returns the client UID this object is bound to, if any |
280
|
|
|
""" |
281
|
|
|
|