# HG changeset patch # User Raphael Velt # Date 1341591733 -7200 # Node ID a5977736d2b047fba628cbfda0dacab9fe470378 # Parent c4c876db76fbeff257dcfd963d2b56b815ca6229 Corrected metadataplayer bug diff -r c4c876db76fb -r a5977736d2b0 web/player_embed.php --- a/web/player_embed.php Tue Jul 03 18:19:39 2012 +0200 +++ b/web/player_embed.php Fri Jul 06 18:22:13 2012 +0200 @@ -51,7 +51,15 @@ }, css:'', widgets: [ - { type: "Polemic" }, + 1) { + echo '{ type: "Polemic"'; + if (isset($config['protocol_level']) && $config['protocol_level'] < 3) { + echo ', polemics: []'; + } + echo '},'; + } +?> { type: "Slider" }, { type: "Controller", diff -r c4c876db76fb -r a5977736d2b0 web/polemicaltimeline.php --- a/web/polemicaltimeline.php Tue Jul 03 18:19:39 2012 +0200 +++ b/web/polemicaltimeline.php Fri Jul 06 18:22:13 2012 +0200 @@ -99,7 +99,15 @@ }, css:'', widgets: [ - { type: "Polemic" }, + 1) { + echo '{ type: "Polemic"'; + if (isset($config['protocol_level']) && $config['protocol_level'] < 3) { + echo ', polemics: []'; + } + echo '},'; + } +?> { type: "Slider" }, { type: "Controller", diff -r c4c876db76fb -r a5977736d2b0 web/res/metadataplayer/Annotation.css --- a/web/res/metadataplayer/Annotation.css Tue Jul 03 18:19:39 2012 +0200 +++ b/web/res/metadataplayer/Annotation.css Fri Jul 06 18:22:13 2012 +0200 @@ -23,6 +23,31 @@ font-weight: bold; } +.Ldt-Annotation-Cleared { + clear: both; +} + +.Ldt-Annotation-MaxMinButton { + float: right; margin: 5px 5px 0; width: 17px; height: 17px; + background: url(img/widget-control.png); background-position: 0 -51px; cursor: pointer; +} + +.Ldt-Annotation-Social { + float: right; +} + +.Ldt-Annotation-MaxMinButton:hover { + background-position: -17px -51px; +} + +.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton { + background-position: 0 -34px; +} + +.Ldt-Annotation-Minimized div.Ldt-Annotation-MaxMinButton:hover { + background-position: -17px -34px; +} + .Ldt-Annotation-Inner h3.Ldt-Annotation-MashupOrigin { font-size: 12px; } @@ -36,55 +61,23 @@ } .Ldt-Annotation-Inner p { - margin: 5px 0; font-size: 12px; -} - -.Ldt-Annotation-ShareIcons { - float: right; -} - -.Ldt-Annotation-Share { - display: inline-block; width: 24px; height: 24px; margin: 2px 0 0 2px; background: url(img/socialbuttons.png); -} - -.Ldt-Annotation-Twitter { - background-position: 0 0; + font-size: 12px; } -.Ldt-Annotation-Twitter:hover { - background-position: 0 -24px; -} - -.Ldt-Annotation-Fb { - background-position: -24px 0; +.Ldt-Annotation-Label { + font-size: 12px; font-weight: bold; max-width: 90px; float: left; clear: left; } -.Ldt-Annotation-Fb:hover { - background-position: -24px -24px; -} - -.Ldt-Annotation-Gplus { - background-position: -48px 0; -} - -.Ldt-Annotation-Gplus:hover { - background-position: -48px -24px; +.Ldt-Annotation-Labelled { + margin: 5px 0 0 90px; clear: right; } .Ldt-Annotation-Tags-Block { font-size: 12px; } -.Ldt-Annotation-NoTags { - display: none; -} - -.Ldt-Annotation-TagTitle { - margin: 5px 0 2px; font-size: 12px; -} - ul.Ldt-Annotation-Tags { - display: inline; list-style: none; padding: 0; margin: 5px 0; + list-style: none; padding: 0; } li.Ldt-Annotation-TagLabel { @@ -122,3 +115,7 @@ display: none; } +.Ldt-Annotation-EmptyBlock { + display: none; +} + diff -r c4c876db76fb -r a5977736d2b0 web/res/metadataplayer/Annotation.js --- a/web/res/metadataplayer/Annotation.js Tue Jul 03 18:19:39 2012 +0200 +++ b/web/res/metadataplayer/Annotation.js Fri Jul 06 18:22:13 2012 +0200 @@ -1,67 +1,73 @@ -// TODO: Open share links in a small window - Migrate Timeupdate functions to Extract +// TODO: Migrate Timeupdate functions to Extract IriSP.Widgets.Annotation = function(player, config) { IriSP.Widgets.Widget.call(this, player, config); this.lastAnnotation = false; + this.minimized = this.start_minimized || false; + this.bounds = [ 0, 0 ]; }; IriSP.Widgets.Annotation.prototype = new IriSP.Widgets.Widget(); IriSP.Widgets.Annotation.prototype.messages = { - "fr": { - share_on: "Partager sur", + fr: { watching: "Je regarde ", on_site: " sur ", - tags: "Mots-clés :", + tags_: "Mots-clés :", + description_: "Description :", excerpt_from: "Extrait de :" }, - "en": { - share_on: "Share on", + en: { watching: "I'm watching ", on_site: " on ", - tags: "Keywords:", + tags_: "Keywords:", + description_: "Description:", excerpt_from: "Excerpt from:" } } IriSP.Widgets.Annotation.prototype.template = '
' - + '
' - + '' - + '' - + '' - + '

' + + '
' + + '
' + + '
' + + '

' + '( - )

' + '

{{l10n.excerpt_from}} ' + '( - )

' - + '

' - + '
{{l10n.tags}}

    '; + + '
    {{l10n.description_}}
    ' + + '

    ' + + '
    ' + + '
    {{l10n.tags_}}
      ' + + '
      '; IriSP.Widgets.Annotation.prototype.defaults = { annotation_type : "chap", + start_minimized: false, show_top_border : false, site_name : "Lignes de Temps" } IriSP.Widgets.Annotation.prototype.draw = function() { this.renderTemplate(); + this.insertSubwidget(this.$.find(".Ldt-Annotation-Social"), "socialWidget", { type: "Social" }); this.bindPopcorn("timeupdate","onTimeupdate"); this.bindPopcorn("IriSP.Annotation.hide","hide"); this.bindPopcorn("IriSP.Annotation.show","show"); this.bindPopcorn("IriSP.Annotation.minimize","minimize"); this.bindPopcorn("IriSP.Annotation.maximize","maximize"); + this.bindPopcorn("IriSP.Annotation.getBounds","sendBounds"); + this.$.find(".Ldt-Annotation-MaxMinButton").click(this.functionWrapper("toggleSize")); this.onTimeupdate(); } IriSP.Widgets.Annotation.prototype.onTimeupdate = function() { var _time = Math.floor(this.player.popcorn.currentTime() * 1000), - _list = this.getWidgetAnnotations().filter(function(_annotation) { - return _annotation.begin <= _time && _annotation.end > _time; - }); + _list = this.getWidgetAnnotationsAtTime(); if (_list.length) { if (_list[0].id !== this.lastAnnotation) { this.drawAnnotation(_list[0]); - this.player.popcorn.trigger("IriSP.Annotation.boundsChanged",[ _list[0].begin.valueOf(), _list[0].end.valueOf() ]); + this.bounds = [ _list[0].begin.valueOf(), _list[0].end.valueOf() ]; } this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: ( _list[0].begin + _list[0].end ) / 2}); } @@ -69,8 +75,13 @@ this.lastAnnotation = false; this.$.find(".Ldt-Annotation-Inner").addClass("Ldt-Annotation-Empty"); this.player.popcorn.trigger("IriSP.Arrow.updatePosition",{widget: this.type, time: _time}); - this.player.popcorn.trigger("IriSP.Annotation.boundsChanged",[ _time, _time ]); + this.bounds = [ _time, _time ]; } + this.sendBounds(); +} + +IriSP.Widgets.Annotation.prototype.sendBounds = function() { + this.player.popcorn.trigger("IriSP.Annotation.boundsChanged",this.bounds); } IriSP.Widgets.Annotation.prototype.drawAnnotation = function(_annotation) { @@ -85,7 +96,7 @@ return '
    • ' + _tag + '
    • '; }).join(""); this.$.find(".Ldt-Annotation-Tags").html(_html); - this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-NoTags"); + this.$.find(".Ldt-Annotation-Tags-Block").removeClass("Ldt-Annotation-EmptyBlock"); /* Correct the empty tag bug */ this.$.find('.Ldt-Annotation-TagLabel').each(function() { @@ -99,10 +110,16 @@ _this.player.popcorn.trigger("IriSP.search.triggeredSearch", IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,'')); }); } else { - this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-NoTags"); + this.$.find(".Ldt-Annotation-Tags-Block").addClass("Ldt-Annotation-EmptyBlock"); } this.$.find(".Ldt-Annotation-Title").html(_annotation.title); - this.$.find(".Ldt-Annotation-Description").html(_annotation.description); + var _desc = _annotation.description.replace(/(^\s+|\s+$)/g,''); + if (_desc) { + this.$.find(".Ldt-Annotation-Description-Block").removeClass("Ldt-Annotation-EmptyBlock"); + this.$.find(".Ldt-Annotation-Description").html(_desc); + } else { + this.$.find(".Ldt-Annotation-Description-Block").addClass("Ldt-Annotation-EmptyBlock"); + } this.$.find(".Ldt-Annotation-Begin").html(_annotation.begin.toString()); this.$.find(".Ldt-Annotation-End").html(_annotation.end.toString()); if (_annotation.elementType === "mashedAnnotation") { @@ -113,9 +130,9 @@ } else { this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-isMashup"); } - this.$.find(".Ldt-Annotation-Fb").attr("href", "http://www.facebook.com/share.php?" + IriSP.jQuery.param({ u: _url, t: _text })); - this.$.find(".Ldt-Annotation-Twitter").attr("href", "https://twitter.com/intent/tweet?" + IriSP.jQuery.param({ url: _url, text: _text })); - this.$.find(".Ldt-Annotation-Gplus").attr("href", "https://plusone.google.com/_/+1/confirm?" + IriSP.jQuery.param({ url: _url, title: _text })); + if (typeof this.socialWidget !== "undefined") { + this.socialWidget.updateUrls(_url, _text); + } this.$.find(".Ldt-Annotation-Inner").removeClass("Ldt-Annotation-Empty"); } @@ -127,10 +144,20 @@ this.$.slideDown(); } +IriSP.Widgets.Annotation.prototype.toggleSize = function() { + if (this.minimized) { + this.maximize(); + } else { + this.minimize(); + } +} + IriSP.Widgets.Annotation.prototype.minimize = function() { + this.minimized = true; this.$.find('.Ldt-Annotation-Inner').addClass("Ldt-Annotation-Minimized"); } IriSP.Widgets.Annotation.prototype.maximize = function() { + this.minimized = false; this.$.find('.Ldt-Annotation-Inner').removeClass("Ldt-Annotation-Minimized"); } \ No newline at end of file diff -r c4c876db76fb -r a5977736d2b0 web/res/metadataplayer/AnnotationsList.css --- a/web/res/metadataplayer/AnnotationsList.css Tue Jul 03 18:19:39 2012 +0200 +++ b/web/res/metadataplayer/AnnotationsList.css Fri Jul 06 18:22:13 2012 +0200 @@ -18,7 +18,7 @@ min-height: 60px; } .Ldt-AnnotationsList-li:hover { - background: url(img/pinstripe-grey.png); + background: url(img/pinstripe-grey.png) !important; } .Ldt-AnnotationsList-highlight { background: #F7268E; @@ -44,35 +44,41 @@ font-size: 12px; margin: 2px; } -h3.Ldt-AnnotationsList-Title, #accordeon h3.Ldt-AnnotationsList-Title { +h3.Ldt-AnnotationsList-Title { color: #0068c4; font-size: 14px; - line-height: 1.2em; - margin: 0 2px 0 82px; + margin: 2px 2px 0 82px; font-weight: bold; } -h3.Ldt-AnnotationsList-Title a, #accordeon h3.Ldt-AnnotationsList-Title a { - color: #0068c4 ; +h3.Ldt-AnnotationsList-Title a { + color: #0068c4; } -p.Ldt-AnnotationsList-Description, #accordeon p.Ldt-AnnotationsList-Description { +p.Ldt-AnnotationsList-Description { margin: 2px 0 2px 82px; - line-height: 1.2em; font-size: 12px; - color: #666666; + color: #333333; } ul.Ldt-AnnotationsList-Tags { list-style: none; padding: 0; - margin: 2px 0 8px 82px; + margin: 2px 0 0 82px; } + li.Ldt-AnnotationsList-Tag-Li { - display: inline-block; - margin: 2px; - background: #0068c4; - color: #fff; - padding: 2px; - font-size: 12px; + display: inline-block; border: none; margin: 0 10px 5px 0; height: 23px; padding: 0 0 0 20px; + background: url(img/tag.png) left top no-repeat; + cursor: pointer; +} + +.Ldt-AnnotationsList-Tag-Li span { + display: inline-block; font-size: 12px; height: 19px; padding: 4px 5px 0 0; border: none; margin: 0; + background: url(img/tag.png) right top no-repeat; } + li.Ldt-AnnotationsList-Tag-Li:hover { - background: #F7268E; + background-position: left -23px; } + +.Ldt-AnnotationsList-Tag-Li:hover span { + background-position: right -23px; +} \ No newline at end of file diff -r c4c876db76fb -r a5977736d2b0 web/res/metadataplayer/AnnotationsList.js --- a/web/res/metadataplayer/AnnotationsList.js Tue Jul 03 18:19:39 2012 +0200 +++ b/web/res/metadataplayer/AnnotationsList.js Fri Jul 06 18:22:13 2012 +0200 @@ -19,7 +19,7 @@ /* number of milliseconds before/after the current timecode when calling the segment API */ ajax_granularity : 300000, - default_thumbnail : "http://ldt.iri.centrepompidou.fr/static/site/ldt/css/imgs/video_sequence.png", + default_thumbnail : "", /* URL when the annotation is not in the current project, * e.g. http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}} */ @@ -27,14 +27,27 @@ annotation_type : false, refresh_interval : 0, limit_count : 10, - newest_first : false + newest_first : false, + polemics : [{ + keyword: "++", + background_color: "#c9ecc6" + },{ + keyword: "--", + background_color: "#f9c5c6" + },{ + keyword: "??", + background_color: "#cec5f9" + },{ + keyword: "==", + background_color: "#f9f4c6" + }] }; IriSP.Widgets.AnnotationsList.prototype.template = '
      ' + '