change remote subscribe to link

darcs-hash:20080630195032-84dde-941bafd039cd6483c5eee0ec9acde9df911a3d14.gz
This commit is contained in:
Evan Prodromou 2008-06-30 15:50:32 -04:00
parent c784f60a40
commit d0e8f8d8a2

View File

@ -52,7 +52,7 @@ class ShowstreamAction extends StreamAction {
header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' => header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
$user->nickname))); $user->nickname)));
common_show_header($profile->nickname, common_show_header($profile->nickname,
array($this, 'show_header'), $user, array($this, 'show_header'), $user,
array($this, 'show_top')); array($this, 'show_top'));
@ -64,16 +64,16 @@ class ShowstreamAction extends StreamAction {
} }
function show_top($user) { function show_top($user) {
$cur = common_current_user(); $cur = common_current_user();
if ($cur && $cur->id == $user->id) { if ($cur && $cur->id == $user->id) {
common_notice_form('showstream'); common_notice_form('showstream');
} }
$this->views_menu(); $this->views_menu();
} }
function show_header($user) { function show_header($user) {
common_element('link', array('rel' => 'alternate', common_element('link', array('rel' => 'alternate',
'href' => common_local_url('userrss', array('nickname' => 'href' => common_local_url('userrss', array('nickname' =>
@ -129,12 +129,12 @@ class ShowstreamAction extends StreamAction {
} }
} }
} else { } else {
$this->show_remote_subscribe_form($profile); $this->show_remote_subscribe_link($profile);
} }
common_element_end('div'); common_element_end('div');
common_element_start('div', array('id' => 'profile_information')); common_element_start('div', array('id' => 'profile_information'));
if ($profile->fullname) { if ($profile->fullname) {
common_element('h1', NULL, $profile->fullname); common_element('h1', NULL, $profile->fullname);
} }
@ -150,7 +150,7 @@ class ShowstreamAction extends StreamAction {
$profile->homepage); $profile->homepage);
common_element_end('p'); common_element_end('p');
} }
$this->show_statistics($profile); $this->show_statistics($profile);
common_element_end('div'); common_element_end('div');
@ -169,21 +169,11 @@ class ShowstreamAction extends StreamAction {
common_element_end('form'); common_element_end('form');
} }
function show_remote_subscribe_form($profile) { function show_remote_subscribe_link($profile) {
common_element_start('form', array('id' => 'remotesubscribe', $url = common_local_url('remotesubscribe',
'method' => 'POST', array('nickname' => $profile->nickname);
'action' => common_local_url('remotesubscribe'))); common_element('a', array('href' => $url),
common_hidden('nickname', $profile->nickname); _t('Subscribe'));
common_element('input', array('name' => 'profile_url',
'type' => 'text',
'id' => 'profile_url',
'size' => '15'));
common_element('input', array('type' => 'submit',
'id' => 'submit',
'name' => 'submit',
'value' => _t('Subscribe'),
'class' => 'submit'));
common_element_end('form');
} }
function show_unsubscribe_form($profile) { function show_unsubscribe_form($profile) {
@ -205,7 +195,7 @@ class ShowstreamAction extends StreamAction {
$subs = DB_DataObject::factory('subscription'); $subs = DB_DataObject::factory('subscription');
$subs->subscriber = $profile->id; $subs->subscriber = $profile->id;
$subs->orderBy('created DESC'); $subs->orderBy('created DESC');
# We ask for an extra one to know if we need to do another page # We ask for an extra one to know if we need to do another page
$subs->limit(0, SUBSCRIPTIONS + 1); $subs->limit(0, SUBSCRIPTIONS + 1);
@ -217,11 +207,11 @@ class ShowstreamAction extends StreamAction {
common_element('h2', NULL, _t('Subscriptions')); common_element('h2', NULL, _t('Subscriptions'));
if ($subs_count > 0) { if ($subs_count > 0) {
common_element_start('ul', array('id' => 'subscriptions_avatars')); common_element_start('ul', array('id' => 'subscriptions_avatars'));
for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) { for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
if (!$subs->fetch()) { if (!$subs->fetch()) {
common_debug('Weirdly, broke out of subscriptions loop early', __FILE__); common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
break; break;
@ -246,20 +236,20 @@ class ShowstreamAction extends StreamAction {
common_element_end('a'); common_element_end('a');
common_element_end('li'); common_element_end('li');
} }
common_element_end('ul'); common_element_end('ul');
} }
if ($subs_count > SUBSCRIPTIONS) { if ($subs_count > SUBSCRIPTIONS) {
common_element_start('p', array('id' => 'subscriptions_viewall')); common_element_start('p', array('id' => 'subscriptions_viewall'));
common_element('a', array('href' => common_local_url('subscriptions', common_element('a', array('href' => common_local_url('subscriptions',
array('nickname' => $profile->nickname)), array('nickname' => $profile->nickname)),
'class' => 'moresubscriptions'), 'class' => 'moresubscriptions'),
_t('All subscriptions')); _t('All subscriptions'));
common_element_end('p'); common_element_end('p');
} }
common_element_end('div'); common_element_end('div');
} }
@ -317,7 +307,7 @@ class ShowstreamAction extends StreamAction {
if ($cnt > 0) { if ($cnt > 0) {
common_element_start('ul', array('id' => 'notices')); common_element_start('ul', array('id' => 'notices'));
for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) { for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
if ($notice->fetch()) { if ($notice->fetch()) {
$this->show_notice($notice); $this->show_notice($notice);
@ -326,7 +316,7 @@ class ShowstreamAction extends StreamAction {
break; break;
} }
} }
common_element_end('ul'); common_element_end('ul');
} }
common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page, common_pagination($page>1, $cnt>NOTICES_PER_PAGE, $page,