0.12_05 commit r0_12_05
authorTony Cook <tony@develop-help.com>
Wed, 14 Aug 2002 04:10:39 +0000 (04:10 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Wed, 14 Aug 2002 04:10:39 +0000 (04:10 +0000)
26 files changed:
MANIFEST
Makefile
schema/bse.sql
site/cgi-bin/modules/BSE/DB/Mysql.pm
site/cgi-bin/modules/BSE/Edit/Article.pm
site/cgi-bin/modules/BSE/UserReg.pm
site/cgi-bin/modules/Image.pm
site/cgi-bin/modules/Images.pm
site/cgi-bin/modules/Order.pm
site/cgi-bin/modules/OrderItem.pm
site/cgi-bin/modules/OrderItems.pm
site/cgi-bin/modules/Orders.pm
site/cgi-bin/modules/OtherParents.pm
site/cgi-bin/modules/Product.pm
site/cgi-bin/modules/Products.pm
site/cgi-bin/modules/SiteUser.pm
site/cgi-bin/modules/Squirrel/GPG.pm
site/cgi-bin/modules/Squirrel/PGP5.pm
site/cgi-bin/modules/Squirrel/PGP6.pm
site/docs/bse.pod
site/templates/admin/article_img.tmpl
site/templates/admin/edit_1.tmpl
site/templates/admin/edit_catalog.tmpl
site/templates/admin/edit_product.tmpl
site/templates/user/userpage_base.tmpl
t/t30rules.t [new file with mode: 0644]

index 4041f1e5996862a8bfbe31ee67b20a779cabefcf..5d027e4d54cc39d9eecabe1e37d59e141acb923f 100644 (file)
--- 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
index 7366972bfeb69459d24f4ce273ec6e30ac585b9f..29c7774dc6ce40e9ac32fdb158deaed9fc2cd9d4 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.12_04
+VERSION=0.12_05
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
index c82e50af7781df0afe00b07f4dcc3c90b39716c8..ced97e9e0a52f1a45a2c4e82920634708e573c9c 100644 (file)
@@ -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)
 );
index 08d2ac9fe34dc62019e76abaa9c4929d0057ab08..aef15e3a83b07c34b53dc3d353b4b5dec9318721 100644 (file)
@@ -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'=>
index 9b5f0c62aa1796521871a2505eb75cd5feb89142..abd6453afdd9f9ee0fcce150e45373906b46c293 100644 (file)
@@ -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);
 
index 6d1cf3fcb6b04da8a04ec12b2cc363fa5d3f7751..5a683d678a6725ae8e3496273ec75446114b92b0 100644 (file)
@@ -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;
   
index bb8655f7ba167864a276450c72ec6728dda2bcb5..4ca07d50f74f16beaf0e53ff865d78c1089bd37b 100644 (file)
@@ -1,5 +1,5 @@
 package Image;
-
+use strict;
 # represents an image from the database
 use Squirrel::Row;
 use vars qw/@ISA/;
index d7cd601d865262a33036ca1aaadebc71352bbbfc..15e0376228ab12a327a6960612ffd487ae8fbfc9 100644 (file)
@@ -1,5 +1,5 @@
 package Images;
-
+use strict;
 use Squirrel::Table;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Squirrel::Table);
index fe7f2082a376ca6867bb6bf3570a49d011f4be00..9325c290d0f169f46a97fad2bd57291e7f10df90 100644 (file)
@@ -1,5 +1,5 @@
 package Order;
-
+use strict;
 # represents an order from the database
 use Squirrel::Row;
 use vars qw/@ISA/;
index 3efa940d9e21bdfe293c09d00a6263569facdce5..0cbbed140f90ddef07b7120603489c293cb7833c 100644 (file)
@@ -1,5 +1,5 @@
 package OrderItem;
-
+use strict;
 # represents an order line item from the database
 use Squirrel::Row;
 use vars qw/@ISA/;
index 9867a693f1122c78267e19e07795a893df75ebd2..2560b34ba5d1f1f69db5fb75a6b8a1d56cf9c6cf 100644 (file)
@@ -1,5 +1,5 @@
 package OrderItems;
-
+use strict;
 use Squirrel::Table;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Squirrel::Table);
index 2d044d3cf79ad46084196106afd7d5c594e34f4b..a99b17e3c6315572ca568967ae2ef3fa2567e581 100644 (file)
@@ -1,5 +1,5 @@
 package Orders;
-
+use strict;
 use Squirrel::Table;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Squirrel::Table);
index 89889e326233d00c1f79079da77e0430ed6bc6cb..d3e8d570ea17e22540fa204e0b60b071ccd01f90 100644 (file)
@@ -1,4 +1,5 @@
 package OtherParents;
+use strict;
 use Squirrel::Table;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Squirrel::Table);
index e2a1e1f0b4c64eace69f95291c7764491ac6baff..d1640a31ceb7ee2fed1878f15896152958a17220 100644 (file)
@@ -1,5 +1,5 @@
 package Product;
-
+use strict;
 # represents a product from the database
 use Article;
 use vars qw/@ISA/;
index d01f1cd1ccc26b40da6ecc39e204d1f8dee6f793..fbaa20d7ae659e7997798746fb1d9bfdf0a008b3 100644 (file)
@@ -1,5 +1,5 @@
 package Products;
-
+use strict;
 use Squirrel::Table;
 use vars qw(@ISA $VERSION);
 @ISA = qw(Squirrel::Table);
index a4991415fabfdb2e4187bf192d5d2068f730b402..af304a2e42b29b6dc6661616fd2ca708df32492b 100644 (file)
@@ -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 {
index ed1b2a9b5dc60234ee39ab6d482b3f7d9d946c52..4e43b396eadb1db4187cc766438d228986958da4 100644 (file)
@@ -1,4 +1,5 @@
 package Squirrel::GPG;
+use strict;
 
 sub new {
   return bless {}, $_[0];
index a822ff66b45d2ef66a16257ca1aa42ce4b6052cb..eeb8afa1022eb362278ea72ea759fad36b13d5b5 100644 (file)
@@ -1,4 +1,5 @@
 package Squirrel::PGP5;
+use strict;
 
 sub new {
   return bless {}, $_[0];
index 2cffa0b7fdbde186337b7920ef940ddb6c4bee15..61675f3cfada600de645691361c392b8a8bd692c 100644 (file)
@@ -1,4 +1,5 @@
 package Squirrel::PGP6;
+use strict;
 
 sub new {
   return bless {}, $_[0];
index 56d6ed9cbb0426431e38bacf8c9f29a92478a6d6..83ce6dc00c6ff336f40ef589dad2b193fb19711d 100644 (file)
@@ -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
index 660d51836d04f6d470e13cd1e2cda8ce9cc77195..db98ab22411a57a6d272e64fa184f7792e891b73 100644 (file)
@@ -82,7 +82,7 @@
           <: 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>
index 17cb36da7367a452a614d534444e08944c3b8722..40ea32843358f32350c586ef0ab2e6b80a120eee 100644 (file)
                       </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 :> &nbsp; <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>
index 29f9ef6742d56b48ed676b254c9ce0b668e31a55..e99381720f91d4948cfc2dde5659b21c7ab5855e 100644 (file)
             <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 :> &nbsp; <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
index ed090db1d02efaaedd964cb7327466edb9b05124..a45dbffec42819e87d3c8387cdf08d70945320c2 100644 (file)
                     </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 :> &nbsp; <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>
index 9a3be6ca950d0809d3501dbf55d467e9b65e3466..3fbf0896ede9c05512d73b277831eeff7a35e116 100644 (file)
@@ -40,7 +40,7 @@
       <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>
diff --git a/t/t30rules.t b/t/t30rules.t
new file mode 100644 (file)
index 0000000..a270944
--- /dev/null
@@ -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 (<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");
+  }
+}