Class::DBI::Plugin::RetrieveAll => 0,
Class::DBI::Loader::Relationship => 0,
Class::DBI => 0.96,
- Class::DBI::SQLite => 0,
+ Class::DBI::SQLite => 0.08,
CGI::Untaint => 1.26,
CGI::Untaint::date => 0,
CGI::Untaint::email => 0,
Note that some details in some of these resources may be out of date.
-=over 4
+=over 4
=item The Maypole Manual
=item Web applications with Maypole
A tutorial written by Simon Cozens for YAPC::EU 2005 -
-http://www.droogs.org/perl/maypole/maypole-tutorial.pdf [228KB].
+http://www.aarontrevena.co.uk/opensource/maypole/maypole-tutorial.pdf [228KB].
=item A Database-Driven Web Application in 18 Lines of Code
=item Authentication
Some notes written by Simon Cozens. A little bit out of date, but still
-very useful: http://www.droogs.org/perl/maypole/authentication.html
+very useful: http://www.aarontrevena.co.uk/opensource/maypole/authentication.html
=item CheatSheet
=back
-=head1 DEMOS
-
-A couple of demos are available, sometimes with source code and configs.
-
-=over 4
-
-=item http://maypole.perl.org/beerdb/
-
-The standard BeerDB example, using the TT factory templates supplied in the
-distribution.
-
-=item beerdb.riverside-cms.co.uk
-
-The standard BeerDB example, running on Mason, using the factory templates
-supplied in the L<MasonX::Maypole> distribution.
-
-=item beerfb.riverside-cms.co.uk
-
-A demo of L<Maypole::FormBuilder>. This site is running on the set of Mason
-templates included in the L<Maypole::FormBuilder> distribution. See the
-synopsis of L<Maypole::Plugin::FormBuilder> for an example driver
-
-=back
-
=cut
__PACKAGE__->mk_classdata($_) for qw( config init_done view_object model_classes_loaded);
=cut
-sub debug { 1 }
+sub debug { 0 }
=item config
L<Standard Templates and Actions|Maypole::Manual::StandardTemplates>
chapter and our case studies.
-=head2 What Maypole wants from a model
-
-=head2 Building your own model class
-
=head2 Links
L<Contents|Maypole::Manual>,
sub search : Exported {
my $self = shift;
my ($sub) = (caller(1))[3];
- $sub =~ /^(.+)::([^:]+)$/;
# So subclasses can still send search down ...
- return ($1 ne "Maypole::Model::Base" && $2 ne "search") ?
- $self->SUPER::search(@_) : $self->do_search(@_);
+ if ($sub =~ /^(.+)::([^:]+)$/) {
+ return ($1 ne "Maypole::Model::Base" && $2 ne "search") ?
+ $self->SUPER::search(@_) : $self->do_search(@_);
+ } else {
+ $self->SUPER::search(@_);
+ }
}
sub do_search : Exported {
end_form;
}
-# Example of has_many select
-package Job;
-__PACKAGE__->has_a('job_employer' => 'Employer');
-__PACKAGE__->has_a('contact' => 'Contact')
-
-package Contact;
-__PACKAGE__->has_a('cont_employer' => 'Employer');
-__PACKAGE__->has_many('jobs' => 'Job',
- { join => { job_employer => 'cont_employer' },
- constraint => { 'finshed' => 0 },
- order_by => "created ASC",
- }
-);
-
-package Employer;
-__PACKAGE__->has_many('jobs' => 'Job',);
-__PACKAGE__->has_many('contacts' => 'Contact',
- order_by => 'name DESC',
-);
+
+ . . .
+
+ # Somewhere else in a Maypole application about beer...
+
+
+
+
+ $beer->to_field('brewery', 'textfield', {
+ name => 'brewery_id', value => $beer->brewery,
+ # however, no need to set value since $beer is object
+ });
+
+ # Rate a beer
+ $beer->to_field(rating => select => {
+ items => [1 , 2, 3, 4, 5],
+ });
+
+ # Select a Brewery to visit in the UK
+ Brewery->to_field(brewery_id => {
+ items => [ Brewery->search_like(location => 'UK') ],
+ });
+
+ # Make a select for a boolean field
+ $Pub->to_field('open' , { items => [ {'Open' => 1, 'Closed' => 0 } ] });
+
+ $beer->to_field('brewery', {
+ selected => $beer->brewery, # again not necessary since caller is obj.
+ });
+
+
+ $beer->to_field('brewery', 'link_hidden', {r => $r, uri => 'www.maypole.perl.org/brewery/view/'.$beer->brewery});
+ # an html link that is also a hidden input to the object. R is required to
+ # make the uri unless you pass a uri
+
+
+
+ #####################################################
+ # Templates Usage
+
+ <form ..>
+
+ ...
+
+ <label>
+
+ <span class="field"> [% classmetadata.colnames.$col %] : </span>
+
+ [% object.to_field(col).as_XML %]
+
+ </label>
+
+ . . .
+
+ <label>
+
+ <span class="field"> Brewery : </span>
+
+ [% object.to_field('brewery', { selected => 23} ).as_XML %]
+
+ </label>
+
+ . . .
+
+
+ #####################################################
+ # Advanced Usage
+
+ # has_many select
+ package Job;
+ __PACKAGE__->has_a('job_employer' => 'Employer');
+ __PACKAGE__->has_a('contact' => 'Contact')
+
+ package Contact;
+ __PACKAGE__->has_a('cont_employer' => 'Employer');
+ __PACKAGE__->has_many('jobs' => 'Job',
+ { join => { job_employer => 'cont_employer' },
+ constraint => { 'finshed' => 0 },
+ order_by => "created ASC",
+ }
+ );
+
+ package Employer;
+ __PACKAGE__->has_many('jobs' => 'Job',);
+ __PACKAGE__->has_many('contacts' => 'Contact',
+ order_by => 'name DESC',
+ );
# Choose some jobs to add to a contact (has multiple attribute).
# Choose a job from $contact->jobs
my $job_sel = $contact->to_field('jobs');
+ 1;
+
+
=head1 DESCRIPTION
$obj = $obj->add_to_from_cgi($r);
$obj = $obj->add_to_from_cgi($r, { params => {...} } );
-
+
# This does not work like in CDBI::FromCGI and probably never will :
# $class->update_from_cgi($h, @columns);
Foo->config->model("Maypole::Model::CDBI::Plain");
Foo->setup([qw/ Foo::SomeTable Foo::Other::Table /]);
+ # untaint columns and provide custom actions for each class
+
+ Foo::SomeTable->untaint_columns(email => ['email'], printable => [qw/name description/]);
+
+ Foo::Other::Table->untaint_columns ( ... );
+
+ sub Foo::SomeTable::SomeAction : Exported {
+
+ . . .
+
+ }
+
=head1 DESCRIPTION
This module allows you to use Maypole with previously set-up
use Test::More;
use lib 'ex'; # Where BeerDB should live
BEGIN {
- $ENV{BEERDB_DEBUG} = 2;
+ $ENV{BEERDB_DEBUG} = 0;
eval { require BeerDB };
Test::More->import( skip_all =>
skip $skip_msg, $skip_howmany if $err;
$DB_Class->table($table);
#use Data::Dumper;
-#warn "colinfo is " . Dumper($DB_Class->_column_info());
run_method_tests($DB_Class,'column_type', %correct_types);
# No support default
#run_method_tests($DB_Class,'column_default', %correct_defaults);
my ($uri_basepath,$uri_query) = split(/\?/,$uri);
- warn "\nuri : '$uri'\nexpected : '$expected'\n";
- warn "uri_basepath : $uri_basepath, uri_query : $uri_query\n";
-
my $q_got = new CGI($uri_query);
if ($uri_query) {