Merge branch 'testing' of git@gitorious.org:statusnet/mainline into testing
This commit is contained in:
commit
cea7d8018a
10
EVENTS.txt
10
EVENTS.txt
|
@ -1,4 +1,4 @@
|
|||
InitializePlugin: a chance to initialize a plugin in a complete environment
|
||||
\InitializePlugin: a chance to initialize a plugin in a complete environment
|
||||
|
||||
CleanupPlugin: a chance to cleanup a plugin at the end of a program
|
||||
|
||||
|
@ -355,6 +355,14 @@ EndShowHeadElements: Right before the </head> tag; put <script>s here if you nee
|
|||
|
||||
CheckSchema: chance to check the schema
|
||||
|
||||
StartProfileRemoteSubscribe: Before showing the link to remote subscription
|
||||
- $userprofile: UserProfile widget
|
||||
- &$profile: the profile being shown
|
||||
|
||||
EndProfileRemoteSubscribe: After showing the link to remote subscription
|
||||
- $userprofile: UserProfile widget
|
||||
- &$profile: the profile being shown
|
||||
|
||||
StartProfilePageProfileSection: Starting to show the section of the
|
||||
profile page with the actual profile data;
|
||||
hook to prevent showing the profile (e.g.)
|
||||
|
|
|
@ -238,9 +238,12 @@ class UserProfile extends Widget
|
|||
|
||||
if (Event::handle('StartProfilePageActionsElements', array(&$this->out, $this->profile))) {
|
||||
if (empty($cur)) { // not logged in
|
||||
if (Event::handle('StartProfileRemoteSubscribe', array(&$this->out, $this->profile))) {
|
||||
$this->out->elementStart('li', 'entity_subscribe');
|
||||
$this->showRemoteSubscribeLink();
|
||||
$this->out->elementEnd('li');
|
||||
Event::handle('EndProfileRemoteSubscribe', array(&$this->out, $this->profile));
|
||||
}
|
||||
} else {
|
||||
if ($cur->id == $this->profile->id) { // your own page
|
||||
$this->out->elementStart('li', 'entity_edit');
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -272,4 +274,14 @@ 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;
|
||||
}
|
||||
|
||||
function onEndShowStatusNetScripts($action) {
|
||||
$action->script(common_path('plugins/OStatus/js/ostatus.js'));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,8 +68,20 @@ class OStatusInitAction extends Action
|
|||
function showForm($err = null)
|
||||
{
|
||||
$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()
|
||||
|
@ -79,15 +91,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');
|
||||
|
|
|
@ -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');
|
||||
|
|
60
plugins/OStatus/js/ostatus.js
Normal file
60
plugins/OStatus/js/ostatus.js
Normal file
|
@ -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('<button class="close">×</button>');
|
||||
|
||||
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();
|
||||
}
|
||||
});
|
30
plugins/OStatus/theme/base/css/ostatus.css
Normal file
30
plugins/OStatus/theme/base/css/ostatus.css
Normal file
|
@ -0,0 +1,30 @@
|
|||
/** theme: base for OStatus
|
||||
*
|
||||
* @package StatusNet
|
||||
* @author Sarven Capadisli <csarven@status.net>
|
||||
* @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;
|
||||
}
|
Loading…
Reference in New Issue
Block a user