diff options
author | ivan <ivan> | 2009-07-05 23:17:31 +0000 |
---|---|---|
committer | ivan <ivan> | 2009-07-05 23:17:31 +0000 |
commit | 7a62aaba31a74ee3dd5e3b77907aa6f06687608d (patch) | |
tree | 281cf62e1a5a90e9c2b786ec5feb019f2e6a6ff4 /httemplate/search/cdr.html | |
parent | 0ce1ba66efbd074aca5182bb3e42bd99ff55472a (diff) |
format start/answer/end dates and link svcnum to service
Diffstat (limited to 'httemplate/search/cdr.html')
-rw-r--r-- | httemplate/search/cdr.html | 27 |
1 files changed, 26 insertions, 1 deletions
diff --git a/httemplate/search/cdr.html b/httemplate/search/cdr.html index 126c4fd43..ceee6f2fd 100644 --- a/httemplate/search/cdr.html +++ b/httemplate/search/cdr.html @@ -23,6 +23,7 @@ @fields, #XXX fill in some pretty-print #processing, etc. ], + 'links' => \@links, 'html_form' => qq!<FORM NAME="cdrForm" ACTION="$p/misc/cdr.cgi" METHOD="POST">!, #false laziness w/queue.html @@ -225,9 +226,33 @@ my @header = map { $header{$_}; } else { my $header = $_; - $header =~ s/\_/ /g; + $header =~ s/\_/ /g; #//wtf ucfirst($header); } } @fields; +my $date_sub_factory = sub { + my $column = shift; + sub { + #my $cdr = shift; + my $date = shift->$column(); + $date ? time2str( '%Y-%m-%d %T', $date ) : ''; #config time2str format? + }; +}; + +my %fields = ( + #any other formatters? + map { $_ => &{ $date_sub_factory }($_) } qw( startdate answerdate enddate ) +); + +my %links = ( + 'svcnum' => + sub { $_[0]->svcnum ? [ $p.'view/svc_phone.cgi?', 'svcnum' ] : ''; }, +); + +@fields = map { exists($fields{$_}) ? $fields{$_} : $_ } @fields; + + #checkbox column +my @links = ( '', map { exists($links{$_}) ? $links{$_} : '' } @fields ); + </%init> |