| author | veltr |
| Thu, 10 May 2012 18:48:09 +0200 | |
| branch | new-model |
| changeset 887 | 6a04bd37da0a |
| parent 882 | 61c384dda19e |
| child 904 | 510ebab76fa3 |
| permissions | -rw-r--r-- |
| 880 | 1 |
IriSP.Widgets.CreateAnnotation = function(player, config) { |
2 |
IriSP.Widgets.Widget.call(this, player, config); |
|
3 |
this.lastAnnotation = false; |
|
4 |
}; |
|
5 |
||
6 |
IriSP.Widgets.CreateAnnotation.prototype = new IriSP.Widgets.Widget(); |
|
7 |
||
8 |
IriSP.Widgets.CreateAnnotation.prototype.defaults = { |
|
9 |
single_time_mode : false, |
|
| 881 | 10 |
show_title_field : true, |
11 |
user_avatar : "https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png" |
|
| 882 | 12 |
/* |
13 |
tags : [ |
|
14 |
{ |
|
15 |
id: "digitalstudies", |
|
16 |
meta: { |
|
17 |
description: "#digital-studies" |
|
18 |
} |
|
19 |
}, |
|
20 |
{ |
|
21 |
id: "amateur", |
|
22 |
meta: { |
|
23 |
description: "#amateur" |
|
24 |
}, |
|
25 |
} |
|
26 |
], |
|
27 |
remote_tags : false, |
|
28 |
random_tags : false, |
|
29 |
show_from_field : false, |
|
30 |
disable_share : false, |
|
31 |
polemic_mode : true, // enable polemics |
|
32 |
polemics : [{ |
|
33 |
className: "positive", |
|
34 |
keyword: "++" |
|
35 |
}, { |
|
36 |
className: "negative", |
|
37 |
keyword: "--" |
|
38 |
}, { |
|
39 |
className: "reference", |
|
40 |
keyword: "==" |
|
41 |
}, { |
|
42 |
className: "question", |
|
43 |
keyword: "??" |
|
44 |
}], |
|
45 |
cinecast_version : false, // put to false to enable the platform version, true for the festival cinecast one. |
|
46 |
||
47 |
// where does the widget PUT the annotations - this is a mustache template. id refers to the id of the media and is filled by the widget. |
|
48 |
|
|
49 |
api_endpoint_template : "", // platform_url + "/ldtplatform/api/ldt/annotations/{{id}}.json", |
|
50 |
api_method : "PUT" |
|
51 |
*/ |
|
| 880 | 52 |
} |
53 |
||
54 |
IriSP.Widgets.CreateAnnotation.prototype.messages = { |
|
| 882 | 55 |
en: { |
56 |
from_time: "from", |
|
57 |
to_time: "to", |
|
58 |
at_time: "at", |
|
59 |
submit: "Submit", |
|
60 |
add_keywords: "Add keywords", |
|
61 |
add_polemic_keywords: "Add polemic keywords", |
|
62 |
your_name: "Your name", |
|
63 |
no_title: "Annotate this video", |
|
64 |
type_title: "Annotation title", |
|
65 |
type_description: "Type the full description of your annotation here.", |
|
66 |
wait_while_processing: "Please wait while your request is being processed...", |
|
67 |
error_while_contacting: "An error happened while contacting the server. Your annotation has not been saved.", |
|
68 |
empty_annotation: "Your annotation is empty. Please write something before submitting.", |
|
69 |
annotation_saved: "Thank you, your annotation has been saved.", |
|
70 |
share_annotation: "Would you like to share it on social networks ?", |
|
71 |
share_on: "Share on", |
|
72 |
more_tags: "More tags", |
|
73 |
cancel: "Cancel" |
|
| 880 | 74 |
}, |
| 882 | 75 |
fr: { |
76 |
from_time: "from", |
|
77 |
to_time: "Ã ", |
|
78 |
at_time: "Ã ", |
|
79 |
submit: "Envoyer", |
|
80 |
add_keywords: "Ajouter des mots-clés", |
|
81 |
add_polemic_keywords: "Ajouter des mots-clés polémiques", |
|
82 |
your_name: "Votre nom", |
|
83 |
no_title: "Annoter cette vidéo", |
|
84 |
type_title: "Titre de l'annotation", |
|
85 |
type_description: "Rédigez le contenu de votre annotation ici.", |
|
86 |
wait_while_processing: "Veuillez patienter pendant le traitement de votre requête...", |
|
87 |
error_while_contacting: "Une erreur s'est produite en contactant le serveur. Votre annotation n'a pas été enregistrée", |
|
88 |
empty_annotation: "Votre annotation est vide. Merci de rédiger un texte avant de l'envoyer.", |
|
89 |
annotation_saved: "Merci, votre annotation a été enregistrée.", |
|
90 |
share_annotation: "Souhaitez-vous la partager sur les réseaux sociaux ?", |
|
91 |
share_on: "Partager sur", |
|
92 |
more_tags: "Plus de mots-clés", |
|
93 |
cancel: "Cancel" |
|
| 880 | 94 |
} |
95 |
} |
|
96 |
||
97 |
IriSP.Widgets.CreateAnnotation.prototype.template = |
|
| 881 | 98 |
'<div class="Ldt-CreateAnnotation"><div class="Ldt-CreateAnnotation-Inner">' |
99 |
+ '<form class="Ldt-CreateAnnotation-Screen Ldt-CreateAnnotation-Main">' |
|
100 |
+ '<h3>{{#show_title_field}}<input class="Ldt-CreateAnnotation-Title" placeholder="{{l10n.type_title}}" />{{/show_title_field}}' |
|
101 |
+ '{{^show_title_field}}<span class="Ldt-CreateAnnotation-NoTitle">{{l10n.no_title}}</span>{{/show_title_field}}' |
|
102 |
+ ' <span class="Ldt-CreateAnnotation-Times">{{#single_time_mode}}{{l10n.at_time}}{{/single_time_mode}}' |
|
103 |
+ '{{^single_time_mode}}{{l10n.from_time}}{{/single_time_mode}} <span class="Ldt-CreateAnnotation-Begin"></span>' |
|
104 |
+ ' {{^single_time_mode}}{{l10n.to_time}} <span class="Ldt-CreateAnnotation-End"></span>{{/single_time_mode}}</span></h3>' |
|
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
105 |
+ '<textarea class="Ldt-CreateAnnotation-Description" placeholder="{{type_description}}"></textarea>' |
|
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
106 |
+ '<input type="submit" class="Ldt-CreateAnnotation-Submit" />' |
|
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
107 |
+ '</form>' |
|
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
108 |
+ '</div></div>'; |
| 880 | 109 |
|
|
887
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
110 |
IriSP.Widgets.CreateAnnotation.prototype.draw = function() { |
|
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
111 |
this.renderTemplate(); |
|
6a04bd37da0a
Corrected lib loading function so several instances of the Metadataplayer can be called
veltr
parents:
882
diff
changeset
|
112 |
} |
| 880 | 113 |
|
114 |
/* |
|
115 |
+ ' <div class="Ldt-CreateAnnotation-Screen Ldt-createAnnotation-startScreen">' |
|
116 |
+ ' <div style="margin-bottom: 7px; overflow: auto;">' |
|
117 |
+ ' <div class="Ldt-createAnnotation-Title"></div>' |
|
118 |
+ ' <div class="Ldt-createAnnotation-TimeFrame"></div>' |
|
119 |
+ ' {{^cinecast_version}} <div class="Ldt-createAnnotation-Minimize Ldt-TraceMe" title="Cancel"></div>' |
|
120 |
+ ' {{/cinecast_version}}' |
|
121 |
+ ' </div>' |
|
122 |
+ ' <div class="Ldt-createAnnotation-Container">' |
|
123 |
+ ' {{#show_from_field}}' |
|
124 |
+ ' <label>{{l10n.your_name}} : </label><input class="Ldt-createAnnotation-userName Ldt-TraceMe" value="{{user_name}}" />' |
|
125 |
+ ' {{/show_from_field}}' |
|
126 |
+ ' <textarea class="Ldt-createAnnotation-Description Ldt-TraceMe"></textarea>' |
|
127 |
+ ' <div class="Ldt-createAnnotation-userAvatar Ldt-TraceMe">' |
|
128 |
+ ' {{^user_avatar}} <img src="https://si0.twimg.com/sticky/default_profile_images/default_profile_1_normal.png"></img>' |
|
129 |
+ ' {{/user_avatar}}' |
|
130 |
+ ' {{#user_avatar}} <img src="{{ user_avatar }}"></img>' |
|
131 |
+ ' {{/user_avatar}}' |
|
132 |
+ ' </div>' |
|
133 |
+ ' <div class="Ldt-createAnnotation-profileArrow"></div>' |
|
134 |
+ ' </div>' |
|
135 |
+ ' <button class="Ldt-createAnnotation-submitButton Ldt-TraceMe">{{l10n.submit}}</button>' |
|
136 |
+ ' {{#tags.length}}' |
|
137 |
+ ' <div class="Ldt-createAnnotation-btnblock Ldt-createAnnotation-keywords">' |
|
138 |
+ ' <label>{{l10n.add_keywords}} :</label>' |
|
139 |
+ ' <ul class="Ldt-floatList">' |
|
140 |
+ ' {{#tags}}' |
|
141 |
+ ' <li><button class="Ldt-createAnnotation-keyword-button Ldt-TraceMe" tag-id="{{id}}">{{meta.description}}</button></li>' |
|
142 |
+ ' {{/tags}}' |
|
143 |
+ ' </ul>' |
|
144 |
+ ' </div>' |
|
145 |
+ ' {{#random_tags}}' |
|
146 |
+ ' <button class="Ldt-createAnnotation-moar-keywordz">{{l10n.more_tags}}</button>' |
|
147 |
+ ' {{/random_tags}}' |
|
148 |
+ ' {{/tags.length}}' |
|
149 |
+ ' {{#polemic_mode}}' |
|
150 |
+ ' {{#polemics.length}}' |
|
151 |
+ ' <div class="Ldt-createAnnotation-btnblock Ldt-createAnnotation-polemics">' |
|
152 |
+ ' <label>{{l10n.add_polemic_keywords}} :</label>' |
|
153 |
+ ' <ul class="Ldt-floatList">' |
|
154 |
+ ' {{#polemics}}' |
|
155 |
+ ' <li><button class="Ldt-createAnnotation-polemic-{{className}} Ldt-createAnnotation-polemic-button Ldt-TraceMe">{{keyword}}</button></li>' |
|
156 |
+ ' {{/polemics}}' |
|
157 |
+ ' </ul>' |
|
158 |
+ ' </div>' |
|
159 |
+ ' {{/polemics.length}}' |
|
160 |
+ ' {{/polemic_mode}}' |
|
161 |
+ ' </div>' |
|
162 |
+ ' <div class="Ldt-createAnnotation-screen Ldt-createAnnotation-waitScreen" style="display: none; text-align: center">' |
|
163 |
+ ' <div class="Ldt-createAnnotation-spinner"></div>' |
|
164 |
+ ' {{l10n.wait_while_processed}}' |
|
165 |
+ ' </div>' |
|
166 |
+ ' <div class="Ldt-createAnnotation-screen Ldt-createAnnotation-errorScreen" style="display: none; text-align: center">' |
|
167 |
+ ' <div class="Ldt-createAnnotation-Minimize" title="Hide"></div>' |
|
168 |
+ ' {{l10n.error_while_contacting}}' |
|
169 |
+ ' </div>' |
|
170 |
+ ' <div class="Ldt-createAnnotation-screen Ldt-createAnnotation-endScreen" style="display: none">' |
|
171 |
+ ' <div class="Ldt-createAnnotation-Minimize" title="Hide"></div>' |
|
172 |
+ ' {{l10n.annotation_saved}}' |
|
173 |
+ ' <br>' |
|
174 |
+ ' {{^disable_share}}' |
|
175 |
+ ' {{l10n.share_annotation}}' |
|
176 |
+ ' <div style="margin-top: 12px; text-align: center;">' |
|
177 |
+ ' <a target="_blank" class="Ldt-createAnnotation-endScreen-TweetLink Ldt-TraceMe"></a>' |
|
178 |
+ ' <a target="_blank" class="Ldt-createAnnotation-endScreen-FbLink Ldt-TraceMe"></a>' |
|
179 |
+ ' <a target="_blank" class="Ldt-createAnnotation-endScreen-GplusLink Ldt-TraceMe"></a>' |
|
180 |
+ ' </div>' |
|
181 |
+ ' {{/disable_share}}' |
|
182 |
+ ' </div>' |
|
183 |
+ ' <div class="Ldt-floatClear"></div>' |
|
184 |
*/ |
|
185 |