[prev in list] [next in list] [prev in thread] [next in thread]
List: bricolage-commits
Subject: [6069] Fix for Bug # 878.
From: theory () bricolage ! cc
Date: 2004-11-09 18:18:36
Message-ID: 20041109181836.28143.qmail () x1 ! develooper ! com
[Download RAW message or body]
Revision: 6069
Author: theory
Date: 2004-11-09 10:18:34 -0800 (Tue, 09 Nov 2004)
ViewCVS: http://viewsvn.bricolage.cc/?rev=6069&view=rev
Log Message:
-----------
Fix for Bug # 878. Changing the sort order of search results now effectively reverses
the order for all pages, not just the current page.
Bugzilla Links:
--------------
http://bugs.bricolage.cc/show_bug.cgi?id=878
Modified Files:
--------------
bricolage/branches/rev_1_8/comp/widgets/listManager/full_list.mc
bricolage/branches/rev_1_8/comp/widgets/listManager/listManager.mc
bricolage/branches/rev_1_8/lib/Bric/Changes.pod
["r6069-theory.diff" (r6069-theory.diff)]
Modified: bricolage/branches/rev_1_8/comp/widgets/listManager/full_list.mc
===================================================================
--- bricolage/branches/rev_1_8/comp/widgets/listManager/full_list.mc 2004-11-09 18:17:33 UTC (rev 6068)
+++ bricolage/branches/rev_1_8/comp/widgets/listManager/full_list.mc 2004-11-09 18:18:34 UTC (rev 6069)
@@ -67,10 +67,6 @@
%# Output the rows of data
% my $first;
-% if ($sortOrder eq 'reverse') {
-% @$data = reverse @$data;
-% }
-
% # here's where the rows diplayed are limited - see lines 209-18
% foreach my $r (0..$#{$data}) {
% my $o_id = shift @{$data->[$r]};
Modified: bricolage/branches/rev_1_8/comp/widgets/listManager/listManager.mc
===================================================================
--- bricolage/branches/rev_1_8/comp/widgets/listManager/listManager.mc 2004-11-09 18:17:33 UTC (rev 6068)
+++ bricolage/branches/rev_1_8/comp/widgets/listManager/listManager.mc 2004-11-09 18:18:34 UTC (rev 6069)
@@ -458,17 +458,17 @@
#--------------------------------------#
# Sort the objects.
-my @sort_objs = $sort_objects->(\@objects, $meth, $exclude);
+my $sort_objs = $sort_objects->(\@objects, $meth, $exclude);
# Make sure we have some results.
-my $no_results = @sort_objs == 0 && $do_list;
+my $no_results = @$sort_objs == 0 && $do_list;
#--------------------------------------#
# Build the table data array
# Search Paging vars - also see $insert_footer and build_table_data()
# number of records returned from lookup
-my $count = scalar @sort_objs;
+my $count = scalar @$sort_objs;
my ($pages, $current_page) = (1,1);
if ($limit) {
@@ -483,7 +483,7 @@
# save persistent values
set_state_data($widget, 'pagination', $pagination);
-my ($rows, $cols, $data) = $build_table_data->(\@sort_objs,
+my ($rows, $cols, $data) = $build_table_data->($sort_objs,
$meth,
$fields,
$select,
@@ -626,7 +626,7 @@
my $slice;
if ($pagination) {
# make sure $limit + $offset is within range
- my $end = $limit + $offset > $count - 1 ? $count - 1 :
+ my $end = $limit + $offset > $count - 1 ? $count - 1 :
($limit + $offset - 1);
# extract array slice
@@ -743,15 +743,14 @@
my $recursivesort;
my $multisort = sub {
my ($meth, @sort_list) = @_;
- my $sort_by = shift @sort_list;
+ my $sort_by = shift @sort_list;
my ($sort_get, $sort_arg) = @{$meth->{$sort_by}}{'get_meth', 'get_args'};
my $type = $meth->{$sort_by}{props}{type};
my $val;
if ($sort_by eq 'id'|| $sort_by eq 'version') {
# Do a numeric sorting.
- $val = $sort_get->($a, @$sort_arg) <=>
- $sort_get->($b, @$sort_arg);
+ $val = $sort_get->($a, @$sort_arg) <=> $sort_get->($b, @$sort_arg);
} elsif ($type eq 'date') {
# Pass in the ISO format so that it always sorts properl.
$val = $sort_get->($a, ISO_8601_FORMAT) cmp
@@ -798,7 +797,10 @@
@sort_objs = grep(not($exclude->($_)), @sort_objs);
}
- return @sort_objs;
+ my $sortOrder = get_state_data($widget, 'sortOrder') || '';
+ return defined $sortOrder && $sortOrder eq 'reverse'
+ ? [ reverse @sort_objs ]
+ : \@sort_objs;
};
</%once>
Modified: bricolage/branches/rev_1_8/lib/Bric/Changes.pod
===================================================================
--- bricolage/branches/rev_1_8/lib/Bric/Changes.pod 2004-11-09 18:17:33 UTC (rev 6068)
+++ bricolage/branches/rev_1_8/lib/Bric/Changes.pod 2004-11-09 18:18:34 UTC (rev 6069)
@@ -133,6 +133,12 @@
Added missing constraint to the "type" column of the "workflow" table. [David]
+=item *
+
+Changing the sort order of a list of items in a search interface now properly
+reverses the entire colletion of object over the pages, rather than just the
+objects for the current page. Thanks to Marshall for the spot! [David]
+
=back
=head2 Bug Fixes
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic