summaryrefslogtreecommitdiff
path: root/plugins/OStatus/actions
diff options
context:
space:
mode:
authorSarven Capadisli <csarven@status.net>2010-02-23 04:59:34 +0100
committerSarven Capadisli <csarven@status.net>2010-02-23 04:59:34 +0100
commitb67bb182b008b5f7b66d39df7bb8dab449b7002a (patch)
treeb51ef300fc53951563ac839c95b17f69c8caa918 /plugins/OStatus/actions
parenta306ac39768ff6cbae4f14b565acf2850c979f8b (diff)
Refactored preview info and form for authorizing a remote subscription
Diffstat (limited to 'plugins/OStatus/actions')
-rw-r--r--plugins/OStatus/actions/ostatussub.php113
1 files changed, 97 insertions, 16 deletions
diff --git a/plugins/OStatus/actions/ostatussub.php b/plugins/OStatus/actions/ostatussub.php
index ffa88cb08..206fb309d 100644
--- a/plugins/OStatus/actions/ostatussub.php
+++ b/plugins/OStatus/actions/ostatussub.php
@@ -87,29 +87,35 @@ class OStatusSubAction extends Action
*/
function showPreviewForm()
{
+ if ($this->oprofile->isGroup()) {
+ $this->previewGroup();
+ } else {
+ $this->previewUser();
+ }
+
+ $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_settings',
+ 'class' => 'form_remote_authorize',
'action' =>
common_local_url('ostatussub')));
-
+ $this->elementStart('fieldset');
$this->hidden('token', common_session_token());
$this->hidden('profile', $this->profile_uri);
-
- $this->elementStart('fieldset', array('id' => 'settings_feeds'));
-
if ($this->oprofile->isGroup()) {
- $this->previewGroup();
- $this->submit('subscribe', _m('Join'));
+ $this->submit('submit', _m('Join'), 'submit', null,
+ _m('Join this group'));
} else {
- $this->previewUser();
- $this->submit('subscribe', _m('Subscribe'));
+ $this->submit('submit', _m('Subscribe'), 'submit', null,
+ _m('Subscribe to this user'));
}
-
-
$this->elementEnd('fieldset');
-
$this->elementEnd('form');
+ $this->elementEnd('li');
+ $this->elementEnd('ul');
+ $this->elementEnd('div');
}
/**
@@ -120,8 +126,7 @@ class OStatusSubAction extends Action
$oprofile = $this->oprofile;
$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;
$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');
}
/**