]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
more ajax coming (un-sub)
authormillette <millette@controlyourself.ca>
Tue, 18 Nov 2008 17:48:57 +0000 (12:48 -0500)
committermillette <millette@controlyourself.ca>
Tue, 18 Nov 2008 17:48:57 +0000 (12:48 -0500)
darcs-hash:20081118174857-099f7-bb67199062174a41433c34434f4832a8f48898ee.gz

actions/nudge.php
actions/subscribe.php
actions/unsubscribe.php
lib/util.php

index 822606d30893b7b59c4434db2ab8221d7b2e46e4..f14cdc83c93d1df55af92c20acc3c8f7ca726796 100644 (file)
@@ -32,9 +32,6 @@ class NudgeAction extends Action {
                }
 
                $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'));
 
                if ($_SERVER['REQUEST_METHOD'] != 'POST') {
index 20c258923bb0b2b33fed38d1d156e27e8cbe155a..10951dc3b4bfb7b0cbeaeb00442a0d379a0fc0f4 100644 (file)
@@ -53,8 +53,19 @@ class SubscribeAction extends Action {
                        common_user_error($result);
                        return;
                }
-               
-               common_redirect(common_local_url('subscriptions', array('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_element_end('body');
+                       common_element_end('html');
+               } else {
+                   common_redirect(common_local_url('subscriptions', array('nickname' =>
                                                                                                                                $user->nickname)));
+        }
        }
-}
\ No newline at end of file
+}
index 4bfaf79580f0c49b316b98efe9f79b71cd7b63c2..562dd00fc489c2d40bd3668f39726bbcc91afbd7 100644 (file)
@@ -49,7 +49,18 @@ class UnsubscribeAction extends Action {
                        return;
                }
 
-               common_redirect(common_local_url('subscriptions', array('nickname' =>
-                                                                                                                               $user->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_element_end('body');
+                       common_element_end('html');
+               } else {
+               common_redirect(common_local_url('subscriptions', array('nickname' =>
+                                                                                                                               $user->nickname)));
+        }
        }
 }
index c8ccf63fff14471745291455cfd5275386f63b74..8fff5f605b09d658ff50748159aa6eba7152620a 100644 (file)
@@ -1896,6 +1896,14 @@ function common_nudge_form($profile) {
        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() {
        common_element('p', array('id' => 'nudge_response'), _('Nudge sent!'));
 }