From b39474935a0e0d58bd4d09cbca979b82b981eed7 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Jan 2009 17:48:53 +0000 Subject: Update profile list for new framework --- lib/profilelist.php | 149 +++++++++++++++++++++++++++++++--------------------- 1 file changed, 90 insertions(+), 59 deletions(-) (limited to 'lib/profilelist.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index bda05daf3..0dbc7f215 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -1,10 +1,13 @@ . + * + * @category Public + * @package Laconica + * @author Evan Prodromou + * @copyright 2008-2009 Control Yourself, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ */ -if (!defined('LACONICA')) { exit(1); } +if (!defined('LACONICA')) { + exit(1); +} + +require_once INSTALLDIR.'/lib/widget.php'; define('PROFILES_PER_PAGE', 20); -class ProfileList -{ +/** + * Widget to show a list of profiles + * + * @category Public + * @package Laconica + * @author Zach Copley + * @author Evan Prodromou + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://laconi.ca/ + */ +class ProfileList extends Widget +{ + /** Current profile, profile query. */ var $profile = null; + /** Owner of this list */ var $owner = null; + /** Action object using us. */ var $action = null; function __construct($profile, $owner=null, $action=null) { + parent::__construct($action); + $this->profile = $profile; $this->owner = $owner; $this->action = $action; } - function show_list() + function show() { - common_element_start('ul', array('id' => 'profiles', 'class' => 'profile_list')); + $this->out->elementStart('ul', array('id' => 'profiles', 'class' => 'profile_list')); $cnt = 0; @@ -48,18 +77,18 @@ class ProfileList if($cnt > PROFILES_PER_PAGE) { break; } - $this->show(); + $this->showProfile(); } - common_element_end('ul'); + $this->out->elementEnd('ul'); return $cnt; } - function show() + function showProfile() { - common_element_start('li', array('class' => 'profile_single', + $this->out->elementStart('li', array('class' => 'profile_single', 'id' => 'profile-' . $this->profile->id)); $user = common_current_user(); @@ -68,51 +97,53 @@ class ProfileList # XXX: special-case for user looking at own # subscriptions page if ($user->isSubscribed($this->profile)) { - common_unsubscribe_form($this->profile); + $usf = new UnsubscribeForm($this->out, $this->profile); + $usf->show(); } else { - common_subscribe_form($this->profile); + $sf = new SubscribeForm($this->out, $this->profile); + $sf->show(); } } $avatar = $this->profile->getAvatar(AVATAR_STREAM_SIZE); - common_element_start('a', array('href' => $this->profile->profileurl)); - common_element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), + $this->out->elementStart('a', array('href' => $this->profile->profileurl)); + $this->out->element('img', array('src' => ($avatar) ? common_avatar_display_url($avatar) : common_default_avatar(AVATAR_STREAM_SIZE), 'class' => 'avatar stream', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => ($this->profile->fullname) ? $this->profile->fullname : $this->profile->nickname)); - common_element_end('a'); - common_element_start('p'); - common_element_start('a', array('href' => $this->profile->profileurl, + $this->out->elementEnd('a'); + $this->out->elementStart('p'); + $this->out->elementStart('a', array('href' => $this->profile->profileurl, 'class' => 'nickname')); - common_raw($this->highlight($this->profile->nickname)); - common_element_end('a'); + $this->out->raw($this->highlight($this->profile->nickname)); + $this->out->elementEnd('a'); if ($this->profile->fullname) { - common_text(' | '); - common_element_start('span', 'fullname'); - common_raw($this->highlight($this->profile->fullname)); - common_element_end('span'); + $this->out->text(' | '); + $this->out->elementStart('span', 'fullname'); + $this->out->raw($this->highlight($this->profile->fullname)); + $this->out->elementEnd('span'); } if ($this->profile->location) { - common_text(' | '); - common_element_start('span', 'location'); - common_raw($this->highlight($this->profile->location)); - common_element_end('span'); + $this->out->text(' | '); + $this->out->elementStart('span', 'location'); + $this->out->raw($this->highlight($this->profile->location)); + $this->out->elementEnd('span'); } - common_element_end('p'); + $this->out->elementEnd('p'); if ($this->profile->homepage) { - common_element_start('p', 'website'); - common_element_start('a', array('href' => $this->profile->homepage)); - common_raw($this->highlight($this->profile->homepage)); - common_element_end('a'); - common_element_end('p'); + $this->out->elementStart('p', 'website'); + $this->out->elementStart('a', array('href' => $this->profile->homepage)); + $this->out->raw($this->highlight($this->profile->homepage)); + $this->out->elementEnd('a'); + $this->out->elementEnd('p'); } if ($this->profile->bio) { - common_element_start('p', 'bio'); - common_raw($this->highlight($this->profile->bio)); - common_element_end('p'); + $this->out->elementStart('p', 'bio'); + $this->out->raw($this->highlight($this->profile->bio)); + $this->out->elementEnd('p'); } # If we're on a list with an owner (subscriptions or subscribers)... @@ -121,49 +152,49 @@ class ProfileList # Get tags $tags = Profile_tag::getTags($this->owner->id, $this->profile->id); - common_element_start('div', 'tags_user'); - common_element_start('dl'); - common_element_start('dt'); + $this->out->elementStart('div', 'tags_user'); + $this->out->elementStart('dl'); + $this->out->elementStart('dt'); if ($user->id == $this->owner->id) { - common_element('a', array('href' => common_local_url('tagother', + $this->out->element('a', array('href' => common_local_url('tagother', array('id' => $this->profile->id))), _('Tags')); } else { - common_text(_('Tags')); + $this->out->text(_('Tags')); } - common_text(":"); - common_element_end('dt'); - common_element_start('dd'); + $this->out->text(":"); + $this->out->elementEnd('dt'); + $this->out->elementStart('dd'); if ($tags) { - common_element_start('ul', 'tags xoxo'); + $this->out->elementStart('ul', 'tags xoxo'); foreach ($tags as $tag) { - common_element_start('li'); - common_element('a', array('rel' => 'tag', + $this->out->elementStart('li'); + $this->out->element('a', array('rel' => 'tag', 'href' => common_local_url($this->action, array('nickname' => $this->owner->nickname, 'tag' => $tag))), $tag); - common_element_end('li'); + $this->out->elementEnd('li'); } - common_element_end('ul'); + $this->out->elementEnd('ul'); } else { - common_text(_('(none)')); + $this->out->text(_('(none)')); } - common_element_end('dd'); - common_element_end('dl'); - common_element_end('div'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); + $this->out->elementEnd('div'); } if ($user && $user->id == $this->owner->id) { - $this->show_owner_controls($this->profile); + $this->showOwnerControls($this->profile); } - common_element_end('li'); + $this->out->elementEnd('li'); } /* Override this in subclasses. */ - function show_owner_controls($profile) + function showOwnerControls($profile) { return; } -- cgit v1.2.3-54-g00ecf From ccf5f58608db6ff6fab43f64782b73c5e4ad4d39 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Mon, 19 Jan 2009 18:09:34 +0000 Subject: Extra whitespace in profilelist --- lib/profilelist.php | 1 - 1 file changed, 1 deletion(-) (limited to 'lib/profilelist.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index 0dbc7f215..fdc71ab8d 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -87,7 +87,6 @@ class ProfileList extends Widget function showProfile() { - $this->out->elementStart('li', array('class' => 'profile_single', 'id' => 'profile-' . $this->profile->id)); -- cgit v1.2.3-54-g00ecf From 77790ab7687c6ef6c86f502c27158ef71cdffa76 Mon Sep 17 00:00:00 2001 From: sarven Date: Mon, 19 Jan 2009 21:56:55 +0000 Subject: Featuerd profile list markup Minor class change to (un)subscribeform.php --- lib/profilelist.php | 53 ++++++++++++++++++++++++++----------------------- lib/subscribeform.php | 15 +++++++++++++- lib/unsubscribeform.php | 14 ++++++++++++- 3 files changed, 55 insertions(+), 27 deletions(-) (limited to 'lib/profilelist.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index fdc71ab8d..24b357385 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -68,7 +68,7 @@ class ProfileList extends Widget function show() { - $this->out->elementStart('ul', array('id' => 'profiles', 'class' => 'profile_list')); + $this->out->elementStart('ul', 'profiles'); $cnt = 0; @@ -87,51 +87,40 @@ class ProfileList extends Widget function showProfile() { - $this->out->elementStart('li', array('class' => 'profile_single', - 'id' => 'profile-' . $this->profile->id)); + $this->out->elementStart('li', array('class' => 'profile vcard', + 'id' => 'profile-' . $this->profile->id)); $user = common_current_user(); - 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->elementStart('div', array('id' => 'user_profile', + 'class' => 'vcard')); $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), - 'class' => 'avatar stream', + 'class' => 'photo avatar', 'width' => AVATAR_STREAM_SIZE, 'height' => AVATAR_STREAM_SIZE, 'alt' => ($this->profile->fullname) ? $this->profile->fullname : $this->profile->nickname)); - $this->out->elementEnd('a'); - $this->out->elementStart('p'); - $this->out->elementStart('a', array('href' => $this->profile->profileurl, - 'class' => 'nickname')); + $this->out->elementStart('span', 'nickname'); $this->out->raw($this->highlight($this->profile->nickname)); + $this->out->elementEnd('span'); $this->out->elementEnd('a'); + if ($this->profile->fullname) { - $this->out->text(' | '); - $this->out->elementStart('span', 'fullname'); + $this->out->elementStart('span', 'fn'); $this->out->raw($this->highlight($this->profile->fullname)); $this->out->elementEnd('span'); } if ($this->profile->location) { - $this->out->text(' | '); $this->out->elementStart('span', 'location'); $this->out->raw($this->highlight($this->profile->location)); $this->out->elementEnd('span'); } - $this->out->elementEnd('p'); if ($this->profile->homepage) { $this->out->elementStart('p', 'website'); $this->out->elementStart('a', array('href' => $this->profile->homepage)); @@ -188,6 +177,20 @@ class ProfileList extends Widget $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'); } @@ -202,4 +205,4 @@ class ProfileList extends Widget { return htmlspecialchars($text); } -} \ No newline at end of file +} diff --git a/lib/subscribeform.php b/lib/subscribeform.php index 996729a28..8b69efd1a 100644 --- a/lib/subscribeform.php +++ b/lib/subscribeform.php @@ -80,6 +80,19 @@ class SubscribeForm extends Form return 'subscribe-' . $this->profile->id; } + + /** + * class of the form + * + * @return string of the form class + */ + + function formClass() + { + return 'form_subscribe'; + } + + /** * Action of the form * @@ -114,4 +127,4 @@ class SubscribeForm extends Form { $this->out->submit('submit', _('Subscribe')); } -} \ No newline at end of file +} diff --git a/lib/unsubscribeform.php b/lib/unsubscribeform.php index a724bb312..b222f0e54 100644 --- a/lib/unsubscribeform.php +++ b/lib/unsubscribeform.php @@ -80,6 +80,18 @@ class UnsubscribeForm extends Form return 'unsubscribe-' . $this->profile->id; } + + /** + * class of the form + * + * @return string of the form class + */ + + function formClass() + { + return 'form_unsubscribe'; + } + /** * Action of the form * @@ -114,4 +126,4 @@ class UnsubscribeForm extends Form { $this->out->submit('submit', _('Unsubscribe')); } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf From 1ab0de3ddd863703648bdaedf92a2ae6cc7eb6ff Mon Sep 17 00:00:00 2001 From: sarven Date: Tue, 20 Jan 2009 23:50:52 +0000 Subject: If user has fn, then it will not link to their own profile with @class 'fn'. Only put @class 'fn' on the anchor if there is no fn. --- actions/showstream.php | 7 ++++--- lib/profilelist.php | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/profilelist.php') diff --git a/actions/showstream.php b/actions/showstream.php index d550ec295..3fe71576d 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -243,9 +243,10 @@ class ShowstreamAction extends Action $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); + $hasFN = ($this->profile->fullname) ? 'nickname url uid' : 'fn nickname url uid'; + $this->element('a', array('href' => $this->profile->profileurl, + 'rel' => 'me', 'class' => $hasFN), + $this->profile->nickname); $this->elementEnd('dd'); $this->elementEnd('dl'); diff --git a/lib/profilelist.php b/lib/profilelist.php index 24b357385..973df7bb6 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -87,7 +87,7 @@ class ProfileList extends Widget function showProfile() { - $this->out->elementStart('li', array('class' => 'profile vcard', + $this->out->elementStart('li', array('class' => 'profile', 'id' => 'profile-' . $this->profile->id)); $user = common_current_user(); -- cgit v1.2.3-54-g00ecf From 96e40e06493148757896c7f6061e9cbb2d8c2ceb Mon Sep 17 00:00:00 2001 From: sarven Date: Wed, 21 Jan 2009 01:10:11 +0000 Subject: profilelist markup and styles --- lib/profilelist.php | 32 ++++++++++++++++++++++++-------- theme/base/css/display.css | 42 ++++++++++++++++++++++++++++++++++++++---- theme/identica/css/display.css | 5 +++-- 3 files changed, 65 insertions(+), 14 deletions(-) (limited to 'lib/profilelist.php') diff --git a/lib/profilelist.php b/lib/profilelist.php index 973df7bb6..b2a9925c1 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -106,32 +106,48 @@ class ProfileList extends Widget 'alt' => ($this->profile->fullname) ? $this->profile->fullname : $this->profile->nickname)); - $this->out->elementStart('span', 'nickname'); + $hasFN = ($this->profile->fullname) ? 'nickname' : 'fn nickname'; + $this->out->elementStart('span', $hasFN); $this->out->raw($this->highlight($this->profile->nickname)); $this->out->elementEnd('span'); $this->out->elementEnd('a'); if ($this->profile->fullname) { + $this->out->elementStart('dl', 'user_fn'); + $this->out->element('dt', null, 'Full name'); + $this->out->elementStart('dd'); $this->out->elementStart('span', 'fn'); $this->out->raw($this->highlight($this->profile->fullname)); $this->out->elementEnd('span'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); } if ($this->profile->location) { - $this->out->elementStart('span', 'location'); + $this->out->elementStart('dl', 'user_location'); + $this->out->element('dt', null, _('Location')); + $this->out->elementStart('dd', 'location'); $this->out->raw($this->highlight($this->profile->location)); - $this->out->elementEnd('span'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); } if ($this->profile->homepage) { - $this->out->elementStart('p', 'website'); - $this->out->elementStart('a', array('href' => $this->profile->homepage)); + $this->out->elementStart('dl', 'user_url'); + $this->out->element('dt', null, _('URL')); + $this->out->elementStart('dd'); + $this->out->elementStart('a', array('href' => $this->profile->homepage, + 'class' => 'url')); $this->out->raw($this->highlight($this->profile->homepage)); $this->out->elementEnd('a'); - $this->out->elementEnd('p'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); } if ($this->profile->bio) { - $this->out->elementStart('p', 'bio'); + $this->out->elementStart('dl', 'user_note'); + $this->out->element('dt', null, _('Note')); + $this->out->elementStart('dd', 'note'); $this->out->raw($this->highlight($this->profile->bio)); - $this->out->elementEnd('p'); + $this->out->elementEnd('dd'); + $this->out->elementEnd('dl'); } # If we're on a list with an owner (subscriptions or subscribers)... diff --git a/theme/base/css/display.css b/theme/base/css/display.css index 61ce2d043..f0bf6bfc1 100644 --- a/theme/base/css/display.css +++ b/theme/base/css/display.css @@ -62,7 +62,9 @@ font-weight:bold; textarea { overflow:auto; } -select, option { +select { +} +option { padding-bottom:0; } fieldset { @@ -526,14 +528,13 @@ clear:none; } #user_profile .user_fn { margin-left:11px; -margin-left:4px; margin-right:4px; } #user_profile .user_fn .fn { font-weight:bold; font-style:normal; } -#user_profile .user_nickname .nickname { +#user_profile .nickname { font-style:italic; font-weight:bold; } @@ -553,8 +554,13 @@ display:none; #user_profile h2 { display:none; } + /* user_profile */ + + + + /*user_actions*/ #user_actions { clear:left; @@ -677,12 +683,40 @@ clear:both; +.profile #user_profile { +margin-bottom:0; +min-height:60px; +} +.profile .form_user_unsubscribe { +float:right; +} +.profiles { +list-style-type:none; +} +.profile #user_profile .user_location { +width:auto; +clear:none; +margin-left:11px; +} +.profile #user_profile dl, +.profile #user_profile dd { +display:inline; +float:none; +} +.profile #user_profile .user_note, +.profile #user_profile .user_url { +margin-left:55px; +clear:none; +display:block; +width:auto; +} /* NOTICE */ -.notice { +.notice, +.profile { position:relative; padding-top:18px; padding-bottom:18px; diff --git a/theme/identica/css/display.css b/theme/identica/css/display.css index eb5f78b9e..e3b5310f7 100644 --- a/theme/identica/css/display.css +++ b/theme/identica/css/display.css @@ -39,7 +39,9 @@ color:#fff; } a, -div.notice-options input { +div.notice-options input, +.form_user_block input.submit, +.form_user_unblock input.submit { color:#002E6E; } @@ -155,7 +157,6 @@ background-image:url(../images/icons/twotone/green/mail.gif); .form_user_block input.submit, .form_user_unblock input.submit { background-image:url(../images/icons/twotone/green/shield.gif); -color:#000; } -- cgit v1.2.3-54-g00ecf From f51984175a7f14d9fdc07a7ef4434bb06acf5d34 Mon Sep 17 00:00:00 2001 From: sarven Date: Wed, 21 Jan 2009 01:22:08 +0000 Subject: Matching markup for tags --- actions/showstream.php | 2 +- lib/profilelist.php | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) (limited to 'lib/profilelist.php') diff --git a/actions/showstream.php b/actions/showstream.php index 3fe71576d..3882af845 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -288,7 +288,7 @@ class ShowstreamAction extends Action if (count($tags) > 0) { $this->elementStart('dl', 'user_tags'); $this->element('dt', null, _('Tags')); - $this->elementStart('dd', 'tags'); + $this->elementStart('dd'); $this->elementStart('ul', 'tags xoxo'); foreach ($tags as $tag) { $this->elementStart('li'); diff --git a/lib/profilelist.php b/lib/profilelist.php index b2a9925c1..f7ed5d19c 100644 --- a/lib/profilelist.php +++ b/lib/profilelist.php @@ -156,8 +156,7 @@ class ProfileList extends Widget # Get tags $tags = Profile_tag::getTags($this->owner->id, $this->profile->id); - $this->out->elementStart('div', 'tags_user'); - $this->out->elementStart('dl'); + $this->out->elementStart('dl', 'user_tags'); $this->out->elementStart('dt'); if ($user->id == $this->owner->id) { $this->out->element('a', array('href' => common_local_url('tagother', @@ -166,13 +165,13 @@ class ProfileList extends Widget } else { $this->out->text(_('Tags')); } - $this->out->text(":"); $this->out->elementEnd('dt'); $this->out->elementStart('dd'); if ($tags) { $this->out->elementStart('ul', 'tags xoxo'); foreach ($tags as $tag) { $this->out->elementStart('li'); + $this->element('span', 'mark_hash', '#'); $this->out->element('a', array('rel' => 'tag', 'href' => common_local_url($this->action, array('nickname' => $this->owner->nickname, @@ -186,7 +185,6 @@ class ProfileList extends Widget } $this->out->elementEnd('dd'); $this->out->elementEnd('dl'); - $this->out->elementEnd('div'); } if ($user && $user->id == $this->owner->id) { -- cgit v1.2.3-54-g00ecf