require_once(INSTALLDIR.'/lib/stream.php');
-define('SUBSCRIPTIONS_PER_ROW', 5);
+define('SUBSCRIPTIONS_PER_ROW', 4);
define('SUBSCRIPTIONS', 80);
class ShowstreamAction extends StreamAction {
return;
}
- # Looks like we're good; show the header
+ # Looks like we're good; start output
+
+ # For YADIS discovery, we also have a <meta> tag
+
+ header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
+ $user->nickname)));
common_show_header($profile->nickname, array($this, 'show_header'), $user);
$cur = common_current_user();
- if ($cur && $cur->id != $profile->id) {
- if ($cur->isSubscribed($profile)) {
- $this->show_unsubscribe_form($profile);
- } else {
- $this->show_subscribe_form($profile);
+ if ($cur) {
+ if ($cur->id != $profile->id) {
+ if ($cur->isSubscribed($profile)) {
+ $this->show_unsubscribe_form($profile);
+ } else {
+ $this->show_subscribe_form($profile);
+ }
}
+ } else {
+ $this->show_remote_subscribe_form($profile);
}
$this->show_statistics($profile);
common_element_end('form');
}
+ function show_remote_subscribe_form($profile) {
+ common_element_start('form', array('id' => 'remotesubscribe', 'method' => 'POST',
+ 'action' => common_local_url('remotesubscribe')));
+ common_hidden('nickname', $profile->nickname);
+ common_input('profile', _t('Profile'));
+ common_submit('submit',_t('Subscribe'));
+ common_element_end('form');
+ }
+
function show_unsubscribe_form($profile) {
common_element_start('form', array('id' => 'unsubscribe', 'method' => 'POST',
'action' => common_local_url('unsubscribe')));
$notice->orderBy('created DESC');
- $page = $this->arg('page') || 1;
+ $page = ($this->arg('page')) ? ($this->arg('page')+0) : 1;
- $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE);
+ $notice->limit((($page-1)*NOTICES_PER_PAGE), NOTICES_PER_PAGE + 1);
- $notice->find();
+ $cnt = $notice->find();
common_element_start('div', 'notices width66 floatLeft');
- common_element_start('ul', 'bigLinks');
-
- while ($notice->fetch()) {
- $this->show_notice($notice);
+ for ($i = 0; $i < min($cnt, NOTICES_PER_PAGE); $i++) {
+ if ($notice->fetch()) {
+ $this->show_notice($notice);
+ } else {
+ // shouldn't happen!
+ break;
+ }
+ }
+
+ if ($page > 1) {
+ common_element_start('span', 'floatLeft width25');
+ common_element('a', array('href' => common_local_url('showstream',
+ array('nickname' => $profile->nickname,
+ 'page' => $page-1)),
+ 'class' => 'newer'),
+ _t('Newer'));
+ common_element_end('span');
}
- common_element_end('ul');
+ if ($cnt > NOTICES_PER_PAGE) {
+ common_element_start('span', 'floatRight width25');
+ common_element('a', array('href' => common_local_url('showstream',
+ array('nickname' => $profile->nickname,
+ 'page' => $page+1)),
+ 'class' => 'older'),
+ _t('Older'));
+ common_element_end('span');
+ }
# XXX: show a link for the next page
common_element_end('div');
if ($notice->find(true)) {
# FIXME: URL, image, video, audio
- common_element('span', array('class' => 'content'),
- $notice->content);
+ common_element_start('span', array('class' => 'content'));
+ common_raw(common_render_content($notice->content, $notice));
+ common_element_end('span');
}
common_element_end('div');
function show_notice($notice) {
$profile = $notice->getProfile();
# XXX: RDFa
- common_element_start('li', array('class' => 'notice',
- 'id' => 'notice-' . $notice->id));
+ common_element_start('div', array('class' => 'notice',
+ 'id' => 'notice-' . $notice->id));
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
# FIXME: URL, image, video, audio
- common_element_start('a', array('class' => 'notice',
- 'href' => $noticeurl));
- common_element('span', 'title', common_date_string($notice->created));
- common_element('span', 'desc', $notice->content);
- common_element_end('a');
- common_element_end('li');
+ common_element_start('span', array('class' => 'content'));
+ common_raw(common_render_content($notice->content, $notice));
+ common_element_end('span');
+ common_element('a', array('class' => 'notice',
+ 'href' => $noticeurl),
+ common_date_string($notice->created));
+ common_element_end('div');
}
}