# HG changeset patch # User veltr # Date 1346332017 -7200 # Node ID b059300340aa3d68bcce136236870ee0ca2dfd10 # Parent 08f962473d45453bfea4ee6d47f7f5f592fb1e60 Upgraded Metadataplayer to add Vimeo support diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/settings.py --- a/src/ldt/ldt/settings.py Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/settings.py Thu Aug 30 15:06:57 2012 +0200 @@ -99,7 +99,7 @@ DEFAULT_USER_ICON = "thumbnails/users/user_default_icon.png" DEFAULT_GROUP_ICON = "thumbnails/groups/group_default_icon.png" -EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com']) +EXTERNAL_STREAM_SRC = getattr(settings, 'EXTERNAL_STREAM_SRC', ['youtube.com', 'dailymotion.com', 'vimeo.com']) HAYSTACK_CONNECTIONS = { 'default': { diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/js/underscore-min.js --- a/src/ldt/ldt/static/ldt/js/underscore-min.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/js/underscore-min.js Thu Aug 30 15:06:57 2012 +0200 @@ -1,30 +1,32 @@ -// Underscore.js 1.2.3 -// (c) 2009-2011 Jeremy Ashkenas, DocumentCloud Inc. +// Underscore.js 1.3.3 +// (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. // Underscore is freely distributable under the MIT license. // Portions of Underscore are inspired or borrowed from Prototype, // Oliver Steele's Functional, and John Resig's Micro-Templating. // For all details and documentation: // http://documentcloud.github.com/underscore -(function(){function r(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== -c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&r(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(m.call(a,h)&&(f++,!(g=m.call(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(m.call(c, -h)&&!f--)break;g=!f}}d.pop();return g}var s=this,F=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,G=k.concat,H=k.unshift,l=p.toString,m=p.hasOwnProperty,v=k.forEach,w=k.map,x=k.reduce,y=k.reduceRight,z=k.filter,A=k.every,B=k.some,q=k.indexOf,C=k.lastIndexOf,p=Array.isArray,I=Object.keys,t=Function.prototype.bind,b=function(a){return new n(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else typeof define==="function"&& -define.amd?define("underscore",function(){return b}):s._=b;b.VERSION="1.2.3";var j=b.each=b.forEach=function(a,c,b){if(a!=null)if(v&&a.forEach===v)a.forEach(c,b);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(x&&a.reduce===x)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(y&&a.reduceRight===y)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g, -c,d,e):b.reduce(g,c)};b.find=b.detect=function(a,c,b){var e;D(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(z&&a.filter===z)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(A&&a.every===A)return a.every(c, -b);j(a,function(a,g,h){if(!(e=e&&c.call(b,a,g,h)))return o});return e};var D=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(B&&a.some===B)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return q&&a.indexOf===q?a.indexOf(c)!=-1:b=D(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(c.call?c||a:a[c]).apply(a, -d)})};b.pluck=function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex= -function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after= -function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=I||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var b=[],d;for(d in a)m.call(a,d)&&(b[b.length]=d);return b};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)b[d]!==void 0&&(a[d]=b[d])});return a};b.defaults=function(a){j(i.call(arguments, -1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(m.call(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a=== -Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!m.call(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)== -"[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.noConflict=function(){s._=F;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),function(c){J(c, -b[c]=a[c])})};var K=0;b.uniqueId=function(a){var b=K++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape,function(a,b){return"',_.escape("+b.replace(/\\'/g,"'")+"),'"}).replace(d.interpolate,function(a,b){return"',"+b.replace(/\\'/g, -"'")+",'"}).replace(d.evaluate||null,function(a,b){return"');"+b.replace(/\\'/g,"'").replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};var n=function(a){this._wrapped=a};b.prototype=n.prototype;var u=function(a,c){return c?b(a).chain():a},J=function(a,c){n.prototype[a]=function(){var a=i.call(arguments);H.call(a,this._wrapped);return u(c.apply(b, -a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];n.prototype[a]=function(){b.apply(this._wrapped,arguments);return u(this._wrapped,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];n.prototype[a]=function(){return u(b.apply(this._wrapped,arguments),this._chain)}});n.prototype.chain=function(){this._chain=true;return this};n.prototype.value=function(){return this._wrapped}}).call(this); +(function(){function r(a,c,d){if(a===c)return 0!==a||1/a==1/c;if(null==a||null==c)return a===c;a._chain&&(a=a._wrapped);c._chain&&(c=c._wrapped);if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return!1;switch(e){case "[object String]":return a==""+c;case "[object Number]":return a!=+a?c!=+c:0==a?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== +c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if("object"!=typeof a||"object"!=typeof c)return!1;for(var f=d.length;f--;)if(d[f]==a)return!0;d.push(a);var f=0,g=!0;if("[object Array]"==e){if(f=a.length,g=f==c.length)for(;f--&&(g=f in a==f in c&&r(a[f],c[f],d)););}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return!1;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&r(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,h)&&!f--)break; +g=!f}}d.pop();return g}var s=this,I=s._,o={},k=Array.prototype,p=Object.prototype,i=k.slice,J=k.unshift,l=p.toString,K=p.hasOwnProperty,y=k.forEach,z=k.map,A=k.reduce,B=k.reduceRight,C=k.filter,D=k.every,E=k.some,q=k.indexOf,F=k.lastIndexOf,p=Array.isArray,L=Object.keys,t=Function.prototype.bind,b=function(a){return new m(a)};"undefined"!==typeof exports?("undefined"!==typeof module&&module.exports&&(exports=module.exports=b),exports._=b):s._=b;b.VERSION="1.3.3";var j=b.each=b.forEach=function(a, +c,d){if(a!=null)if(y&&a.forEach===y)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==null&&(a=[]);if(A&& +a.reduce===A){e&&(c=b.bind(c,e));return f?a.reduce(c,d):a.reduce(c)}j(a,function(a,b,i){if(f)d=c.call(e,d,a,b,i);else{d=a;f=true}});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(B&&a.reduceRight===B){e&&(c=b.bind(c,e));return f?a.reduceRight(c,d):a.reduceRight(c)}var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=function(a, +c,b){var e;G(a,function(a,g,h){if(c.call(b,a,g,h)){e=a;return true}});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(C&&a.filter===C)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(D&&a.every===D)return a.every(c,b);j(a,function(a,g,h){if(!(e=e&&c.call(b, +a,g,h)))return o});return!!e};var G=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(E&&a.some===E)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return o});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;if(q&&a.indexOf===q)return a.indexOf(c)!=-1;return b=G(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= +function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a)&&a[0]===+a[0])return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]}; +j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1),true);return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a= +i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=L||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&& +c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.pick=function(a){var c={};j(b.flatten(i.call(arguments,1)),function(b){b in a&&(c[b]=a[b])});return c};b.defaults=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return r(a,b,[])};b.isEmpty= +function(a){if(a==null)return true;if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=p||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};b.isArguments=function(a){return l.call(a)=="[object Arguments]"};b.isArguments(arguments)||(b.isArguments=function(a){return!(!a||!b.has(a,"callee"))});b.isFunction=function(a){return l.call(a)=="[object Function]"}; +b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isFinite=function(a){return b.isNumber(a)&&isFinite(a)};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a, +b){return K.call(a,b)};b.noConflict=function(){s._=I;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.result=function(a,c){if(a==null)return null;var d=a[c];return b.isFunction(d)?d.call(a):d};b.mixin=function(a){j(b.functions(a),function(c){M(c,b[c]=a[c])})};var N=0;b.uniqueId= +function(a){var b=N++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var u=/.^/,n={"\\":"\\","'":"'",r:"\r",n:"\n",t:"\t",u2028:"\u2028",u2029:"\u2029"},v;for(v in n)n[n[v]]=v;var O=/\\|'|\r|\n|\t|\u2028|\u2029/g,P=/\\(\\|'|r|n|t|u2028|u2029)/g,w=function(a){return a.replace(P,function(a,b){return n[b]})};b.template=function(a,c,d){d=b.defaults(d||{},b.templateSettings);a="__p+='"+a.replace(O,function(a){return"\\"+n[a]}).replace(d.escape|| +u,function(a,b){return"'+\n_.escape("+w(b)+")+\n'"}).replace(d.interpolate||u,function(a,b){return"'+\n("+w(b)+")+\n'"}).replace(d.evaluate||u,function(a,b){return"';\n"+w(b)+"\n;__p+='"})+"';\n";d.variable||(a="with(obj||{}){\n"+a+"}\n");var a="var __p='';var print=function(){__p+=Array.prototype.join.call(arguments, '')};\n"+a+"return __p;\n",e=new Function(d.variable||"obj","_",a);if(c)return e(c,b);c=function(a){return e.call(this,a,b)};c.source="function("+(d.variable||"obj")+"){\n"+a+"}";return c}; +b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var x=function(a,c){return c?b(a).chain():a},M=function(a,c){m.prototype[a]=function(){var a=i.call(arguments);J.call(a,this._wrapped);return x(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return x(d, +this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return x(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.css Thu Aug 30 15:06:57 2012 +0200 @@ -20,8 +20,8 @@ padding: 2px 0; min-height: 60px; } -.Ldt-AnnotationsList-li:hover { - background: url(img/pinstripe-grey.png) !important; +.Ldt-AnnotationsList-li.selected { + background-image: url(img/pinstripe-grey.png); } .Ldt-AnnotationsList-highlight { background: #F7268E; diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js --- a/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/AnnotationsList.js Thu Aug 30 15:06:57 2012 +0200 @@ -46,8 +46,11 @@ IriSP.Widgets.AnnotationsList.prototype.template = '
' + '
    ' - + '{{#annotations}}' - + '
  • ' + + '
' + + '
'; + +IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = + '
  • ' + '
  • ' - + '{{/annotations}}' - + '' - + ''; + + ''; IriSP.Widgets.AnnotationsList.prototype.onSearch = function(searchString) { this.searchString = typeof searchString !== "undefined" ? searchString : ''; @@ -170,60 +170,72 @@ if (_forceRedraw || !IriSP._.isEqual(_ids, this.lastIds)) { /* This part only gets executed if the list needs updating */ this.lastIds = _ids; - var _data = _list.map(function(_annotation) { - var _url = ( - ( typeof _annotation.url !== "undefined" && _annotation.url) - ? _annotation.url - : ( - ( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project ) - ? Mustache.to_html( - _this.foreign_url, - { - project : _annotation.project, - media : _annotation.media.id, - annotation : _annotation.id, - annotationType : _annotation.annotationType.id - } - ) - : '#id=' + _annotation.id - ) - ); - var _title = (_annotation.title || "").replace(_annotation.description,''), - _description = _annotation.description; - if (!_annotation.title) { - _title = _annotation.creator; - } - if (!_annotation.description && _annotation.creator) { - _description = _annotation.title; - _title = _annotation.creator; - } - var _bgcolor; - IriSP._(_this.polemics).each(function(_polemic) { - var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true); - if (_rgxp.test(_title + " " + _description)) { - _bgcolor = _polemic.background_color; + this.list_$.html(""); + _list.forEach(function(_annotation) { + var _url = ( + ( typeof _annotation.url !== "undefined" && _annotation.url) + ? _annotation.url + : ( + ( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project ) + ? Mustache.to_html( + _this.foreign_url, + { + project : _annotation.project, + media : _annotation.media.id, + annotation : _annotation.id, + annotationType : _annotation.annotationType.id } - }); - var _res = { - id : _annotation.id, - title : _title, - description : _description, - begin : _annotation.begin.toString(), - end : _annotation.end.toString(), - thumbnail : typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail, - url : _url, - tags : _annotation.getTagTexts(), - specific_style : (typeof _bgcolor !== "undefined" ? "background: " + _bgcolor : "") - } - return _res; - }), - _html = Mustache.to_html( - this.template, - { - annotations : _data - }); - - this.$.html(_html); + ) + : '#id=' + _annotation.id + ) + ); + var _title = (_annotation.title || "").replace(_annotation.description,''), + _description = _annotation.description; + if (!_annotation.title) { + _title = _annotation.creator; + } + if (!_annotation.description && _annotation.creator) { + _description = _annotation.title; + _title = _annotation.creator; + } + var _bgcolor; + IriSP._(_this.polemics).each(function(_polemic) { + var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true); + if (_rgxp.test(_title + " " + _description)) { + _bgcolor = _polemic.background_color; + } + }); + var _data = { + id : _annotation.id, + media_id : _annotation.getMedia().id, + title : _title, + description : _description, + begin : _annotation.begin.toString(), + end : _annotation.end.toString(), + thumbnail : typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail, + url : _url, + tags : _annotation.getTagTexts(), + specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : "") + }; + var _html = Mustache.to_html(_this.annotationTemplate, _data); + var _el = IriSP.jQuery(_html); + _el.mouseover(function() { + _annotation.trigger("select"); + }) + .mouseout(function() { + _annotation.trigger("unselect"); + }) + .appendTo(_this.list_$); + _annotation.on("select", function() { + _this.annotations_$.removeClass("selected"); + _el.addClass("selected"); + }); + _annotation.on("unselect", function() { + _this.annotations_$.removeClass("selected"); + });; + }); + + this.annotations_$ = this.$.find('.Ldt-AnnotationsList-li'); /* Correct the empty tag bug */ this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() { @@ -260,6 +272,10 @@ IriSP.Widgets.AnnotationsList.prototype.draw = function() { + this.renderTemplate(); + + this.list_$ = this.$.find(".Ldt-AnnotationsList-ul"); + this.bindPopcorn("IriSP.search", "onSearch"); this.bindPopcorn("IriSP.search.closed", "onSearch"); this.bindPopcorn("IriSP.search.cleared", "onSearch"); diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js --- a/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/CreateAnnotation.js Thu Aug 30 15:06:57 2012 +0200 @@ -135,7 +135,7 @@ .map(function(_tag) { return _tag; }); - // We have to use the map function because Mustache doesn't like our tags object + /* We have to use the map function because Mustache doesn't like our tags object */ } this.renderTemplate(); this.$.find(".Ldt-CreateAnnotation-Close").click(function() { @@ -272,52 +272,66 @@ return !!_contents; } +/* Fonction effectuant l'envoi des annotations */ IriSP.Widgets.CreateAnnotation.prototype.onSubmit = function() { + /* Si les champs obligatoires sont vides, on annule l'envoi */ if (!this.onDescriptionChange() || (this.show_title_field && !this.onTitleChange()) || (this.show_creator_field && !this.onCreatorChange())) { return; } - var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager); - _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), - _annotation = new IriSP.Model.Annotation(false, _export), - _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type), - _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), - _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); - + var _exportedAnnotations = new IriSP.Model.List(this.player.sourceManager), /* Création d'une liste d'annotations contenant une annotation afin de l'envoyer au serveur */ + _export = this.player.sourceManager.newLocalSource({serializer: IriSP.serializers[this.api_serializer]}), /* Création d'un objet source utilisant un sérialiseur spécifique pour l'export */ + _annotation = new IriSP.Model.Annotation(false, _export), /* Création d'une annotation dans cette source avec un ID généré à la volée (param. false) */ + _annotationTypes = this.source.getAnnotationTypes().searchByTitle(this.annotation_type), /* Récupération du type d'annotation dans lequel l'annotation doit être ajoutée */ + _annotationType = (_annotationTypes.length ? _annotationTypes[0] : new IriSP.Model.AnnotationType(false, _export)), /* Si le Type d'Annotation n'existe pas, il est créé à la volée */ + _url = Mustache.to_html(this.api_endpoint_template, {id: this.source.projectId}); /* Génération de l'URL à laquelle l'annotation doit être envoyée, qui doit inclure l'ID du projet */ + + /* Si nous avons dû générer un ID d'annotationType à la volée... */ if (!_annotationTypes.length) { + /* Il ne faudra pas envoyer l'ID généré au serveur */ _annotationType.dont_send_id = true; + /* Il faut inclure le titre dans le type d'annotation */ + _annotationType.title = this.annotation_type; } - _annotationType.title = this.annotation_type; - _annotation.setBegin(this.begin); - _annotation.setEnd(this.end); - _annotation.setMedia(this.source.currentMedia.id); - _annotation.setAnnotationType(_annotationType.id); + /* + * Nous remplissons les données de l'annotation générée à la volée + * ATTENTION: Si nous sommes sur un MASHUP, ces éléments doivent se référer AU MEDIA D'ORIGINE + * */ + _annotation.setBegin(this.begin); /*Timecode de début */ + _annotation.setEnd(this.end); /* Timecode de fin */ + _annotation.setMedia(this.source.currentMedia.id); /* Id du média annoté */ + + _annotation.setAnnotationType(_annotationType.id); /* Id du type d'annotation */ if (this.show_title_field) { + /* Champ titre, seulement s'il est visible */ _annotation.title = this.$.find(".Ldt-CreateAnnotation-Title").val(); } - _annotation.created = new Date(); - _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); - _annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected").map(function() { return IriSP.jQuery(this).attr("tag-id")})); + _annotation.created = new Date(); /* Date de création de l'annotation */ + _annotation.description = this.$.find(".Ldt-CreateAnnotation-Description").val(); /* Champ description */ + _annotation.setTags(this.$.find(".Ldt-CreateAnnotation-TagLi.selected") + .map(function() { return IriSP.jQuery(this).attr("tag-id")})); /*Liste des ids de tags */ + /* Les données créateur/date de création sont envoyées non pas dans l'annotation, mais dans le projet */ if (this.show_creator_field) { _export.creator = this.$.find(".Ldt-CreateAnnotation-Creator").val(); } else { _export.creator = this.creator_name; } _export.created = new Date(); - _exportedAnnotations.push(_annotation); - _export.addList("annotation",_exportedAnnotations); + _exportedAnnotations.push(_annotation); /* Ajout de l'annotation à la liste à exporter */ + _export.addList("annotation",_exportedAnnotations); /* Ajout de la liste à exporter à l'objet Source */ var _this = this; + /* Envoi de l'annotation via AJAX au serveur ! */ IriSP.jQuery.ajax({ url: _url, type: this.api_method, contentType: 'application/json', - data: _export.serialize(), + data: _export.serialize(), /* L'objet Source est sérialisé */ success: function(_data) { - _this.showScreen('Saved'); - if (_this.after_send_timeout) { + _this.showScreen('Saved'); /* Si l'appel a fonctionné, on affiche l'écran "Annotation enregistrée" */ + if (_this.after_send_timeout) { /* Selon les options de configuration, on revient à l'écran principal ou on ferme le widget, ou rien */ window.setTimeout( function() { _this.close_after_send @@ -327,13 +341,13 @@ _this.after_send_timeout ); } - _export.getAnnotations().removeElement(_annotation, true); - _export.deSerialize(_data); - _this.source.merge(_export); - if (this.pause_on_write && this.player.popcorn.media.paused) { - this.player.popcorn.play(); + _export.getAnnotations().removeElement(_annotation, true); /* Pour éviter les doublons, on supprime l'annotation qui a été envoyée */ + _export.deSerialize(_data); /* On désérialise les données reçues pour les réinjecter */ + _this.source.merge(_export); /* On récupère les données réimportées dans l'espace global des données */ + if (_this.pause_on_write && _this.player.popcorn.media.paused) { + _this.player.popcorn.play(); } - _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); + _this.player.popcorn.trigger("IriSP.AnnotationsList.refresh"); /* On force le rafraîchissement du widget AnnotationsList */ }, error: function(_xhr, _error, _thrown) { IriSP.log("Error when sending annotation", _thrown); diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css --- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.css Thu Aug 30 15:06:57 2012 +0200 @@ -9,7 +9,7 @@ } .Ldt-Widget { - /*font-family: Arial, Helvetica, sans-serif;*/ +/* font-family: Arial, Helvetica, sans-serif; */ color: black; font-size: 12px; -} +} \ No newline at end of file diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js --- a/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/LdtPlayer-core.js Thu Aug 30 15:06:57 2012 +0200 @@ -117,7 +117,7 @@ IriSP.jQuery = window.jQuery.noConflict(); } if (typeof IriSP._ === "undefined" && typeof window._ !== "undefined") { - IriSP._ = window._.noConflict(); + IriSP._ = window._; } IriSP.loadCss(IriSP.getLib("cssjQueryUI")); IriSP.loadCss(this.config.gui.css); @@ -205,6 +205,7 @@ _types = { "html5" : /\.(ogg|ogv|webm)$/, "youtube" : /^(https?:\/\/)?(www\.)?youtube\.com/, + "vimeo" : /^(https?:\/\/)?(www\.)?vimeo\.com/, "dailymotion" : /^(https?:\/\/)?(www\.)?dailymotion\.com/ }; @@ -298,6 +299,15 @@ _pop = Popcorn.youtube("#" + containerDiv, _url); break; + case "vimeo": + // Popcorn.vimeo wants us to specify the size of the player in the style attribute of its container div. + IriSP.jQuery("#" + containerDiv).css({ + width : this.config.player.width + "px", + height : this.config.player.height + "px" + }); + _pop = Popcorn.vimeo("#" + containerDiv, this.config.player.video); + break; + case "dailymotion": _pop = new IriSP.PopcornReplacement.dailymotion("#" + containerDiv, this.config.player); break; @@ -663,6 +673,7 @@ Array.call(this); this.directory = _directory; this.idIndex = []; + this.__events = {}; if (typeof _directory == "undefined") { console.trace(); throw "Error : new IriSP.Model.List(directory): directory is undefined"; @@ -671,12 +682,8 @@ IriSP.Model.List.prototype = new Array(); -IriSP.Model.List.prototype.getElement = function(_id) { - return this[_id]; -} - IriSP.Model.List.prototype.hasId = function(_id) { - return (IriSP._(this.idIndex).indexOf(_id) !== -1); + return IriSP._(this.idIndex).include(_id); } /* On recent browsers, forEach and map are defined and do what we want. @@ -840,6 +847,20 @@ }); } +IriSP.Model.List.prototype.on = function(_event, _callback) { + if (typeof this.__events[_event] === "undefined") { + this.__events[_event] = []; + } + this.__events[_event].push(_callback); +} + +IriSP.Model.List.prototype.trigger = function(_event, _data) { + var _list = this; + IriSP._(this.__events[_event]).each(function(_callback) { + _callback.call(_list, _data); + }); +} + /* A simple time management object, that helps converting millisecs to seconds and strings, * without the clumsiness of the original Date object. */ @@ -964,6 +985,7 @@ this.id = _id; this.title = ""; this.description = ""; + this.__events = {} this.source.directory.addElement(this); } @@ -990,6 +1012,20 @@ }); } +IriSP.Model.Element.prototype.on = function(_event, _callback) { + if (typeof this.__events[_event] === "undefined") { + this.__events[_event] = []; + } + this.__events[_event].push(_callback); +} + +IriSP.Model.Element.prototype.trigger = function(_event, _data) { + var _element = this; + IriSP._(this.__events[_event]).each(function(_callback) { + _callback.call(_element, _data); + }); +} + /* */ IriSP.Model.Media = function(_id, _source) { @@ -1129,6 +1165,10 @@ return this.annotation.getTags().getTitles(); } +IriSP.Model.MashedAnnotation.prototype.getDuration = function() { + return this.annotation.getDuration(); +} + /* */ IriSP.Model.Mashup = function(_id, _source) { @@ -1396,15 +1436,25 @@ jwPlayerSWF : "player.swf", json : "json2.js", zeroClipboardJs: "ZeroClipboard.js", - zeroClipboardSwf: "ZeroClipboard.swf" + zeroClipboardSwf: "ZeroClipboard.swf", + backbone: "backbone.js", + backboneRelational: "backbone-relational.js", + paper: "paper.js", + jqueryMousewheel: "jquery.mousewheel.min.js", + renkanPublish: "renkan-publish.js" }, locations : { - // use to define locations outside defautl_dir + // use to define locations outside default_dir }, cdn : { - jQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.17/jquery-ui.js", + jQuery : "http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.2.min.js", + jQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/jquery-ui.min.js", swfObject : "http://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js", - cssjQueryUI : "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.4/themes/base/jquery-ui.css" + cssjQueryUI : "http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.22/themes/ui-lightness/jquery-ui.css", + underscore : "http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.3.3/underscore-min.js", + Mustache : "http://cdnjs.cloudflare.com/ajax/libs/mustache.js/0.5.0-dev/mustache.min.js", + raphael : "http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js", + json : "http://cdnjs.cloudflare.com/ajax/libs/json2/20110223/json2.js" }, useCdn : false } @@ -1432,6 +1482,9 @@ }, Social: { requires: [ "zeroClipboardJs" ] + }, + Renkan: { + requires: [ "backbone", "backboneRelational", "paper", "jqueryMousewheel", "renkanPublish" ] } } @@ -1919,10 +1972,10 @@ if (typeof options.url_transform === "function") { _videoUrl = options.url_transform(_videoUrl); } - + _videoEl .attr({ - src : _videoUrl, + //src : _videoUrl, id : _tmpId, width : _w, height : _h @@ -1932,7 +1985,19 @@ top: 0, left: 0 }); - + + if(typeof _videoUrl === "string"){ + _videoEl.attr({src : _videoUrl}); + } + else{ + // _videoUrl is an array of {src:"u",type:"m"} + l = _videoUrl.length; + for (var _i = 0; _i < l; _i++) { + var srcNode = IriSP.jQuery(''); + srcNode.attr({src:_videoUrl[_i]["src"], type:_videoUrl[_i]["type"]}); + _videoEl.append(srcNode); + } + } _this.$.append(_videoEl); _media.videoEl = _videoEl; _media.popcorn = Popcorn("#" + _tmpId); diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/Polemic.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Polemic.js Thu Aug 30 15:06:57 2012 +0200 @@ -25,18 +25,22 @@ foundcolor : "#fc00ff", polemics : [ { + "name" : "OK", "keywords" : [ "++" ], "color" : "#1D973D" }, { + "name" : "KO", "keywords" : [ "--" ], "color" : "#CE0A15" }, { + "name" : "REF", "keywords" : [ "==", "http://" ], "color" : "#C5A62D" }, { + "name" : "Q", "keywords" : [ "?" ], "color" : "#036AAE" } @@ -60,7 +64,7 @@ } else { _el.css({ "background" : _el.attr("polemic-color"), - "opacity" : .5 + "opacity" : .3 }); } } else { @@ -141,36 +145,66 @@ position: "relative" }); - var _x = 0, - _html = ''; + var _x = 0; - function displayElement(_x, _y, _color, _id, _title) { - _html += Mustache.to_html( - '
    ', + function displayAnnotation(_elx, _ely, _pol, _col, _annotation) { + var _html = Mustache.to_html( + '
    ', { - id: _id, - title: _title, - posx: Math.floor(_x + (_this.element_width - 1) / 2), - left: _x, - top: _y, - color: _color, + id: _annotation.id, + media_id: _this.source.currentMedia.id, + polemic: _pol, + left: _elx, + top: _ely, + color: _col, width: (_this.element_width-1), - height: _this.element_height + height: _this.element_height, + title: _annotation.title + }); + var _el = IriSP.jQuery(_html); + _el.mouseover(function() { + _annotation.trigger("select"); + }).mouseout(function() { + _annotation.trigger("unselect"); + }).click(function() { + _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _annotation.id); + _this.player.popcorn.trigger("IriSP.Tweet.show", _annotation.id); }); + _annotation.on("select", function() { + _this.tooltip.show( + Math.floor(_elx + (_this.element_width - 1) / 2), + _ely, + _annotation.title, + _col + ); + _this.$tweets.each(function() { + var _e = IriSP.jQuery(this); + _e.css( + "opacity", + ( _e.attr("annotation-id") == _annotation.id ? 1 : .3 ) + ); + }); + }); + _annotation.on("unselect", function() { + _this.tooltip.hide(); + _this.$tweets.css("opacity",1); + }); + _this.$zone.append(_el); } IriSP._(_slices).forEach(function(_slice) { var _y = _this.height; _slice.annotations.forEach(function(_annotation) { _y -= _this.element_height; - displayElement(_x, _y, _this.defaultcolor, _annotation.id, _annotation.title); + displayAnnotation(_x, _y, "none", _this.defaultcolor, _annotation); }); IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { - var _color = _this.polemics[_j].color; + var _color = _this.polemics[_j].color, + _polemic = _this.polemics[_j].name; _annotations.forEach(function(_annotation) { _y -= _this.element_height; - displayElement(_x, _y, _color, _annotation.id, _annotation.title); + displayAnnotation(_x, _y, _polemic, _color, _annotation); }); }); _x += _this.element_width; @@ -180,20 +214,6 @@ this.$tweets = this.$.find(".Ldt-Polemic-TweetDiv"); - this.$tweets - .mouseover(function() { - var _el = IriSP.jQuery(this); - _this.tooltip.show(_el.attr("pos-x"), _el.attr("pos-y"), _el.attr("tweet-title"), _el.attr("polemic-color")); - }) - .mouseout(function() { - _this.tooltip.hide(); - }) - .click(function() { - var _id = IriSP.jQuery(this).attr("annotation-id"); - _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _id); - _this.player.popcorn.trigger("IriSP.Tweet.show", _id); - }); - this.bindPopcorn("IriSP.search", "onSearch"); this.bindPopcorn("IriSP.search.closed", "onSearch"); this.bindPopcorn("IriSP.search.cleared", "onSearch"); @@ -215,13 +235,15 @@ _html = '', _scale = this.max_elements * this.element_height / _max; - function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end) { + function displayStackElement(_x, _y, _h, _color, _nums, _begin, _end, _polemic) { _html += Mustache.to_html( - '
    ', { nums: _nums, posx: Math.floor(_x + (_this.element_width - 1) / 2), + media_id: _this.source.currentMedia.id, + polemic: _polemic, left: _x, top: _y, color: _color, @@ -240,14 +262,15 @@ if (_slice.annotations.length) { var _h = Math.ceil(_scale * _slice.annotations.length); _y -= _h; - displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end); + displayStackElement(_x, _y, _h, _this.defaultcolor, _nums, _slice.begin, _slice.end, "none"); } IriSP._(_slice.polemicStacks).forEach(function(_annotations, _j) { if (_annotations.length) { var _color = _this.polemics[_j].color, + _polemic = _this.polemics[_j].name, _h = Math.ceil(_scale * _annotations.length); _y -= _h; - displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end); + displayStackElement(_x, _y, _h, _color, _nums, _slice.begin, _slice.end, _polemic); } }); _x += _this.element_width; diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/Segments.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Segments.js Thu Aug 30 15:06:57 2012 +0200 @@ -1,4 +1,4 @@ -// TODO: Trigger IriSP.SegmentsWidget.click and IriSP.Mediafragment.showAnnotation +// TODO: Trigger IriSP.SegmentsWidget.click IriSP.Widgets.Segments = function(player, config) { IriSP.Widgets.Widget.call(this, player, config); @@ -13,19 +13,23 @@ }; IriSP.Widgets.Segments.prototype.template = - '
    {{#segments}}' - + '
    ' - + '{{/segments}}
    ' + '
    ' + '
    ' + '
    '; +IriSP.Widgets.Segments.prototype.annotationTemplate = + '
    ' + + IriSP.Widgets.Segments.prototype.draw = function() { this.bindPopcorn("IriSP.search", "onSearch"); this.bindPopcorn("IriSP.search.closed", "onSearch"); this.bindPopcorn("IriSP.search.cleared", "onSearch"); this.bindPopcorn("timeupdate", "onTimeupdate"); + this.renderTemplate(); + var _list = this.getWidgetAnnotations(), _this = this, _scale = this.width / this.source.getDuration(); @@ -34,41 +38,47 @@ height : (this.height - 2) + "px", margin : "1px 0" }); - this.$.append(Mustache.to_html(this.template, { - segments : _list.map(function(_annotation, _k) { - var _left = _annotation.begin * _scale, - _width = ( _annotation.end - _annotation.begin ) * _scale, - _center = _left + _width / 2, - _fulltext = _annotation.title + ( _annotation.description ? ( '
    ' + _annotation.description ) : '' ); - return { - text : _fulltext.replace(/(^.{120,140})[\s].+$/m,'$1…'), - color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ), - beginseconds : _annotation.begin.getSeconds() , - left : Math.floor( _left ), - width : Math.floor( _width ), - center : Math.floor( _center ), - id : _annotation.id - } - }) - })); + this.list_$ = this.$.find('.Ldt-Segments-List'); + + _list.forEach(function(_annotation, _k) { + var _left = _annotation.begin * _scale, + _width = ( _annotation.getDuration() ) * _scale, + _center = Math.floor( _left + _width / 2 ), + _fulltext = _annotation.title + ( _annotation.description ? ( '
    ' + _annotation.description ) : '' ), + _beginseconds = _annotation.begin.getSeconds(); + var _data = { + color : ( typeof _annotation.color !== "undefined" && _annotation.color ? _annotation.color : _this.colors[_k % _this.colors.length] ), + text: _fulltext.replace(/(\n|\r|\r\n)/mg,' ').replace(/(^.{120,140})[\s].+$/m,'$1…'), + left : Math.floor( _left ), + width : Math.floor( _width ), + id : _annotation.id, + media_id : _annotation.getMedia().id + }; + var _html = Mustache.to_html(_this.annotationTemplate, _data), + _el = IriSP.jQuery(_html); + _el.mouseover(function() { + _annotation.trigger("select"); + }) + .mouseout(function() { + _annotation.trigger("unselect"); + }) + .click(function() { + _this.player.popcorn.currentTime(_beginseconds); + _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _data.id); + }) + .appendTo(_this.list_$) + _annotation.on("select", function() { + _this.$segments.removeClass("active").addClass("inactive"); + _this.tooltip.show( _center, 0, _data.text, _data.color ); + _el.removeClass("inactive").addClass("active"); + }); + _annotation.on("unselect", function() { + _this.tooltip.hide(); + _this.$segments.removeClass("inactive active"); + }); + }); this.insertSubwidget(this.$.find(".Ldt-Segments-Tooltip"), "tooltip", { type: "Tooltip" }); this.$segments = this.$.find('.Ldt-Segments-Segment'); - - this.$segments.mouseover(function() { - var _el = IriSP.jQuery(this); - _this.$segments.removeClass("active").addClass("inactive"); - _this.tooltip.show( _el.attr("center-pos"), 0, _el.attr("segment-text"), _el.attr("segment-color")); - _el.removeClass("inactive").addClass("active"); - }) - .mouseout(function() { - _this.tooltip.hide(); - _this.$segments.removeClass("inactive active"); - }) - .click(function() { - var _el = IriSP.jQuery(this); - _this.player.popcorn.currentTime(_el.attr("begin-seconds")); - _this.player.popcorn.trigger("IriSP.Mediafragment.setHashToAnnotation", _el.attr("segment-id")); - }); } IriSP.Widgets.Segments.prototype.onSearch = function(searchString) { diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/Slice.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Slice.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Slice.js Thu Aug 30 15:06:57 2012 +0200 @@ -11,12 +11,14 @@ IriSP.Widgets.Slice.prototype.defaults = { start_visible : false, - live_update : true + live_update : true, /* Shall the bounds change each time the Annotation Widget sends an update (true) or only when "show" is triggered (false) ? - true is to be recommended when the widget is permanently displayed. */ + override_bounds : true + /* Can the Annotation Widget bounds be overriden ? */ }; IriSP.Widgets.Slice.prototype.draw = function() { @@ -52,6 +54,9 @@ _currentTime = _this.player.popcorn.currentTime(); }, slide: function(event, ui) { + if (!_this.override_bounds && (ui.value < _this.min || ui.value > _this.max)) { + return false; + } _this.player.popcorn.currentTime(ui.value / 1000); }, stop: function() { @@ -69,7 +74,7 @@ this.bindPopcorn("IriSP.Slice.show","show"); this.bindPopcorn("IriSP.Slice.hide","hide"); this.bindPopcorn("IriSP.Annotation.boundsChanged","storeBounds"); - this.trigger("IriSP.Annotation.getBounds"); + this.player.popcorn.trigger("IriSP.Annotation.getBounds"); }; IriSP.Widgets.Slice.prototype.show = function() { @@ -84,10 +89,10 @@ } IriSP.Widgets.Slice.prototype.storeBounds = function(_values) { - if (!this.sliding && !this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) { + if (!this.player.popcorn.media.paused && (this.min != _values[0] || this.max != _values[1])) { this.min = _values[0]; this.max = _values[1]; - if (this.live_update) { + if (this.live_update && !this.sliding) { this.$slider.slider("values", [this.min, this.max]); } } diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/Trace.js --- a/src/ldt/ldt/static/ldt/metadataplayer/Trace.js Thu Aug 30 00:49:03 2012 +0200 +++ b/src/ldt/ldt/static/ldt/metadataplayer/Trace.js Thu Aug 30 15:06:57 2012 +0200 @@ -11,7 +11,8 @@ requestmode: 'GET', syncmode: "sync", default_subject: "IRI", - tracer: null + tracer: null, + extend: false } IriSP.Widgets.Trace.prototype.draw = function() { @@ -84,7 +85,7 @@ _traceInfo = _target.attr("trace-info"), _lastTarget = _name + (_id && _id.length ? '#' + IriSP.jqEscape(_id) : '') + (_class && _class.length ? ('.' + IriSP.jqEscape(_class).replace(/\s/g,'.')).replace(/\.Ldt-(Widget|TraceMe)/g,'') : ''); _data.target = _lastTarget - if (typeof _traceInfo == "string" && _traceInfo.length && _traceInfo.length < 140) { + if (typeof _traceInfo == "string" && _traceInfo.length) { _data.traceInfo = _traceInfo; _lastTarget += ( ";" + _traceInfo ); } @@ -145,8 +146,11 @@ _traceName += _listener.replace('IriSP.','').replace('.','_'); } this.lastEvent = _traceName; + if (typeof this.extend === "object" && this.extend) { + IriSP._(_arg).extend(this.extend); + } this.tracer.trace(_traceName, _arg); - if (this.js_console) { + if (this.js_console && typeof window.console !== "undefined" && typeof console.log !== "undefined") { console.log("tracer.trace('" + _traceName + "', " + JSON.stringify(_arg) + ");"); } } diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/metadataplayer/img/pinstripe-grey.png Binary file src/ldt/ldt/static/ldt/metadataplayer/img/pinstripe-grey.png has changed diff -r 08f962473d45 -r b059300340aa src/ldt/ldt/static/ldt/swf/player.swf Binary file src/ldt/ldt/static/ldt/swf/player.swf has changed diff -r 08f962473d45 -r b059300340aa web/ldtplatform/settings.py --- a/web/ldtplatform/settings.py Thu Aug 30 00:49:03 2012 +0200 +++ b/web/ldtplatform/settings.py Thu Aug 30 15:06:57 2012 +0200 @@ -232,7 +232,7 @@ '??' : 'Q' } -EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com'] +EXTERNAL_STREAM_SRC = ['youtube.com', 'dailymotion.com', 'vimeo.com'] HAYSTACK_CONNECTIONS = { 'default': {