From: Aaron Trevena Date: Fri, 15 Jul 2005 08:24:22 +0000 (+0000) Subject: more small changes X-Git-Tag: 2.10~4 X-Git-Url: https://git.decadent.org.uk/gitweb/?a=commitdiff_plain;h=1832705643db5a1ca965d83db327dc5c7ec73ad1;p=maypole.git more small changes git-svn-id: http://svn.maypole.perl.org/Maypole/trunk@360 48953598-375a-da11-a14b-00016c27c3ee --- diff --git a/Changes b/Changes index 468ab1d..718872b 100644 --- a/Changes +++ b/Changes @@ -2,7 +2,7 @@ This file documents the revision history for Perl extension Maypole. For information about current developments and future releases, see: http://maypole.perl.org/?TheRoadmap -2.10_pre4 Wed 13 Jul 2005 +2.10_pre5 Thu 14 Jul 2005 Multiple Template Paths added ( http://rt.cpan.org/NoAuth/Bug.html?id=13447 ) Small fix to templates/factory/frontpage ( http://rt.cpan.org/NoAuth/Bug.html?id=11236 ) MasonX support in Maypole::Application ( https://rt.cpan.org/NoAuth/Bug.html?id=12383 ) @@ -12,6 +12,7 @@ For information about current developments and future releases, see: Fix to plugin to allow Maypole::Plugin::Config::YAML to work Fix to Maypole::Model::CDBI order sub from list Improvement to primary display column using CDBI + Improved efficiency of finding stringified columns using new classmetadata field Additional Requirements : Digest::MD5 diff --git a/lib/Maypole.pm b/lib/Maypole.pm index f3978ab..3fea662 100644 --- a/lib/Maypole.pm +++ b/lib/Maypole.pm @@ -7,7 +7,7 @@ use Maypole::Config; use Maypole::Constants; use Maypole::Headers; -our $VERSION = '2.10_pre4'; +our $VERSION = '2.10_pre5'; __PACKAGE__->mk_classdata($_) for qw( config init_done view_object ); __PACKAGE__->mk_accessors( diff --git a/lib/Maypole/Model/CDBI.pm b/lib/Maypole/Model/CDBI.pm index 0615f87..d99eb50 100644 --- a/lib/Maypole/Model/CDBI.pm +++ b/lib/Maypole/Model/CDBI.pm @@ -152,7 +152,8 @@ sub stringify_column { my $class = shift; return ( $class->columns("Stringify"), - ( grep { /^(name|title)/i } $class->columns ), + ( grep { /^(name|title)$/i } $class->columns ), + ( grep { /(name|title)/i } $class->columns ), ( grep { !/id$/i } $class->primary_columns ), )[0]; } diff --git a/lib/Maypole/Session.pm b/lib/Maypole/Session.pm index b8b03dc..309ff38 100644 --- a/lib/Maypole/Session.pm +++ b/lib/Maypole/Session.pm @@ -2,7 +2,7 @@ package Maypole::Session; =head1 NAME -Maypole::Constants - Maypole predefined constants +Maypole::Session - Session related functionality for maypole =head1 SYNOPSIS @@ -14,7 +14,11 @@ my $uid = Maypole::Session::generate_unique_id() This class provides session related methods for Maypole such as unique id's for requests. -=head1 METHODS +Currently it provides only the generate_unique_id() function, by checking the id's generated by this function and included in submitted forms, it is possible to see if a form has been submitted before.. implementing these checks is left to the developer of that application. + +Further functionality is to be added here in later versions to provide easy access to sessions, either through plugins or builtin methods. + +=head1 FUNCTIONS =head2 generate_unique_id() @@ -26,6 +30,7 @@ generates a unique id and returns it, requires no arguments but accepts size, de use strict; use Digest::MD5; +our $VERSION = 0.01; sub generate_unique_id { my $length = shift || 32; @@ -37,6 +42,9 @@ sub generate_unique_id { ################################################################################################### ################################################################################################### +=head1 TODO + +Currently implementing uniqueness tests of form submissions is left to the Maypole user, we plan to provide an optional default behaviour to automate this if required. =head1 SEE ALSO diff --git a/lib/Maypole/View/Base.pm b/lib/Maypole/View/Base.pm index a3d9466..9615950 100644 --- a/lib/Maypole/View/Base.pm +++ b/lib/Maypole/View/Base.pm @@ -55,6 +55,7 @@ sub vars { $classmeta->{moniker} ||= $class->moniker; $classmeta->{plural} ||= $class->plural_moniker; $classmeta->{cgi} ||= { $class->to_cgi }; + $classmeta->{stringify_column} ||= $class->stringify_column; # User-friendliness facility for custom template writers. if ( @{ $r->objects || [] } > 1 ) { diff --git a/templates/factory/macros b/templates/factory/macros index 8743afc..2af0a6c 100644 --- a/templates/factory/macros +++ b/templates/factory/macros @@ -59,7 +59,7 @@ for some. ""; IF col == "url" AND item.url; ' '; item.url; ''; - ELSIF col == item.stringify_column; + ELSIF col == classmetadata.stringifycolumn; maybe_link_view(item); ELSE; accessor = item.accessor_name(col); @@ -128,7 +128,7 @@ This takes an object and and displays its properties in a table. #%] [% MACRO view_item(item) BLOCK; %] - [% SET string = item.stringify_column %] + [% SET string = classmetadata.stringifycolumn %]
[% item.$string %]
[% INCLUDE navbar %]