diff options
author | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
---|---|---|
committer | Brett Profitt <brett.profitt@gmail.com> | 2011-08-25 10:00:38 -0700 |
commit | dccc333c765bb28da55b4a55d9c916acdb88413a (patch) | |
tree | bdd26a0b4cd85241a19b7fcb2c0770f0ac3eb9f0 /mod/twitter_api/views/default | |
parent | ec7b94a64aef23b85866ecdac8e8acc712d29bb6 (diff) | |
parent | 003cb81c7888f4d2fd763e5814027c6f8d71186f (diff) | |
download | elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.gz elgg-dccc333c765bb28da55b4a55d9c916acdb88413a.tar.bz2 |
Merge branch 'master' of github.com:brettp/Elgg
Diffstat (limited to 'mod/twitter_api/views/default')
5 files changed, 90 insertions, 20 deletions
diff --git a/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php new file mode 100644 index 000000000..fdeafd46d --- /dev/null +++ b/mod/twitter_api/views/default/forms/twitter_api/interstitial_settings.php @@ -0,0 +1,61 @@ +<?php +/** + * Make the user set up some alternative ways to login. + */ + +$user = elgg_get_logged_in_user_entity(); + +if (elgg_is_sticky_form('twitter_api_interstitial')) { + extract(elgg_get_sticky_values('twitter_api_interstitial')); + elgg_clear_sticky_form('twitter_api_interstitial'); +} + +if (!isset($display_name)) { + $display_name = $user->name; +} + +// username +$title = elgg_echo('username'); + +$body = elgg_echo('twitter_api:interstitial:username'); +$body .= elgg_view('input/text', array('value' => $user->username, 'disabled' => 'disabled')); + +echo elgg_view_module('info', $title, $body); + +// display name +$title = elgg_echo('name'); + +$body = elgg_echo('twitter_api:interstitial:name'); +$body .= elgg_view('input/text', array('name' => 'display_name', 'value' => $display_name)); + +echo elgg_view_module('info', $title, $body); + +// email +$title = elgg_echo('email'); + +$body = elgg_echo('twitter_api:interstitial:email'); +$body .= elgg_view('input/email', array('name' => 'email', 'value' => $email)); + +echo elgg_view_module('info', $title, $body); + +// password +$title = elgg_echo('password'); + +$body = elgg_echo('twitter_api:interstitial:password'); +$body .= elgg_view('input/password', array('name' => 'password_1')); +$body .= elgg_echo('twitter_api:interstitial:password2'); +$body .= elgg_view('input/password', array('name' => 'password_2')); + +echo elgg_view_module('info', $title, $body); + +// buttons + +echo elgg_view('input/submit', array( + 'text' => elgg_echo('save') +)); + +echo elgg_view('output/url', array( + 'class' => 'right', + 'text' => elgg_echo('twitter_api:interstitial:no_thanks'), + 'href' => '/', +));
\ No newline at end of file diff --git a/mod/twitter_api/views/default/settings/twitter_api/edit.php b/mod/twitter_api/views/default/settings/twitter_api/edit.php index 9deac3989..4e52a5c9d 100644 --- a/mod/twitter_api/views/default/settings/twitter_api/edit.php +++ b/mod/twitter_api/views/default/settings/twitter_api/edit.php @@ -1,8 +1,9 @@ <?php /** - * + * Twitter API plugin settings */ -$insert_view = elgg_view('twittersettings/extend'); + +$instructions = elgg_echo('twitter_api:settings:instructions', array(elgg_get_site_url())); $consumer_key_string = elgg_echo('twitter_api:consumer_key'); $consumer_key_view = elgg_view('input/text', array( @@ -15,7 +16,7 @@ $consumer_secret_string = elgg_echo('twitter_api:consumer_secret'); $consumer_secret_view = elgg_view('input/text', array( 'name' => 'params[consumer_secret]', 'value' => $vars['entity']->consumer_secret, - 'class' => 'text_input', + 'class' => 'text_input twitter-secret', )); $sign_on_with_twitter_string = elgg_echo('twitter_api:login'); @@ -39,9 +40,9 @@ $new_users_with_twitter_view = elgg_view('input/dropdown', array( )); $settings = <<<__HTML -<div>$insert_view</div> -<div>$consumer_key_string $consumer_key_view</div> -<div>$consumer_secret_string $consumer_secret_view</div> +<div class="elgg-instructs mtm"><p>$instructions</p></div> +<div><label>$consumer_key_string</label><br /> $consumer_key_view</div> +<div><label>$consumer_secret_string</label><br /> $consumer_secret_view</div> <div>$sign_on_with_twitter_string $sign_on_with_twitter_view</div> <div>$new_users_with_twitter $new_users_with_twitter_view</div> __HTML; diff --git a/mod/twitter_api/views/default/twitter_api/css.php b/mod/twitter_api/views/default/twitter_api/css.php index 140ce6a52..04bbed668 100644 --- a/mod/twitter_api/views/default/twitter_api/css.php +++ b/mod/twitter_api/views/default/twitter_api/css.php @@ -4,9 +4,10 @@ */ ?> -#twitter_api_site_settings .text_input { - width: 350px; -} #login_with_twitter { padding: 10px 0 0 0; } + +.twitter-secret { + width: 400px; +}
\ No newline at end of file diff --git a/mod/twitter_api/views/default/twitter_api/login.php b/mod/twitter_api/views/default/twitter_api/login.php index d0aca87ac..17bd76d56 100644 --- a/mod/twitter_api/views/default/twitter_api/login.php +++ b/mod/twitter_api/views/default/twitter_api/login.php @@ -1,10 +1,10 @@ <?php /** - * + * Extension of login form for Twitter sign in */ $url = elgg_get_site_url() . 'twitter_api/forward'; -$img_url = elgg_get_site_url() . 'mod/twitter_api/graphics/sign_in_with_twitter.gif'; +$img_url = elgg_get_site_url() . 'mod/twitter_api/graphics/sign-in-with-twitter-d.png'; $login = <<<__HTML <div id="login_with_twitter"> diff --git a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php b/mod/twitter_api/views/default/usersettings/twitter_api/edit.php index 77dd5cc5d..acb8d9af5 100644 --- a/mod/twitter_api/views/default/usersettings/twitter_api/edit.php +++ b/mod/twitter_api/views/default/usersettings/twitter_api/edit.php @@ -1,22 +1,29 @@ <?php /** - * + * User settings for Twitter API */ -$user_id = elgg_get_logged_in_user_guid(); -$twitter_name = get_plugin_usersetting('twitter_name', $user_id, 'twitter_api'); -$access_key = get_plugin_usersetting('access_key', $user_id, 'twitter_api'); -$access_secret = get_plugin_usersetting('access_secret', $user_id, 'twitter_api'); +$user = elgg_get_logged_in_user_entity(); +$user_guid = $user->getGUID(); +$twitter_name = get_plugin_usersetting('twitter_name', $user_guid, 'twitter_api'); +$access_key = get_plugin_usersetting('access_key', $user_guid, 'twitter_api'); +$access_secret = get_plugin_usersetting('access_secret', $user_guid, 'twitter_api'); $site_name = elgg_get_site_entity()->name; echo '<div>' . elgg_echo('twitter_api:usersettings:description', array($site_name)) . '</div>'; if (!$access_key || !$access_secret) { // send user off to validate account - $request_link = twitter_api_get_authorize_url(); + $request_link = twitter_api_get_authorize_url(null, false); echo '<div>' . elgg_echo('twitter_api:usersettings:request', array($request_link, $site_name)) . '</div>'; } else { - $url = elgg_get_site_url() . "twitter_api/revoke"; - echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>'; - echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>'; + // if this user logged in through twitter and never set up an email address, don't + // let them disassociate their account. + if ($user->email) { + $url = elgg_get_site_url() . "twitter_api/revoke"; + echo '<div class="twitter_anywhere">' . elgg_echo('twitter_api:usersettings:authorized', array($site_name, $twitter_name)) . '</div>'; + echo '<div>' . sprintf(elgg_echo('twitter_api:usersettings:revoke'), $url) . '</div>'; + } else { + echo elgg_echo('twitter_api:usersettings:cannot_revoke', array(elgg_normalize_url('twitter_api/interstitial'))); + } } |