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,
"ui": {
"annotationsFont": "small",
"annotationsRange": "all",
"annotationsRange": "position",
"annotationsSize": 256,
"annotationsSort": "position",
"clipsColumns": 2,
"columns": {
"Colors": {

View file

@ -426,7 +426,8 @@ class Item(models.Model):
for l in settings.CONFIG['layers']:
name = l['id']
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':
qs = qs.exclude(value='')
if l.get('private'):
@ -1171,7 +1172,7 @@ class Item(models.Model):
'in': a.start,
'out': a.end,
'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):
i = kwargs['instance']

View file

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

View file

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

View file

@ -763,7 +763,14 @@ pandora.getVideoOptions = function(data) {
});
options.layers = [];
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;
};