Merge branch '1.0.x' into testing
This commit is contained in:
commit
9dfa406493
|
@ -111,31 +111,51 @@ class Profile extends Managed_DataObject
|
|||
$height = $width;
|
||||
}
|
||||
|
||||
if (!isset($this->_avatars)) {
|
||||
$this->_avatars = array();
|
||||
}
|
||||
$avatar = $this->_getAvatar($width);
|
||||
|
||||
if (array_key_exists($width, $this->_avatars)) {
|
||||
return $this->_avatars[$width];
|
||||
}
|
||||
|
||||
$avatar = null;
|
||||
if (empty($avatar)) {
|
||||
|
||||
if (Event::handle('StartProfileGetAvatar', array($this, $width, &$avatar))) {
|
||||
$avatar = Avatar::pkeyGet(array('profile_id' => $this->id,
|
||||
$avatar = Avatar::pkeyGet(
|
||||
array(
|
||||
'profile_id' => $this->id,
|
||||
'width' => $width,
|
||||
'height' => $height));
|
||||
'height' => $height
|
||||
)
|
||||
);
|
||||
Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar));
|
||||
}
|
||||
|
||||
$this->_avatars[$width] = $avatar;
|
||||
$this->_fillAvatar($width, $avatar);
|
||||
}
|
||||
|
||||
return $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()
|
||||
|
@ -1454,4 +1474,8 @@ class Profile extends Managed_DataObject
|
|||
{
|
||||
return $this;
|
||||
}
|
||||
|
||||
static function pivotGet($key, $values, $otherCols=array()) {
|
||||
return Memcached_DataObject::pivotGet('Profile', $key, $values, $otherCols);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -14,3 +14,26 @@
|
|||
/* add padding to account for vertical scrollbar */
|
||||
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 {
|
||||
display:inline;
|
||||
}
|
||||
li.rsvp-list .entities li {
|
||||
list-style-type: none;
|
||||
margin-right: 3px;
|
||||
margin-bottom: 8px;
|
||||
display: inline;
|
||||
}
|
||||
li.rsvp-list .entities li .photo {
|
||||
margin: 0 !important;
|
||||
float: none !important;
|
||||
}
|
||||
li.rsvp-list .entities li .fn {
|
||||
display: none;
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue
Block a user