-
- common_input('twitter_username', _('Twitter Username'),
- ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
- _('No spaces, please.')); // hey, it's what Twitter says
-
- common_password('twitter_password', _('Twitter Password'));
-
- // these checkboxes don't do anything yet
-
- common_checkbox('repost', _('Automatically send my notices to Twitter.'), true);
- common_checkbox('subscribe_friends', _('Subscribe to my Twitter friends here.'), true);
-
- common_submit('submit', _('Save'));
+ common_hidden('token', common_session_token());
+
+ common_element('h2', NULL, _('Twitter Account'));
+
+ if ($fuser) {
+ common_element_start('p');
+
+ common_element('span', 'twitter_user', $fuser->nickname);
+ common_element('a', array('href' => $fuser->uri), $fuser->uri);
+ common_element('span', 'input_instructions',
+ _('Current verified Twitter account.'));
+ common_hidden('flink_foreign_id', $flink->foreign_id);
+ common_element_end('p');
+ common_submit('remove', _('Remove'));
+ } else {
+
+ // XXX: Should we make an educated guess as to the twitter acct name? -- Zach
+ common_input('twitter_username', _('Twitter Username'),
+ ($this->arg('twitter_username')) ? $this->arg('twitter_username') : $profile->nickname,
+ _('No spaces, please.')); // hey, it's what Twitter says
+
+ common_password('twitter_password', _('Twitter Password'));
+ }
+
+ common_element('h2', NULL, _('Preferences'));
+
+ common_checkbox('noticesync', _('Automatically send my notices to Twitter.'),
+ ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND) : true);
+
+ common_checkbox('replysync', _('Send local "@" replies to Twitter.'),
+ ($flink) ? ($flink->noticesync & FOREIGN_NOTICE_SEND_REPLY) : true);
+
+ common_checkbox('friendsync', _('Subscribe to my Twitter friends here.'),
+ ($flink) ? ($flink->friendsync & FOREIGN_FRIEND_RECV) : false,
+ NULL, 'true', true);
+
+ if ($flink) {
+ common_submit('save', _('Save'));
+ } else {
+ common_submit('add', _('Add'));
+ }
+