summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorcsarven <csarven@controlyourself.ca>2008-11-20 18:26:55 -0500
committercsarven <csarven@controlyourself.ca>2008-11-20 18:26:55 -0500
commit171bedf24bca7bd195dd4a8ee79cb3f04e6de5d5 (patch)
treec4b84cffe4fcd70e7906d18cab288cc221e1019a /actions
parent41f29ab662a5587b1505303ff6d39efb4b6b77c9 (diff)
(Un)Subscribe form using ajaxForm()
darcs-hash:20081120232655-eefa4-cf6a71e246828793d3bfa413db724ab33bc58bcf.gz
Diffstat (limited to 'actions')
-rw-r--r--actions/showstream.php34
-rw-r--r--actions/subscribe.php5
-rw-r--r--actions/unsubscribe.php4
3 files changed, 12 insertions, 31 deletions
diff --git a/actions/showstream.php b/actions/showstream.php
index 3eae5eb0f..419c4421a 100644
--- a/actions/showstream.php
+++ b/actions/showstream.php
@@ -174,9 +174,9 @@ class ShowstreamAction extends StreamAction {
if ($cur) {
if ($cur->id != $profile->id) {
if ($cur->isSubscribed($profile)) {
- $this->show_unsubscribe_form($profile);
+ common_unsubscribe_form($profile);
} else {
- $this->show_subscribe_form($profile);
+ common_subscribe_form($profile);
}
}
} else {
@@ -185,19 +185,9 @@ class ShowstreamAction extends StreamAction {
common_element_end('li');
$user = User::staticGet('id', $profile->id);
-
- if ($cur && $cur->id != $user->id && $cur->mutuallySubscribed($user)) {
- common_element_start('li', array('id' => 'profile_send_a_new_message'));
- common_element('a', array('href' => common_local_url('newmessage', array('to' => $user->id))),
- _('Send a message'));
- common_element_end('li');
- if ($user->email && $user->emailnotifynudge) {
- common_element_start('li', array('id' => 'profile_nudge'));
- common_nudge_form($user);
- common_element_end('li');
- }
- }
- common_element_end('ul');
+ common_profile_new_message_nudge($cur, $user, $profile);
+
+ common_element_end('ul');
common_element_end('div');
@@ -229,20 +219,6 @@ class ShowstreamAction extends StreamAction {
common_element_end('div');
}
- function show_subscribe_form($profile) {
- common_element_start('form', array('id' => 'subscribe', 'method' => 'post',
- 'action' => common_local_url('subscribe')));
- common_hidden('token', common_session_token());
- common_element('input', array('id' => 'subscribeto',
- 'name' => 'subscribeto',
- 'type' => 'hidden',
- 'value' => $profile->nickname));
- common_element('input', array('type' => 'submit',
- 'class' => 'submit',
- 'value' => _('Subscribe')));
- common_element_end('form');
- }
-
function show_remote_subscribe_link($profile) {
$url = common_local_url('remotesubscribe',
array('nickname' => $profile->nickname));
diff --git a/actions/subscribe.php b/actions/subscribe.php
index 10951dc3b..856586f87 100644
--- a/actions/subscribe.php
+++ b/actions/subscribe.php
@@ -54,13 +54,16 @@ class SubscribeAction extends Action {
return;
}
+ $cur = common_current_user();
+ $profile = Profile::staticGet('nickname', $other_nickname);
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_unsubscribe_form($profile);
+ common_profile_new_message_nudge($cur, $profile);
common_element_end('body');
common_element_end('html');
} else {
diff --git a/actions/unsubscribe.php b/actions/unsubscribe.php
index 562dd00fc..ad4f04a02 100644
--- a/actions/unsubscribe.php
+++ b/actions/unsubscribe.php
@@ -49,13 +49,15 @@ class UnsubscribeAction extends Action {
return;
}
+ $profile = Profile::staticGet('nickname', $other_nickname);
+
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_subscribe_form($profile);
common_element_end('body');
common_element_end('html');
} else {