[Solar-svn] Revision 2800

pmjones at solarphp.com pmjones at solarphp.com
Fri Sep 28 21:38:59 CDT 2007


branch: Solar_App_Bookmarks:

* [CHG] Method _getOrder() now takes bookmarks.id into account.

* [CHG] Now displays the list of tags in use, as well as accurate page counts.

* [FIX] View/browse.rss.php now works.





Modified: branches/orm/Solar/App/Bookmarks/View/browse.rss.php
===================================================================
--- branches/orm/Solar/App/Bookmarks/View/browse.rss.php	2007-09-29 02:36:07 UTC (rev 2799)
+++ branches/orm/Solar/App/Bookmarks/View/browse.rss.php	2007-09-29 02:38:59 UTC (rev 2800)
@@ -36,23 +36,23 @@
 // that date.
 $items = '';
 $updated = ''; // last update
-foreach ($this->list as $key => $val) {
+foreach ($this->list as $item) {
     
     $category = $this->escape(
-        $val['owner_handle'] . '/' . str_replace(' ', '+', $val['tags'])
+        $item->owner_handle . '/' . str_replace(' ', '+', $item->tags_as_string)
     );
     
-    $title = $this->escape($val['subj']);
+    $title = $this->escape($item->subj);
     
-    $pubDate = $this->date($val['updated'], DATE_RSS);
+    $pubDate = $this->date($item->updated, DATE_RSS);
     
-    if ($val['updated'] > $updated) {
-        $updated = $val['updated'];
+    if ($item->updated > $updated) {
+        $updated = $item->updated;
     }
     
-    $description = $this->escape($val['summ']);
+    $description = $this->escape($item->summ);
     
-    $uri = $this->escape($val['uri']);
+    $uri = $this->escape($item->uri);
     
     $items .= <<<ITEM
         
@@ -70,7 +70,7 @@
 <rss version="2.0">
     <channel>
         <title><?php echo $this->escape($this->feed['title']) ?></title>
-        <link><?php echo $this->escape($link->fetch(true)) ?></link>
+        <link><?php echo $this->escape($link->get(true)) ?></link>
         <description><?php echo $this->escape($this->feed['descr']) ?></description>
         <pubDate><?php echo $this->date($updated, DATE_RSS) ?></pubDate>
         <?php echo $items ?>

Modified: branches/orm/Solar/App/Bookmarks.php
===================================================================
--- branches/orm/Solar/App/Bookmarks.php	2007-09-29 02:36:07 UTC (rev 2799)
+++ branches/orm/Solar/App/Bookmarks.php	2007-09-29 02:38:59 UTC (rev 2800)
@@ -246,36 +246,36 @@
         // created timestamp
         case 'created':
         case 'created_asc':
-            $order = 'bookmarks.created ASC';
+            $order = 'bookmarks.created ASC, bookmarks.id ASC';
             break;
         
         case 'created_desc':
-            $order = 'bookmarks.created DESC';
+            $order = 'bookmarks.created DESC, bookmarks.id DESC';
             break;
             
         // title
         case 'subj':
         case 'subj_asc':
-            $order = 'LOWER(bookmarks.subj) ASC';
+            $order = 'LOWER(bookmarks.subj) ASC, bookmarks.id ASC';
             break;
         
         case 'subj_desc':
-            $order = 'LOWER(bookmarks.subj) DESC';
+            $order = 'LOWER(bookmarks.subj) DESC, bookmarks.id DESC';
             break;
         
         // pos
         case 'pos':
         case 'pos_asc':
-            $order = 'bookmarks.pos ASC';
+            $order = 'bookmarks.pos ASC, bookmarks.id ASC';
             break;
         
         case 'pos_desc':
-            $order = 'bookmarks.pos DESC';
+            $order = 'bookmarks.pos DESC, bookmarks.id DESC';
             break;
         
         // default
         default:
-            $order = 'bookmarks.created DESC';
+            $order = 'bookmarks.created DESC, bookmarks.id DESC';
             break;
         
         }
@@ -569,11 +569,16 @@
         $this->list = $this->_bookmarks->fetchAllByTags($tag_list, $params);
         
         // get the total pages and row-count
-        $total = $this->_bookmarks->countPages($tag_list, $params);
+        $total = $this->_bookmarks->countPagesByTags($tag_list, $params);
         
         // flash forward the backlink in case we go to edit
         $this->_session->setFlash('backlink', $this->_request->server('REQUEST_URI'));
         
+        // assign the list of tags in use
+        $this->tags_in_use   = $this->_tags->fetchAllWithCount(array(
+            'order' => 'tags.name'
+        ));
+        
         // assign everything else for the view
         $this->count         = $total['count'];
         $this->pages         = $total['pages'];
@@ -581,7 +586,6 @@
         $this->page          = $params['page'];
         $this->owner_handle  = null; // requested owner_handle
         $this->tags          = $tag_list; // the requested tags
-        $this->tags_in_use   = $this->_tags->fetchAllWithCount(null);
         $this->feed['title'] = 'tag';
         $this->feed['descr'] = $tag_list;
         
@@ -627,7 +631,7 @@
         // tags or no-tags?
         if ($tag_list) {
             $this->list = $this->_bookmarks->fetchAllByTags($tag_list, $params);
-            $total = $this->_bookmarks->countPagesByTags($params);
+            $total = $this->_bookmarks->countPagesByTags($tag_list, $params);
         } else {
             $this->list = $this->_bookmarks->fetchAll($params);
             $total = $this->_bookmarks->countPages($params);
@@ -636,14 +640,21 @@
         // flash forward the backlink in case we go to edit
         $this->_session->setFlash('backlink', $this->_request->server('REQUEST_URI'));
         
-        // assign view vars
+        // assign the list of tags in use
+        $this->tags_in_use = $this->_tags->fetchAllByOwnerHandle(
+            $owner_handle,
+            array(
+            'order' => 'tags.name'
+            )
+        );
+        
+        // assign remaining view vars
         $this->count         = $total['count'];
         $this->pages         = $total['pages'];
         $this->order         = $this->_query('order');
         $this->page          = $params['page'];
         $this->owner_handle  = $owner_handle; // requested owner_handle
         $this->tags          = $tag_list; // the requested tags
-        $this->tags_in_use   = $this->_tags->fetchAllByOwnerHandle($owner_handle);
         $this->feed['title'] = 'user';
         $this->feed['descr'] = $this->owner_handle . '/' . $this->tags;
         




More information about the Solar-svn mailing list