add first annotation

This commit is contained in:
j 2011-02-25 16:03:41 +01:00
parent dbdf12945d
commit a022c37d81
2 changed files with 9 additions and 18 deletions

View file

@ -49,7 +49,8 @@ def addAnnotation(request):
}
return {'status': {'code': int, 'text': string},
'data': {
'annotation': {}s
id: 123,
...
}
}
'''
@ -72,8 +73,7 @@ def addAnnotation(request):
start=float(data['in']), end=float(data['out']),
value=data['value'])
annotation.save()
response = json_response()
response['data']['annotation'] = annotation.json()
response = json_response(annotation.json())
return render_to_json_response(response)
response = {'status': {'code': 501, 'text': 'not implemented'}}
@ -119,6 +119,8 @@ def editAnnotation(request):
}
return {'status': {'code': int, 'text': string},
'data': {
id:
...
}
}
'''
@ -130,10 +132,8 @@ def editAnnotation(request):
a.start = data['in']
a.end = data['out']
a.save()
response['data'] = a.json()
else:
response = json_response(status=403, text='permission denied')
return render_to_json_response(response)
response = json_response(status=501, text='not implemented')
return render_to_json_response(response)
actions.register(editAnnotation, cache=False)

View file

@ -1825,16 +1825,7 @@
video.width = parseInt(video.height * video.aspectRatio / 2) * 2;
video.url = video.baseUrl + '/' + video.height + 'p.' + format;
$.each(app.config.layers, function(i, layer) {
layers[i] = $.extend({}, layer);
if (result.data.item.layers[layer.id])
layers[i]['items'] = result.data.item.layers[layer.id];
else
layers[i]['items'] = [{
'in': 5,
'out': 10,
'value': 'This annotation is just a test...'
}];
layers[i] = $.extend({}, layer, {items: result.data.item.layers[layer.id]});
});
app.$ui.contentPanel.replace(1, app.$ui.editor = new Ox.VideoEditor({
annotationsSize: app.user.ui.annotationsSize,
@ -1872,9 +1863,9 @@
addAnnotation: function(event, data) {
Ox.print('addAnnotation', data);
data.item = app.user.ui.item;
data.value = 'Click to change text';
data.value = 'Click to edit';
pandora.api.addAnnotation(data, function(result) {
app.$ui.editor.addAnnotation(data.layer, result.data.annotation);
app.$ui.editor.addAnnotation(data.layer, result.data);
});
},
removeAnnotations: function(event, data) {