src/widgets/AnnotationsList.js
author durandn
Tue, 01 Sep 2015 15:31:46 +0200
changeset 1046 eb77616c245f
parent 1037 5c0416e8bba1
child 1053 149a4ea20ea7
permissions -rw-r--r--
Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
     1
IriSP.Widgets.AnnotationsList = function(player, config) {
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
     2
    IriSP.Widgets.Widget.call(this, player, config);
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
     3
    this.lastIds = [];
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
     4
    var _this = this;
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
     5
    this.throttledRefresh = IriSP._.throttle(function() {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
     6
        _this.refresh(false);
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
     7
    }, 800);
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
     8
    this.searchString = false;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
     9
    this.lastSearch = false;
585
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    10
};
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    11
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    12
IriSP.Widgets.AnnotationsList.prototype = new IriSP.Widgets.Widget();
585
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    13
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    14
IriSP.Widgets.AnnotationsList.prototype.defaults = {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    15
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    16
     * URL when the annotations are to be reloaded from an LDT-like segment API
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    17
     * e.g.
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    18
     * http://ldt.iri.centrepompidou.fr/ldtplatform/api/ldt/segments/{{media}}/{{begin}}/{{end}}?callback=?
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    19
     */
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    20
    ajax_url : false,
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    21
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    22
     * number of milliseconds before/after the current timecode when calling the
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    23
     * segment API
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    24
     */
967
b4c6e64acb2d Added a dual mode HTML/Flash player
veltr
parents: 966
diff changeset
    25
    ajax_granularity : 600000, 
925
28efc97b5d78 Corrected MAJOR bug in search results
veltr
parents: 924
diff changeset
    26
    default_thumbnail : "",
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    27
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    28
     * URL when the annotation is not in the current project, e.g.
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    29
     * http://ldt.iri.centrepompidou.fr/ldtplatform/ldt/front/player/{{media}}/{{project}}/{{annotationType}}#id={{annotation}}
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    30
     */
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    31
    foreign_url : "",
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    32
    annotation_type : false,
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    33
    refresh_interval : 0,
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    34
    limit_count : 20,
924
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    35
    newest_first : false,
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    36
    always_visible : false,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    37
    start_visible: true,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    38
    show_audio : true,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    39
    show_filters : false,
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    40
    show_header : false,
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    41
    custom_header : false,
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    42
    show_creation_date : false,
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    43
    show_timecode : true,
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    44
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    45
     * Only annotation in the current segment will be displayed. Designed to work with the Segments Widget.
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    46
     */
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    47
    filter_by_segments: false,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    48
    segments_annotation_type: "chap",
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    49
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    50
     * Set to a username if you only want to display annotations from a given user
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    51
     */
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    52
    show_only_annotation_from_user: false,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    53
    /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    54
     * Show a text field that filter annotations by username
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    55
     */
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    56
    filter_by_user: false,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    57
    tags : true,
924
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    58
    polemics : [{
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    59
        keyword: "++",
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    60
        background_color: "#c9ecc6"
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    61
    },{
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    62
        keyword: "--",
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    63
        background_color: "#f9c5c6"
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    64
    },{
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    65
        keyword: "??",
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    66
        background_color: "#cec5f9"
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    67
    },{
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    68
        keyword: "==",
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    69
        background_color: "#f9f4c6"
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
    70
    }]
585
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    71
};
44a4a4a179c1 first version of the AnnotationListWidget.
hamidouk
parents:
diff changeset
    72
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    73
IriSP.Widgets.AnnotationsList.prototype.messages = {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    74
    en: {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    75
        voice_annotation: "Voice Annotation",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    76
        now_playing: "Now playing...",
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    77
        everyone: "Everyone",
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    78
        header: "Annotations for this content"
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    79
    },
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    80
    fr: {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    81
        voice_annotation: "Annotation Vocale",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    82
        now_playing: "Lecture en cours...",
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    83
        everyone: "Tous",
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    84
        header: "Annotations sur ce contenu"
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    85
    }
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
    86
};
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
    87
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
    88
IriSP.Widgets.AnnotationsList.prototype.template =
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    89
    '{{#show_header}}<p class="Ldt-AnnotationsList-header">'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    90
    +     '{{#custom_header}}{{custom_header}}{{/custom_header}}'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    91
    +     '{{^custom_header}}{{l10n.header}}{{/custom_header}}'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    92
    + '</p>{{/show_header}}'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    93
    + '<div class="Ldt-AnnotationsListWidget">'
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    94
    + '{{#show_filters}}'
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
    95
    + '<div class="Ldt-AnnotationsList-Filters">'
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    96
    +    '<input class="Ldt-AnnotationsList-filter-text" id="Ldt-AnnotationsList-keywordsFilter" type="text" value=""></input>'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    97
    +    '<select class="Ldt-AnnotationsList-filter-dropdown" id="Ldt-AnnotationsList-userFilter"><option selected value="">{{l10n.everyone}}</option></select>'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    98
    +    '<label class="Ldt-AnnotationsList-filter-date">Date: <input id="Ldt-AnnotationsList-dateFilter" type="text"></input></label>'
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
    99
    +    '<label class="Ldt-AnnotationsList-filter-checkbox"><input type="checkbox" id="Ldt-AnnotationsList-ignoreSegmentsFilter">Toutes annotations</label>'
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   100
    + '</div>'
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   101
    + '{{/show_filters}}'
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   102
    + '{{#show_audio}}<div class="Ldt-AnnotationsList-Audio"></div>{{/show_audio}}'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   103
    + '<ul class="Ldt-AnnotationsList-ul">'
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   104
    + '</ul>'
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   105
    + '</div>';
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   106
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   107
IriSP.Widgets.AnnotationsList.prototype.annotationTemplate = 
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   108
    '<li class="Ldt-AnnotationsList-li Ldt-TraceMe" trace-info="annotation-id:{{id}}, media-id:{{media_id}}" style="{{specific_style}}">'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   109
    + '<div class="Ldt-AnnotationsList-ThumbContainer">'
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   110
    + '<a href="{{url}}" draggable="true">'
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   111
    + '<img class="Ldt-AnnotationsList-Thumbnail" src="{{thumbnail}}" />'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   112
    + '</a>'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   113
    + '</div>'
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   114
    + '{{#show_timecode}}<div class="Ldt-AnnotationsList-Duration">{{begin}} - {{end}}</div>{{/show_timecode}}'
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   115
    + '<h3 class="Ldt-AnnotationsList-Title" draggable="true">'
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   116
    + '<a href="{{url}}">{{{htitle}}}</a>'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   117
    + '</h3>'
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   118
    + '<p class="Ldt-AnnotationsList-Description">{{{hdescription}}}</p>'
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   119
    + '{{#created}}'
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   120
    + '<div class="Ldt-AnnotationsList-CreationDate">{{{created}}}</div>'
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   121
    + '{{/created}}'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   122
    + '{{#tags.length}}'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   123
    + '<ul class="Ldt-AnnotationsList-Tags">'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   124
    + '{{#tags}}'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   125
    + '{{#.}}'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   126
    + '<li class="Ldt-AnnotationsList-Tag-Li">'
902
14022f1d49ab Added MediaList widget for mashup
veltr
parents: 876
diff changeset
   127
    + '<span>{{.}}</span>'
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   128
    + '</li>'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   129
    + '{{/.}}'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   130
    + '{{/tags}}'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   131
    + '</ul>'
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   132
    + '{{/tags.length}}'
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   133
    + '{{#audio}}<div class="Ldt-AnnotationsList-Play" data-annotation-id="{{id}}">{{l10n.voice_annotation}}</div>{{/audio}}'
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   134
    + '</li>';
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   135
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   136
// obj.url = this.project_url + "/" + media + "/" + annotations[i].meta.project
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   137
// + "/" + annotations[i].meta["id-ref"] + '#id=' + annotations[i].id;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   138
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   139
IriSP.Widgets.AnnotationsList.prototype.ajaxSource = function() {
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   140
    var _currentTime = this.media.getCurrentTime(),
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   141
        _duration = this.media.duration;
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   142
    this.lastAjaxQuery = _currentTime;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   143
    var _url = Mustache.to_html(this.ajax_url, {
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   144
        media : this.source.currentMedia.id,
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   145
        begin : Math.max(0, _currentTime - this.ajax_granularity),
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   146
        end : Math.min(_duration.milliseconds, _currentTime + this.ajax_granularity)
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   147
    });
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   148
    this.currentSource = this.player.loadMetadata(IriSP._.defaults({
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   149
        "url" : _url
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   150
    }, this.metadata));
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   151
};
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   152
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   153
IriSP.Widgets.AnnotationsList.prototype.ajaxMashup = function() {
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   154
    var _currentTime = this.media.getCurrentTime();
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   155
    var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   156
    if (typeof _currentAnnotation !== "undefined" && _currentAnnotation.id !== this.lastMashupAnnotation) {
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   157
        this.lastMashupAnnotation = _currentAnnotation.id;
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   158
        var _currentMedia = _currentAnnotation.getMedia(),
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   159
            _url = Mustache.to_html(this.ajax_url, {
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   160
                media : _currentMedia.id,
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   161
                begin : Math.max(0, _currentAnnotation.annotation.begin.milliseconds - this.ajax_granularity),
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   162
                end : Math.min(_currentMedia.duration.milliseconds, _currentAnnotation.annotation.end.milliseconds + this.ajax_granularity)
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   163
            });
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   164
        this.currentSource = this.player.loadMetadata(IriSP._.defaults({
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   165
            "url" : _url
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   166
        }, this.metadata));
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   167
    }
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   168
};
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   169
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   170
IriSP.Widgets.AnnotationsList.prototype.refresh = function(_forceRedraw) {
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   171
    _forceRedraw = (typeof _forceRedraw !== "undefined" && _forceRedraw);
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   172
    if (this.currentSource.status !== IriSP.Model._SOURCE_STATUS_READY) {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   173
        return 0;
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   174
    }
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   175
    var _this = this,
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   176
        _currentTime = this.media.getCurrentTime();
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   177
    var _list = this.annotation_type ? this.currentSource.getAnnotationsByTypeTitle(this.annotation_type) : this.currentSource.getAnnotations();
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   178
    if (this.mashupMode) {
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   179
        var _currentAnnotation = this.source.currentMedia.getAnnotationAtTime(_currentTime);
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   180
        if (typeof _currentAnnotation !== "undefined") {
965
eadb7290c325 Improvements in widget communication
veltr
parents: 963
diff changeset
   181
            _currentTime = _currentTime - _currentAnnotation.begin + _currentAnnotation.annotation.begin;
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   182
            var _mediaId = _currentAnnotation.getMedia().id;
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   183
            _list = _list.filter(function(_annotation) {
916
ec6849bbbdcc Removed Namespacing before rewrite
veltr
parents: 909
diff changeset
   184
                return _annotation.getMedia().id === _mediaId;
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   185
            });
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   186
        }
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   187
    }
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   188
    _list = _list.filter(function(_annotation) {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   189
        return _annotation.found !== false;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   190
    });
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   191
    
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   192
    if ((this.filter_by_segments)&&(!(this.show_filters && this.ignoresegmentcheckbox_$[0].checked))) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   193
        /*
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   194
         *  A given annotation is considered "in" segment if the middle of it is between the segment beginning and the segment end. 
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   195
         *  Note this is meant to be used for "markings" annotations (not segments)
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   196
         */
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   197
        _segmentsAnnotation = this.currentSource.getAnnotationsByTypeTitle(this.segments_annotation_type)
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   198
        if (this.media.getTimeRange()){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   199
            _currentSegments = _segmentsAnnotation.filter(function(_segment){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   200
                return (_this.media.getTimeRange()[0] == _segment.begin && _this.media.getTimeRange()[1] == _segment.end)
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   201
            });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   202
        }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   203
        else {
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   204
            _currentSegments = _segmentsAnnotation.filter(function(_segment){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   205
                return (_currentTime >= _segment.begin && _currentTime <= _segment.end)
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   206
            });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   207
        }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   208
        if (_currentSegments.length == 0) {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   209
            _list = _list.filter(function(_annotation){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   210
                return false;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   211
            });
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   212
        }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   213
        else {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   214
            _list = _list.filter(function(_annotation){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   215
                _annotation_time = (_annotation.begin+_annotation.end)/2;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   216
                return (_currentSegments[0].begin <= _annotation_time && _currentSegments[0].end >= _annotation_time)
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   217
            });
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   218
        }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   219
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   220
    if (this.show_only_annotation_from_user){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   221
        _list = _list.filter(function(_annotation){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   222
           return _annotation.creator == _this.show_only_annotation_from_user;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   223
        });
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   224
    }
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   225
    if (this.limit_count) {
965
eadb7290c325 Improvements in widget communication
veltr
parents: 963
diff changeset
   226
        /* Get the n annotations closest to current timecode */
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   227
        _list = _list.sortBy(function(_annotation) {
965
eadb7290c325 Improvements in widget communication
veltr
parents: 963
diff changeset
   228
            return Math.abs((_annotation.begin + _annotation.end) / 2 - _currentTime);
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   229
        }).slice(0, this.limit_count);
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   230
    }
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   231
    
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   232
    if (this.newest_first) {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   233
        _list = _list.sortBy(function(_annotation) {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   234
            return -_annotation.created.valueOf();
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   235
        });
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   236
    } else {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   237
        _list = _list.sortBy(function(_annotation) {
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   238
            return _annotation.begin;
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   239
        });
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   240
    }
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   241
    
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   242
    if (this.show_filters){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   243
        _username = this.userselect_$[0].options[this.userselect_$[0].selectedIndex].value;
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   244
        if (_username != "false")
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   245
        {
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   246
            _list = _list.filter(function(_annotation){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   247
                return _annotation.creator == _username
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   248
            })
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   249
        }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   250
        _keyword = this.keywordinput_$[0].value;
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   251
        if (_keyword != ""){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   252
            _list = _list.filter(function(_annotation){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   253
               return _annotation.description.toLowerCase().match(_keyword.toLowerCase());
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   254
            });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   255
        }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   256
        
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   257
        
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   258
        if(this.datefilterinput_$[0].value != ""){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   259
            _date = this.datefilterinput_$.datepicker("getDate");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   260
            _list = _list.filter(function(_annotation){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   261
                return ((_annotation.created.getDate() == _date.getDate())&&(_annotation.created.getMonth() == _date.getMonth())&&(_annotation.created.getFullYear() == _date.getFullYear()))
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   262
            });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   263
        }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   264
        
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   265
    }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   266
    
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   267
    var _ids = _list.idIndex;
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   268
    
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   269
    if (_forceRedraw || !IriSP._.isEqual(_ids, this.lastIds) || this.searchString !== this.lastSearch) {
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   270
        /* This part only gets executed if the list needs updating */
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   271
        this.lastSearch = this.searchString;
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   272
        this.lastIds = _ids;
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   273
        this.list_$.html("");
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   274
        _list.forEach(function(_annotation) {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   275
            var _url = (
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   276
                ( typeof _annotation.url !== "undefined" && _annotation.url)
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   277
                ? _annotation.url
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   278
                : (
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   279
                    ( typeof _this.source.projectId !== "undefined" && typeof _annotation.project !== "undefined" && _annotation.project && _this.source.projectId !== _annotation.project )
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   280
                    ? Mustache.to_html(
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   281
                        _this.foreign_url,
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   282
                        {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   283
                            project : _annotation.project,
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   284
                            media : _annotation.media.id,
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   285
                            annotation : _annotation.id,
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   286
                            annotationType : _annotation.annotationType.id
924
64c2eaafe5e2 Modifications for LDT-Platform
veltr
parents: 923
diff changeset
   287
                        }
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   288
                    )
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   289
                    : document.location.href.replace(/#.*$/,'') + '#id=' + _annotation.id
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   290
                    )
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   291
            );
1021
7253d4d06f0d update widgets after enhance in annotation platform.
cavaliet
parents: 1013
diff changeset
   292
            var _title = "",
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   293
                _description = _annotation.description,
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   294
                _thumbnail = (typeof _annotation.thumbnail !== "undefined" && _annotation.thumbnail ? _annotation.thumbnail : _this.default_thumbnail)
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   295
            
1021
7253d4d06f0d update widgets after enhance in annotation platform.
cavaliet
parents: 1013
diff changeset
   296
            // Update : display creator
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   297
            if (_annotation.creator) {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   298
                _title = _annotation.creator;
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   299
            }
1021
7253d4d06f0d update widgets after enhance in annotation platform.
cavaliet
parents: 1013
diff changeset
   300
            if (_annotation.title) {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   301
                var tempTitle = _annotation.title;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   302
                if( tempTitle.substr(0, _title.length + 1) == (_title + ":") ){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   303
                    _title = "";
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   304
                }
1021
7253d4d06f0d update widgets after enhance in annotation platform.
cavaliet
parents: 1013
diff changeset
   305
                _title = _title + ( (_title=="") ? "" : ": ") + _annotation.title;
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   306
            }
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   307
            var _bgcolor;
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   308
            IriSP._(_this.polemics).each(function(_polemic) {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   309
                var _rgxp = IriSP.Model.regexpFromTextOrArray(_polemic.keyword, true);
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   310
                if (_rgxp.test(_title + " " + _description)) {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   311
                    _bgcolor = _polemic.background_color;
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   312
                }
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   313
            });
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   314
            var _created = false;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   315
            if (_this.show_creation_date) {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   316
                _created = _annotation.created.toLocaleDateString()+", "+_annotation.created.toLocaleTimeString();
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   317
            }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   318
            if(this.tags == true){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   319
                var _tags = _annotation.getTagTexts();
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   320
            }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   321
            else {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   322
                var _tags = false;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   323
            }
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   324
            var _data = {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   325
                id : _annotation.id,
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   326
                media_id : _annotation.getMedia().id,
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   327
                htitle : IriSP.textFieldHtml(_title),
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   328
                hdescription : IriSP.textFieldHtml(_description),
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   329
                begin : _annotation.begin.toString(),
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   330
                end : _annotation.end.toString(),
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   331
                created : _created,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   332
                show_timecode : _this.show_timecode,
993
a7efd386872a Drag-and-drop support for Renkan
raph
parents: 988
diff changeset
   333
                thumbnail : _thumbnail,
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   334
                url : _url,
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   335
                tags : _tags,
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   336
                specific_style : (typeof _bgcolor !== "undefined" ? "background-color: " + _bgcolor : ""),
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   337
                l10n: _this.l10n
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   338
            };
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   339
            if (_this.show_audio && _annotation.audio && _annotation.audio.href && _annotation.audio.href != "null") {
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   340
                _data.audio = true;
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   341
                if (!_this.jwplayers[_annotation.id]) {
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   342
                    var _audiofile = _annotation.audio.href;
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   343
                    if (_this.audio_url_transform) {
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   344
                        _audiofile = _this.audio_url_transform(_annotation.audio.href);
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   345
                    }
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   346
                    var _tmpId = "jwplayer-" + IriSP.Model.getUID();
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   347
                    _this.jwplayers[_annotation.id] = _tmpId;
1011
7396abb7e251 Corrections on AnnotationsList
veltr
parents: 1010
diff changeset
   348
                    _this.$.find(".Ldt-AnnotationsList-Audio").append(IriSP.jQuery("<div>").attr("id", _tmpId));
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   349
                    jwplayer(_tmpId).setup({
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   350
                        flashplayer: IriSP.getLib("jwPlayerSWF"),
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   351
                        file: _audiofile,
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   352
                        fallback: false,
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   353
                        primary: "flash",
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   354
                        controls: false,
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   355
                        width: 1,
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   356
                        height: 1,
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   357
                        events: {
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   358
                            onPause: function() {
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   359
                                _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.voice_annotation);
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   360
                            },
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   361
                            onPlay: function() {
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   362
                                _this.$.find(".Ldt-AnnotationsList-Play[data-annotation-id=" + _annotation.id + "]").text(_this.l10n.now_playing);
1011
7396abb7e251 Corrections on AnnotationsList
veltr
parents: 1010
diff changeset
   363
                            }
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   364
                        }
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   365
                    });
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   366
                }
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   367
            }
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   368
            var _html = Mustache.to_html(_this.annotationTemplate, _data),
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   369
                _el = IriSP.jQuery(_html),
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   370
                _onselect = function() {
1011
7396abb7e251 Corrections on AnnotationsList
veltr
parents: 1010
diff changeset
   371
                    _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   372
                    _el.addClass("selected");
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   373
                },
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   374
                _onunselect = function() {
1011
7396abb7e251 Corrections on AnnotationsList
veltr
parents: 1010
diff changeset
   375
                    _this.$.find('.Ldt-AnnotationsList-li').removeClass("selected");
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   376
                };
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   377
            _el.mouseover(function() {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   378
                    _annotation.trigger("select");
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   379
                })
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   380
                .mouseout(function() {
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   381
                    _annotation.trigger("unselect");
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   382
                })
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   383
                .click(function() {
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   384
                    _annotation.trigger("click");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   385
                })
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   386
                .appendTo(_this.list_$);
996
c472984db275 refactored drag-and-drop interface (IE Compatibility)
veltr
parents: 994
diff changeset
   387
            IriSP.attachDndData(_el.find("[draggable]"), {
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   388
                title: _title,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   389
                description: _description,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   390
                uri: _url,
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   391
                image: _annotation.thumbnail
996
c472984db275 refactored drag-and-drop interface (IE Compatibility)
veltr
parents: 994
diff changeset
   392
            });
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   393
            _el.on("remove", function() {
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   394
                _annotation.off("select", _onselect);
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   395
                _annotation.off("unselect", _onunselect);
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   396
            });
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   397
            _annotation.on("select", _onselect);
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   398
            _annotation.on("unselect", _onunselect);
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   399
        });
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   400
        
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   401
        /* Correct the empty tag bug */
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   402
        this.$.find('.Ldt-AnnotationsList-Tag-Li').each(function() {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   403
            var _el = IriSP.jQuery(this);
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   404
            if (!_el.text().replace(/(^\s+|\s+$)/g,'')) {
969
353b0881a0b9 Added On-the-fly (file-less) metadata generation test
veltr
parents: 967
diff changeset
   405
                _el.remove();
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   406
            }
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   407
        });
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   408
    
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   409
        this.$.find('.Ldt-AnnotationsList-Tag-Li').click(function() {
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   410
            _this.source.getAnnotations().search(IriSP.jQuery(this).text().replace(/(^\s+|\s+$)/g,''));
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   411
        });
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   412
        
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   413
        this.$.find(".Ldt-AnnotationsList-Play").click(function() {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   414
            var _el = IriSP.jQuery(this),
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   415
                _annid = _el.attr("data-annotation-id");
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   416
            if (_this.jwplayers[_annid]) {
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   417
                jwplayer(_this.jwplayers[_annid]).play();
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   418
            }
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   419
            _this.media.pause();
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   420
        });
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   421
        
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   422
        if (this.source.getAnnotations().searching) {
988
eefd336335f9 Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents: 983
diff changeset
   423
            var rx = _this.source.getAnnotations().regexp || false;
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   424
            this.$.find(".Ldt-AnnotationsList-Title a, .Ldt-AnnotationsList-Description").each(function() {
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   425
                var _$ = IriSP.jQuery(this);
988
eefd336335f9 Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents: 983
diff changeset
   426
                _$.html(IriSP.textFieldHtml(_$.text(), rx));
eefd336335f9 Some improvements: Hashtags can be used, links are now clickable, ....
veltr
parents: 983
diff changeset
   427
            });
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   428
        }
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   429
    }
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   430
    
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   431
    if (this.ajax_url) {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   432
        if (this.mashupMode) {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   433
            this.ajaxMashup();
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   434
        } else {
963
d58d0dcdb640 Bugfixes
veltr
parents: 959
diff changeset
   435
            if (Math.abs(_currentTime - this.lastAjaxQuery) > (this.ajax_granularity)) {
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   436
                this.ajaxSource();
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   437
            }
872
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   438
        }
d777d05a16e4 finished AnnotationsList and started New PolemicWidget
veltr
parents: 870
diff changeset
   439
    }
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   440
    
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   441
    return _list.length;
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   442
};
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   443
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   444
IriSP.Widgets.AnnotationsList.prototype.hide = function() {
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   445
    var _this = this;
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   446
    if (this.visible){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   447
        this.visible = false;
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   448
        this.widget_$.slideUp(function(){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   449
            _this.$.find('.Ldt-AnnotationsList-header').hide();            
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   450
        });
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   451
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   452
}
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   453
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   454
IriSP.Widgets.AnnotationsList.prototype.show = function() {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   455
    if(!this.visible){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   456
        this.visible = true;
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   457
        this.$.find('.Ldt-AnnotationsList-header').show();
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   458
        this.widget_$.slideDown();
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   459
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   460
}
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   461
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   462
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   463
IriSP.Widgets.AnnotationsList.prototype.toggle = function() {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   464
    if (!this.always_visible) {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   465
        if (this.visible) {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   466
            this.hide();
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   467
        } else {
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   468
            this.show();
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   469
        }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   470
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   471
};
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   472
875
43629caa77bc Big refactoring of widget files + started migration of segmentwidget
veltr
parents: 874
diff changeset
   473
IriSP.Widgets.AnnotationsList.prototype.draw = function() {
876
03967b6ada7c ArrowWidget, AnnotationWidget
veltr
parents: 875
diff changeset
   474
    
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   475
    this.jwplayers = {};
959
ee11ed1b739e Mashup Player and Dailymotion are now widgets
veltr
parents: 957
diff changeset
   476
    this.mashupMode = (this.media.elementType === "mashup");
ee11ed1b739e Mashup Player and Dailymotion are now widgets
veltr
parents: 957
diff changeset
   477
    
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   478
    this.renderTemplate();
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   479
    
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   480
    var _this = this;
1010
5566738cb829 Updated AnnotationsList for new jwplayer
veltr
parents: 1005
diff changeset
   481
        
937
eb3c442cec50 Added events on annotation for inter widget communication
veltr
parents: 930
diff changeset
   482
    this.list_$ = this.$.find(".Ldt-AnnotationsList-ul");
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   483
    this.widget_$ = this.$.find(".Ldt-AnnotationsListWidget");
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   484
    this.userselect_$ = this.$.find("#Ldt-AnnotationsList-userFilter");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   485
    this.userselect_$.change(function(){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   486
        _this.player.trigger("AnnotationsList.refresh");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   487
    });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   488
    this.keywordinput_$ = this.$.find("#Ldt-AnnotationsList-keywordsFilter");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   489
    this.keywordinput_$.keyup(function(){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   490
        _this.player.trigger("AnnotationsList.refresh");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   491
    });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   492
    this.ignoresegmentcheckbox_$ = this.$.find("#Ldt-AnnotationsList-ignoreSegmentsFilter");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   493
    this.ignoresegmentcheckbox_$.click(function(){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   494
        _this.player.trigger("AnnotationsList.refresh");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   495
    });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   496
    this.datefilterinput_$ = this.$.find("#Ldt-AnnotationsList-dateFilter");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   497
    this.datefilterinput_$.datepicker({ dateFormat: 'dd/mm/yy' });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   498
    this.datefilterinput_$.change(function(){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   499
        _this.player.trigger("AnnotationsList.refresh")
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   500
    })
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   501
    
983
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   502
    this.source.getAnnotations().on("search", function(_text) {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   503
        _this.searchString = _text;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   504
        if (_this.source !== _this.currentSource) {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   505
            _this.currentSource.getAnnotations().search(_text);
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   506
            _this.throttledRefresh();
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   507
        }
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   508
    });
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   509
    this.source.getAnnotations().on("found", function() {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   510
        _this.throttledRefresh();
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   511
    });
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   512
    this.source.getAnnotations().on("not-found", function() {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   513
        _this.throttledRefresh();
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   514
    });
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   515
    this.source.getAnnotations().on("clear-search", function() {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   516
        _this.searchString = false;
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   517
        if (_this.source !== _this.currentSource) {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   518
            _this.currentSource.getAnnotations().trigger("clear-search");
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   519
        }
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   520
    });
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   521
    this.source.getAnnotations().on("search-cleared", function() {
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   522
        _this.throttledRefresh();
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   523
    });
97fef7a4b189 updated search
veltr
parents: 969
diff changeset
   524
    
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   525
    if (this.show_filters){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   526
        _usernames = Array();
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   527
        _list = this.getWidgetAnnotations()
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   528
        _list.forEach(function(_annotation){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   529
            if(_usernames.indexOf(_annotation.creator) == -1){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   530
                _usernames.push(_annotation.creator);
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   531
            }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   532
        });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   533
        this.userselect_$.html("<option selected value='false'>"+this.l10n.everyone+"</option>");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   534
        _usernames.forEach(function(_user){
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   535
            _this.userselect_$.append("<option value='"+_user+"'>"+_user+"</option>");
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   536
        });
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   537
    }
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   538
    
966
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   539
    this.onMdpEvent("AnnotationsList.refresh", function() {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   540
        if (_this.ajax_url) {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   541
            if (_this.mashupMode) {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   542
                _this.ajaxMashup();
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   543
            } else {
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   544
                _this.ajaxSource();
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   545
            }
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   546
        }
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   547
        _this.throttledRefresh();
c1c762ad1697 Added Voice Annotation Support
veltr
parents: 965
diff changeset
   548
    });
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   549
    
903
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   550
    if (this.ajax_url) {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   551
        if (this.mashupMode) {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   552
            this.ajaxMashup();
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   553
        } else {
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   554
            this.ajaxSource();
d9da52e20f7f AnnotationsList now updated to work with mashups
veltr
parents: 902
diff changeset
   555
        }
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   556
    } else {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   557
        this.currentSource = this.source;
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   558
    }
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   559
    
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   560
    if (this.refresh_interval) {
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   561
        window.setInterval(function() {
1013
392ddcd212d7 Throwed in a bunch of semicolons
veltr
parents: 1011
diff changeset
   562
            _this.currentSource.get();
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   563
        }, this.refresh_interval);
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   564
    }
674
835f5f454595 WIP - working on ajax autoupdate of the widget.
hamidouk
parents: 642
diff changeset
   565
    
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   566
    this.onMdpEvent("AnnotationsList.toggle","toggle");
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   567
    this.onMdpEvent("AnnotationsList.hide", "hide");
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   568
    this.onMdpEvent("AnnotationsList.show", "show");
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   569
    
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   570
    this.onMdpEvent("createAnnotationWidget.addedAnnotation", this.throttledRefresh);
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   571
    var _events = [
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   572
        "timeupdate",
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   573
        "seeked",
1046
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   574
        "loadedmetadata",
eb77616c245f Updated LatestAnnotation, CurrentSegmentInfobox, AnnotationController and AnnotationList widgets to use timerange to find the current segment when the corresponding option is used + CurrentSegmentInfobox now has an option for editing the current segment + LatestAnnotation now has a "Copy and edit" button that allows to use the text from the currently displayed annotation into the CreateAnnotation widget textarea
durandn
parents: 1037
diff changeset
   575
        "settimerange"
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   576
    ];
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   577
    for (var _i = 0; _i < _events.length; _i++) {
957
4da0a5740b6c Starting 'players-as-widgets' branch
veltr
parents: 944
diff changeset
   578
        this.onMediaEvent(_events[_i], this.throttledRefresh);
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   579
    }
730
357fc047503b redraw the widget after that an annotation has been added.
hamidouk
parents: 729
diff changeset
   580
    
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   581
    this.throttledRefresh();
1037
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   582
    
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   583
    this.visible = true;
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   584
    if (!this.start_visible){
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   585
        this.hide();
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   586
    }
5c0416e8bba1 AnnotationsList widget new features: show creation date for annotations, hide/show feature on signal trigger, filter by username
durandn
parents: 1033
diff changeset
   587
    
870
2c025db10a10 Migrated playerWidget and started annotationsListWidget
veltr
parents: 852
diff changeset
   588
};