[trean] Patch for case when No categories are set

Michal michal@michal.no-ip.com
Thu Oct 10 02:06:18 2002


But now I'm really sorry, it seems my IMP has a problems with adding atachments 
(I could see them in them compose window) - nevermind:

--- browse.php	Wed Oct  9 08:55:50 2002
+++ browse.php	Wed Oct  9 20:27:08 2002
@@ -38,15 +38,20 @@
 $categories = Trean::listCategories($category);
 $showCategories = array_key_exists($category, $categories);
 
+/* Test if are any trean categories defined */
+$testcategories = Trean::listCategories('-1');
+$noCategories = empty( $testcategories );
+
 /* Display the categories */
-if ($showCategories) {
-    $categories = $categories[$category];
+if ($showCategories || $noCategories) {
+    if (!$noCategories)
+       $categories = $categories[$category];
     $show_new_bookmark = !($showBookmarks || $category == '-1');
     require TREAN_TEMPLATES . '/browse/categories.inc';
 }
 
 /* Display the bookmarks */
-if ($showBookmarks || !$showCategories) {
+if ( ($showBookmarks || !$showCategories) && !$noCategories) {
     $show_new_category = !$showCategories;
     require TREAN_TEMPLATES . '/browse/bookmarks.inc';
 }


--- menu.inc	Thu Oct  3 19:17:37 2002
+++ menu.inc	Wed Oct  9 20:22:05 2002
@@ -2,9 +2,15 @@
 <tr><td class="menu"><table border="0" width="100%"><tr>
 <?php
 
+/* Test if are any trean categories defined */
+$testcategories = Trean::listCategories('-1');
+$noCategories = empty( $testcategories );
+
 /* Trean menu items */
 Menu::printItem(Horde::applicationUrl('browse.php'), _
("Browse"), 'browse.gif');
-Menu::printItem(Horde::applicationUrl('add.php'), _("Add"), 'add.gif');
+if (!$noCategories) {
+    Menu::printItem(Horde::applicationUrl('add.php'), _("Add"), 'add.gif');
+}
 Menu::printItem(Horde::applicationUrl('search.php'), _
("Search"), 'search.gif');
 if (($conf['prefs']['driver'] != '') && ($conf['prefs']['driver'] != 'none')) {
     Menu::printItem(Horde::applicationUrl('prefs.php'), _
("Options"), 'prefs.gif', $registry->getParam('graphics', 'horde'));





Quoting Michal <michal@michal.no-ip.com>:

> I have to go find medical help. I'm not able to attach two files ;)
> 
> 
> Sorry for this
> 
> Michal
> 
> 
> 
> Quoting Michal <michal@michal.no-ip.com>:
> 
> > :-) ;-) |-) |-| 8-|
> > 
> > Forgot attach those...
> > 
> > Quoting Michal <michal@michal.no-ip.com>:
> > 
> > > Sorry about bad attachments, here are the good ones.
> > > 
> > > Michal
> > > 
> > > Quoting Michal <michal@michal.no-ip.com>:
> > > 
> > > > Hi all,
> > > > 
> > > > 
> > > > I found that new users with no trean categories set, can see link 'New
> > > > Bookmark', because /templates/browse/bookmarks.inc is displayed.
> > > > 
> > > > Also 'Add' menu icon was still displayed so here is patch for
> browse.php
> > > and
> > > 
> > > > /templates/menu/menu.inc which solve both things.
> > > > 
> > > > 
> > > > Michal
> > > > 
> > > > 
> > > 
> > > 
> > > 
> > 
> > 
> > 
> 
> 
>