From 10e32eca5ca7683dd7ea3746d563727f1923163f Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Mon, 12 Jan 2009 03:16:22 +0000 Subject: [PATCH] trac750 Better workflow for inviting friends to use the Facebook app --- actions/facebookinvite.php | 60 +++++++++++++++++++++++++++++++++----- 1 file changed, 52 insertions(+), 8 deletions(-) diff --git a/actions/facebookinvite.php b/actions/facebookinvite.php index 7addc4b31d..14c09db3d2 100644 --- a/actions/facebookinvite.php +++ b/actions/facebookinvite.php @@ -28,38 +28,82 @@ class FacebookinviteAction extends FacebookAction { parent::handle($args); - $this->display(); + if ($this->arg('ids')) { + $this->showThankYou(); + } else { + $this->showInviteForm(); + } } - function display() + + function showThankYou() { - $facebook = get_facebook(); - $fbuid = $facebook->require_login(); $this->show_header('Invite'); + common_element('h2', null, _('Thanks for inviting your friends to use Identi.ca!')); + common_element('p', null, _('Invitations have been sent to the following users:')); + + $friend_ids = $_POST['ids']; // Hmm... $arg->('ids) doesn't seem to work + + common_element_start("ul"); + + foreach ($friend_ids as $friend) { + common_element_start('li'); + common_element('fb:profile-pic', array('uid' => $friend)); + common_element('fb:name', array('uid' => $friend, + 'capitalize' => 'true')); + common_element_end('li'); + } + + common_element_end("ul"); + + $this->show_footer(); + } + + function showInviteForm() + { + + $facebook = get_facebook(); + $fbuid = $facebook->require_login(); + + $this->show_header('Invite'); // Get a list of users who are already using the app for exclusion $exclude_ids = $facebook->api_client->friends_getAppUsers(); - $content = 'You have been invited to Identi.ca! ' . + $content = _('You have been invited to Identi.ca!') . htmlentities(''); common_element_start('fb:request-form', array('action' => 'invite.php', - 'method' => 'POST', + 'method' => 'post', 'invite' => 'true', 'type' => 'Identi.ca', 'content' => $content)); - + common_hidden('invite', 'true'); $actiontext = 'Invite your friends to use Identi.ca.'; common_element('fb:multi-friend-selector', array('showborder' => 'false', 'actiontext' => $actiontext, - 'exclude_ids' => implode(',', $exclude_ids))); + 'exclude_ids' => implode(',', $exclude_ids), + 'bypass' => 'cancel')); common_element_end('fb:request-form'); + common_element('h2', null, _('Friends already using Identi.ca:')); + common_element_start("ul"); + + foreach ($exclude_ids as $friend) { + common_element_start('li'); + common_element('fb:profile-pic', array('uid' => $friend)); + common_element('fb:name', array('uid' => $friend, + 'capitalize' => 'true')); + common_element_end('li'); + } + + common_element_end("ul"); + $this->show_footer(); }