]> git.decadent.org.uk Git - maypole.git/commitdiff
fixed search ordering in Maypole::Model::CDBI and parameter handling in CGI::Maypole
authorSebastian Riedel <sri@labs.kraih.com>
Fri, 8 Oct 2004 20:57:32 +0000 (20:57 +0000)
committerSebastian Riedel <sri@labs.kraih.com>
Fri, 8 Oct 2004 20:57:32 +0000 (20:57 +0000)
git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@218 48953598-375a-da11-a14b-00016c27c3ee

Changes
lib/CGI/Maypole.pm
lib/Maypole.pm
lib/Maypole/Model/CDBI.pm

diff --git a/Changes b/Changes
index c030cf0e43233b083838ed8b0dd00a829f20948e..dd3db0e0ecd0387a2a55365709b9cebb7eff1a85 100644 (file)
--- 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
     - 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.
       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
 
 1.7   Sat Jul 17 20:15:26 BST 2004
     - Emergency release - we lost the "use Maypole::Constants" from
index 67cbf92f1c08e34325e1c767b5ffb845393632ff..ac0a4bac34111dd744564e65c2af4da8121168a1 100644 (file)
@@ -30,7 +30,7 @@ sub parse_args {
     my (%vars) = $self->{cgi}->Vars;
     while ( my ( $key, $value ) = each %vars ) {
         my @values = split "\0", $value;
     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};
     }
     $self->{params} = {%vars};
     $self->{query}  = {%vars};
index 597ab7c5a66f679696e62a84279c49f9501957fe..6b4fe3f0a56d250f7261e2cfc4e53cb98449cbb2 100644 (file)
@@ -406,7 +406,7 @@ Simon Cozens, C<simon@cpan.org>
 
 =head1 THANK YOU
 
 
 =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.
 
 Mickael Joanne, Simon Flack, Veljko Vidovic and all the others who've
 helped.
 
index 6ad14171255cad627ee61722099fbe4cd190a71a..171c9164b21de239d2dcde9e75f20200eebb2765 100644 (file)
@@ -105,8 +105,9 @@ sub search : Exported {
     $self = $self->do_pager($r);
     $r->objects(
         [
     $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;
         ]
     );
     $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" );
     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 ) = @_;
 
 sub list : Exported {
     my ( $self, $r ) = @_;
@@ -144,19 +145,21 @@ sub list : Exported {
 }
 
 sub setup_database {
 }
 
 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);
     $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 ];
 }
     $config->{classes} = [ $config->{loader}->classes ];
     $config->{tables}  = [ $config->{loader}->tables ];
 }