forked from GNUsocial/gnu-social
New Events for avatar settings
This commit is contained in:
parent
83830c26e7
commit
4db184e5b4
12
EVENTS.txt
12
EVENTS.txt
@ -290,6 +290,18 @@ StartRegistrationTry: before validating and saving a new user
|
|||||||
EndRegistrationTry: after saving a new user (note: no profile or user object!)
|
EndRegistrationTry: after saving a new user (note: no profile or user object!)
|
||||||
- $action: action object being shown
|
- $action: action object being shown
|
||||||
|
|
||||||
|
StartAvatarFormData: before displaying avatar form
|
||||||
|
- $action: action object being shown
|
||||||
|
|
||||||
|
EndAvatarFormData: after displaying avatar form
|
||||||
|
- $action: action object being shown
|
||||||
|
|
||||||
|
StartAvatarSaveForm: before saving the avatar
|
||||||
|
- $action: action object being shown
|
||||||
|
|
||||||
|
EndAvatarSaveForm: after saving the avatar
|
||||||
|
- $action: action object being shown
|
||||||
|
|
||||||
StartNewQueueManager: before trying to start a new queue manager; good for plugins implementing new queue manager classes
|
StartNewQueueManager: before trying to start a new queue manager; good for plugins implementing new queue manager classes
|
||||||
- $qm: empty queue manager to set
|
- $qm: empty queue manager to set
|
||||||
|
|
||||||
|
@ -119,52 +119,55 @@ class AvatarsettingsAction extends AccountSettingsAction
|
|||||||
$this->element('legend', null, _('Avatar settings'));
|
$this->element('legend', null, _('Avatar settings'));
|
||||||
$this->hidden('token', common_session_token());
|
$this->hidden('token', common_session_token());
|
||||||
|
|
||||||
$this->elementStart('ul', 'form_data');
|
if (Event::handle('StartAvatarFormData', array($this))) {
|
||||||
if ($original) {
|
$this->elementStart('ul', 'form_data');
|
||||||
$this->elementStart('li', array('id' => 'avatar_original',
|
if ($original) {
|
||||||
'class' => 'avatar_view'));
|
$this->elementStart('li', array('id' => 'avatar_original',
|
||||||
$this->element('h2', null, _("Original"));
|
'class' => 'avatar_view'));
|
||||||
$this->elementStart('div', array('id'=>'avatar_original_view'));
|
$this->element('h2', null, _("Original"));
|
||||||
$this->element('img', array('src' => $original->url,
|
$this->elementStart('div', array('id'=>'avatar_original_view'));
|
||||||
'width' => $original->width,
|
$this->element('img', array('src' => $original->url,
|
||||||
'height' => $original->height,
|
'width' => $original->width,
|
||||||
'alt' => $user->nickname));
|
'height' => $original->height,
|
||||||
$this->elementEnd('div');
|
'alt' => $user->nickname));
|
||||||
|
$this->elementEnd('div');
|
||||||
|
$this->elementEnd('li');
|
||||||
|
}
|
||||||
|
|
||||||
|
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
||||||
|
|
||||||
|
if ($avatar) {
|
||||||
|
$this->elementStart('li', array('id' => 'avatar_preview',
|
||||||
|
'class' => 'avatar_view'));
|
||||||
|
$this->element('h2', null, _("Preview"));
|
||||||
|
$this->elementStart('div', array('id'=>'avatar_preview_view'));
|
||||||
|
$this->element('img', array('src' => $original->url,
|
||||||
|
'width' => AVATAR_PROFILE_SIZE,
|
||||||
|
'height' => AVATAR_PROFILE_SIZE,
|
||||||
|
'alt' => $user->nickname));
|
||||||
|
$this->elementEnd('div');
|
||||||
|
$this->submit('delete', _('Delete'));
|
||||||
|
$this->elementEnd('li');
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->elementStart('li', array ('id' => 'settings_attach'));
|
||||||
|
$this->element('input', array('name' => 'avatarfile',
|
||||||
|
'type' => 'file',
|
||||||
|
'id' => 'avatarfile'));
|
||||||
|
$this->element('input', array('name' => 'MAX_FILE_SIZE',
|
||||||
|
'type' => 'hidden',
|
||||||
|
'id' => 'MAX_FILE_SIZE',
|
||||||
|
'value' => ImageFile::maxFileSizeInt()));
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
}
|
$this->elementEnd('ul');
|
||||||
|
|
||||||
$avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
|
$this->elementStart('ul', 'form_actions');
|
||||||
|
$this->elementStart('li');
|
||||||
if ($avatar) {
|
$this->submit('upload', _('Upload'));
|
||||||
$this->elementStart('li', array('id' => 'avatar_preview',
|
|
||||||
'class' => 'avatar_view'));
|
|
||||||
$this->element('h2', null, _("Preview"));
|
|
||||||
$this->elementStart('div', array('id'=>'avatar_preview_view'));
|
|
||||||
$this->element('img', array('src' => $original->url,
|
|
||||||
'width' => AVATAR_PROFILE_SIZE,
|
|
||||||
'height' => AVATAR_PROFILE_SIZE,
|
|
||||||
'alt' => $user->nickname));
|
|
||||||
$this->elementEnd('div');
|
|
||||||
$this->submit('delete', _('Delete'));
|
|
||||||
$this->elementEnd('li');
|
$this->elementEnd('li');
|
||||||
|
$this->elementEnd('ul');
|
||||||
}
|
}
|
||||||
|
Event::handle('EndAvatarFormData', array($this));
|
||||||
$this->elementStart('li', array ('id' => 'settings_attach'));
|
|
||||||
$this->element('input', array('name' => 'avatarfile',
|
|
||||||
'type' => 'file',
|
|
||||||
'id' => 'avatarfile'));
|
|
||||||
$this->element('input', array('name' => 'MAX_FILE_SIZE',
|
|
||||||
'type' => 'hidden',
|
|
||||||
'id' => 'MAX_FILE_SIZE',
|
|
||||||
'value' => ImageFile::maxFileSizeInt()));
|
|
||||||
$this->elementEnd('li');
|
|
||||||
$this->elementEnd('ul');
|
|
||||||
|
|
||||||
$this->elementStart('ul', 'form_actions');
|
|
||||||
$this->elementStart('li');
|
|
||||||
$this->submit('upload', _('Upload'));
|
|
||||||
$this->elementEnd('li');
|
|
||||||
$this->elementEnd('ul');
|
|
||||||
|
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
@ -267,14 +270,17 @@ class AvatarsettingsAction extends AccountSettingsAction
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->arg('upload')) {
|
if (Event::handle('StartAvatarSaveForm', array($this))) {
|
||||||
$this->uploadAvatar();
|
if ($this->arg('upload')) {
|
||||||
} else if ($this->arg('crop')) {
|
$this->uploadAvatar();
|
||||||
$this->cropAvatar();
|
} else if ($this->arg('crop')) {
|
||||||
} else if ($this->arg('delete')) {
|
$this->cropAvatar();
|
||||||
$this->deleteAvatar();
|
} else if ($this->arg('delete')) {
|
||||||
} else {
|
$this->deleteAvatar();
|
||||||
$this->showForm(_('Unexpected form submission.'));
|
} else {
|
||||||
|
$this->showForm(_('Unexpected form submission.'));
|
||||||
|
}
|
||||||
|
Event::handle('EndAvatarSaveForm', array($this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user