more ajax coming (un-sub)

darcs-hash:20081118174857-099f7-bb67199062174a41433c34434f4832a8f48898ee.gz
This commit is contained in:
millette 2008-11-18 12:48:57 -05:00
parent 7557079012
commit 7c2c1855ba
4 changed files with 35 additions and 8 deletions

View File

@ -32,9 +32,6 @@ class NudgeAction extends Action {
} }
$user = common_current_user(); $user = common_current_user();
// $other_nickname = common_canonical_nickname($args['nickname']);
// $other_nickname = $this->arg('nickname');
// $other = User::staticGet('nickname', $other_nickname);
$other = User::staticGet('nickname', $this->arg('nickname')); $other = User::staticGet('nickname', $this->arg('nickname'));
if ($_SERVER['REQUEST_METHOD'] != 'POST') { if ($_SERVER['REQUEST_METHOD'] != 'POST') {

View File

@ -54,7 +54,18 @@ class SubscribeAction extends Action {
return; return;
} }
if ($this->boolean('ajax')) {
common_start_html('text/xml');
common_element_start('head');
common_element('title', null, _('Subscribed'));
common_element_end('head');
common_element_start('body');
common_subscribe_response();
common_element_end('body');
common_element_end('html');
} else {
common_redirect(common_local_url('subscriptions', array('nickname' => common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname))); $user->nickname)));
} }
} }
}

View File

@ -49,7 +49,18 @@ class UnsubscribeAction extends Action {
return; return;
} }
if ($this->boolean('ajax')) {
common_start_html('text/xml');
common_element_start('head');
common_element('title', null, _('Unsubscribed'));
common_element_end('head');
common_element_start('body');
common_unsubscribe_response();
common_element_end('body');
common_element_end('html');
} else {
common_redirect(common_local_url('subscriptions', array('nickname' => common_redirect(common_local_url('subscriptions', array('nickname' =>
$user->nickname))); $user->nickname)));
} }
} }
}

View File

@ -1896,6 +1896,14 @@ function common_nudge_form($profile) {
common_element_end('form'); common_element_end('form');
} }
function common_subscribe_response() {
common_element('p', array('id' => 'subscribe_response'), _('Subscribed'));
}
function common_unsubscribe_response() {
common_element('p', array('id' => 'unsubscribe_response'), _('Unsubscribed'));
}
function common_nudge_response() { function common_nudge_response() {
common_element('p', array('id' => 'nudge_response'), _('Nudge sent!')); common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
} }