aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Storage/Directory.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2018-03-21 21:19:18 -0700
committerzotlabs <mike@macgirvin.com>2018-03-21 21:19:18 -0700
commit1514b0f4e5c053df60b8873b5411c70be727d227 (patch)
tree6b4824c72ef04df34e147e862d418d8100f26b8f /Zotlabs/Storage/Directory.php
parentdc066d4c9b84267bd551ecb122cf3708b6f1472b (diff)
downloadvolse-hubzilla-1514b0f4e5c053df60b8873b5411c70be727d227.tar.gz
volse-hubzilla-1514b0f4e5c053df60b8873b5411c70be727d227.tar.bz2
volse-hubzilla-1514b0f4e5c053df60b8873b5411c70be727d227.zip
initial support for alternative sort orders on the cloud pages. Can be triggered manually but further development is required.
Diffstat (limited to 'Zotlabs/Storage/Directory.php')
-rw-r--r--Zotlabs/Storage/Directory.php18
1 files changed, 17 insertions, 1 deletions
diff --git a/Zotlabs/Storage/Directory.php b/Zotlabs/Storage/Directory.php
index a2dd1e9b8..a2ae0fee8 100644
--- a/Zotlabs/Storage/Directory.php
+++ b/Zotlabs/Storage/Directory.php
@@ -691,7 +691,23 @@ class Directory extends DAV\Node implements DAV\ICollection, DAV\IQuota, DAV\IMo
}
$prefix = '';
- $suffix = ' order by is_dir desc, filename asc ';
+
+ if(! array_key_exists('cloud_sort',$_SESSION))
+ $_SESSION['cloud_sort'] = 'name';
+
+ switch($_SESSION['cloud_sort']) {
+ case 'size':
+ $suffix = ' order by is_dir desc, filesize asc ';
+ break;
+ // The following provides inconsistent results for directories because we re-calculate the date for directories based on the most recent change
+ case 'date':
+ $suffix = ' order by is_dir desc, edited asc ';
+ break;
+ case 'name':
+ default:
+ $suffix = ' order by is_dir desc, filename asc ';
+ break;
+ }
$r = q("select $prefix id, uid, hash, filename, filetype, filesize, revision, folder, flags, is_dir, created, edited from attach where folder = '%s' and uid = %d $perms $suffix",
dbesc($folder),