Fix delete action.

pull/2487/head
jmontoyaa 9 years ago
parent 3e78de8ad2
commit 046e9bc2bf
  1. 10
      main/inc/lib/display.lib.php
  2. 22
      main/social/friends.php

@ -2556,13 +2556,18 @@ HTML;
}
/**
* @param $userInfo
* @param array $userInfo
* @param string $status
* @param string $toolbar
*
* @return string
*/
public static function getUserCard($userInfo, $status= '', $toolbar = '')
{
if (empty($userInfo)) {
return '';
}
if (!empty($status)) {
$status = '<div class="items-user-status">'.$status.'</div>';
}
@ -2571,7 +2576,7 @@ HTML;
$toolbar = '<div class="btn-group pull-right">'.$toolbar.'</div>';
}
return '<div class="col-md-12">
return '<div id="user_card_'.$userInfo['id'].'" class="col-md-12">
<div class="row">
<div class="col-md-2">
<img src="'.$userInfo['avatar'].'" class="img-responsive img-circle">
@ -2591,5 +2596,4 @@ HTML;
<hr />
</div>';
}
}

@ -18,18 +18,16 @@ $this_section = SECTION_SOCIAL;
$htmlHeadXtra[] = '<script>
function delete_friend (element_div) {
id_image=$(element_div).attr("id");
user_id=id_image.split("_");
id_image = $(element_div).attr("id");
user_id = id_image.split("_");
if (confirm("'.get_lang('Delete', '').'")) {
$.ajax({
contentType: "application/x-www-form-urlencoded",
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=delete_friend",
data: "delete_friend_id="+user_id[1],
success: function(datos) {
$("div#"+"div_"+user_id[1]).hide("slow");
$("div#"+"div_"+user_id[1]).html("");
clear_form ();
success: function(datos) {
$("#user_card_"+user_id[1]).hide("slow");
}
});
}
@ -66,12 +64,6 @@ function hide_icon_delete(element_html) {
$(ident).attr("title","");
}
function clear_form () {
$("input[@type=radio]").attr("checked", false);
$("div#div_qualify_image").html("");
$("div#div_info_user").html("");
}
</script>';
$interbreadcrumb[] = array('url' => 'profile.php', 'name' => get_lang('SocialNetwork'));
@ -126,7 +118,7 @@ if (count($friends) == 0) {
while ($j < $number_friends) {
if (isset($friends[$j])) {
$friend = $friends[$j];
$toolBar = '<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
$toolBar = '<button class="btn btn-danger" onclick="delete_friend(this)" id=img_' . $friend['friend_user_id'] . '>
' . get_lang('Delete') . '
</button>';
$url = api_get_path(WEB_PATH).'main/social/profile.php?u='.$friend['friend_user_id'];

Loading…
Cancel
Save