]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/groupmembers.php
Merge branch '0.9.x'
[quix0rs-gnu-social.git] / actions / groupmembers.php
index f16e972a4194a6eee1a0fd60e2c4fad70881b36d..038d1db68a4af6f7fc46378be06385d704635c44 100644 (file)
@@ -77,7 +77,14 @@ class GroupmembersAction extends GroupDesignAction
             return false;
         }
 
-        $this->group = User_group::staticGet('nickname', $nickname);
+        $local = Local_group::staticGet('nickname', $nickname);
+
+        if (!$local) {
+            $this->clientError(_('No such group.'), 404);
+            return false;
+        }
+
+        $this->group = User_group::staticGet('id', $local->group_id);
 
         if (!$this->group) {
             $this->clientError(_('No such group.'), 404);
@@ -90,9 +97,13 @@ class GroupmembersAction extends GroupDesignAction
     function title()
     {
         if ($this->page == 1) {
+            // TRANS: Title of the page showing group members.
+            // TRANS: %s is the name of the group.
             return sprintf(_('%s group members'),
                            $this->group->nickname);
         } else {
+            // TRANS: Title of the page showing group members.
+            // TRANS: %1$s is the name of the group, %2$d is the page number of the members list.
             return sprintf(_('%1$s group members, page %2$d'),
                            $this->group->nickname,
                            $this->page);
@@ -198,13 +209,13 @@ class GroupMemberListItem extends ProfileListItem
             !$this->profile->isAdmin($this->group)) {
             $this->out->elementStart('li', 'entity_make_admin');
             $maf = new MakeAdminForm($this->out, $this->profile, $this->group,
-                                     array('action' => 'groupmembers',
-                                           'nickname' => $this->group->nickname));
+                                     $this->returnToArgs());
             $maf->show();
             $this->out->elementEnd('li');
         }
 
     }
+
     function showGroupBlockForm()
     {
         $user = common_current_user();
@@ -212,12 +223,49 @@ class GroupMemberListItem extends ProfileListItem
         if (!empty($user) && $user->id != $this->profile->id && $user->isAdmin($this->group)) {
             $this->out->elementStart('li', 'entity_block');
             $bf = new GroupBlockForm($this->out, $this->profile, $this->group,
-                                array('action' => 'groupmembers',
-                                      'nickname' => $this->group->nickname));
+                                     $this->returnToArgs());
             $bf->show();
             $this->out->elementEnd('li');
         }
+    }
+
+    function linkAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
 
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] .= ' nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    function homepageAttributes()
+    {
+        $aAttrs = parent::linkAttributes();
+
+        if (common_config('nofollow', 'members')) {
+            $aAttrs['rel'] = 'nofollow';
+        }
+
+        return $aAttrs;
+    }
+
+    /**
+     * Fetch necessary return-to arguments for the profile forms
+     * to return to this list when they're done.
+     * 
+     * @return array
+     */
+    protected function returnToArgs()
+    {
+        $args = array('action' => 'groupmembers',
+                      'nickname' => $this->group->nickname);
+        $page = $this->out->arg('page');
+        if ($page) {
+            $args['param-page'] = $page;
+        }
+        return $args;
     }
 }
 
@@ -345,7 +393,14 @@ class GroupBlockForm extends Form
 
     function formActions()
     {
-        $this->out->submit('submit', _('Block'), 'submit', null, _('Block this user'));
+        $this->out->submit(
+            'submit',
+            // TRANS: Button text for the form that will block a user from a group.
+            _m('BUTTON','Block'),
+            'submit',
+            null,
+            // TRANS: Submit button title.
+            _m('TOOLTIP',_('Block this user'));
     }
 }
 
@@ -472,6 +527,13 @@ class MakeAdminForm extends Form
 
     function formActions()
     {
-        $this->out->submit('submit', _('Make Admin'), 'submit', null, _('Make this user an admin'));
+        $this->out->submit(
+          'submit',
+          // TRANS: Button text for the form that will make a user administrator.
+          _m('BUTTON','Make Admin'),
+          'submit',
+          null,
+          // TRANS: Submit button title.
+          _m('TOOLTIP','Make this user an admin'));
     }
 }