From: Ian Jackson Date: Thu, 13 Aug 2009 14:00:29 +0000 (+0100) Subject: New dataage mode actually works X-Git-Tag: 3.4~206 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?p=ypp-sc-tools.db-live.git;a=commitdiff_plain;h=2961c979e0f7bdae7183d49ab7fab5f5830dff4e New dataage mode actually works --- diff --git a/yarrg/web/dataage b/yarrg/web/dataage new file mode 100644 index 0000000..b6ba584 --- /dev/null +++ b/yarrg/web/dataage @@ -0,0 +1,92 @@ +<%once> +my $meta_prettyprint_age= sub { + my ($age,$floor,$plus) = @_; + return <('$age','floor','.').' + }; +' or die "$@"; + + + +<%perl> + +my $now= time; + +my $row; +my $sth= $dbh->prepare("SELECT archipelago, islandid, islandname, timestamp + FROM uploads NATURAL JOIN islands + ORDER BY archipelago, islandid"); +$sth->execute(); + + + + + + + + +% while ($row=$sth->fetchrow_hashref) { +% my $elid= "daid_$row->{'islandid'}"; +% my $age= $now - $row->{'timestamp'}; + + +% } +
Archipelago +Island +Age +
<% $row->{'archipelago'} |h + %> <% $row->{'islandname'} |h + %> <% $prettyprint_age->($age) %>
+ +

+Time since this page loaded: +(not known; times above not updating) + +

+% foreach my $a (keys %ARGS) { + +% } + +
+ + + +<%init> +use POSIX; +use CommodsWeb; +my $dbh= dbw_connect('Midnight'); + diff --git a/yarrg/web/lookup b/yarrg/web/lookup index ae22b33..469f228 100644 --- a/yarrg/web/lookup +++ b/yarrg/web/lookup @@ -50,7 +50,7 @@ foreach my $var (@vars) { <% ucfirst $ahtml{Query} %> - YARRG -YARRG - +YARRG - Yet Another Revenue Research Gatherer

<%perl> @@ -72,7 +72,7 @@ foreach my $var (keys %ARGS) { } my $quri= sub { - my $uri= URI->new($m->current_comp()->name()); + my $uri= URI->new('lookup'); $uri->query_form(@_); $uri->path_query(); }; @@ -226,7 +226,7 @@ foreach my $arch (keys %islandlistdata) { - +