Skip to content

Commit a92a9c9

Browse files
added qualifiedrelations to infopopup
1 parent ac49bc3 commit a92a9c9

File tree

3 files changed

+76
-28
lines changed

3 files changed

+76
-28
lines changed

l10n/custom-data-type-dante.csv

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,13 @@ custom.data.type.dante.config.parameter.mask.label_with_hierarchie.value.label,L
120120
custom.data.type.dante.config.parameter.mask.label_with_hierarchie.value.checkbox,Hierarchie aktivieren,use hierarchie
121121
custom.data.type.dante.modal.form.popup.paging.label.page,Seite,Page
122122
custom.data.type.dante.modal.form.popup.paging.label.count,Treffer:,Hits:
123+
custom.data.type.dante.modal.form.popup.jskospreview.gender,Geschlecht,Gender
124+
custom.data.type.dante.modal.form.popup.jskospreview.maritalStatus,Familienstand,Marital Status
125+
custom.data.type.dante.modal.form.popup.jskospreview.participatedIn,Ereignisse,Events
126+
custom.data.type.dante.modal.form.popup.jskospreview.hasOccupation,Beruf,Occupation
127+
custom.data.type.dante.modal.form.popup.jskospreview.hasDenomination,Konfession,Denomination
128+
custom.data.type.dante.modal.form.popup.jskospreview.hasPoliticalParty,Politische Zugehörigkeit,Political Party
129+
custom.data.type.dante.modal.form.popup.jskospreview.nationality,Staatsangehörigkeit,Nationality
130+
custom.data.type.dante.modal.form.popup.jskospreview.type,Typ,Type
131+
132+

src/webfrontend/CustomDataTypeDante.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,7 @@ class CustomDataTypeDANTE extends CustomDataTypeWithCommonsAsPlugin
10971097
if that.getCustomMaskSettings()?.mapbox_access_token?.value
10981098
mapbox_access_token = that.getCustomMaskSettings().mapbox_access_token.value
10991099
# start new request to DANTE-API
1100-
extendedInfo_xhr.xhr = new (CUI.XHR)(url: location.protocol + '//api.dante.gbv.de/data?uri=' + uri + '&format=json&properties=+ancestors,hiddenLabel,notation,scopeNote,definition,note,identifier,example,location,depiction,startDate,endDate,startPlace,endPlace&cache=1')
1100+
extendedInfo_xhr.xhr = new (CUI.XHR)(url: location.protocol + '//api.dante.gbv.de/data?uri=' + uri + '&format=json&properties=+ancestors,hiddenLabel,notation,scopeNote,definition,note,identifier,example,location,depiction,startDate,endDate,startPlace,endPlace,qualifiedRelations&cache=1')
11011101
extendedInfo_xhr.xhr.start()
11021102
.done((data, status, statusText) ->
11031103
htmlContent = that.getJSKOSPreview(data, mapbox_access_token)

src/webfrontend/CustomDataTypeDanteParseJSKOS.coffee

Lines changed: 65 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -76,32 +76,70 @@ CustomDataTypeDANTE.prototype.getJSKOSPreview = (data, mapbox_access_token = fal
7676
if notations
7777
html += '<h4>' + $$('custom.data.type.dante.modal.form.popup.jskospreview.notations') + '</h4>' + notations
7878

79-
# startDate + startPlace
80-
startPlaces = []
81-
if data.startDate || data.startPlace
82-
html += '<h4>' + $$('custom.data.type.dante.modal.form.popup.jskospreview.startDate') + '</h4>'
83-
if data.startDate
84-
html += data.startDate + '<br />'
85-
if data.startPlace
86-
for key, val of data.startPlace
87-
startPlaces.push ' &#8226; ' + val.prefLabel.und
88-
startPlaces = startPlaces.filter((item, i, ar) ->
89-
ar.indexOf(item) == i
90-
)
91-
html += startPlaces.join('<br />')
92-
93-
# endDate + endPlace
94-
endPlaces = []
95-
if data.endDate || data.endPlace
96-
html += '<h4>' + $$('custom.data.type.dante.modal.form.popup.jskospreview.endDate') + '</h4>'
97-
if data.endDate
98-
html += data.endDate + '<br />'
99-
if data.endPlace
100-
for key, val of data.endPlace
101-
endPlaces.push ' &#8226; ' + val.prefLabel.und
102-
endPlaces = endPlaces.filter (item, i, ar) ->
103-
ar.indexOf(item) == i
104-
html += endPlaces.join('<br />')
79+
# qualifiedRelation to HTML
80+
qualifiedRelationToHTML = (qualifiedRelation, translationKey) ->
81+
html = ''
82+
titleSet = false
83+
for qualifiedRelationKey, qualifiedRelationEntry of qualifiedRelation
84+
# title
85+
if translationKey and not titleSet
86+
titleSet = true
87+
html += '<h4>' + $$(translationKey) + '</h4>'
88+
89+
# .resource.prefLabel
90+
if qualifiedRelationEntry.resource.prefLabel
91+
prefLabel = that.getPrefLabelFromJSKOS(qualifiedRelationEntry.resource)
92+
html += '<span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-arrow-circle-o-right" aria-hidden="true"></i></span> ' + prefLabel + '<br />'
93+
94+
# .startdate + .enddate
95+
if qualifiedRelationEntry.startDate || qualifiedRelationEntry.endDate
96+
html += '<span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-calendar" aria-hidden="true"></i></span> '
97+
if qualifiedRelationEntry.startDate
98+
html += qualifiedRelationEntry.startDate + ' - '
99+
if qualifiedRelationEntry.endDate
100+
html += qualifiedRelationEntry.endDate + '<br />'
101+
102+
# .resource.place
103+
if qualifiedRelationEntry.resource.place
104+
places = []
105+
for key, value of qualifiedRelationEntry.resource.place
106+
if value.prefLabel
107+
placeLabel = that.getPrefLabelFromJSKOS(value)
108+
places.push ' &#8226; ' + placeLabel
109+
if places.length > 0
110+
html += '<span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-map-marker" aria-hidden="true"></i></span> ' + places.join('<br />') + '<br />'
111+
112+
# .resource.startDate + .resource.startDate
113+
if qualifiedRelationEntry.resource.startDate || qualifiedRelationEntry.resource.endDate
114+
html += '<span class="qualifiedRelationInfo cui-label-icon"><i class="fa fa-calendar" aria-hidden="true"></i></span> '
115+
if qualifiedRelationEntry.resource.startDate
116+
html += qualifiedRelationEntry.resource.startDate + ' - '
117+
if qualifiedRelationEntry.resource.endDate
118+
html += qualifiedRelationEntry.resource.endDate + '<br />'
119+
120+
# add a vertical line, if not the last entry
121+
if (qualifiedRelationKey*1 + 1) < qualifiedRelation.length
122+
html += '<div class="qualifiedRelationsDeviderLine"></div>'
123+
124+
return html
125+
126+
qualifiedRelationsTableToEcho =
127+
'https://schema.org/gender' : 'custom.data.type.dante.modal.form.popup.jskospreview.gender'
128+
'https://w3id.org/dpv/pd#MaritalStatus' : 'custom.data.type.dante.modal.form.popup.jskospreview.maritalStatus'
129+
'http://www.cidoc-crm.org/cidoc-crm/P11i_participated_in' : 'custom.data.type.dante.modal.form.popup.jskospreview.participatedIn'
130+
'https://schema.org/hasOccupation' : 'custom.data.type.dante.modal.form.popup.jskospreview.hasOccupation'
131+
'http://gov.genealogy.net/ontology.owl#hasDenomination' : 'custom.data.type.dante.modal.form.popup.jskospreview.hasDenomination'
132+
'https://www.wikidata.org/wiki/Property:P102' : 'custom.data.type.dante.modal.form.popup.jskospreview.hasPoliticalParty'
133+
'https://schema.org/nationality' : 'custom.data.type.dante.modal.form.popup.jskospreview.nationality'
134+
'https://www.w3.org/1999/02/22-rdf-syntax-ns#type' : 'custom.data.type.dante.modal.form.popup.jskospreview.type'
135+
136+
# Biographie / Chronologie (qualifiedRelations)
137+
if data.qualifiedRelations
138+
for qualifiedRelationKey, qualifiedRelation of data.qualifiedRelations
139+
if qualifiedRelationsTableToEcho[qualifiedRelationKey]
140+
translationKey = qualifiedRelationsTableToEcho[qualifiedRelationKey]
141+
# title (translationKey) to title, but only once
142+
html += qualifiedRelationToHTML(qualifiedRelation, translationKey)
105143

106144
# Depiction
107145
if data.depiction
@@ -233,7 +271,7 @@ CustomDataTypeDANTE.prototype.getJSKOSPreview = (data, mapbox_access_token = fal
233271
if example
234272
html += '<h4>' + $$('custom.data.type.dante.modal.form.popup.jskospreview.example') + '</h4>' + example
235273

236-
html = '<style>.danteTooltip { padding: 10px; min-width:200px; } .danteTooltip h4 { margin-bottom: 0px; } .danteTooltip .danteTooltipAncestors { font-size: 13px; font-weight: bold; margin-top: 0px;} .danteTooltip .mapImage {background-color: #EFEFEF; position: relative; width: 100%; height: 150px; background-size: cover; background-repeat: no-repeat; margin-bottom: 6px; border-radius: 2px;} .danteTooltip .colorPreview{ width:100%; height: 100px; } .depictionPreview {background-size: contain; background-repeat: no-repeat; background-position: center center; width: 100%; height:150px; background-color: #EFEFEF;}</style><div class="danteTooltip">' + html + '</div>'
274+
html = '<style>.danteTooltip .qualifiedRelationsDeviderLine {width: 100%; height: 6px;} .danteTooltip { padding: 10px; min-width:200px; } .danteTooltip h4 { margin-bottom: 3px; margin-top: 9px; } .danteTooltip .danteTooltipAncestors { font-size: 13px; font-weight: bold; margin-top: 0px;} .danteTooltip .mapImage {background-color: #EFEFEF; position: relative; width: 100%; height: 150px; background-size: cover; background-repeat: no-repeat; margin-bottom: 6px; border-radius: 2px;} .danteTooltip .colorPreview{ width:100%; height: 100px; } .depictionPreview {background-size: contain; background-repeat: no-repeat; background-position: center center; width: 100%; height:150px; background-color: #EFEFEF;}</style><div class="danteTooltip">' + html + '</div>'
237275
return html
238276

239277

0 commit comments

Comments
 (0)