This commit is contained in:
j 2018-05-09 10:10:23 +01:00
parent ee22835c96
commit dfa46712a8
2 changed files with 15 additions and 166 deletions

View file

@ -40,7 +40,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"capabilities": { "capabilities": {
"canAddItems": {"member": true, "staff": true, "admin": true}, "canAddItems": {"member": true, "staff": true, "admin": true},
"canAddDocuments": {"member": true, "staff": true, "admin": true}, "canAddDocuments": {"member": true, "staff": true, "admin": true},
"canDownloadVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canDownloadVideo": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canEditAnnotations": {"staff": true, "admin": true}, "canEditAnnotations": {"staff": true, "admin": true},
"canEditDocuments": {"staff": true, "admin": true}, "canEditDocuments": {"staff": true, "admin": true},
"canEditEntities": {"staff": true, "admin": true}, "canEditEntities": {"staff": true, "admin": true},
@ -64,8 +64,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"canManagePlacesAndEvents": {"member": true, "staff": true, "admin": true}, "canManagePlacesAndEvents": {"member": true, "staff": true, "admin": true},
"canManageTitlesAndNames": {"member": true, "staff": true, "admin": true}, "canManageTitlesAndNames": {"member": true, "staff": true, "admin": true},
"canManageUsers": {"staff": true, "admin": true}, "canManageUsers": {"staff": true, "admin": true},
"canPlayClips": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canPlayClips": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canPlayVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canPlayVideo": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canReadText": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, "canReadText": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canRemoveItems": {"admin": true}, "canRemoveItems": {"admin": true},
"canRemoveDocuments": {"admin": true}, "canRemoveDocuments": {"admin": true},
@ -74,8 +74,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"canSeeDebugMenu": {"staff": true, "admin": true}, "canSeeDebugMenu": {"staff": true, "admin": true},
"canSeeExtraItemViews": {"staff": true, "admin": true}, "canSeeExtraItemViews": {"staff": true, "admin": true},
"canSeeMedia": {"staff": true, "admin": true}, "canSeeMedia": {"staff": true, "admin": true},
"canSeeDocument": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canSeeDocument": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canSeeItem": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, "canSeeItem": {"guest": 0, "member": 0, "staff": 1, "admin": 1},
"canSeeSize": {"staff": true, "admin": true}, "canSeeSize": {"staff": true, "admin": true},
"canSeeSoftwareVersion": {"staff": true, "admin": true}, "canSeeSoftwareVersion": {"staff": true, "admin": true},
"canSendMail": {"admin": true} "canSendMail": {"admin": true}
@ -577,7 +577,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"title": "Version", "title": "Version",
"type": "string", "type": "string",
"columnWidth": 128, "columnWidth": 128,
"find": true, "find": true
}, },
{ {
@ -1045,6 +1045,8 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"item": "Keyword", "item": "Keyword",
"autocomplete": true, "autocomplete": true,
"overlap": true, "overlap": true,
"hasEvents": true,
"hasPlaces": true,
"type": "string" "type": "string"
}, },
{ {
@ -1137,7 +1139,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"rightsLevel" defines which initial rights level will be assigned to items "rightsLevel" defines which initial rights level will be assigned to items
and texts created by users of these user levels. and texts created by users of these user levels.
*/ */
"rightsLevel": {"member": 2, "staff": 2, "admin": 2}, "rightsLevel": {"member": 1, "staff": 1, "admin": 1},
/* /*
"rightsLevels" is an ordered list of rights levels, one of which will be "rightsLevels" is an ordered list of rights levels, one of which will be
assigned to each item. assigned to each item.
@ -1426,4 +1428,4 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution.
"resolutions": [240, 720], "resolutions": [240, 720],
"torrent": false "torrent": false
} }
} }

View file

@ -34,10 +34,6 @@ pandora.ui.infoView = function(data) {
return key.id; return key.id;
}), }),
posterKeys = ['title', 'director', 'year'], posterKeys = ['title', 'director', 'year'],
descriptions = {
names: getNames(),
studios: getStudios()
},
statisticsWidth = 128, statisticsWidth = 128,
$bar = Ox.Bar({size: 16}) $bar = Ox.Bar({size: 16})
@ -215,7 +211,6 @@ pandora.ui.infoView = function(data) {
$links, $links,
$descriptions,
$statistics = $('<div>') $statistics = $('<div>')
.css({ .css({
@ -313,7 +308,7 @@ pandora.ui.infoView = function(data) {
renderGroup(['productionCompany']); renderGroup(['productionCompany']);
renderGroup([ renderGroup([
'producer', 'codirector', 'writer', 'cinematographer', 'editor', 'producer', 'writer', 'cinematographer', 'editor',
]); ]);
renderGroup(['actor']); renderGroup(['actor']);
@ -335,21 +330,12 @@ pandora.ui.infoView = function(data) {
) )
.appendTo($text); .appendTo($text);
renderGroup(canSeeAllMetadata ? ['genre', 'topic'] : ['genre']); renderGroup(['imdbId', 'genre']);
renderGroup(['imdbId', 'links']);
if (canEdit) { if (canEdit) {
updateIMDb(); updateIMDb();
} }
// Encyclopedia and Wiki ---------------------------------------------------
if (['staff', 'admin'].indexOf(pandora.user.level) > -1 && canEdit) {
renderGroup(['encyclopedia', 'wiki']);
}
// Summary ----------------------------------------------------------------- // Summary -----------------------------------------------------------------
if (data.summary || canEdit) { if (data.summary || canEdit) {
@ -381,12 +367,8 @@ pandora.ui.infoView = function(data) {
.appendTo($text); .appendTo($text);
} }
// Descriptions ------------------------------------------------------------ $('<div>').css({height: '16px'}).appendTo($text);
renderGroup(['topic']);
$descriptions = $('<div>').attr({id: 'descriptions'}).appendTo($text);
renderDescriptions();
$('<div>').css({height: '16px'}).appendTo($text); $('<div>').css({height: '16px'}).appendTo($text);
if (data.parts && data.rendered) { if (data.parts && data.rendered) {
@ -466,7 +448,7 @@ pandora.ui.infoView = function(data) {
var $rightsLevel = $('<div>'); var $rightsLevel = $('<div>');
var $div = $('<div>') var $div = $('<div>')
.css({marginBottom: '4px'}) .css({marginBottom: '4px'})
.append(formatKey('Rights Level', 'link', '/copyrights')) .append('Rights Level')
.append($rightsLevel) .append($rightsLevel)
.appendTo($statistics); .appendTo($statistics);
pandora.createLinks($div); pandora.createLinks($div);
@ -632,11 +614,6 @@ pandora.ui.infoView = function(data) {
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length],
true true
) : ''; ) : '';
} else if (key == 'links') {
ret = value.split(', ').map(function(link) {
return '<a href="' + link + '">' + Ox.parseURL(link).host + '</a>';
}).join(', ');
} else if (nameKeys.indexOf(key) > -1) { } else if (nameKeys.indexOf(key) > -1) {
ret = formatLink(value.split(', '), 'name'); ret = formatLink(value.split(', '), 'name');
} else if (listKeys.indexOf(key) > -1) { } else if (listKeys.indexOf(key) > -1) {
@ -715,29 +692,6 @@ pandora.ui.infoView = function(data) {
}); });
} }
function getNames() {
var names = [];
nameKeys.forEach(function(key) {
data[key] && data[key].forEach(function(name) {
var index = Ox.indexOf(names, function(value) {
return value.name == name;
});
if (index == -1) {
names.push({
name: name,
keys: [key],
description: data.namedescription
? data.namedescription[name]
: void 0
});
} else {
names[index].keys.push(key);
}
});
});
return names;
}
function getRightsLevelElement(rightsLevel) { function getRightsLevelElement(rightsLevel) {
return Ox.Theme.formatColorLevel( return Ox.Theme.formatColorLevel(
rightsLevel, rightsLevel,
@ -747,22 +701,6 @@ pandora.ui.infoView = function(data) {
); );
} }
function getStudios() {
var studios = [];
if (data.productionCompany) {
data.productionCompany.forEach(function(studio) {
studios.push({
name: studio,
keys: ['productionCompany'],
description: data.productionCompanydescription
? data.productionCompanydescription[studio]
: void 0
});
});
}
return studios;
}
function getValue(key, value) { function getValue(key, value) {
return !value ? '' return !value ? ''
: key == 'alternativeTitles' ? value.map(function(value) { : key == 'alternativeTitles' ? value.map(function(value) {
@ -853,97 +791,6 @@ pandora.ui.infoView = function(data) {
}); });
} }
function renderDescriptions() {
$descriptions.empty();
['studios', 'names'].forEach(function(key) {
descriptions[key].forEach(function(value) {
if (canEdit || value.description) {
var filmography = key == 'studios' ? Ox._('Films') : Ox._('Filmography'),
$name = Ox.Element()
.addClass('OxSelectable')
.css(css)
.css({marginTop: '12px', fontWeight: 'bold'})
.html(
formatLink(
value.name,
key == 'studios' ? 'productionCompany' : 'name'
) + ' (' + value.keys.map(function(key) {
return formatKey(key, 'description');
}).join(', ') + ') -&nbsp;'
)
.appendTo($descriptions),
$link = $('<span>')
.addClass('OxLink')
.css({fontWeight: 'bold'})
.html(Ox._('Show {0}', [filmography]))
.one({
click: function() {
$link.removeClass('OxLink')
.html(Ox._('Loading {0}...', [filmography]));
getFilmography(
key == 'studios' ? 'productionCompany' : 'name',
Ox.decodeHTMLEntities(value.name),
value.keys,
function($element) {
$link.addClass('OxLink')
.html(Ox._('Hide {0}', [filmography]))
.on({
click: function() {
if (Ox.startsWith($link.html(), Ox._('Show'))) {
$link.html(Ox._('Hide {0}', [filmography]));
$text.show();
} else {
$link.html(Ox._('Show {0}', [filmography]));
$text.hide();
}
}
});
$text.append($element).show();
}
);
}
})
.appendTo($name),
$text = $('<div>')
.addClass('OxSelectable')
.css(css)
.hide()
.appendTo($descriptions);
pandora.createLinks($name);
Ox.EditableContent({
clickLink: pandora.clickLink,
editable: canEdit,
format: function(value) {
return value.replace(
/<img /g,
'<img style="max-width: 256px; max-height: 256px; margin: 0 16px 16px 0; float: left;" '
);
},
placeholder: formatLight(Ox._('No Description')),
tooltip: canEdit ? pandora.getEditTooltip() : '',
type: 'textarea',
value: value.description || ''
})
.css(css)
.css({
overflow: 'hidden'
})
.bindEvent({
submit: function(data) {
editMetadata(
key == 'studios'
? 'productionCompanydescription'
: 'namedescription',
Ox.extend({}, value.name, data.value)
);
}
})
.appendTo($descriptions);
}
});
});
}
function renderGroup(keys) { function renderGroup(keys) {
var $element; var $element;
if (canEdit || keys.filter(function(key) { if (canEdit || keys.filter(function(key) {