Merge branch 'master' of /var/www/trunk

This commit is contained in:
Robin Millette 2009-01-20 20:38:05 +00:00
commit 5abdf8aae1
5 changed files with 172 additions and 102 deletions

View File

@ -132,7 +132,12 @@ class ShowstreamAction extends Action
function showPageTitle() function showPageTitle()
{ {
// Don't show the H1; we have one in the profile block $this->element('h1', NULL, $this->profile->nickname._("'s profile"));
}
function showPageNoticeBlock()
{
return;
} }
function showExportData() function showExportData()
@ -219,19 +224,90 @@ class ShowstreamAction extends Action
function showProfile() function showProfile()
{ {
$this->elementStart('div', array('id' => 'profile', 'class' => 'vcard')); $this->elementStart('div', array('id' => 'user_profile', 'class' => 'vcard author'));
$this->element('h2', null, _('User profile'));
$avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE); $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
$this->elementStart('div', array('id' => 'profile_avatar')); $this->elementStart('dl', 'user_depiction');
$this->element('dt', null, _('Photo'));
$this->elementStart('dd');
$this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE), $this->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_PROFILE_SIZE),
'class' => 'avatar profile photo', 'class' => 'photo avatar',
'width' => AVATAR_PROFILE_SIZE, 'width' => AVATAR_PROFILE_SIZE,
'height' => AVATAR_PROFILE_SIZE, 'height' => AVATAR_PROFILE_SIZE,
'alt' => $this->profile->nickname)); 'alt' => $this->profile->nickname));
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementStart('ul', array('id' => 'profile_actions')); $this->elementStart('dl', 'user_nickname');
$this->element('dt', null, _('Nickname'));
$this->elementStart('dd');
$this->element('a', array('href' => $this->profile->profileurl,
'rel' => 'me', 'class' => 'nickname url uid'),
$this->profile->nickname);
$this->elementEnd('dd');
$this->elementEnd('dl');
$this->elementStart('li', array('id' => 'profile_subscribe')); if ($this->profile->fullname) {
$this->elementStart('dl', 'user_fn');
$this->element('dt', null, _('Full name'));
$this->elementStart('dd');
$this->element('span', 'fn', $this->profile->fullname);
$this->elementEnd('dd');
$this->elementEnd('dl');
}
if ($this->profile->location) {
$this->elementStart('dl', 'user_location');
$this->element('dt', null, _('Location'));
$this->element('dd', 'location', $this->profile->location);
$this->elementEnd('dl');
}
if ($this->profile->homepage) {
$this->elementStart('dl', 'user_url');
$this->element('dt', null, _('URL'));
$this->elementStart('dd');
$this->element('a', array('href' => $this->profile->homepage,
'rel' => 'me', 'class' => 'url'),
$this->profile->homepage);
$this->elementEnd('dd');
$this->elementEnd('dl');
}
if ($this->profile->bio) {
$this->elementStart('dl', 'user_note');
$this->element('dt', null, _('Note'));
$this->element('dd', 'note', $this->profile->bio);
$this->elementEnd('dl');
}
$tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
if (count($tags) > 0) {
$this->elementStart('dl', 'user_tags');
$this->element('dt', null, _('Tags'));
$this->elementStart('dd', 'tags');
$this->elementStart('ul', 'tags xoxo');
foreach ($tags as $tag) {
$this->elementStart('li');
$this->element('span', 'mark_hash', '#');
$this->element('a', array('rel' => 'tag',
'href' => common_local_url('peopletag',
array('tag' => $tag))),
$tag);
$this->elementEnd('li');
}
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementEnd('dl');
}
$this->elementEnd('div');
$this->elementStart('div', array('id' => 'user_actions'));
$this->element('h2', null, _('User actions'));
$this->elementStart('ul');
$this->elementStart('li', array('id' => 'user_subscribe'));
$cur = common_current_user(); $cur = common_current_user();
if ($cur) { if ($cur) {
if ($cur->id != $this->profile->id) { if ($cur->id != $this->profile->id) {
@ -252,7 +328,7 @@ 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' => 'profile_block')); $this->elementStart('li', array('id' => 'user_block'));
if ($blocked) { if ($blocked) {
$bf = new BlockForm($this, $this->profile); $bf = new BlockForm($this, $this->profile);
$bf->show(); $bf->show();
@ -262,35 +338,7 @@ class ShowstreamAction extends Action
} }
$this->elementEnd('li'); $this->elementEnd('li');
} }
$this->elementEnd('ul'); $this->elementEnd('ul');
$this->elementEnd('div');
$this->elementStart('div', array('id' => 'profile_information'));
if ($this->profile->fullname) {
$this->element('h1', array('class' => 'fn'), $this->profile->fullname . ' (' . $this->profile->nickname . ')');
} else {
$this->element('h1', array('class' => 'fn nickname'), $this->profile->nickname);
}
if ($this->profile->location) {
$this->element('p', 'location', $this->profile->location);
}
if ($this->profile->bio) {
$this->element('p', 'description note', $this->profile->bio);
}
if ($this->profile->homepage) {
$this->elementStart('p', 'website');
$this->element('a', array('href' => $this->profile->homepage,
'rel' => 'me', 'class' => 'url'),
$this->profile->homepage);
$this->elementEnd('p');
}
$this->elementEnd('div');
$this->elementEnd('div'); $this->elementEnd('div');
} }
@ -334,14 +382,14 @@ class ShowstreamAction extends Action
$subs_count = $subs->find(); $subs_count = $subs->find();
$this->elementStart('div', array('id' => '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 ($subs_count > 0) {
$this->elementStart('ul', array('id' => 'subscriptions_avatars')); $this->elementStart('ul', 'users');
for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) { for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
@ -363,15 +411,16 @@ class ShowstreamAction extends Action
$other->nickname, $other->nickname,
'href' => $other->profileurl, 'href' => $other->profileurl,
'rel' => 'contact', 'rel' => 'contact',
'class' => 'subscription fn url')); 'class' => 'url'));
$avatar = $other->getAvatar(AVATAR_MINI_SIZE); $avatar = $other->getAvatar(AVATAR_MINI_SIZE);
$this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)), $this->element('img', array('src' => (($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_MINI_SIZE)),
'width' => AVATAR_MINI_SIZE, 'width' => AVATAR_MINI_SIZE,
'height' => AVATAR_MINI_SIZE, 'height' => AVATAR_MINI_SIZE,
'class' => 'avatar mini photo', 'class' => 'avatar photo',
'alt' => ($other->fullname) ? 'alt' => ($other->fullname) ?
$other->fullname : $other->fullname :
$other->nickname)); $other->nickname));
$this->element('span', 'fn nickname', $other->nickname);
$this->elementEnd('a'); $this->elementEnd('a');
$this->elementEnd('li'); $this->elementEnd('li');
} }
@ -380,11 +429,11 @@ class ShowstreamAction extends Action
} }
if ($subs_count > SUBSCRIPTIONS) { if ($subs_count > SUBSCRIPTIONS) {
$this->elementStart('p', array('id' => 'subscriptions_viewall')); $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' => 'moresubscriptions'), 'class' => 'mores'),
_('All subscriptions')); _('All subscriptions'));
$this->elementEnd('p'); $this->elementEnd('p');
} }
@ -394,7 +443,6 @@ class ShowstreamAction extends Action
function showStatistics() function showStatistics()
{ {
// XXX: WORM cache this // XXX: WORM cache this
$subs = new Subscription(); $subs = new Subscription();
$subs->subscriber = $this->profile->id; $subs->subscriber = $this->profile->id;
@ -408,48 +456,39 @@ class ShowstreamAction extends Action
$notices->profile_id = $this->profile->id; $notices->profile_id = $this->profile->id;
$notice_count = (int) $notices->count(); $notice_count = (int) $notices->count();
$this->elementStart('div', array('id' => 'statistics', $this->elementStart('div', array('id' => 'user_statistics',
'class' => 'section')); 'class' => 'section'));
$this->element('h2', 'statistics', _('Statistics')); $this->element('h2', null, _('Statistics'));
// Other stats...? // Other stats...?
$this->elementStart('dl', 'statistics'); $this->elementStart('dl', 'user_member-since');
$this->element('dt', 'membersince', _('Member since')); $this->element('dt', null, _('Member since'));
$this->element('dd', 'membersince', date('j M Y', $this->element('dd', null, date('j M Y',
strtotime($this->profile->created))); strtotime($this->profile->created)));
$this->elementEnd('dl');
$this->elementStart('dt', 'subscriptions'); $this->elementStart('dl', 'user_subscriptions');
$this->elementStart('dt');
$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))),
_('Subscriptions')); _('Subscriptions'));
$this->elementEnd('dt'); $this->elementEnd('dt');
$this->element('dd', 'subscriptions', (is_int($subs_count)) ? $subs_count : '0'); $this->element('dd', null, (is_int($subs_count)) ? $subs_count : '0');
$this->elementStart('dt', 'subscribers'); $this->elementEnd('dl');
$this->elementStart('dl', 'user_subscribers');
$this->elementStart('dt');
$this->element('a', array('href' => common_local_url('subscribers', $this->element('a', array('href' => common_local_url('subscribers',
array('nickname' => $this->profile->nickname))), array('nickname' => $this->profile->nickname))),
_('Subscribers')); _('Subscribers'));
$this->elementEnd('dt'); $this->elementEnd('dt');
$this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0'); $this->element('dd', 'subscribers', (is_int($subbed_count)) ? $subbed_count : '0');
$this->element('dt', 'notices', _('Notices')); $this->elementEnd('dl');
$this->element('dd', 'notices', (is_int($notice_count)) ? $notice_count : '0');
// XXX: link these to something
$this->element('dt', 'tags', _('Tags'));
$this->elementStart('dd', 'tags');
$tags = Profile_tag::getTags($this->profile->id, $this->profile->id);
$this->elementStart('ul', 'tags xoxo');
foreach ($tags as $tag) {
$this->elementStart('li');
$this->element('a', array('rel' => 'bookmark tag',
'href' => common_local_url('peopletag',
array('tag' => $tag))),
$tag);
$this->elementEnd('li');
}
$this->elementEnd('ul');
$this->elementEnd('dd');
$this->elementStart('dl', 'user_notices');
$this->element('dt', null, _('Notices'));
$this->element('dd', null, (is_int($notice_count)) ? $notice_count : '0');
$this->elementEnd('dl'); $this->elementEnd('dl');
$this->elementEnd('div'); $this->elementEnd('div');

View File

@ -68,7 +68,7 @@ class ProfileList extends Widget
function show() function show()
{ {
$this->out->elementStart('ul', array('id' => 'profiles', 'class' => 'profile_list')); $this->out->elementStart('ul', 'profiles');
$cnt = 0; $cnt = 0;
@ -87,51 +87,40 @@ class ProfileList extends Widget
function showProfile() function showProfile()
{ {
$this->out->elementStart('li', array('class' => 'profile_single', $this->out->elementStart('li', array('class' => 'profile vcard',
'id' => 'profile-' . $this->profile->id)); 'id' => 'profile-' . $this->profile->id));
$user = common_current_user(); $user = common_current_user();
if ($user && $user->id != $this->profile->id) {
# XXX: special-case for user looking at own $this->out->elementStart('div', array('id' => 'user_profile',
# subscriptions page 'class' => 'vcard'));
if ($user->isSubscribed($this->profile)) {
$usf = new UnsubscribeForm($this->out, $this->profile);
$usf->show();
} else {
$sf = new SubscribeForm($this->out, $this->profile);
$sf->show();
}
}
$avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE);
$this->out->elementStart('a', array('href' => $this->profile->profileurl)); $this->out->elementStart('a', array('href' => $this->profile->profileurl,
'class' => 'url'));
$this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), $this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE),
'class' => 'avatar stream', 'class' => 'photo avatar',
'width' => AVATAR_STREAM_SIZE, 'width' => AVATAR_STREAM_SIZE,
'height' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE,
'alt' => 'alt' =>
($this->profile->fullname) ? $this->profile->fullname : ($this->profile->fullname) ? $this->profile->fullname :
$this->profile->nickname)); $this->profile->nickname));
$this->out->elementEnd('a'); $this->out->elementStart('span', 'nickname');
$this->out->elementStart('p');
$this->out->elementStart('a', array('href' => $this->profile->profileurl,
'class' => 'nickname'));
$this->out->raw($this->highlight($this->profile->nickname)); $this->out->raw($this->highlight($this->profile->nickname));
$this->out->elementEnd('span');
$this->out->elementEnd('a'); $this->out->elementEnd('a');
if ($this->profile->fullname) { if ($this->profile->fullname) {
$this->out->text(' | '); $this->out->elementStart('span', 'fn');
$this->out->elementStart('span', 'fullname');
$this->out->raw($this->highlight($this->profile->fullname)); $this->out->raw($this->highlight($this->profile->fullname));
$this->out->elementEnd('span'); $this->out->elementEnd('span');
} }
if ($this->profile->location) { if ($this->profile->location) {
$this->out->text(' | ');
$this->out->elementStart('span', 'location'); $this->out->elementStart('span', 'location');
$this->out->raw($this->highlight($this->profile->location)); $this->out->raw($this->highlight($this->profile->location));
$this->out->elementEnd('span'); $this->out->elementEnd('span');
} }
$this->out->elementEnd('p');
if ($this->profile->homepage) { if ($this->profile->homepage) {
$this->out->elementStart('p', 'website'); $this->out->elementStart('p', 'website');
$this->out->elementStart('a', array('href' => $this->profile->homepage)); $this->out->elementStart('a', array('href' => $this->profile->homepage));
@ -188,6 +177,20 @@ class ProfileList extends Widget
$this->showOwnerControls($this->profile); $this->showOwnerControls($this->profile);
} }
$this->out->elementEnd('div');
if ($user && $user->id != $this->profile->id) {
# XXX: special-case for user looking at own
# subscriptions page
if ($user->isSubscribed($this->profile)) {
$usf = new UnsubscribeForm($this->out, $this->profile);
$usf->show();
} else {
$sf = new SubscribeForm($this->out, $this->profile);
$sf->show();
}
}
$this->out->elementEnd('li'); $this->out->elementEnd('li');
} }

View File

@ -80,6 +80,19 @@ class SubscribeForm extends Form
return 'subscribe-' . $this->profile->id; return 'subscribe-' . $this->profile->id;
} }
/**
* class of the form
*
* @return string of the form class
*/
function formClass()
{
return 'form_subscribe';
}
/** /**
* Action of the form * Action of the form
* *

View File

@ -80,6 +80,18 @@ class UnsubscribeForm extends Form
return 'unsubscribe-' . $this->profile->id; return 'unsubscribe-' . $this->profile->id;
} }
/**
* class of the form
*
* @return string of the form class
*/
function formClass()
{
return 'form_unsubscribe';
}
/** /**
* Action of the form * Action of the form
* *

View File

@ -489,7 +489,7 @@ margin-bottom:0;
/* user_profile */ /* user_profile */
#user_profile { #user_profile {
position:relative; position:relative;
width:633px; width:475px;
min-height:123px; min-height:123px;
float:left; float:left;
margin-bottom:17px; margin-bottom:17px;
@ -514,7 +514,7 @@ width:96px;
#user_profile .user_tags { #user_profile .user_tags {
float:left; float:left;
clear:left; clear:left;
margin-left:125px; margin-left:113px;
width:322px; width:322px;
margin-bottom:4px; margin-bottom:4px;
} }
@ -524,21 +524,24 @@ margin-bottom:4px;
width:auto; width:auto;
clear:none; clear:none;
} }
#user_profile .user_nickname { #user_profile .user_fn {
margin-left:11px; margin-left:11px;
margin-left:4px;
margin-right:4px;
font-weight:bold;
} }
#user_profile .user_nickname .nickname { #user_profile .user_nickname .nickname {
font-style:italic; font-style:italic;
font-weight:bold; font-weight:bold;
margin-left:4px;
margin-right:4px;
} }
#user_profile .user_nickname dd:before { #user_profile .user_fn dd:before {
content: "("; content: "(";
font-weight:normal;
} }
#user_profile .user_nickname dd:after { #user_profile .user_fn dd:after {
content: ")"; content: ")";
font-weight:normal;
} }
#user_profile dt { #user_profile dt {