forked from GNUsocial/gnu-social
		
	Merge branch '1.0.x' into testing
This commit is contained in:
		@@ -111,31 +111,51 @@ class Profile extends Managed_DataObject
 | 
				
			|||||||
            $height = $width;
 | 
					            $height = $width;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!isset($this->_avatars)) {
 | 
					        $avatar = $this->_getAvatar($width);
 | 
				
			||||||
            $this->_avatars = array();
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if (array_key_exists($width, $this->_avatars)) {
 | 
					        if (empty($avatar)) {
 | 
				
			||||||
			return $this->_avatars[$width];
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		
 | 
					 | 
				
			||||||
        $avatar = null;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (Event::handle('StartProfileGetAvatar', array($this, $width, &$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,
 | 
					                        'width'      => $width,
 | 
				
			||||||
                                            'height' => $height));
 | 
					                        'height'     => $height
 | 
				
			||||||
 | 
					                    )
 | 
				
			||||||
 | 
					                );
 | 
				
			||||||
                Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar));
 | 
					                Event::handle('EndProfileGetAvatar', array($this, $width, &$avatar));
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		$this->_avatars[$width] = $avatar;
 | 
					            $this->_fillAvatar($width, $avatar);
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return $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)
 | 
					    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;
 | 
					        $this->_avatars[$width] = $avatar;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function getOriginalAvatar()
 | 
					    function getOriginalAvatar()
 | 
				
			||||||
@@ -1454,4 +1474,8 @@ class Profile extends Managed_DataObject
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
        return $this;
 | 
					        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()
 | 
					    function showHomepage()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        $homepage = $this->homepage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!empty($homepage)) {
 | 
					        if (!empty($homepage)) {
 | 
				
			||||||
            $this->out->element('a', 'profile_block_homepage', $homepage);
 | 
					            $this->out->element('a', 'profile_block_homepage', $homepage);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -14,3 +14,26 @@
 | 
				
			|||||||
    /* add padding to account for vertical scrollbar */
 | 
					    /* add padding to account for vertical scrollbar */
 | 
				
			||||||
    padding-right: 20px;
 | 
					    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');
 | 
					        $out->elementStart('div', 'event-rsvps');
 | 
				
			||||||
        // TRANS: Field label for event description.
 | 
					        // TRANS: Field label for event description.
 | 
				
			||||||
        $out->element('strong', null, _m('Attending:'));
 | 
					
 | 
				
			||||||
        $out->element('span', 'event-rsvps',
 | 
					        $out->text(_('Attending:'));
 | 
				
			||||||
                      // TRANS: RSVP counts.
 | 
					        $out->elementStart('ul', 'attending-list');
 | 
				
			||||||
                      // TRANS: %1$d, %2$d and %3$d are numbers of RSVPs.
 | 
					
 | 
				
			||||||
                      sprintf(_m('Yes: %1$d No: %2$d Maybe: %3$d'),
 | 
					        foreach ($rsvps as $verb => $responses) {
 | 
				
			||||||
                              count($rsvps[RSVP::POSITIVE]),
 | 
					            $out->elementStart('li', 'rsvp-list');
 | 
				
			||||||
                              count($rsvps[RSVP::NEGATIVE]),
 | 
					            switch ($verb)
 | 
				
			||||||
                              count($rsvps[RSVP::POSSIBLE])));
 | 
					            {
 | 
				
			||||||
 | 
					            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');
 | 
					        $out->elementEnd('div');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        $user = common_current_user();
 | 
					        $user = common_current_user();
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user