update VideoEditor/AnnotationPanel/Editable integration

This commit is contained in:
j 2012-01-04 01:47:44 +05:30
parent 3c9676a32a
commit 1c408c78e5
5 changed files with 21 additions and 5 deletions

View file

@ -595,8 +595,9 @@
"newsletter": true, "newsletter": true,
"ui": { "ui": {
"annotationsFont": "small", "annotationsFont": "small",
"annotationsRange": "all", "annotationsRange": "position",
"annotationsSize": 256, "annotationsSize": 256,
"annotationsSort": "position",
"clipsColumns": 2, "clipsColumns": 2,
"columns": { "columns": {
"Colors": { "Colors": {

View file

@ -426,7 +426,8 @@ class Item(models.Model):
for l in settings.CONFIG['layers']: for l in settings.CONFIG['layers']:
name = l['id'] name = l['id']
ll = layers.setdefault(name, []) ll = layers.setdefault(name, [])
qs = Annotation.objects.filter(layer=name, item=self) qs = Annotation.objects.filter(layer=name, item=self).order_by(
'start', 'end', 'sortvalue')
if name == 'subtitles': if name == 'subtitles':
qs = qs.exclude(value='') qs = qs.exclude(value='')
if l.get('private'): if l.get('private'):
@ -1171,7 +1172,7 @@ class Item(models.Model):
'in': a.start, 'in': a.start,
'out': a.end, 'out': a.end,
'value': a.value 'value': a.value
} for a in self.annotations.filter(layer=layer).order_by('start')]) } for a in self.annotations.filter(layer=layer).order_by('start', 'end', 'sortvalue')])
def delete_item(sender, **kwargs): def delete_item(sender, **kwargs):
i = kwargs['instance'] i = kwargs['instance']

View file

@ -490,8 +490,9 @@
"level": "guest", "level": "guest",
"ui": { "ui": {
"annotationsFont": "small", "annotationsFont": "small",
"annotationsRange": "all", "annotationsRange": "position",
"annotationsSize": 256, "annotationsSize": 256,
"annotationsSort": "position",
"clipsColumns": 2, "clipsColumns": 2,
"columns": { "columns": {
"Colors": { "Colors": {

View file

@ -197,6 +197,7 @@ pandora.ui.item = function() {
annotationsFont: pandora.user.ui.annotationsFont, annotationsFont: pandora.user.ui.annotationsFont,
annotationsRange: pandora.user.ui.annotationsRange, annotationsRange: pandora.user.ui.annotationsRange,
annotationsSize: pandora.user.ui.annotationsSize, annotationsSize: pandora.user.ui.annotationsSize,
annotationsSort: pandora.user.ui.annotationsSort,
censored: videoOptions.censored, censored: videoOptions.censored,
cuts: result.data.cuts || [], cuts: result.data.cuts || [],
duration: result.data.duration, duration: result.data.duration,
@ -244,6 +245,9 @@ pandora.ui.item = function() {
annotationsSize: function(data) { annotationsSize: function(data) {
pandora.UI.set({annotationsSize: data.size}); pandora.UI.set({annotationsSize: data.size});
}, },
annotationsSort: function(data) {
pandora.UI.set({annotationsSort: data.sort});
},
find: function(data) { find: function(data) {
pandora.UI.set('itemFind', data.find ? { pandora.UI.set('itemFind', data.find ? {
conditions: [{key: 'subtitles', value: data.find, operator: '='}], conditions: [{key: 'subtitles', value: data.find, operator: '='}],
@ -289,6 +293,8 @@ pandora.ui.item = function() {
out: data.out, out: data.out,
value: data.value, value: data.value,
}, function(result) { }, function(result) {
result.data.editable = true;
result.data.duration = result.data.out - result.data['in'];
pandora.$ui.editor.addAnnotation(data.layer, result.data); pandora.$ui.editor.addAnnotation(data.layer, result.data);
}); });
}, },

View file

@ -763,7 +763,14 @@ pandora.getVideoOptions = function(data) {
}); });
options.layers = []; options.layers = [];
pandora.site.layers.forEach(function(layer, i) { pandora.site.layers.forEach(function(layer, i) {
options.layers[i] = Ox.extend({}, layer, {items: data.layers[layer.id]}); options.layers[i] = Ox.extend({}, layer, {
items: data.layers[layer.id].map(function(annotation) {
annotation.duration = annotation.out - annotation['in'];
annotation.editable = annotation.user == pandora.user.username ||
pandora.site.capabilities['canEditAnnotations'][pandora.user.level];
return annotation;
})
});
}); });
return options; return options;
}; };