From bf5ae8e69a971b6310641f5a963292a64609d0e8 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Fri, 30 May 2008 13:43:10 -0400 Subject: remotesubscribe form darcs-hash:20080530174310-84dde-1e05966eb48573ced8e73acf3f3b59e7bc4f1170.gz --- actions/remotesubscribe.php | 2 ++ actions/showstream.php | 23 ++++++++++++++++++----- doc/TODO | 14 +++++++++----- lib/common.php | 2 -- lib/util.php | 7 +++++++ 5 files changed, 36 insertions(+), 12 deletions(-) diff --git a/actions/remotesubscribe.php b/actions/remotesubscribe.php index 68f5f0fc3..29e62c3e9 100644 --- a/actions/remotesubscribe.php +++ b/actions/remotesubscribe.php @@ -41,12 +41,14 @@ class RemotesubscribeAction extends Action { } function show_form($err=NULL) { + $nickname = $this->trimmed('nickname'); common_show_header(_t('Remote subscribe')); if ($err) { common_element('div', 'error', $err); } common_element_start('form', array('id' => 'remotesubscribe', 'method' => 'POST', 'action' => common_local_url('remotesubscribe'))); + common_input('nickname', _t('User nickname'), $nickname); common_input('profile', _t('Profile URL')); common_submit('submit', _t('Subscribe')); common_element_end('form'); diff --git a/actions/showstream.php b/actions/showstream.php index 7bdc7c679..a4c476534 100644 --- a/actions/showstream.php +++ b/actions/showstream.php @@ -88,12 +88,16 @@ class ShowstreamAction extends StreamAction { $cur = common_current_user(); - if ($cur && $cur->id != $profile->id) { - if ($cur->isSubscribed($profile)) { - $this->show_unsubscribe_form($profile); - } else { - $this->show_subscribe_form($profile); + if ($cur) { + if ($cur->id != $profile->id) { + if ($cur->isSubscribed($profile)) { + $this->show_unsubscribe_form($profile); + } else { + $this->show_subscribe_form($profile); + } } + } else { + $this->show_remote_subscribe_form($profile); } $this->show_statistics($profile); @@ -146,6 +150,15 @@ class ShowstreamAction extends StreamAction { common_element_end('form'); } + function show_remote_subscribe_form($profile) { + common_element_start('form', array('id' => 'remotesubscribe', 'method' => 'POST', + 'action' => common_local_url('remotesubscribe'))); + common_hidden('nickname', $profile->nickname); + common_input('profile', _t('Profile')); + common_submit('submit',_t('Subscribe')); + common_element_end('form'); + } + function show_unsubscribe_form($profile) { common_element_start('form', array('id' => 'unsubscribe', 'method' => 'POST', 'action' => common_local_url('unsubscribe'))); diff --git a/doc/TODO b/doc/TODO index 6c4996709..10a072a87 100644 --- a/doc/TODO +++ b/doc/TODO @@ -60,8 +60,8 @@ - server side of user authorization - server side of request token - server side of access token -- OAuth store -- log of consumers who ask for access ++ OAuth store ++ log of consumers who ask for access - receive remote notice - send remote notice - subscribe form for not-logged-in users on showstream @@ -83,10 +83,12 @@ + add a next page link to all - AGPL notification - Check licenses of all libraries for compatibility -- gettext ++ @ messages ++ Automatically linkify URLs in notices - release 0.3 +- email notification on subscriptions +- gettext - license per notice -- Automatically linkify URLs in notices - tinyurl-ification of URLs - use only canonical email addresses - allow mixed-case usernames @@ -98,6 +100,8 @@ - theme per site - theme per profile - email confirmation for registration +- email options +- email newsletter - change cookie handling for anon users to be more cache-friendly - jQuery for as much as possible - content negotiation for interface language @@ -114,7 +118,6 @@ - RDFa for stream pages - RDFa for subscriber pages - RDFa for subscribed pages -- @ messages - # tags - L: location - hreviews @@ -134,6 +137,7 @@ - receive notices from mobile phone - machine tags - release 0.6 +- OAuth for third-party tools (desktop, other sites) - Twitter-compatible API - Pownce-compatible API - include twitter subscriptions (push and pull) diff --git a/lib/common.php b/lib/common.php index 1954dfc2a..6ff40ab5f 100644 --- a/lib/common.php +++ b/lib/common.php @@ -17,8 +17,6 @@ * along with this program. If not, see . */ -/* XXX: break up into separate modules (HTTP, HTML, user, files) */ - if (!defined('LACONICA')) { exit(1); } define('AVATAR_PROFILE_SIZE', 96); diff --git a/lib/util.php b/lib/util.php index 72876cef7..126801126 100644 --- a/lib/util.php +++ b/lib/util.php @@ -238,6 +238,13 @@ function common_input($id, $label, $value=NULL) { common_element_end('p'); } +function common_hidden($id, $value) { + common_element('input', array('name' => $id, + 'type' => 'hidden', + 'id' => $id, + 'value' => $value)); +} + function common_password($id, $label) { common_element_start('p'); common_element('label', array('for' => $id), $label); -- cgit v1.2.3-54-g00ecf