fix sub/unsub buttons, profileminilist for sections
This commit is contained in:
parent
00f6f4fb67
commit
ed9cb94ff3
|
@ -34,6 +34,7 @@ if (!defined('LACONICA')) {
|
||||||
|
|
||||||
require_once INSTALLDIR.'/lib/personalgroupnav.php';
|
require_once INSTALLDIR.'/lib/personalgroupnav.php';
|
||||||
require_once INSTALLDIR.'/lib/noticelist.php';
|
require_once INSTALLDIR.'/lib/noticelist.php';
|
||||||
|
require_once INSTALLDIR.'/lib/profileminilist.php';
|
||||||
require_once INSTALLDIR.'/lib/feedlist.php';
|
require_once INSTALLDIR.'/lib/feedlist.php';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -305,7 +306,6 @@ class ShowstreamAction extends Action
|
||||||
}
|
}
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
|
|
||||||
|
|
||||||
$this->elementStart('div', array('id' => 'user_actions'));
|
$this->elementStart('div', array('id' => 'user_actions'));
|
||||||
$this->element('h2', null, _('User actions'));
|
$this->element('h2', null, _('User actions'));
|
||||||
$this->elementStart('ul');
|
$this->elementStart('ul');
|
||||||
|
@ -314,11 +314,11 @@ class ShowstreamAction extends Action
|
||||||
if ($cur) {
|
if ($cur) {
|
||||||
if ($cur->id != $this->profile->id) {
|
if ($cur->id != $this->profile->id) {
|
||||||
if ($cur->isSubscribed($this->profile)) {
|
if ($cur->isSubscribed($this->profile)) {
|
||||||
$sf = new SubscribeForm($this, $this->profile);
|
|
||||||
$sf->show();
|
|
||||||
} else {
|
|
||||||
$usf = new UnsubscribeForm($this, $this->profile);
|
$usf = new UnsubscribeForm($this, $this->profile);
|
||||||
$usf->show();
|
$usf->show();
|
||||||
|
} else {
|
||||||
|
$sf = new SubscribeForm($this, $this->profile);
|
||||||
|
$sf->show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -344,17 +344,15 @@ class ShowstreamAction extends Action
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if ($cur && $cur->id != $this->profile->id) {
|
if ($cur && $cur->id != $this->profile->id) {
|
||||||
$blocked = $cur->hasBlocked($this->profile);
|
$blocked = $cur->hasBlocked($this->profile);
|
||||||
$this->elementStart('li', array('id' => 'user_block'));
|
$this->elementStart('li', array('id' => 'user_block'));
|
||||||
if ($blocked) {
|
if ($blocked) {
|
||||||
$bf = new BlockForm($this, $this->profile);
|
|
||||||
$bf->show();
|
|
||||||
} else {
|
|
||||||
$ubf = new UnblockForm($this, $this->profile);
|
$ubf = new UnblockForm($this, $this->profile);
|
||||||
$ubf->show();
|
$ubf->show();
|
||||||
|
} else {
|
||||||
|
$bf = new BlockForm($this, $this->profile);
|
||||||
|
$bf->show();
|
||||||
}
|
}
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
}
|
||||||
|
@ -386,71 +384,28 @@ class ShowstreamAction extends Action
|
||||||
{
|
{
|
||||||
$this->showStatistics();
|
$this->showStatistics();
|
||||||
$this->showSubscriptions();
|
$this->showSubscriptions();
|
||||||
|
$this->showSubscribers();
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSubscriptions()
|
function showSubscriptions()
|
||||||
{
|
{
|
||||||
$subs = new Subscription();
|
$profile = $this->user->getSubscriptions(0, PROFILES_PER_MINILIST + 1);
|
||||||
$subs->subscriber = $this->profile->id;
|
|
||||||
$subs->whereAdd('subscribed != ' . $this->profile->id);
|
|
||||||
|
|
||||||
$subs->orderBy('created DESC');
|
|
||||||
|
|
||||||
// We ask for an extra one to know if we need to do another page
|
|
||||||
|
|
||||||
$subs->limit(0, SUBSCRIPTIONS + 1);
|
|
||||||
|
|
||||||
$subs_count = $subs->find();
|
|
||||||
|
|
||||||
$this->elementStart('div', array('id' => 'user_subscriptions',
|
$this->elementStart('div', array('id' => 'user_subscriptions',
|
||||||
'class' => 'section'));
|
'class' => 'section'));
|
||||||
|
|
||||||
$this->element('h2', null, _('Subscriptions'));
|
$this->element('h2', null, _('Subscriptions'));
|
||||||
|
|
||||||
if ($subs_count > 0) {
|
if ($profile) {
|
||||||
|
$pml = new ProfileMiniList($profile, $this->user, $this);
|
||||||
$this->elementStart('ul', 'users');
|
$cnt = $pml->show();
|
||||||
|
if ($cnt == 0) {
|
||||||
for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
|
$this->element('p', null, _('(None)'));
|
||||||
|
|
||||||
if (!$subs->fetch()) {
|
|
||||||
common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
$other = Profile::staticGet($subs->subscribed);
|
|
||||||
|
|
||||||
if (!$other) {
|
|
||||||
common_log_db_error($subs, 'SELECT', __FILE__);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->elementStart('li', 'vcard');
|
|
||||||
$this->elementStart('a', array('title' => ($other->fullname) ?
|
|
||||||
$other->fullname :
|
|
||||||
$other->nickname,
|
|
||||||
'href' => $other->profileurl,
|
|
||||||
'rel' => 'contact',
|
|
||||||
'class' => 'url'));
|
|
||||||
$avatar = $other->getAvatar(AVATAR_MINI_SIZE);
|
|
||||||
$this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
|
|
||||||
'width' => AVATAR_MINI_SIZE,
|
|
||||||
'height' => AVATAR_MINI_SIZE,
|
|
||||||
'class' => 'avatar photo',
|
|
||||||
'alt' => ($other->fullname) ?
|
|
||||||
$other->fullname :
|
|
||||||
$other->nickname));
|
|
||||||
$this->element('span', 'fn nickname', $other->nickname);
|
|
||||||
$this->elementEnd('a');
|
|
||||||
$this->elementEnd('li');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->elementEnd('ul');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($subs_count > SUBSCRIPTIONS) {
|
if ($cnt > PROFILES_PER_MINILIST) {
|
||||||
$this->elementStart('p');
|
$this->elementStart('p');
|
||||||
|
|
||||||
$this->element('a', array('href' => common_local_url('subscriptions',
|
$this->element('a', array('href' => common_local_url('subscriptions',
|
||||||
array('nickname' => $this->profile->nickname)),
|
array('nickname' => $this->profile->nickname)),
|
||||||
'class' => 'mores'),
|
'class' => 'mores'),
|
||||||
|
@ -461,6 +416,35 @@ class ShowstreamAction extends Action
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showSubscribers()
|
||||||
|
{
|
||||||
|
$profile = $this->user->getSubscribers(0, PROFILES_PER_MINILIST + 1);
|
||||||
|
|
||||||
|
$this->elementStart('div', array('id' => 'user_subscribers',
|
||||||
|
'class' => 'section'));
|
||||||
|
|
||||||
|
$this->element('h2', null, _('Subscribers'));
|
||||||
|
|
||||||
|
if ($profile) {
|
||||||
|
$pml = new ProfileMiniList($profile, $this->user, $this);
|
||||||
|
$cnt = $pml->show();
|
||||||
|
if ($cnt == 0) {
|
||||||
|
$this->element('p', null, _('(None)'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($cnt > PROFILES_PER_MINILIST) {
|
||||||
|
$this->elementStart('p');
|
||||||
|
$this->element('a', array('href' => common_local_url('subscribers',
|
||||||
|
array('nickname' => $this->profile->nickname)),
|
||||||
|
'class' => 'mores'),
|
||||||
|
_('All subscribers'));
|
||||||
|
$this->elementEnd('p');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->elementEnd('div');
|
||||||
|
}
|
||||||
|
|
||||||
function showStatistics()
|
function showStatistics()
|
||||||
{
|
{
|
||||||
// XXX: WORM cache this
|
// XXX: WORM cache this
|
||||||
|
@ -513,7 +497,6 @@ class ShowstreamAction extends Action
|
||||||
|
|
||||||
$this->elementEnd('div');
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We don't show the author for a profile, since we already know who it is!
|
// We don't show the author for a profile, since we already know who it is!
|
||||||
|
|
Loading…
Reference in New Issue
Block a user