From a0a59e0518459076079e904cd257dd9608b9bd37 Mon Sep 17 00:00:00 2001 From: Friendika Date: Tue, 17 May 2011 18:25:18 -0700 Subject: [PATCH] statusnet post by default --- addon/statusnet/statusnet.css | 19 +++++++++++++------ addon/statusnet/statusnet.php | 23 ++++++++++++++++------- 2 files changed, 29 insertions(+), 13 deletions(-) diff --git a/addon/statusnet/statusnet.css b/addon/statusnet/statusnet.css index 4e27b0938..6c1347fc7 100644 --- a/addon/statusnet/statusnet.css +++ b/addon/statusnet/statusnet.css @@ -12,25 +12,32 @@ } #statusnet-disconnect-label { float: left; - width: 200px; + width: 250px; + margin-bottom: 25px; +} +#statusnet-default-label { + float: left; + width: 250px; margin-bottom: 25px; } #statusnet-disconnect { float: left; } + #statusnet-enable-label { float: left; - width: 200px; + width: 250px; margin-bottom: 5px; } #statusnet-checkbox { float: left; } + #statusnet-pin-label { float: left; - width: 200px; + width: 250px; margin-bottom: 25px; } #statusnet-pin { @@ -40,7 +47,7 @@ #statusnet-consumerkey-label { float: left; - width: 200px; + width: 250px; margin-bottom: 8px; } #statusnet-consumerkey { @@ -49,7 +56,7 @@ } #statusnet-consumersecret-label { float: left; - width: 200px; + width: 250px; margin-bottom: 8px; } #statusnet-consumersecret { @@ -58,7 +65,7 @@ } #statusnet-baseapi-label { float: left; - width: 200px; + width: 250px; margin-bottom: 25px; } #statusnet-baseapi { diff --git a/addon/statusnet/statusnet.php b/addon/statusnet/statusnet.php index 5ed92d13a..ad992f979 100644 --- a/addon/statusnet/statusnet.php +++ b/addon/statusnet/statusnet.php @@ -90,10 +90,11 @@ function statusnet_settings_post ($a,$post) { * if the statusnet-disconnect checkbox is set, clear the statusnet configuration * TODO can we revoke the access tokens at Twitter and do we need to do so? */ - del_pconfig( local_user(), 'statusnet', 'consumerkey' ); - del_pconfig( local_user(), 'statusnet', 'consumersecret' ); - del_pconfig( local_user(), 'statusnet', 'post' ); - del_pconfig( local_user(), 'statusnet', 'oauthtoken' ); + del_pconfig( local_user(), 'statusnet', 'consumerkey' ); + del_pconfig( local_user(), 'statusnet', 'consumersecret' ); + del_pconfig( local_user(), 'statusnet', 'post' ); + del_pconfig( local_user(), 'statusnet', 'post_by_default' ); + del_pconfig( local_user(), 'statusnet', 'oauthtoken' ); del_pconfig( local_user(), 'statusnet', 'oauthsecret' ); del_pconfig( local_user(), 'statusnet', 'baseapi' ); } else { @@ -149,6 +150,8 @@ function statusnet_settings_post ($a,$post) { // if no PIN is supplied in the POST variables, the user has changed the setting // to post a tweet for every new __public__ posting to the wall set_pconfig(local_user(),'statusnet','post',intval($_POST['statusnet-enable'])); + set_pconfig(local_user(),'statusnet','post_by_default',intval($_POST['statusnet-default'])); + notice( t('StatusNet settings updated.') . EOL); }}} } function statusnet_settings(&$a,&$s) { @@ -166,8 +169,10 @@ function statusnet_settings(&$a,&$s) { $csecret = get_pconfig(local_user(), 'statusnet', 'consumersecret' ); $otoken = get_pconfig(local_user(), 'statusnet', 'oauthtoken' ); $osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret' ); - $enabled = get_pconfig(local_user(), 'statusnet', 'post'); + $enabled = get_pconfig(local_user(), 'statusnet', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); + $defenabled = get_pconfig(local_user(),'statusnet','post_by_default'); + $defchecked = (($defenabled) ? ' checked="checked" ' : ''); $s .= '
'; $s .= '

'. t('StatusNet Posting Settings').'

'; @@ -228,11 +233,15 @@ function statusnet_settings(&$a,&$s) { $connection = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret); $details = $connection->get('account/verify_credentials'); $s .= '

'. t('Currently connected to: ') .''.$details->screen_name.'
'.$details->description.'

'; - $s .= '

'. t('If enabled all your public postings will be posted to the associated StatusNet account as well.') .'

'; + $s .= '

'. t('If enabled all your public postings will be posted to the associated StatusNet account.') .'

'; $s .= '
'; - $s .= ''; + $s .= ''; $s .= ''; + $s .= '
'; + $s .= ''; + $s .= ''; $s .= '
'; + $s .= '
'; $s .= ''; $s .= '';