summaryrefslogtreecommitdiff
path: root/actions/profilesettings.php
diff options
context:
space:
mode:
authorZach Copley <zach@controlyourself.ca>2008-09-06 03:06:51 -0400
committerZach Copley <zach@controlyourself.ca>2008-09-06 03:06:51 -0400
commit4f19a9462c7f3b0f21204bfe9e3e196c99aa7d73 (patch)
tree4ff3f0c43b5692ed38adb2ec9fb667cfb5ffa10d /actions/profilesettings.php
parent4f1c30fd882211186a1e8609e500a6d2683098dc (diff)
Moved avatar upload down below timezone on profile settings
darcs-hash:20080906070651-7b5ce-23c17932cc9c474dfbeb530d29b1bd1adb3a4260.gz
Diffstat (limited to 'actions/profilesettings.php')
-rw-r--r--actions/profilesettings.php108
1 files changed, 63 insertions, 45 deletions
diff --git a/actions/profilesettings.php b/actions/profilesettings.php
index 10ab2cd0f..f34101ba9 100644
--- a/actions/profilesettings.php
+++ b/actions/profilesettings.php
@@ -29,48 +29,33 @@ class ProfilesettingsAction extends SettingsAction {
}
function show_form($msg=NULL, $success=false) {
- $user = common_current_user();
- $profile = $user->getProfile();
$this->form_header(_('Profile settings'), $msg, $success);
+ $this->show_settings_form();
+ $this->show_avatar_form();
+ common_show_footer();
+ }
- common_element('h2', NULL, _('Avatar'));
+ function handle_post() {
- $original = $profile->getOriginalAvatar();
+ # CSRF protection
- if ($original) {
- common_element('img', array('src' => $original->url,
- 'class' => 'avatar original',
- 'width' => $original->width,
- 'height' => $original->height,
- 'alt' => $user->nickname));
+ $token = $this->trimmed('token');
+ if (!$token || $token != common_session_token()) {
+ $this->show_form(_('There was a problem with your session token. Try again, please.'));
+ return;
}
- $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
-
- if ($avatar) {
- common_element('img', array('src' => $avatar->url,
- 'class' => 'avatar profile',
- 'width' => AVATAR_PROFILE_SIZE,
- 'height' => AVATAR_PROFILE_SIZE,
- 'alt' => $user->nickname));
+ if ($this->arg('save')) {
+ $this->save_profile();
+ } else if ($this->arg('upload')) {
+ $this->upload_avatar();
}
+ }
- common_element_start('form', array('enctype' => 'multipart/form-data',
- 'method' => 'POST',
- 'id' => 'profilesettings',
- 'action' =>
- common_local_url('profilesettings')));
- common_hidden('token', common_session_token());
+ function show_settings_form() {
- common_element('input', array('name' => 'MAX_FILE_SIZE',
- 'type' => 'hidden',
- 'id' => 'MAX_FILE_SIZE',
- 'value' => MAX_AVATAR_SIZE));
- common_element('input', array('name' => 'avatarfile',
- 'type' => 'file',
- 'id' => 'avatarfile'));
- common_submit('upload', _('Upload'));
- common_element_end('form');
+ $user = common_current_user();
+ $profile = $user->getProfile();
common_element_start('form', array('method' => 'POST',
'id' => 'profilesettings',
@@ -78,7 +63,6 @@ class ProfilesettingsAction extends SettingsAction {
common_local_url('profilesettings')));
common_hidden('token', common_session_token());
- common_element('h2', NULL, _('Profile Settings'));
# too much common patterns here... abstractable?
@@ -112,24 +96,58 @@ class ProfilesettingsAction extends SettingsAction {
common_submit('save', _('Save'));
common_element_end('form');
- common_show_footer();
+
+
}
- function handle_post() {
+ function show_avatar_form() {
- # CSRF protection
+ $user = common_current_user();
+ $profile = $user->getProfile();
- $token = $this->trimmed('token');
- if (!$token || $token != common_session_token()) {
- $this->show_form(_('There was a problem with your session token. Try again, please.'));
- return;
+ $original = $profile->getOriginalAvatar();
+
+
+ common_element_start('form', array('enctype' => 'multipart/form-data',
+ 'method' => 'POST',
+ 'id' => 'profilesettings',
+ 'action' =>
+ common_local_url('profilesettings')));
+ common_hidden('token', common_session_token());
+
+ common_element_start('p');
+ common_element('label', array('for' => 'avatar'), 'Avatar');
+
+ if ($original) {
+ common_element('img', array('src' => $original->url,
+ 'class' => 'avatar original',
+ 'width' => $original->width,
+ 'height' => $original->height,
+ 'alt' => $user->nickname));
}
- if ($this->arg('save')) {
- $this->save_profile();
- } else if ($this->arg('upload')) {
- $this->upload_avatar();
+ $avatar = $profile->getAvatar(AVATAR_PROFILE_SIZE);
+
+ if ($avatar) {
+ common_element('img', array('src' => $avatar->url,
+ 'class' => 'avatar profile',
+ 'width' => AVATAR_PROFILE_SIZE,
+ 'height' => AVATAR_PROFILE_SIZE,
+ 'alt' => $user->nickname));
}
+
+ common_element_end('p');
+
+ common_element('input', array('name' => 'MAX_FILE_SIZE',
+ 'type' => 'hidden',
+ 'id' => 'MAX_FILE_SIZE',
+ 'value' => MAX_AVATAR_SIZE));
+ common_element('input', array('name' => 'avatarfile',
+ 'type' => 'file',
+ 'id' => 'avatarfile'));
+ common_submit('upload', _('Upload'));
+ common_element_end('form');
+
}
function save_profile() {