X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/25b7f8464704469cc4641bbb096c11f548b5a153..d3ed59c2753c2babd5aa9a1c5e0109c644904ba8:/widget/doclist.php diff --git a/widget/doclist.php b/widget/doclist.php index 2d85884..589c8d6 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -6,37 +6,58 @@ foreach (glob("$Page$Args/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); - if (!filesize($url)) { - $cal[$date] = []; + $group = substr($date, 0, 4); + if (!isset($cal[$group][$date])) { + $cal[$group][$date] = []; } - else { - $cal[$date][$suffix] = $link; + if (!is_dir($url) and filesize($url)) { + $cal[$group][$date][$suffix] = $link; } } -$mindate = strtotime($date); +$year = 3600 * 24 * 365; # seconds per year +$scale = 7; # em width per year +$mindate = max(time(), strtotime($date) + ($year / $scale * 3)); # at least last entry plus 3em for centered text +$length = ($mindate - strtotime(key(current($cal)))) / $year * $scale; # earliest entry position -print '