From b1924e3c47ba1d56373f149b25b01759db6f0d8b Mon Sep 17 00:00:00 2001 From: j <0x006A@0x2620.org> Date: Tue, 18 Jan 2011 15:24:14 +0530 Subject: [PATCH] annotations/icons/list description --- pandora/annotaion/models.py | 28 +++++++++++++++++----------- pandora/annotaion/views.py | 4 ++-- pandora/item/models.py | 1 + pandora/itemlist/views.py | 4 ++++ 4 files changed, 24 insertions(+), 13 deletions(-) diff --git a/pandora/annotaion/models.py b/pandora/annotaion/models.py index 9606ebf74..e7501dc92 100644 --- a/pandora/annotaion/models.py +++ b/pandora/annotaion/models.py @@ -13,20 +13,23 @@ class Layer(models.Model): class Meta: ordering = ('position', ) + enabled = models.BooleanField(default=True) + name = models.CharField(null=True, max_length=255, unique=True) title = models.CharField(null=True, max_length=255) - #text, string, string from list(fixme), event, place, person + #text, string, string from list(fixme), date, place, person, pingback, + #What about: smart layers? for date, place, person type = models.CharField(null=True, max_length=255) + + #can this be changed per user? position = models.IntegerField(default=0) - overlapping = models.BooleanField(default=True) - enabled = models.BooleanField(default=True) - - enabled = models.BooleanField(default=True) + overlap = models.BooleanField(default=True) + overlay = models.BooleanField(default=True) public = models.BooleanField(default=True) #false=users only see there own bins - subtitle = models.BooleanField(default=True) #bis can be displayed as subtitle, only one bin - find = models.BooleanField(default=True) + #find/sort integration + find = models.BooleanField(default=True) #true part of find all #words / item duration(wpm), total words, cuts per minute, cuts, number of annotations, number of annotations/duration sort = models.CharField(null=True, max_length=255) @@ -55,7 +58,7 @@ class Annotation(models.Model): #seconds start = models.FloatField(default=-1) - stop = models.FloatField(default=-1) + end = models.FloatField(default=-1) layer = models.ForeignKey(Layer) value = models.TextField() @@ -74,16 +77,19 @@ class Annotation(models.Model): else: return self.value + def get_id(self): + return ox.to32(self.id) + def json(self): return { - 'id': self.id, + 'id': self.get_id(), 'user': self.user.username, 'start': self.start, - 'stop': self.start, + 'end': self.end, 'value': self.value, 'value_html': self.html(), 'layer': self.layer.name } def __unicode__(self): - return "%s/%s-%s" %(self.item, self.start, self.stop) + return u"%s/%s-%s" %(self.item, self.start, self.end) diff --git a/pandora/annotaion/views.py b/pandora/annotaion/views.py index c9446b601..f1f48510d 100644 --- a/pandora/annotaion/views.py +++ b/pandora/annotaion/views.py @@ -10,7 +10,7 @@ import models from api.actions import actions -def findAnnotation(request): +def findAnnotations(request): ''' param data { fixme @@ -29,7 +29,7 @@ def findAnnotation(request): qs = models.Annotations.objects.filter(item__itemId=data['item']) response['data']['annotations'] = [a.json() for a in qs] return render_to_json_response(response) -actions.register(findAnnotation) +actions.register(findAnnotations) @login_required_json diff --git a/pandora/item/models.py b/pandora/item/models.py index b2415f388..5a9ed5177 100644 --- a/pandora/item/models.py +++ b/pandora/item/models.py @@ -652,6 +652,7 @@ class Item(models.Model): stream.extract_derivatives() self.make_local_posters() self.make_poster() + self.make_icon() self.available = True self.save() diff --git a/pandora/itemlist/views.py b/pandora/itemlist/views.py index 3cf9aa59f..b867bbc3b 100644 --- a/pandora/itemlist/views.py +++ b/pandora/itemlist/views.py @@ -215,6 +215,8 @@ def addList(request): if not request.user.is_staff and value == 'featured': value = 'private' setattr(list, key, value) + elif key == 'description': + list.description = data['description'] list.save() if list.status == 'featured': @@ -313,6 +315,8 @@ def editList(request): num += 1 name = data['name'] + ' (%d)' % num list.name = name + elif key == 'description': + list.description = data['description'] if 'position' in data: pos, created = models.Position.objects.get_or_create(list=list, user=request.user)