diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/OStatusPlugin.php | 17 | ||||
-rw-r--r-- | plugins/OStatus/actions/ostatussub.php | 33 | ||||
-rw-r--r-- | plugins/OStatus/js/ostatus.js | 14 | ||||
-rw-r--r-- | plugins/OStatus/theme/base/css/ostatus.css | 30 |
4 files changed, 72 insertions, 22 deletions
diff --git a/plugins/OStatus/OStatusPlugin.php b/plugins/OStatus/OStatusPlugin.php index 7133e43a3..7c6c0c69f 100644 --- a/plugins/OStatus/OStatusPlugin.php +++ b/plugins/OStatus/OStatusPlugin.php @@ -499,4 +499,21 @@ class OStatusPlugin extends Plugin } return true; } + + function onStartShowSubscriptionsContent($action) + { + $user = common_current_user(); + if ($user && ($user->id == $action->profile->id)) { + $action->elementStart('div', 'entity_actions'); + $action->elementStart('p', array('id' => 'entity_remote_subscribe', + 'class' => 'entity_subscribe')); + $action->element('a', array('href' => common_local_url('ostatussub'), + 'class' => 'entity_remote_subscribe') + , _m('Subscribe to remote user')); + $action->elementEnd('p'); + $action->elementEnd('div'); + } + + return true; + } } diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php index bbbd1b7e6..95dec19af 100644 --- a/plugins/OStatus/actions/ostatussub.php +++ b/plugins/OStatus/actions/ostatussub.php @@ -55,7 +55,27 @@ class OStatusSubAction extends Action function showForm($error=null) { $this->error = $error; - $this->showPage(); + 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, _m('Subscribe to user')); + $this->elementEnd('head'); + $this->elementStart('body'); + $this->showContent(); + $this->elementEnd('body'); + $this->elementEnd('html'); + } else { + $this->showPage(); + } + } + + function showPageNotice() + { + if ($this->error) { + $this->element('p', 'error', $this->error); + } } /** @@ -69,17 +89,12 @@ class OStatusSubAction extends Action function showContent() { - // @fixme is this right place? - if ($this->error) { - $this->text($this->error); - } - $user = common_current_user(); $profile = $user->getProfile(); $this->elementStart('form', array('method' => 'post', - 'id' => 'ostatus_sub', + 'id' => 'form_ostatus_sub', 'class' => 'form_settings', 'action' => common_local_url('ostatussub'))); @@ -139,7 +154,7 @@ class OStatusSubAction extends Action if ($this->profile_uri) { $this->validateAndPreview(); } else { - $this->showPage(); + $this->showForm(); } } } @@ -255,7 +270,7 @@ class OStatusSubAction extends Action { if ($this->validateFeed()) { $this->preview = true; - $this->showForm(_m('Previewing feed:')); + $this->showForm(); } } diff --git a/plugins/OStatus/js/ostatus.js b/plugins/OStatus/js/ostatus.js index 671795558..4b4c32910 100644 --- a/plugins/OStatus/js/ostatus.js +++ b/plugins/OStatus/js/ostatus.js @@ -1,14 +1,15 @@ SN.U.DialogBox = { Subscribe: function(a) { - var f = a.parent().find('#form_ostatus_connect'); + var f = a.parent().find('.form_settings'); if (f.length > 0) { f.show(); } else { + a[0].href = (a[0].href.match(/[\\?]/) == null) ? a[0].href+'?' : a[0].href+'&'; $.ajax({ type: 'GET', dataType: 'xml', - url: a[0].href+'&ajax=1', + url: a[0].href+'ajax=1', beforeSend: function(formData) { a.addClass('processing'); }, @@ -19,7 +20,7 @@ SN.U.DialogBox = { if (typeof($('form', data)[0]) != 'undefined') { a.after(document._importNode($('form', data)[0], true)); - var form = a.parent().find('#form_ostatus_connect'); + var form = a.parent().find('.form_settings'); form .addClass('dialogbox') @@ -40,6 +41,7 @@ SN.U.DialogBox = { }); form.find('#acct').focus(); + form.find('#profile').focus(); } a.removeClass('processing'); @@ -50,11 +52,9 @@ SN.U.DialogBox = { }; SN.Init.Subscribe = function() { - $('.entity_subscribe a').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; }); + $('.entity_subscribe .entity_remote_subscribe').live('click', function() { SN.U.DialogBox.Subscribe($(this)); return false; }); }; $(document).ready(function() { - if ($('.entity_subscribe .entity_remote_subscribe').length > 0) { - SN.Init.Subscribe(); - } + SN.Init.Subscribe(); }); diff --git a/plugins/OStatus/theme/base/css/ostatus.css b/plugins/OStatus/theme/base/css/ostatus.css index 9bc90a731..feeeb47d3 100644 --- a/plugins/OStatus/theme/base/css/ostatus.css +++ b/plugins/OStatus/theme/base/css/ostatus.css @@ -7,24 +7,42 @@ * @link http://status.net/ */ -#form_ostatus_connect.dialogbox { +#form_ostatus_connect.dialogbox, +#form_ostatus_sub.dialogbox { width:70%; background-image:none; } -#form_ostatus_connect.dialogbox .form_data label { +#form_ostatus_sub.dialogbox { +width:65%; +} +#form_ostatus_connect.dialogbox .form_data label, +#form_ostatus_sub.dialogbox .form_data label { width:34%; } -#form_ostatus_connect.dialogbox .form_data input { +#form_ostatus_connect.dialogbox .form_data input, +#form_ostatus_sub.dialogbox .form_data input { width:57%; } -#form_ostatus_connect.dialogbox .form_data .form_guide { +#form_ostatus_connect.dialogbox .form_data .form_guide, +#form_ostatus_sub.dialogbox .form_data .form_guide { margin-left:36%; } -#form_ostatus_connect.dialogbox #ostatus_nickname { +#form_ostatus_connect.dialogbox #ostatus_nickname, +#form_ostatus_sub.dialogbox #ostatus_nickname { display:none; } -#form_ostatus_connect.dialogbox .submit_dialogbox { +#form_ostatus_connect.dialogbox .submit_dialogbox, +#form_ostatus_sub.dialogbox .submit_dialogbox { min-width:96px; } + +#subscriptions #entity_remote_subscribe { +padding:0; +float:right; +} + +#subscriptions .entity_remote_subscribe { +float:right; +} |