From dfa46712a8dcd66a828611ea899bce1216a22272 Mon Sep 17 00:00:00 2001 From: j Date: Wed, 9 May 2018 10:10:23 +0100 Subject: [PATCH] cleanup --- config.jsonc | 18 +++-- static/js/infoView.cms.js | 163 ++------------------------------------ 2 files changed, 15 insertions(+), 166 deletions(-) diff --git a/config.jsonc b/config.jsonc index c375e2e..66dea09 100644 --- a/config.jsonc +++ b/config.jsonc @@ -40,7 +40,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "capabilities": { "canAddItems": {"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}, "canEditDocuments": {"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}, "canManageTitlesAndNames": {"member": true, "staff": true, "admin": true}, "canManageUsers": {"staff": true, "admin": true}, - "canPlayClips": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, - "canPlayVideo": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, + "canPlayClips": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, + "canPlayVideo": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, "canReadText": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, "canRemoveItems": {"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}, "canSeeExtraItemViews": {"staff": true, "admin": true}, "canSeeMedia": {"staff": true, "admin": true}, - "canSeeDocument": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, - "canSeeItem": {"guest": 1, "member": 1, "staff": 4, "admin": 4}, + "canSeeDocument": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, + "canSeeItem": {"guest": 0, "member": 0, "staff": 1, "admin": 1}, "canSeeSize": {"staff": true, "admin": true}, "canSeeSoftwareVersion": {"staff": true, "admin": true}, "canSendMail": {"admin": true} @@ -577,7 +577,7 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "title": "Version", "type": "string", "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", "autocomplete": true, "overlap": true, + "hasEvents": true, + "hasPlaces": true, "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 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 assigned to each item. @@ -1426,4 +1428,4 @@ examples (config.SITENAME.jsonc) that are part of this pan.do/ra distribution. "resolutions": [240, 720], "torrent": false } -} \ No newline at end of file +} diff --git a/static/js/infoView.cms.js b/static/js/infoView.cms.js index a330a5b..866df52 100644 --- a/static/js/infoView.cms.js +++ b/static/js/infoView.cms.js @@ -34,10 +34,6 @@ pandora.ui.infoView = function(data) { return key.id; }), posterKeys = ['title', 'director', 'year'], - descriptions = { - names: getNames(), - studios: getStudios() - }, statisticsWidth = 128, $bar = Ox.Bar({size: 16}) @@ -215,7 +211,6 @@ pandora.ui.infoView = function(data) { $links, - $descriptions, $statistics = $('
') .css({ @@ -313,7 +308,7 @@ pandora.ui.infoView = function(data) { renderGroup(['productionCompany']); renderGroup([ - 'producer', 'codirector', 'writer', 'cinematographer', 'editor', + 'producer', 'writer', 'cinematographer', 'editor', ]); renderGroup(['actor']); @@ -335,21 +330,12 @@ pandora.ui.infoView = function(data) { ) .appendTo($text); - renderGroup(canSeeAllMetadata ? ['genre', 'topic'] : ['genre']); - - - renderGroup(['imdbId', 'links']); + renderGroup(['imdbId', 'genre']); if (canEdit) { updateIMDb(); } - // Encyclopedia and Wiki --------------------------------------------------- - - if (['staff', 'admin'].indexOf(pandora.user.level) > -1 && canEdit) { - renderGroup(['encyclopedia', 'wiki']); - } - // Summary ----------------------------------------------------------------- if (data.summary || canEdit) { @@ -381,12 +367,8 @@ pandora.ui.infoView = function(data) { .appendTo($text); } - // Descriptions ------------------------------------------------------------ - - $descriptions = $('
').attr({id: 'descriptions'}).appendTo($text); - - renderDescriptions(); - + $('
').css({height: '16px'}).appendTo($text); + renderGroup(['topic']); $('
').css({height: '16px'}).appendTo($text); if (data.parts && data.rendered) { @@ -466,7 +448,7 @@ pandora.ui.infoView = function(data) { var $rightsLevel = $('
'); var $div = $('
') .css({marginBottom: '4px'}) - .append(formatKey('Rights Level', 'link', '/copyrights')) + .append('Rights Level') .append($rightsLevel) .appendTo($statistics); pandora.createLinks($div); @@ -632,11 +614,6 @@ pandora.ui.infoView = function(data) { ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], true ) : ''; - } else if (key == 'links') { - ret = value.split(', ').map(function(link) { - return '' + Ox.parseURL(link).host + ''; - }).join(', '); - } else if (nameKeys.indexOf(key) > -1) { ret = formatLink(value.split(', '), 'name'); } 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) { return Ox.Theme.formatColorLevel( 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) { return !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(', ') + ') - ' - ) - .appendTo($descriptions), - $link = $('') - .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 = $('
') - .addClass('OxSelectable') - .css(css) - .hide() - .appendTo($descriptions); - pandora.createLinks($name); - Ox.EditableContent({ - clickLink: pandora.clickLink, - editable: canEdit, - format: function(value) { - return value.replace( - /