]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - actions/showstream.php
better titles in RSS
[quix0rs-gnu-social.git] / actions / showstream.php
index f8446e008a67dbc655f2b412928b6122edccd6c4..2fc5184c38ece9ae707d4899aa4af06be29e8b74 100644 (file)
@@ -52,7 +52,9 @@ class ShowstreamAction extends StreamAction {
                header('X-XRDS-Location: '. common_local_url('xrds', array('nickname' =>
                                                                                                                                   $user->nickname)));
 
-               common_show_header($profile->nickname, array($this, 'show_header'), $user);
+               common_show_header($profile->nickname, 
+                                                  array($this, 'show_header'), $user,
+                                                  array($this, 'show_top'));
 
                $this->show_profile($profile);
 
@@ -61,6 +63,17 @@ class ShowstreamAction extends StreamAction {
                common_show_footer();
        }
 
+       function show_top($user) {
+               
+               $cur = common_current_user();
+               
+               if ($cur && $cur->id == $user->id) {
+                       common_notice_form();
+               }
+               
+               $this->views_menu();
+       }
+       
        function show_header($user) {
                common_element('link', array('rel' => 'alternate',
                                                                         'href' => common_local_url('userrss', array('nickname' =>
@@ -133,7 +146,10 @@ class ShowstreamAction extends StreamAction {
                        common_element('p', 'description', htmlspecialchars($profile->bio));
                }
                if ($profile->homepage) {
-                       common_element('p', 'website', $profile->homepage);
+                       common_element_start('p', 'website');
+                       common_element('a', array('href' => $profile->homepage),
+                                                  $profile->homepage);
+                       common_element_end('p');
                }
                
                $this->show_statistics($profile);
@@ -159,9 +175,9 @@ class ShowstreamAction extends StreamAction {
                                                                                   'method' => 'POST',
                                                                                   'action' => common_local_url('remotesubscribe')));
                common_hidden('nickname', $profile->nickname);
-               common_element('input', array('name' => 'profile',
+               common_element('input', array('name' => 'profile_url',
                                                                          'type' => 'text',
-                                                                         'id' => 'profile',
+                                                                         'id' => 'profile_url',
                                                                          'size' => '15'));
                common_element('input', array('type' => 'submit',
                                                                          'id' => 'submit',
@@ -187,13 +203,12 @@ class ShowstreamAction extends StreamAction {
        function show_subscriptions($profile) {
                global $config;
 
-               # XXX: add a limit
                $subs = DB_DataObject::factory('subscription');
                $subs->subscriber = $profile->id;
 
                # We ask for an extra one to know if we need to do another page
 
-               $subs->limit(0, SUBSCRIPTIONS);
+               $subs->limit(0, SUBSCRIPTIONS + 1);
 
                $subs_count = $subs->find();
 
@@ -205,7 +220,12 @@ class ShowstreamAction extends StreamAction {
                        
                        common_element_start('ul', array('id' => 'subscriptions_avatars'));
                        
-                       while ($subs->fetch()) {
+                       for ($i = 0; $i < min($subs_count, SUBSCRIPTIONS); $i++) {
+                               
+                               if (!$subs->fetch()) {
+                                       common_debug('Weirdly, broke out of subscriptions loop early', __FILE__);
+                                       break;
+                               }
 
                                $other = Profile::staticGet($subs->subscribed);
 
@@ -226,17 +246,19 @@ class ShowstreamAction extends StreamAction {
                                common_element_end('a');
                                common_element_end('li');
                        }
+                       
                        common_element_end('ul');
                }
 
-               common_element_start('p', array('id' => 'subscriptions_viewall'));
-               
-               common_element('a', array('href' => common_local_url('subscriptions',
-                                                                                                                        array('nickname' => $profile->nickname)),
-                                                                 'class' => 'moresubscriptions'),
-                                          _t('All subscriptions'));
-
-               common_element_end('p');
+               if ($subs_count > SUBSCRIPTIONS) {
+                       common_element_start('p', array('id' => 'subscriptions_viewall'));
+                       
+                       common_element('a', array('href' => common_local_url('subscriptions',
+                                                                                                                                array('nickname' => $profile->nickname)),
+                                                                         'class' => 'moresubscriptions'),
+                                                  _t('All subscriptions'));
+                       common_element_end('p');
+               }
                
                common_element_end('div');
        }
@@ -261,9 +283,17 @@ class ShowstreamAction extends StreamAction {
 
                # Other stats...?
                common_element_start('dl', 'statistics');
-               common_element('dt', 'subscriptions', _t('Subscriptions'));
+               common_element_start('dt', 'subscriptions');
+               common_element('a', array('href' => common_local_url('subscriptions',
+                                                                                                                        array('nickname' => $profile->nickname))),
+                                          _t('Subscriptions'));
+               common_element_end('dt');
                common_element('dd', 'subscriptions', $subs_count);
-               common_element('dt', 'subscribers', _t('Subscribers'));
+               common_element_start('dt', 'subscribers');
+               common_element('a', array('href' => common_local_url('subscribed',
+                                                                                                                        array('nickname' => $profile->nickname))),
+                                          _t('Subscribers'));
+               common_element_end('dt');
                common_element('dd', 'subscribers', $subbed_count);
                common_element('dt', 'notices', _t('Notices'));
                common_element('dd', 'notices', $notice_count);