[dev] Re: trean block - patch

Stefan Kronawithleitner stefan at kronawithleitner.at
Mon May 3 12:42:31 PDT 2004


> btw, there's a bug somewhere - no matter which category i select, there are
> always  _all_ bookmarks shown. i think there's a parameter missing 
> when calling
> _trean_list(), right? but i don't know how to fix this, sorry...

with some help from danial vandal and some reading through the lib - a 
patch for
the mentioned bug above. includes also the last patch.
patches against trean/lib/Block/bookmarks.php and trean/lib/api.php

stefan
-------------- next part --------------
--- bookmarks.php.old	2004-04-06 22:24:24.000000000 +0200
+++ bookmarks.php	2004-05-03 21:38:04.873379000 +0200
@@ -40,7 +40,7 @@
         foreach (Trean::listCategories() as $id => $cat) {
             $catname = explode(':', $cat);
             $catname = array_pop($catname);
-            $params['category']['values'][$id] = $catname;;
+            $params['category']['values'][$id] = $catname;
         }
 
         $GLOBALS['registry']->popApp();
@@ -56,7 +56,7 @@
     {
         global $registry;
 
-        $html  = Horde::link(Horde::url($registry->getInitialPage(), true), $registry->getParam('name'), 'header') . $registry->getParam('name') . '</a> - ';
+        $html  = Horde::link(Horde::url($registry->getInitialPage(), true), $registry->getParam('name'), 'header') . $registry->getParam('name') . '</a> :: ';
         $html .= Horde::link(Horde::applicationUrl('add.php', true), _("New Bookmark"), 'smallheader') . Horde::img('trean.gif', _("New Note"), 'hspace="5"', Horde::url($registry->getParam('graphics'), true, -1)) . _("New Bookmark") . '</a>';
 
         return $html;
@@ -72,13 +72,12 @@
         require_once dirname(__FILE__) . '/../base.php';
         global $registry, $prefs, $conf;
 
-        $bookmarks = _trean_list();
+        $bookmarks = _trean_list(Trean::getName($this->_params['category']));
 
-        $class = 0;
         $html = '';
         $template = TREAN_TEMPLATES . '/block/' . $this->_params['template'] . '.inc';
         foreach ($bookmarks as $id => $bookmark) {
-            $html .= '<tr><td class="item' . $class . '" style="padding: 5px;width:100%;">';
+            $html .= '<tr><td class="summary" style="padding: 5px;width:100%;">';
 
             ob_start();
             $bookmark->displayHTML($template, $this->_params['category'], $id);
-------------- next part --------------
--- api.php.old	2004-02-04 23:03:50.000000000 +0100
+++ api.php	2004-05-03 21:34:16.503379000 +0200
@@ -64,5 +64,9 @@
 function _trean_list($category = -1)
 {
     require_once dirname(__FILE__) . '/base.php';
-    return $GLOBALS['trean']->listAllBookmarks($category);
+    if ($category == '') {
+        return $GLOBALS['trean']->listAllBookmarks();
+    } else {
+        return $GLOBALS['trean']->listAllBookmarks($category);
+	}
 }


More information about the dev mailing list