]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Refactored preview info and form for authorizing a remote subscription
authorSarven Capadisli <csarven@status.net>
Tue, 23 Feb 2010 03:59:34 +0000 (04:59 +0100)
committerSarven Capadisli <csarven@status.net>
Tue, 23 Feb 2010 03:59:34 +0000 (04:59 +0100)
plugins/OStatus/actions/ostatussub.php

index ffa88cb0884f335c06c8bf8bf254dc2fb22105b4..206fb309d2bbeb845683cde36dde8826c2ecfd33 100644 (file)
@@ -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');
     }
 
     /**