Commit 99006b59 authored by Sylvain Thénault's avatar Sylvain Thénault
Browse files

[ui] Tab for data-object references of a archive unit

parent f06380b98264
......@@ -912,37 +912,6 @@ msgstr ""
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsPartOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsVersionOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReferencesArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReplacesArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltRequiresArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
"seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgid "SEDADataObjectReference_plural"
msgstr ""
......@@ -3287,37 +3256,6 @@ msgstr ""
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsPartOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsVersionOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReferencesArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReplacesArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltRequiresArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
"seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgid "add a SEDADataObjectVersion"
msgstr ""
......@@ -4780,6 +4718,13 @@ msgid ""
"SEDAArchiveTransfer %(linkto)s)"
msgstr ""
#, python-format
msgid ""
"creating SEDADataObjectReference (SEDADataObjectReference "
"seda_data_object_reference SEDASeqAltArchiveUnitArchiveUnitRefIdManagement "
"%(linkto)s)"
msgstr ""
#, python-format
msgid ""
"creating SEDAPhysicalDataObject (SEDAPhysicalDataObject "
......@@ -5448,6 +5393,9 @@ msgstr ""
msgid "seda_au_archive_units_tab"
msgstr ""
msgid "seda_au_data_objects_refs_tab"
msgstr ""
msgid "seda_authorized_agent_from"
msgstr ""
......
......@@ -915,37 +915,6 @@ msgstr ""
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsPartOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsVersionOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReferencesArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReplacesArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltRequiresArchiveUnitRefId.seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
"seda_data_object_reference.object"
msgid "SEDADataObjectReference"
msgstr ""
msgid "SEDADataObjectReference_plural"
msgstr ""
......@@ -3290,37 +3259,6 @@ msgstr ""
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsPartOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltIsVersionOfArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReferencesArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltReplacesArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDAAltRequiresArchiveUnitRefId.seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgctxt ""
"inlined:SEDASeqAltArchiveUnitArchiveUnitRefIdManagement."
"seda_data_object_reference.object"
msgid "add a SEDADataObjectReference"
msgstr ""
msgid "add a SEDADataObjectVersion"
msgstr ""
......@@ -4783,6 +4721,15 @@ msgid ""
"SEDAArchiveTransfer %(linkto)s)"
msgstr "création d'un objet-données binaire dans le profil %(linkto)s"
#, python-format
msgid ""
"creating SEDADataObjectReference (SEDADataObjectReference "
"seda_data_object_reference SEDASeqAltArchiveUnitArchiveUnitRefIdManagement "
"%(linkto)s)"
msgstr ""
"création d'une référence à un objet-données pour l'unité d'archive "
"%(linkto)s"
#, python-format
msgid ""
"creating SEDAPhysicalDataObject (SEDAPhysicalDataObject "
......@@ -5451,6 +5398,9 @@ msgstr ""
msgid "seda_au_archive_units_tab"
msgstr "unités d'archives"
msgid "seda_au_data_objects_refs_tab"
msgstr "objets-données"
msgid "seda_authorized_agent_from"
msgstr ""
......@@ -5777,7 +5727,7 @@ msgid "seda_data_object_reference"
msgstr ""
msgid "seda_data_object_reference_id"
msgstr ""
msgstr "objet-données référencé"
msgctxt "SEDACustodialHistoryFile"
msgid "seda_data_object_reference_id"
......@@ -5799,7 +5749,7 @@ msgid "seda_data_object_reference_id_object"
msgstr ""
msgid "seda_data_object_reference_object"
msgstr ""
msgstr "référence à un objet-données"
msgctxt "SEDAAltIsPartOfArchiveUnitRefId"
msgid "seda_data_object_reference_object"
......
......@@ -26,7 +26,7 @@ from cubicweb.web.views import uicfg, baseviews, tabs, autoform, formrenderers
from cubes.compound import views as compound
from cubes.seda.views import add_subobject_link, dropdown_button
from cubes.seda.views import add_subobject_link, dropdown_button, viewlib
_ = unicode
......@@ -35,6 +35,13 @@ pvs = uicfg.primaryview_section
rec = uicfg.reledit_ctrl
def parent_archive_unit(entity):
"""Return the first encountered parent which is an ArchiveUnit"""
while entity.cw_etype != 'SEDAArchiveUnit':
entity = entity.cw_adapt_to('IContained').parent
return entity
@objectify_predicate
def is_archive_unit_ref(cls, req, rset=None, entity=None, **kwargs):
"""Return 1 if a unit_type value is specified in kwargs or in form parameters, and it value is
......@@ -79,10 +86,7 @@ class SkipInContextView(baseviews.InContextView):
def cell_call(self, row, col):
entity = self.cw_rset.get_entity(row, col)
while entity.cw_etype != 'SEDAArchiveUnit':
# skip parent until we go back to the parent archive unit
entity = entity.cw_adapt_to('IContained').parent
entity.view('incontext', w=self.w)
parent_archive_unit(entity).view('incontext', w=self.w)
class ArchiveUnitRefIdOutOfContextView(baseviews.OutOfContextView):
......@@ -95,12 +99,24 @@ class ArchiveUnitRefIdOutOfContextView(baseviews.OutOfContextView):
parent.view('incontext', w=self.w)
class DataObjectReferenceBusinessValueLinkEntityView(viewlib.BusinessValueLinkEntityView):
__select__ = is_instance('SEDADataObjectReference')
def entity_call(self, entity):
do_rset = entity.related('seda_data_object_reference_id', 'subject')
if do_rset:
do_rset.one().view(self.__regid__, w=self.w)
else:
super(DataObjectReferenceBusinessValueLinkEntityView, self).entity_call(entity)
class ArchiveUnitTabbedPrimaryView(tabs.TabbedPrimaryView):
__select__ = tabs.TabbedPrimaryView.__select__ & is_instance('SEDAArchiveUnit')
tabs = [
'main_tab',
_('seda_au_archive_units_tab'),
_('seda_au_data_objects_refs_tab'),
]
au_pvs = deepcopy(pvs)
......@@ -158,6 +174,30 @@ class ArchiveUnitArchiveUnitsTab(tabs.TabsMixin, EntityView):
tabid=self.__regid__)
class ArchiveUnitDataObjectReferencesTab(viewlib.SubObjectsTab):
"""Tab for data object references of an archive unit"""
__regid__ = 'seda_au_data_objects_refs_tab'
__select__ = is_instance('SEDAArchiveUnit') & ~is_archive_unit_ref()
rtype_role_targets = [('seda_data_object_reference', 'object', None)]
_('creating SEDADataObjectReference (SEDADataObjectReference seda_data_object_reference '
'SEDASeqAltArchiveUnitArchiveUnitRefIdManagement %(linkto)s)')
def entity_call(self, entity):
seq = entity.first_level_choice.content_sequence
self.display_add_button(seq)
self.display_subobjects_list(seq)
def url_params(self, entity):
archive_unit = parent_archive_unit(entity)
return {'__redirectparams': 'tab=' + self.__regid__,
'__redirectpath': archive_unit.rest_path()}
def parent(self, entity):
return parent_archive_unit(entity)
# Top level ArchiveUnit form: create to distinct forms, one form archive unit reference and the
# other for archive unit content. This is done by a mix of uicfg, form and renderer customization
# depending on a 'unit_type' parameter in form params.
......
......@@ -700,7 +700,7 @@ afs.tag_object_of(('*', 'seda_management', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_content', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_content', '*'), 'main', 'inlined')
afs.tag_subject_of(('*', 'seda_data_object_reference', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_data_object_reference', '*'), 'main', 'inlined')
afs.tag_object_of(('*', 'seda_data_object_reference', '*'), 'main', 'hidden')
afs.tag_object_of(('*', 'seda_data_object_reference_id', '*'), 'main', 'hidden')
afs.tag_subject_of(('*', 'seda_data_object_reference_id', '*'), 'main', 'attributes')
afs.tag_subject_of(('*', 'seda_href', '*'), 'main', 'hidden')
......@@ -1020,6 +1020,8 @@ pvs.tag_subject_of(('*', 'seda_need_authorization', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_need_authorization', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_archive_unit', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_archive_unit', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_data_object_reference', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_data_object_reference', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_relationship', '*'), 'hidden')
pvs.tag_object_of(('*', 'seda_relationship', '*'), 'hidden')
pvs.tag_subject_of(('*', 'seda_width', '*'), 'hidden')
......
......@@ -40,6 +40,7 @@ RTYPES_IN_TAB = set((
'seda_reuse_rule',
'seda_classification_rule',
'seda_need_authorization',
'seda_data_object_reference',
))
for element_name in ('CodeListVersions', 'FormatIdentification', 'FileInfo', 'PhysicalDimensions'):
for rtype, role, path in XSDM_MAPPING.iter_rtype_role(element_name):
......
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