Changeset 1483

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 )

Location:
trunk/gregarius
Files:
3 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 
  • trunk/gregarius/cls/channels.php

    r1181 r1483  
    205205            if (array_key_exists(COLLAPSED_FOLDERS_COOKIE, $_COOKIE)) { 
    206206                $this->collapsed_ids = explode(":", $_COOKIE[COLLAPSED_FOLDERS_COOKIE]); 
    207             } 
    208      
    209             //get unread count per folder 
     207            }  elseif (empty($this->collapsed_ids) && getConfig("rss.output.channelcollapsedefault")) { 
     208               // Lets collapse all folders 
     209               $res = rss_query("select id from " . getTable('folders') . " where id != 0"); 
     210               while (list ($this->collapsed_ids[]) = rss_fetch_row($res)) { 
     211               } 
     212               if (!headers_sent()) { // Sajax does not allow us to set cookies 
     213                setcookie(COLLAPSED_FOLDERS_COOKIE,  
     214                  implode(":", $this->collapsed_ids ) , time()+COOKIE_LIFESPAN,getPath()); 
     215               } 
     216            } 
    210217     
    211218            //get unread count per folder                                                                         
  • trunk/gregarius/schema.php

    r1464 r1483  
    437437        "rss.output.compression"    =>      array("true","true","boolean","This variable turns output compression on and off. Output compression is handled by most browsers.",NULL), 
    438438        "rss.output.channelcollapse"=>  array("true","true","boolean","Allow collapsing of channels on the main page. ",NULL), 
     439        "rss.output.channelcollapsedefault"=>   array("false","false","boolean","Collapse the channels on the main page by default",NULL), 
    439440        "rss.output.usepermalinks"  =>      array("true","true","boolean","Display a permalink icon and allow linking a given item directly.",NULL), 
    440441        "rss.config.markreadonupdate"=> array("false","false","boolean","Mark all old unread feeds as read when updating if new unread feeds are found.",NULL),