Compare commits

..

No commits in common. "6e10bb17d2b5bc5392fd65973174595852dd9a0b" and "05aa23166ea9a28657b1988b681ec8d7937e0412" have entirely different histories.

8 changed files with 41 additions and 81 deletions

View file

@ -378,8 +378,6 @@ class Annotation(models.Model):
streams = self.item.streams() streams = self.item.streams()
if streams: if streams:
j['videoRatio'] = streams[0].aspect_ratio j['videoRatio'] = streams[0].aspect_ratio
if 'clip' in keys:
j[key] = self.clip.public_id
for key in keys: for key in keys:
if key not in j: if key not in j:
if key in self._clip_keys: if key in self._clip_keys:

View file

@ -78,7 +78,7 @@ def findClips(request, data):
takes { takes {
query: object, // find clips, query object, see `find` query: object, // find clips, query object, see `find`
itemsQuery: object, // limit to matching items, 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 positions: [int], // list of positions
range: [int, int], // range of results to return range: [int, int], // range of results to return
sort: [object] // list of sort objects, see `find` sort: [object] // list of sort objects, see `find`

View file

@ -621,6 +621,19 @@ pandora.ui.infoView = function(data, isMixed) {
$('<div>').css({height: '16px'}).appendTo($statistics); $('<div>').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) { function editMetadata(key, value) {
if (value != data[key]) { if (value != data[key]) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key); var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
@ -648,7 +661,7 @@ pandora.ui.infoView = function(data, isMixed) {
edit[key] = value; edit[key] = value;
} }
if (itemKey && itemKey.type && itemKey.type[0] == 'date') { 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) { pandora.api.edit(edit, function(result) {
if (!isMultiple) { if (!isMultiple) {
@ -750,14 +763,14 @@ pandora.ui.infoView = function(data, isMixed) {
specialListKeys.indexOf(key) > -1 && itemKey && itemKey.type[0] == 'date' specialListKeys.indexOf(key) > -1 && itemKey && itemKey.type[0] == 'date'
) { ) {
ret = value.split('; ').map(function(date) { ret = value.split('; ').map(function(date) {
date = pandora.cleanupDate(date) date = cleanupDate(date)
return date ? formatLink(Ox.formatDate(date, return date ? formatLink(Ox.formatDate(date,
['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length], ['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length],
true true
), key, date) : ''; ), key, date) : '';
}).join('; '); }).join('; ');
} else if (['releasedate'].indexOf(key) > -1) { } else if (['releasedate'].indexOf(key) > -1) {
value = pandora.cleanupDate(value); value = cleanupDate(value);
ret = value ? Ox.formatDate(value, ret = value ? Ox.formatDate(value,
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length], ['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length],
true true

View file

@ -38,15 +38,6 @@ pandora.ui.infoView = function(data, isMixed) {
}) })
), ),
posterKeys = nameKeys.concat(['title', 'year']), 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, statisticsWidth = 128,
$bar = Ox.Bar({size: 16}) $bar = Ox.Bar({size: 16})
@ -245,18 +236,14 @@ pandora.ui.infoView = function(data, isMixed) {
) )
.appendTo($text); .appendTo($text);
// Director, Year and Country, Language -------------------------------- // Director, Year and Country ----------------------------------------------
renderGroup(['director', 'year', 'country', 'language']); renderGroup(['director', 'year', 'country']);
// Featuring ---------------------------------------------- // Featuring ----------------------------------------------
renderGroup(['featuring']); renderGroup(['featuring']);
// Render any remaing keys defined in config
renderRemainingKeys();
// Summary ----------------------------------------------------------------- // Summary -----------------------------------------------------------------
if (canEdit || data.summary) { if (canEdit || data.summary) {
@ -291,7 +278,6 @@ pandora.ui.infoView = function(data, isMixed) {
.appendTo($text); .appendTo($text);
} }
// Duration, Aspect Ratio -------------------------------------------------- // Duration, Aspect Ratio --------------------------------------------------
if (!isMultiple) { if (!isMultiple) {
['duration', 'aspectratio'].forEach(function(key) { ['duration', 'aspectratio'].forEach(function(key) {
@ -385,6 +371,19 @@ pandora.ui.infoView = function(data, isMixed) {
$('<div>').css({height: '16px'}).appendTo($statistics); $('<div>').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) { function editMetadata(key, value) {
if (value != data[key]) { if (value != data[key]) {
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key); var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
@ -401,7 +400,7 @@ pandora.ui.infoView = function(data, isMixed) {
edit[key] = value ? value : null; edit[key] = value ? value : null;
} }
if (itemKey && itemKey.type && itemKey.type[0] == 'date') { 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) { pandora.api.edit(edit, function(result) {
if (!isMultiple) { 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' listKeys.indexOf(key) > -1 && Ox.getObjectById(pandora.site.itemKeys, key).type[0] == 'date'
) { ) {
ret = value.split('; ').map(function(date) { ret = value.split('; ').map(function(date) {
date = pandora.cleanupDate(date) date = cleanupDate(date)
return date ? formatLink(Ox.formatDate(date, return date ? formatLink(Ox.formatDate(date,
['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length], ['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length],
true true
@ -589,7 +588,6 @@ pandora.ui.infoView = function(data, isMixed) {
function renderGroup(keys) { function renderGroup(keys) {
var $element; var $element;
keys.forEach(function(key) { displayedKeys.push(key) });
if (canEdit || keys.filter(function(key) { if (canEdit || keys.filter(function(key) {
return data[key]; return data[key];
}).length) { }).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() { function renderRightsLevel() {
var $rightsLevelElement = getRightsLevelElement(data.rightslevel), var $rightsLevelElement = getRightsLevelElement(data.rightslevel),
$rightsLevelSelect; $rightsLevelSelect;

View file

@ -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
};

View file

@ -41,28 +41,11 @@ pandora.ui.item = function() {
pandora.user.ui.itemView.slice(0, 1) pandora.user.ui.itemView.slice(0, 1)
) > -1 ? 'an': 'a') + ' ' ) > -1 ? 'an': 'a') + ' '
+'{1} view.', [result.data.title, Ox._(pandora.user.ui.itemView)]); +'{1} view.', [result.data.title, Ox._(pandora.user.ui.itemView)]);
pandora.$ui.contentPanel.replaceElement(1,
var note = Ox.Element() Ox.Element()
.css({marginTop: '32px', fontSize: '12px', textAlign: 'center'}) .css({marginTop: '32px', fontSize: '12px', textAlign: 'center'})
pandora.$ui.contentPanel.replaceElement(1, note); .html(html)
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._(
'<i>{0}</i> 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.site.itemViews.filter(function(view) { pandora.site.itemViews.filter(function(view) {
return view.id == 'documents'; return view.id == 'documents';
}).length && pandora.api.get({ }).length && pandora.api.get({

View file

@ -229,10 +229,8 @@ pandora.ui.mainMenu = function() {
{ id: 'names', title: Ox._('Manage Names...'), disabled: !pandora.hasCapability('canManageTitlesAndNames') }, { id: 'names', title: Ox._('Manage Names...'), disabled: !pandora.hasCapability('canManageTitlesAndNames') },
{ id: 'translations', title: Ox._('Manage Translations...'), disabled: !pandora.hasCapability('canManageTranslations') }, { id: 'translations', title: Ox._('Manage Translations...'), disabled: !pandora.hasCapability('canManageTranslations') },
{}, {},
pandora.hasView('map') { id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') },
? [{ id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [], { id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') },
pandora.hasView('calendar')
? [{ id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') }] : [],
{}, {},
{ id: 'users', title: Ox._('Manage Users...'), disabled: !pandora.hasCapability('canManageUsers') }, { id: 'users', title: Ox._('Manage Users...'), disabled: !pandora.hasCapability('canManageUsers') },
{ id: 'statistics', title: Ox._('Statistics...'), disabled: !pandora.hasCapability('canManageUsers') }, { id: 'statistics', title: Ox._('Statistics...'), disabled: !pandora.hasCapability('canManageUsers') },

View file

@ -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) { pandora.isClipView = function(view, item) {
if (pandora.user.ui.section == 'items') { if (pandora.user.ui.section == 'items') {