Commit aceb2be0 authored by Yann Voté's avatar Yann Voté
Browse files

[ui] Refactor content view using generated uicfg

and use rtags_from_xsd_element function for Gps subelements.
parent b2c358cc1c34
...@@ -854,10 +854,6 @@ msgstr "" ...@@ -854,10 +854,6 @@ msgstr ""
msgid "SEDACustodialHistoryFile" msgid "SEDACustodialHistoryFile"
msgstr "" msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural" msgid "SEDACustodialHistoryFile_plural"
msgstr "" msgstr ""
...@@ -2857,10 +2853,6 @@ msgstr "" ...@@ -2857,10 +2853,6 @@ msgstr ""
msgid "add a SEDACustodialHistoryFile" msgid "add a SEDACustodialHistoryFile"
msgstr "" msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "add a SEDACustodialHistoryFile"
msgstr ""
msgid "add a SEDACustodialHistoryItem" msgid "add a SEDACustodialHistoryItem"
msgstr "" msgstr ""
......
...@@ -857,10 +857,6 @@ msgstr "" ...@@ -857,10 +857,6 @@ msgstr ""
msgid "SEDACustodialHistoryFile" msgid "SEDACustodialHistoryFile"
msgstr "" msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural" msgid "SEDACustodialHistoryFile_plural"
msgstr "" msgstr ""
...@@ -2860,10 +2856,6 @@ msgstr "" ...@@ -2860,10 +2856,6 @@ msgstr ""
msgid "add a SEDACustodialHistoryFile" msgid "add a SEDACustodialHistoryFile"
msgstr "ajouter une référence à un fichier de journalisation externe" msgstr "ajouter une référence à un fichier de journalisation externe"
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "add a SEDACustodialHistoryFile"
msgstr ""
msgid "add a SEDACustodialHistoryItem" msgid "add a SEDACustodialHistoryItem"
msgstr "" msgstr ""
......
...@@ -22,7 +22,8 @@ from logilab.mtconverter import xml_escape ...@@ -22,7 +22,8 @@ from logilab.mtconverter import xml_escape
from cubicweb.predicates import is_instance from cubicweb.predicates import is_instance
from cubicweb.web.views import tabs, uicfg from cubicweb.web.views import tabs, uicfg
from cubes.seda.views import rtags_from_rtype_role_targets, viewlib, widgets from cubes.seda.views import rtags_from_rtype_role_targets, rtags_from_xsd_element
from cubes.seda.views import viewlib, widgets
_ = unicode _ = unicode
...@@ -56,85 +57,55 @@ for rtype in ('seda_description', ...@@ -56,85 +57,55 @@ for rtype in ('seda_description',
# Tabs fields # Tabs fields
identification_rtype_role = [ identification_rtype_role_targets = [
('seda_source', 'object'), ('seda_source', 'object', None),
('seda_file_plan_position', 'object'), ('seda_file_plan_position', 'object', None),
('seda_system_id', 'object'), ('seda_system_id', 'object', None),
('seda_originating_system_id', 'object'), ('seda_originating_system_id', 'object', None),
('seda_archival_agency_archive_unit_identifier', 'object'), ('seda_archival_agency_archive_unit_identifier', 'object', None),
('seda_originating_agency_archive_unit_identifier', 'object'), ('seda_originating_agency_archive_unit_identifier', 'object', None),
('seda_transferring_agency_archive_unit_identifier', 'object'), ('seda_transferring_agency_archive_unit_identifier', 'object', None),
] ]
service_rtype_role = [ service_rtype_role_targets = [
('seda_originating_agency_from', 'object'), ('seda_originating_agency_from', 'object', None),
('seda_submission_agency_from', 'object'), ('seda_submission_agency_from', 'object', None),
('seda_authorized_agent_from', 'object'), ('seda_authorized_agent_from', 'object', None),
] ]
agent_rtype_role = [ agent_rtype_role_targets = [
('seda_writer_from', 'object'), ('seda_writer_from', 'object', None),
('seda_addressee_from', 'object'), ('seda_addressee_from', 'object', None),
('seda_recipient_from', 'object'), ('seda_recipient_from', 'object', None),
] ]
coverage_rtype_role = [
('seda_spatial', 'object'),
('seda_temporal', 'object'),
('seda_juridictional', 'object'),
]
date_rtype_role = [
('seda_created_date', 'object'),
('seda_transacted_date', 'object'),
('seda_acquired_date', 'object'),
('seda_sent_date', 'object'),
('seda_received_date', 'object'),
('seda_registered_date', 'object'),
('seda_start_date', 'object'),
('seda_end_date', 'object'),
]
gps_rtype_role = [
('seda_gps_version_id', 'object'),
('seda_gps_altitude', 'object'),
('seda_gps_altitude_ref', 'object'),
('seda_gps_latitude', 'object'),
('seda_gps_latitude_ref', 'object'),
('seda_gps_longitude', 'object'),
('seda_gps_longitude_ref', 'object'),
('seda_gps_date_stamp', 'object'),
]
keyword_rtype_role = [
('seda_keyword', 'object'),
]
relation_rtype_role = [ date_rtype_role_targets = [
('seda_is_version_of', 'object'), ('seda_created_date', 'object', None),
('seda_replaces', 'object'), ('seda_transacted_date', 'object', None),
('seda_requires', 'object'), ('seda_acquired_date', 'object', None),
('seda_is_part_of', 'object'), ('seda_sent_date', 'object', None),
('seda_references', 'object'), ('seda_received_date', 'object', None),
('seda_registered_date', 'object', None),
('seda_start_date', 'object', None),
('seda_end_date', 'object', None),
] ]
event_rtype_role = [ keyword_rtype_role_targets = [
('seda_event', 'object'), ('seda_keyword', 'object', None),
] ]
history_rtype_role = [ event_rtype_role_targets = [
('seda_custodial_history_item', 'object'), ('seda_event', 'object', None),
] ]
# Remove from relations section and autoform what is shown in tabs # Remove from relations section and autoform what is shown in tabs
for rtype, role in (itertools.chain(identification_rtype_role, for rtype, role, __ in (itertools.chain(identification_rtype_role_targets,
service_rtype_role, service_rtype_role_targets,
agent_rtype_role, agent_rtype_role_targets,
coverage_rtype_role, date_rtype_role_targets,
date_rtype_role, keyword_rtype_role_targets,
keyword_rtype_role, event_rtype_role_targets)):
event_rtype_role,
history_rtype_role)):
if role == 'object': if role == 'object':
pvs.tag_object_of(('*', rtype, 'SEDAContent'), 'hidden') pvs.tag_object_of(('*', rtype, 'SEDAContent'), 'hidden')
afs.tag_object_of(('*', rtype, 'SEDAContent'), 'main', 'hidden') afs.tag_object_of(('*', rtype, 'SEDAContent'), 'main', 'hidden')
...@@ -173,7 +144,7 @@ class ContentIdentificationTab(tabs.PrimaryTab): ...@@ -173,7 +144,7 @@ class ContentIdentificationTab(tabs.PrimaryTab):
__regid__ = 'seda_content_identification_tab' __regid__ = 'seda_content_identification_tab'
rtype_role_targets = [(rtype, role, None) for rtype, role in identification_rtype_role] rtype_role_targets = identification_rtype_role_targets
rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets) rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets)
...@@ -182,7 +153,7 @@ class ContentDateTab(tabs.PrimaryTab): ...@@ -182,7 +153,7 @@ class ContentDateTab(tabs.PrimaryTab):
__regid__ = 'seda_content_date_tab' __regid__ = 'seda_content_date_tab'
rtype_role_targets = [(rtype, role, None) for rtype, role in date_rtype_role] rtype_role_targets = date_rtype_role_targets
rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets) rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets)
...@@ -191,8 +162,7 @@ class ContentGpsTab(tabs.PrimaryTab): ...@@ -191,8 +162,7 @@ class ContentGpsTab(tabs.PrimaryTab):
__regid__ = 'seda_content_gps_tab' __regid__ = 'seda_content_gps_tab'
rtype_role_targets = [(rtype, role, None) for rtype, role in gps_rtype_role] rsection, display_ctrl = rtags_from_xsd_element('SEDAContent', 'Gps')
rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets)
class ContentServiceTab(tabs.PrimaryTab): class ContentServiceTab(tabs.PrimaryTab):
...@@ -200,7 +170,7 @@ class ContentServiceTab(tabs.PrimaryTab): ...@@ -200,7 +170,7 @@ class ContentServiceTab(tabs.PrimaryTab):
__regid__ = 'seda_content_service_tab' __regid__ = 'seda_content_service_tab'
rtype_role_targets = [(rtype, role, None) for rtype, role in service_rtype_role] rtype_role_targets = service_rtype_role_targets
rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets) rsection, display_ctrl = rtags_from_rtype_role_targets('SEDAContent', rtype_role_targets)
...@@ -210,7 +180,7 @@ class ContentAgentTab(viewlib.SubObjectsTab): ...@@ -210,7 +180,7 @@ class ContentAgentTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_agent_tab' __regid__ = 'seda_content_agent_tab'
__select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent') __select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent')
rtype_role_targets = [(rtype, role, None) for rtype, role in agent_rtype_role] rtype_role_targets = agent_rtype_role_targets
_('creating SEDAWriter (SEDAWriter seda_writer_from SEDAContent %(linkto)s)') _('creating SEDAWriter (SEDAWriter seda_writer_from SEDAContent %(linkto)s)')
_('creating SEDAAddressee (SEDAAddressee seda_addressee_from SEDAContent %(linkto)s)') _('creating SEDAAddressee (SEDAAddressee seda_addressee_from SEDAContent %(linkto)s)')
...@@ -222,7 +192,9 @@ class ContentCoverageTab(viewlib.SubObjectsTab): ...@@ -222,7 +192,9 @@ class ContentCoverageTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_coverage_tab' __regid__ = 'seda_content_coverage_tab'
rtype_role_targets = [(rtype, role, None) for rtype, role in coverage_rtype_role] rtype_role_targets = [('seda_spatial', 'object', None),
('seda_temporal', 'object', None),
('seda_juridictional', 'object', None)]
_('creating SEDASpatial (SEDASpatial seda_spatial SEDAContent %(linkto)s)') _('creating SEDASpatial (SEDASpatial seda_spatial SEDAContent %(linkto)s)')
_('creating SEDATemporal (SEDATemporal seda_temporal SEDAContent %(linkto)s)') _('creating SEDATemporal (SEDATemporal seda_temporal SEDAContent %(linkto)s)')
...@@ -235,7 +207,7 @@ class ContentKeywordTab(viewlib.SubObjectsTab): ...@@ -235,7 +207,7 @@ class ContentKeywordTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_keyword_tab' __regid__ = 'seda_content_keyword_tab'
__select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent') __select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent')
rtype_role_targets = [(rtype, role, None) for rtype, role in keyword_rtype_role] rtype_role_targets = keyword_rtype_role_targets
_('creating SEDAKeyword (SEDAKeyword seda_keyword SEDAContent %(linkto)s)') _('creating SEDAKeyword (SEDAKeyword seda_keyword SEDAContent %(linkto)s)')
...@@ -246,7 +218,11 @@ class ContentRelationTab(viewlib.SubObjectsTab): ...@@ -246,7 +218,11 @@ class ContentRelationTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_relation_tab' __regid__ = 'seda_content_relation_tab'
__select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent') __select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent')
rtype_role_targets = [(rtype, role, None) for rtype, role in relation_rtype_role] rtype_role_targets = [('seda_is_version_of', 'object', None),
('seda_replaces', 'object', None),
('seda_requires', 'object', None),
('seda_is_part_of', 'object', None),
('seda_references', 'object', None)]
_('creating SEDAIsVersionOf (SEDAIsVersionOf seda_is_version_of SEDAContent %(linkto)s)') _('creating SEDAIsVersionOf (SEDAIsVersionOf seda_is_version_of SEDAContent %(linkto)s)')
_('creating SEDAReplaces (SEDAReplaces seda_replaces SEDAContent %(linkto)s)') _('creating SEDAReplaces (SEDAReplaces seda_replaces SEDAContent %(linkto)s)')
...@@ -261,7 +237,7 @@ class ContentEventTab(viewlib.SubObjectsTab): ...@@ -261,7 +237,7 @@ class ContentEventTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_event_tab' __regid__ = 'seda_content_event_tab'
__select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent') __select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent')
rtype_role_targets = [(rtype, role, None) for rtype, role in event_rtype_role] rtype_role_targets = event_rtype_role_targets
_('creating SEDAEvent (SEDAEvent seda_event SEDAContent %(linkto)s)') _('creating SEDAEvent (SEDAEvent seda_event SEDAContent %(linkto)s)')
...@@ -272,7 +248,7 @@ class ContentHistoryTab(viewlib.SubObjectsTab): ...@@ -272,7 +248,7 @@ class ContentHistoryTab(viewlib.SubObjectsTab):
__regid__ = 'seda_content_history_tab' __regid__ = 'seda_content_history_tab'
__select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent') __select__ = viewlib.SubObjectsTab.__select__ & is_instance('SEDAContent')
rtype_role_targets = [(rtype, role, None) for rtype, role in history_rtype_role] rtype_role_targets = [('seda_custodial_history_item', 'object', None)]
_('creating SEDACustodialHistoryItem (SEDACustodialHistoryItem seda_custodial_history_item ' _('creating SEDACustodialHistoryItem (SEDACustodialHistoryItem seda_custodial_history_item '
'SEDAContent %(linkto)s)') 'SEDAContent %(linkto)s)')
......
...@@ -805,11 +805,11 @@ afs.tag_subject_of(('*', 'seda_alt_replaces_archive_unit_ref_id', '*'), 'main', ...@@ -805,11 +805,11 @@ afs.tag_subject_of(('*', 'seda_alt_replaces_archive_unit_ref_id', '*'), 'main',
afs.tag_object_of(('*', 'seda_alt_is_version_of_archive_unit_ref_id', '*'), 'main', 'hidden') afs.tag_object_of(('*', 'seda_alt_is_version_of_archive_unit_ref_id', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_alt_is_version_of_archive_unit_ref_id', '*'), 'main', 'inlined') afs.tag_subject_of(('*', 'seda_alt_is_version_of_archive_unit_ref_id', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_spatial', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_spatial', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_spatial', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_spatial', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_temporal', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_temporal', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_temporal', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_temporal', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_juridictional', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_juridictional', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_juridictional', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_juridictional', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_keyword_content', '*'), 'main', 'hidden') afs.tag_object_of(('*', 'seda_keyword_content', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_keyword_content', '*'), 'main', 'inlined') afs.tag_subject_of(('*', 'seda_keyword_content', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_keyword_reference_from', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_keyword_reference_from', '*'), 'main', 'hidden')
...@@ -821,9 +821,9 @@ afs.tag_object_of(('*', 'seda_keyword_type_from', '*'), 'main', 'inlined') ...@@ -821,9 +821,9 @@ afs.tag_object_of(('*', 'seda_keyword_type_from', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_keyword_type_to', '*'), 'main', 'hidden') afs.tag_object_of(('*', 'seda_keyword_type_to', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_keyword_type_to', '*'), 'main', 'attributes') afs.tag_subject_of(('*', 'seda_keyword_type_to', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_custodial_history_item', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_custodial_history_item', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_custodial_history_item', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_custodial_history_item', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_custodial_history_file', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_custodial_history_file', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_custodial_history_file', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_custodial_history_file', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_when', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_when', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_when', '*'), 'main', 'inlined') afs.tag_object_of(('*', 'seda_when', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_relationship', '*'), 'main', 'hidden') afs.tag_subject_of(('*', 'seda_relationship', '*'), 'main', 'hidden')
...@@ -999,6 +999,16 @@ pvs.tag_subject_of(('*', 'seda_is_part_of', '*'), 'hidden') ...@@ -999,6 +999,16 @@ pvs.tag_subject_of(('*', 'seda_is_part_of', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_is_part_of', '*'), 'hidden') pvs.tag_object_of(('*', 'seda_is_part_of', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_references', '*'), 'hidden') pvs.tag_subject_of(('*', 'seda_references', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_references', '*'), 'hidden') pvs.tag_object_of(('*', 'seda_references', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_spatial', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_spatial', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_temporal', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_temporal', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_juridictional', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_juridictional', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_custodial_history_item', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_custodial_history_item', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_custodial_history_file', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_custodial_history_file', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_relationship', '*'), 'hidden') pvs.tag_subject_of(('*', 'seda_relationship', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_relationship', '*'), 'hidden') pvs.tag_object_of(('*', 'seda_relationship', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_width', '*'), 'hidden') pvs.tag_subject_of(('*', 'seda_width', '*'), 'hidden')
......
...@@ -45,7 +45,7 @@ RTYPES_IN_TAB = set(( ...@@ -45,7 +45,7 @@ RTYPES_IN_TAB = set((
'seda_alt_archive_unit_archive_unit_ref_id', 'seda_alt_archive_unit_archive_unit_ref_id',
)) ))
for element_name in ('CodeListVersions', 'FormatIdentification', 'FileInfo', 'PhysicalDimensions', for element_name in ('CodeListVersions', 'FormatIdentification', 'FileInfo', 'PhysicalDimensions',
'Gps', 'RelatedObjectReference'): 'Gps', 'RelatedObjectReference', 'CustodialHistory', 'Coverage'):
for rtype, role, path in XSDM_MAPPING.iter_rtype_role(element_name): for rtype, role, path in XSDM_MAPPING.iter_rtype_role(element_name):
RTYPES_IN_TAB.add(rtype) RTYPES_IN_TAB.add(rtype)
......
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