# HG changeset patch # User nanaya # Date 1432460025 -32400 # Node ID 7de8f524d1e4876a71c90eab0e3f01539bc070ad # Parent 2ec27751645eb72600c5891fa521aa48499d8c49 Always group by directory no matter what type of sorting. diff -r 2ec27751645e -r 7de8f524d1e4 index.php --- a/index.php Sun May 24 18:29:37 2015 +0900 +++ b/index.php Sun May 24 18:33:45 2015 +0900 @@ -62,8 +62,8 @@ return sprintf($return_format, $size, $return_unit); } - function hidden_data($data) { - return " " . $data . " "; + function hidden_data($data = "", $is_dir = false) { + return " " . ($is_dir === true ? 0 : 1) . " " . $data . " "; } // END UTILITY @@ -96,13 +96,10 @@ $file_rows = ""; $file_suffix = ""; - $list_file_prefix = ""; + $list_file_prefix = hidden_data("", $is_dir); if ($is_dir) { $file_suffix = "/"; - $list_file_prefix = hidden_data(0); - } else { - $list_file_prefix = hidden_data(1); } foreach($files as $file) { @@ -112,11 +109,12 @@ $file_rows .= "". $list_file_prefix . link_to($file . $file_suffix, $file . $file_suffix).""; $file_rows .= ""; - if ($is_dir) { $file_rows .= hidden_data(0) . "[dir]"; } - else { $file_rows .= hidden_data($file_stat["size"]) . human_size($file_stat['size']); } + $file_rows .= hidden_data($file_stat["size"], $is_dir); + if ($is_dir) { $file_rows .= "[dir]"; } + else { $file_rows .= human_size($file_stat['size']); } $file_rows .= ""; - $file_rows .= "".h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime'])).""; + $file_rows .= "" . hidden_data("", $is_dir) . h(strftime("%Y-%m-%d %H:%M %Z", $file_stat['mtime'])) . ""; $file_rows .= ""; }