diff options
author | Florian Pritz <bluewind@xinu.at> | 2016-07-04 07:46:42 +0200 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2016-07-04 07:58:15 +0200 |
commit | 82efb0bdb6b20dfa5a76a3b4dcde48441ecf252a (patch) | |
tree | 46c1a33db228bfbfddce16b262141f7f10cf0fc7 /application/controllers/file.php | |
parent | 1ac83a99d3c7188f74ca4ecdec77a98ec9cef338 (diff) |
Add popover with filenames of multipaste to history
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application/controllers/file.php')
-rw-r--r-- | application/controllers/file.php | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php index 1f07ae4ec..1888b7c06 100644 --- a/application/controllers/file.php +++ b/application/controllers/file.php @@ -738,8 +738,27 @@ class File extends MY_Controller { foreach ($history["multipaste_items"] as $key => $item) { $size = 0; + $filenames = array(); + $files = array(); + $max_filenames = 10; + foreach ($item["items"] as $i) { $size += $history["items"][$i["id"]]["filesize"]; + $files[] = array( + "filename" => $history["items"][$i["id"]]['filename'], + "sort_order" => $i["sort_order"], + ); + } + + uasort($files, function ($a, $b) { + return $a['sort_order'] - $b['sort_order']; + }); + + $filenames = array_map(function ($a) {return $a['filename'];}, $files); + + if (count($filenames) > $max_filenames) { + $filenames = array_slice($filenames, 0, $max_filenames); + $filenames[] = "..."; } $history["items"][] = array( @@ -749,6 +768,7 @@ class File extends MY_Controller { "date" => $item["date"], "hash" => "", "filesize" => $size, + "preview_text" => implode("\n", $filenames), ); } |