# HG changeset patch # User ymh # Date 1329133504 -3600 # Node ID 1cb2a4a573e1c826a837d4df7702a6752045cddc # Parent 7a6b74faf355ce5d2cbac901842e231b19063b72 correct annoations api handler + ldt encoding diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/api/ldt/handlers.py --- a/src/ldt/ldt/api/ldt/handlers.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/api/ldt/handlers.py Mon Feb 13 12:45:04 2012 +0100 @@ -21,6 +21,34 @@ @require_extended def update(self, request, project_id): + #return rc.ALL_OK + logging.debug("request " + repr(request)) + data = request.data + ldt_str = data["ldt"] + + logging.debug("request data" + repr(ldt_str)) + + if not ldt_str: + return rc.BAD_REQUEST + + project = Project.objects.get(ldt_id=project_id) + + project.ldt = ldt_str + + unprotect_models() + project.save() + protect_models() + + return rc.ALL_OK + + +class AnnotationHandler(BaseHandler): + allowed_methods = ('PUT',) + model = Project + + + @require_extended + def update(self, request, project_id): """ This method is called when a PUT request is sent to http:///api/ldt/projects/.. is the ldt_id field of the project. If does not match any project on the platform, a 410 ("Gone") @@ -148,67 +176,46 @@ """ #return rc.ALL_OK - #assert False, " TIBO str(request.data) = " + str(request.data) - if request.content_type.lower().find("application/json") > -1 : - try: - project = Project.objects.get(ldt_id=project_id) - except Project.DoesNotExist: - return rc.NOT_HERE + try: + project = Project.objects.get(ldt_id=project_id) + except Project.DoesNotExist: + return rc.NOT_HERE + + adder = LdtAnnotation(project) + logging.debug("request json " + repr(request.data)) - adder = LdtAnnotation(project) - logging.debug("request json " + repr(request.data)) - - unprotect_models() # Allows anonymous user to modify models in this request only - - meta = request.data['meta'] - author = meta['creator'] - date = meta['created'] - new_annotations = request.data['annotations'] + unprotect_models() # Allows anonymous user to modify models in this request only - for a in new_annotations: - dur = str(a['end'] - a['begin']) - begin = str(a['begin']) - type_id, new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date) - if not new_id: - protect_models() - return rc.BAD_REQUEST - - - content = project.contents.get(iri_id=a['media']) - add_annotation_to_stat(content, a['begin'], a['end']) - - # We update the ids - a['type'] = type_id - a['id'] = new_id - - # We save if there were added annotation - if len(new_annotations)>0 : - adder.save() - - protect_models() - - return request.data - - else: - logging.debug("request " + repr(request)) - data = request.data - ldt_str = data["ldt"] - - logging.debug("request data" + repr(ldt_str)) - - if not ldt_str: + meta = request.data['meta'] + author = meta['creator'] + date = meta['created'] + new_annotations = request.data['annotations'] + + for a in new_annotations: + dur = str(a['end'] - a['begin']) + begin = str(a['begin']) + type_id, new_id = adder.add(a['media'], a['type'], a['type_title'], a['content']['data'], '', a['tags'], begin, dur, author, date) + if not new_id: + protect_models() return rc.BAD_REQUEST - project = Project.objects.get(ldt_id=project_id) - - project.ldt = ldt_str + + content = project.contents.get(iri_id=a['media']) + add_annotation_to_stat(content, a['begin'], a['end']) - unprotect_models() - project.save() - protect_models() + # We update the ids + a['type'] = type_id + a['id'] = new_id - return rc.ALL_OK + # We save if there were added annotation + if len(new_annotations)>0 : + adder.save() + protect_models() + + return request.data + + class ContentHandler(BaseHandler): allowed_methods = ('GET', ) diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/api/ldt/urls.py --- a/src/ldt/ldt/api/ldt/urls.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/api/ldt/urls.py Mon Feb 13 12:45:04 2012 +0100 @@ -1,13 +1,15 @@ from django.conf.urls.defaults import patterns, url from piston.resource import Resource -from ldt.api.ldt.handlers import ProjectHandler, ContentHandler, SegmentHandler +from ldt.api.ldt.handlers import ProjectHandler, AnnotationHandler, ContentHandler, SegmentHandler -project_handler = Resource(ProjectHandler, None) -content_handler = Resource(ContentHandler, None) -segment_handler = Resource(SegmentHandler, None) +project_handler = Resource(ProjectHandler, None) +annotation_handler = Resource(AnnotationHandler, None) +content_handler = Resource(ContentHandler, None) +segment_handler = Resource(SegmentHandler, None) urlpatterns = patterns('', url(r'projects/(?P[^/.]+)\.?(?P.*)$', project_handler, name='project_api'), + url(r'annotations/(?P[^/.]+)\.?(?P.*)$', annotation_handler, name='annotation_api'), url(r'contents/(?P[^/.]+)\.?(?P.*)$', content_handler, name='content_api'), url(r'segments/(?P.*)/(?P.*)/(?P.*)$', segment_handler, name='segment_api'), ) diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/contentindexer.py --- a/src/ldt/ldt/ldt_utils/contentindexer.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/contentindexer.py Mon Feb 13 12:45:04 2012 +0100 @@ -129,15 +129,19 @@ class ContentIndexer(LdtIndexer): - def __init__(self, contentList, writer, decoupage_blackList=settings.DECOUPAGE_BLACKLIST): + def __init__(self, contentList, writer, decoupage_blackList=settings.DECOUPAGE_BLACKLIST, callback=None): super(ContentIndexer, self).__init__(writer, decoupage_blackList) self.__contentList = contentList + self.__callback = callback def index_all(self): - for content in self.__contentList: + for i,content in enumerate(self.__contentList): + if self.__callback: + self.__callback(i,content) self.index_content(content) def index_content(self, content): + url = content.iri_url() filepath = urllib.urlopen(url) doc = lxml.etree.parse(filepath) #@UndefinedVariable @@ -155,18 +159,22 @@ class ProjectIndexer(LdtIndexer): - def __init__(self, projectList, writer, decoupage_blackList=settings.DECOUPAGE_BLACKLIST): + def __init__(self, projectList, writer, decoupage_blackList=settings.DECOUPAGE_BLACKLIST, callback=None): super(ProjectIndexer, self).__init__(writer, decoupage_blackList) self.__projectList = projectList + self.__callback = callback def index_all(self): - for project in self.__projectList: + for i,project in enumerate(self.__projectList): + if self.__callback: + self.__callback(i,project) + self.index_project(project) def index_project(self, project): # pocketfilms.utils.log.debug("Indexing project : "+str(project.iri_id)) - doc = lxml.etree.fromstring(project.ldt) #@UndefinedVariable + doc = lxml.etree.fromstring(project.ldt_encoded) #@UndefinedVariable self.writer.deleteDocuments(lucene.Term("project_id", project.ldt_id)) Segment.objects.filter(project_obj__ldt_id=project.ldt_id).delete() #@UndefinedVariable diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/models.py --- a/src/ldt/ldt/ldt_utils/models.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/models.py Mon Feb 13 12:45:04 2012 +0100 @@ -2,24 +2,26 @@ from django.contrib.auth.models import User, Group from django.db import models from django.utils.translation import ugettext_lazy as _ -#from ldt.core.models import Document, Owner +from guardian.shortcuts import assign, remove_perm, get_perms from ldt.core.models import Document -from guardian.shortcuts import assign, remove_perm, get_perms -import ldt.indexation -from ldt.security import get_current_user_or_admin, set_current_user, get_current_user +from ldt.security import (get_current_user_or_admin, set_current_user, + get_current_user) +from ldt.security.manager import SafeManager from ldt.security.models import SafeModel -from ldt.security.manager import SafeManager from sorl.thumbnail import ImageField +from tagging.models import Tag from utils import (create_ldt, copy_ldt, create_empty_iri, update_iri, generate_uuid) import datetime +import ldt.indexation import lucene import lxml.etree import mimetypes import os.path +import re import tagging.fields -from tagging.models import Tag import uuid +#from ldt.core.models import Document, Owner class Author(SafeModel): @@ -511,7 +513,12 @@ ('view_project', 'Can view project'), ) - + def __setattr__(self, name, value): + super(Project, self).__setattr__(name,value) + if name == "ldt" and hasattr(self, "__ldt_encoded"): + del self.__ldt_encoded + + def __unicode__(self): return unicode(self.id) + u"::" + unicode(self.ldt_id) + u"::" + unicode(self.title) @@ -627,6 +634,25 @@ return True else: return False + + def ldt_encoded(): #@NoSelf + + def fget(self): + if self.ldt is None: + return None + if not hasattr(self, "__ldt_encoded"): + m = re.match("<\?xml.*?encoding\s*?=\s*?['\"]([A-Za-z][A-Za-z0-9._-]*)['\"].*?\?>", self.ldt.lstrip(), re.I|re.M|re.U) + if m and m.group(1): + encoding = m.group(1) + else: + encoding = 'utf-8' + self.__ldt_encoded = self.ldt.encode(encoding) + return self.__ldt_encoded + + return locals() + + ldt_encoded = property(**ldt_encoded()) + class Segment(SafeModel): diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/projectindexer.py --- a/src/ldt/ldt/ldt_utils/projectindexer.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/projectindexer.py Mon Feb 13 12:45:04 2012 +0100 @@ -35,13 +35,12 @@ def index_project(self, project): # ldt.utils.log.debug("Indexing project : "+str(project.ldt_id)) - ldt = project.ldt - doc = lxml.etree.fromstring(ldt.encode("utf-8")) + ldt = project.ldt_encoded + doc = lxml.etree.fromstring(ldt) self.__writer.deleteDocuments(lucene.Term("ldt_id", project.ldt_id)) res = doc.xpath("/iri/annotations/content") - project.ldt.encode("utf-8 ") for content in res: contentId = content.get("id") diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/projectserializer.py --- a/src/ldt/ldt/ldt_utils/projectserializer.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/projectserializer.py Mon Feb 13 12:45:04 2012 +0100 @@ -284,7 +284,7 @@ def __parse_ldt(self): - self.ldt_doc = lxml.etree.fromstring(self.project.ldt.encode("utf-8")) + self.ldt_doc = lxml.etree.fromstring(self.project.ldt_encoded) if self.from_display: xpath_str = "/iri/displays/display[position()=1]" @@ -519,7 +519,7 @@ project = Project.create_project(user, creator + '_' + contributor, contentList) project.changed_by = contributor - ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8")) + ldtdoc = lxml.etree.fromstring(project.ldt_encoded) element = ldtdoc.xpath('/iri/annotations') for media in contentList: diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/segmentserializer.py --- a/src/ldt/ldt/ldt_utils/segmentserializer.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/segmentserializer.py Mon Feb 13 12:45:04 2012 +0100 @@ -36,7 +36,7 @@ if not project: return None project = project[0] - doc = lxml.etree.fromstring(project.ldt) + doc = lxml.etree.fromstring(project.ldt_encoded) self.xml_docs[project_id] = doc else: doc = self.xml_docs[project_id] diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/tests.py --- a/src/ldt/ldt/ldt_utils/tests.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/tests.py Mon Feb 13 12:45:04 2012 +0100 @@ -97,7 +97,7 @@ self.project.contents.add(self.cont5, self.cont6) self.project.ldt = "" create_ldt(self.project, self.user) - ldt = lxml.etree.fromstring(self.project.ldt) + ldt = lxml.etree.fromstring(self.project.ldt_encoded) self.assertEqual(ldt.xpath("/iri")[0].tag, "iri") self.assertEqual(ldt.xpath("/iri/project")[0].get("title"), self.project.title) self.assertEqual(ldt.xpath("/iri/medias/media")[0].get("src"), self.cont5.iri_url()) @@ -114,8 +114,8 @@ self.project.contents.add(self.cont7, self.cont8) copy_ldt(self.project, self.projectcopy, self.user) - ldt1 = lxml.etree.fromstring(self.project.ldt) - ldt2 = lxml.etree.fromstring(self.projectcopy.ldt) + ldt1 = lxml.etree.fromstring(self.project.ldt_encoded) + ldt2 = lxml.etree.fromstring(self.projectcopy.ldt_encoded) self.assertTrue(ldt1.xpath("/iri/project")[0].get("id") != ldt2.xpath("/iri/project")[0].get("id")) self.assertEqual(ldt1.xpath("/iri/medias/media")[0].get("id"), ldt2.xpath("/iri/medias/media")[0].get("id")) self.assertEqual(ldt1.xpath("/iri/annotations/content/ensemble")[0].get("title"), ldt2.xpath("/iri/annotations/content/ensemble")[0].get("title")) diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/utils.py --- a/src/ldt/ldt/ldt_utils/utils.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/utils.py Mon Feb 13 12:45:04 2012 +0100 @@ -83,7 +83,7 @@ projects = [] annotations_nodes = {} for project in projects: - ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8")) + ldtdoc = lxml.etree.fromstring(project.ldt_encoded) res = ldtdoc.xpath("/iri/annotations/content") for content in res: @@ -167,7 +167,7 @@ def __init__(self, project, force_save=False): self.project = project self.parser = lxml.etree.XMLParser(remove_blank_text=True) - self.ldtdoc = lxml.etree.parse(StringIO(project.ldt.encode("utf-8")), self.parser) + self.ldtdoc = lxml.etree.parse(StringIO(project.ldt_encoded), self.parser) self.to_add = True # add( a['media'], a['type'], a['type_title, a[data], '', a['tags'], begin, dur, author, date) @@ -284,7 +284,6 @@ def save(self): if self.to_add: self.project.ldt = lxml.etree.tostring(self.ldtdoc, pretty_print=True) - #assert False, " TIBO SAVE " + self.project.ldt self.project.save() def get_polemic_syntax(self, text): @@ -432,7 +431,7 @@ """create xml""" - ldt = lxml.etree.fromstring(project.ldt.encode("utf-8")) + ldt = lxml.etree.fromstring(project.ldt_encoded) res = ldt.xpath("/iri/project") for elementProject in res: elementProject.set('abstract', project.get_description()) diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/views/lignesdetemps.py --- a/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/lignesdetemps.py Mon Feb 13 12:45:04 2012 +0100 @@ -144,7 +144,7 @@ if project_id and project_id != "_" : project = Project.safe_objects.get(ldt_id=project_id) #@UndefinedVariable - ldtdoc = lxml.etree.fromstring(project.ldt.encode("utf-8")) + ldtdoc = lxml.etree.fromstring(project.ldt_encoded) ldtdoc = set_forbidden_stream(ldtdoc, request.user) displays_node = ldtdoc.find("displays") if not displays_node: @@ -254,7 +254,7 @@ project = Project.safe_objects.get(ldt_id=id) #@UndefinedVariable - doc = lxml.etree.fromstring(project.ldt) + doc = lxml.etree.fromstring(project.ldt_encoded) doc = set_forbidden_stream(doc, request.user) resp.write(lxml.etree.tostring(doc, pretty_print=True, xml_declaration=True, encoding="utf-8")) @@ -271,7 +271,7 @@ #save xml ldt ldtproject.ldt = ldt - doc = lxml.etree.fromstring(ldtproject.ldt.encode("utf-8")) + doc = lxml.etree.fromstring(ldtproject.ldt_encoded) result = doc.xpath("/iri/project") #set new title diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/ldt_utils/views/project.py --- a/src/ldt/ldt/ldt_utils/views/project.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/ldt_utils/views/project.py Mon Feb 13 12:45:04 2012 +0100 @@ -133,7 +133,7 @@ if project.title != form.cleaned_data['title'] or project.description != form.cleaned_data['description']: project.title = form.cleaned_data['title'] project.description = form.cleaned_data['description'] - ldt = lxml.etree.fromstring(project.ldt.encode("utf-8")) + ldt = lxml.etree.fromstring(project.ldt_encoded) res = ldt.xpath("/iri/project") res[0].set("title", project.title) res[0].set("abstract", project.description) diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/management/commands/reindex.py --- a/src/ldt/ldt/management/commands/reindex.py Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/management/commands/reindex.py Mon Feb 13 12:45:04 2012 +0100 @@ -2,6 +2,7 @@ import ldt.indexation from ldt.ldt_utils.models import Content, Project from ldt.ldt_utils.contentindexer import ContentIndexer, ProjectIndexer +from ldt.management.utils import show_progress from optparse import make_option class Command(BaseCommand): @@ -27,18 +28,23 @@ if options.content_id: self.stdout.write('Creating index for %s\n' % options.content_id) contentList = Content.objects.filter(iri_id=options.content_id) - indexer = ContentIndexer(contentList, writer) - indexer.index_all() else: self.stdout.write('Creating contents index...\n') contentList = Content.objects.all() - indexer = ContentIndexer(contentList, writer) - indexer.index_all() + + count = contentList.count() + + c = lambda i,o: show_progress(i+1, count, o.title, 50) + + indexer = ContentIndexer(contentList, writer, callback=c) + indexer.index_all() if options.projects: self.stdout.write('Creating projects index...\n') - projectList = Project.objects.filter(contents__in=contentList, state=2).distinct() - indexer = ProjectIndexer(projectList, writer) + projectList = Project.objects.filter(contents__in=contentList, state=2).distinct() + count = projectList.count() + c = lambda i,o: show_progress(i+1, count, o.title, 50) + indexer = ProjectIndexer(projectList, writer, callback=c) indexer.index_all() writer.close() diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/static/ldt/js/LdtPlayer-release.js --- a/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/static/ldt/js/LdtPlayer-release.js Mon Feb 13 12:45:04 2012 +0100 @@ -1085,24 +1085,24 @@ IriSP.__jsonMetadata = data; callback.call(window) }); }); -}; -IriSP.SparklineWidget_template = "
Loading
"; -IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}
"; -IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; -IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
 
Chargement...
"; -IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; -IriSP.arrowWidget_template = "
"; -IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}
{{^cinecast_version}}
{{/cinecast_version}}
{{^user_avatar}} {{/user_avatar}} {{#user_avatar}} {{/user_avatar}}
Submit
Add keywords :
{{#polemic_mode}}
Add polemic keywords
{{/polemic_mode}}
"; -IriSP.createAnnotationWidget_festivalCinecast_template = "{{! template for the annotation creation widget specific for the cinecast festival}}
Add keywords :
Submit
"; -IriSP.createAnnotation_errorMessage_template = "

You must enter text to submit an annotation

"; -IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}
"; -IriSP.player_template = "{{! template for the radio player }}
00:00
/
00:00
"; -IriSP.search_template = "{{! template for the search container }}
"; -IriSP.share_template = "{{! social network sharing template }} "; -IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }}
{{! the zone which represents our slice }}
"; -IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}
"; -IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
"; -IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}
"; +}; +IriSP.SparklineWidget_template = "
Loading
"; +IriSP.annotation_template = "{{! template for an annotation displayed in a segmentWidget }}
"; +IriSP.annotationWidget_template = "{{! template for the annotation widget }}
"; +IriSP.annotation_loading_template = "{{! template shown while the annotation widget is loading }}
 
Chargement...
"; +IriSP.annotationsListWidget_template = "{{! template for the annotation list widget }}
"; +IriSP.arrowWidget_template = "
"; +IriSP.createAnnotationWidget_template = "{{! template for the annotation creation widget }}
{{^cinecast_version}}
{{/cinecast_version}}
{{^user_avatar}} {{/user_avatar}} {{#user_avatar}} {{/user_avatar}}
Submit
Add keywords :
{{#polemic_mode}}
Add polemic keywords
{{/polemic_mode}}
"; +IriSP.createAnnotationWidget_festivalCinecast_template = "{{! template for the annotation creation widget specific for the cinecast festival}}
Add keywords :
Submit
"; +IriSP.createAnnotation_errorMessage_template = "

You must enter text to submit an annotation

"; +IriSP.overlay_marker_template = "{{! the template for the small bars which is z-indexed over our segment widget }}
"; +IriSP.player_template = "{{! template for the radio player }}
00:00
/
00:00
"; +IriSP.search_template = "{{! template for the search container }}
"; +IriSP.share_template = "{{! social network sharing template }} "; +IriSP.sliceWidget_template = "{{! template for the slice widget }}
{{! the whole bar }}
{{! the zone which represents our slice }}
"; +IriSP.sliderWidget_template = "{{! template for the slider widget - it's composed of two divs we one overlayed on top of the other }}
"; +IriSP.tooltip_template = "{{! template used by the jquery ui tooltip }}
{{title}}
{{begin}} : {{end}}
{{description}}
"; +IriSP.tooltipWidget_template = "{{! template for the tooltip widget }}
"; IriSP.tweetWidget_template = "{{! template for the tweet widget }}";/* utils.js - various utils that don't belong anywhere else */ /* trace function, for debugging */ @@ -1626,9 +1626,9 @@ IriSP.paths = {}; -IriSP.libdir = "/mdp/src/js/libs/"; -IriSP.jwplayer_swf_path = "/mdp/test/libs/player.swf"; -IriSP.platform_url = "http://localhost/pf"; +IriSP.libdir = ""; +IriSP.jwplayer_swf_path = ""; +IriSP.platform_url = ""; IriSP.default_templates_vars = { }; /** ugly ugly ugly ugly - returns an object defining @@ -1709,13 +1709,13 @@ ajax_mode: true, /* use ajax to get information about the annotations. if set to false, only search in the annotations for the current project. */ - /* the platform generates some funky urls. We replace them afterwards to point to the correct place - this setting will probably be overwritten by the platform implementers. Note that the player has to replace the variables between {{ and }} by its own values. */ ajax_url: platform_url + "/ldtplatform/api/ldt/segments/{media}/{begin}/{end}", + ajax_granularity: 10000, /* how much ms should we look before and after the current timecode */ @@ -1726,9 +1726,20 @@ }; }; +/* +Override this if you want to change the info the player receives about the user. +It's typically overrided in server-side templates with user-specific data. +*/ +IriSP.defaults.user = function() { return { + "name" : "Anonymous user", + "avatar" : IriSP.paths.imgs + "/user_default_icon.png" + } +}; + + IriSP.defaults.paths = { // "imgs": "/tweetlive/res/metadataplayer/src/css/imgs" - "imgs": "/mdp/src/css/imgs" + "imgs": "" }; IriSP.defaults.default_templates_vars = function() { @@ -1737,16 +1748,6 @@ }; } -/* -Override this if you want to change the info the player receives about the user. -It's typically overrided in server-side templates with user-specific data. -*/ -IriSP.defaults.user = function() { - return { - "name" : "Anonymous user", - "avatar" : IriSP.paths.imgs + "/user_default_icon.png" - } -}; /* the widget classes and definitions */ /** @@ -2962,17 +2963,17 @@ } _this.selector.find(".Ldt-createAnnotation-Description").val(newVal); - + // we use a custom event because there's no simple way to test for a js + // change in a textfield. + _this.selector.find(".Ldt-createAnnotation-Description").trigger("js_mod"); // also call our update function. _this.handleTextChanges(); } }(polemic)); } - // js_mod is a custom event because there's no simple way to test for a js - // change in a textfield. this.selector.find(".Ldt-createAnnotation-Description") - .bind("propertychange keyup input paste js_mod", IriSP.wrap(this, this.handleTextChanges)); + .bind("propertychange keyup input paste", IriSP.wrap(this, this.handleTextChanges)); /* the cinecast version of the player is supposed to pause when the user clicks on the button */ if (this.cinecast_version) { @@ -3273,7 +3274,8 @@ var jsonString = JSON.stringify(apiJson); var project_id = this._serializer._data.meta.id; - var url = Mustache.to_html("{{platf_url}}/ldtplatform/api/ldt/projects/{{id}}.json", + //TODO: extract magic url + var url = Mustache.to_html("{{platf_url}}/ldtplatform/api/ldt/annotations/{{id}}.json", {platf_url: IriSP.platform_url, id: project_id}); IriSP.jQuery.ajax({ @@ -5249,19 +5251,21 @@ var self = this; - var fn = function(data) { - self._data = data; - if (typeof(self._data["annotations"]) === "undefined" || - self._data["annotations"] === null) - self._data["annotations"] = []; - - // sort the data too - self._data["annotations"].sort(function(a, b) - { var a_begin = +a.begin; - var b_begin = +b.begin; - return a_begin - b_begin; - }); - + var fn = function(data) { + //TODO: seems taht data can be null here + if (data !== null) { + self._data = data; + if (typeof(self._data["annotations"]) === "undefined" || + self._data["annotations"] === null) + self._data["annotations"] = []; + + // sort the data too + self._data["annotations"].sort(function(a, b) + { var a_begin = +a.begin; + var b_begin = +b.begin; + return a_begin - b_begin; + }); + } callback(data); }; diff -r 7a6b74faf355 -r 1cb2a4a573e1 src/ldt/ldt/static/ldt/js/LdtPlayer.min.js --- a/src/ldt/ldt/static/ldt/js/LdtPlayer.min.js Fri Feb 10 17:07:35 2012 +0100 +++ b/src/ldt/ldt/static/ldt/js/LdtPlayer.min.js Mon Feb 13 12:45:04 2012 +0100 @@ -16,147 +16,153 @@ * The fact that you are presently reading this means that you have had * knowledge of the CeCILL-C license and that you accept its terms. */ -(function(a){function b(w,F){var I=/^\w+\:\/\//;if(/^\/\/\/?/.test(w))w=location.protocol+w;else if(!I.test(w)&&w.charAt(0)!="/")w=(F||"")+w;return I.test(w)?w:(w.charAt(0)=="/"?L:D)+w}function d(w,F){for(var I in w)if(w.hasOwnProperty(I))F[I]=w[I];return F}function h(w,F,I,N){w.onload=w.onreadystatechange=function(){if(!(w.readyState&&w.readyState!="complete"&&w.readyState!="loaded"||F[I])){w.onload=w.onreadystatechange=null;N()}}}function f(w){w.ready=w.finished=true;for(var F=0;F0){for(var M=0;M=0;){r=c.shift();k=k[r.type].apply(null,r.args)}return k},noConflict:function(){a.$LAB=u;return j},sandbox:function(){return p()}}}var u=a.$LAB,z="UseLocalXHR",n="AlwaysPreserveOrder",s="AllowDuplicates",q="CacheBust",m="Debug",x="BasePath",D=/^[^?#]*\//.exec(location.href)[0],L=/^\w+\:\/\/\/?[^\/]+/.exec(D)[0],K=document.head||document.getElementsByTagName("head"),H=a.opera&&Object.prototype.toString.call(a.opera)== -"[object Opera]"||"MozAppearance"in document.documentElement.style,G=function(){},y=G,C=document.createElement("script"),v=typeof C.preload=="boolean",g=v||C.readyState&&C.readyState=="uninitialized",B=!g&&C.async===true,P=!g&&!B&&!H;if(a.console&&a.console.log){if(!a.console.error)a.console.error=a.console.log;G=function(w){a.console.log(w)};y=function(w,F){a.console.error(w,F)}}a.$LAB=p();(function(w,F,I){if(document.readyState==null&&document[w]){document.readyState="loading";document[w](F,I=function(){document.removeEventListener(F, +(function(a){function b(x,F){var I=/^\w+\:\/\//;if(/^\/\/\/?/.test(x))x=location.protocol+x;else if(!I.test(x)&&x.charAt(0)!="/")x=(F||"")+x;return I.test(x)?x:(x.charAt(0)=="/"?L:D)+x}function c(x,F){for(var I in x)if(x.hasOwnProperty(I))F[I]=x[I];return F}function g(x,F,I,N){x.onload=x.onreadystatechange=function(){if(!(x.readyState&&x.readyState!="complete"&&x.readyState!="loaded"||F[I])){x.onload=x.onreadystatechange=null;N()}}}function h(x){x.ready=x.finished=true;for(var F=0;F0){for(var M=0;M=0;){r=d.shift();l=l[r.type].apply(null,r.args)}return l},noConflict:function(){a.$LAB=u;return j},sandbox:function(){return p()}}}var u=a.$LAB,z="UseLocalXHR",n="AlwaysPreserveOrder",s="AllowDuplicates",q="CacheBust",m="Debug",w="BasePath",D=/^[^?#]*\//.exec(location.href)[0],L=/^\w+\:\/\/\/?[^\/]+/.exec(D)[0],J=document.head||document.getElementsByTagName("head"),H=a.opera&&Object.prototype.toString.call(a.opera)== +"[object Opera]"||"MozAppearance"in document.documentElement.style,G=function(){},y=G,C=document.createElement("script"),v=typeof C.preload=="boolean",f=v||C.readyState&&C.readyState=="uninitialized",B=!f&&C.async===true,P=!f&&!B&&!H;if(a.console&&a.console.log){if(!a.console.error)a.console.error=a.console.log;G=function(x){a.console.log(x)};y=function(x,F){a.console.error(x,F)}}a.$LAB=p();(function(x,F,I){if(document.readyState==null&&document[x]){document.readyState="loading";document[x](F,I=function(){document.removeEventListener(F, I,false);document.readyState="complete"},false)}})("addEventListener","DOMContentLoaded")})(this); -var Mustache=function(){function a(n){return String(n).replace(/&(?!\w+;)|[<>"']/g,function(s){return p[s]||s})}var b=Object.prototype.toString;Array.isArray=Array.isArray||function(n){return b.call(n)=="[object Array]"};var d=String.prototype.trim,h;if(d)h=function(n){return n==null?"":d.call(n)};else{var f,l;if(/\S/.test("\u00a0")){f=/^[\s\xA0]+/;l=/[\s\xA0]+$/}else{f=/^\s+/;l=/\s+$/}h=function(n){return n==null?"":n.toString().replace(f,"").replace(l,"")}}var p={"&":"&","<":"<",">":">", -'"':""","'":"'"},u={},z=function(){};z.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(n,s,q,m){if(!m){this.context=s;this.buffer=[]}if(!this.includes("",n))if(m)return n;else{this.send(n);return}n=this.render_pragmas(n);var x=this.render_section(n,s,q);if(x===false)x=this.render_tags(n,s,q,m);if(m)return x;else this.sendLines(x)},send:function(n){n!==""&&this.buffer.push(n)},sendLines:function(n){if(n){n=n.split("\n"); -for(var s=0;s|&|\\{|%)?([^#\\^]+?)\\1?"+y+"+","g")})},L=D(),K=function(G,y,C){switch(y){case "!":return"";case "=":x.set_delimiters(C);L=D();return"";case ">":return x.render_partial(C,s,q);case "{":case "&":return x.find(C,s);default:return a(x.find(C,s))}};n=n.split("\n");for(var H=0;H0;){m=x;x=x[q.shift()]}if(typeof x=="function")return x.apply(m);return x},includes:function(n,s){return s.indexOf(this.otag+n)!=-1},create_context:function(n){if(this.is_object(n))return n;else{var s=".";if(this.pragmas["IMPLICIT-ITERATOR"])s=this.pragmas["IMPLICIT-ITERATOR"].iterator;var q={};q[s]=n;return q}},is_object:function(n){return n&&typeof n=="object"},map:function(n,s){if(typeof n.map=="function")return n.map(s);else{for(var q=[],m=n.length,x=0;x2;c==null&&(c=[]);if(x&&c.reduce===x)return k&&(e=g.bind(e,k)),o?c.reduce(e,j):c.reduce(e);B(c,function(r,A,E){o?j=e.call(k,j,r,A,E):(j=r,o=true)});if(!o)throw new TypeError("Reduce of empty array with no initial value");return j};g.reduceRight=g.foldr=function(c,e,j,k){var o=arguments.length>2;c==null&&(c=[]);if(D&&c.reduceRight===D)return k&&(e=g.bind(e,k)),o?c.reduceRight(e,j):c.reduceRight(e);var r=g.toArray(c).reverse();k&&!o&&(e=g.bind(e,k));return o?g.reduce(r, -e,j,k):g.reduce(r,e)};g.find=g.detect=function(c,e,j){var k;P(c,function(o,r,A){if(e.call(j,o,r,A))return k=o,true});return k};g.filter=g.select=function(c,e,j){var k=[];if(c==null)return k;if(L&&c.filter===L)return c.filter(e,j);B(c,function(o,r,A){e.call(j,o,r,A)&&(k[k.length]=o)});return k};g.reject=function(c,e,j){var k=[];if(c==null)return k;B(c,function(o,r,A){e.call(j,o,r,A)||(k[k.length]=o)});return k};g.every=g.all=function(c,e,j){var k=true;if(c==null)return k;if(K&&c.every===K)return c.every(e, -j);B(c,function(o,r,A){if(!(k=k&&e.call(j,o,r,A)))return h});return k};var P=g.some=g.any=function(c,e,j){e||(e=g.identity);var k=false;if(c==null)return k;if(H&&c.some===H)return c.some(e,j);B(c,function(o,r,A){if(k||(k=e.call(j,o,r,A)))return h});return!!k};g.include=g.contains=function(c,e){var j=false;if(c==null)return j;return G&&c.indexOf===G?c.indexOf(e)!=-1:j=P(c,function(k){return k===e})};g.invoke=function(c,e){var j=p.call(arguments,2);return g.map(c,function(k){return(e.call?e||k:k[e]).apply(k, -j)})};g.pluck=function(c,e){return g.map(c,function(j){return j[e]})};g.max=function(c,e,j){if(!e&&g.isArray(c))return Math.max.apply(Math,c);if(!e&&g.isEmpty(c))return-Infinity;var k={computed:-Infinity};B(c,function(o,r,A){r=e?e.call(j,o,r,A):o;r>=k.computed&&(k={value:o,computed:r})});return k.value};g.min=function(c,e,j){if(!e&&g.isArray(c))return Math.min.apply(Math,c);if(!e&&g.isEmpty(c))return Infinity;var k={computed:Infinity};B(c,function(o,r,A){r=e?e.call(j,o,r,A):o;rA?1:0}),"value")};g.groupBy=function(c,e){var j={},k=g.isFunction(e)?e:function(o){return o[e]};B(c,function(o,r){var A=k(o,r);(j[A]||(j[A]=[])).push(o)});return j};g.sortedIndex= -function(c,e,j){j||(j=g.identity);for(var k=0,o=c.length;k>1;j(c[r])=0})})};g.difference=function(c){var e=g.flatten(p.call(arguments,1));return g.filter(c,function(j){return!g.include(e,j)})};g.zip=function(){for(var c=p.call(arguments),e=g.max(g.pluck(c,"length")),j=Array(e),k=0;k=0;j--)e=[c[j].apply(this,e)];return e[0]}};g.after=function(c, -e){return c<=0?e():function(){if(--c<1)return e.apply(this,arguments)}};g.keys=C||function(c){if(c!==Object(c))throw new TypeError("Invalid object");var e=[],j;for(j in c)s.call(c,j)&&(e[e.length]=j);return e};g.values=function(c){return g.map(c,g.identity)};g.functions=g.methods=function(c){var e=[],j;for(j in c)g.isFunction(c[j])&&e.push(j);return e.sort()};g.extend=function(c){B(p.call(arguments,1),function(e){for(var j in e)e[j]!==void 0&&(c[j]=e[j])});return c};g.defaults=function(c){B(p.call(arguments, -1),function(e){for(var j in e)c[j]==null&&(c[j]=e[j])});return c};g.clone=function(c){return!g.isObject(c)?c:g.isArray(c)?c.slice():g.extend({},c)};g.tap=function(c,e){e(c);return c};g.isEqual=function(c,e){return a(c,e,[])};g.isEmpty=function(c){if(g.isArray(c)||g.isString(c))return c.length===0;for(var e in c)if(s.call(c,e))return false;return true};g.isElement=function(c){return!!(c&&c.nodeType==1)};g.isArray=l||function(c){return n.call(c)=="[object Array]"};g.isObject=function(c){return c=== -Object(c)};g.isArguments=function(c){return n.call(c)=="[object Arguments]"};if(!g.isArguments(arguments))g.isArguments=function(c){return!(!c||!s.call(c,"callee"))};g.isFunction=function(c){return n.call(c)=="[object Function]"};g.isString=function(c){return n.call(c)=="[object String]"};g.isNumber=function(c){return n.call(c)=="[object Number]"};g.isNaN=function(c){return c!==c};g.isBoolean=function(c){return c===true||c===false||n.call(c)=="[object Boolean]"};g.isDate=function(c){return n.call(c)== -"[object Date]"};g.isRegExp=function(c){return n.call(c)=="[object RegExp]"};g.isNull=function(c){return c===null};g.isUndefined=function(c){return c===void 0};g.noConflict=function(){b._=d;return this};g.identity=function(c){return c};g.times=function(c,e,j){for(var k=0;k/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};g.mixin=function(c){B(g.functions(c),function(e){V(e, -g[e]=c[e])})};var F=0;g.uniqueId=function(c){var e=F++;return c?c+e:e};g.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};g.template=function(c,e){var j=g.templateSettings;j="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+c.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(j.escape,function(o,r){return"',_.escape("+r.replace(/\\'/g,"'")+"),'"}).replace(j.interpolate,function(o,r){return"',"+r.replace(/\\'/g, -"'")+",'"}).replace(j.evaluate||null,function(o,r){return"');"+r.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var k=new Function("obj","_",j);return e?k(e,g):function(o){return k.call(this,o,g)}};var I=function(c){this._wrapped=c};g.prototype=I.prototype;var N=function(c,e){return e?g(c).chain():c},V=function(c,e){I.prototype[c]=function(){var j=p.call(arguments);z.call(j,this._wrapped);return N(e.apply(g, -j),this._chain)}};g.mixin(g);B("pop,push,reverse,shift,sort,splice,unshift".split(","),function(c){var e=f[c];I.prototype[c]=function(){e.apply(this._wrapped,arguments);return N(this._wrapped,this._chain)}});B(["concat","join","slice"],function(c){var e=f[c];I.prototype[c]=function(){return N(e.apply(this._wrapped,arguments),this._chain)}});I.prototype.chain=function(){this._chain=true;return this};I.prototype.value=function(){return this._wrapped}}).call(this); +var Mustache=function(){function a(n){return String(n).replace(/&(?!\w+;)|[<>"']/g,function(s){return p[s]||s})}var b=Object.prototype.toString;Array.isArray=Array.isArray||function(n){return b.call(n)=="[object Array]"};var c=String.prototype.trim,g;if(c)g=function(n){return n==null?"":c.call(n)};else{var h,k;if(/\S/.test("\u00a0")){h=/^[\s\xA0]+/;k=/[\s\xA0]+$/}else{h=/^\s+/;k=/\s+$/}g=function(n){return n==null?"":n.toString().replace(h,"").replace(k,"")}}var p={"&":"&","<":"<",">":">", +'"':""","'":"'"},u={},z=function(){};z.prototype={otag:"{{",ctag:"}}",pragmas:{},buffer:[],pragmas_implemented:{"IMPLICIT-ITERATOR":true},context:{},render:function(n,s,q,m){if(!m){this.context=s;this.buffer=[]}if(!this.includes("",n))if(m)return n;else{this.send(n);return}n=this.render_pragmas(n);var w=this.render_section(n,s,q);if(w===false)w=this.render_tags(n,s,q,m);if(m)return w;else this.sendLines(w)},send:function(n){n!==""&&this.buffer.push(n)},sendLines:function(n){if(n){n=n.split("\n"); +for(var s=0;s|&|\\{|%)?([^#\\^]+?)\\1?"+y+"+","g")})},L=D(),J=function(G,y,C){switch(y){case "!":return"";case "=":w.set_delimiters(C);L=D();return"";case ">":return w.render_partial(C,s,q);case "{":case "&":return w.find(C,s);default:return a(w.find(C,s))}};n=n.split("\n");for(var H=0;H0;){m=w;w=w[q.shift()]}if(typeof w=="function")return w.apply(m);return w},includes:function(n,s){return s.indexOf(this.otag+n)!=-1},create_context:function(n){if(this.is_object(n))return n;else{var s=".";if(this.pragmas["IMPLICIT-ITERATOR"])s=this.pragmas["IMPLICIT-ITERATOR"].iterator;var q={};q[s]=n;return q}},is_object:function(n){return n&&typeof n=="object"},map:function(n,s){if(typeof n.map=="function")return n.map(s);else{for(var q=[],m=n.length,w=0;w2;d==null&&(d=[]);if(w&&d.reduce===w)return l&&(e=f.bind(e,l)),o?d.reduce(e,j):d.reduce(e);B(d,function(r,A,E){o?j=e.call(l,j,r,A,E):(j=r,o=true)});if(!o)throw new TypeError("Reduce of empty array with no initial value");return j};f.reduceRight=f.foldr=function(d,e,j,l){var o=arguments.length>2;d==null&&(d=[]);if(D&&d.reduceRight===D)return l&&(e=f.bind(e,l)),o?d.reduceRight(e,j):d.reduceRight(e);var r=f.toArray(d).reverse();l&&!o&&(e=f.bind(e,l));return o?f.reduce(r, +e,j,l):f.reduce(r,e)};f.find=f.detect=function(d,e,j){var l;P(d,function(o,r,A){if(e.call(j,o,r,A))return l=o,true});return l};f.filter=f.select=function(d,e,j){var l=[];if(d==null)return l;if(L&&d.filter===L)return d.filter(e,j);B(d,function(o,r,A){e.call(j,o,r,A)&&(l[l.length]=o)});return l};f.reject=function(d,e,j){var l=[];if(d==null)return l;B(d,function(o,r,A){e.call(j,o,r,A)||(l[l.length]=o)});return l};f.every=f.all=function(d,e,j){var l=true;if(d==null)return l;if(J&&d.every===J)return d.every(e, +j);B(d,function(o,r,A){if(!(l=l&&e.call(j,o,r,A)))return g});return l};var P=f.some=f.any=function(d,e,j){e||(e=f.identity);var l=false;if(d==null)return l;if(H&&d.some===H)return d.some(e,j);B(d,function(o,r,A){if(l||(l=e.call(j,o,r,A)))return g});return!!l};f.include=f.contains=function(d,e){var j=false;if(d==null)return j;return G&&d.indexOf===G?d.indexOf(e)!=-1:j=P(d,function(l){return l===e})};f.invoke=function(d,e){var j=p.call(arguments,2);return f.map(d,function(l){return(e.call?e||l:l[e]).apply(l, +j)})};f.pluck=function(d,e){return f.map(d,function(j){return j[e]})};f.max=function(d,e,j){if(!e&&f.isArray(d))return Math.max.apply(Math,d);if(!e&&f.isEmpty(d))return-Infinity;var l={computed:-Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;r>=l.computed&&(l={value:o,computed:r})});return l.value};f.min=function(d,e,j){if(!e&&f.isArray(d))return Math.min.apply(Math,d);if(!e&&f.isEmpty(d))return Infinity;var l={computed:Infinity};B(d,function(o,r,A){r=e?e.call(j,o,r,A):o;rA?1:0}),"value")};f.groupBy=function(d,e){var j={},l=f.isFunction(e)?e:function(o){return o[e]};B(d,function(o,r){var A=l(o,r);(j[A]||(j[A]=[])).push(o)});return j};f.sortedIndex= +function(d,e,j){j||(j=f.identity);for(var l=0,o=d.length;l>1;j(d[r])=0})})};f.difference=function(d){var e=f.flatten(p.call(arguments,1));return f.filter(d,function(j){return!f.include(e,j)})};f.zip=function(){for(var d=p.call(arguments),e=f.max(f.pluck(d,"length")),j=Array(e),l=0;l=0;j--)e=[d[j].apply(this,e)];return e[0]}};f.after=function(d, +e){return d<=0?e():function(){if(--d<1)return e.apply(this,arguments)}};f.keys=C||function(d){if(d!==Object(d))throw new TypeError("Invalid object");var e=[],j;for(j in d)s.call(d,j)&&(e[e.length]=j);return e};f.values=function(d){return f.map(d,f.identity)};f.functions=f.methods=function(d){var e=[],j;for(j in d)f.isFunction(d[j])&&e.push(j);return e.sort()};f.extend=function(d){B(p.call(arguments,1),function(e){for(var j in e)e[j]!==void 0&&(d[j]=e[j])});return d};f.defaults=function(d){B(p.call(arguments, +1),function(e){for(var j in e)d[j]==null&&(d[j]=e[j])});return d};f.clone=function(d){return!f.isObject(d)?d:f.isArray(d)?d.slice():f.extend({},d)};f.tap=function(d,e){e(d);return d};f.isEqual=function(d,e){return a(d,e,[])};f.isEmpty=function(d){if(f.isArray(d)||f.isString(d))return d.length===0;for(var e in d)if(s.call(d,e))return false;return true};f.isElement=function(d){return!!(d&&d.nodeType==1)};f.isArray=k||function(d){return n.call(d)=="[object Array]"};f.isObject=function(d){return d=== +Object(d)};f.isArguments=function(d){return n.call(d)=="[object Arguments]"};if(!f.isArguments(arguments))f.isArguments=function(d){return!(!d||!s.call(d,"callee"))};f.isFunction=function(d){return n.call(d)=="[object Function]"};f.isString=function(d){return n.call(d)=="[object String]"};f.isNumber=function(d){return n.call(d)=="[object Number]"};f.isNaN=function(d){return d!==d};f.isBoolean=function(d){return d===true||d===false||n.call(d)=="[object Boolean]"};f.isDate=function(d){return n.call(d)== +"[object Date]"};f.isRegExp=function(d){return n.call(d)=="[object RegExp]"};f.isNull=function(d){return d===null};f.isUndefined=function(d){return d===void 0};f.noConflict=function(){b._=c;return this};f.identity=function(d){return d};f.times=function(d,e,j){for(var l=0;l/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};f.mixin=function(d){B(f.functions(d),function(e){V(e, +f[e]=d[e])})};var F=0;f.uniqueId=function(d){var e=F++;return d?d+e:e};f.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};f.template=function(d,e){var j=f.templateSettings;j="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+d.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(j.escape,function(o,r){return"',_.escape("+r.replace(/\\'/g,"'")+"),'"}).replace(j.interpolate,function(o,r){return"',"+r.replace(/\\'/g, +"'")+",'"}).replace(j.evaluate||null,function(o,r){return"');"+r.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');";var l=new Function("obj","_",j);return e?l(e,f):function(o){return l.call(this,o,f)}};var I=function(d){this._wrapped=d};f.prototype=I.prototype;var N=function(d,e){return e?f(d).chain():d},V=function(d,e){I.prototype[d]=function(){var j=p.call(arguments);z.call(j,this._wrapped);return N(e.apply(f, +j),this._chain)}};f.mixin(f);B("pop,push,reverse,shift,sort,splice,unshift".split(","),function(d){var e=h[d];I.prototype[d]=function(){e.apply(this._wrapped,arguments);return N(this._wrapped,this._chain)}});B(["concat","join","slice"],function(d){var e=h[d];I.prototype[d]=function(){return N(e.apply(this._wrapped,arguments),this._chain)}});I.prototype.chain=function(){this._chain=true;return this};I.prototype.value=function(){return this._wrapped}}).call(this); if(window.IriSP===undefined&&window.__IriSP===undefined)__IriSP=IriSP={};IriSP._=window._.noConflict();IriSP.underscore=IriSP._; -IriSP.loadLibs=function(a,b,d,h){IriSP.jQuery=null;var f=$LAB.script(a.jQuery).script(a.swfObject).wait().script(a.jQueryUI);if(b.player.type==="jwplayer")f=f.script(a.jwplayer);else{f=f.script(a.popcorn).script(a["popcorn.code"]);if(b.player.type==="youtube")f=f.script(a["popcorn.youtube"]);if(b.player.type==="vimeo")f=f.script(a["popcorn.vimeo"])}for(var l in b.gui.widgets){if(b.gui.widgets[l].type==="PolemicWidget"||b.gui.widgets[l].type==="StackGraphWidget")f.script(a.raphael);b.gui.widgets[l].type=== -"SparklineWidget"&&f.script(a.jquery_sparkline)}f.wait(function(){IriSP.jQuery=window.jQuery.noConflict(true);var p=IriSP.jQuery("",{rel:"stylesheet",type:"text/css",href:a.cssjQueryUI,"class":"dynamic_css"}),u=IriSP.jQuery("",{rel:"stylesheet",type:"text/css",href:b.gui.css,"class":"dynamic_css"});p.appendTo("head");u.appendTo("head");IriSP.setupDataLoader();IriSP.__dataloader.get(d,function(z){IriSP.__jsonMetadata=z;h.call(window)})})};IriSP.SparklineWidget_template="
Loading
"; -IriSP.annotation_template="{{! template for an annotation displayed in a segmentWidget }}
";IriSP.annotationWidget_template="{{! template for the annotation widget }}