From 699a90f11ce5f066a5210610db22ef0a7756a546 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Thu, 29 Sep 2011 15:12:30 -0400 Subject: [PATCH 1/5] Show Event attendees in mini-list --- classes/Profile.php | 4 ++++ plugins/Event/event.css | 21 ++++++++++++++++- plugins/Event/eventlistitem.php | 41 ++++++++++++++++++++++++++------- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index f983225fd5..7ccfa72166 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -1454,4 +1454,8 @@ class Profile extends Managed_DataObject { return $this; } + + static function pivotGet($key, $values, $otherCols=array()) { + return Memcached_DataObject::pivotGet('Profile', $key, $values, $otherCols); + } } diff --git a/plugins/Event/event.css b/plugins/Event/event.css index 7fbb67d732..3cad53c590 100644 --- a/plugins/Event/event.css +++ b/plugins/Event/event.css @@ -13,4 +13,23 @@ overflow-x: hidden; /* add padding to account for vertical scrollbar */ padding-right: 20px; -} \ No newline at end of file +} + +li.rsvp-list ul.entities { + float:left; + width:100%; + display:inline; +} +li.rsvp-list .entities li { + list-style-type: none; + float: left; + margin-right: 3px; + margin-bottom: 8px; + display: inline; +} +li.rsvp-list .entities li .photo { + margin: 0; +} +li.rsvp-list .entities li .fn { + display: none; +} diff --git a/plugins/Event/eventlistitem.php b/plugins/Event/eventlistitem.php index fb27704461..2f0710f01f 100644 --- a/plugins/Event/eventlistitem.php +++ b/plugins/Event/eventlistitem.php @@ -152,14 +152,39 @@ class EventListItem extends NoticeListItemAdapter $out->elementStart('div', 'event-rsvps'); // TRANS: Field label for event description. - $out->element('strong', null, _m('Attending:')); - $out->element('span', 'event-rsvps', - // TRANS: RSVP counts. - // TRANS: %1$d, %2$d and %3$d are numbers of RSVPs. - sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'), - count($rsvps[RSVP::POSITIVE]), - count($rsvps[RSVP::NEGATIVE]), - count($rsvps[RSVP::POSSIBLE]))); + + $out->text(_('Attending:')); + $out->elementStart('ul', 'attending-list'); + + foreach ($rsvps as $verb => $responses) { + $out->elementStart('li', 'rsvp-list'); + switch ($verb) + { + case RSVP::POSITIVE: + $out->text(_('Yes:')); + break; + case RSVP::NEGATIVE: + $out->text(_('No:')); + break; + case RSVP::POSSIBLE: + $out->text(_('Maybe:')); + break; + } + $ids = array(); + foreach ($responses as $response) { + $ids[] = $response->profile_id; + } + common_debug("IDS = " . implode(',', $ids)); + $profiles = Profile::pivotGet('id', $ids); + common_debug("Profiles = " . print_r($profiles, true)); + $profile = new ArrayWrapper(array_values($profiles)); + $minilist = new ProfileMiniList($profile, $out); + $minilist->show(); + + $out->elementEnd('li'); + } + + $out->elementEnd('ul'); $out->elementEnd('div'); $user = common_current_user(); From d51a93ddb9759faeffd7bdd11b28d20541968481 Mon Sep 17 00:00:00 2001 From: Samantha Doherty Date: Thu, 29 Sep 2011 16:00:10 -0400 Subject: [PATCH 2/5] Quick style for event attendee avatar lists. --- plugins/Event/event.css | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/plugins/Event/event.css b/plugins/Event/event.css index 3cad53c590..e5af5cf515 100644 --- a/plugins/Event/event.css +++ b/plugins/Event/event.css @@ -15,20 +15,24 @@ padding-right: 20px; } +.attending-list { list-style-type: none; float: left; width: 100%; } + +#form_event_rsvp { clear: left; } + +li.rsvp-list { float: left; clear: left; } + li.rsvp-list ul.entities { - float:left; - width:100%; display:inline; } li.rsvp-list .entities li { list-style-type: none; - float: left; margin-right: 3px; margin-bottom: 8px; display: inline; } li.rsvp-list .entities li .photo { - margin: 0; + margin: 0 !important; + float: none !important; } li.rsvp-list .entities li .fn { display: none; From d438a55434213058ffe4a648844b1182391a3699 Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 29 Sep 2011 07:58:52 +0000 Subject: [PATCH 3/5] Fix navigation for SubMirrorPlugin --- plugins/SubMirror/SubMirrorPlugin.php | 7 ++++--- plugins/SubMirror/actions/mirrorsettings.php | 11 +++++++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/plugins/SubMirror/SubMirrorPlugin.php b/plugins/SubMirror/SubMirrorPlugin.php index ccb32b4a49..95fccabe9d 100644 --- a/plugins/SubMirror/SubMirrorPlugin.php +++ b/plugins/SubMirror/SubMirrorPlugin.php @@ -99,15 +99,16 @@ class SubMirrorPlugin extends Plugin /** * Menu item for personal subscriptions/groups area * - * @param Widget $widget Widget being executed + * @param Action $action action being executed * * @return boolean hook return */ - function onEndSubGroupNav($widget) + function onEndAccountSettingsNav($action) { - $action = $widget->out; $action_name = $action->trimmed('action'); + common_debug("ACTION NAME = " . $action_name); + $action->menuItem(common_local_url('mirrorsettings'), // TRANS: SubMirror plugin menu item on user settings page. _m('MENU', 'Mirroring'), diff --git a/plugins/SubMirror/actions/mirrorsettings.php b/plugins/SubMirror/actions/mirrorsettings.php index 2db7504a64..000d7ecad0 100644 --- a/plugins/SubMirror/actions/mirrorsettings.php +++ b/plugins/SubMirror/actions/mirrorsettings.php @@ -153,10 +153,17 @@ class MirrorSettingsAction extends SettingsAction { } + /** + * Show the local navigation menu + * + * This is the same for all settings, so we show it here. + * + * @return void + */ function showLocalNav() { - $nav = new SubGroupNav($this, common_current_user()); - $nav->show(); + $menu = new SettingsNav($this); + $menu->show(); } function showScripts() From 51b7af41d47cce5d66affcf79ee091b97d9b6b2c Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Thu, 29 Sep 2011 20:26:01 +0000 Subject: [PATCH 4/5] Show homepage on profile --- lib/profileblock.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/profileblock.php b/lib/profileblock.php index 432df0da5a..4e5539496a 100644 --- a/lib/profileblock.php +++ b/lib/profileblock.php @@ -122,6 +122,8 @@ abstract class ProfileBlock extends Widget function showHomepage() { + $homepage = $this->homepage(); + if (!empty($homepage)) { $this->out->element('a', 'profile_block_homepage', $homepage); } From ba4bda9beb8b51eb53c47ac32e435179cb9eecde Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Fri, 30 Sep 2011 00:56:24 +0000 Subject: [PATCH 5/5] Fix display of group admin avatars --- classes/Profile.php | 68 +++++++++++++++++++++++++++++---------------- 1 file changed, 44 insertions(+), 24 deletions(-) diff --git a/classes/Profile.php b/classes/Profile.php index 7ccfa72166..938c5357c2 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -103,41 +103,61 @@ class Profile extends Managed_DataObject return $this->_user; } - protected $_avatars; - + protected $_avatars; + function getAvatar($width, $height=null) { if (is_null($height)) { $height = $width; } - if (!isset($this->_avatars)) { - $this->_avatars = array(); + $avatar = $this->_getAvatar($width); + + if (empty($avatar)) { + + if (Event::handle('StartProfileGetAvatar', array($this, $width, &$avatar))) { + $avatar = Avatar::pkeyGet( + array( + 'profile_id' => $this->id, + 'width' => $width, + 'height' => $height + ) + ); + Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar)); + } + + $this->_fillAvatar($width, $avatar); } - if (array_key_exists($width, $this->_avatars)) { - return $this->_avatars[$width]; - } - - $avatar = null; - - if (Event::handle('StartProfileGetAvatar', array($this, $width, &$avatar))) { - $avatar = Avatar::pkeyGet(array('profile_id' => $this->id, - 'width' => $width, - 'height' => $height)); - Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar)); - } - - $this->_avatars[$width] = $avatar; - return $avatar; } - function _fillAvatar($width, $avatar) - { - $this->_avatars[$width] = $avatar; - } - + // XXX: @Fix me gargargar + function _getAvatar($width) + { + if (empty($this->_avatars)) { + $this->_avatars = array(); + } + + // GAR! I cannot figure out where _avatars gets pre-filled with the avatar from + // the previously used profile! Please shoot me now! --Zach + if (array_key_exists($width, $this->_avatars)) { + // Don't return cached avatar unless it's really for this profile + if ($this->_avatars[$width]->profile_id == $this->id) { + return $this->_avatars[$width]; + } + } + + return null; + } + + function _fillAvatar($width, $avatar) + { + //common_debug("Storing avatar of width: {$avatar->width} and profile_id {$avatar->profile_id} in profile {$this->id}."); + $this->_avatars[$width] = $avatar; + + } + function getOriginalAvatar() { $avatar = DB_DataObject::factory('avatar');