From 2225b4184a391bab5f1d9498d5b695ba0c2f09f2 Mon Sep 17 00:00:00 2001 From: Sebastian Riedel Date: Fri, 8 Oct 2004 20:57:32 +0000 Subject: [PATCH] fixed search ordering in Maypole::Model::CDBI and parameter handling in CGI::Maypole git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@218 48953598-375a-da11-a14b-00016c27c3ee --- Changes | 4 +++- lib/CGI/Maypole.pm | 2 +- lib/Maypole.pm | 2 +- lib/Maypole/Model/CDBI.pm | 27 +++++++++++++++------------ 4 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Changes b/Changes index c030cf0..dd3db0e 100644 --- a/Changes +++ b/Changes @@ -21,10 +21,12 @@ Revision history for Perl extension Maypole - moved doc/*.pod to lib/Maypole/Manual - added Maypole::Model::Base::is_public() to make it simple to overload :Exported behavior - - Added support for replacing use base qw/All My Modules/ with + - added support for replacing use base qw/All My Modules/ with use Maypole::Application qw/Redirect AnotherPlugin/; note that this will only triggers with parameters to import, to preserve backwards compability. + - fixed search ordering in Maypole::Model::CDBI and parameter + handling in CGI::Maypole (Dave Slack) 1.7 Sat Jul 17 20:15:26 BST 2004 - Emergency release - we lost the "use Maypole::Constants" from diff --git a/lib/CGI/Maypole.pm b/lib/CGI/Maypole.pm index 67cbf92..ac0a4ba 100644 --- a/lib/CGI/Maypole.pm +++ b/lib/CGI/Maypole.pm @@ -30,7 +30,7 @@ sub parse_args { my (%vars) = $self->{cgi}->Vars; while ( my ( $key, $value ) = each %vars ) { my @values = split "\0", $value; - $vars{$key} = @values == 1 ? $values[0] : \@values; + $vars{$key} = @values <= 1 ? $values[0] : \@values; } $self->{params} = {%vars}; $self->{query} = {%vars}; diff --git a/lib/Maypole.pm b/lib/Maypole.pm index 597ab7c..6b4fe3f 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -406,7 +406,7 @@ Simon Cozens, C =head1 THANK YOU -Danijel Milicevic, Jesse Sheidlower, Jody Belka, Marcus Ramberg, +Danijel Milicevic, Dave Slack, Jesse Sheidlower, Jody Belka, Marcus Ramberg, Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've helped. diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 6ad1417..171c916 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -105,8 +105,9 @@ sub search : Exported { $self = $self->do_pager($r); $r->objects( [ - $self->search_where( \%values ), - ( $order ? { order => $order } : () ) + $self->search_where( + \%values, ( $order ? { order => $order } : () ) + ) ] ); $r->{template_args}{search} = 1; @@ -127,9 +128,9 @@ sub order { my %ok_columns = map { $_ => 1 } $self->columns; if ( $order = $r->query->{order} and $ok_columns{$order} ) { $order .= ( $r->query->{o2} eq "desc" && " DESC" ); - } - $order; } + $order; +} sub list : Exported { my ( $self, $r ) = @_; @@ -144,19 +145,21 @@ sub list : Exported { } sub setup_database { - my ($self, $config, $namespace, $dsn, $u, $p, $opts) = @_; + my ( $self, $config, $namespace, $dsn, $u, $p, $opts ) = @_; $dsn ||= $config->dsn; $u ||= $config->user; $p ||= $config->pass; $opts ||= $config->opts; $config->dsn($dsn); - $config->loader || $config->loader( Class::DBI::Loader->new( - namespace => $namespace, - dsn => $dsn, - user => $u, - password => $p, - options => $opts, - ) ); + $config->loader || $config->loader( + Class::DBI::Loader->new( + namespace => $namespace, + dsn => $dsn, + user => $u, + password => $p, + options => $opts, + ) + ); $config->{classes} = [ $config->{loader}->classes ]; $config->{tables} = [ $config->{loader}->tables ]; } -- 2.39.5