first checkin - updated contact_edit, more work remains

This commit is contained in:
Friendika 2011-11-08 18:30:20 -08:00
parent 20ca93191f
commit 05cabf24a9
4 changed files with 87 additions and 63 deletions

View File

@ -161,6 +161,36 @@ function common_friends($uid,$cid) {
} }
function count_all_friends($uid,$cid) {
$r = q("SELECT count(*) as `total`
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d ",
intval($cid),
intval($uid)
);
if(count($r))
return $r[0]['total'];
return 0;
}
function all_friends($uid,$cid,$start = 0, $limit = 80) {
$r = q("SELECT `gcontact`.*
FROM `glink` left join `gcontact` on `glink`.`gcid` = `gcontact`.`id`
where `glink`.`cid` = %d and `glink`.`uid` = %d LIMIT %d, %d ",
intval($cid),
intval($uid),
intval($start),
intval($limit)
);
return $r;
}
function suggestion_query($uid, $start = 0, $limit = 40) { function suggestion_query($uid, $start = 0, $limit = 40) {

View File

@ -259,15 +259,16 @@ function contacts_content(&$a) {
if($r[0]['last-update'] !== '0000-00-00 00:00:00') if($r[0]['last-update'] !== '0000-00-00 00:00:00')
$last_update .= ' ' . (($r[0]['last-update'] == $r[0]['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29")); $last_update .= ' ' . (($r[0]['last-update'] == $r[0]['success_update']) ? t("\x28Update was successful\x29") : t("\x28Update was not successful\x29"));
$lblsuggest = (($r[0]['network'] === NETWORK_DFRN) $lblsuggest = (($r[0]['network'] === NETWORK_DFRN) ? t('Suggest friends') : '');
? '<div id="contact-suggest-wrapper"><a href="fsuggest/' . $r[0]['id'] . '" id="contact-suggest">' . t('Suggest friends') . '</a></div>' : '');
$poll_enabled = (($r[0]['network'] !== NETWORK_DIASPORA) ? true : false); $poll_enabled = (($r[0]['network'] !== NETWORK_DIASPORA) ? true : false);
$nettype = '<div id="contact-edit-nettype">' . sprintf( t('Network type: %s'),network_to_name($r[0]['network'])) . '</div>'; $nettype = sprintf( t('Network type: %s'),network_to_name($r[0]['network']));
$common = count_common_friends(local_user(),$r[0]['id']); $common = count_common_friends(local_user(),$r[0]['id']);
$common_text = (($common) ? sprintf( tt('%d friends in common','%d friends in common', $common),$common) : ''); $common_text = (($common) ? sprintf( tt('%d contacts in common','%d contacts in common', $common),$common) : '');
$common_view = t('View');
$all_friends = t('View all contacts');
$o .= replace_macros($tpl,array( $o .= replace_macros($tpl,array(
'$header' => t('Contact Editor'), '$header' => t('Contact Editor'),
'$submit' => t('Submit'), '$submit' => t('Submit'),
@ -280,11 +281,12 @@ function contacts_content(&$a) {
'$lbl_rep4' => t('Please take a moment to elaborate on this selection if you feel it could be helpful to others.'), '$lbl_rep4' => t('Please take a moment to elaborate on this selection if you feel it could be helpful to others.'),
'$common_text' => $common_text, '$common_text' => $common_text,
'$common_link' => $a->get_baseurl() . '/common/' . $r[0]['id'], '$common_link' => $a->get_baseurl() . '/common/' . $r[0]['id'],
'$all_friends' => $all_friends,
'$visit' => sprintf( t('Visit %s\'s profile [%s]'),$r[0]['name'],$r[0]['url']), '$visit' => sprintf( t('Visit %s\'s profile [%s]'),$r[0]['name'],$r[0]['url']),
'$blockunblock' => t('Block/Unblock contact'), '$blockunblock' => t('Block/Unblock contact'),
'$ignorecont' => t('Ignore contact'), '$ignorecont' => t('Ignore contact'),
'$altcrepair' => t('Repair contact URL settings'), '$altcrepair' => t('Repair contact URL settings'),
'$lblcrepair' => t("Repair contact URL settings \x28WARNING: Advanced\x29"), '$lblcrepair' => t("Repair contact URL settings"),
'$lblrecent' => t('View conversations'), '$lblrecent' => t('View conversations'),
'$lblsuggest' => $lblsuggest, '$lblsuggest' => $lblsuggest,
'$delete' => t('Delete contact'), '$delete' => t('Delete contact'),

View File

@ -1,35 +1,44 @@
<h2>$header</h2> <h2>$header</h2>
<div id="contact-edit-banner-name">$name</div> <div id="contact-edit-wrapper" >
<div id="contact-edit-banner-name">$name</div>
<div id="contact-edit-photo" >
<a href="$url" title="$visit" /><img src="$photo" $sparkle alt="$name" /></a>
</div>
<div id="contact-edit-drop-link" >
<a href="contacts/$contact_id/drop" class="icon drophide" id="contact-edit-drop-link" onclick="return confirmDelete();" title="$delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);"></a>
</div>
<div id="contact-edit-drop-link-end"></div>
<div id="contact-edit-nav-wrapper" >
<div id="contact-edit-links" >
<ul>
<li><a href="network/?cid=$contact_id" id="contact-view-recent">$lblrecent</a></li>
{{ if $lblsuggest }}
<li><a href="fsuggest/$contact_id" id="contact-edit-suggest">$lblsuggest</a></li>
{{ endif }}
<li><a href="contacts/$contact_id/block" id="contact-edit-block-link" title="$block_text">$block_text</a></li>
<li><a href="contacts/$contact_id/ignore" id="contact-edit-ignore-link" title="$ignore_text">$ignore_text</a></li>
<li><a href="crepair/$contact_id" id="contact-edit-repair" title="$lblcrepair">$lblcrepair</a></li>
</ul>
</div>
<div id="contact-edit-info-links">
<div id="contact-edit-nettype">$nettype</div>
{{ if $common_text }}
<div id="contact-edit-common"><a href="common/$contact_id">$common_text</a></div>
{{ endif }}
<div id="contact-edit-allfriends"><a href="allfriends/$contact_id">$all_friends</a></div>
</div>
</div>
<div id="contact-edit-nav-end"></div>
$nettype
<form action="contacts/$contact_id" method="post" > <form action="contacts/$contact_id" method="post" >
<input type="hidden" name="contact_id" value="$contact_id"> <input type="hidden" name="contact_id" value="$contact_id">
{# <img id="contact-edit-direction-icon" src="$dir_icon" alt="$alt_text" title="$alt_text" /> #}
<div id="contact-edit-wrapper" >
<div id="contact-edit-photo-wrapper" >
<img id="contact-edit-direction-icon" src="$dir_icon" alt="$alt_text" title="$alt_text" />
<div id="contact-edit-photo" >
<a href="$url" title="$visit" /><img src="$photo" $sparkle alt="$name" /></a>
</div>
<div id="contact-edit-photo-end" ></div>
</div>
<div id="contact-edit-nav-wrapper" >
<div id="contact-edit-links" >
<a href="contacts/$contact_id/block" class="icon block" id="contact-edit-block-link" title="$block_text"></a>
<a href="contacts/$contact_id/ignore" class="icon no" id="contact-edit-ignore-link" title="$ignore_text"></a>
<a href="crepair/$contact_id" class="icon tools" id="contact-edit-repair" title="$lblcrepair"></a>
</div>
<div id="contact-drop-links" >
<a href="contacts/$contact_id/drop" class="icon drophide" id="contact-edit-drop-link" onclick="return confirmDelete();" title="$delete" onmouseover="imgbright(this);" onmouseout="imgdull(this);"></a>
</div>
<div id="contact-edit-nav-end"></div>
{{ if $poll_enabled }} {{ if $poll_enabled }}
<div id="contact-edit-poll-wrapper"> <div id="contact-edit-poll-wrapper">
@ -39,23 +48,14 @@ $nettype
<div id="contact-edit-update-now" class="button"><a href="contacts/$contact_id/update" >$udnow</a></div> <div id="contact-edit-update-now" class="button"><a href="contacts/$contact_id/update" >$udnow</a></div>
</div> </div>
{{ endif }} {{ endif }}
</div>
<div id="contact-edit-end" ></div> <div id="contact-edit-end" ></div>
{{ if $common_text }}
<div id="contact-edit-common">
<a href="$common_link">$common_text</a>
</a>
{{ endif }}
$insecure $insecure
$blocked $blocked
$ignored $ignored
<div id="view-recent-wrapper"><a href="network/?cid=$contact_id" id="contact-view-recent">$lblrecent</a></div>
$lblsuggest
<div id="contact-edit-info-wrapper"> <div id="contact-edit-info-wrapper">
<h4>$lbl_info1</h4> <h4>$lbl_info1</h4>

View File

@ -1396,13 +1396,12 @@ input#dfrn-url {
} }
#contact-edit-wrapper { #contact-edit-wrapper {
margin-top: 50px; margin-top: 10px;
} }
#contact-edit-banner-name { #contact-edit-banner-name {
font-size: 1.4em; font-size: 1.4em;
font-weight: bold; font-weight: bold;
margin-left: 30px;
} }
#contact-edit-nettype { #contact-edit-nettype {
@ -1427,25 +1426,22 @@ input#dfrn-url {
#contact-edit-photo-wrapper { #contact-edit-photo-wrapper {
margin-bottom: 20px; margin-bottom: 20px;
} }
#contact-edit-links {
float: left; #contact-edit-links{
clear: both;
} }
#contact-edit-links a {
float: left; #contact-edit-drop-link {
float: right;
margin-right: 20px;
} }
#contact-edit-links img {
margin-left: 20px; /*
border: none; #contact-edit-drop-link img {
}
#contact-drop-links {
float: left;
}
#contact-drop-links img {
margin-left: 20px; margin-left: 20px;
border: none; border: none;
} }
*/
#contact-edit-nav-end { #contact-edit-nav-end {
clear: both; clear: both;
@ -1469,7 +1465,11 @@ input#dfrn-url {
float: left; float: left;
} }
#contact-edit-wrapper {
width: 100%;
}
#contact-edit-nav-wrapper { #contact-edit-nav-wrapper {
/* width: 450px; */
float: left; float: left;
} }
@ -1482,14 +1482,6 @@ input#dfrn-url {
margin-left: 175px; margin-left: 175px;
} }
#contact-reputation-selector {
margin-left: 175px;
}
#contact-edit-rating-text {
margin-left: 175px;
}
.contact-edit-submit { .contact-edit-submit {
margin-top: 20px; margin-top: 20px;
/*margin-left: 50px;*/ /*margin-left: 50px;*/