From e0fbf02bbf516db10070bddaabbbaea31d336cda Mon Sep 17 00:00:00 2001 From: Zach Copley Date: Sun, 4 Jan 2009 23:02:12 -0500 Subject: trac750 configurable sync flags for Facebook app (noticesync, replysync) darcs-hash:20090105040212-7b5ce-37f6195649dc673241e4566a93183b13e428d98f.gz --- actions/facebooksettings.php | 66 +++++++++++++++++++++++++++++++++++++++----- 1 file changed, 59 insertions(+), 7 deletions(-) (limited to 'actions/facebooksettings.php') diff --git a/actions/facebooksettings.php b/actions/facebooksettings.php index 17812850c..469bcfc45 100644 --- a/actions/facebooksettings.php +++ b/actions/facebooksettings.php @@ -28,30 +28,82 @@ class FacebooksettingsAction extends FacebookAction { parent::handle($args); - $this->display(); + if ($this->arg('save')) { + $this->save_settings(); + } else { + $this->show_form(); + } } - function display() - { + + function save_settings() { + + $noticesync = $this->arg('noticesync'); + $replysync = $this->arg('replysync'); $facebook = get_facebook(); + $fbuid = $facebook->require_login(); + + $flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook + + $original = clone($flink); + $flink->set_flags($noticesync, $replysync, false); + $result = $flink->update($original); + + if ($result) { + echo ''; + } + + $this->show_form(); + + } + + function show_form() { + $facebook = get_facebook(); $fbuid = $facebook->require_login(); + $flink = Foreign_link::getByForeignID($fbuid, 2); // 2 == Facebook + + $this->show_header('Settings'); + $fbml = '' - .'

Add an Identi.ca box to your profile!

' + .'

Add an Identi.ca box to my profile

' .'' .'
'; - $fbml .= '

Allow Identi.ca to update my Facebook status

'; - $this->show_header('Settings'); + $fbml .= '
' + .'

Sync preferences

' + .'

'; + + if ($flink->noticesync & FOREIGN_NOTICE_SEND) { + $fbml .= ''; + } else { + $fbml .= ''; + } + + $fbml .= '' + .'

' + .'

'; + + if ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) { + $fbml .= ''; + } else { + $fbml .= ''; + } + + $fbml .= '' + .'

' + .'

' + .'' + .'

' + .'
'; echo $fbml; $this->show_footer(); - } } -- cgit v1.2.3-54-g00ecf