Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cubicweb
cubes
seda
Commits
9c4c7e875f87
Commit
aceb2be0
authored
Jun 14, 2016
by
Yann Voté
Browse files
[ui] Refactor content view using generated uicfg
and use rtags_from_xsd_element function for Gps subelements.
parent
b2c358cc1c34
Changes
5
Hide whitespace changes
Inline
Side-by-side
i18n/en.po
View file @
9c4c7e87
...
...
@@ -854,10 +854,6 @@ msgstr ""
msgid "SEDACustodialHistoryFile"
msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural"
msgstr ""
...
...
@@ -2857,10 +2853,6 @@ msgstr ""
msgid "add a SEDACustodialHistoryFile"
msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "add a SEDACustodialHistoryFile"
msgstr ""
msgid "add a SEDACustodialHistoryItem"
msgstr ""
...
...
i18n/fr.po
View file @
9c4c7e87
...
...
@@ -857,10 +857,6 @@ msgstr ""
msgid "SEDACustodialHistoryFile"
msgstr ""
msgctxt "inlined:SEDAContent.seda_custodial_history_file.object"
msgid "SEDACustodialHistoryFile"
msgstr ""
msgid "SEDACustodialHistoryFile_plural"
msgstr ""
...
...
@@ -2860,10 +2856,6 @@ msgstr ""
msgid "add a SEDACustodialHistoryFile"
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"
msgstr ""
...
...
views/content.py
View file @
9c4c7e87
...
...
@@ -22,7 +22,8 @@ from logilab.mtconverter import xml_escape
from
cubicweb.predicates
import
is_instance
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
...
...
@@ -56,85 +57,55 @@ for rtype in ('seda_description',
# Tabs fields
identification_rtype_role
=
[
(
'seda_source'
,
'object'
),
(
'seda_file_plan_position'
,
'object'
),
(
'seda_system_id'
,
'object'
),
(
'seda_originating_system_id'
,
'object'
),
(
'seda_archival_agency_archive_unit_identifier'
,
'object'
),
(
'seda_originating_agency_archive_unit_identifier'
,
'object'
),
(
'seda_transferring_agency_archive_unit_identifier'
,
'object'
),
identification_rtype_role
_targets
=
[
(
'seda_source'
,
'object'
,
None
),
(
'seda_file_plan_position'
,
'object'
,
None
),
(
'seda_system_id'
,
'object'
,
None
),
(
'seda_originating_system_id'
,
'object'
,
None
),
(
'seda_archival_agency_archive_unit_identifier'
,
'object'
,
None
),
(
'seda_originating_agency_archive_unit_identifier'
,
'object'
,
None
),
(
'seda_transferring_agency_archive_unit_identifier'
,
'object'
,
None
),
]
service_rtype_role
=
[
(
'seda_originating_agency_from'
,
'object'
),
(
'seda_submission_agency_from'
,
'object'
),
(
'seda_authorized_agent_from'
,
'object'
),
service_rtype_role
_targets
=
[
(
'seda_originating_agency_from'
,
'object'
,
None
),
(
'seda_submission_agency_from'
,
'object'
,
None
),
(
'seda_authorized_agent_from'
,
'object'
,
None
),
]
agent_rtype_role
=
[
(
'seda_writer_from'
,
'object'
),
(
'seda_addressee_from'
,
'object'
),
(
'seda_recipient_from'
,
'object'
),
agent_rtype_role
_targets
=
[
(
'seda_writer_from'
,
'object'
,
None
),
(
'seda_addressee_from'
,
'object'
,
None
),
(
'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
=
[
(
'seda_is_version_of'
,
'object'
),
(
'seda_replaces'
,
'object'
),
(
'seda_requires'
,
'object'
),
(
'seda_is_part_of'
,
'object'
),
(
'seda_references'
,
'object'
),
date_rtype_role_targets
=
[
(
'seda_created_date'
,
'object'
,
None
),
(
'seda_transacted_date'
,
'object'
,
None
),
(
'seda_acquired_date'
,
'object'
,
None
),
(
'seda_sent_date'
,
'object'
,
None
),
(
'seda_received_date'
,
'object'
,
None
),
(
'seda_registered_date'
,
'object'
,
None
),
(
'seda_start_date'
,
'object'
,
None
),
(
'seda_end_date'
,
'object'
,
None
),
]
event
_rtype_role
=
[
(
'seda_
event
'
,
'object'
),
keyword
_rtype_role
_targets
=
[
(
'seda_
keyword
'
,
'object'
,
None
),
]
history
_rtype_role
=
[
(
'seda_
custodial_history_item
'
,
'object'
),
event
_rtype_role
_targets
=
[
(
'seda_
event
'
,
'object'
,
None
),
]
# Remove from relations section and autoform what is shown in tabs
for
rtype
,
role
in
(
itertools
.
chain
(
identification_rtype_role
,
service_rtype_role
,
agent_rtype_role
,
coverage_rtype_role
,
date_rtype_role
,
keyword_rtype_role
,
event_rtype_role
,
history_rtype_role
)):
for
rtype
,
role
,
__
in
(
itertools
.
chain
(
identification_rtype_role_targets
,
service_rtype_role_targets
,
agent_rtype_role_targets
,
date_rtype_role_targets
,
keyword_rtype_role_targets
,
event_rtype_role_targets
)):
if
role
==
'object'
:
pvs
.
tag_object_of
((
'*'
,
rtype
,
'SEDAContent'
),
'hidden'
)
afs
.
tag_object_of
((
'*'
,
rtype
,
'SEDAContent'
),
'main'
,
'hidden'
)
...
...
@@ -173,7 +144,7 @@ class ContentIdentificationTab(tabs.PrimaryTab):
__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
)
...
...
@@ -182,7 +153,7 @@ class ContentDateTab(tabs.PrimaryTab):
__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
)
...
...
@@ -191,8 +162,7 @@ class ContentGpsTab(tabs.PrimaryTab):
__regid__
=
'seda_content_gps_tab'
rtype_role_targets
=
[(
rtype
,
role
,
None
)
for
rtype
,
role
in
gps_rtype_role
]
rsection
,
display_ctrl
=
rtags_from_rtype_role_targets
(
'SEDAContent'
,
rtype_role_targets
)
rsection
,
display_ctrl
=
rtags_from_xsd_element
(
'SEDAContent'
,
'Gps'
)
class
ContentServiceTab
(
tabs
.
PrimaryTab
):
...
...
@@ -200,7 +170,7 @@ class ContentServiceTab(tabs.PrimaryTab):
__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
)
...
...
@@ -210,7 +180,7 @@ class ContentAgentTab(viewlib.SubObjectsTab):
__regid__
=
'seda_content_agent_tab'
__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 SEDAAddressee (SEDAAddressee seda_addressee_from SEDAContent %(linkto)s)'
)
...
...
@@ -222,7 +192,9 @@ class ContentCoverageTab(viewlib.SubObjectsTab):
__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 SEDATemporal (SEDATemporal seda_temporal SEDAContent %(linkto)s)'
)
...
...
@@ -235,7 +207,7 @@ class ContentKeywordTab(viewlib.SubObjectsTab):
__regid__
=
'seda_content_keyword_tab'
__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)'
)
...
...
@@ -246,7 +218,11 @@ class ContentRelationTab(viewlib.SubObjectsTab):
__regid__
=
'seda_content_relation_tab'
__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 SEDAReplaces (SEDAReplaces seda_replaces SEDAContent %(linkto)s)'
)
...
...
@@ -261,7 +237,7 @@ class ContentEventTab(viewlib.SubObjectsTab):
__regid__
=
'seda_content_event_tab'
__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)'
)
...
...
@@ -272,7 +248,7 @@ class ContentHistoryTab(viewlib.SubObjectsTab):
__regid__
=
'seda_content_history_tab'
__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 '
'SEDAContent %(linkto)s)'
)
...
...
views/uicfg.py
View file @
9c4c7e87
...
...
@@ -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_subject_of
((
'*'
,
'seda_alt_is_version_of_archive_unit_ref_id'
,
'*'
),
'main'
,
'inlined'
)
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_object_of
((
'*'
,
'seda_temporal'
,
'*'
),
'main'
,
'
inlined
'
)
afs
.
tag_object_of
((
'*'
,
'seda_temporal'
,
'*'
),
'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_subject_of
((
'*'
,
'seda_keyword_content'
,
'*'
),
'main'
,
'inlined'
)
afs
.
tag_subject_of
((
'*'
,
'seda_keyword_reference_from'
,
'*'
),
'main'
,
'hidden'
)
...
...
@@ -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_subject_of
((
'*'
,
'seda_keyword_type_to'
,
'*'
),
'main'
,
'attributes'
)
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_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_object_of
((
'*'
,
'seda_when'
,
'*'
),
'main'
,
'inlined'
)
afs
.
tag_subject_of
((
'*'
,
'seda_relationship'
,
'*'
),
'main'
,
'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_subject_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_object_of
((
'*'
,
'seda_relationship'
,
'*'
),
'hidden'
)
pvs
.
tag_subject_of
((
'*'
,
'seda_width'
,
'*'
),
'hidden'
)
...
...
xsd2uicfg.py
View file @
9c4c7e87
...
...
@@ -45,7 +45,7 @@ RTYPES_IN_TAB = set((
'seda_alt_archive_unit_archive_unit_ref_id'
,
))
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
):
RTYPES_IN_TAB
.
add
(
rtype
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment