Skip Menu |

This queue is for tickets about the HTML-ReportWriter CPAN distribution.

Report information
The Basics
Id: 19776
Status: open
Priority: 0/
Queue: HTML-ReportWriter

People
Owner: OPIATE [...] cpan.org
Requestors: MARKSTOS [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.3.2
Fixed in: (no value)



Subject: PATCH: add get_sortable_arrayref
The attached patch adds get_sortable_arrayref(). It's of interest to those who want full control over the HTML generated. Related, it would be nice if the following modules were considered recommended but not required for this distibution: Template Spreadsheet::SimpleExcel Neither are required to use it successfully and usefully. Mark
Subject: sortable_arrayref.diff
Wed Jun 7 17:55:04 EDT 2006 mark@summersault.com * add get_sortable_arrayref() to HTML::ReportWriter::PagingAndSorting diff -rN old-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm new-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm 726a727,778 > =item B<get_sortable_arrayref()> > > $cols_aref = $pager->get_sortable_arrayref(); > > An alternative to C<get_sortable_table_header> for those who want full control over the HTML. > Produces an arrayref of hashrefs, following this model. > > $cols_aref = [ > { > url => 'http://...', # (may be null of the column is not sortable) > display => 'Title', # from options given to new() > is_current => 1, # whether or not this column is the current sort column > sort_asc => 1, # true if sorted ascending > } > .... > ] > ); > > Here's an example of how it might be used with L<HTML::Template>. This example assumes > that every column is "sortable". > > <tr> > <!-- tmpl_loop columns --> > <th><a href="<tmpl_var url>"><!-- tmpl_var display --></a> > <!-- tmpl_if is_current --> > <!-- tmpl_if sort_asc -->^<!-- tmpl_else -->v<!--/tmpl_if --> > <!-- /tmpl_if --> > </th> > <!-- /tmpl_loop --> > </tr> > > =cut > > sub get_sortable_arrayref > { > my $self = shift; > > my $cols = []; > > foreach my $col (@{$self->{'SORTABLE_COLUMNS'}}) > { > push @$cols, { > sort_asc => ($self->{'CURRENT_SORT_DIR'} eq 'ASC'), > url => ($col->{'sortable'} ? $self->get_sort_link($col->{'get'}) : ''), > display => $col->{'display'}, > is_current => (defined($self->{'CURRENT_SORT_COL'}) && $col->{'get'} eq $self->{'CURRENT_SORT_COL'}), > } > } > > return $cols; > } >
Template and Spreadsheet::SimpleExcel have been removed from the requirements as of version 1.4.0. I am evaluating the patch and will release it in a forthcoming version. Also, copied from a followup email: Here's two patches for the docs and code to add "is_sortable" to the new arrayref routine: * document is_sortable option diff -rN old-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm new-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm 741,744c741,745 < url => 'http://...', # (may be null of the column is not sortable) < display => 'Title', # from options given to new() < is_current => 1, # whether or not this column is the current sort column < sort_asc => 1, # true if sorted ascending --- Show quoted text
> url => 'http://...', # (may be null of the column is
not sortable) Show quoted text
> display => 'Title', # from options given to new() > is_current => 1, # whether or not this column is
the current sort column Show quoted text
> is_sortable => 1, # from "sortable" option given
to new() Show quoted text
> sort_asc => 1, # true if sorted ascending
diff -rN -u old-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm new-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm --- old-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm 2006-06-09 14:25:16.000000000 -0400 +++ new-miami/perllib/HTML/ReportWriter/PagingAndSorting.pm 2006-06-09 14:25:16.000000000 -0400 @@ -775,6 +775,7 @@ url => ($col->{'sortable'} ? $self->get_sort_link($col->{'get'}) : ''), display => $col->{'display'}, is_current => (defined($self->{'CURRENT_SORT_COL'}) && $col->{'get'} eq $self->{'CURRENT_SORT_COL'}), + is_sortable => $col->{'sortable'}, } }
Subject: PATCH: add get_sortable_arrayref (accept or reject?)
Hello, It's been two years now. Any thoughts on whether to accept or reject this patch? Mark On Wed Jun 07 18:01:20 2006, MARKSTOS wrote: Show quoted text
> The attached patch adds get_sortable_arrayref(). It's of interest to > those who want full control over the HTML generated. > > Related, it would be nice if the following modules were considered > recommended but not required for this distibution: > > Template > Spreadsheet::SimpleExcel > > Neither are required to use it successfully and usefully. > > Mark >
I submitted this patch 5 years ago. Any comment on whether it will be accepted or not? Would you like me to be a co-maintainer of the distribution? Mark