]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
more subscriptions/subscribers changes
authorEvan Prodromou <evan@prodromou.name>
Wed, 18 Jun 2008 17:24:44 +0000 (13:24 -0400)
committerEvan Prodromou <evan@prodromou.name>
Wed, 18 Jun 2008 17:24:44 +0000 (13:24 -0400)
Showstream now shows subscriptions in reverse chron order, like the
other pages.

Added a callback method to figure out who the _other_ guy is in a
subscription.

Changed gallery page to be a UL of images.

darcs-hash:20080618172444-84dde-b886f6f8170370ae1aaf2e7f996aff288a471145.gz

actions/showstream.php
actions/subscribers.php
actions/subscriptions.php
lib/gallery.php

index f339e08987a78484c6be3303c67943539be909d3..d9637c377520da50621b0780c6395405ceaac8d9 100644 (file)
@@ -204,7 +204,8 @@ class ShowstreamAction extends StreamAction {
 
                $subs = DB_DataObject::factory('subscription');
                $subs->subscriber = $profile->id;
-
+               $subs->orderBy('created DESC');
+               
                # We ask for an extra one to know if we need to do another page
 
                $subs->limit(0, SUBSCRIPTIONS + 1);
index f5548d653508ebafbca03e4677c8541923596c9b..de374d57aa8a05dc3215902a8b73cb1a93585076 100644 (file)
@@ -43,4 +43,8 @@ class SubscribersAction extends GalleryAction {
        function div_class() {
                return 'subscribers';
        }
+       
+       function get_other(&$subs) {
+               return $subs->subscriber;
+       }
 }
\ No newline at end of file
index aba974f6e99031f5a2630a34b66cefb53f438946..10aef54d80966d367a082459501125a73d8c1428 100644 (file)
@@ -43,4 +43,8 @@ class SubscriptionsAction extends GalleryAction {
        function div_class() {
                return 'subscriptions';
        }
+       
+       function get_other(&$subs) {
+               return $subs->subscribed;
+       }
 }
\ No newline at end of file
index 6d21b8310f49c2c53d0a4ba2124a2510f9378171..d0c55d634b0bc9d69f8f3f80c998c35363894b34 100644 (file)
@@ -68,15 +68,25 @@ class GalleryAction extends Action {
 
                $subs_count = $subs->find();
 
-               common_element_start('div', $this->div_class());
-
-               $idx = 0;
+               if ($subs_count == 0) {
+                       common_element('p', _t('Nobody to show!'));
+                       return;
+               }
+               
+               common_element_start('ul', $this->div_class());
 
-               while ($subs->fetch()) {
+               for ($idx = 0; $idx < min($subs_count, AVATARS_PER_PAGE); $idx++) {
+                       
+                       $result = $subs->fetch();
                        
-                       $idx++;
+                       if (!$result) {
+                               common_debug('Ran out of subscribers too early.', __FILE__);
+                               break;
+                       }
 
-                       $other = Profile::staticGet($subs->subscribed);
+                       $other = Profile::staticGet($this->get_other($subs));
+
+                       common_element_start('li');
                        
                        common_element_start('a', array('title' => ($other->fullname) ?
                                                                                        $other->fullname :
@@ -97,14 +107,12 @@ class GalleryAction extends Action {
                        common_element_end('a');
 
                        # XXX: subscribe form here
-
-                       if ($idx == AVATARS_PER_PAGE) {
-                               break;
-                       }
+                       
+                       common_element_end('li');
                }
 
-               common_element_end('div');
-               
+               common_element_end('ul');
+
                common_pagination($page > 1, 
                                                  $subs_count > AVATARS_PER_PAGE,
                                                  $page, 
@@ -123,6 +131,10 @@ class GalleryAction extends Action {
        function define_subs(&$subs, &$profile) {
                return;
        }
+
+       function get_other(&$subs) {
+               return NULL;
+       }
        
        function div_class() {
                return '';