Refactored preview info and form for authorizing a remote subscription
This commit is contained in:
parent
a306ac3976
commit
b67bb182b0
|
@ -87,29 +87,35 @@ class OStatusSubAction extends Action
|
||||||
*/
|
*/
|
||||||
function showPreviewForm()
|
function showPreviewForm()
|
||||||
{
|
{
|
||||||
$this->elementStart('form', array('method' => 'post',
|
|
||||||
'id' => 'form_ostatus_sub',
|
|
||||||
'class' => 'form_settings',
|
|
||||||
'action' =>
|
|
||||||
common_local_url('ostatussub')));
|
|
||||||
|
|
||||||
$this->hidden('token', common_session_token());
|
|
||||||
$this->hidden('profile', $this->profile_uri);
|
|
||||||
|
|
||||||
$this->elementStart('fieldset', array('id' => 'settings_feeds'));
|
|
||||||
|
|
||||||
if ($this->oprofile->isGroup()) {
|
if ($this->oprofile->isGroup()) {
|
||||||
$this->previewGroup();
|
$this->previewGroup();
|
||||||
$this->submit('subscribe', _m('Join'));
|
|
||||||
} else {
|
} else {
|
||||||
$this->previewUser();
|
$this->previewUser();
|
||||||
$this->submit('subscribe', _m('Subscribe'));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->elementStart('div', 'entity_actions');
|
||||||
|
$this->elementStart('ul');
|
||||||
|
$this->elementStart('li', 'entity_subscribe');
|
||||||
|
$this->elementStart('form', array('method' => 'post',
|
||||||
|
'id' => 'form_ostatus_sub',
|
||||||
|
'class' => 'form_remote_authorize',
|
||||||
|
'action' =>
|
||||||
|
common_local_url('ostatussub')));
|
||||||
|
$this->elementStart('fieldset');
|
||||||
|
$this->hidden('token', common_session_token());
|
||||||
|
$this->hidden('profile', $this->profile_uri);
|
||||||
|
if ($this->oprofile->isGroup()) {
|
||||||
|
$this->submit('submit', _m('Join'), 'submit', null,
|
||||||
|
_m('Join this group'));
|
||||||
|
} else {
|
||||||
|
$this->submit('submit', _m('Subscribe'), 'submit', null,
|
||||||
|
_m('Subscribe to this user'));
|
||||||
|
}
|
||||||
$this->elementEnd('fieldset');
|
$this->elementEnd('fieldset');
|
||||||
|
|
||||||
$this->elementEnd('form');
|
$this->elementEnd('form');
|
||||||
|
$this->elementEnd('li');
|
||||||
|
$this->elementEnd('ul');
|
||||||
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -120,8 +126,7 @@ class OStatusSubAction extends Action
|
||||||
$oprofile = $this->oprofile;
|
$oprofile = $this->oprofile;
|
||||||
$profile = $oprofile->localProfile();
|
$profile = $oprofile->localProfile();
|
||||||
|
|
||||||
$this->text(sprintf(_m("Remote user %s"), $profile->nickname));
|
$this->showEntity($profile);
|
||||||
// ...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,8 +137,84 @@ class OStatusSubAction extends Action
|
||||||
$oprofile = $this->oprofile;
|
$oprofile = $this->oprofile;
|
||||||
$group = $oprofile->localGroup();
|
$group = $oprofile->localGroup();
|
||||||
|
|
||||||
$this->text(sprintf(_m("Remote group %s"), $group->nickname));
|
$this->showEntity($group);
|
||||||
// ..
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function showEntity($entity)
|
||||||
|
{
|
||||||
|
$nickname = $entity->nickname;
|
||||||
|
$profile = $entity->profileurl;
|
||||||
|
$fullname = $entity->fullname;
|
||||||
|
$homepage = $entity->homepage;
|
||||||
|
$bio = $entity->bio;
|
||||||
|
$location = $entity->location;
|
||||||
|
$avatar = $entity->avatarurl;
|
||||||
|
|
||||||
|
$this->elementStart('div', 'entity_profile vcard');
|
||||||
|
$this->elementStart('dl', 'entity_depiction');
|
||||||
|
$this->element('dt', null, _('Photo'));
|
||||||
|
$this->elementStart('dd');
|
||||||
|
if ($avatar) {
|
||||||
|
$this->element('img', array('src' => $avatar,
|
||||||
|
'class' => 'photo avatar',
|
||||||
|
'width' => AVATAR_PROFILE_SIZE,
|
||||||
|
'height' => AVATAR_PROFILE_SIZE,
|
||||||
|
'alt' => $nickname));
|
||||||
|
}
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
|
$this->elementStart('dl', 'entity_nickname');
|
||||||
|
$this->element('dt', null, _('Nickname'));
|
||||||
|
$this->elementStart('dd');
|
||||||
|
$hasFN = ($fullname !== '') ? 'nickname' : 'fn nickname';
|
||||||
|
$this->elementStart('a', array('href' => $profile,
|
||||||
|
'class' => 'url '.$hasFN));
|
||||||
|
$this->raw($nickname);
|
||||||
|
$this->elementEnd('a');
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
|
||||||
|
if (!is_null($fullname)) {
|
||||||
|
$this->elementStart('dl', 'entity_fn');
|
||||||
|
$this->elementStart('dd');
|
||||||
|
$this->elementStart('span', 'fn');
|
||||||
|
$this->raw($fullname);
|
||||||
|
$this->elementEnd('span');
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
}
|
||||||
|
if (!is_null($location)) {
|
||||||
|
$this->elementStart('dl', 'entity_location');
|
||||||
|
$this->element('dt', null, _('Location'));
|
||||||
|
$this->elementStart('dd', 'label');
|
||||||
|
$this->raw($location);
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($homepage)) {
|
||||||
|
$this->elementStart('dl', 'entity_url');
|
||||||
|
$this->element('dt', null, _('URL'));
|
||||||
|
$this->elementStart('dd');
|
||||||
|
$this->elementStart('a', array('href' => $homepage,
|
||||||
|
'class' => 'url'));
|
||||||
|
$this->raw($homepage);
|
||||||
|
$this->elementEnd('a');
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_null($bio)) {
|
||||||
|
$this->elementStart('dl', 'entity_note');
|
||||||
|
$this->element('dt', null, _('Note'));
|
||||||
|
$this->elementStart('dd', 'note');
|
||||||
|
$this->raw($bio);
|
||||||
|
$this->elementEnd('dd');
|
||||||
|
$this->elementEnd('dl');
|
||||||
|
}
|
||||||
|
$this->elementEnd('div');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user