Index: manager.php
===================================================================
RCS file: /repository/gollem/manager.php,v
retrieving revision 1.65
diff -U2 -p -r1.65 manager.php
--- manager.php	26 Mar 2003 04:19:51 -0000	1.65
+++ manager.php	2 Apr 2003 21:21:50 -0000
@@ -266,4 +266,9 @@ foreach ($info as $backend_key => $vars)
     require GOLLEM_TEMPLATES . '/manager/actions.inc';
 
+    /* Read the columns to display from the preferences. */
+    $sources = Gollem::string2Columns($prefs->getValue('columns'));
+    $columns = isset($sources[$_SESSION['gollem'][$backend_key]['driver']]) 
+	    ? $sources[$_SESSION['gollem'][$backend_key]['driver']] : array();
+
     if (is_array($list) && count($list)) {
         require GOLLEM_TEMPLATES . '/manager/file_headers.inc';
Index: config/prefs.php.dist
===================================================================
RCS file: /repository/gollem/config/prefs.php.dist,v
retrieving revision 1.18
diff -U2 -p -r1.18 prefs.php.dist
--- config/prefs.php.dist	4 Mar 2003 19:59:23 -0000	1.18
+++ config/prefs.php.dist	2 Apr 2003 21:21:50 -0000
@@ -15,5 +15,5 @@ $prefGroups['display'] = array(
     'label' => _("Display Options"),
     'desc' => _("Change your file sorting options."),
-    'members' => array('show_dotfiles', 'sortby', 'sortdir'));
+    'members' => array('show_dotfiles', 'columnselect', 'sortby', 'sortdir'));
 
 
@@ -32,4 +32,19 @@ $_prefs['show_dotfiles'] = array('value'
                                  'desc' => _("Show dotfiles?")
 );
+
+// columns selection widget
+$_prefs['columnselect'] = array(
+    'locked' => false,
+    'type' => 'special'
+); 
+ 
+// columns to be displayed
+$_prefs['columns'] = array(
+    'value' => "ftp\ttype\tname\tdownload\tmodified\tsize\tpermission\towner\tgr
+oup",
+    'locked' => false,
+    'shared' => false,
+    'type' => 'implicit'
+); 
 
 // user preferred sorting column
Index: lib/Gollem.php
===================================================================
RCS file: /repository/gollem/lib/Gollem.php,v
retrieving revision 1.85
diff -U2 -p -r1.85 Gollem.php
--- lib/Gollem.php	4 Mar 2003 19:59:24 -0000	1.85
+++ lib/Gollem.php	2 Apr 2003 21:21:51 -0000
@@ -535,3 +537,40 @@ class Gollem {
     }
 
+    function string2Columns($string)
+    {
+        $ret = array();
+        $lines = explode("\n", $string);
+        foreach ($lines as $line) {
+            $line = trim($line);
+            if (!empty($line)) {
+                $columns = explode("\t", $line);
+                if (count($columns) > 1) {
+                    $source = array_splice($columns, 0, 1);
+                    $ret[$source[0]] = $columns;
+                }
+            }
+        }   
+        
+        return $ret;
+    }   
+
+    function columns2String($hash)
+    {
+        foreach ($hash as $source => $columns) {
+            if (isset($string)) {
+                $string .= "\n";
+            } else {
+                $string = '';
+            }
+            $line = '';
+            foreach ($columns as $column) {
+                if (!empty($line)) {
+                    $line .= "\t";
+                }
+                $line .= $column;
+            }
+        }
+
+        return $string;
+    }
 }
Index: templates/manager/file_headers.inc
===================================================================
RCS file: /repository/gollem/templates/manager/file_headers.inc,v
retrieving revision 1.11
diff -U2 -p -r1.11 file_headers.inc
--- templates/manager/file_headers.inc	17 Dec 2002 21:14:57 -0000	1.11
+++ templates/manager/file_headers.inc	2 Apr 2003 21:21:56 -0000
@@ -3,31 +3,43 @@
 <tr class="item">
   <th nowrap="nowrap" width="3%" align="center">&nbsp;<?php echo Horde::img('checkbox.gif', _("Checkbox")) ?></td>
-  <th class="<?php echo ($prefs->getValue('sortby') == SORT_TYPE) ? 'selected' : 'item' ?>" width="5%" nowrap="nowrap" align="right">
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_TYPE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_TYPE) ?>"><?php echo _("Type") ?></a>&nbsp;
-  </th>
-  <th class="<?php echo ($prefs->getValue('sortby') == SORT_NAME) ? 'selected' : 'item' ?>" width="57%" nowrap="nowrap" align="left">
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_NAME . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_NAME) ?>"><?php echo _("Name") ?></a>
-  </th>
-  <th class="item" width="1%" align="center">
-    <?php echo Horde::img('download.gif', _("Download"), null, $registry->getParam('graphics', 'horde')) ?>
-  </th>
-  <th class="<?php echo ($prefs->getValue('sortby') == SORT_DATE) ? 'selected' : 'item' ?>" width="7%" nowrap="nowrap" align="right">
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_DATE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_DATE); ?>"><?php echo _("Modified") ?></a>
-  </th>
-  <th class="<?php echo ($prefs->getValue('sortby') == SORT_SIZE) ? 'selected' : 'item' ?>" width="7%" nowrap="nowrap" align="right">
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_SIZE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
-    <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_SIZE) ?>"><?php echo _("Size") ?></a>
-  </th>
-  <th class="item" width="7%" nowrap="nowrap" align="right">
-    <?php echo _("Permission") ?>
-  </th>
-  <th class="item" width="7%" nowrap="nowrap" align="right">
-    <?php echo _("Owner") ?>
-  </th>
-  <th class="item" width="7%" nowrap="nowrap" align="right">
-    <?php echo _("Group") ?>
-  </th>
+  <?php foreach($columns as $heading):?>
+    <?php switch($heading):
+      case 'type': ?>
+	<th class="<?php echo ($prefs->getValue('sortby') == SORT_TYPE) ? 'selected' : 'item' ?>" width="5%" nowrap="nowrap" align="right">
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_TYPE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_TYPE) ?>"><?php echo _("Type") ?></a>&nbsp;
+	</th>
+	<?php break; ?>
+      <?php case 'name': ?>
+	<th class="<?php echo ($prefs->getValue('sortby') == SORT_NAME) ? 'selected' : 'item' ?>" width="57%" nowrap="nowrap" align="left">
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_NAME . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_NAME) ?>"><?php echo _("Name") ?></a>
+	</th>
+	<?php break; ?>
+      <?php case 'download': ?>
+	<th class="item" width="1%" align="center">
+	  <?php echo Horde::img('download.gif', _("Download"), null, $registry->getParam('graphics', 'horde')) ?>
+	</th>
+	<?php break; ?>
+      <?php case 'date': ?>
+	<th class="<?php echo ($prefs->getValue('sortby') == SORT_DATE) ? 'selected' : 'item' ?>" width="7%" nowrap="nowrap" align="right">
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_DATE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_DATE); ?>"><?php echo _("Modified") ?></a>
+	</th>
+	<?php break; ?>
+      <?php case 'size': ?>
+	<th class="<?php echo ($prefs->getValue('sortby') == SORT_SIZE) ? 'selected' : 'item' ?>" width="7%" nowrap="nowrap" align="right">
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_SIZE . '&sortdir=' . abs(1 - $prefs->getValue('sortdir'))); ?>"><?php echo Horde::img($prefs->getValue('sortdir') ? 'down.gif' : 'up.gif', _("Sort Direction")); ?></a>
+	  <a href="<?php echo Horde::applicationUrl('manager.php?sortby=' . SORT_SIZE) ?>"><?php echo _("Size") ?></a>
+	</th>
+	<?php break; ?>
+      <?php case 'permission':
+      case 'owner':
+      case 'group': ?>
+	<th class="item" width="7%" nowrap="nowrap" align="right">
+	  <?php echo _(ucfirst($heading)) ?>
+	</th>
+	<?php break; ?>
+      <?php endswitch; ?>
+    <?php endforeach; ?>
 </tr>
Index: templates/manager/file_summaries.inc
===================================================================
RCS file: /repository/gollem/templates/manager/file_summaries.inc,v
retrieving revision 1.24
diff -U2 -p -r1.24 file_summaries.inc
--- templates/manager/file_summaries.inc	17 Dec 2002 21:14:57 -0000	1.24
+++ templates/manager/file_summaries.inc	2 Apr 2003 21:21:56 -0000
@@ -3,20 +3,40 @@
     <input type="checkbox" name="items[]" value="<?php echo $item['name']; ?>" />
   </td>
-  <td align="right">
-    <?php if (!empty($item['link'])): ?>
-    <?php echo Horde::img('manager/symlink.gif', _("symlink")) ?>
-    <?php elseif ($item['type'] == '**dir'): ?>
-    <?php echo Horde::img('manager/folder.gif', _("folder")) ?>
-    <?php else: ?>
-    <?php echo Horde::img(MIME_Viewer::getIcon(MIME_Magic::extToMIME($item['type'])), '', '', '') ?>
-    <?php endif; ?>
-    &nbsp;
-  </td>
-  <td nowrap="nowrap"><?php echo $link ?></td>
-  <td align="center"><?php echo is_null($dl) ? '&nbsp;' : $dl ?></td>
-  <td align="right" nowrap="nowrap"><?php echo strftime($conf['manager']['date_format'], $item['date']); ?></td>
-  <td align="right"><?php echo $item['type'] == '**dir' ? '-' : number_format($item['size'], 0, '.', ','); ?></td>
-  <td align="right" nowrap="nowrap"><?php echo $item['perms'] ?></td>
-  <td align="right" nowrap="nowrap"><?php echo $item['owner'] ?></td>
-  <td align="right" nowrap="nowrap"><?php echo $item['group'] ?></td>
+  <?php foreach($columns as $heading): ?>
+    <?php switch($heading):
+      case 'type': ?>
+	<td align="right">
+	  <?php if (!empty($item['link'])): ?>
+	  <?php echo Horde::img('manager/symlink.gif', _("symlink")) ?>
+	  <?php elseif ($item['type'] == '**dir'): ?>
+	  <?php echo Horde::img('manager/folder.gif', _("folder")) ?>
+	  <?php else: ?>
+	  <?php echo Horde::img(MIME_Viewer::getIcon(MIME_Magic::extToMIME($item['type'])), '', '', '') ?>
+	  <?php endif; ?>
+	  &nbsp;
+	</td>
+	<?php break; ?>
+      <?php case 'name': ?>
+	<td nowrap="nowrap"><?php echo $link ?></td>
+	<?php break; ?>
+      <?php case 'download': ?>
+	<td align="center"><?php echo is_null($dl) ? '&nbsp;' : $dl ?></td>
+	<?php break; ?>
+      <?php case 'date': ?>
+	<td align="right" nowrap="nowrap"><?php echo strftime($conf['manager']['date_format'], $item['date']); ?></td>
+	<?php break; ?>
+      <?php case 'size': ?>
+	<td align="right"><?php echo $item['type'] == '**dir' ? '-' : number_format($item['size'], 0, '.', ','); ?></td>
+	<?php break; ?>
+      <?php case 'permission': ?>
+	<td align="right" nowrap="nowrap"><?php echo $item['perms'] ?></td>
+	<?php break; ?>
+      <?php case 'owner': ?>
+	<td align="right" nowrap="nowrap"><?php echo $item['owner'] ?></td>
+	<?php break; ?>
+      <?php case 'group': ?>
+	<td align="right" nowrap="nowrap"><?php echo $item['group'] ?></td>
+	<?php break; ?>
+    <?php endswitch; ?>
+  <?php endforeach; ?>
 </tr>
