Browse Source

Fixed collapsed folder bug. When de-activating collapsable folders collapsed
folder remained collapsed.

philippe_mingo 24 years ago
parent
commit
cc1d99e08e
1 changed files with 12 additions and 9 deletions
  1. 12 9
      src/left_main.php

+ 12 - 9
src/left_main.php

@@ -202,7 +202,7 @@
     echo '</A>)</SMALL></CENTER><BR>';
 
     /* Lastly, display the folder list. */
-    if (isset($collapse_folders) && $collapse_folders) {
+    if (isset($collapse_folders) && $collapse_folders ) {
         /* If directed, collapse or uncollapse a folder. */
         if (isset($fold)) {
             setPref($data_dir, $username, 'collapse_folder_' . $fold, SM_BOX_COLLAPSED);
@@ -303,7 +303,7 @@
      * status and parent (or not parent) status for all children boxes.
      */
     function compute_folder_children(&$parbox, $boxcount) {
-        global $boxes, $data_dir, $username;
+        global $boxes, $data_dir, $username, $collapse_folders;
         $nextbox = $parbox + 1;
 
         /* Retreive the name for the parent box. */
@@ -313,16 +313,19 @@
         $boxes[$parbox]['parent'] = false;
 
         /* Compute the collapse status for this box. */
-        $collapse = 0;
-        $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
-        $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
+        if( isset($collapse_folders) && $collapse_folders ) {
+            $collapse = getPref($data_dir, $username, 'collapse_folder_' . $parbox_name);
+            $collapse = ($collapse == '' ? SM_BOX_UNCOLLAPSED : $collapse);
+        } else {
+            $collapse = SM_BOX_UNCOLLAPSED;
+        }
         $boxes[$parbox]['collapse'] = $collapse;
 
         /* Otherwise, get the name of the next box. */
-	if (isset($boxes[$nextbox]['unformatted']))
-           $nextbox_name = $boxes[$nextbox]['unformatted'];
-	else
-	   $nextbox_name = '';
+    	if (isset($boxes[$nextbox]['unformatted']))
+               $nextbox_name = $boxes[$nextbox]['unformatted'];
+    	else
+    	   $nextbox_name = '';
 
         /* Compute any children boxes for this box. */
         while (($nextbox < $boxcount) &&