]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showgroup.php
add bookmarklet to main help
[quix0rs-gnu-social.git] / actions / showgroup.php
index c2cd3d295956c2bcc323508409691a301a9db397..79445851f923b1b6f41352a546ca6b3bb0cf47f2 100644 (file)
@@ -73,11 +73,17 @@ class ShowgroupAction extends Action
 
     function title()
     {
+        if (!empty($this->group->fullname)) {
+            $base = $this->group->fullname . ' (' . $this->group->nickname . ')';
+        } else {
+            $base = $this->group->nickname;
+        }
+
         if ($this->page == 1) {
-            return sprintf(_("%s group"), $this->group->nickname);
+            return sprintf(_("%s group"), $base);
         } else {
             return sprintf(_("%s group, page %d"),
-                           $this->group->nickname,
+                           $base,
                            $this->page);
         }
     }
@@ -129,6 +135,8 @@ class ShowgroupAction extends Action
             return false;
         }
 
+        common_set_returnto($this->selfUrl());
+
         return true;
     }
 
@@ -146,6 +154,12 @@ class ShowgroupAction extends Action
         $this->showPage();
     }
 
+    /**
+     * Local menu
+     *
+     * @return void
+     */
+
     function showLocalNav()
     {
         $nav = new GroupNav($this, $this->group);
@@ -195,13 +209,12 @@ class ShowgroupAction extends Action
 
     function showGroupProfile()
     {
-        $this->elementStart('div', array('id' => 'group_profile',
-                                         'class' => 'vcard author'));
+        $this->elementStart('div', 'entity_profile vcard author');
 
         $this->element('h2', null, _('Group profile'));
 
-        $this->elementStart('dl', 'group_depiction');
-        $this->element('dt', null, _('Photo'));
+        $this->elementStart('dl', 'entity_depiction');
+        $this->element('dt', null, _('Avatar'));
         $this->elementStart('dd');
 
         $logo = ($this->group->homepage_logo) ?
@@ -215,10 +228,10 @@ class ShowgroupAction extends Action
         $this->elementEnd('dd');
         $this->elementEnd('dl');
 
-        $this->elementStart('dl', 'group_nickname');
+        $this->elementStart('dl', 'entity_nickname');
         $this->element('dt', null, _('Nickname'));
         $this->elementStart('dd');
-        $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn nickname url uid';
+        $hasFN = ($this->group->fullname) ? 'nickname url uid' : 'fn org nickname url uid';
         $this->element('a', array('href' => $this->group->homeUrl(),
                                   'rel' => 'me', 'class' => $hasFN),
                             $this->group->nickname);
@@ -226,23 +239,23 @@ class ShowgroupAction extends Action
         $this->elementEnd('dl');
 
         if ($this->group->fullname) {
-            $this->elementStart('dl', 'group_fn');
+            $this->elementStart('dl', 'entity_fn');
             $this->element('dt', null, _('Full name'));
             $this->elementStart('dd');
-            $this->element('span', 'fn', $this->group->fullname);
+            $this->element('span', 'fn org', $this->group->fullname);
             $this->elementEnd('dd');
             $this->elementEnd('dl');
         }
 
         if ($this->group->location) {
-            $this->elementStart('dl', 'group_location');
+            $this->elementStart('dl', 'entity_location');
             $this->element('dt', null, _('Location'));
-            $this->element('dd', 'location', $this->group->location);
+            $this->element('dd', 'label', $this->group->location);
             $this->elementEnd('dl');
         }
 
         if ($this->group->homepage) {
-            $this->elementStart('dl', 'group_url');
+            $this->elementStart('dl', 'entity_url');
             $this->element('dt', null, _('URL'));
             $this->elementStart('dd');
             $this->element('a', array('href' => $this->group->homepage,
@@ -253,7 +266,7 @@ class ShowgroupAction extends Action
         }
 
         if ($this->group->description) {
-            $this->elementStart('dl', 'group_note');
+            $this->elementStart('dl', 'entity_note');
             $this->element('dt', null, _('Note'));
             $this->element('dd', 'note', $this->group->description);
             $this->elementEnd('dl');
@@ -261,10 +274,10 @@ class ShowgroupAction extends Action
 
         $this->elementEnd('div');
 
-        $this->elementStart('div', array('id' => 'group_actions'));
+        $this->elementStart('div', 'entity_actions');
         $this->element('h2', null, _('Group actions'));
         $this->elementStart('ul');
-        $this->elementStart('li', array('id' => 'group_subscribe'));
+        $this->elementStart('li', 'entity_subscribe');
         $cur = common_current_user();
         if ($cur) {
             if ($cur->isMember($this->group)) {
@@ -283,37 +296,18 @@ class ShowgroupAction extends Action
     }
 
     /**
-     * Show a list of links to feeds this page produces
+     * Get a list of the feeds for this page
      *
      * @return void
      */
 
-    function showExportData()
-    {
-        $fl = new FeedList($this);
-        $fl->show(array(0=>array('href'=>common_local_url('grouprss',
-                                                          array('nickname' => $this->group->nickname)),
-                                 'type' => 'rss',
-                                 'version' => 'RSS 1.0',
-                                 'item' => 'notices')));
-    }
-
-    /**
-     * Show a list of links to feeds this page produces
-     *
-     * @return void
-     */
-
-    function showFeeds()
+    function getFeeds()
     {
         $url =
           common_local_url('grouprss',
                            array('nickname' => $this->group->nickname));
 
-        $this->element('link', array('rel' => 'alternate',
-                                     'href' => $url,
-                                     'type' => 'application/rss+xml',
-                                     'title' => sprintf(_('Notice feed for %s group'),
+        return array(new Feed(Feed::RSS1, $url, sprintf(_('Notice feed for %s group'),
                                                         $this->group->nickname)));
     }
 
@@ -326,6 +320,9 @@ class ShowgroupAction extends Action
     function showSections()
     {
         $this->showMembers();
+        $this->showStatistics();
+        $cloud = new GroupTagCloudSection($this, $this->group);
+        $cloud->show();
     }
 
     /**
@@ -342,17 +339,15 @@ class ShowgroupAction extends Action
             return;
         }
 
-        $this->elementStart('div', array('id' => 'user_subscriptions',
+        $this->elementStart('div', array('id' => 'entity_members',
                                          'class' => 'section'));
 
         $this->element('h2', null, _('Members'));
 
-        if ($member) {
-            $pml = new ProfileMiniList($member, null, $this);
-            $cnt = $pml->show();
-            if ($cnt == 0) {
-                $this->element('p', null, _('(None)'));
-            }
+        $pml = new ProfileMiniList($member, null, $this);
+        $cnt = $pml->show();
+        if ($cnt == 0) {
+             $this->element('p', null, _('(None)'));
         }
 
         if ($cnt == MEMBERS_PER_SECTION) {
@@ -360,5 +355,61 @@ class ShowgroupAction extends Action
                                                                  array('nickname' => $this->group->nickname))),
                            _('All members'));
         }
+
+        $this->elementEnd('div');
     }
-}
\ No newline at end of file
+
+    /**
+     * Show some statistics
+     *
+     * @return void
+     */
+
+    function showStatistics()
+    {
+        // XXX: WORM cache this
+        $members = $this->group->getMembers();
+        $members_count = 0;
+        /** $member->count() doesn't work. */
+        while ($members->fetch()) {
+            $members_count++;
+        }
+
+        $this->elementStart('div', array('id' => 'entity_statistics',
+                                         'class' => 'section'));
+
+        $this->element('h2', null, _('Statistics'));
+
+        $this->elementStart('dl', 'entity_created');
+        $this->element('dt', null, _('Created'));
+        $this->element('dd', null, date('j M Y',
+                                                 strtotime($this->group->created)));
+        $this->elementEnd('dl');
+
+        $this->elementStart('dl', 'entity_members');
+        $this->element('dt', null, _('Members'));
+        $this->element('dd', null, (is_int($members_count)) ? $members_count : '0');
+        $this->elementEnd('dl');
+
+        $this->elementEnd('div');
+    }
+
+    function showAnonymousMessage()
+    {
+        if (!(common_config('site','closed') || common_config('site','inviteonly'))) {
+            $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+                'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
+                'short messages about their life and interests. '.
+                '[Join now](%%%%action.register%%%%) to become part of this group and many more! ([Read more](%%%%doc.help%%%%))'),
+                     $this->group->nickname);
+        } else {
+            $m = sprintf(_('**%s** is a user group on %%%%site.name%%%%, a [micro-blogging](http://en.wikipedia.org/wiki/Micro-blogging) service ' .
+                'based on the Free Software [Laconica](http://laconi.ca/) tool. Its members share ' .
+                'short messages about their life and interests. '),
+                     $this->group->nickname);
+        }
+        $this->elementStart('div', array('id' => 'anon_notice'));
+        $this->raw(common_markup_to_html($m));
+        $this->elementEnd('div');
+    }
+}