| 
				
			 | 
			
			
				@@ -23,7 +23,7 @@ function hideAllMessages() 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				23
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				24
			 | 
			
				24
			 | 
			
			
				 function ResponseController() 
			 | 
		
	
		
			
			| 
				25
			 | 
			
				25
			 | 
			
			
				 { 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				
			 | 
			
			
				-  var propagate = function(response) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+  var propagate = function(response, after_login_success_callback) 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				27
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				28
			 | 
			
			
				     if (response.status === 'error') 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				29
			 | 
			
			
				     { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -35,18 +35,19 @@ function ResponseController() 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				35
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				36
			 | 
			
			
				       else if (response.error === 'UserNotConnected') 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				37
			 | 
			
			
				       { 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				
			 | 
			
			
				-        open_connection_or_subscription_window(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+        open_connection_or_subscription_window(false, {}, after_login_success_callback); 
			 | 
		
	
		
			
			| 
				39
			 | 
			
				39
			 | 
			
			
				       } 
			 | 
		
	
		
			
			| 
				40
			 | 
			
				40
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				41
			 | 
			
				41
			 | 
			
			
				     else if (response.status === 'mustbeconnected') 
			 | 
		
	
		
			
			| 
				42
			 | 
			
				42
			 | 
			
			
				     { 
			 | 
		
	
		
			
			| 
				43
			 | 
			
				
			 | 
			
			
				-      open_connection_or_subscription_window(true); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+      open_connection_or_subscription_window(true, {}, after_login_success_callback); 
			 | 
		
	
		
			
			| 
				44
			 | 
			
				44
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				45
			 | 
			
				
			 | 
			
			
				-  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+  }; 
			 | 
		
	
		
			
			| 
				46
			 | 
			
				46
			 | 
			
			
				    
			 | 
		
	
		
			
			| 
				47
			 | 
			
				
			 | 
			
			
				-  this.execute = function(response, success_callback, failure_callback) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				47
			 | 
			
			
				+  this.execute = function(response, success_callback, failure_callback, after_login_success_callback) 
			 | 
		
	
		
			
			| 
				48
			 | 
			
				48
			 | 
			
			
				   { 
			 | 
		
	
		
			
			| 
				49
			 | 
			
				
			 | 
			
			
				-    propagate(response); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				49
			 | 
			
			
				+    propagate(response, after_login_success_callback); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				50
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				50
			 | 
			
				51
			 | 
			
			
				     if (response.status === 'success') 
			 | 
		
	
		
			
			| 
				51
			 | 
			
				52
			 | 
			
			
				     { 
			 | 
		
	
		
			
			| 
				52
			 | 
			
				53
			 | 
			
			
				       success_callback(response); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -55,7 +56,7 @@ function ResponseController() 
			 | 
		
	
		
			
			| 
				55
			 | 
			
				56
			 | 
			
			
				     { 
			 | 
		
	
		
			
			| 
				56
			 | 
			
				57
			 | 
			
			
				       failure_callback(response); 
			 | 
		
	
		
			
			| 
				57
			 | 
			
				58
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				58
			 | 
			
				
			 | 
			
			
				-  } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				59
			 | 
			
			
				+  }; 
			 | 
		
	
		
			
			| 
				59
			 | 
			
				60
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				60
			 | 
			
				61
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				61
			 | 
			
				62
			 | 
			
			
				 window.ResponseController = new ResponseController(); 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -1320,6 +1321,16 @@ $(document).ready(function(){ 
			 | 
		
	
		
			
			| 
				1320
			 | 
			
				1321
			 | 
			
			
				        
			 | 
		
	
		
			
			| 
				1321
			 | 
			
				1322
			 | 
			
			
				       form_add_hide_errors(); 
			 | 
		
	
		
			
			| 
				1322
			 | 
			
				1323
			 | 
			
			
				        
			 | 
		
	
		
			
			| 
				
			 | 
			
				1324
			 | 
			
			
				+      // Dans le cas d'un ajout depuis l'extérieur (iframe) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1325
			 | 
			
			
				+      if ($('form[name="add"] input[name="shared_from"]').val() === "1") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1326
			 | 
			
			
				+      { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1327
			 | 
			
			
				+        var elements = $('<ul class="elements"></ul>') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1328
			 | 
			
			
				+        elements.prepend(response.html); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1329
			 | 
			
			
				+        $('div#share_from_content').append(elements); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1330
			 | 
			
			
				+        $('div#share_from_message').text(response.message); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1331
			 | 
			
			
				+        //$('form[name="add"]').append($('<input type="hidden" name="shared_from_finished" id="shared_from_finished" value="1" />')); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1332
			 | 
			
			
				+      } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1333
			 | 
			
			
				+       
			 | 
		
	
		
			
			| 
				1323
			 | 
			
				1334
			 | 
			
			
				       return true; 
			 | 
		
	
		
			
			| 
				1324
			 | 
			
				1335
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				1325
			 | 
			
				1336
			 | 
			
			
				     else if (response.status == 'error') 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -1540,11 +1551,30 @@ $(document).ready(function(){ 
			 | 
		
	
		
			
			| 
				1540
			 | 
			
				1551
			 | 
			
			
				   }); 
			 | 
		
	
		
			
			| 
				1541
			 | 
			
				1552
			 | 
			
			
				   $('form[name="add"]').ajaxForm(function(response) { 
			 | 
		
	
		
			
			| 
				1542
			 | 
			
				1553
			 | 
			
			
				      
			 | 
		
	
		
			
			| 
				
			 | 
			
				1554
			 | 
			
			
				+    var callback_login = null; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1555
			 | 
			
			
				+    // Dans le cas d'un ajout depuis l'extérieur (iframe) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1556
			 | 
			
			
				+    if ($('form[name="add"] input[name="shared_from"]').val() === "1") 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1557
			 | 
			
			
				+    { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1558
			 | 
			
			
				+      callback_login = function(){  
			 | 
		
	
		
			
			| 
				
			 | 
			
				1559
			 | 
			
			
				+        $('#form_add_loader').show(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1560
			 | 
			
			
				+        JQueryJson(url_csrf, {}, function(response){ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1561
			 | 
			
			
				+          if (response.status == 'success') 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1562
			 | 
			
			
				+          { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1563
			 | 
			
			
				+            $('form[name="add"] input[name="element_add[_token]"]').val(response.data); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1564
			 | 
			
			
				+            $('form[name="add"]').submit(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1565
			 | 
			
			
				+            $('#form_add_loader').hide(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1566
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1567
			 | 
			
			
				+        }); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1568
			 | 
			
			
				+          
			 | 
		
	
		
			
			| 
				
			 | 
			
				1569
			 | 
			
			
				+      }; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1570
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1571
			 | 
			
			
				+     
			 | 
		
	
		
			
			| 
				1543
			 | 
			
				1572
			 | 
			
			
				     $('form[name="add"] img.tag_loader').hide(); 
			 | 
		
	
		
			
			| 
				1544
			 | 
			
				1573
			 | 
			
			
				     window.ResponseController.execute( 
			 | 
		
	
		
			
			| 
				1545
			 | 
			
				1574
			 | 
			
			
				       response, 
			 | 
		
	
		
			
			| 
				1546
			 | 
			
				1575
			 | 
			
			
				       function(){}, 
			 | 
		
	
		
			
			| 
				1547
			 | 
			
				
			 | 
			
			
				-      function(){} 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1576
			 | 
			
			
				+      function(){}, 
			 | 
		
	
		
			
			| 
				
			 | 
			
				1577
			 | 
			
			
				+      callback_login 
			 | 
		
	
		
			
			| 
				1548
			 | 
			
				1578
			 | 
			
			
				     ); 
			 | 
		
	
		
			
			| 
				1549
			 | 
			
				1579
			 | 
			
			
				      
			 | 
		
	
		
			
			| 
				1550
			 | 
			
				1580
			 | 
			
			
				       // Si on en est a la première étape la réponse sera des données récupérés auprès 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -3361,7 +3391,7 @@ function open_ajax_popin(url, callback, data) 
			 | 
		
	
		
			
			| 
				3361
			 | 
			
				3391
			 | 
			
			
				   } 
			 | 
		
	
		
			
			| 
				3362
			 | 
			
				3392
			 | 
			
			
				 } 
			 | 
		
	
		
			
			| 
				3363
			 | 
			
				3393
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				3364
			 | 
			
				
			 | 
			
			
				-function open_connection_or_subscription_window(open_login_part, data) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3394
			 | 
			
			
				+function open_connection_or_subscription_window(open_login_part, data, login_success_callback) 
			 | 
		
	
		
			
			| 
				3365
			 | 
			
				3395
			 | 
			
			
				 { 
			 | 
		
	
		
			
			| 
				3366
			 | 
			
				3396
			 | 
			
			
				   if (window_login_or_subscription_opened == false) 
			 | 
		
	
		
			
			| 
				3367
			 | 
			
				3397
			 | 
			
			
				   { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -3390,7 +3420,15 @@ function open_connection_or_subscription_window(open_login_part, data) 
			 | 
		
	
		
			
			| 
				3390
			 | 
			
				3420
			 | 
			
			
				         $('div.login form').find('img.loader').hide(); 
			 | 
		
	
		
			
			| 
				3391
			 | 
			
				3421
			 | 
			
			
				         if (response.status == 'success') 
			 | 
		
	
		
			
			| 
				3392
			 | 
			
				3422
			 | 
			
			
				         { 
			 | 
		
	
		
			
			| 
				3393
			 | 
			
				
			 | 
			
			
				-          $(location).attr('href', response.data.redirect_url); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3423
			 | 
			
			
				+          if (login_success_callback) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3424
			 | 
			
			
				+          { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3425
			 | 
			
			
				+            $('a#helpbox_close').click(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3426
			 | 
			
			
				+            login_success_callback(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3427
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3428
			 | 
			
			
				+          else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3429
			 | 
			
			
				+          { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3430
			 | 
			
			
				+            $(location).attr('href', response.data.redirect_url); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3431
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				3394
			 | 
			
				3432
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				3395
			 | 
			
				3433
			 | 
			
			
				         else if (response.status == 'error') 
			 | 
		
	
		
			
			| 
				3396
			 | 
			
				3434
			 | 
			
			
				         { 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -3407,7 +3445,15 @@ function open_connection_or_subscription_window(open_login_part, data) 
			 | 
		
	
		
			
			| 
				3407
			 | 
			
				3445
			 | 
			
			
				         $('div.register form.fos_user_registration_register').find('img.loader').hide(); 
			 | 
		
	
		
			
			| 
				3408
			 | 
			
				3446
			 | 
			
			
				         if (response.status == 'success') 
			 | 
		
	
		
			
			| 
				3409
			 | 
			
				3447
			 | 
			
			
				         { 
			 | 
		
	
		
			
			| 
				3410
			 | 
			
				
			 | 
			
			
				-          $(location).attr('href', url_home); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3448
			 | 
			
			
				+          if (login_success_callback) 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3449
			 | 
			
			
				+          { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3450
			 | 
			
			
				+            $('a#helpbox_close').click(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3451
			 | 
			
			
				+            login_success_callback(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3452
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3453
			 | 
			
			
				+          else 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3454
			 | 
			
			
				+          { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3455
			 | 
			
			
				+            $(location).attr('href', url_home); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3456
			 | 
			
			
				+          } 
			 | 
		
	
		
			
			| 
				3411
			 | 
			
				3457
			 | 
			
			
				         } 
			 | 
		
	
		
			
			| 
				3412
			 | 
			
				3458
			 | 
			
			
				         else if (response.status == 'error') 
			 | 
		
	
		
			
			| 
				3413
			 | 
			
				3459
			 | 
			
			
				         { 
			 |