|
@@ -44,11 +44,11 @@ function ResponseController()
|
44
|
44
|
propagate(response);
|
45
|
45
|
if (response.status === 'success')
|
46
|
46
|
{
|
47
|
|
- success_callback();
|
|
47
|
+ success_callback(response);
|
48
|
48
|
}
|
49
|
49
|
else
|
50
|
50
|
{
|
51
|
|
- failure_callback();
|
|
51
|
+ failure_callback(response);
|
52
|
52
|
}
|
53
|
53
|
}
|
54
|
54
|
}
|
|
@@ -1518,54 +1518,57 @@ $(document).ready(function(){
|
1518
|
1518
|
$('form[name="add"]').find('img.tag_loader').show();
|
1519
|
1519
|
});
|
1520
|
1520
|
$('form[name="add"]').ajaxForm(function(response) {
|
1521
|
|
- if (response.status == 'mustbeconnected')
|
1522
|
|
- {
|
1523
|
|
- $(location).attr('href', url_index);
|
1524
|
|
- }
|
1525
|
1521
|
|
1526
|
1522
|
$('form[name="add"] img.tag_loader').hide();
|
|
1523
|
+ window.ResponseController.execute(
|
|
1524
|
+ response,
|
|
1525
|
+ function(){},
|
|
1526
|
+ function(){}
|
|
1527
|
+ );
|
1527
|
1528
|
|
1528
|
|
- // Si on en est a la promière étape la réponse sera des données récupérés auprès
|
1529
|
|
- // des apis
|
1530
|
|
- if ($('input#form_add_step').val() == '1')
|
|
1529
|
+ if (response.status === 'success')
|
1531
|
1530
|
{
|
1532
|
|
- if (element_add_proceed_data_apis(response))
|
|
1531
|
+ // Si on en est a la première étape la réponse sera des données récupérés auprès
|
|
1532
|
+ // des apis
|
|
1533
|
+ if ($('input#form_add_step').val() == '1')
|
1533
|
1534
|
{
|
1534
|
|
- // On a plus qu'a afficher les champs
|
1535
|
|
- $('div#form_add_second_part').slideDown();
|
1536
|
|
- $('div#form_add_first_part').slideUp();
|
1537
|
|
- form_add_hide_errors();
|
1538
|
|
- $('#form_add_loader').hide();
|
1539
|
|
- $('input#form_add_step').val('2');
|
1540
|
|
-
|
1541
|
|
- // On doit avoir le slug du groupe si on ajoute a un groupe
|
1542
|
|
- if (!$('input#add_element_group_page').length)
|
|
1535
|
+ if (element_add_proceed_data_apis(response))
|
1543
|
1536
|
{
|
1544
|
|
- $('form[name="add"]').attr('action', url_element_add);
|
|
1537
|
+ // On a plus qu'a afficher les champs
|
|
1538
|
+ $('div#form_add_second_part').slideDown();
|
|
1539
|
+ $('div#form_add_first_part').slideUp();
|
|
1540
|
+ form_add_hide_errors();
|
|
1541
|
+ $('#form_add_loader').hide();
|
|
1542
|
+ $('input#form_add_step').val('2');
|
|
1543
|
+
|
|
1544
|
+ // On doit avoir le slug du groupe si on ajoute a un groupe
|
|
1545
|
+ if (!$('input#add_element_group_page').length)
|
|
1546
|
+ {
|
|
1547
|
+ $('form[name="add"]').attr('action', url_element_add);
|
|
1548
|
+ }
|
|
1549
|
+ else
|
|
1550
|
+ {
|
|
1551
|
+ $('form[name="add"]').attr('action', url_element_add+'/'+$('input#add_element_group_page').val());
|
|
1552
|
+ }
|
|
1553
|
+ $('span#add_url_title_url').html($('input#element_add_url').val());
|
|
1554
|
+ // Mise a zero des tags
|
|
1555
|
+ window.add_tag_prompt_connector.initializeTags([]);
|
|
1556
|
+ $('input#element_add_need_tags').attr('checked', false);
|
1545
|
1557
|
}
|
1546
|
1558
|
else
|
1547
|
1559
|
{
|
1548
|
|
- $('form[name="add"]').attr('action', url_element_add+'/'+$('input#add_element_group_page').val());
|
|
1560
|
+ form_add_display_errors(response.errors);
|
|
1561
|
+ $('#form_add_loader').hide();
|
1549
|
1562
|
}
|
1550
|
|
- $('span#add_url_title_url').html($('input#element_add_url').val());
|
1551
|
|
- // Mise a zero des tags
|
1552
|
|
- window.add_tag_prompt_connector.initializeTags([]);
|
1553
|
|
- $('input#element_add_need_tags').attr('checked', false);
|
1554
|
|
- }
|
1555
|
|
- else
|
1556
|
|
- {
|
1557
|
|
- form_add_display_errors(response.errors);
|
1558
|
|
- $('#form_add_loader').hide();
|
1559
|
1563
|
}
|
1560
|
|
- }
|
1561
|
|
- else if ($('input#form_add_step').val() == '2')
|
1562
|
|
- {
|
1563
|
|
- if (element_add_proceed_json_response(response))
|
|
1564
|
+ else if ($('input#form_add_step').val() == '2')
|
1564
|
1565
|
{
|
1565
|
|
- form_add_reinit();
|
|
1566
|
+ if (element_add_proceed_json_response(response))
|
|
1567
|
+ {
|
|
1568
|
+ form_add_reinit();
|
|
1569
|
+ }
|
1566
|
1570
|
}
|
1567
|
1571
|
}
|
1568
|
|
-
|
1569
|
1572
|
|
1570
|
1573
|
return false;
|
1571
|
1574
|
});
|
|
@@ -2193,10 +2196,12 @@ $(document).ready(function(){
|
2193
|
2196
|
|
2194
|
2197
|
$.getJSON(link.attr('href'), function(response){
|
2195
|
2198
|
|
2196
|
|
- if (response.status == 'mustbeconnected')
|
2197
|
|
- {
|
2198
|
|
- $(location).attr('href', url_index);
|
2199
|
|
- }
|
|
2199
|
+ window.ResponseController.execute(
|
|
2200
|
+ response,
|
|
2201
|
+ function(){},
|
|
2202
|
+ function(){}
|
|
2203
|
+ );
|
|
2204
|
+
|
2200
|
2205
|
});
|
2201
|
2206
|
|
2202
|
2207
|
$('div.question').fadeOut();
|
|
@@ -2218,21 +2223,28 @@ $(document).ready(function(){
|
2218
|
2223
|
|
2219
|
2224
|
var img = $(this).find('img');
|
2220
|
2225
|
var link = $(this);
|
|
2226
|
+ var old_img_url = img.attr('src');
|
2221
|
2227
|
img.attr('src', url_img_ajax_loader);
|
2222
|
2228
|
|
2223
|
2229
|
$.getJSON(link.attr('href'), function(response){
|
2224
|
|
-
|
2225
|
|
- if (response.status == 'mustbeconnected')
|
2226
|
|
- {
|
2227
|
|
- $(location).attr('href', url_index);
|
2228
|
|
- }
|
2229
|
2230
|
|
2230
|
|
- if (response.status == 'success')
|
|
2231
|
+ window.ResponseController.execute(
|
|
2232
|
+ response,
|
|
2233
|
+ function(){},
|
|
2234
|
+ function(){}
|
|
2235
|
+ );
|
|
2236
|
+
|
|
2237
|
+ if (response.status === 'success')
|
2231
|
2238
|
{
|
2232
|
2239
|
link.attr('href', response.data.a.href);
|
2233
|
2240
|
img.attr('src', response.data.img.src);
|
2234
|
2241
|
link.parents('ul.element_thumb_actions').find('li.score').text(response.data.element.points);
|
2235
|
2242
|
}
|
|
2243
|
+
|
|
2244
|
+ if (response.status === 'error')
|
|
2245
|
+ {
|
|
2246
|
+ img.attr('src', old_img_url);
|
|
2247
|
+ }
|
2236
|
2248
|
|
2237
|
2249
|
});
|
2238
|
2250
|
|
|
@@ -2286,22 +2298,27 @@ $(document).ready(function(){
|
2286
|
2298
|
li.find('img.element_loader').hide();
|
2287
|
2299
|
window.ResponseController.execute(
|
2288
|
2300
|
response,
|
2289
|
|
- function(){
|
2290
|
|
- // On prépare le tagBox
|
2291
|
|
- var table = li.find('table:first');
|
2292
|
|
- li.find('div.tag_proposition').remove();
|
2293
|
|
- table.after(response.html);
|
|
2301
|
+ function(){},
|
|
2302
|
+ function(){}
|
|
2303
|
+ );
|
|
2304
|
+
|
|
2305
|
+ if (response.status === 'success')
|
|
2306
|
+ {
|
|
2307
|
+ // On prépare le tagBox
|
|
2308
|
+ var table = li.find('table:first');
|
|
2309
|
+ li.find('div.tag_proposition').remove();
|
|
2310
|
+ table.after(response.html);
|
2294
|
2311
|
|
2295
|
|
- // Pour le click sur l'input de saisie de tag
|
2296
|
|
- //li.find('ul.tagbox li.input input[type="text"]').formDefaults();
|
|
2312
|
+ // Pour le click sur l'input de saisie de tag
|
|
2313
|
+ //li.find('ul.tagbox li.input input[type="text"]').formDefaults();
|
2297
|
2314
|
|
2298
|
|
- var options = new Array();
|
2299
|
|
- options.form_name = response.form_name;
|
2300
|
|
- options.tag_init = response.tags;
|
|
2315
|
+ var options = new Array();
|
|
2316
|
+ options.form_name = response.form_name;
|
|
2317
|
+ options.tag_init = response.tags;
|
2301
|
2318
|
|
2302
|
|
- ajax_query_timestamp = null;
|
|
2319
|
+ ajax_query_timestamp = null;
|
2303
|
2320
|
|
2304
|
|
- //$("#tags_prompt_list_"+response.form_name).tagBox(options);
|
|
2321
|
+ //$("#tags_prompt_list_"+response.form_name).tagBox(options);
|
2305
|
2322
|
|
2306
|
2323
|
// On rend ce formulaire ajaxFormable
|
2307
|
2324
|
$('form[name="'+response.form_name+'"] input[type="submit"]').live('click', function(){
|
|
@@ -2335,13 +2352,8 @@ $(document).ready(function(){
|
2335
|
2352
|
|
2336
|
2353
|
li.find('div.tag_proposition div.tags_prompt').prepend(ul_errors);
|
2337
|
2354
|
}
|
2338
|
|
-
|
2339
|
2355
|
});
|
2340
|
|
- },
|
2341
|
|
- function(){
|
2342
|
|
-
|
2343
|
|
- }
|
2344
|
|
- );
|
|
2356
|
+ }
|
2345
|
2357
|
|
2346
|
2358
|
// if (response.status === 'mustbeconnected')
|
2347
|
2359
|
// {
|
|
@@ -2453,10 +2465,12 @@ $(document).ready(function(){
|
2453
|
2465
|
|
2454
|
2466
|
$.getJSON(link.attr('href'), function(response){
|
2455
|
2467
|
|
2456
|
|
- if (response.status == 'mustbeconnected')
|
2457
|
|
- {
|
2458
|
|
- $(location).attr('href', url_index);
|
2459
|
|
- }
|
|
2468
|
+ window.ResponseController.execute(
|
|
2469
|
+ response,
|
|
2470
|
+ function(){},
|
|
2471
|
+ function(){}
|
|
2472
|
+ );
|
|
2473
|
+
|
2460
|
2474
|
});
|
2461
|
2475
|
|
2462
|
2476
|
$('div.question').fadeOut();
|
|
@@ -2961,6 +2975,14 @@ $(document).ready(function(){
|
2961
|
2975
|
});
|
2962
|
2976
|
});
|
2963
|
2977
|
|
|
2978
|
+ /*
|
|
2979
|
+ * Buttons for open email confirmation request
|
|
2980
|
+ */
|
|
2981
|
+
|
|
2982
|
+ $('a#group_add_link_disabled.mustconfirmemail').click(function(){
|
|
2983
|
+ open_ajax_popin(url_email_not_confirmed, function(){});
|
|
2984
|
+ });
|
|
2985
|
+
|
2964
|
2986
|
});
|
2965
|
2987
|
|
2966
|
2988
|
function open_ajax_popin(url, callback)
|
|
@@ -2985,6 +3007,7 @@ function open_ajax_popin(url, callback)
|
2985
|
3007
|
}
|
2986
|
3008
|
}
|
2987
|
3009
|
});
|
|
3010
|
+ $('html, body').animate({ scrollTop: 0 }, 'fast');
|
2988
|
3011
|
}
|
2989
|
3012
|
|
2990
|
3013
|
function open_connection_or_subscription_window(open_login_part)
|