</%args>
<%once>
-my $meta_prettyprint_age= sub {
- my ($age,$floor,$plus) = @_;
- return <<END;
- $age < 60 ? 'less than a minute' :
- $age < 60*2 ? '1 minute' :
- $age < 3600*2 ? $floor ($age/60) $plus' minutes' :
- $age < 86400*2 ? $floor ($age/3600) $plus ' hours' :
- $floor ($age/86400) $plus ' days';
-END
-};
-
-my $prettyprint_age;
-eval '
- $prettyprint_age= sub {
- my ($age) = @_;
- '.$meta_prettyprint_age->('$age','floor','.').'
- };
-' or die "$@";
</%once>
% my %da_ages;
% my %ts_sortkeys;
% $da_ages{'id_loaded'}= 0;
+% my $rowix= 0;
% while ($row=$sth->fetchrow_hashref) {
% my $rowid= "id_$row->{'islandid'}";
% my $cellid= "c$rowid";
% $ts_sortkeys{'0'}{$rowid}= $row->{'archipelago'};
% $ts_sortkeys{'1'}{$rowid}= $row->{'islandname'};
% $da_ages{$rowid}= $age;
-<tr id=<% $rowid %>
+<tr id=<% $rowid %> class="<% 'datarow'.($rowix & 1) %>"
> <td><% $row->{'archipelago'} |h
%> <td><% $row->{'islandname'} |h
- %> <td id="<% $cellid %>"><% $prettyprint_age->($age) %> </tr>
+ %> <td id="<% $cellid %>"><% prettyprint_age($age) %> </tr>
+% $rowix++;
% }
</table>
-<& tabsort, table => 'ts_table', cols => [
+<& tabsort, table => 'ts_table', rowclass => 'datarow', cols => [
{}, {},
{ DoReverse => 1,
Numeric => 1,
var cellid= 'c'+rowid;
var el= document.getElementById(cellid);
var age= oldage + (now - da_pageload) / 1000;
- var newhtml= <% $meta_prettyprint_age->('age','Math.floor','+') %>;
+ var newhtml= <% meta_prettyprint_age('age','Math.floor','+') %>;
% if ($ARGS{debug}) {
if (cellid == 'cid_loaded')
debug('element rowid='+rowid+' cellid='+cellid