t/t00smoke.t
t/t10edit.t
t/t20gen.t
+t/t30rules.t Check for use strict and warnings
test.cfg.base
-VERSION=0.12_04
+VERSION=0.12_05
DISTNAME=bse-$(VERSION)
DISTBUILD=$(DISTNAME)
DISTTAR=../$(DISTNAME).tar
profession integer not null,
otherProfession varchar(127) not null,
+ previousLogon datetime not null,
+
primary key (id),
unique (userId)
);
'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'=>
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 {
}
sub validate_old {
- my ($self, $data, $articles, $rmsg, $errors) = @_;
+ my ($self, $article, $data, $articles, $rmsg, $errors) = @_;
$self->_validate_common($data, $articles, $errors);
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;
$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},
$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;
package Image;
-
+use strict;
# represents an image from the database
use Squirrel::Row;
use vars qw/@ISA/;
package Images;
-
+use strict;
use Squirrel::Table;
use vars qw(@ISA $VERSION);
@ISA = qw(Squirrel::Table);
package Order;
-
+use strict;
# represents an order from the database
use Squirrel::Row;
use vars qw/@ISA/;
package OrderItem;
-
+use strict;
# represents an order line item from the database
use Squirrel::Row;
use vars qw/@ISA/;
package OrderItems;
-
+use strict;
use Squirrel::Table;
use vars qw(@ISA $VERSION);
@ISA = qw(Squirrel::Table);
package Orders;
-
+use strict;
use Squirrel::Table;
use vars qw(@ISA $VERSION);
@ISA = qw(Squirrel::Table);
package OtherParents;
+use strict;
use Squirrel::Table;
use vars qw(@ISA $VERSION);
@ISA = qw(Squirrel::Table);
package Product;
-
+use strict;
# represents a product from the database
use Article;
use vars qw/@ISA/;
package Products;
-
+use strict;
use Squirrel::Table;
use vars qw(@ISA $VERSION);
@ISA = qw(Squirrel::Table);
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 {
package Squirrel::GPG;
+use strict;
sub new {
return bless {}, $_[0];
package Squirrel::PGP5;
+use strict;
sub new {
return bless {}, $_[0];
package Squirrel::PGP6;
+use strict;
sub new {
return bless {}, $_[0];
=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
<: iterator begin images :>
<tr bgcolor="#FFFFFF">
<td align="center" colspan="3"> <img src="/images/<: image image :>" alt="<: image alt :>" width="<:
- image height :>" height="<: image width :>"></td>
+ image width :>" height="<: image height :>"></td>
</tr>
<tr bgcolor="#FFFFFF">
<th width="50%"> Alt Text</th>
</tr>
<:iterator end files:>
</table>
- </td></tr></table>
+ </td></tr></table><br>
<:or Files:><p>No files are attached to this article.<:eif Files:>
<a href="<:script:>?filelist=1&id=<:article id:>"><b>Manage Files</b></a></p>
</td>
<td nowrap bgcolor="#FFFFFF" valign="top"><:help edit files:></td>
</tr>
<tr>
- <th valign="top" nowrap bgcolor="#FFFFFF" align="left"> Uploaded images:
+ <th valign="top" nowrap bgcolor="#FFFFFF" align="left"> Images:
</th>
- <td align="center" bgcolor="#FFFFFF" width="100%"><:if Images:> <p><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p> <:iterator begin
+ <td align="center" bgcolor="#FFFFFF" width="100%"><:if Images:> <:iterator begin
images:> <img src="/images/<: image image :>" alt="<:image alt :>" width=
<:image width:> height=<:image height:>> <:iterator separator images:>
<hr noshade size="1">
- <: iterator end images :> <br>
- <:or Images:><p>No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <: iterator end images :>
+ <p align="left"><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <:or Images:><p align="left">No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
<:eif Images:>
</td>
<td bgcolor="#FFFFFF" valign="top"><:help edit images:> </td>
<td nowrap bgcolor="#FFFFFF" valign="top"><:help edit files:></td>
</tr>
<tr>
- <th valign="top" bgcolor="#FFFFFF" nowrap align="left"> Uploaded images:
+ <th valign="top" bgcolor="#FFFFFF" nowrap align="left"> Images:
</th>
- <td align="center" bgcolor="#FFFFFF" width="100%"> <:if Images:> <p><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p> <:iterator begin
+ <td align="center" bgcolor="#FFFFFF" width="100%"> <:if Images:> <:iterator begin
images:> <img src="/images/<: image image :>" alt="<:image alt :>" width=
<:image width:> height=<:image height:>> <:iterator separator images:>
<hr noshade size="1">
- <: iterator end images :> <br>
- <:or Images:><p>No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <: iterator end images :>
+ <p align="left"><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <:or Images:><p align="left">No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
<:eif Images:>
</td>
<td bgcolor="#FFFFFF" valign="top"><:help catalog images:></td>
<:if HaveChildType:>
<:if new:>
<:or new:>
-<table><tr>
-<td><form action="/cgi-bin/admin/add.pl" method="POST">
+<p>
+<form action="/cgi-bin/admin/add.pl" method="POST">
<input type=hidden name="parentid" value="<:article id:>">
<input type=hidden name="type" value="Catalog">
-<p>
+
<input type=submit value="Add Sub-catalog">
- </p>
-</form></td>
-<td><form action="/cgi-bin/admin/add.pl" method="POST">
+</form>
+<form action="/cgi-bin/admin/add.pl" method="POST">
<input type=hidden name="parentid" value="<:article id:>">
<input type=hidden name="parentid" value="Product">
-<p>
<input type=submit value="Add Product">
- </p>
-</form></td></tr></table>
+</form></p>
<:eif new:> <:or HaveChildType:> <:eif HaveChildType:>
<p><font size="-1">BSE Release <:release:></font></p>
</body
</table>
</td>
</tr>
- </table>
+ </table><br>
<:or Files:><p>No files are attached to this article.<:eif Files:>
<a href="<:script:>?filelist=1&id=<:product id:>"><b>Manage Files</b></a></p>
</td>
files:></td>
</tr>
<tr>
- <th valign="top" nowrap bgcolor="#FFFFFF" align="left"> Uploaded images:
+ <th valign="top" nowrap bgcolor="#FFFFFF" align="left"> Images:
</th>
- <td align="center" bgcolor="#FFFFFF" width="100%"> <:if Images:> <p><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p> <:iterator begin
+ <td align="center" bgcolor="#FFFFFF" width="100%"> <:if Images:> <:iterator begin
images:> <img src="/images/<: image image :>" alt="<:image alt :>" width=
<:image width:> height=<:image height:>> <:iterator separator images:>
<hr noshade size="1">
- <: iterator end images :> <br>
- <:or Images:><p>No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <: iterator end images :>
+ <p align="left"><a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
+ <:or Images:><p align="left">No images are attached to this article. <a href="<:script:>?id=<:article id:>&showimages=1"><b>Manage Images</b></a></p>
<:eif Images:>
</td>
<td valign="top" bgcolor="#FFFFFF" width="100%"><:help product images:></td>
<td align="center">
<p><font face="Verdana, Arial, Helvetica, sans-serif" size="2">Hello <:user
userId:><br>
- Last logged in: <:date user lastLogon:></font><br>
+ Last logged in: <:date user previousLogon:></font><br>
<br>
</p>
</td>
--- /dev/null
+#!perl -w
+use strict;
+use BSE::Test qw(ok);
+use File::Find;
+
+my @files;
+open MANIFEST, "< MANIFEST" or die "Cannot open MANIFEST";
+while (<MANIFEST>) {
+ 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 $/; <SRC> };
+ close SRC;
+ ok($data =~ /^use\s+strict/m, "use strict in $file");
+ if ($file =~ /\.(pl|t)$/) {
+ ok($data =~ /#!.*perl.*-w/, "-w in $file");
+ }
+}