diff --git a/pandora/annotation/models.py b/pandora/annotation/models.py index 0326e37d..470af358 100644 --- a/pandora/annotation/models.py +++ b/pandora/annotation/models.py @@ -378,8 +378,6 @@ class Annotation(models.Model): streams = self.item.streams() if streams: j['videoRatio'] = streams[0].aspect_ratio - if 'clip' in keys: - j[key] = self.clip.public_id for key in keys: if key not in j: if key in self._clip_keys: diff --git a/pandora/clip/views.py b/pandora/clip/views.py index 7c2fcd23..700a95a1 100644 --- a/pandora/clip/views.py +++ b/pandora/clip/views.py @@ -78,7 +78,7 @@ def findClips(request, data): takes { query: object, // find clips, query object, see `find` itemsQuery: object, // limit to matching items, query object, see `find` - keys: [string], // list of properties to return, include 'annotations' to get all annotations for a clip + keys: [string], // list of properties to return positions: [int], // list of positions range: [int, int], // range of results to return sort: [object] // list of sort objects, see `find` diff --git a/static/js/infoView.indiancinema.js b/static/js/infoView.indiancinema.js index 277c706d..9776dd42 100644 --- a/static/js/infoView.indiancinema.js +++ b/static/js/infoView.indiancinema.js @@ -621,6 +621,19 @@ pandora.ui.infoView = function(data, isMixed) { $('
').css({height: '16px'}).appendTo($statistics); + function cleanupDate(value) { + if (/\d{2}-\d{2}-\d{4}/.test(value)) { + value = Ox.reverse(value.split('-')).join('-') + } + if (/\d{4}i\/\d{2}\/\d{d}/.test(value)) { + value = value.split('/').join('-') + } + if (/\d{2}\/\d{2}\/\d{4}/.test(value)) { + value = Ox.reverse(value.split('/')).join('-') + } + return value + } + function editMetadata(key, value) { if (value != data[key]) { var itemKey = Ox.getObjectById(pandora.site.itemKeys, key); @@ -648,7 +661,7 @@ pandora.ui.infoView = function(data, isMixed) { edit[key] = value; } if (itemKey && itemKey.type && itemKey.type[0] == 'date') { - edit[key] = edit[key].map(pandora.cleanupDate); + edit[key] = edit[key].map(cleanupDate); } pandora.api.edit(edit, function(result) { if (!isMultiple) { @@ -750,14 +763,14 @@ pandora.ui.infoView = function(data, isMixed) { specialListKeys.indexOf(key) > -1 && itemKey && itemKey.type[0] == 'date' ) { ret = value.split('; ').map(function(date) { - date = pandora.cleanupDate(date) + date = cleanupDate(date) return date ? formatLink(Ox.formatDate(date, ['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length], true ), key, date) : ''; }).join('; '); } else if (['releasedate'].indexOf(key) > -1) { - value = pandora.cleanupDate(value); + value = cleanupDate(value); ret = value ? Ox.formatDate(value, ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], true diff --git a/static/js/infoView.js b/static/js/infoView.js index abdc4180..9c18ff69 100644 --- a/static/js/infoView.js +++ b/static/js/infoView.js @@ -38,15 +38,6 @@ pandora.ui.infoView = function(data, isMixed) { }) ), posterKeys = nameKeys.concat(['title', 'year']), - displayedKeys = [ // FIXME: can tis be a flag in the config? - 'title', 'notes', 'name', 'summary', 'id', - 'hue', 'saturation', 'lightness', 'cutsperminute', 'volume', - 'user', 'rightslevel', 'bitrate', 'timesaccessed', - 'numberoffiles', 'numberofannotations', 'numberofcuts', 'words', 'wordsperminute', - 'duration', 'aspectratio', 'pixels', 'size', 'resolution', - 'created', 'modified', 'accessed', - 'random' - ], statisticsWidth = 128, $bar = Ox.Bar({size: 16}) @@ -245,18 +236,14 @@ pandora.ui.infoView = function(data, isMixed) { ) .appendTo($text); - // Director, Year and Country, Language -------------------------------- + // Director, Year and Country ---------------------------------------------- - renderGroup(['director', 'year', 'country', 'language']); + renderGroup(['director', 'year', 'country']); // Featuring ---------------------------------------------- renderGroup(['featuring']); - // Render any remaing keys defined in config - - renderRemainingKeys(); - // Summary ----------------------------------------------------------------- if (canEdit || data.summary) { @@ -291,7 +278,6 @@ pandora.ui.infoView = function(data, isMixed) { .appendTo($text); } - // Duration, Aspect Ratio -------------------------------------------------- if (!isMultiple) { ['duration', 'aspectratio'].forEach(function(key) { @@ -385,6 +371,19 @@ pandora.ui.infoView = function(data, isMixed) { $('
').css({height: '16px'}).appendTo($statistics); + function cleanupDate(value) { + if (/\d{2}-\d{2}-\d{4}/.test(value)) { + value = Ox.reverse(value.split('-')).join('-') + } + if (/\d{4}i\/\d{2}\/\d{d}/.test(value)) { + value = value.split('/').join('-') + } + if (/\d{2}\/\d{2}\/\d{4}/.test(value)) { + value = Ox.reverse(value.split('/')).join('-') + } + return value + } + function editMetadata(key, value) { if (value != data[key]) { var itemKey = Ox.getObjectById(pandora.site.itemKeys, key); @@ -401,7 +400,7 @@ pandora.ui.infoView = function(data, isMixed) { edit[key] = value ? value : null; } if (itemKey && itemKey.type && itemKey.type[0] == 'date') { - edit[key] = edit[key].map(pandora.cleanupDate); + edit[key] = edit[key].map(cleanupDate); } pandora.api.edit(edit, function(result) { if (!isMultiple) { @@ -475,7 +474,7 @@ pandora.ui.infoView = function(data, isMixed) { listKeys.indexOf(key) > -1 && Ox.getObjectById(pandora.site.itemKeys, key).type[0] == 'date' ) { ret = value.split('; ').map(function(date) { - date = pandora.cleanupDate(date) + date = cleanupDate(date) return date ? formatLink(Ox.formatDate(date, ['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length], true @@ -589,7 +588,6 @@ pandora.ui.infoView = function(data, isMixed) { function renderGroup(keys) { var $element; - keys.forEach(function(key) { displayedKeys.push(key) }); if (canEdit || keys.filter(function(key) { return data[key]; }).length) { @@ -621,17 +619,6 @@ pandora.ui.infoView = function(data, isMixed) { } } - function renderRemainingKeys() { - var keys = pandora.site.itemKeys.filter(function(item) { - return item.id != '*' && item.type != 'layer' && !Ox.contains(displayedKeys, item.id); - }).map(function(item) { - return item.id; - }); - if (keys.length) { - renderGroup(keys) - } - } - function renderRightsLevel() { var $rightsLevelElement = getRightsLevelElement(data.rightslevel), $rightsLevelSelect; diff --git a/static/js/infoViewUtils.js b/static/js/infoViewUtils.js deleted file mode 100644 index 9ab90665..00000000 --- a/static/js/infoViewUtils.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - - -pandora.cleanupDate = function(value) { - if (/\d{2}-\d{2}-\d{4}/.test(value)) { - value = Ox.reverse(value.split('-')).join('-') - } - if (/\d{4}i\/\d{2}\/\d{d}/.test(value)) { - value = value.split('/').join('-') - } - if (/\d{2}\/\d{2}\/\d{4}/.test(value)) { - value = Ox.reverse(value.split('/')).join('-') - } - return value -}; - diff --git a/static/js/item.js b/static/js/item.js index c5045d1f..91c9b8f4 100644 --- a/static/js/item.js +++ b/static/js/item.js @@ -41,28 +41,11 @@ pandora.ui.item = function() { pandora.user.ui.itemView.slice(0, 1) ) > -1 ? 'an': 'a') + ' ' +'{1} view.', [result.data.title, Ox._(pandora.user.ui.itemView)]); - - var note = Ox.Element() - .css({marginTop: '32px', fontSize: '12px', textAlign: 'center'}) - pandora.$ui.contentPanel.replaceElement(1, note); - if (pandora.user.username == item.user || pandora.hasCapability('canSeeAllTasks')) { - pandora.api.getTasks({ - user: pandora.hasCapability('canSeeAllTasks') ? '' : pandora.user.username - }, function(result_) { - var tasks = result_.data.items.filter(function(task) { return task.item == item}) - if (tasks.length == 0) { - html = Ox._( - '{0} is currently processed. ' - + '{1} view will be available in a moment.', - [result.data.title, Ox._(pandora.user.ui.itemView)] - ) - } - note.html(html) - }) - } else { - note.html(html) - } - + pandora.$ui.contentPanel.replaceElement(1, + Ox.Element() + .css({marginTop: '32px', fontSize: '12px', textAlign: 'center'}) + .html(html) + ); pandora.site.itemViews.filter(function(view) { return view.id == 'documents'; }).length && pandora.api.get({ diff --git a/static/js/mainMenu.js b/static/js/mainMenu.js index 87bfbc52..b797b4bd 100644 --- a/static/js/mainMenu.js +++ b/static/js/mainMenu.js @@ -229,10 +229,8 @@ pandora.ui.mainMenu = function() { { id: 'names', title: Ox._('Manage Names...'), disabled: !pandora.hasCapability('canManageTitlesAndNames') }, { id: 'translations', title: Ox._('Manage Translations...'), disabled: !pandora.hasCapability('canManageTranslations') }, {}, - pandora.hasView('map') - ? [{ id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [], - pandora.hasView('calendar') - ? [{ id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [], + { id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }, + { id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }, {}, { id: 'users', title: Ox._('Manage Users...'), disabled: !pandora.hasCapability('canManageUsers') }, { id: 'statistics', title: Ox._('Statistics...'), disabled: !pandora.hasCapability('canManageUsers') }, diff --git a/static/js/utils.js b/static/js/utils.js index ae2758cc..32c40c08 100644 --- a/static/js/utils.js +++ b/static/js/utils.js @@ -2489,9 +2489,6 @@ pandora.hasPlacesLayer = function() { }); }; -pandora.hasView = function(id) { - return !!(Ox.getObjectById(pandora.site.itemViews, id) || Ox.getObjectById(pandora.site.listViews, id)) -}; pandora.isClipView = function(view, item) { if (pandora.user.ui.section == 'items') {