summaryrefslogtreecommitdiff
path: root/actions/emailsettings.php
diff options
context:
space:
mode:
authorBrion Vibber <brion@pobox.com>2010-12-01 14:23:56 -0800
committerBrion Vibber <brion@pobox.com>2010-12-01 14:23:56 -0800
commit5d9d0d7349ac757869a76ccd01dfde65d3f54273 (patch)
tree1608fe38cf15ec74c1ab190f3d709ab7b15ea55b /actions/emailsettings.php
parent36d605a1e9b8ca05c5f9342602731e11346f3447 (diff)
Ticket #2912 further cleanup: use JS on emailsettings form to help connect the 'I want to post by email' checkbox with the controls for adding or removing a post-by-email alias.
Now, when you first come up the checkbox will most likely be off and the button to create an address is grayed out. Checking the box enables use of the 'new' button to generate an email address -- it's left disabled until you check the box, so you can't accidentally trip it. Actually adding the address now enables the post-by-mail option, as well, thus ensuring that it's saved. WARNING: OTHER CHANGES ON THE FORM WILL STILL BE LOST. Removing the address now disables the post-by-mail option, so it's not sitting around confusingly enabled but useless. You can still disable the checkbox manually without removing the address, in case you want to keep it for later. It's also still possible to actually save it in the state where the option is enabled, but there's no configured address, but that shouldn't happen too often. Possibly that should be prevented outright though.
Diffstat (limited to 'actions/emailsettings.php')
-rw-r--r--actions/emailsettings.php16
1 files changed, 16 insertions, 0 deletions
diff --git a/actions/emailsettings.php b/actions/emailsettings.php
index aae39f6af..4a7dc1b87 100644
--- a/actions/emailsettings.php
+++ b/actions/emailsettings.php
@@ -79,6 +79,7 @@ class EmailsettingsAction extends AccountSettingsAction
function showScripts()
{
parent::showScripts();
+ $this->script('emailsettings.js');
$this->autofocus('email');
}
@@ -159,6 +160,16 @@ class EmailsettingsAction extends AccountSettingsAction
$this->elementEnd('li');
$this->elementEnd('ul');
+ // Our stylesheets make the form_data list items all floats, which
+ // creates lots of problems with trying to wrap divs around things.
+ // This should force a break before the next section, which needs
+ // to be separate so we can disable the things in it when the
+ // checkbox is off.
+ $this->elementStart('div', array('style' => 'clear: both'));
+ $this->elementEnd('div');
+
+ $this->elementStart('div', array('id' => 'emailincoming'));
+
if ($user->incomingemail) {
$this->elementStart('p');
$this->element('span', 'address', $user->incomingemail);
@@ -186,6 +197,9 @@ class EmailsettingsAction extends AccountSettingsAction
// TRANS: Button label for adding an e-mail address to send notices from.
$this->submit('newincoming', _m('BUTTON','New'));
+
+ $this->elementEnd('div'); // div#emailincoming
+
$this->elementEnd('fieldset');
}
@@ -518,6 +532,7 @@ class EmailsettingsAction extends AccountSettingsAction
$orig = clone($user);
$user->incomingemail = null;
+ $user->emailpost = 0;
if (!$user->updateKeys($orig)) {
common_log_db_error($user, 'UPDATE', __FILE__);
@@ -542,6 +557,7 @@ class EmailsettingsAction extends AccountSettingsAction
$orig = clone($user);
$user->incomingemail = mail_new_incoming_address();
+ $user->emailpost = 1;
if (!$user->updateKeys($orig)) {
common_log_db_error($user, 'UPDATE', __FILE__);