Commit 052ceb23 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[ui] Move format identification fields of binary data object to their own tab

Related to #11447483
parent fd6650f6c48c
......@@ -1108,10 +1108,6 @@ msgstr ""
msgid "SEDAEncoding"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_encoding_from.object"
msgid "SEDAEncoding"
msgstr ""
msgid "SEDAEncodingCodeListVersion"
msgstr ""
......@@ -1194,20 +1190,12 @@ msgstr ""
msgid "SEDAFormatId"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_id_from.object"
msgid "SEDAFormatId"
msgstr ""
msgid "SEDAFormatId_plural"
msgstr ""
msgid "SEDAFormatLitteral"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_litteral.object"
msgid "SEDAFormatLitteral"
msgstr ""
msgid "SEDAFormatLitteral_plural"
msgstr ""
......@@ -1446,10 +1434,6 @@ msgstr ""
msgid "SEDAMimeType"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_mime_type_from.object"
msgid "SEDAMimeType"
msgstr ""
msgid "SEDAMimeTypeCodeListVersion"
msgstr ""
......@@ -3833,10 +3817,6 @@ msgstr ""
msgid "add a SEDAEncoding"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_encoding_from.object"
msgid "add a SEDAEncoding"
msgstr ""
msgid "add a SEDAEncodingCodeListVersion"
msgstr ""
......@@ -3892,14 +3872,6 @@ msgstr ""
msgid "add a SEDAFormatId"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_id_from.object"
msgid "add a SEDAFormatId"
msgstr ""
msgid "add a SEDAFormatLitteral"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_litteral.object"
msgid "add a SEDAFormatLitteral"
msgstr ""
......@@ -4069,10 +4041,6 @@ msgstr ""
msgid "add a SEDAMimeType"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_mime_type_from.object"
msgid "add a SEDAMimeType"
msgstr ""
msgid "add a SEDAMimeTypeCodeListVersion"
msgstr ""
......@@ -6408,6 +6376,9 @@ msgctxt "Agent"
msgid "seda_authorized_agent_to_object"
msgstr ""
msgid "seda_bdo_format_identification"
msgstr ""
msgid "seda_binary_data_object"
msgstr ""
......
......@@ -808,7 +808,7 @@ msgid "SEDAAuthorizedAgent_plural"
msgstr ""
msgid "SEDABinaryDataObject"
msgstr ""
msgstr "objet-données binaires"
msgid "SEDABinaryDataObject_plural"
msgstr "objets-données binaires"
......@@ -1111,10 +1111,6 @@ msgstr ""
msgid "SEDAEncoding"
msgstr "encodage"
msgctxt "inlined:SEDABinaryDataObject.seda_encoding_from.object"
msgid "SEDAEncoding"
msgstr ""
msgid "SEDAEncodingCodeListVersion"
msgstr ""
......@@ -1197,20 +1193,12 @@ msgstr ""
msgid "SEDAFormatId"
msgstr "type spécifique du format"
msgctxt "inlined:SEDABinaryDataObject.seda_format_id_from.object"
msgid "SEDAFormatId"
msgstr ""
msgid "SEDAFormatId_plural"
msgstr ""
msgid "SEDAFormatLitteral"
msgstr "forme littérale du nom du format"
msgctxt "inlined:SEDABinaryDataObject.seda_format_litteral.object"
msgid "SEDAFormatLitteral"
msgstr ""
msgid "SEDAFormatLitteral_plural"
msgstr ""
......@@ -1449,10 +1437,6 @@ msgstr ""
msgid "SEDAMimeType"
msgstr "type MIME"
msgctxt "inlined:SEDABinaryDataObject.seda_mime_type_from.object"
msgid "SEDAMimeType"
msgstr ""
msgid "SEDAMimeTypeCodeListVersion"
msgstr ""
......@@ -3836,10 +3820,6 @@ msgstr ""
msgid "add a SEDAEncoding"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_encoding_from.object"
msgid "add a SEDAEncoding"
msgstr ""
msgid "add a SEDAEncodingCodeListVersion"
msgstr ""
......@@ -3895,14 +3875,6 @@ msgstr ""
msgid "add a SEDAFormatId"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_id_from.object"
msgid "add a SEDAFormatId"
msgstr ""
msgid "add a SEDAFormatLitteral"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_format_litteral.object"
msgid "add a SEDAFormatLitteral"
msgstr ""
......@@ -4072,10 +4044,6 @@ msgstr ""
msgid "add a SEDAMimeType"
msgstr ""
msgctxt "inlined:SEDABinaryDataObject.seda_mime_type_from.object"
msgid "add a SEDAMimeType"
msgstr ""
msgid "add a SEDAMimeTypeCodeListVersion"
msgstr ""
......@@ -5647,7 +5615,7 @@ msgid "file_plan_position"
msgstr ""
msgid "format_litteral"
msgstr ""
msgstr "valeur"
msgctxt "SEDAFormatLitteral"
msgid "format_litteral"
......@@ -6411,6 +6379,9 @@ msgctxt "Agent"
msgid "seda_authorized_agent_to_object"
msgstr ""
msgid "seda_bdo_format_identification"
msgstr "format"
msgid "seda_binary_data_object"
msgstr ""
......@@ -7019,14 +6990,14 @@ msgid "seda_encoding_from"
msgstr ""
msgid "seda_encoding_from_object"
msgstr ""
msgstr "encodage"
msgctxt "SEDABinaryDataObject"
msgid "seda_encoding_from_object"
msgstr ""
msgid "seda_encoding_to"
msgstr ""
msgstr "valeur"
msgctxt "SEDAEncoding"
msgid "seda_encoding_to"
......@@ -7205,14 +7176,14 @@ msgid "seda_format_id_from"
msgstr ""
msgid "seda_format_id_from_object"
msgstr ""
msgstr "type spécifique du format"
msgctxt "SEDABinaryDataObject"
msgid "seda_format_id_from_object"
msgstr ""
msgid "seda_format_id_to"
msgstr ""
msgstr "valeur"
msgctxt "SEDAFormatId"
msgid "seda_format_id_to"
......@@ -7233,7 +7204,7 @@ msgid "seda_format_litteral"
msgstr ""
msgid "seda_format_litteral_object"
msgstr ""
msgstr "forme littérale du nom du format"
msgctxt "SEDABinaryDataObject"
msgid "seda_format_litteral_object"
......@@ -7671,14 +7642,14 @@ msgid "seda_mime_type_from"
msgstr ""
msgid "seda_mime_type_from_object"
msgstr ""
msgstr "type MIME"
msgctxt "SEDABinaryDataObject"
msgid "seda_mime_type_from_object"
msgstr ""
msgid "seda_mime_type_to"
msgstr ""
msgstr "valeur"
msgctxt "SEDAMimeType"
msgid "seda_mime_type_to"
......
......@@ -14,6 +14,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from yams import BASE_TYPES
from cubicweb import tags, neg_role
from cubicweb.utils import UStringIO
# XXX alias to avoid side effect: uicfg will become our uicfg submodule. Not necessary with 3.23?
......@@ -52,8 +54,12 @@ def rtags_from_xsd_element(etype, element_name):
{'rvid': 'seda.reledit.direct_link_to_concept'})
else:
relation = ('*', rtype, etype, role)
if path[-1][-2] in BASE_TYPES:
vid = 'seda.reledit.text'
else:
vid = 'seda.reledit.link_to_concept'
rec.tag_object_of(('*', rtype, '*'),
{'rvid': 'seda.reledit.link_to_concept',
{'rvid': vid,
'novalue_label': _('<unauthorized>')})
rsection.tag_relation(relation, 'attributes')
ordered.append((rtype, role))
......
......@@ -23,11 +23,14 @@ from cubicweb.web.views import uicfg, tabs
from cubes.relationwidget import views as rwdg
from cubes.seda.xsd2yams import RDEF_CONSTRAINTS
from cubes.seda.views import rtags_from_xsd_element
_ = unicode
affk = uicfg.autoform_field_kwargs
pvdc = uicfg.primaryview_display_ctrl
rec = uicfg.reledit_ctrl
for etype in ('SEDABinaryDataObject', 'SEDAPhysicalDataObject'):
affk.set_fields_order(etype, ('id', 'user_cardinality', 'user_annotation'))
......@@ -97,8 +100,6 @@ class ContainedSearchForRelatedEntitiesView(rwdg.SearchForRelatedEntitiesView):
return self._cw.execute(rql, {'at': int(self._cw.form['container'])})
from cubes.seda.xsd2yams import RDEF_CONSTRAINTS
for key, rql_expr in RDEF_CONSTRAINTS.items():
if 'S container AT' in rql_expr:
try:
......@@ -114,9 +115,22 @@ class BinaryDataObjectTabbedPrimaryView(tabs.TabbedPrimaryView):
__select__ = tabs.TabbedPrimaryView.__select__ & is_instance('SEDABinaryDataObject')
tabs = [
'main_tab',
_('seda_bdo_format_identification'),
]
affk.set_field_kwargs('*', 'format_litteral', widget=fw.TextInput({'size': 80}))
affk.set_fields_order('SEDAFormatLitteral', ('user_cardinality', 'format_litteral'))
class BinaryDataObjectFormatIdentificationTab(tabs.PrimaryTab):
"""Display format identification information of a binary data object"""
__regid__ = 'seda_bdo_format_identification'
__select__ = tabs.PrimaryTab.__select__ & is_instance('SEDABinaryDataObject')
rsection, display_ctrl = rtags_from_xsd_element('SEDABinaryDataObject', 'FormatIdentification')
class PhysicalDataObjectTabbedPrimaryView(tabs.TabbedPrimaryView):
__select__ = tabs.TabbedPrimaryView.__select__ & is_instance('SEDAPhysicalDataObject')
tabs = [
......
......@@ -533,15 +533,15 @@ afs.tag_object_of(('*', 'seda_creating_os_version', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_last_modified', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_last_modified', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_format_litteral', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_format_litteral', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_format_litteral', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_mime_type_from', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_mime_type_from', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_mime_type_from', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_mime_type_to', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_format_id_from', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_format_id_from', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_format_id_from', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_format_id_to', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_encoding_from', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_encoding_from', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_encoding_from', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_encoding_to', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_algorithm', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_algorithm', '*'), 'main', 'attributes')
......@@ -611,6 +611,14 @@ pvs.tag_subject_of(('*', 'seda_binary_data_object', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_binary_data_object', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_physical_data_object', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_physical_data_object', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_format_litteral', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_format_litteral', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_mime_type_from', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_mime_type_from', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_format_id_from', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_format_id_from', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_encoding_from', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_encoding_from', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_reply_code_list_version', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_reply_code_list_version', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_message_digest_algorithm_code_list_version', '*'), 'hidden')
......
......@@ -30,6 +30,19 @@ class XSDMetaEntityView(EntityView):
self.w(u' <div class="description">%s</div>' % description)
class TextEntityAttributeView(EntityView):
"""Attribute view for SEDA relations displaying entity as text (no link to the entity)
"""
__regid__ = 'seda.reledit.text'
subvid = 'text'
def entity_call(self, entity):
self.w(u'<div>')
entity.view(self.subvid, w=self.w)
self.w(u' <span class="cardinality">[%s]</span>' % getattr(entity, 'user_cardinality', 1))
self.w(u'</div>')
class LinkToConceptEntityAttributeView(EntityView):
"""Attribute view for SEDA relations linking to a concept through an intermediary entity holding
cardinalities / annotation
......@@ -48,13 +61,8 @@ class LinkToConceptEntityAttributeView(EntityView):
self.w(u'</div>')
class DirectLinkToConceptEntityAttributeView(EntityView):
class DirectLinkToConceptEntityAttributeView(TextEntityAttributeView):
"""Attribute view for SEDA relations linking directly to a concept without intermediary entity
"""
__regid__ = 'seda.reledit.direct_link_to_concept'
def entity_call(self, entity):
self.w(u'<div>')
entity.view('oneline', w=self.w)
self.w(u' <span class="cardinality">[%s]</span>' % getattr(entity, 'user_cardinality', 1))
self.w(u'</div>')
subvid = 'oneline'
......@@ -28,6 +28,15 @@ from xsd2yams import PY_HEADER, xsy_mapping
LEVEL_ETYPES = set(('SEDABinaryDataObjectType', 'SEDAPhysicalDataObjectType',
'SEDAArchiveUnitType'))
RTYPES_IN_TAB = set((
'seda_binary_data_object',
'seda_physical_data_object',
'seda_format_litteral',
'seda_mime_type_from',
'seda_format_id_from',
'seda_encoding_from',
))
class UICFGGenerator(object):
rtags_info = {
......@@ -88,7 +97,7 @@ class UICFGGenerator(object):
if not mapping.final and mapping.subjtype != 'SEDAid':
if (mapping.rtype.endswith('code_list_version_from')
or mapping.rtype.endswith('code_list_version')
or mapping.rtype.endswith('data_object')):
or mapping.rtype in RTYPES_IN_TAB):
section = 'hidden'
role = mapping.composite or 'subject'
yield mapping.rtype, neg_role(role), section
......@@ -110,7 +119,7 @@ class UICFGGenerator(object):
if not mapping.final and mapping.subjtype != 'SEDAid':
if (mapping.rtype.endswith('code_list_version_from')
or mapping.rtype.endswith('code_list_version')
or mapping.rtype.endswith('data_object')):
or mapping.rtype in RTYPES_IN_TAB):
section = 'hidden'
role = mapping.composite or 'subject'
yield mapping.rtype, neg_role(role), section
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment