X-Git-Url: http://git.shiar.net/minimedit.git/blobdiff_plain/10356b51f95050d0aec0cd1807d5ba1ec46d475a..d9e768059d2a10c2c5eb5b908a998fb496b4e4cf:/widget/doclist.php diff --git a/widget/doclist.php b/widget/doclist.php index 5c11c68..123271b 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -1,8 +1,11 @@ place[0])) { + $Page->link .= '/'.$Page->place[0]; +} $cal = []; -foreach (glob("$Page$Args/2*") as $url) { +foreach (glob("{$Page->link}/2*") as $url) { $link = preg_replace('/\.html$/', '', $url); $name = pathinfo($link, PATHINFO_BASENAME); @list ($date, $suffix) = explode('.', $name, 2); @@ -14,16 +17,22 @@ foreach (glob("$Page$Args/2*") as $url) { $cal[$group][$date][$suffix] = $link; } } +if (!$cal) { + return; +} $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 '