| author | cavaliet |
| Fri, 29 Apr 2011 10:58:24 +0200 | |
| changeset 71 | 8a881c9593d0 |
| parent 66 | 8a7530e28185 |
| child 103 | 5578dcb54f4d |
| permissions | -rw-r--r-- |
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
1 |
|
| 0 | 2 |
$.fn.realVal = function() { |
| 32 | 3 |
var obj = $(this[0]); |
4 |
if(obj.val) { |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
5 |
if(obj.val() === obj.attr('defaultText')) { |
| 32 | 6 |
return ''; |
7 |
} |
|
8 |
else { |
|
9 |
return obj.val(); |
|
10 |
} |
|
11 |
} |
|
12 |
else { |
|
13 |
return null; |
|
14 |
} |
|
| 0 | 15 |
}; |
16 |
||
| 24 | 17 |
|
| 0 | 18 |
function init_events_base(base_node, embed_url) { |
| 32 | 19 |
|
20 |
$('.ldt_link_embed',base_node).click(function(e) { |
|
21 |
e.preventDefault(); |
|
22 |
var link = $(e.target); |
|
23 |
var json_url = link.attr("href"); |
|
24 |
var player_id = link.attr("id"); |
|
25 |
var ldt_id = player_id.substring(15); |
|
26 |
$('<a />', { |
|
27 |
href: embed_url+'?json_url='+escape(json_url)+'&player_id='+escape(player_id)+'&ldt_id='+escape(ldt_id), |
|
28 |
target: "_blank" |
|
29 |
}).nyroModal({ |
|
30 |
filters: ['iframe'], |
|
31 |
sizes: { |
|
32 |
minW: '750', |
|
33 |
minH: '662' |
|
34 |
}, |
|
35 |
callbacks: { |
|
36 |
afterShowCont: function(nm) { |
|
37 |
nm.store.iframe.height(662); |
|
38 |
nm.store.iframe.width(750); |
|
39 |
} |
|
40 |
} |
|
41 |
}).trigger('nyroModal'); |
|
42 |
return false; |
|
43 |
}); |
|
| 0 | 44 |
|
45 |
||
| 32 | 46 |
$('.imageline',base_node).each(function(i) { |
47 |
var tr = $(this); |
|
48 |
tr.mouseover(function() { |
|
49 |
$('.cellimgdiv',this).css('visibility', 'visible'); |
|
50 |
}); |
|
51 |
tr.mouseout(function() { |
|
52 |
$('.cellimgdiv',this).css('visibility', 'hidden'); |
|
53 |
}); |
|
54 |
}); |
|
55 |
|
|
56 |
$('.cellimgdiv img').qtip({ |
|
57 |
style: { |
|
58 |
'name': 'dark', |
|
59 |
'filter':'alpha(opacity=70)', |
|
60 |
'-moz-opacity':'0.7', |
|
61 |
'-khtml-opacity': '0.7', |
|
62 |
'opacity': '0.7', |
|
63 |
'border': { |
|
64 |
'width' : '0', |
|
65 |
'color': '#505050' |
|
66 |
}, |
|
67 |
'tip': true |
|
68 |
} |
|
69 |
}); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
70 |
} |
| 0 | 71 |
|
| 33 | 72 |
function testAndClose(close_fn) { |
| 32 | 73 |
|
74 |
return function(force) { |
|
75 |
// Here we ask LDT if the current work is modified and if the user want to save it. |
|
76 |
var ldtSwf = $('#ldtInitSwf',$.nmTop().store.iframe.contents()).get(0); |
|
77 |
// In the ldt_link_create case, the modal page can be the form, or the ldt swf. So we have to test. |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
78 |
if (!force && ldtSwf && ldtSwf.name==="ldtInitSwf" && ldtSwf.isModified()==="true") { |
| 32 | 79 |
ldtSwf.askSave(); |
80 |
} |
|
81 |
else { |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
82 |
close_fn.apply(this); |
| 32 | 83 |
} |
84 |
}; |
|
|
31
0d829ac13c4b
Update modal behavior, to test if LDT swf has a still not saved work. Update language files too.
Cavalie Thibaut <thibaut.cavalie@centrepompidou.fr>
parents:
24
diff
changeset
|
85 |
} |
|
0d829ac13c4b
Update modal behavior, to test if LDT swf has a still not saved work. Update language files too.
Cavalie Thibaut <thibaut.cavalie@centrepompidou.fr>
parents:
24
diff
changeset
|
86 |
|
| 0 | 87 |
|
88 |
function searchCallback(target, container_selector, url, timeout) { |
|
89 |
||
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
90 |
timeout = typeof(timeout) !== 'undefined' ? timeout : 0; |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
91 |
target = $(target); |
| 32 | 92 |
|
93 |
// remove all qtip |
|
94 |
$(".qtip").remove(); |
|
95 |
|
|
96 |
if(target.realVal().length > 0) { |
|
97 |
target.nextAll(".searchclear").show(); |
|
98 |
} |
|
| 0 | 99 |
|
| 32 | 100 |
if(target.attr('timer')) { |
101 |
clearTimeout(target.attr('timer')); |
|
102 |
} |
|
| 0 | 103 |
|
| 32 | 104 |
target.attr( |
105 |
'timer', |
|
106 |
setTimeout(function() { |
|
107 |
target.next(".searchajaxloader").show(); |
|
108 |
target.nextAll(".searchclear").hide(); |
|
109 |
var filterVal = "_" + escape(target.realVal()); |
|
110 |
url = url.replace('__FILTER__',filterVal); |
|
111 |
$.ajax({ |
|
112 |
url: url, |
|
113 |
cache: false, |
|
114 |
success: function(data, status, request) { |
|
115 |
$(container_selector).html(data); |
|
116 |
target.next(".searchajaxloader").hide(); |
|
117 |
if(target.realVal().length > 0) { |
|
118 |
target.nextAll(".searchclear").show(); |
|
119 |
} |
|
120 |
init_events($(container_selector)); |
|
121 |
target.removeAttr('timer'); |
|
122 |
} |
|
123 |
}); |
|
124 |
}, |
|
125 |
300) |
|
126 |
); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
127 |
} |
| 0 | 128 |
|
129 |
||
130 |
function init_events_contents(base_node, embed_url, content_filter_url) { |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
131 |
|
| 32 | 132 |
init_events_base(base_node, embed_url); |
133 |
|
|
134 |
$('.content_link_create').each(function(i){ |
|
135 |
$(this).attr("target","_blank"); |
|
136 |
}); |
|
137 |
$('.content_link_create').nyroModal({ |
|
138 |
filters: ['iframe'], |
|
139 |
sizes: { |
|
140 |
minW: 770, |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
141 |
minH: 550 |
| 32 | 142 |
}, |
143 |
callbacks: { |
|
144 |
afterClose: function(nm) { |
|
145 |
searchCallback($('#searchprojectsinput'), "#contentslistcontainer", content_filter_url); |
|
146 |
}, |
|
147 |
afterShowCont: function(nm) { |
|
148 |
nm.store.iframe.width(770); |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
149 |
nm.store.iframe.height(550); |
| 32 | 150 |
nm.store.iframe.load(function() { |
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
151 |
var form_status = $(this).contents().find("#content_form_status").val(); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
152 |
if(form_status === 'saved' || form_status === 'deleted' ) { |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
153 |
$.nmTop().close(); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
154 |
} |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
155 |
}); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
156 |
} |
| 32 | 157 |
} |
158 |
}); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
159 |
|
| 32 | 160 |
$('.contenttitlelink').each(function(i){ |
161 |
$(this).attr("target","_blank"); |
|
162 |
}); |
|
163 |
$('.contenttitlelink').nyroModal({ |
|
164 |
filters: ['iframe'], |
|
165 |
sizes: { |
|
166 |
minW: 770, |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
167 |
minH: 550 |
| 32 | 168 |
}, |
169 |
callbacks: { |
|
170 |
afterClose: function(nm) { |
|
171 |
searchCallback($("#searchcontentsinput"),"#contentslistcontainer",content_filter_url,0); |
|
172 |
}, |
|
173 |
afterShowCont: function(nm) { |
|
174 |
nm.store.iframe.width(770); |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
175 |
nm.store.iframe.height(550); |
| 32 | 176 |
nm.store.iframe.load(function() { |
177 |
var form_status = $(this).contents().find("#content_form_status").val(); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
178 |
if(form_status === 'saved' || form_status === 'deleted') { |
| 32 | 179 |
$.nmTop().close(); |
180 |
} |
|
181 |
}); |
|
182 |
} |
|
183 |
} |
|
184 |
}); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
185 |
|
| 0 | 186 |
} |
187 |
||
188 |
function init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
189 |
||
| 32 | 190 |
// These are the functions called when we display a project in an LDT modal window |
191 |
$('.ldt_link',base_node).each(function(i){ |
|
192 |
$(this).attr("target","_iri"); |
|
|
31
0d829ac13c4b
Update modal behavior, to test if LDT swf has a still not saved work. Update language files too.
Cavalie Thibaut <thibaut.cavalie@centrepompidou.fr>
parents:
24
diff
changeset
|
193 |
}); |
| 32 | 194 |
$('.ldt_link',base_node).nyroModal({ |
195 |
filters: ['iriIframe'], |
|
196 |
sizes: { |
|
|
38
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
197 |
minW: '1025', |
|
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
198 |
minH: '665' |
| 32 | 199 |
}, |
200 |
showCloseButton: true, |
|
201 |
closeOnEscape:false, |
|
202 |
closeOnClick:false, |
|
203 |
callbacks: { |
|
204 |
afterShowCont: function(nm) { |
|
|
38
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
205 |
nm.store.iframe.width(1025); |
|
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
206 |
nm.store.iframe.height(665); |
| 32 | 207 |
}, |
208 |
close: function(nm) { |
|
209 |
// We don't do anything here, we hack the callback directly from the close function. |
|
210 |
}, |
|
211 |
afterClose: function(nm) { |
|
212 |
// Can't do that because searchprojectfilterurl is not defined in init_events_base params |
|
213 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
214 |
} |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
215 |
} |
| 32 | 216 |
}); |
217 |
||
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
218 |
|
| 32 | 219 |
$('.ldt_link',base_node).each(function(i, e) { |
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
220 |
nm = $(e).data('nmObj'); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
221 |
$(e).data('nmObj', $.extend(true, nm, { |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
222 |
close: testAndClose(nm.close) |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
223 |
})); |
| 32 | 224 |
}); |
|
31
0d829ac13c4b
Update modal behavior, to test if LDT swf has a still not saved work. Update language files too.
Cavalie Thibaut <thibaut.cavalie@centrepompidou.fr>
parents:
24
diff
changeset
|
225 |
|
|
0d829ac13c4b
Update modal behavior, to test if LDT swf has a still not saved work. Update language files too.
Cavalie Thibaut <thibaut.cavalie@centrepompidou.fr>
parents:
24
diff
changeset
|
226 |
|
| 32 | 227 |
$('.ldt_link_create',base_node).each(function(i){ |
228 |
$(this).attr("target","_iri"); |
|
229 |
}); |
|
|
66
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
230 |
$('.ldt_link_create',base_node).nyroModal({ |
| 32 | 231 |
|
232 |
filters: ['iriIframe'], |
|
233 |
sizes: { |
|
234 |
minW: '600', |
|
235 |
minH: '500' |
|
236 |
}, |
|
237 |
showCloseButton:true, |
|
238 |
closeOnEscape:false, |
|
239 |
closeOnClick:false, |
|
240 |
callbacks: { |
|
241 |
afterShowCont: function(nm) { |
|
242 |
nm.store.iframe.width(600); |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
243 |
nm.store.iframe.height(600); |
| 32 | 244 |
var iframe = nm.store.iframe; |
245 |
iframe.load(function(){ |
|
246 |
var form_status = $(this).contents().find("#project_form_status").val(); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
247 |
if(form_status === 'saved' || form_status === 'deleted' ) { |
| 32 | 248 |
$.nmTop().close(); |
249 |
} |
|
250 |
var swfobject = $(this).contents().find("#ldtInitSwf"); |
|
251 |
if (swfobject.length) { |
|
|
38
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
252 |
nm['sizes']['initW'] = 1025; |
|
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
253 |
nm['sizes']['initH'] = 665; |
| 32 | 254 |
nm.resize(); |
|
38
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
255 |
nm.store.iframe.width(1025); |
|
457d4ab675df
debug modal for chrome, ie7. For firefox, links are not modal anymore.
cavaliet
parents:
37
diff
changeset
|
256 |
nm.store.iframe.height(665); |
| 32 | 257 |
} |
258 |
}); |
|
259 |
}, |
|
260 |
afterClose: function(nm) { |
|
261 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
262 |
} |
|
263 |
} |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
264 |
}); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
265 |
$('.ldt_link_create',base_node).each(function(i, e) { |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
266 |
nm = $(e).data('nmObj'); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
267 |
$(e).data('nmObj', $.extend(true, nm, { |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
268 |
close: testAndClose(nm.close) |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
269 |
})); |
|
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
270 |
}); |
| 32 | 271 |
|
272 |
|
|
|
66
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
273 |
$('.publishedproject', base_node).click(function(e) { |
| 32 | 274 |
e.preventDefault(); |
275 |
var target = $(e.target); |
|
276 |
var project_id = target.attr('id').replace('project_',''); |
|
277 |
var url = unpublishprojecturl.replace('__PROJECT_ID__', project_id); |
|
278 |
$.ajax({ |
|
279 |
url: url, |
|
280 |
type: 'POST', |
|
|
66
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
281 |
data: {csrfmiddlewaretoken:global_csrf_token}, |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
282 |
// bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
283 |
//dataType: 'json', |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
284 |
success: function(json, textStatus, XMLHttpRequest) { |
| 32 | 285 |
if(json.res) { |
286 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
287 |
} |
|
288 |
} |
|
289 |
}); |
|
| 24 | 290 |
}); |
|
66
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
291 |
|
| 32 | 292 |
$('.unpublishedproject', base_node).click(function(e) { |
293 |
e.preventDefault(); |
|
294 |
var target = $(e.target); |
|
295 |
var project_id = target.attr('id').replace('project_',''); |
|
296 |
var url = publishprojecturl.replace('__PROJECT_ID__', project_id); |
|
297 |
$.ajax({ |
|
298 |
url: url, |
|
299 |
type: 'POST', |
|
|
66
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
300 |
data: {csrfmiddlewaretoken:global_csrf_token}, |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
301 |
// bug with jquery >= 1.5, "json" adds a callback so we don't specify dataType |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
302 |
//dataType: 'json', |
|
8a7530e28185
Add token authentification to un/publish request. Update jquery.min.js and twitter auth keys.
cavaliet
parents:
46
diff
changeset
|
303 |
success: function(json, textStatus, XMLHttpRequest) { |
| 32 | 304 |
if(json.res) { |
305 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
306 |
} |
|
307 |
} |
|
308 |
}); |
|
309 |
}); |
|
| 0 | 310 |
|
| 32 | 311 |
$('.projecttitlelink').each(function(i){ |
312 |
$(this).attr("target","_blank"); |
|
313 |
}); |
|
314 |
$('.projecttitlelink').nyroModal({ |
|
315 |
filters: ['iframe'], |
|
316 |
sizes: { |
|
317 |
minH:680, |
|
|
46
ba02faf089df
Update media adding, to allow youtube import, and display the thumbnail when we paste the youtube url.
cavaliet
parents:
38
diff
changeset
|
318 |
minW:600 |
| 32 | 319 |
}, |
320 |
callbacks: { |
|
321 |
afterClose: function(nm) { |
|
322 |
searchCallback($('#searchprojectsinput'), "#projectslistcontainer", searchprojectfilterurl, 0); |
|
323 |
}, |
|
324 |
afterShowCont: function(nm) { |
|
325 |
nm.store.iframe.height(680); |
|
326 |
nm.store.iframe.width(600); |
|
327 |
var iframe = nm.store.iframe; |
|
328 |
iframe.load(function(){ |
|
329 |
var form_status = $(this).contents().find("#project_form_status").val(); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
330 |
if(form_status === 'saved' || form_status === 'deleted') { |
| 32 | 331 |
$.nmTop().close(); |
332 |
} |
|
333 |
}); |
|
334 |
} |
|
335 |
} |
|
336 |
}); |
|
337 |
|
|
| 0 | 338 |
} |
339 |
||
340 |
function init_events_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
| 32 | 341 |
init_events_base(base_node, embed_url); |
342 |
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
|
| 0 | 343 |
} |
344 |
||
345 |
function init_events_all(base_node, embed_url, searchcontentfilterurl, searchprojectfilterurl, publishprojecturl, unpublishprojecturl) { |
|
| 32 | 346 |
init_events_contents(base_node, embed_url, searchcontentfilterurl); |
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
347 |
init_events_base_projects(base_node, embed_url, searchprojectfilterurl, publishprojecturl, unpublishprojecturl); |
| 0 | 348 |
} |
349 |
||
350 |
function searchFieldInit(input_list_init) { |
|
351 |
||
| 32 | 352 |
$(".searchfieldinputbase").keydown(function (e) { |
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
353 |
if(e.which === 27) { |
| 32 | 354 |
$(e.target).blur(); |
355 |
$(e.target).next(".searchajaxloader").hide(); |
|
356 |
} |
|
357 |
}); |
|
358 |
|
|
359 |
$('.searchfieldinput').each(function(i) { |
|
360 |
var sbox = $(this); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
361 |
if(sbox.val() !== '') { |
| 32 | 362 |
sbox.attr('defaultText', sbox.val()); |
363 |
} |
|
364 |
|
|
365 |
sbox.focus(function() { |
|
366 |
box = $(this); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
367 |
if(box.val() === box.attr('defaultText')) { |
| 32 | 368 |
box.val(''); |
369 |
box.toggleClass("searchfieldinput"); |
|
370 |
} |
|
371 |
}); |
|
372 |
|
|
373 |
sbox.blur(function() { |
|
374 |
var box = $(this); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
375 |
if(box.val() === '' && box.attr('defaultText')) { |
| 32 | 376 |
box.val(box.attr('defaultText')); |
377 |
box.toggleClass("searchfieldinput"); |
|
378 |
} |
|
379 |
}); |
|
380 |
|
|
381 |
}); |
|
| 0 | 382 |
|
| 32 | 383 |
$.each(input_list_init, function(index, value) { |
384 |
$(value['input_selector']).keyup(function (e) { |
|
385 |
searchCallback(e.target, value['container_selector'], value['url']); |
|
386 |
}); |
|
387 |
}); |
|
388 |
|
|
389 |
$('.searchclear').click(function(e) { |
|
390 |
var box = $(e.target).parent().find("input"); |
|
391 |
box.val(box.attr('defaultText')); |
|
392 |
box.addClass("searchfieldinput"); |
|
393 |
box.blur(); |
|
394 |
box.keyup(); |
|
395 |
}); |
|
396 |
|
|
397 |
$('.searchclear').each(function(i) { |
|
398 |
$(this).hide(); |
|
399 |
}); |
|
|
37
3586af4092f3
update projectscontents.js to avoid reload on modal resize.
cavaliet
parents:
33
diff
changeset
|
400 |
|
| 0 | 401 |
} |
|
71
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
402 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
403 |
// |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
404 |
// Functions used in the create content view. |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
405 |
// |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
406 |
function onCreateContentReady(url_upload, media_prefix, post_added_params, btn_label, success_label) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
407 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
408 |
var upload_from_local_done = false; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
409 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
410 |
$("#close_button").click(function (e) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
411 |
e.preventDefault(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
412 |
parent.$.nmTop().close(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
413 |
}); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
414 |
$("#submit_button_write").click(function(e) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
415 |
$(".submitcontent-loader-content").show(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
416 |
}); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
417 |
$(".media_fields").hide(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
418 |
$("#media_field_"+$("#id_content-media_input_type").val()).show(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
419 |
$("#id_content-media_input_type").change(function(e) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
420 |
$(".media_fields").hide(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
421 |
$("#media_field_"+$(e.target).val()).show(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
422 |
}); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
423 |
// The textinput's id for external url is id_media-src |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
424 |
$('#id_media-src').bind('textchange', function(e) { testUrlValue(e); }); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
425 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
426 |
// We disable the default submit |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
427 |
$('#my_form').submit(function() { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
428 |
if($('#id_content-media_input_type').val()=="upload" && upload_from_local_done==false){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
429 |
//alert("1. " + $('#id_content-media_input_type').val() + ", upload_done = " + upload_from_local_done); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
430 |
startLocalUpload(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
431 |
return false; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
432 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
433 |
else{ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
434 |
//alert("2. " + $('#id_content-media_input_type').val()); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
435 |
return true; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
436 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
437 |
}); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
438 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
439 |
$("#upload_progress_bar").css({ width:"90%", height:"10" }); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
440 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
441 |
$('#media_fields_div').height(80); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
442 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
443 |
// We init the swfupload object |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
444 |
swfupload = new SWFUpload({ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
445 |
debug: false, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
446 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
447 |
upload_url: url_upload, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
448 |
flash_url: media_prefix+"swf/swfupload.swf", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
449 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
450 |
post_params: post_added_params, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
451 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
452 |
button_placeholder_id: "upload_btn", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
453 |
button_width: "60", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
454 |
button_height: "16", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
455 |
button_cursor: SWFUpload.CURSOR.HAND, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
456 |
button_text : '<span class="btnText">' + btn_label + '</span>', |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
457 |
button_text_style : ".btnText { font-size: 12; font-family: Arial; }", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
458 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
459 |
file_types : "*.flv;*.f4v;*.mp4;*.mov;*.mp3", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
460 |
file_types_description : "Media Files (flv, f4v, mov H264, mp4, mp3)", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
461 |
file_upload_limit : "1", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
462 |
file_queue_limit : "1", |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
463 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
464 |
upload_progress_handler : uploadProgress, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
465 |
upload_error_handler : uploadError, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
466 |
upload_success_handler : function() { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
467 |
try { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
468 |
if($('#upload_progress_info').children().size()>0){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
469 |
$('#progress_info').remove(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
470 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
471 |
$('#upload_progress_info').append('<p id="progress_info">' + success_label + '.</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
472 |
upload_from_local_done = true; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
473 |
// Now that the file is uploaded, we submit the form |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
474 |
$('#my_form').submit(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
475 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
476 |
catch (ex) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
477 |
//this.debug(ex); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
478 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
479 |
}, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
480 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
481 |
file_queued_handler : displayUploadPath, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
482 |
//file_dialog_complete_handler: function() { this.startUpload(); }, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
483 |
//upload_complete_handler: function() { this.startUpload(); }, |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
484 |
}); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
485 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
486 |
function displayUploadPath(file) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
487 |
try { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
488 |
$('#id_media-local_file_name').val(file.name); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
489 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
490 |
catch (ex) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
491 |
//this.debug(ex); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
492 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
493 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
494 |
function startLocalUpload(){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
495 |
swfupload.startUpload(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
496 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
497 |
function uploadProgress(file, bytesLoaded, bytesTotal) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
498 |
try { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
499 |
var percent = Math.ceil((bytesLoaded / bytesTotal) * 100); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
500 |
$("#upload_progress_bar").progressbar({ value: percent }); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
501 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
502 |
catch (ex) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
503 |
//this.debug(ex); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
504 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
505 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
506 |
function uploadSuccess(success_label) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
507 |
try { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
508 |
if($('#upload_progress_info').children().size()>0){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
509 |
$('#progress_info').remove(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
510 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
511 |
$('#upload_progress_info').append('<p id="progress_info">' + success_label + '.</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
512 |
upload_from_local_done = true; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
513 |
// Now that the file is uploaded, we submit the form |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
514 |
$('#my_form').submit(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
515 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
516 |
catch (ex) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
517 |
//this.debug(ex); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
518 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
519 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
520 |
function uploadError(file, errorCode, message) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
521 |
try { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
522 |
if($('#upload_progress_info').children().size()>0){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
523 |
$('#progress_info').remove(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
524 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
525 |
switch (errorCode) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
526 |
case SWFUpload.UPLOAD_ERROR.HTTP_ERROR: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
527 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: HTTP Error, File name: " + file.name + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
528 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
529 |
case SWFUpload.UPLOAD_ERROR.UPLOAD_FAILED: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
530 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: Upload Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
531 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
532 |
case SWFUpload.UPLOAD_ERROR.IO_ERROR: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
533 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: IO Error, File name: " + file.name + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
534 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
535 |
case SWFUpload.UPLOAD_ERROR.SECURITY_ERROR: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
536 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: Security Error, File name: " + file.name + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
537 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
538 |
case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
539 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: Upload Limit Exceeded, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
540 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
541 |
case SWFUpload.UPLOAD_ERROR.FILE_VALIDATION_FAILED: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
542 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: File Validation Failed, File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
543 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
544 |
case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
545 |
$('#upload_progress_info').append('<p id="progress_info">' + "Error Code: FILE_CANCELLED" + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
546 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
547 |
case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
548 |
$('#upload_progress_info').append('<p id="progress_info">' + "STOPPED" + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
549 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
550 |
default: |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
551 |
$('#upload_progress_info').append('<p id="progress_info">' + "unhandled error: File name: " + file.name + ", File size: " + file.size + ", Message: " + message + '</p>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
552 |
break; |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
553 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
554 |
} catch (ex) { |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
555 |
//this.debug(ex); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
556 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
557 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
558 |
|
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
559 |
// Test the value of the URL from the form to load a picture in case it is a youtube video |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
560 |
function testUrlValue(e){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
561 |
// First, we remove the current thumbnail if there is one. |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
562 |
if($('#media_field_create').children().size()>2){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
563 |
$('#external_thumbnail').remove(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
564 |
$('#media_fields_div').height(80); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
565 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
566 |
// If the pasted text is a youtube url, we get the default thumbnail of the video and display it. |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
567 |
url = $('#id_media-src').val(); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
568 |
if(url.match("youtube") && url.match("[\\?&]v=([^&#]*)")){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
569 |
results = url.match("[\\?&]v=([^&#]*)"); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
570 |
vid = ( results === null ) ? url : results[1].substring(0,11); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
571 |
if(vid.length===11){ |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
572 |
//$('#id_content-description').val($('#media_field_create') + '<img src="http://img.youtube.com/vi/'+vid+'/default.jpg" alt="Youtube Thumbnail"/>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
573 |
$('#media_field_create').append('<img id="external_thumbnail" src="http://img.youtube.com/vi/'+vid+'/default.jpg" alt="Youtube Thumbnail"/>'); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
574 |
$('#media_fields_div').height(150); |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
575 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
576 |
} |
|
8a881c9593d0
Add swfupload for local upload to create content view, with progress bar and error management.
cavaliet
parents:
66
diff
changeset
|
577 |
} |