From f6e766d5acd4d9ca8e9bea30f1c00762ac193bd4 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 18:42:00 +0100 Subject: Using the new remote subscription event and updated subscribe label --- plugins/OStatus/OStatusPlugin.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index bf7dde296..0e05a75cd 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -188,7 +188,7 @@ class OStatusPlugin extends Plugin /** * Add in an OStatus subscribe button */ - function onStartProfilePageActionsElements($output, $profile) + function onStartProfileRemoteSubscribe($output, $profile) { $cur = common_current_user(); @@ -199,10 +199,12 @@ class OStatusPlugin extends Plugin array('nickname' => $profile->nickname)); $output->element('a', array('href' => $url, 'class' => 'entity_remote_subscribe'), - _m('OStatus')); + _m('Subscribe')); $output->elementEnd('li'); } + + return false; } /** -- cgit v1.2.3-54-g00ecf From 24394269fa7d89c556835ebb55afd5b4c8400059 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 18:44:41 +0100 Subject: Updated OStatus form markup --- plugins/OStatus/actions/ostatusinit.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php index bac2c4d43..11f81ecb9 100644 --- a/plugins/OStatus/actions/ostatusinit.php +++ b/plugins/OStatus/actions/ostatusinit.php @@ -79,15 +79,15 @@ class OStatusInitAction extends Action 'class' => 'form_settings', 'action' => common_local_url('ostatusinit'))); $this->elementStart('fieldset'); - $this->element('legend', _('Subscribe to a remote user')); + $this->element('legend', null, sprintf(_('Subscribe to %s'), $this->nickname)); $this->hidden('token', common_session_token()); $this->elementStart('ul', 'form_data'); - $this->elementStart('li'); + $this->elementStart('li', array('id' => 'ostatus_nickname')); $this->input('nickname', _('User nickname'), $this->nickname, _('Nickname of the user you want to follow')); $this->elementEnd('li'); - $this->elementStart('li'); + $this->elementStart('li', array('id' => 'ostatus_profile')); $this->input('acct', _('Profile Account'), $this->acct, _('Your account id (i.e. user@identi.ca)')); $this->elementEnd('li'); @@ -95,7 +95,7 @@ class OStatusInitAction extends Action $this->submit('submit', _('Subscribe')); $this->elementEnd('fieldset'); $this->elementEnd('form'); - } + } function ostatusConnect() { @@ -125,4 +125,4 @@ class OStatusInitAction extends Action return _('OStatus Connect'); } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf From f30af7047b0131f4a7e6ed9c77f49fe5c113ea59 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 18:46:10 +0100 Subject: Updated feed subscription form markup --- plugins/OStatus/actions/ostatussub.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php index 9774286fd..239122501 100644 --- a/plugins/OStatus/actions/ostatussub.php +++ b/plugins/OStatus/actions/ostatussub.php @@ -76,7 +76,7 @@ class OStatusSubAction extends Action $this->elementStart('fieldset', array('id' => 'settings_feeds')); $this->elementStart('ul', 'form_data'); - $this->elementStart('li', array('id' => 'settings_twitter_login_button')); + $this->elementStart('li'); $this->input('feedurl', _('Feed URL'), $this->feedurl, _('Enter the URL of a PubSubHubbub-enabled feed')); $this->elementEnd('li'); $this->elementEnd('ul'); @@ -223,4 +223,4 @@ class OStatusSubAction extends Action } -} \ No newline at end of file +} -- cgit v1.2.3-54-g00ecf From 4d050f96f3b6c43ed74521d7a7215676cda6835e Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 18:49:14 +0100 Subject: Added XHR channel for OStatus Subscribe button --- plugins/OStatus/actions/ostatusinit.php | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/actions/ostatusinit.php b/plugins/OStatus/actions/ostatusinit.php index 11f81ecb9..d21774420 100644 --- a/plugins/OStatus/actions/ostatusinit.php +++ b/plugins/OStatus/actions/ostatusinit.php @@ -67,9 +67,21 @@ class OStatusInitAction extends Action function showForm($err = null) { - $this->err = $err; - $this->showPage(); - + $this->err = $err; + if ($this->boolean('ajax')) { + header('Content-Type: text/xml;charset=utf-8'); + $this->xw->startDocument('1.0', 'UTF-8'); + $this->elementStart('html'); + $this->elementStart('head'); + $this->element('title', null, _('Subscribe to user')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showContent(); + $this->elementEnd('body'); + $this->elementEnd('html'); + } else { + $this->showPage(); + } } function showContent() -- cgit v1.2.3-54-g00ecf From 1cb94e0be63f16d85bb5e9c4a8f6791caf91c8c5 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 19:07:21 +0100 Subject: Added dialogbox styles for OStatus subscribe form --- plugins/OStatus/OStatusPlugin.php | 5 +++++ plugins/OStatus/theme/base/css/ostatus.css | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 plugins/OStatus/theme/base/css/ostatus.css (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 0e05a75cd..e84d68504 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -274,4 +274,9 @@ class OStatusPlugin extends Plugin $schema->ensureTable('hubsub', HubSub::schemaDef()); return true; } + + function onEndShowStatusNetStyles($action) { + $action->cssLink(common_path('plugins/OStatus/theme/base/css/ostatus.css')); + return true; + } } diff --git a/plugins/OStatus/theme/base/css/ostatus.css b/plugins/OStatus/theme/base/css/ostatus.css new file mode 100644 index 000000000..9bc90a731 --- /dev/null +++ b/plugins/OStatus/theme/base/css/ostatus.css @@ -0,0 +1,30 @@ +/** theme: base for OStatus + * + * @package StatusNet + * @author Sarven Capadisli + * @copyright 2010 StatusNet, Inc. + * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0 + * @link http://status.net/ + */ + +#form_ostatus_connect.dialogbox { +width:70%; +background-image:none; +} +#form_ostatus_connect.dialogbox .form_data label { +width:34%; +} +#form_ostatus_connect.dialogbox .form_data input { +width:57%; +} +#form_ostatus_connect.dialogbox .form_data .form_guide { +margin-left:36%; +} + +#form_ostatus_connect.dialogbox #ostatus_nickname { +display:none; +} + +#form_ostatus_connect.dialogbox .submit_dialogbox { +min-width:96px; +} -- cgit v1.2.3-54-g00ecf From 171bf3093a4cf3f3ff0b4d255392ffd5375e4c36 Mon Sep 17 00:00:00 2001 From: Sarven Capadisli Date: Sat, 13 Feb 2010 20:28:05 +0100 Subject: Dialogbox for OStatus remote subscription --- plugins/OStatus/OStatusPlugin.php | 5 ++++ plugins/OStatus/js/ostatus.js | 60 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 plugins/OStatus/js/ostatus.js (limited to 'plugins/OStatus') diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index e84d68504..276ca1b3d 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -279,4 +279,9 @@ class OStatusPlugin extends Plugin $action->cssLink(common_path('plugins/OStatus/theme/base/css/ostatus.css')); return true; } + + function onEndShowStatusNetScripts($action) { + $action->script(common_path('plugins/OStatus/js/ostatus.js')); + return true; + } } diff --git a/plugins/OStatus/js/ostatus.js b/plugins/OStatus/js/ostatus.js new file mode 100644 index 000000000..671795558 --- /dev/null +++ b/plugins/OStatus/js/ostatus.js @@ -0,0 +1,60 @@ +SN.U.DialogBox = { + Subscribe: function(a) { + var f = a.parent().find('#form_ostatus_connect'); + if (f.length > 0) { + f.show(); + } + else { + $.ajax({ + type: 'GET', + dataType: 'xml', + url: a[0].href+'&ajax=1', + beforeSend: function(formData) { + a.addClass('processing'); + }, + error: function (xhr, textStatus, errorThrown) { + alert(errorThrown || textStatus); + }, + success: function(data, textStatus, xhr) { + if (typeof($('form', data)[0]) != 'undefined') { + a.after(document._importNode($('form', data)[0], true)); + + var form = a.parent().find('#form_ostatus_connect'); + + form + .addClass('dialogbox') + .append(''); + + form + .find('.submit') + .addClass('submit_dialogbox') + .removeClass('submit') + .bind('click', function() { + form.addClass('processing'); + }); + + form.find('button.close').click(function(){ + form.hide(); + + return false; + }); + + form.find('#acct').focus(); + } + + a.removeClass('processing'); + } + }); + } + } +}; + +SN.Init.Subscribe = function() { + $('.entity_subscribe a').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; }); +}; + +$(document).ready(function() { + if ($('.entity_subscribe .entity_remote_subscribe').length > 0) { + SN.Init.Subscribe(); + } +}); -- cgit v1.2.3-54-g00ecf