From: Tony Cook Date: Wed, 14 Aug 2002 04:10:39 +0000 (+0000) Subject: 0.12_05 commit X-Git-Tag: bse-0.15_56~283 X-Git-Url: http://git.imager.perl.org/bse.git/commitdiff_plain/15fb10f23354d131bb3c7903bddebba06811ad58 0.12_05 commit --- diff --git a/MANIFEST b/MANIFEST index 4041f1e5..5d027e4d 100644 --- a/MANIFEST +++ b/MANIFEST @@ -254,4 +254,5 @@ t/BSE/Test.pm t/t00smoke.t t/t10edit.t t/t20gen.t +t/t30rules.t Check for use strict and warnings test.cfg.base diff --git a/Makefile b/Makefile index 7366972b..29c7774d 100755 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -VERSION=0.12_04 +VERSION=0.12_05 DISTNAME=bse-$(VERSION) DISTBUILD=$(DISTNAME) DISTTAR=../$(DISTNAME).tar diff --git a/schema/bse.sql b/schema/bse.sql index c82e50af..ced97e9e 100644 --- a/schema/bse.sql +++ b/schema/bse.sql @@ -399,6 +399,8 @@ create table site_users ( profession integer not null, otherProfession varchar(127) not null, + previousLogon datetime not null, + primary key (id), unique (userId) ); diff --git a/site/cgi-bin/modules/BSE/DB/Mysql.pm b/site/cgi-bin/modules/BSE/DB/Mysql.pm index 08d2ac9f..aef15e3a 100644 --- a/site/cgi-bin/modules/BSE/DB/Mysql.pm +++ b/site/cgi-bin/modules/BSE/DB/Mysql.pm @@ -103,8 +103,8 @@ EOS 'select * from site_users where userId = ?', getSiteUserByPkey => 'select * from site_users where id = ?', - addSiteUser => 'insert site_users values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', - replaceSiteUser => 'replace site_users values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', + addSiteUser => 'insert site_users values(null,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', + replaceSiteUser => 'replace site_users values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)', 'SiteUsers.removeSubscriptions'=> 'delete from subscribed_users where userId = ?', 'SiteUsers.removeSub'=> diff --git a/site/cgi-bin/modules/BSE/Edit/Article.pm b/site/cgi-bin/modules/BSE/Edit/Article.pm index 9b5f0c62..abd6453a 100644 --- a/site/cgi-bin/modules/BSE/Edit/Article.pm +++ b/site/cgi-bin/modules/BSE/Edit/Article.pm @@ -266,16 +266,16 @@ sub iter_get_images { sub iter_get_kids { my ($article, $articles) = @_; + my @children; $article->{id} or return; if (UNIVERSAL::isa($article, 'Article')) { - $article->children; + @children = $article->children; } elsif ($article->{id}) { - return $articles->children($article->{id}); - } - else { - return; + @children = $articles->children($article->{id}); } + + return sort { $b->{displayOrder} <=> $a->{displayOrder} } @children; } sub tag_if_have_child_type { @@ -944,7 +944,7 @@ sub validate { } sub validate_old { - my ($self, $data, $articles, $rmsg, $errors) = @_; + my ($self, $article, $data, $articles, $rmsg, $errors) = @_; $self->_validate_common($data, $articles, $errors); diff --git a/site/cgi-bin/modules/BSE/UserReg.pm b/site/cgi-bin/modules/BSE/UserReg.pm index 6d1cf3fc..5a683d67 100644 --- a/site/cgi-bin/modules/BSE/UserReg.pm +++ b/site/cgi-bin/modules/BSE/UserReg.pm @@ -9,6 +9,7 @@ use BSE::SubscriptionTypes; use BSE::SubscribedUsers; use BSE::Mail; use BSE::EmailRequests; +use BSE::Util::SQL qw/now_datetime/; use constant MAX_UNACKED_CONF_MSGS => 3; use constant MIN_UNACKED_CONF_GAP => 2 * 24 * 60 * 60; @@ -84,6 +85,9 @@ sub logon { $msgs->(baduserpass=>"Invalid user or password")); } $session->{userid} = $user->{userId}; + $user->{previousLogon} = $user->{lastLogon}; + $user->{lastLogon} = now_datetime; + $user->save; use CGI::Cookie; print "Set-Cookie: ",CGI::Cookie->new(-name=>"userid", -value=>$user->{userId}, @@ -397,8 +401,8 @@ sub register { $user{userId} = $userid; $user{password} = $pass; $user{email} = $email; - use BSE::Util::SQL qw/now_datetime/; - $user{lastLogon} = $user{whenRegistered} = now_datetime; + $user{lastLogon} = $user{whenRegistered} = + $user{previousLogon} = now_datetime; $user{keepAddress} = 0; $user{wantLetter} = 0; diff --git a/site/cgi-bin/modules/Image.pm b/site/cgi-bin/modules/Image.pm index bb8655f7..4ca07d50 100644 --- a/site/cgi-bin/modules/Image.pm +++ b/site/cgi-bin/modules/Image.pm @@ -1,5 +1,5 @@ package Image; - +use strict; # represents an image from the database use Squirrel::Row; use vars qw/@ISA/; diff --git a/site/cgi-bin/modules/Images.pm b/site/cgi-bin/modules/Images.pm index d7cd601d..15e03762 100644 --- a/site/cgi-bin/modules/Images.pm +++ b/site/cgi-bin/modules/Images.pm @@ -1,5 +1,5 @@ package Images; - +use strict; use Squirrel::Table; use vars qw(@ISA $VERSION); @ISA = qw(Squirrel::Table); diff --git a/site/cgi-bin/modules/Order.pm b/site/cgi-bin/modules/Order.pm index fe7f2082..9325c290 100644 --- a/site/cgi-bin/modules/Order.pm +++ b/site/cgi-bin/modules/Order.pm @@ -1,5 +1,5 @@ package Order; - +use strict; # represents an order from the database use Squirrel::Row; use vars qw/@ISA/; diff --git a/site/cgi-bin/modules/OrderItem.pm b/site/cgi-bin/modules/OrderItem.pm index 3efa940d..0cbbed14 100644 --- a/site/cgi-bin/modules/OrderItem.pm +++ b/site/cgi-bin/modules/OrderItem.pm @@ -1,5 +1,5 @@ package OrderItem; - +use strict; # represents an order line item from the database use Squirrel::Row; use vars qw/@ISA/; diff --git a/site/cgi-bin/modules/OrderItems.pm b/site/cgi-bin/modules/OrderItems.pm index 9867a693..2560b34b 100644 --- a/site/cgi-bin/modules/OrderItems.pm +++ b/site/cgi-bin/modules/OrderItems.pm @@ -1,5 +1,5 @@ package OrderItems; - +use strict; use Squirrel::Table; use vars qw(@ISA $VERSION); @ISA = qw(Squirrel::Table); diff --git a/site/cgi-bin/modules/Orders.pm b/site/cgi-bin/modules/Orders.pm index 2d044d3c..a99b17e3 100644 --- a/site/cgi-bin/modules/Orders.pm +++ b/site/cgi-bin/modules/Orders.pm @@ -1,5 +1,5 @@ package Orders; - +use strict; use Squirrel::Table; use vars qw(@ISA $VERSION); @ISA = qw(Squirrel::Table); diff --git a/site/cgi-bin/modules/OtherParents.pm b/site/cgi-bin/modules/OtherParents.pm index 89889e32..d3e8d570 100644 --- a/site/cgi-bin/modules/OtherParents.pm +++ b/site/cgi-bin/modules/OtherParents.pm @@ -1,4 +1,5 @@ package OtherParents; +use strict; use Squirrel::Table; use vars qw(@ISA $VERSION); @ISA = qw(Squirrel::Table); diff --git a/site/cgi-bin/modules/Product.pm b/site/cgi-bin/modules/Product.pm index e2a1e1f0..d1640a31 100644 --- a/site/cgi-bin/modules/Product.pm +++ b/site/cgi-bin/modules/Product.pm @@ -1,5 +1,5 @@ package Product; - +use strict; # represents a product from the database use Article; use vars qw/@ISA/; diff --git a/site/cgi-bin/modules/Products.pm b/site/cgi-bin/modules/Products.pm index d01f1cd1..fbaa20d7 100644 --- a/site/cgi-bin/modules/Products.pm +++ b/site/cgi-bin/modules/Products.pm @@ -1,5 +1,5 @@ package Products; - +use strict; use Squirrel::Table; use vars qw(@ISA $VERSION); @ISA = qw(Squirrel::Table); diff --git a/site/cgi-bin/modules/SiteUser.pm b/site/cgi-bin/modules/SiteUser.pm index a4991415..af304a2e 100644 --- a/site/cgi-bin/modules/SiteUser.pm +++ b/site/cgi-bin/modules/SiteUser.pm @@ -10,7 +10,7 @@ sub columns { name1 name2 address city state postcode telephone facsimile country wantLetter confirmed confirmSecret waitingForConfirmation textOnlyMail title organization referral otherReferral - prompt otherPrompt profession otherProfession/; + prompt otherPrompt profession otherProfession previousLogon/; } sub removeSubscriptions { diff --git a/site/cgi-bin/modules/Squirrel/GPG.pm b/site/cgi-bin/modules/Squirrel/GPG.pm index ed1b2a9b..4e43b396 100644 --- a/site/cgi-bin/modules/Squirrel/GPG.pm +++ b/site/cgi-bin/modules/Squirrel/GPG.pm @@ -1,4 +1,5 @@ package Squirrel::GPG; +use strict; sub new { return bless {}, $_[0]; diff --git a/site/cgi-bin/modules/Squirrel/PGP5.pm b/site/cgi-bin/modules/Squirrel/PGP5.pm index a822ff66..eeb8afa1 100644 --- a/site/cgi-bin/modules/Squirrel/PGP5.pm +++ b/site/cgi-bin/modules/Squirrel/PGP5.pm @@ -1,4 +1,5 @@ package Squirrel::PGP5; +use strict; sub new { return bless {}, $_[0]; diff --git a/site/cgi-bin/modules/Squirrel/PGP6.pm b/site/cgi-bin/modules/Squirrel/PGP6.pm index 2cffa0b7..61675f3c 100644 --- a/site/cgi-bin/modules/Squirrel/PGP6.pm +++ b/site/cgi-bin/modules/Squirrel/PGP6.pm @@ -1,4 +1,5 @@ package Squirrel::PGP6; +use strict; sub new { return bless {}, $_[0]; diff --git a/site/docs/bse.pod b/site/docs/bse.pod index 56d6ed9c..83ce6dc0 100644 --- a/site/docs/bse.pod +++ b/site/docs/bse.pod @@ -10,6 +10,40 @@ Maybe I'll add some other bits here. =head1 CHANGES +=head2 0.12_05 + +=over + +=item * + +test script to check that all modules and scripts have use strict and +all scripts have -w in the #! line + +=item * + +the width and height values were swapped for display of an articles +images in the image manager template + +=item * + +children weren't sorted on article editing pages + +=item * + +updated templates from Adrian. + +=item * + +added a previousLogon field to accept the last value of lastLogon at +logon, so the previous value could be displayed. + +=item * + +editing an article would give a server error on save (due to some late +changes) + +=back + =head2 0.12_04 =over diff --git a/site/templates/admin/article_img.tmpl b/site/templates/admin/article_img.tmpl index 660d5183..db98ab22 100644 --- a/site/templates/admin/article_img.tmpl +++ b/site/templates/admin/article_img.tmpl @@ -82,7 +82,7 @@ <: iterator begin images :> <: image alt :> + image width :>" height="<: image height :>"> Alt Text diff --git a/site/templates/admin/edit_1.tmpl b/site/templates/admin/edit_1.tmpl index 17cb36da..40ea3284 100644 --- a/site/templates/admin/edit_1.tmpl +++ b/site/templates/admin/edit_1.tmpl @@ -144,21 +144,22 @@ <:iterator end files:> - +
<:or Files:>

No files are attached to this article.<:eif Files:> Manage Files

<:help edit files:> - Uploaded images: + Images: - <:if Images:>

Manage Images

<:iterator begin + <:if Images:> <:iterator begin images:> <:image alt :> height=<:image height:>> <:iterator separator images:>
- <: iterator end images :>  
- <:or Images:>

No images are attached to this article. Manage Images

+ <: iterator end images :> +

Manage Images

+ <:or Images:>

No images are attached to this article. Manage Images

<:eif Images:> <:help edit images:> diff --git a/site/templates/admin/edit_catalog.tmpl b/site/templates/admin/edit_catalog.tmpl index 29f9ef67..e9938172 100644 --- a/site/templates/admin/edit_catalog.tmpl +++ b/site/templates/admin/edit_catalog.tmpl @@ -143,14 +143,15 @@ <:help edit files:> - Uploaded images: + Images: - <:if Images:>

Manage Images

<:iterator begin + <:if Images:> <:iterator begin images:> <:image alt :> height=<:image height:>> <:iterator separator images:>
- <: iterator end images :>  
- <:or Images:>

No images are attached to this article. Manage Images

+ <: iterator end images :> +

Manage Images

+ <:or Images:>

No images are attached to this article. Manage Images

<:eif Images:> <:help catalog images:> @@ -202,21 +203,18 @@ <:if HaveChildType:> <:if new:> <:or new:> - - -
+

+ -

+ -

-
+
+
-

-

-
+

<:eif new:> <:or HaveChildType:> <:eif HaveChildType:>

BSE Release <:release:>

- +
<:or Files:>

No files are attached to this article.<:eif Files:> Manage Files

@@ -155,14 +155,15 @@ files:> - Uploaded images: + Images: - <:if Images:>

Manage Images

<:iterator begin + <:if Images:> <:iterator begin images:> <:image alt :> height=<:image height:>> <:iterator separator images:>
- <: iterator end images :>  
- <:or Images:>

No images are attached to this article. Manage Images

+ <: iterator end images :> +

Manage Images

+ <:or Images:>

No images are attached to this article. Manage Images

<:eif Images:> <:help product images:> diff --git a/site/templates/user/userpage_base.tmpl b/site/templates/user/userpage_base.tmpl index 9a3be6ca..3fbf0896 100644 --- a/site/templates/user/userpage_base.tmpl +++ b/site/templates/user/userpage_base.tmpl @@ -40,7 +40,7 @@

Hello <:user userId:>
- Last logged in: <:date user lastLogon:>

+ Last logged in: <:date user previousLogon:>

diff --git a/t/t30rules.t b/t/t30rules.t new file mode 100644 index 00000000..a2709442 --- /dev/null +++ b/t/t30rules.t @@ -0,0 +1,25 @@ +#!perl -w +use strict; +use BSE::Test qw(ok); +use File::Find; + +my @files; +open MANIFEST, "< MANIFEST" or die "Cannot open MANIFEST"; +while () { + chomp; + next if /^\s*\#/; + s/\s+.*//; + push @files, $_ if /\.(pm|t|pl)$/; +} +close MANIFEST; +my @scripts = grep /\.(pl|t)$/, @files; +print "1..",scalar(@files) + scalar(@scripts),"\n"; +for my $file (@files) { + open SRC, "< $file" or die "Cannot open $file: $!"; + my $data = do { local $/; }; + close SRC; + ok($data =~ /^use\s+strict/m, "use strict in $file"); + if ($file =~ /\.(pl|t)$/) { + ok($data =~ /#!.*perl.*-w/, "-w in $file"); + } +}