update document metadata

This commit is contained in:
j 2024-02-26 12:14:42 +00:00
parent efaf216ceb
commit eb0e8a4aa7
2 changed files with 211 additions and 7 deletions

View file

@ -163,9 +163,9 @@
"columnWidth": 256 "columnWidth": 256
}, },
{ {
"id": "type", "id": "format",
"operator": "+", "operator": "+",
"title": "Type", "title": "Format",
"type": "string", "type": "string",
"filter": true, "filter": true,
"find": true, "find": true,
@ -173,6 +173,17 @@
"autocomplete": true, "autocomplete": true,
"columnWidth": 128 "columnWidth": 128
}, },
{
"id": "publication",
"operator": "+",
"title": "Publication",
"type": "string",
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{ {
"id": "author", "id": "author",
"operator": "+", "operator": "+",
@ -185,6 +196,17 @@
"autocomplete": true, "autocomplete": true,
"columnWidth": 256 "columnWidth": 256
}, },
{
"id": "group",
"operator": "+",
"title": "Group",
"type": "string",
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{ {
"id": "publisher", "id": "publisher",
"operator": "+", "operator": "+",
@ -196,6 +218,24 @@
"autocomplete": true, "autocomplete": true,
"columnWidth": 256 "columnWidth": 256
}, },
{
"id": "source",
"operator": "+",
"title": "Source",
"type": "string",
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{
"id": "links",
"title": "Links",
"type": ["string"],
"columnWidth": 180,
"find": true
},
{ {
"id": "place", "id": "place",
"title": "Place", "title": "Place",
@ -205,6 +245,15 @@
"find": true, "find": true,
"sort": true "sort": true
}, },
{
"id": "space",
"title": "Space",
"type": ["string"],
"columnWidth": 128,
"filter": true,
"find": true,
"sort": true
},
{ {
"id": "date", "id": "date",
"title": "Date", "title": "Date",
@ -223,11 +272,21 @@
"sort": true "sort": true
}, },
{ {
"id": "edition", "id": "volume",
"title": "Edition", "title": "Volume",
"type": "string", "type": "string",
"columnWidth": 128, "columnWidth": 128,
"find": true "find": true,
"additionalSort": [{"key": "issue", "operator": "-"}],
"sort": true
},
{
"id": "issue",
"title": "Issue",
"type": "string",
"columnWidth": 128,
"find": true,
"sort": true
}, },
{ {
"id": "language", "id": "language",
@ -238,6 +297,61 @@
"find": true, "find": true,
"sort": true "sort": true
}, },
{
"id": "movement",
"operator": "+",
"title": "Social Movements",
"type": ["string"],
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{
"id": "event",
"operator": "+",
"title": "Events",
"type": ["string"],
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{
"id": "associatedgroups",
"operator": "+",
"title": "Associated groups",
"type": ["string"],
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{
"id": "relatedpeople",
"operator": "+",
"title": "Related people",
"type": ["string"],
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{
"id": "tags",
"operator": "+",
"title": "Tags",
"type": ["string"],
"filter": true,
"find": true,
"sort": true,
"autocomplete": true,
"columnWidth": 256
},
{ {
"id": "id", "id": "id",
"operator": "+", "operator": "+",
@ -516,6 +630,7 @@
"id": "year", "id": "year",
"title": "Year", "title": "Year",
"type": "string", "type": "string",
"additionalSort": [{"key": "date", "operator": "+"}],
"autocomplete": true, "autocomplete": true,
"columnWidth": 60, "columnWidth": 60,
"filter": true, "filter": true,

View file

@ -202,6 +202,87 @@ pandora.ui.documentInfoView = function(data, isMixed) {
pandora.createLinks($info); pandora.createLinks($info);
} }
// Group & Publication description -----------------------------------------------------
if (!isMultiple) {
;['group', 'publication'].forEach(key => {
var $box = $('<div>').appendTo($data);
(data[key] ? pandora.api.findEntities : Ox.noop)({
query: {
conditions: [{
key: 'type', operator: '==', value: Ox.decodeHTMLEntities(key)
}, {
key: 'name', operator: '==', value: Ox.decodeHTMLEntities(data[key] || '')
}],
operator: '&'
},
keys: ['id', 'name', 'description']
}, function(result) {
if (data[key] && ((result && result.data.items.length == 1) || canEdit)) {
var entity = {}
if (result && result.data.items.length) {
entity = result.data.items[0]
}
$('<div>')
.html(Ox._('About {0}:', [data[key]]))
.css({
'padding-top': '4px',
'font-weight': 'bold'
})
.appendTo($box);
$('<div>')
.append(
Ox.EditableContent({
clickLink: pandora.clickLink,
editable: false,
format: function(value) {
return value.replace(
/<img src=/g,
'<img style="float: left; max-width: 256px; max-height: 256px; margin: 0 16px 16px 0" src='
);
},
placeholder: formatLight(Ox._('No {0} Description', [Ox._(Ox.toTitleCase(key))])),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: entity.description || ''
})
.css(css)
.css({
'text-align': ''
})
.bindEvent({
doubleclick: function(event) {
if (!canEdit) {
return
}
if (entity.id) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [entity.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
} else {
pandora.api.addEntity({
type: key,
name: data[key]
}, function(result) {
var set = {}
set['entitiesType'] = key
set['entitiesSelection.' + key] = [result.data.id];
pandora.UI.set(set);
pandora.$ui.entitiesDialog = pandora.ui.entitiesDialog().open();
})
}
}
})
).css({
margin: '12px 0',
})
.appendTo($box);
}
})
});
}
// Title ------------------------------------------------------------------- // Title -------------------------------------------------------------------
$('<div>') $('<div>')
@ -229,8 +310,16 @@ pandora.ui.documentInfoView = function(data, isMixed) {
// Director, Year and Country ---------------------------------------------- // Director, Year and Country ----------------------------------------------
renderGroup(['author', 'date', 'type']); renderGroup(['group', 'author']);
renderGroup(['publisher', 'place', 'series', 'edition', 'language']); renderGroup(['publication']);
renderGroup(['date', 'format', 'language']);
renderGroup(['publisher', 'series', 'volume', 'issue']);
renderGroup(['source', 'links']);
renderGroup(['place', 'space']);
renderGroup(['movement', 'event']);
renderGroup(['associatedgroups', 'relatedpeople']);
renderGroup(['tags']);
// Description ------------------------------------------------------------- // Description -------------------------------------------------------------