Update to forms and email settings

This commit is contained in:
sarven 2009-01-16 23:41:46 +00:00
parent 9881932d07
commit f46fd284e4
4 changed files with 51 additions and 33 deletions

View File

@ -85,42 +85,46 @@ class EmailsettingsAction extends SettingsAction
$user = common_current_user(); $user = common_current_user();
$this->elementStart('form', array('method' => 'post', $this->elementStart('form', array('method' => 'post',
'id' => 'emailsettings', 'id' => 'form_settings_email',
'class' => 'form_settings',
'action' => 'action' =>
common_local_url('emailsettings'))); common_local_url('emailsettings')));
$this->elementStart('fieldset');
$this->element('legend', null, _('Email settings'));
$this->hidden('token', common_session_token()); $this->hidden('token', common_session_token());
$this->elementStart('div', array('id' => 'settings_email_address'));
$this->element('h2', null, _('Address')); $this->element('h2', null, _('Address'));
if ($user->email) { if ($user->email) {
$this->elementStart('p'); $this->element('p', array('id' => 'email_confirmed', $user->email));
$this->element('span', 'address confirmed', $user->email); $this->element('p', array('class' => 'form_note'), _('Current confirmed email address.'));
$this->element('span', 'input_instructions',
_('Current confirmed email address.'));
$this->hidden('email', $user->email); $this->hidden('email', $user->email);
$this->elementEnd('p');
$this->submit('remove', _('Remove')); $this->submit('remove', _('Remove'));
} else { } else {
$confirm = $this->getConfirmation(); $confirm = $this->getConfirmation();
if ($confirm) { if ($confirm) {
$this->elementStart('p'); $this->element('p', array('id' => 'email_unconfirmed'), $confirm->address);
$this->element('span', 'address unconfirmed', $confirm->address); $this->element('p', array('class' => 'form_note'),
$this->element('span', 'input_instructions', _('Awaiting confirmation on this address. '.
_('Awaiting confirmation on this address. '. 'Check your inbox (and spam box!) for a message '.
'Check your inbox (and spam box!) for a message '. 'with further instructions.'));
'with further instructions.'));
$this->hidden('email', $confirm->address); $this->hidden('email', $confirm->address);
$this->elementEnd('p');
$this->submit('cancel', _('Cancel')); $this->submit('cancel', _('Cancel'));
} else { } else {
$this->elementStart('ul', 'form_datas');
$this->elementStart('li');
$this->input('email', _('Email Address'), $this->input('email', _('Email Address'),
($this->arg('email')) ? $this->arg('email') : null, ($this->arg('email')) ? $this->arg('email') : null,
_('Email address, like "UserName@example.org"')); _('Email address, like "UserName@example.org"'));
$this->elementEnd('li');
$this->elementEnd('ul');
$this->submit('add', _('Add')); $this->submit('add', _('Add'));
} }
} }
$this->elementEnd('div');
$this->elementStart('div', array('id' => 'settings_email_incoming'));
if ($user->email) { if ($user->email) {
$this->element('h2', null, _('Incoming email')); $this->element('h2', null, _('Incoming email'));
@ -140,31 +144,49 @@ class EmailsettingsAction extends SettingsAction
$this->elementEnd('p'); $this->elementEnd('p');
$this->submit('newincoming', _('New')); $this->submit('newincoming', _('New'));
} }
$this->elementEnd('div');
$this->elementStart('div', array('id' => 'settings_email_preferences'));
$this->element('h2', null, _('Preferences')); $this->element('h2', null, _('Preferences'));
$this->elementStart('ul', 'form_datas');
$this->elementStart('li');
$this->checkbox('emailnotifysub', $this->checkbox('emailnotifysub',
_('Send me notices of new subscriptions through email.'), _('Send me notices of new subscriptions through email.'),
$user->emailnotifysub); $user->emailnotifysub);
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('emailnotifyfav', $this->checkbox('emailnotifyfav',
_('Send me email when someone '. _('Send me email when someone '.
'adds my notice as a favorite.'), 'adds my notice as a favorite.'),
$user->emailnotifyfav); $user->emailnotifyfav);
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('emailnotifymsg', $this->checkbox('emailnotifymsg',
_('Send me email when someone sends me a private message.'), _('Send me email when someone sends me a private message.'),
$user->emailnotifymsg); $user->emailnotifymsg);
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('emailnotifynudge', $this->checkbox('emailnotifynudge',
_('Allow friends to nudge me and send me an email.'), _('Allow friends to nudge me and send me an email.'),
$user->emailnotifynudge); $user->emailnotifynudge);
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('emailpost', $this->checkbox('emailpost',
_('I want to post notices by email.'), _('I want to post notices by email.'),
$user->emailpost); $user->emailpost);
$this->elementEnd('li');
$this->elementStart('li');
$this->checkbox('emailmicroid', $this->checkbox('emailmicroid',
_('Publish a MicroID for my email address.'), _('Publish a MicroID for my email address.'),
$user->emailmicroid); $user->emailmicroid);
$this->elementEnd('li');
$this->elementEnd('ul');
$this->elementEnd('div');
$this->submit('save', _('Save')); $this->submit('save', _('Save'));
$this->elementEnd('fieldset');
$this->elementEnd('form'); $this->elementEnd('form');
} }

View File

@ -155,20 +155,17 @@ class HTMLOutputter extends XMLOutputter
function input($id, $label, $value=null, $instructions=null) function input($id, $label, $value=null, $instructions=null)
{ {
$this->elementStart('p');
$this->element('label', array('for' => $id), $label); $this->element('label', array('for' => $id), $label);
$attrs = array('name' => $id, $attrs = array('name' => $id,
'type' => 'text', 'type' => 'text',
'class' => 'input_text',
'id' => $id); 'id' => $id);
if ($value) { if ($value) {
$attrs['value'] = htmlspecialchars($value); $attrs['value'] = htmlspecialchars($value);
} }
$this->element('input', $attrs); $this->element('input', $attrs);
if ($instructions) { if ($instructions) {
$this->element('span', 'input_instructions', $instructions); $this->element('p', 'form_guide', $instructions);
} }
$this->elementEnd('p');
} }
/** /**
@ -192,7 +189,6 @@ class HTMLOutputter extends XMLOutputter
function checkbox($id, $label, $checked=false, $instructions=null, function checkbox($id, $label, $checked=false, $instructions=null,
$value='true', $disabled=false) $value='true', $disabled=false)
{ {
$this->elementStart('p');
$attrs = array('name' => $id, $attrs = array('name' => $id,
'type' => 'checkbox', 'type' => 'checkbox',
'class' => 'checkbox', 'class' => 'checkbox',
@ -213,9 +209,8 @@ class HTMLOutputter extends XMLOutputter
$label); $label);
$this->text(' '); $this->text(' ');
if ($instructions) { if ($instructions) {
$this->element('span', 'input_instructions', $instructions); $this->element('p', 'form_guide', $instructions);
} }
$this->elementEnd('p');
} }
/** /**
@ -240,7 +235,6 @@ class HTMLOutputter extends XMLOutputter
function dropdown($id, $label, $content, $instructions=null, function dropdown($id, $label, $content, $instructions=null,
$blank_select=false, $selected=null) $blank_select=false, $selected=null)
{ {
$this->elementStart('p');
$this->element('label', array('for' => $id), $label); $this->element('label', array('for' => $id), $label);
$this->elementStart('select', array('id' => $id, 'name' => $id)); $this->elementStart('select', array('id' => $id, 'name' => $id));
if ($blank_select) { if ($blank_select) {
@ -257,9 +251,8 @@ class HTMLOutputter extends XMLOutputter
} }
$this->elementEnd('select'); $this->elementEnd('select');
if ($instructions) { if ($instructions) {
$this->element('span', 'input_instructions', $instructions); $this->element('p', 'form_guide', $instructions);
} }
$this->elementEnd('p');
} }
/** /**
@ -296,7 +289,6 @@ class HTMLOutputter extends XMLOutputter
function password($id, $label, $instructions=null) function password($id, $label, $instructions=null)
{ {
$this->elementStart('p');
$this->element('label', array('for' => $id), $label); $this->element('label', array('for' => $id), $label);
$attrs = array('name' => $id, $attrs = array('name' => $id,
'type' => 'password', 'type' => 'password',
@ -304,9 +296,8 @@ class HTMLOutputter extends XMLOutputter
'id' => $id); 'id' => $id);
$this->element('input', $attrs); $this->element('input', $attrs);
if ($instructions) { if ($instructions) {
$this->element('span', 'input_instructions', $instructions); $this->element('p', 'form_guide', $instructions);
} }
$this->elementEnd('p');
} }
/** /**
@ -348,7 +339,6 @@ class HTMLOutputter extends XMLOutputter
function textarea($id, $label, $content=null, $instructions=null) function textarea($id, $label, $content=null, $instructions=null)
{ {
$this->elementStart('p');
$this->element('label', array('for' => $id), $label); $this->element('label', array('for' => $id), $label);
$this->element('textarea', array('rows' => 3, $this->element('textarea', array('rows' => 3,
'cols' => 40, 'cols' => 40,
@ -356,8 +346,7 @@ class HTMLOutputter extends XMLOutputter
'id' => $id), 'id' => $id),
($content) ? $content : ''); ($content) ? $content : '');
if ($instructions) { if ($instructions) {
$this->element('span', 'input_instructions', $instructions); $this->element('p', 'form_guide', $instructions);
} }
$this->elementEnd('p');
} }
} }

View File

@ -94,7 +94,7 @@ class SettingsGroupNav extends Widget
_('Other options'))); _('Other options')));
$action_name = $this->action->trimmed('action'); $action_name = $this->action->trimmed('action');
$this->action->elementStart('ul', array('id' => 'nav_views')); $this->action->elementStart('ul', array('class' => 'nav'));
foreach ($menu as $menuaction => $menudesc) { foreach ($menu as $menuaction => $menudesc) {
if ($menuaction == 'imsettings' && if ($menuaction == 'imsettings' &&
@ -104,7 +104,7 @@ class SettingsGroupNav extends Widget
$this->action->menuItem(common_local_url($menuaction), $this->action->menuItem(common_local_url($menuaction),
$menudesc[0], $menudesc[0],
$menudesc[1], $menudesc[1],
$action_name == $menuaction); $action_name === $menuaction);
} }
$this->action->elementEnd('ul'); $this->action->elementEnd('ul');

View File

@ -100,7 +100,7 @@ border:0;
display:none; display:none;
} }
.form_settings .form_datas label { .form_settings .form_datas label {
display:block;
} }
.form_guide { .form_guide {
@ -116,6 +116,13 @@ display:inline;
font-weight:bold; font-weight:bold;
} }
.form_settings p {
margin-bottom:18px;
}
#settings_email_address {
margin-bottom:29px;
}
/* FORM SETTINGS */ /* FORM SETTINGS */