Show
Ignore:
Timestamp:
06/05/06 01:15:49 (2 years ago)
Author:
sdcosta
Message:

Fix for #402 ( config option to decide whether folders / categories in the sidebar are expanded or collapsed by default )

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/gregarius/cls/categories.php

    r1181 r1483  
    9696            if (array_key_exists(COLLAPSED_CATEGORIES_COOKIE, $_COOKIE)) { 
    9797                $this->collapsed_ids = explode(":", $_COOKIE[COLLAPSED_CATEGORIES_COOKIE]); 
     98            } elseif (empty($this->collapsed_ids) && getConfig("rss.output.channelcollapsedefault")) { 
     99               // Lets collapse all categories 
     100               $res = rss_query("select distinct(tid) from " . getTable('metatag') . " where ttype='channel'"); 
     101               while (list ($this->collapsed_ids[]) = rss_fetch_row($res)) { 
     102               } 
     103               if (!headers_sent()) { // Sajax does not allow us to set cookies 
     104                setcookie(COLLAPSED_CATEGORIES_COOKIE,  
     105                   implode(":", $this->collapsed_ids ) , time()+COOKIE_LIFESPAN,getPath()); 
     106               } 
    98107            } 
    99108