viewcontacts update

This commit is contained in:
friendica 2013-02-19 00:20:47 -08:00
parent 6e6a83194a
commit 2d6027150f
6 changed files with 29 additions and 32 deletions

View File

@ -598,7 +598,7 @@ function contact_block() {
if((! is_array($a->profile)) || ($a->profile['hide_friends']))
return $o;
$r = q("SELECT COUNT(*) AS total FROM abook WHERE abook_channel = %d and abook_flags = 0",
$r = q("SELECT COUNT(abook_id) AS total FROM abook WHERE abook_channel = %d and abook_flags = 0",
intval($a->profile['uid'])
);
if(count($r)) {
@ -627,7 +627,7 @@ function contact_block() {
$tpl = get_markup_template('contact_block.tpl');
$o = replace_macros($tpl, array(
'$contacts' => $contacts,
'$nickname' => $a->profile['nickname'],
'$nickname' => $a->profile['channel_address'],
'$viewcontacts' => t('View Connections'),
'$micropro' => $micropro,
));

View File

@ -378,7 +378,7 @@ function update_r1030() {
KEY `issue_created` (`issue_created`),
KEY `issue_updated` (`issue_updated`),
KEY `issue_assigned` (`issue_assigned`),
KEY `issue_priority` ('issue_priority`),
KEY `issue_priority` (`issue_priority`),
KEY `issue_status` (`issue_status`),
KEY `issue_component` (`issue_component`)
) ENGINE = MYISAM ");

View File

@ -1,13 +1,14 @@
<?php
require_once('include/contact_selectors.php');
require_once('include/Contact.php');
function viewcontacts_init(&$a) {
if((get_config('system','block_public')) && (! local_user()) && (! remote_user())) {
return;
}
profile_load($a,$a->argv[1]);
if(argc() > 1)
profile_load($a,argv(1));
}
@ -33,57 +34,53 @@ function viewcontacts_content(&$a) {
return;
}
if(! perm_is_allowed($a->profile['uid'], get_observer_hash(),'view_contacts')) {
notice( t('Permission denied.') . EOL);
return;
}
$r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ",
$r = q("SELECT COUNT(abook_id) as total FROM abook WHERE abook_channel = %d AND abook_flags = 0 ",
intval($a->profile['uid'])
);
if(count($r))
if($r)
$a->set_pager_total($r[0]['total']);
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 ORDER BY `name` ASC LIMIT %d , %d ",
$r = q("SELECT * FROM abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_flags = 0 order by xchan_name LIMIT %d , %d ",
intval($a->profile['uid']),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
if(! count($r)) {
info( t('No contacts.') . EOL );
if(! $r) {
info( t('No connections.') . EOL );
return $o;
}
$contacts = array();
foreach($r as $rr) {
if($rr['self'])
continue;
$url = $rr['url'];
// route DFRN profiles through the redirect
$is_owner = ((local_user() && ($a->profile['profile_uid'] == local_user())) ? true : false);
if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
$url = 'redir/' . $rr['id'];
else
$url = zid($url);
$url = zid($rr['xchan_url']);
$contacts[] = array(
'id' => $rr['id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'thumb' => $rr['thumb'],
'name' => substr($rr['name'],0,20),
'username' => $rr['name'],
'id' => $rr['abook_id'],
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'), $rr['xchan_name'], $rr['xchan_url']),
'thumb' => $rr['xchan_photo_m'],
'name' => substr($rr['xchan_name'],0,20),
'username' => $rr['xchan_addr'],
'url' => $url,
'sparkle' => '',
'itemurl' => $rr['url'],
'network' => network_to_name($rr['network']),
'network' => '',
);
}
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array(
'$title' => t('View Contacts'),
'$title' => t('View Connnections'),
'$contacts' => $contacts,
'$paginate' => paginate($a),
));

View File

@ -1 +1 @@
2013-02-18.228
2013-02-19.229

View File

@ -1,7 +1,7 @@
<div class="contact-entry-wrapper" id="contact-entry-wrapper-$contact.id" >
<div class="contact-entry-photo-wrapper" >
<a href="$contact.edit" title="$contact.img_hover" /><img src="$contact.thumb" alt="$contact.name" /></a>
<a href="$contact.url" title="$contact.img_hover" /><img src="$contact.thumb" alt="$contact.name" /></a>
</div>
<div class="contact-entry-photo-end" ></div>
<div class="contact-entry-name" id="contact-entry-name-$contact.id" >$contact.name</div>

View File

@ -6,7 +6,7 @@
<div class="contact-entry-wrapper" id="contact-entry-wrapper-{{$contact.id}}" >
<div class="contact-entry-photo-wrapper" >
<a href="{{$contact.edit}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a>
<a href="{{$contact.url}}" title="{{$contact.img_hover}}" /><img src="{{$contact.thumb}}" alt="{{$contact.name}}" /></a>
</div>
<div class="contact-entry-photo-end" ></div>
<div class="contact-entry-name" id="contact-entry-name-{{$contact.id}}" >{{$contact.name}}</div>