Fixing search friend page

skala
Julio Montoya 14 years ago
parent 790611504f
commit 8d908584a0
  1. 25
      main/auth/profile.php
  2. 25
      main/inc/ajax/social.ajax.php
  3. 93
      main/social/friends.php

@ -249,14 +249,15 @@ if (api_get_setting('profile', 'language') !== 'true') {
// EXTENDED PROFILE this make the page very slow!
if (api_get_setting('extended_profile') == 'true') {
if (!isset($_GET['type']) || (isset($_GET['type']) && $_GET['type'] == 'extended')) {
$width_extended_profile = 500;
//$form->addElement('html', '<a href="javascript: void(0);" onclick="javascript: show_extend();"> show_extend_profile</a>');
$form->addElement('static', null, '<em>'.get_lang('OptionalTextFields').'</em>');
// MY COMPETENCES
$form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '580', 'Height' => '130'));
$form->add_html_editor('competences', get_lang('MyCompetences'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
// MY DIPLOMAS
$form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '580', 'Height' => '130'));
$form->add_html_editor('diplomas', get_lang('MyDiplomas'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
// WHAT I AM ABLE TO TEACH
$form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '580', 'Height' => '130'));
$form->add_html_editor('teach', get_lang('MyTeach'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '130'));
// MY PRODUCTIONS
$form->addElement('file', 'production', get_lang('MyProductions'));
@ -264,7 +265,7 @@ if (api_get_setting('extended_profile') == 'true') {
$form->addElement('static', 'productions_list', null, $production_list);
}
// MY PERSONAL OPEN AREA
$form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => '580', 'Height' => '350'));
$form->add_html_editor('openarea', get_lang('MyPersonalOpenArea'), false, false, array('ToolbarSet' => 'Profile', 'Width' => $width_extended_profile, 'Height' => '350'));
$form->applyFilter(array('competences', 'diplomas', 'teach', 'openarea'), 'stripslashes');
$form->applyFilter(array('competences', 'diplomas', 'teach'), 'trim'); // openarea is untrimmed for maximum openness
}
@ -828,21 +829,7 @@ if (api_get_setting('allow_social_tool') == 'true') {
echo '</div>';
echo '<div id="social-content-right">';
echo '<table><tr><td>';
//Useless link
/*
echo '<div id="social-content-online">';
if (api_get_setting('extended_profile') == 'true') {
$show = isset($_GET['show']) ? '&amp;show='.Security::remove_XSS($_GET['show']) : '';
if (isset($_GET['type']) && $_GET['type'] == 'reduced') {
echo '<a href="profile.php?type=extended '.$show.'"><span class="social-menu-text1">'.Display::return_icon('edit.png', get_lang('EditExtendProfile'),'',16).'&nbsp;'.get_lang('EditExtendProfile').'</span></a>';
} else {
echo '<a href="profile.php?type=reduced'.$show.'"><span class="social-menu-text1">'.Display::return_icon('edit.png', get_lang('EditNormalProfile'),'',16).'&nbsp;'.get_lang('EditNormalProfile').'</span></a>';
}
}
echo '</div>';*/
$form->display();
echo '</td></tr></table>';
$form->display();
echo '</div>';
} else {
// Style position:absolute has been removed for Opera-compatibility.

@ -68,23 +68,10 @@ switch ($action) {
echo '';
break;
}
//deprecated variables?
//$my_current_friend = Security::remove_XSS($_POST['friend_id']);
//$my_denied_current_friend= Security::remove_XSS($_POST['denied_friend_id']);
$my_delete_friend = Security::remove_XSS($_POST['delete_friend_id']);
//$friend_id_qualify = Security::remove_XSS($_POST['user_id_friend_q']);
//$type_friend_qualify = Security::remove_XSS($_POST['type_friend_q']); //filtered?
//$is_my_friend = Security::remove_XSS($_POST['is_my_friend']); //filtered?
$my_delete_friend = intval($_POST['delete_friend_id']);
if (isset($_POST['delete_friend_id'])) {
SocialManager::remove_user_rel_user($my_delete_friend);
}
/*
if(isset($_POST['user_id_friend_q']) && isset($_POST['type_friend_q'])) {
SocialManager::qualify_friend($friend_id_qualify,$type_friend_qualify);
echo api_xml_http_response_encode(get_lang('AttachContactsToGroupSuccesfuly'));
}*/
}
break;
case 'show_my_friends':
if (api_is_anonymous()) {
@ -93,11 +80,11 @@ switch ($action) {
}
$list_path_friends = array();
$user_id = api_get_user_id();
$name_search= Security::remove_XSS($_POST['search_name_q']);
$name_search= Security::remove_XSS($_POST['search_name_q']);
$number_friends = 0;
if (isset($name_search) && $name_search!='undefined') {
$friends = SocialManager::get_friends($user_id,null,$name_search);
if (isset($name_search) && $name_search != 'undefined') {
$friends = SocialManager::get_friends($user_id, null, $name_search);
} else {
$friends = SocialManager::get_friends($user_id);
}
@ -123,7 +110,7 @@ switch ($action) {
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
$friend_html.='<span><a href="profile.php?u='.$friend['friend_user_id'].'"><center><img src="'.$friends_profile['file'].'" style="width:60px;height:60px;border:3pt solid #eee" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /></center></a></span>';
$friend_html.='<img onclick="delete_friend (this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
$friend_html.='<img onclick="delete_friend (this)" id=img_'.$friend['friend_user_id'].' src="'.api_get_path(WEB_IMG_PATH).'blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
}
$j++;
}

@ -42,15 +42,15 @@ function delete_friend (element_div) {
}
function search_image_social(element_html) {
name_search=$(element_html).attr("value");
function search_image_social() {
var name_search = $("#id_search_image").attr("value");
$.ajax({
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=show_my_friends",
data: "search_name_q="+name_search,
success: function(datos) {
$("div#div_content_table").html(datos);
$("#friend_table").html(datos);
}
});
}
@ -114,64 +114,35 @@ if (count($friends) == 0 ) {
echo get_lang('NoFriendsInYourContactList').'<br /><br />';
echo '<a href="search.php">'.get_lang('TryAndFindSomeFriends').'</a>';
} else {
?>
<div align="center" >
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td height="25" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td width="100%" valign="top" class="social-align-box">&nbsp;&nbsp;<?php echo get_lang('Search') .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?>
<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" value="" onkeyup="search_image_social(this)" />
</td>
</tr>
</table></td>
</tr>
<tr>
<td height="175" valign="top">
<table width="100%" border="0" cellpadding="0" cellspacing="0" >
<tr>
<td height="153" valign="top">
<?php
echo get_lang('Search') .'&nbsp;&nbsp; : &nbsp;&nbsp;'; ?>
<input class="social-search-image" type="text" id="id_search_image" name="id_search_image" onkeyup="search_image_social()" />
<?php
$friend_html = '';
$number_of_images = 8;
$number_friends = count($friends);
$j=0;
$friend_html = '';
$number_of_images = 8;
$number_friends = count($friends);
$j=0;
echo '<div id ="social-content-right">';
//echo '<div id="div_content_table" class="rounded_div" style="width:90%">';
$friend_html.= '<table class="rounded_div" width="95%" border="0" cellpadding="0" cellspacing="0" bgcolor="" >';
for ($k=0;$k<$number_friends;$k++) {
$friend_html.='<tr><td valign="top">';
while ($j<$number_friends) {
if (isset($friends[$j])) {
$friend = $friends[$j];
$user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
$friend_html.='<span><a href="profile.php?u='.$friend['friend_user_id'].'"><center><img src="'.$friends_profile['file'].'" style="height:60px;" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /></center></a></span>';
$friend_html.='<img onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
}
$j++;
}
$friend_html.='</td></tr>';
}
$friend_html.='<br/></table>';
echo $friend_html;
echo '</div>';
?>
</td>
</tr>
</table></td>
</tr>
</table>
</div>
<?php
}
$friend_html.= '<table id="friend_table" class="rounded_div" width="95%" border="0" cellpadding="0" cellspacing="0" bgcolor="" >';
for ($k=0;$k<$number_friends;$k++) {
$friend_html.='<tr><td valign="top">';
while ($j<$number_friends) {
if (isset($friends[$j])) {
$friend = $friends[$j];
$user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']);
$friends_profile = SocialManager::get_picture_user($friend['friend_user_id'], $friend['image'], 92);
$friend_html.='<div onMouseover="show_icon_delete(this)" onMouseout="hide_icon_delete(this)" class="image-social-content" id=div_'.$friends[$j]['friend_user_id'].'>';
$friend_html.='<span><a href="profile.php?u='.$friend['friend_user_id'].'"><center><img src="'.$friends_profile['file'].'" style="height:60px;" id="imgfriend_'.$friend['friend_user_id'].'" title="'.$user_name.'" /></center></a></span>';
$friend_html.='<img onclick="delete_friend(this)" id=img_'.$friend['friend_user_id'].' src="../img/blank.gif" alt="" title="" class="image-delete" /> <center class="friend">'.$user_name.'</center></div>';
}
$j++;
}
$friend_html.='</td></tr>';
}
$friend_html.='<br/></table>';
echo $friend_html;
}
echo '</div>';
echo '</div>';
Display :: display_footer();
Display :: display_footer();
Loading…
Cancel
Save