quattro post preview, style contacts pages, style for "shiny" class, fix contacts list in profile aside.

remove html from viewcontacts.php and contacts.php
use contact_template.tpl to print contacts also in viewcontacts
This commit is contained in:
Fabio Comuni 2012-02-23 11:22:32 +01:00
commit cbc60d525e
15 changed files with 273 additions and 134 deletions

View file

@ -451,29 +451,17 @@ function contacts_content(&$a) {
$a->set_pager_total($r[0]['total']);
$tpl = get_markup_template("contacts-top.tpl");
$o .= replace_macros($tpl,array(
'$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
'$tabs' => $t,
'$total' => $r[0]['total'],
'$search' => $search_hdr,
'$desc' => t('Search your contacts'),
'$finding' => (strlen($search) ? '<h4>' . t('Finding: ') . "'" . $search . "'" . '</h4>' : ""),
'$submit' => t('Find'),
'$cmd' => $a->cmd
));
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `pending` = 0 $sql_extra $sql_extra2 ORDER BY `name` ASC LIMIT %d , %d ",
intval($_SESSION['uid']),
intval($a->pager['start']),
intval($a->pager['itemspage'])
);
if(count($r)) {
$contacts = array();
$tpl = get_markup_template("contact_template.tpl");
if(count($r)) {
foreach($r as $rr) {
if($rr['self'])
@ -505,24 +493,40 @@ function contacts_content(&$a) {
}
$o .= replace_macros($tpl, array(
'$img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
'$edit_hover' => t('Edit contact'),
'$contact_photo_menu' => contact_photo_menu($rr),
'$id' => $rr['id'],
'$alt_text' => $alt_text,
'$dir_icon' => $dir_icon,
'$thumb' => $rr['thumb'],
'$name' => $rr['name'],
'$username' => $rr['name'],
'$sparkle' => $sparkle,
'$url' => $url
));
$contacts[] = array(
'img_hover' => sprintf( t('Visit %s\'s profile [%s]'),$rr['name'],$rr['url']),
'edit_hover' => t('Edit contact'),
'photo_menu' => contact_photo_menu($rr),
'id' => $rr['id'],
'alt_text' => $alt_text,
'dir_icon' => $dir_icon,
'thumb' => $rr['thumb'],
'name' => $rr['name'],
'username' => $rr['name'],
'sparkle' => $sparkle,
'url' => $url,
'item' => $rr,
);
}
$o .= '<div id="contact-edit-end"></div>';
}
$o .= paginate($a);
$tpl = get_markup_template("contacts-template.tpl");
$o .= replace_macros($tpl,array(
'$header' => t('Contacts') . (($nets) ? ' - ' . network_to_name($nets) : ''),
'$tabs' => $t,
'$total' => $r[0]['total'],
'$search' => $search_hdr,
'$desc' => t('Search your contacts'),
'$finding' => (strlen($search) ? t('Finding: ') . "'" . $search . "'" : ""),
'$submit' => t('Find'),
'$cmd' => $a->cmd,
'$contacts' => $contacts,
'$paginate' => paginate($a),
));
return $o;
}

View file

@ -1,4 +1,5 @@
<?php
require_once('include/contact_selectors.php');
function viewcontacts_init(&$a) {
@ -22,8 +23,6 @@ function viewcontacts_content(&$a) {
return;
}
$o .= '<h3>' . t('View Contacts') . '</h3>';
$r = q("SELECT COUNT(*) as `total` FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 ",
intval($a->profile['uid'])
@ -41,7 +40,7 @@ function viewcontacts_content(&$a) {
return $o;
}
$tpl = get_markup_template("viewcontact_template.tpl");
$contacts = array();
foreach($r as $rr) {
if($rr['self'])
@ -56,19 +55,26 @@ function viewcontacts_content(&$a) {
if($is_owner && ($rr['network'] === NETWORK_DFRN) && ($rr['rel']))
$url = 'redir/' . $rr['id'];
$o .= replace_macros($tpl, array(
'$id' => $rr['id'],
'$alt_text' => sprintf( t('Visit %s\'s profile [%s]'), $rr['name'], $rr['url']),
'$thumb' => $rr['thumb'],
'$name' => substr($rr['name'],0,20),
'$username' => $rr['name'],
'$url' => $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'],
'url' => $url,
'sparkle' => '',
'item' => $rr,
);
}
$o .= '<div id="view-contact-end"></div>';
$o .= paginate($a);
$tpl = get_markup_template("viewcontact_template.tpl");
$o .= replace_macros($tpl, array(
'$title' => t('View Contacts'),
'$contacts' => $contacts,
'$paginate' => paginate($a),
));
return $o;
}