X-Git-Url: http://git.shiar.nl/minimedit.git/blobdiff_plain/0aa43066e7ac889d9bbba62344ed086d9b463366..edfd8ba72bb0144615f28f6bbd54f3cbfc31cb4f:/widget/doclist.php diff --git a/widget/doclist.php b/widget/doclist.php index 78b8c49..e0751b0 100644 --- a/widget/doclist.php +++ b/widget/doclist.php @@ -1,31 +1,69 @@ place[0])) { + $Page->link .= '/'.$Page->place[0]; } -print ' 5) print ' class="cols"'; -print ">\n"; -foreach (array_reverse($cal) as $title => $versions) { - print '
  • '; - if ($url = @$versions['html']) { - printf('%s', $url, $title); +$cal = []; +foreach (glob("{$Page->link}/2*") as $url) { + $link = preg_replace('/\.html$/', '', $url); + $name = pathinfo($link, PATHINFO_BASENAME); + @list ($date, $suffix) = explode('.', $name, 2); + $group = substr($date, 0, 4); + if (!isset($cal[$group][$date])) { + $cal[$group][$date] = []; + } + if (is_dir($url) ? file_exists("$url/index.html") : filesize($url)) { + $cal[$group][$date][$suffix] = $link; } - elseif (implode('', array_keys($versions))) { - list ($format, $url) = each($versions); - include_once('format.inc.php'); - printf('%s (%sB %s)', - $title, $url, showsize(filesize($url)), $format +} +if (!$cal) { + return; +} + +$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 + +printf('\n\n";