Compare commits
5 commits
05aa23166e
...
6e10bb17d2
| Author | SHA1 | Date | |
|---|---|---|---|
| 6e10bb17d2 | |||
| f012d99942 | |||
| f60222c9b5 | |||
| aaf444ae96 | |||
| faeb2ddd2d |
8 changed files with 81 additions and 41 deletions
|
|
@ -378,6 +378,8 @@ 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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
keys: [string], // list of properties to return, include 'annotations' to get all annotations for a clip
|
||||
positions: [int], // list of positions
|
||||
range: [int, int], // range of results to return
|
||||
sort: [object] // list of sort objects, see `find`
|
||||
|
|
|
|||
|
|
@ -621,19 +621,6 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
$('<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) {
|
||||
if (value != data[key]) {
|
||||
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
|
||||
|
|
@ -661,7 +648,7 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
edit[key] = value;
|
||||
}
|
||||
if (itemKey && itemKey.type && itemKey.type[0] == 'date') {
|
||||
edit[key] = edit[key].map(cleanupDate);
|
||||
edit[key] = edit[key].map(pandora.cleanupDate);
|
||||
}
|
||||
pandora.api.edit(edit, function(result) {
|
||||
if (!isMultiple) {
|
||||
|
|
@ -763,14 +750,14 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
specialListKeys.indexOf(key) > -1 && itemKey && itemKey.type[0] == 'date'
|
||||
) {
|
||||
ret = value.split('; ').map(function(date) {
|
||||
date = cleanupDate(date)
|
||||
date = pandora.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 = cleanupDate(value);
|
||||
value = pandora.cleanupDate(value);
|
||||
ret = value ? Ox.formatDate(value,
|
||||
['', '%Y', '%B %Y', '%B %e, %Y'][value.split('-').length],
|
||||
true
|
||||
|
|
|
|||
|
|
@ -38,6 +38,15 @@ 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})
|
||||
|
|
@ -236,14 +245,18 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
)
|
||||
.appendTo($text);
|
||||
|
||||
// Director, Year and Country ----------------------------------------------
|
||||
// Director, Year and Country, Language --------------------------------
|
||||
|
||||
renderGroup(['director', 'year', 'country']);
|
||||
renderGroup(['director', 'year', 'country', 'language']);
|
||||
|
||||
// Featuring ----------------------------------------------
|
||||
|
||||
renderGroup(['featuring']);
|
||||
|
||||
// Render any remaing keys defined in config
|
||||
|
||||
renderRemainingKeys();
|
||||
|
||||
// Summary -----------------------------------------------------------------
|
||||
|
||||
if (canEdit || data.summary) {
|
||||
|
|
@ -278,6 +291,7 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
.appendTo($text);
|
||||
}
|
||||
|
||||
|
||||
// Duration, Aspect Ratio --------------------------------------------------
|
||||
if (!isMultiple) {
|
||||
['duration', 'aspectratio'].forEach(function(key) {
|
||||
|
|
@ -371,19 +385,6 @@ pandora.ui.infoView = function(data, isMixed) {
|
|||
|
||||
$('<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) {
|
||||
if (value != data[key]) {
|
||||
var itemKey = Ox.getObjectById(pandora.site.itemKeys, key);
|
||||
|
|
@ -400,7 +401,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(cleanupDate);
|
||||
edit[key] = edit[key].map(pandora.cleanupDate);
|
||||
}
|
||||
pandora.api.edit(edit, function(result) {
|
||||
if (!isMultiple) {
|
||||
|
|
@ -474,7 +475,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 = cleanupDate(date)
|
||||
date = pandora.cleanupDate(date)
|
||||
return date ? formatLink(Ox.formatDate(date,
|
||||
['', '%Y', '%B %Y', '%B %e, %Y'][date.split('-').length],
|
||||
true
|
||||
|
|
@ -588,6 +589,7 @@ 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) {
|
||||
|
|
@ -619,6 +621,17 @@ 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;
|
||||
|
|
|
|||
16
static/js/infoViewUtils.js
Normal file
16
static/js/infoViewUtils.js
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
'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
|
||||
};
|
||||
|
||||
|
|
@ -41,11 +41,28 @@ pandora.ui.item = function() {
|
|||
pandora.user.ui.itemView.slice(0, 1)
|
||||
) > -1 ? 'an': 'a') + ' '
|
||||
+'{1} view.', [result.data.title, Ox._(pandora.user.ui.itemView)]);
|
||||
pandora.$ui.contentPanel.replaceElement(1,
|
||||
Ox.Element()
|
||||
.css({marginTop: '32px', fontSize: '12px', textAlign: 'center'})
|
||||
.html(html)
|
||||
);
|
||||
|
||||
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._(
|
||||
'<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) {
|
||||
return view.id == 'documents';
|
||||
}).length && pandora.api.get({
|
||||
|
|
|
|||
|
|
@ -229,8 +229,10 @@ pandora.ui.mainMenu = function() {
|
|||
{ id: 'names', title: Ox._('Manage Names...'), disabled: !pandora.hasCapability('canManageTitlesAndNames') },
|
||||
{ id: 'translations', title: Ox._('Manage Translations...'), disabled: !pandora.hasCapability('canManageTranslations') },
|
||||
{},
|
||||
{ id: 'places', title: Ox._('Manage Places...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') },
|
||||
{ id: 'events', title: Ox._('Manage Events...'), disabled: !pandora.hasCapability('canManagePlacesAndEvents') },
|
||||
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: 'users', title: Ox._('Manage Users...'), disabled: !pandora.hasCapability('canManageUsers') },
|
||||
{ id: 'statistics', title: Ox._('Statistics...'), disabled: !pandora.hasCapability('canManageUsers') },
|
||||
|
|
|
|||
|
|
@ -2489,6 +2489,9 @@ 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') {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue