0.15_23 commit r0_15_23
authorTony Cook <tony@develop-help.com>
Thu, 28 Jul 2005 07:25:58 +0000 (07:25 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Thu, 28 Jul 2005 07:25:58 +0000 (07:25 +0000)
30 files changed:
MANIFEST
Makefile
site/cgi-bin/bse.cfg
site/cgi-bin/interest.pl
site/cgi-bin/modules/BSE/Dynamic/Article.pm
site/cgi-bin/modules/BSE/Dynamic/Seminar.pm
site/cgi-bin/modules/BSE/Edit/Catalog.pm
site/cgi-bin/modules/BSE/Edit/Product.pm
site/cgi-bin/modules/BSE/Request.pm
site/cgi-bin/modules/BSE/Shop/Util.pm
site/cgi-bin/modules/BSE/UI/Affiliate.pm
site/cgi-bin/modules/BSE/UI/Formmail.pm
site/cgi-bin/modules/BSE/UI/Image.pm
site/cgi-bin/modules/BSE/UI/Shop.pm
site/cgi-bin/modules/BSE/UserReg.pm
site/cgi-bin/modules/BSE/Util/DynamicTags.pm [new file with mode: 0644]
site/cgi-bin/modules/Generate/Article.pm
site/cgi-bin/modules/Util.pm
site/cgi-bin/search.pl
site/cgi-bin/user.pl
site/docs/bse.pod
site/docs/config.pod
site/docs/formmail.pod
site/docs/templates.pod
site/templates/formmail/defquery_base.tmpl
site/templates/search_base.tmpl
site/templates/sidebar/logon.tmpl
t/t20gen.t
t/t21gencat.t
test.cfg

index 8aef5488ec1dd5a3f7b666ee1b143e0c501e79ab..9dc713c48b65cd15673795a4b07129f732ce6027 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -128,6 +128,7 @@ site/cgi-bin/modules/BSE/UI/SiteuserCommon.pm
 site/cgi-bin/modules/BSE/UI/SubAdmin.pm
 site/cgi-bin/modules/BSE/UserReg.pm
 site/cgi-bin/modules/BSE/Util/DynSort.pm
+site/cgi-bin/modules/BSE/Util/DynamicTags.pm
 site/cgi-bin/modules/BSE/Util/Iterate.pm
 site/cgi-bin/modules/BSE/Util/SQL.pm
 site/cgi-bin/modules/BSE/Util/Secure.pm
index a0d851ca31873f0b63fc60120c06a2dbb160eaa6..56333f9d627fa89226437ce1d829094c2270d090 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.15_22
+VERSION=0.15_23
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
index eb0d6ec64058446937e42392e0229c6db5381f42..12fc491c55eeba330b1cc155c32f8e5f99e0afc2 100644 (file)
@@ -58,6 +58,7 @@ title = Send us a comment
 
 [error settings]
 title = Error
+dynamic = 0
 
 [messages]
 user/notyourorder = Order $1 isn't your order
index a3953518066a81747572b8ed554f6febe02f612b..ac82cd2b6107dfeefc17766c13e3400f22bac5c2 100755 (executable)
@@ -5,24 +5,20 @@ use strict;
 use FindBin;
 use lib "$FindBin::Bin/modules";
 use Constants qw(:shop);
-use BSE::Cfg;
 use BSE::Session;
 use BSE::Mail;
 use BSE::Template;
 use BSE::Util::Tags;
-use SiteUsers;
-use CGI;
+use BSE::Request;
 
-my $cfg = BSE::Cfg->new;
+my $req = BSE::Request->new;
+my $cfg = $req->cfg;;
 
-my %session;
-BSE::Session->tie_it(\%session, $cfg);
-
-my $cgi = CGI->new;
+my $cgi = $req->cgi;
 my $useremail = $cgi->param('email');
 unless ($useremail) {
-  if ($session{userid}) {
-    my $user = SiteUsers->getBy(userId=>$session{userid});
+  my $user = $req->siteuser;
+  if ($user) {
     $useremail = $user->{email};
   }
 }
@@ -48,7 +44,7 @@ defined($product_id) or $product_id = '';
 my %acts;
 %acts =
   (
-   BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
+   $req->dyn_user_tags(),
    product => sub { $product },
    product_id => sub { $product_id },
    email => sub { $useremail },
index c9519db1f80e31b6612f0eed38c07dd5289067ee..2b2994edce0c742ea7387cc091bd8eaafa3cd7a9 100644 (file)
@@ -2,6 +2,7 @@ package BSE::Dynamic::Article;
 use strict;
 use BSE::Util::Tags qw(tag_hash);
 use BSE::Template;
+use DevHelp::HTML;
 
 sub new {
   my ($class, $req) = @_;
@@ -28,11 +29,12 @@ sub generate {
 
 sub tags {
   my ($self, $article) = @_;
-
+  
+  $self->{req}->set_article(dynarticle => $article);
   return
     (
      dynarticle => [ \&tag_hash, $article ],
-     BSE::Util::Tags->basic({}, $self->{req}->cgi, $self->{req}->cfg),
+     $self->{req}->dyn_user_tags(),
     );
 }
 
index 50b48219b2a6fbc9b26252e533371325a3613558..1ee60ec716866d8f41eb9bc80eb1e74b92b5f26f 100644 (file)
@@ -1,6 +1,6 @@
 package BSE::Dynamic::Seminar;
 use strict;
-use base 'BSE::Dynamic::Product;
+use base 'BSE::Dynamic::Product';
 use BSE::TB::Seminars;
 
 sub get_real_article {
index abbe67d9fb5d5aab4a05469da2ad9d7f69ff19cb..d48923ce2642da8e5e0683e41404b92c56b9790c 100644 (file)
@@ -88,7 +88,12 @@ sub default_link_path {
 sub make_link {
   my ($self, $article) = @_;
 
-  my $urlbase = $self->{cfg}->entryVar('site', 'secureurl');
+# Modified by adrian
+  my $urlbase = '';
+  if ($self->{cfg}->entry('shop', 'secureurl_articles', 1)) {
+    $urlbase = $self->{cfg}->entryVar('site', 'secureurl');
+  }
+# end adrian
 
   if ($article->is_dynamic) {
     return "$urlbase/cgi-bin/page.pl?id=$article->{id}&title=".escape_uri($article->{title});
index fad1b86fc774a568a330ccd7cf02951c559fd8d5..84b2dd99f67ccac5efea85a9de73209b2dc77b16 100644 (file)
@@ -233,7 +233,12 @@ sub default_link_path {
 sub make_link {
   my ($self, $article) = @_;
 
-  my $urlbase = $self->{cfg}->entryVar('site', 'secureurl');
+# Modified by adrian
+  my $urlbase = '';
+  if ($self->{cfg}->entry('shop', 'secureurl_articles', 1)) {
+    $urlbase = $self->{cfg}->entryVar('site', 'secureurl');
+  }
+# end adrian
 
   if ($article->is_dynamic) {
     return "$urlbase/cgi-bin/page.pl?id=$article->{id}&title=".escape_uri($article->{title});
index 6ac91a38003918474e92ce53744352c593551336..7cb223b7bc09e2b4119d94107249823346bad38f 100644 (file)
@@ -311,6 +311,13 @@ sub siteuser_has_access {
   }
 }
 
+sub dyn_user_tags {
+  my ($self) = @_;
+
+  require BSE::Util::DynamicTags;
+  return BSE::Util::DynamicTags->tags($self);
+}
+
 sub DESTROY {
   my ($self) = @_;
   if ($self->{session}) {
@@ -318,4 +325,31 @@ sub DESTROY {
   }
 }
 
+sub set_article {
+  my ($self, $name, $article) = @_;
+
+  if ($article) {
+    $self->{articles}{$name} = $article;
+  }
+  else {
+    delete $self->{articles}{$name};
+  }
+}
+
+sub get_article {
+  my ($self, $name) = @_;
+
+  exists $self->{articles}{$name}
+    or return;
+
+  my $article = $self->{articles}{$name};
+  if (ref $article eq 'SCALAR') {
+    $article = $$article;
+  }
+  $article 
+    or return;
+
+  $article;
+}
+
 1;
index 9f77aea026c91526fae1e34aa1592aeb5d740da5..4b4a04c194cf0bda411e1b3b736e76fa5d911ae3 100644 (file)
@@ -14,28 +14,23 @@ use DevHelp::HTML qw(escape_html);
 
 # returns a list of tags which display the cart details
 sub shop_cart_tags {
-  my ($acts, $cart, $cart_prods, $session, $q, $cfg, $stage) = @_;
+  my ($acts, $cart, $cart_prods, $req, $stage) = @_;
 
+  my $cfg = $req->cfg;
+  my $q = $req->cgi;
   $cfg or confess "No config";
   $cfg->isa("BSE::Cfg") or confess "Not a config";
 
   my $item_index;
   my $option_index;
   my @options;
-  my $user;
-  if ($session->{userid}) {
-    require 'SiteUsers.pm';
-    $user = SiteUsers->getBy(userId=>$session->{userid});
-  }
   my $sem_session;
   my $location;
   my $item;
   my $product;
   return
     (
-     BSE::Util::Tags->basic($acts, $q, $cfg),
-     ifUser => sub { $user },
-     user => sub { CGI::escapeHTML($user ? $user->{$_[0]} : '') },
+     $req->dyn_user_tags(),
      iterate_items_reset => sub { $item_index = -1 },
      iterate_items => 
      sub { 
@@ -69,7 +64,7 @@ sub shop_cart_tags {
      },
      index => sub { $item_index },
      total => 
-     sub { total($cart, $cart_prods, $session->{custom}, $cfg, $stage) },
+     sub { total($cart, $cart_prods, $req->session->{custom}, $cfg, $stage) },
      count => sub { scalar @$cart },
      iterate_options_reset => sub { $option_index = -1 },
      iterate_options => sub { ++$option_index < @options },
@@ -79,7 +74,7 @@ sub shop_cart_tags {
      session => [ \&tag_session, \$item, \$sem_session ],
      location => [ \&tag_location, \$item, \$location ],
      custom_class($cfg)
-     ->checkout_actions($acts, $cart, $cart_prods, $session->{custom}, $q, $cfg),
+     ->checkout_actions($acts, $cart, $cart_prods, $req->session->{custom}, $q, $cfg),
     );  
 }
 
index bf8510f9e9b1b1034810194e384502632d24f6aa..481a28aa0ddfe6a6dbcbea1878788af61fa17408 100644 (file)
@@ -262,7 +262,7 @@ sub req_show {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(undef, $req->cgi, $req->cfg),
+     $req->dyn_user_tags(),
      $class->_display_tags($user, $req->cfg),
     );
 
index 2ed1ccc378f26358b95a4db217c97af80863207e..fcfc262f404019b04066fdbd85023c1ecd141392 100644 (file)
@@ -44,6 +44,7 @@ my %form_defs =
    crypt_passphrase => $Constants::SHOP_PASSPHRASE,
    crypt_signing_id => $Constants::SHOP_SIGNING_ID,
    crypt_content_type => 0,
+   autofill => 1,
   );
 
 sub _get_form {
@@ -84,6 +85,7 @@ sub _get_form {
        maxdatemsg);
   my @extra_cfg_names = grep /\S/ && !exists $std_cfg_names{$_}, 
     split /,/, $extra_cfg_names;
+  my $user = $req->siteuser;
   for my $name (keys %$fields) {
     my $field = $fields->{$name};
     $field->{name} = $name;
@@ -93,6 +95,10 @@ sub _get_form {
       my $value = $cfg->entry($valid_section, "${name}_${cfg_name}");
       defined $value and $field->{$cfg_name} = $value;
     }
+
+    if ($form{autofill} && $user && exists $user->{$name}) {
+      $field->{default} = $user->{$name};
+    }
   }
 
   $form{validation} = $fields;
@@ -203,7 +209,7 @@ sub req_show {
   my $current_value;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $req->cgi, $req->cfg),
+     $req->dyn_user_tags(),
      error_img => [ \&tag_error_img, $req->cfg, $errors ],
      $it->make_iterator(undef, 'field', 'fields', $form->{fields},
                        undef, undef, \$current_field),
index 27a285eabd188f6554162e5ff42fbc5b65f7f8b0..dd0ff272c162392f7b229a78818beddfa199d0a1 100644 (file)
@@ -49,10 +49,11 @@ sub dispatch {
     }
   }
 
+  $req->set_article(article=>$article);
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->static(),
+     $req->dyn_user_tags(),
      article => [ \&tag_hash, $article ],
      image => [ \&tag_hash, $image ],
     );
index 16df71f162f59f218a0416c02ad793a198f15b0d..c401ee668787fb9fbf7dead5daf7f8c5eb2aba34 100644 (file)
@@ -93,8 +93,7 @@ sub req_cart {
     (
      $cust_class->cart_actions(\%acts, \@cart, \@cart_prods, \%custom_state, 
                               $req->cfg),
-     shop_cart_tags(\%acts, \@items, \@cart_prods, $req->session, $req->cgi, 
-                   $req->cfg, 'cart'),
+     shop_cart_tags(\%acts, \@items, \@cart_prods, $req, 'cart'),
      basic_tags(\%acts),
      msg => $msg,
     );
@@ -292,8 +291,7 @@ sub req_checkout {
   my %acts;
   %acts =
     (
-     shop_cart_tags(\%acts, \@items, \@cart_prods, $req->session, $req->cgi, 
-                   $cfg, 'checkout'),
+     shop_cart_tags(\%acts, \@items, \@cart_prods, $req, 'checkout'),
      basic_tags(\%acts),
      message => $message,
      msg => $message,
@@ -458,8 +456,7 @@ sub req_show_payment {
      message => $msg,
      msg => $msg,
      order => [ \&tag_hash, $order_values ],
-     shop_cart_tags(\%acts, \@items, \@products, $req->session, $req->cgi,
-                   $req->cfg, 'payment'),
+     shop_cart_tags(\%acts, \@items, \@products, $req, 'payment'),
      ifMultPaymentTypes => @payment_types > 1,
      checkedPayment => [ \&tag_checkedPayment, $payment, \%types_by_name ],
      ifPayments => [ \&tag_ifPayments, \@payment_types, \%types_by_name ],
index 9cbd5393576b5ebe043dc2d9bba4f4185f6d3cd1..a1aa52c54cd48b4e4b0ccecff2604dbaec39ade0 100644 (file)
@@ -22,32 +22,6 @@ use constant MIN_UNACKED_CONF_GAP => 2 * 24 * 60 * 60;
 my @donttouch = qw(id userId password email confirmed confirmSecret waitingForConfirmation disabled flags affiliate_name previousLogon);
 my %donttouch = map { $_, $_ } @donttouch;
 
-sub user_tags {
-  my ($self, $acts, $session, $user) = @_;
-
-  unless ($user) {
-    my $userid = $session->{userid};
-    
-    if ($userid) {
-      $user = SiteUsers->getBy(userId=>$userid);
-    }
-  }
-
-  return
-    (
-     ifUser=> 
-     sub { 
-       if ($_[0]) {
-        return $user->{$_[0]};
-       }
-       else {
-        return $user;
-       }
-     },
-     user => $user ? [ \&tag_hash, $user ] : '',
-    );
-}
-
 sub _refresh_userpage ($$) {
   my ($cfg, $msg) = @_;
 
@@ -59,12 +33,16 @@ sub _refresh_userpage ($$) {
 }
 
 sub show_logon {
-  my ($self, $session, $cgi, $cfg, $message) = @_;
+  my ($self, $req, $message) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
 
   if ($nopassword) {
-    return $self->nopassword($session, $cgi, $cfg);
+    return $self->nopassword($req);
   }
 
   $message ||= $cgi->param('message') || '';
@@ -75,8 +53,7 @@ sub show_logon {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
-     $self->user_tags(\%acts, $session),
+     $req->dyn_user_tags(),
      message => sub { CGI::escapeHTML($message) },
     );
 
@@ -84,12 +61,16 @@ sub show_logon {
 }
 
 sub logon {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
 
   if ($nopassword) {
-    return $self->nopassword($session, $cgi, $cfg);
+    return $self->nopassword($req);
   }
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $userid = $cgi->param('userid')
@@ -176,7 +157,11 @@ sub _got_user_refresh {
 }
 
 sub set_cookie {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $debug = $cfg->entryBool('debug', 'logon_cookies', 0);
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
@@ -208,12 +193,16 @@ sub set_cookie {
 }
 
 sub logoff {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
 
   if ($nopassword) {
-    return $self->nopassword($session, $cgi, $cfg);
+    return $self->nopassword($req);
   }
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
@@ -252,7 +241,11 @@ sub tag_if_required {
 }
 
 sub show_register {
-  my ($self, $session, $cgi, $cfg, $message, $errors) = @_;
+  my ($self, $req, $message, $errors) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $user_register = $cfg->entryBool('site users', 'user_register', 1);
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
@@ -289,8 +282,7 @@ sub show_register {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
-     $self->user_tags(\%acts, $session),
+     $req->dyn_user_tags(),
      old => 
      sub {
        my $value = $cgi->param($_[0]);
@@ -317,8 +309,11 @@ sub show_register {
 }
 
 sub _get_user {
-  my ($self, $session, $cgi, $cfg, $name) = @_;
+  my ($self, $req, $name) = @_;
 
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
   if ($nopassword) {
     my $password;
@@ -343,12 +338,10 @@ sub _get_user {
       return $custom->siteuser_auth($session, $cgi, $cfg);
     }
     else {
-      my $userid = $session->{userid}
-       or do { $self->show_logon($session, $cgi, $cfg); return };
-      my $user = SiteUsers->getBy(userId=>$userid)
-       or do { $self->show_logon($session, $cgi, $cfg); return };
+      my $user = $req->siteuser
+       or do { $self->show_logon($req); return };
       $user->{disabled}
-       and do { $self->show_logon($session, $cgi, $cfg, "Account disabled"); return };
+       and do { $self->show_logon($req, "Account disabled"); return };
       
       return $user;
     }
@@ -366,9 +359,13 @@ sub tag_ifSubscribedTo {
 }
 
 sub show_opts {
-  my ($self, $session, $cgi, $cfg, $message, $errors) = @_;
+  my ($self, $req, $message, $errors) = @_;
 
-  my $user = $self->_get_user($session, $cgi, $cfg, 'show_opts')
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
+
+  my $user = $self->_get_user($req, 'show_opts')
     or return;
   my @subs = grep $_->{visible}, BSE::SubscriptionTypes->all;
   my @usersubs = BSE::SubscribedUsers->getBy(userId=>$user->{id});
@@ -396,8 +393,7 @@ sub show_opts {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
-     $self->user_tags(\%acts, $session, $user),
+     $req->dyn_user_tags(),
      last => 
      sub {
        my $value = $cgi->param($_[0]);
@@ -477,11 +473,15 @@ sub _checkemail {
 }
 
 sub saveopts {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
 
-  my $user = $self->_get_user($session, $cgi, $cfg)
+  my $user = $self->_get_user($req)
     or return;
   my $nopassword = $cfg->entryBool('site users', 'nopassword', 0);
   my %errors;
@@ -635,7 +635,11 @@ sub _save_subs {
 }
 
 sub register {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
 
@@ -806,9 +810,13 @@ sub iter_usersubs {
 }
 
 sub userpage {
-  my ($self, $session, $cgi, $cfg, $message) = @_;
+  my ($self, $req, $message) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
-  my $user = $self->_get_user($session, $cgi, $cfg, 'userpage')
+  my $user = $self->_get_user($req, 'userpage')
     or return;
   require BSE::TB::Orders;
   my @orders = sort { $b->{orderDate} cmp $a->{orderDate}
@@ -829,8 +837,7 @@ sub userpage {
   my $file_index;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
-     $self->user_tags(\%acts, $session, $user),
+     $req->dyn_user_tags(),
      message => sub { CGI::escapeHTML($message) },
      BSE::Util::Tags->make_iterator(\@orders, 'order', 'orders', 
                                    \$order_index),
@@ -919,9 +926,13 @@ sub tag_detail_ifFileAvail {
 }
 
 sub req_orderdetail {
-  my ($self, $session, $cgi, $cfg, $message) = @_;
+  my ($self, $req, $message) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
-  my $user = $self->_get_user($session, $cgi, $cfg, 'userpage')
+  my $user = $self->_get_user($req, 'userpage')
     or return;
   my $order_id = $cgi->param('id');
   my $order;
@@ -950,9 +961,8 @@ sub req_orderdetail {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
+     $req->dyn_user_tags(),
      order => [ \&tag_hash, $order ],
-     $self->user_tags(\%acts, $session, $user),
      message => sub { CGI::escapeHTML($message) },
      $it->make_iterator
      (undef, 'item', 'items', \@items, undef, undef, \$current_item),
@@ -977,10 +987,14 @@ sub req_orderdetail {
 }
 
 sub download {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
-  my $user = $self->_get_user($session, $cgi, $cfg, 'show_opts')
+  my $user = $self->_get_user($req, 'show_opts')
     or return;
 
   my $orderid = $cgi->param('order')
@@ -1045,7 +1059,11 @@ sub download {
 }
 
 sub download_file {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $userid = $session->{userid};
@@ -1100,7 +1118,11 @@ sub download_file {
 }
 
 sub show_lost_password {
-  my ($self, $session, $cgi, $cfg, $message) = @_;
+  my ($self, $req, $message) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   $message ||= $cgi->param('message') || '';
   $message = escape_html($message);
@@ -1113,15 +1135,18 @@ sub show_lost_password {
   my %acts;
   %acts =
     (
-     BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
+     $req->dyn_user_tags(),
      message => $message,
-     $self->user_tags(\%acts, $session, $user),
     );
   BSE::Template->show_page('user/lostpassword', $cfg, \%acts);
 }
 
 sub lost_password {
-  my ($self, $session, $cgi, $cfg, $message) = @_;
+  my ($self, $req, $message) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $userid = $cgi->param('userid');
@@ -1168,7 +1193,11 @@ sub lost_password {
 }
 
 sub subinfo {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $id = $cgi->param('id')
     or return $self->show_opts($session, $cgi, $cfg, "No subscription id parameter");
@@ -1184,7 +1213,11 @@ sub subinfo {
 }
 
 sub nopassword {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my %acts;
   %acts =
@@ -1195,7 +1228,11 @@ sub nopassword {
 }
 
 sub blacklist {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $email = $cgi->param('blacklist')
@@ -1225,7 +1262,11 @@ sub blacklist {
 }
 
 sub confirm {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $secret = $cgi->param('confirm')
@@ -1388,7 +1429,11 @@ sub send_conf_request {
 }
 
 sub unsub {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $msgs = BSE::Message->new(cfg=>$cfg, section=>'user');
   my $secret = $cgi->param('unsub')
@@ -1478,7 +1523,11 @@ sub _validate_affiliate_name {
 }
 
 sub req_image {
-  my ($self, $session, $cgi, $cfg) = @_;
+  my ($self, $req) = @_;
+
+  my $cfg = $req->cfg;
+  my $cgi = $req->cgi;
+  my $session = $req->session;
 
   my $u = $cgi->param('u');
   my $i = $cgi->param('i');
diff --git a/site/cgi-bin/modules/BSE/Util/DynamicTags.pm b/site/cgi-bin/modules/BSE/Util/DynamicTags.pm
new file mode 100644 (file)
index 0000000..a1f85cd
--- /dev/null
@@ -0,0 +1,64 @@
+package BSE::Util::DynamicTags;
+use strict;
+use BSE::Util::Tags;
+use DevHelp::HTML;
+
+sub tags {
+  my ($class, $req) = @_;
+  
+  return
+    (
+     BSE::Util::Tags->basic(undef, $req->cgi, $req->cfg),
+     user => [ \&tag_user, $req ],
+     ifUser => [ \&tag_ifUser, $req ],
+     ifUserCanSee => [ \&tag_ifUserCanSee, $req ],
+    );
+}
+
+sub tag_ifUser {
+  my ($req, $args) = @_;
+
+  my $user = $req->siteuser
+    or return '';
+  if ($args) {
+    return $user->{$args};
+  }
+  else {
+    return 1;
+  }
+}
+
+sub tag_user {
+  my ($req, $args) = @_;
+
+  my $siteuser = $req->siteuser
+    or return '';
+
+  exists $siteuser->{$args}
+    or return '';
+
+  escape_html($siteuser->{$args});
+}
+
+sub tag_ifUserCanSee {
+  my ($req, $args) = @_;
+
+  $args 
+    or return 0;
+
+  my $article;
+  if ($args =~ /^\d+$/) {
+    $article = Articles->getByPkey($args);
+  }
+  else {
+    $article = $req->get_article($args);
+  }
+  $article
+    or return 0;
+
+  print STDERR "$args -> $article ($article->{id})\n";
+
+  $req->siteuser_has_access($article);
+}
+
+1;
index d8d351ada7b0d1d48623857bcf418d9db425fae6..cc8f7d414b346aff6a69c2680e3d728bdfdcbde4 100644 (file)
@@ -223,6 +223,7 @@ sub baseActs {
 
   my @images = Images->getBy('articleId', $article->{id});
   my @unnamed_images = grep $_->{name} eq '', @images;
+  my @iter_images;
   my $image_index = -1;
   my $had_image_tags = 0;
   my @files = sort { $b->{displayOrder} <=> $a->{displayOrder} }
@@ -442,8 +443,26 @@ HTML
      },
      
      # access to images, if any
-     iterate_images_reset => sub { $image_index = -1 },
-     iterate_images => sub { $had_image_tags = 1; ++$image_index < @unnamed_images },
+     iterate_images_reset => 
+     sub { 
+       my ($arg) = @_;
+       $image_index = -1;
+       if ($arg eq 'all') {
+        @iter_images = @images;
+       }
+       elsif ($arg eq 'named') {
+        @iter_images = grep $_->{name} ne '', @images;
+       }
+       elsif ($arg =~ m!^named\s+/([^/]+)/$!) {
+        my $re = $1;
+        @iter_images = grep $_->{name} =~ /$re/i, @images;
+       }
+       else {
+        @iter_images = @unnamed_images;
+       }
+     },
+     iterate_images => 
+     sub { $had_image_tags = 1; ++$image_index < @iter_images },
      image =>
      sub {
        my ($which, $align, $rest) = split ' ', $_[0], 3;
@@ -455,7 +474,7 @@ HTML
         $im = $images[$which-1];
        }
        else {
-        $im = $unnamed_images[$image_index];
+        $im = $iter_images[$image_index];
        }
 
        return $self->_format_image($im, $align, $rest);
@@ -470,15 +489,33 @@ HTML
        $self->_format_image($im, $align, $rest);
      },
      ifImage => sub { $_[0] >= 1 && $_[0] <= @images },
-     ifImages => sub { @images },
+     ifImages => 
+     sub {
+       my ($arg) = @_;
+       if ($arg eq 'all' or $arg eq '') {
+        return @images;
+       }
+       elsif ($arg eq 'named') {
+        return grep $_->{name} ne '', @images;
+       }
+       elsif ($arg =~ m!^named\s+/([^/]+)/$!) {
+        my $re = $1;
+        return grep $_->{name} =~ /$re/i, @images;
+       }
+       elsif ($arg eq 'unnamed') {
+        return @unnamed_images;
+       }
+       else {
+        return 0;
+       }
+     },
      image_index => sub { $image_index },
      BSE::Util::Tags->make_iterator(\@files, 'file', 'files'),
      BSE::Util::Tags->make_iterator(\@stepkids, 'stepkid', 'stepkids'),
      BSE::Util::Tags->make_iterator(\@allkids, 'allkid', 'allkids', \$allkids_index),
      BSE::Util::Tags->make_iterator(\@stepparents, 'stepparent', 'stepparents'),
      top => [ \&tag_top, $self, $article ],
-     ifDynamic => 
-     scalar(UNIVERSAL::isa($top, 'Article') ? $top->is_dynamic : 0),
+     ifDynamic => [ \&tag_ifDynamic, $self, $top ],
     );
 
   if ($abs_urls) {
@@ -498,6 +535,15 @@ HTML
   return %acts;
 }
 
+sub tag_ifDynamic {
+  my ($self, $top) = @_;
+
+  # this is to support pregenerated pages being handled as dynamic pages
+  $self->{force_dynamic} and return 1;
+
+  UNIVERSAL::isa($top, 'Article') ? $top->is_dynamic : 0;
+}
+
 sub generate {
   my ($self, $article, $articles) = @_;
 
@@ -700,7 +746,21 @@ C<level1> or C<level2> article is the current page.
 
 =item iterator ... images
 
-Iterates over the images for the given article.
+Iterates over the unnamed images for the given article.
+
+=item iterator ... images all
+
+Iterates over all images for the article.
+
+=item iterator ... images named
+
+Iterates over the named images for the article.
+
+=item iterator ... images named /regexp/
+
+Iterates over images with names matching the given regular expression.
+Note that if the expression matches an empty string then unnamed
+images will be included.
 
 =item image which field
 
@@ -759,12 +819,44 @@ Condition tag, true if an image exists at the given index.
 
 =item ifImages
 
+=item ifImages all
+
 Conditional tag, true if the article has any images.
 
+=item ifImages named
+
+Conditional tag, true if the article has any named images.
+
+=item ifImages named /regexp/
+
+Conditional tag, true if the article has any named images, where the
+name matches the regular expression.
+
+=item ifImages unnamed
+
+Conditional tag, true if the article has any unnamed images.
+
 =item embed child
 
 This has been made more general and been moved, see L<Generate/embed child>.
 
+=item ifDynamic
+
+Tests if the article is dynamically generated.
+
+=item top I<field>
+
+Toplevel article being generated.  This is the page that any articles
+are being embedded in.
+
+=item iterator ... files
+
+Iterates over the files attached to the article, setting the file tag.
+
+=item file I<field>
+
+Information from the current file in the files iterator.
+
 =back
 
 =head2 Article attributes
index 24705c11da58bd06c73641383e755fae03ec0e0d..4c4435150c71371da76450f81a883cfb2313451d 100644 (file)
@@ -100,7 +100,8 @@ sub generate_search {
     (-1, -1, $SEARCH_TITLE, $SEARCH_TITLE_IMAGE, 0, $CGI_URI."/search.pl", 0, 1);
 
   require 'Generate/Article.pm';
-  my $gen = Generate::Article->new(cfg=>$cfg, top => \%article);
+  my $gen = Generate::Article->new(cfg=>$cfg, top => \%article, 
+                                  force_dynamic => 1);
 
   my %acts;
   %acts = $gen->baseActs($articles, \%acts, \%article);
@@ -128,7 +129,7 @@ sub generate_shop {
   require 'Generate/Article.pm';
   my $shop = $articles->getByPkey($SHOPID);
   my $cfg = BSE::Cfg->new;
-  my $gen = Generate::Article->new(cfg=>$cfg, top=>$shop);
+  my $gen = Generate::Article->new(cfg=>$cfg, top=>$shop, force_dynamic => 1);
   for my $name (@pages) {
     my %acts;
     %acts = $gen->baseActs($articles, \%acts, $shop);
@@ -227,8 +228,12 @@ sub generate_extras {
          $article{$field} = $cfg->entryVar("$presets settings", $field);
        }
       }
+      # by default all of these are handled as dynamic, but it can be 
+      # overidden, eg. the error template
+      my $dynamic = $cfg->entry("$presets settings", 'dynamic', 1);
       my %acts;
-      my $gen = Generate::Article->new(cfg=>$cfg, top=>\%article);
+      my $gen = Generate::Article->new(cfg=>$cfg, top=>\%article, 
+                                      force_dynamic => $dynamic);
       %acts = $gen->baseActs($articles, \%acts, \%article);
       my $oldurl = $acts{url};
       $acts{url} =
index b8f481c3611caf437970db4b280067bddeb6a5ed..b0659d3876a8beb73ba0dec737947aee456eca33 100755 (executable)
@@ -2,7 +2,6 @@
 # -d:ptkdb
 BEGIN { $ENV{DISPLAY} = '192.168.32.15:0.0' }
 use strict;
-use CGI;
 use FindBin;
 use lib "$FindBin::Bin/modules";
 use Articles;
@@ -13,14 +12,16 @@ use BSE::Cfg;
 use BSE::Template;
 use DevHelp::HTML qw':default popup_menu';
 use BSE::Util::Tags;
+use BSE::Request;
 
-my $cfg = BSE::Cfg->new;
+my $req = BSE::Request->new;
+my $cfg = $req->cfg;
 
 my $results_per_page = 10;
 
 my $dh = BSE::DB->single;
 
-my $cgi = CGI->new;
+my $cgi = $req->cgi;
 my $words = $cgi->param('q');
 my $section = $cgi->param('s');
 my $date = $cgi->param('d');
@@ -86,7 +87,7 @@ my $words_re = qr/$words_re_str/i;
 my %acts;
 %acts =
   (
-   BSE::Util::Tags->basic(\%acts, $cgi, $cfg),
+   $req->dyn_user_tags(),
    iterate_results => 
    sub { 
      ++$result_seq;
@@ -106,10 +107,13 @@ my %acts;
        # match against the pageTitle
        $pageTitle = $articles[$article_index]{pageTitle};
        $pageTitle =~ s!$words_re!<b>$1</b>!g or $pageTitle = '';
+       $req->set_article(result => $articles[$article_index]);
        
        return 1;
      }
      else {
+       $req->set_article(result => undef);
+
        return 0;
      }
    },
index b36ba70a1698ff7bc24410b9ca9a30c278db49da..462416e9dd18a3e90425857b9212e72dfbcf6281 100755 (executable)
@@ -5,19 +5,11 @@ use strict;
 use FindBin;
 use lib "$FindBin::Bin/modules";
 use Constants;
-use BSE::Cfg;
 use BSE::Session;
 use BSE::UserReg;
-use CGI;
+use BSE::Request;
 
-my $cfg = BSE::Cfg->new;
-
-my %session;
-BSE::Session->tie_it(\%session, $cfg);
-
-#  print STDERR "it's tied\n" if tied %session;
-#  use Data::Dumper;
-#  print STDERR Dumper \%session;
+my $req = BSE::Request->new;
 
 my %actions =
   (
@@ -43,12 +35,11 @@ my %actions =
    a_orderdetail => 'req_orderdetail',
   );
 
-my $cgi = CGI->new;
+my $cgi = $req->cgi;
 
 my ($action) = grep $cgi->param($_) || $cgi->param("$_.x"), keys %actions;
-$action ||= 'show_logon';
+$action ||= 'userpage';
 my $method = $actions{$action};
 
-BSE::UserReg->$method(\%session, $cgi, $cfg);
+BSE::UserReg->$method($req);
 
-untie %session;
index c9a691c9844ff371cfdca59233a4963ec0091b93..f37c06c29d8249f01f80f4dea44b90d2cd5ceb2e 100644 (file)
@@ -10,6 +10,56 @@ Maybe I'll add some other bits here.
 
 =head1 CHANGES
 
+=head2 0.15_23
+
+=over
+
+=item *
+
+added [shop].secureurl_articles option.  Patch by Adrian Oldham
+(http://www.visualthought.com.au/)
+
+=item *
+
+pregenerated templates used by various scripts are now generated as if
+they were dynamic articles, and the various scripts now make the
+dynamic article tags available.  This is a complex change, so it may
+have introduced some problems.
+
+=item *
+
+the sidebar logon panel has been updated to generate serverside when
+the containing page is dynamic.
+
+=item *
+
+the t21gencat.t test script wasn't cleaning up properly after itself,
+leaving the database in an inconsistent state.
+
+=item *
+
+fmail.pl forms are now filled from the currently logged on siteuser by
+default.  The field names must correspond to the siteuser field named
+for this to happen.  Note: custom defquery_base variants will need to
+be updated to support this.
+
+=item *
+
+user.pl now attempts to display the userpage by default, instead of
+the logon form.
+
+=item *
+
+the images iterator (on articles) now accepts various options to
+filter the images iterated over.  See templates.pod for details.
+
+=item *
+
+the ifImages conditions (on articles) now accepts various options to
+filter the images tested for.  See templates.pod for details.
+
+=back
+
 =head2 0.15_22
 
 =over
index a225831a6c1559b69d6bad396f17349b9fa64bcd..b52cb7d60d4ca552d61843db399deee8c93f708d 100644 (file)
@@ -525,6 +525,11 @@ result excerpts.  Default: True
 Used by some templates to check if the shop is enabled.  Set this to 1
 to enable the shop, or 0 to disable it.
 
+=item secureurl_articles
+
+If this is false then shop articles will not use the secureurl as their 
+baseurl.  Default: True
+
 =item register_if_files
 
 If true the customer is required to register before checkout if there
index 1bb408e6bbeeed64b0f0df24b9f7acd9e549d80f..fb03d140aff40dab7a57e2abb3cf3ebcfaa4b524 100644 (file)
@@ -142,6 +142,16 @@ require_logon is set and the user isn't logged on.
 
 =item *
 
+autofill - if this is non-zero then form values which match the names
+of siteuser fields are defaulted on the form with the values from the
+currently logged in user.  Default: Enabled.  To disable add:
+
+  autofill=0
+
+to the configuration area for your form.
+
+=item *
+
 encrypt - if this is non-zero then the emailed form data is encrypted
 using PGP or GPG as configured (see the crypt options below).
 
index 7d81028ffeb6faa030b98a9b3eb112fc39afd190..cdc7c9852de60f988690b2458e29b7c2b245801f 100644 (file)
@@ -1059,7 +1059,21 @@ C<level1> or C<level2> article is the current page.
 
 =item iterator ... images
 
-Iterates over the images for the given article.
+Iterates over the unnamed images for the given article.
+
+=item iterator ... images all
+
+Iterates over all images for the article.
+
+=item iterator ... images named
+
+Iterates over the named images for the article.
+
+=item iterator ... images named /regexp/
+
+Iterates over images with names matching the given regular expression.
+Note that if the expression matches an empty string then unnamed
+images will be included.
 
 =item image which field
 
@@ -1118,8 +1132,40 @@ Condition tag, true if an image exists at the given index.
 
 =item ifImages
 
+=item ifImages all
+
 Conditional tag, true if the article has any images.
 
+=item ifImages named
+
+Conditional tag, true if the article has any named images.
+
+=item ifImages named /regexp/
+
+Conditional tag, true if the article has any named images, where the
+name matches the regular expression.
+
+=item ifImages unnamed
+
+Conditional tag, true if the article has any unnamed images.
+
+=item ifDynamic
+
+Tests if the article is dynamically generated.
+
+=item top I<field>
+
+Toplevel article being generated.  This is the page that any articles
+are being embedded in.
+
+=item iterator ... files
+
+Iterates over the files attached to the article, setting the file tag.
+
+=item file I<field>
+
+Information from the current file in the files iterator.
+
 =back
 
 The following tags produce output only in admin mode.
index e1b4a8158038bd0d6affbb9c66a960f2333aefb5..4f2863f78dabc8f6b759ca4ffc37b38321e37ffd 100644 (file)
@@ -9,7 +9,7 @@
   <td>
   <:switch:>
   <:case Eq [field htmltype] "textarea":>
-  <textarea name="<:field name:>" <:ifField width:>cols="<:field width:>"<:or:><:eif:> <:ifField height:>rows="<:field height:>"<:or:><:eif:> wrap="virtual"><:old [field name]:></textarea>
+  <textarea name="<:field name:>" <:ifField width:>cols="<:field width:>"<:or:><:eif:> <:ifField height:>rows="<:field height:>"<:or:><:eif:> wrap="virtual"><:old [field name] field default:></textarea>
   <:case Eq [field htmltype] "password":>
   <input type="password" name="<:field name:>" value="<:old [field name]:>" <:ifField width:>size="<:field width:>"<:or:><:eif:> />
   <:case Eq [field htmltype] "select":>
@@ -33,7 +33,7 @@
   <br />
   <:iterator end values:>
   <:case default:>
-  <input type="text" name="<:field name:>" value="<:old [field name]:>" <:ifField width:>size="<:field width:>" <:or:><:eif:><:ifField maxlength:>maxlength="<:field maxlength:>"<:or:><:eif:> />
+  <input type="text" name="<:field name:>" value="<:old [field name] field default:>" <:ifField width:>size="<:field width:>" <:or:><:eif:><:ifField maxlength:>maxlength="<:field maxlength:>"<:or:><:eif:> />
   <:endswitch:>
   <:ifField notes:><:field notes:><:or:><:eif:>
   </td>
index 9fcad2e24d8d15c7c37881c93cacea8d96cfe1cb..96e30cf309d2a7ab4a1ee3383a1c57234a12d8f7 100644 (file)
@@ -52,8 +52,9 @@
 <: iterator begin results:> 
 <dl> 
   <dt> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <b> <:resultSeq:>.
-    </b></font> <a href="<:articleurl:>"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><:result 
-    title:></b></font></a> 
+    </b></font> <:ifUserCanSee result:><a href="<:articleurl:>"><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><:result 
+    title:></b></font></a> <:or:><font face="Verdana, Arial, Helvetica, sans-serif" size="2"><b><:result 
+    title:></b></font><:eif:>
   <dd> <font face="Verdana, Arial, Helvetica, sans-serif" size="2"> <:excerpt:></font> 
     <br>
     <font face="Verdana, Arial, Helvetica, sans-serif" size="2" color="#808080"> 
index eea2d578f3e717a9c91d2e35e87b415e836488eb..1e27bd134c2b91510791991da07c52619161e47f 100644 (file)
@@ -1,9 +1,4 @@
-<:wrap base.tmpl:> <:embed start:><:if Cfg "site users" nopassword:>
-<!-- This form is not used when you have the nopassword option enabled -->
-<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Please use the URL from your confirmation email to access your
-details and subscription information.</font></p>
-<div align="center"><form action="/cgi-bin/user.pl" method="post"><input type="submit" name="show_register" value="Register" class="user-buttons" /></form></div>
-<:or Cfg:><:ifAdmin:>
+<:wrap base.tmpl:> <:embed start:><:ifAdmin:>
 <table cellpadding="4" cellspacing="0" border="0">
   <tr> 
     <td> 
@@ -20,7 +15,22 @@ details and subscription information.</font></p>
     </td>
   </tr>
 </table>
-<:or:><:eif:>
+<:or:><:eif:><:if Cfg "site users" nopassword:>
+<!-- This form is not used when you have the nopassword option enabled -->
+<p><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Please use the URL from your confirmation email to access your
+details and subscription information.</font></p>
+<div align="center"><form action="/cgi-bin/user.pl" method="post"><input type="submit" name="show_register" value="Register" class="user-buttons" /></form></div>
+<:or Cfg:><:if Dynamic:>
+<:if User:>
+<form action="/cgi-bin/user.pl" method="post">
+<table><tr><td align="left"><input type="submit" name="userpage" value="User profile" class="user-buttons" /></td><td align="right"><input type="submit" name="logoff" value="Logoff" class="user-buttons" /></td></tr></table></form>
+<:or User:>
+<form action="/cgi-bin/user.pl" method="post">
+<table><tr><th><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Username:</font></th><td><input type="text" name="userid" size="10" /></td></tr>
+<tr><th><font face="Verdana, Arial, Helvetica, sans-serif" size="-2">Password:</font></th><td><input type="password" name="password" size="10" /></td></tr>
+<tr><td align="left"><input type="submit" name="logon" value="Logon" class="user-buttons" /></td><td align="right"><input type="submit" name="show_register" value="Register" class="user-buttons" /></td></tr></table></form>
+<:eif User:>
+<:or Dynamic:>
 <div align="center">
 <script language="JavaScript">
 <!--
@@ -48,4 +58,4 @@ else {
 //-->
 </script>
 </div>
-<:eif Cfg:><:embed end:>
+<:eif Dynamic:><:eif Cfg:><:embed end:>
index e0a86ae48648e0537983d8995789ef2a4c76da21..9a0cb5eb2c7ff1708e16125c7cb16d6d5ad8f149 100644 (file)
@@ -241,8 +241,9 @@ EXPECTED
 BSE::Admin::StepParents->del($parent, $parent);
 for my $kid (reverse @kids) {
   my $name = $kid->{title};
+  my $kidid = $kid->{id};
   $kid->remove();
-  ok(1, "removing kid $name");
+  ok(1, "removing kid $name ($kidid)");
 }
 $parent->remove();
 ok(1, "removed parent");
index f24abff22345c6974f07348a264bd9d14c9c30e2..8889660e83fc57e889d8f4c2b699590b65066477 100644 (file)
@@ -1,7 +1,7 @@
 #!perl -w
 use strict;
 use BSE::Test ();
-use Test::More tests=>69;
+use Test::More tests=>74;
 use File::Spec;
 use FindBin;
 my $cgidir = File::Spec->catdir(BSE::Test::base_dir, 'cgi-bin');
@@ -244,7 +244,12 @@ EXPECTED
 
 BSE::Admin::StepParents->del($parent, $stepkid);
 BSE::Admin::StepParents->del($parent, $stepprod);
-for my $kid (reverse @kids) {
+for my $kid (reverse @prods, $stepprod) {
+  my $name = $kid->{title};
+  $kid->remove();
+  ok(1, "removing product $name");
+}
+for my $kid (reverse @kids, $stepkid) {
   my $name = $kid->{title};
   $kid->remove();
   ok(1, "removing kid $name");
index 0ef4980aca61b5719a8876dca27d06eb02db3c9e..494709adff0e49fd6a2ba7ce38f23c854050cd9d 100644 (file)
--- a/test.cfg
+++ b/test.cfg
@@ -102,7 +102,7 @@ affiliate.subscription_required=affiliatepage
 
 default formmail validation.subject_width=40
 
-test form.fields=name,company,select,radio,check,multiselect
+test form.fields=email,name,company,select,radio,check,multiselect
 test form.subject=Foo
 test form.encrypt=1
 test form.crypt_signing_id=
@@ -111,6 +111,7 @@ test form.crypt_passphrase=
 test form.email=tony@develop-help.com
 test form.field_config=notes,required_if
 test form.submit=Send the message
+test form.autofill=0
 test form.require_logon=1
 test form.logon_message=Yo Dude! Logon to submit this form!
 test formmail validation.name_description=Your Name