X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/2477e787850b513cde668b6ba91297466ff31a54..6f67c60627918b9ef956914c63cb7290b7e2de13:/widget/doclist.php diff --git a/widget/doclist.php b/widget/doclist.php index a465768..589c8d6 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -6,21 +6,34 @@ foreach (glob("$Page$Args/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); - if (!isset($cal[$date])) { - $cal[$date] = []; + $group = substr($date, 0, 4); + if (!isset($cal[$group][$date])) { + $cal[$group][$date] = []; } if (!is_dir($url) and filesize($url)) { - $cal[$date][$suffix] = $link; + $cal[$group][$date][$suffix] = $link; } } $year = 3600 * 24 * 365; # seconds per year -$scale = 8; # em width per year -$mindate = strtotime($date) + ($year / $scale * 3); # first point plus about 3em for centered text +$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 '