]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/tagprofile.php
Initial move towards microformats2
[quix0rs-gnu-social.git] / actions / tagprofile.php
index 8c0e039dd6029dd1499fb53501c1f4a806b27744..a79ebf1d2563822ee9bec9d1b17b3fa01ac770e9 100644 (file)
@@ -41,19 +41,19 @@ class TagprofileAction extends Action
         if (!$id) {
             $this->profile = false;
         } else {
-            $this->profile = Profile::staticGet('id', $id);
+            $this->profile = Profile::getKV('id', $id);
 
             if (!$this->profile) {
+                // TRANS: Client error displayed when referring to non-existing profile ID.
                 $this->clientError(_('No profile with that ID.'));
-                return false;
             }
         }
 
         $current = common_current_user()->getProfile();
         if ($this->profile && !$current->canTag($this->profile)) {
+            // TRANS: Client error displayed when trying to tag a user that cannot be tagged.
             $this->clientError(_('You cannot tag this user.'));
         }
-        return true;
     }
 
     function handle($args)
@@ -72,9 +72,12 @@ class TagprofileAction extends Action
     function title()
     {
         if (!$this->profile) {
-            return _('Tag a profile');
+            // TRANS: Title for list form when not on a profile page.
+            return _('List a profile');
         }
-        return sprintf(_('Tag %s'), $this->profile->nickname);
+        // TRANS: Title for list form when on a profile page.
+        // TRANS: %s is a profile nickname.
+        return sprintf(_m('ADDTOLIST','List %s'), $this->profile->nickname);
     }
 
     function showForm($error=null)
@@ -83,12 +86,13 @@ class TagprofileAction extends Action
         if ($this->boolean('ajax')) {
             $this->startHTML('text/xml;charset=utf-8');
             $this->elementStart('head');
-            $this->element('title', null, _('Error'));
+            // TRANS: Title for list form when an error has occurred.
+            $this->element('title', null, _m('TITLE','Error'));
             $this->elementEnd('head');
             $this->elementStart('body');
             $this->element('p', 'error', $error);
             $this->elementEnd('body');
-            $this->elementEnd('html');
+            $this->endHTML();
         } else {
             $this->showPage();
         }
@@ -97,11 +101,12 @@ class TagprofileAction extends Action
     function showContent()
     {
         if (Event::handle('StartShowTagProfileForm', array($this, $this->profile)) && $this->profile) {
-            $this->elementStart('div', 'entity_profile vcard author');
+            $this->elementStart('div', 'entity_profile h-card p-author');
+            // TRANS: Header in list form.
             $this->element('h2', null, _('User profile'));
 
-            $avatar = $this->profile->getAvatar(AVATAR_PROFILE_SIZE);
-            $this->element('img', array('src' => ($avatar) ? $avatar->displayUrl() : Avatar::defaultImage(AVATAR_PROFILE_SIZE),
+            $avatarUrl = $this->profile->avatarUrl(AVATAR_PROFILE_SIZE);
+            $this->element('img', array('src' => $avatarUrl,
                                         'class' => 'photo avatar entity_depiction',
                                         'width' => AVATAR_PROFILE_SIZE,
                                         'height' => AVATAR_PROFILE_SIZE,
@@ -113,7 +118,7 @@ class TagprofileAction extends Action
                                       'class' => 'entity_nickname nickname'),
                            $this->profile->nickname);
             if ($this->profile->fullname) {
-                $this->element('div', 'fn entity_fn', $this->profile->fullname);
+                $this->element('div', 'p-name entity_fn', $this->profile->fullname);
             }
 
             if ($this->profile->location) {
@@ -123,7 +128,7 @@ class TagprofileAction extends Action
             if ($this->profile->homepage) {
                 $this->element('a', array('href' => $this->profile->homepage,
                                           'rel' => 'me',
-                                          'class' => 'url entity_url'),
+                                          'class' => 'u-url entity_url'),
                                $this->profile->homepage);
             }
 
@@ -140,7 +145,8 @@ class TagprofileAction extends Action
                                                'action' => common_local_url('tagprofile', array('id' => $this->profile->id))));
 
             $this->elementStart('fieldset');
-            $this->element('legend', null, _('Tag user'));
+            // TRANS: Fieldset legend for list form.
+            $this->element('legend', null, _('List user'));
             $this->hidden('token', common_session_token());
             $this->hidden('id', $this->profile->id);
 
@@ -150,12 +156,15 @@ class TagprofileAction extends Action
             $this->elementStart('li');
 
             $tags = Profile_tag::getTagsArray($user->id, $this->profile->id, $user->id);
-            $this->input('tags', _('Tags'),
+            // TRANS: Field label on list form.
+            $this->input('tags', _m('LABEL','Lists'),
                          ($this->arg('tags')) ? $this->arg('tags') : implode(' ', $tags),
-                         _('Tags for this user (letters, numbers, -, ., and _), comma- or space- separated'));
+                         // TRANS: Field title on list form.
+                         _('Lists for this user (letters, numbers, -, ., and _), comma- or space- separated.'));
             $this->elementEnd('li');
             $this->elementEnd('ul');
-            $this->submit('save', _('Save'));
+            // TRANS: Button text to save lists.
+            $this->submit('save', _m('BUTTON','Save'));
             $this->elementEnd('fieldset');
             $this->elementEnd('form');
 
@@ -171,6 +180,7 @@ class TagprofileAction extends Action
 
         if (Event::handle('StartSavePeopletags', array($this, $tagstring))) {
             if (!$token || $token != common_session_token()) {
+                // TRANS: Client error displayed when the session token does not match or is not given.
                 $this->showForm(_('There was a problem with your session token. '.
                                   'Try again, please.'));
                 return;
@@ -188,7 +198,9 @@ class TagprofileAction extends Action
 
                     $tag = common_canonical_tag($tag);
                     if (!common_valid_profile_tag($tag)) {
-                        $this->showForm(sprintf(_('Invalid tag: "%s"'), $tag));
+                        // TRANS: Form validation error displayed if a given tag is invalid.
+                        // TRANS: %s is the invalid tag.
+                        $this->showForm(sprintf(_('Invalid tag: "%s".'), $tag));
                         return;
                     }
 
@@ -211,7 +223,7 @@ class TagprofileAction extends Action
             if ($this->boolean('ajax')) {
                 $this->startHTML('text/xml;charset=utf-8');
                 $this->elementStart('head');
-                $this->element('title', null, _('Tags'));
+                $this->element('title', null, _m('TITLE','Tags'));
                 $this->elementEnd('head');
                 $this->elementStart('body');
 
@@ -224,9 +236,10 @@ class TagprofileAction extends Action
                 }
 
                 $this->elementEnd('body');
-                $this->elementEnd('html');
+                $this->endHTML();
             } else {
-                $this->error = 'Tags saved.';
+                // TRANS: Success message if lists are saved.
+                $this->error = _('Lists saved.');
                 $this->showForm();
             }
 
@@ -241,9 +254,9 @@ class TagprofileAction extends Action
         } else {
             $this->elementStart('div', 'instructions');
             $this->element('p', null,
-                           _('Use this form to add tags to your subscribers or subscriptions.'));
+                           // TRANS: Page notice.
+                           _('Use this form to add your subscribers or subscriptions to lists.'));
             $this->elementEnd('div');
         }
     }
 }
-