0.14_15 commit r0_14_15
authorTony Cook <tony@develop-help.com>
Mon, 22 Mar 2004 05:18:01 +0000 (05:18 +0000)
committertony <tony@45cb6cf1-00bc-42d2-bb5a-07f51df49f94>
Mon, 22 Mar 2004 05:18:01 +0000 (05:18 +0000)
27 files changed:
MANIFEST
Makefile
schema/bse.sql
site/cgi-bin/admin/admin.pl
site/cgi-bin/admin/generate.pl
site/cgi-bin/admin/makeIndex.pl
site/cgi-bin/admin/move.pl
site/cgi-bin/admin/reorder.pl
site/cgi-bin/admin/report.pl
site/cgi-bin/admin/shopadmin.pl
site/cgi-bin/admin/subs.pl
site/cgi-bin/modules/Article.pm
site/cgi-bin/modules/BSE/AdminLogon.pm
site/cgi-bin/modules/BSE/AdminUsers.pm
site/cgi-bin/modules/BSE/Edit/Article.pm
site/cgi-bin/modules/BSE/Formatter.pm
site/cgi-bin/modules/BSE/Request.pm
site/cgi-bin/modules/BSE/UserReg.pm
site/cgi-bin/modules/BSE/Util/Tags.pm
site/cgi-bin/modules/BSE/WebUtil.pm [new file with mode: 0644]
site/cgi-bin/modules/Util.pm
site/cgi-bin/shop.pl
site/docs/bse.pod
site/docs/config.pod
site/htdocs/admin/help/body.html
site/templates/admin/logon.tmpl
test.cfg

index 9ee39a7297fe4a7ef796e793816f77078d12837e..83d28f5dfc853d7e717dfb26b5f625cdd0b31ad7 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -95,6 +95,7 @@ site/cgi-bin/modules/BSE/Util/Secure.pm
 site/cgi-bin/modules/BSE/Util/Tags.pm
 site/cgi-bin/modules/BSE/Util/Valid.pm
 site/cgi-bin/modules/BSE/Version.pm
+site/cgi-bin/modules/BSE/WebUtil.pm
 site/cgi-bin/modules/Constants.pm
 site/cgi-bin/modules/DevHelp/DynSort.pm
 site/cgi-bin/modules/DevHelp/Formatter.pm
index 2c8344a81024876331f7f322e7c5d6e345246ca0..eb253f23d7622cc3852461d2a8901e2f92c60e48 100755 (executable)
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-VERSION=0.14_14
+VERSION=0.14_15
 DISTNAME=bse-$(VERSION)
 DISTBUILD=$(DISTNAME)
 DISTTAR=../$(DISTNAME).tar
index 047e3bf10415e7175c22f93f11084678ebfc4e08..4fe246e83fe1396b8e5daaca41de177c3c589806 100644 (file)
@@ -55,7 +55,7 @@ CREATE TABLE article (
   -- 2 - list in sections, but not on the menu
   listed smallint not null default 1,
   -- date last modified
-  lastModified date not null,
+  lastModified datetime not null,
 
   -- flags specified via the config file
   -- used by code and templates
index 7e2e943b12289e5975635073c7b7c9bc844b243d..553e64adf5c823ddebf0cbc206281ebe12f51e72 100755 (executable)
@@ -8,7 +8,7 @@ use CGI::Carp 'fatalsToBrowser';
 use lib "$FindBin::Bin/../modules";
 use Articles;
 use BSE::Request;
-use Util 'refresh_to';
+use BSE::WebUtil 'refresh_to_admin';
 
 my $req = BSE::Request->new;
 my $cfg = $req->cfg;
@@ -36,6 +36,5 @@ if ($req->check_admin_logon()) {
   print $generator->generate($article, $articles);
 }
 else {
-  my $urlbase = $cfg->entryErr('site', 'url');
-  refresh_to("$urlbase/cgi-bin/admin/logon.pl");
+  refresh_to_admin($cfg, "/cgi-bin/admin/logon.pl");
 }
index c348b80ce5150e48501ee5ef606cbe2d79f2937a..eb68b5f09a0cc3ce92c17f7cd43ef7a136c7a754 100755 (executable)
@@ -7,7 +7,8 @@ use lib "$FindBin::Bin/../modules";
 use Articles;
 use CGI qw(:standard);
 use Constants;
-use Util qw(generate_button regen_and_refresh refresh_to);
+use Util qw(generate_button regen_and_refresh);
+use BSE::WebUtil qw(refresh_to_admin);
 use Carp 'verbose';
 use BSE::Request;
 use URI::Escape;
@@ -18,7 +19,7 @@ my $cfg = $req->cfg;
 my $cgi = $req->cgi;
 my $siteurl = $cfg->entryErr('site', 'url');
 unless ($req->check_admin_logon()) {
-  refresh_to("$siteurl/cgi-bin/admin/logon.pl");
+  refresh_to_admin($cfg, "/cgi-bin/admin/logon.pl");
   exit;
 }
 
@@ -68,14 +69,14 @@ if (generate_button()) {
        if ($baseurl =~ /menu\.pl$/) {
          $baseurl .= "?m=".uri_escape("You don't have permission to regenerate that");
        }
-       refresh_to("$siteurl$baseurl");
+       refresh_to_admin($cfg, $baseurl);
       }
     }
   }
   else {
     if ($req->user_can('regen_all')) {
       regen_and_refresh('Articles', undef, 1, 
-                       $siteurl . $baseurl, $cfg, $callback);
+                       $baseurl, $cfg, $callback);
     }
     else {
       if ($progress) {
@@ -85,7 +86,7 @@ if (generate_button()) {
        if ($baseurl =~ /menu\.pl$/) {
          $baseurl .= "?m=".uri_escape("You don't have permission to regenerate all");
        }
-       refresh_to("$siteurl$baseurl");
+       refresh_to_admin($cfg, $baseurl);
       }
     }
   }
index 6816b413fbfd2dd7736d2c53bdcbda0b3aa14d1e..06d17782ce2384582b77015595a4398f91f49114 100755 (executable)
@@ -7,7 +7,7 @@ use Constants qw($BASEDIR $MAXPHRASE $DATADIR @SEARCH_EXCLUDE @SEARCH_INCLUDE $S
 use BSE::DB;
 use Generate;
 use BSE::Cfg;
-use Util 'refresh_to';
+use BSE::WebUtil 'refresh_to_admin';
 my $in_cgi = exists $ENV{REQUEST_METHOD};
 if ($in_cgi) {
   #eval "use CGI::Carp qw(fatalsToBrowser)";
@@ -82,7 +82,7 @@ for my $key (sort keys %index) {
 }
 
 if ($in_cgi) {
-  refresh_to("$urlbase/cgi-bin/admin/menu.pl");
+  refresh_to_admin($cfg, "/cgi-bin/admin/menu.pl");
 }
 
 sub makeIndex {
index 15c84a66506b8f21810ecf68953ab5be18a5a32d..28c61782e0be04a30ec4953a7c13301d347dc797 100755 (executable)
@@ -11,16 +11,15 @@ use Carp 'verbose';
 use CGI::Carp 'fatalsToBrowser';
 use BSE::Request;
 use Constants;
-use Util 'refresh_to';
+use BSE::WebUtil qw/refresh_to refresh_to_admin/;
 
 my $req = BSE::Request->new;
 
 my $cfg = $req->cfg;
 my $cgi = $req->cgi;
-my $urlbase = $cfg->entryVar('site', 'url');
 
 unless ($req->check_admin_logon()) {
-  refresh_to("$urlbase/cgi-bin/admin/logon.pl");
+  refresh_to_admin($cfg, "/cgi-bin/admin/logon.pl");
   exit;
 }
 
@@ -141,17 +140,17 @@ else {
 }
 
 if ($cgi->param('refreshto')) {
-  refresh_to($urlbase .$cgi->param('refreshto'));
+  refresh_to_admin($cgi->param('refreshto'));
 }
 elsif ($cgi->param('r')) {
   refresh_to($cgi->param('r'));
 }
 elsif ($cgi->param('edit')) {
   # refresh back to editor
-  refresh_to("$urlbase/cgi-bin/admin/add.pl?id=$article->{parentid}#children");
+  refresh_to_admin($cfg, "/cgi-bin/admin/add.pl?id=$article->{parentid}#children");
 }
 else {
   # refresh back to the parent
   my $parent = $articles->getByPkey($article->{parentid});
-  refresh_to("$urlbase$parent->{admin}");
+  refresh_to_admin($cfg, $parent->{admin});
 }
index 267827cb75709a900442388a7c9f07a575b4ece6..86a10e3265191e3abea4f880290e6777928e21dd 100755 (executable)
@@ -6,16 +6,15 @@ use FindBin;
 use lib "$FindBin::Bin/../modules";
 use Articles;
 use BSE::Request;
-use Util 'refresh_to';
+use BSE::WebUtil 'refresh_to_admin';
 use vars qw($VERSION);
-$VERSION = 1.02;
+$VERSION = 1.03;
 
 my $req = BSE::Request->new;
 my $cfg = $req->cfg;
 my $cgi = $req->cgi;
-my $urlbase = $cfg->entryVar('site', 'url');
 unless ($req->check_admin_logon()) {
-  refresh_to("$urlbase/cgi-bin/admin/logon.pl");
+  refresh_to_admin("/cgi-bin/admin/logon.pl");
   exit;
 }
 
@@ -79,6 +78,35 @@ if ($req->user_can(edit_reorder_children => $parentid)) {
   elsif ($sort eq 'current') {
     $code = sub { $b->[1]{$b->[2]} <=> $a->[1]{$a->[2]} };
   }
+  elsif ($sort eq 'id') {
+    $code = sub { $a->[0]{id} <=> $b->[0]{id} };
+  }
+  elsif (@kids) {
+    my @fields = split ',', $sort;
+    my @reverse = grep(s/^-// || 0, @fields);
+    my %reverse;
+    @reverse{@fields} = @reverse;
+    @fields = grep exists($kids[0]{$_}), @fields;
+    my @num = 
+    my %num = map { $_ => 1 } $kids[0]->numeric;
+
+    $code =
+      sub {
+       for my $field (@fields) {
+         my $rev = $reverse{$field};
+         my $cmp;
+         if ($num{$field}) {
+           $cmp = $a->[0]{$field} <=> $b->[0]{$field};
+         }
+         else {
+           $cmp = lc $a->[0]{$field} cmp lc $b->[0]{$field};
+         }
+         $cmp = -$cmp if $rev;
+         return $cmp if $cmp;
+       }
+       return $a->[0]{id} <=> $b->[0]{id};
+      };
+  }
   if ($reverse) {
     my $temp = $code;
     $code = sub { -$temp->() };
@@ -93,7 +121,7 @@ if ($req->user_can(edit_reorder_children => $parentid)) {
   }
 }
 
-refresh_to("$urlbase$refreshto");
+refresh_to_admin($cfg, $refreshto);
 
 =head1 NAME
 
index e7825855e457727841f5ecf87bb789e870295f65..1f4c7b0965b388f8994b65f9f9f3b3b2970234b8 100755 (executable)
@@ -11,7 +11,7 @@ use BSE::Permissions;
 use BSE::Util::Tags;
 use DevHelp::Report;
 use DevHelp::HTML;
-use Util 'refresh_to';
+use BSE::WebUtil 'refresh_to';
 
 my $req = BSE::Request->new;
 my $cgi = $req->cgi;
index 80d363d4d8283d3f065448215f5f1f56d31d546a..61a061551f6b9ec3ce4bab256558dc1cad080388 100755 (executable)
@@ -22,7 +22,7 @@ use Articles;
 use BSE::Sort;
 use BSE::Util::Tags;
 use BSE::Request;
-use Util 'refresh_to';
+use BSE::WebUtil 'refresh_to_admin';
 use DevHelp::HTML;
 use BSE::Arrows;
 
@@ -31,7 +31,7 @@ my $cfg = $req->cfg;
 my $securlbase = $cfg->entryVar('site', 'secureurl');
 my $baseurl =  $cfg->entryVar('site', 'url');
 unless ($req->check_admin_logon()) {
-  refresh_to("$baseurl/cgi-bin/admin/logon.pl");
+  refresh_to_admin($cfg, "/cgi-bin/admin/logon.pl");
   exit;
 }
 #my %session;
index d0ac8e915853f4a213fa63b95959dfb0a23e4fee..eb799b09ece71dced38ef171147c984e47e3a581 100755 (executable)
@@ -10,7 +10,7 @@ use BSE::DB;
 use BSE::Util::Tags;
 use BSE::Template;
 use Articles;
-use Util qw/refresh_to/;
+use BSE::WebUtil qw/refresh_to refresh_to_admin/;
 use BSE::Message;
 use BSE::Permissions;
 use BSE::Request;
@@ -276,13 +276,13 @@ sub _refresh_list {
 
   my $url = $q->param('r');
   unless ($url) {
-    $url = $cfg->entryErr('site', 'url') . "/cgi-bin/admin/subs.pl";
+    $url = "/cgi-bin/admin/subs.pl";
     if ($msg) {
       $url .= "?m=" . CGI::escape($msg);
     }
   }
 
-  refresh_to($url);
+  refresh_to_admin($cfg, $url);
 }
 
 sub addsave {
index 110153cfac4916111ec8a459dafe08524fa511e8..7b1c7630c27fa14a8e2485942f98edd9d3341708 100644 (file)
@@ -14,6 +14,11 @@ sub columns {
     customInt1 customInt2 customInt3 customInt4/;
 }
 
+sub numeric {
+  qw(id listed parentid threshold summaryLength level 
+     customInt1 customInt2 customInt3 customInt4);
+}
+
 sub step_parents {
   my ($self) = @_;
 
index 3d75f3be67366eb20df4c78400b46ec4602fc930..eee79c991a7b25edfa1b89cd485a11dc82386421 100644 (file)
@@ -2,6 +2,7 @@ package BSE::AdminLogon;
 use strict;
 use BSE::Util::Tags qw(tag_error_img);
 use DevHelp::HTML;
+use BSE::CfgInfo 'admin_base_url';
 
 my %actions =
   (
@@ -77,7 +78,7 @@ sub req_logon {
 
   my $r = $cgi->param('r');
   unless ($r) {
-    $r = $req->cfg->entryErr('site', 'url') . "/cgi-bin/admin/menu.pl";
+    $r = admin_base_url($req->cfg) . "/cgi-bin/admin/menu.pl";
   }
 
   return BSE::Template->get_refresh($r, $req->cfg);
@@ -89,7 +90,7 @@ sub req_logoff {
   delete $req->session->{adminuserid};
   ++$req->session->{changed};
 
-  my $r = $req->cfg->entryErr('site', 'url') . "/cgi-bin/admin/logon.pl";
+  my $r = admin_base_url($req->cfg) . "/cgi-bin/admin/logon.pl";
 
   return BSE::Template->get_refresh($r, $req->cfg);
 }
index 5743d54e1a7c5d7b53313d3e084f09dc98c818cc..f5242e2f520790ae549eedfd7cdc34aaa5bb87aa 100644 (file)
@@ -3,6 +3,7 @@ use strict;
 use BSE::Util::Tags qw/tag_error_img/;
 use BSE::Permissions;
 use DevHelp::HTML;
+use BSE::CfgInfo qw(admin_base_url);
 
 my %actions =
   (
@@ -193,7 +194,7 @@ sub refresh {
 
   my $url = $req->cgi->param('r');
   unless ($url) {
-    $url = $req->cfg->entryVar('site', 'url');
+    $url = admin_base_url($req->cfg);
     $url .= $ENV{SCRIPT_NAME};
     $url .= "?$target=1";
     while (my ($key, $value) = splice @parms, 0, 2) {
index d33fe4037af76aabe6c56c9fe983327546b057c3..8c4e8adf6663f9fc1c773658995e5b2d44b0fc92 100644 (file)
@@ -2,12 +2,12 @@ package BSE::Edit::Article;
 use strict;
 use base qw(BSE::Edit::Base);
 use BSE::Util::Tags qw(tag_error_img);
-use BSE::Util::SQL qw(now_sqldate);
+use BSE::Util::SQL qw(now_sqldate now_sqldatetime);
 use BSE::Util::Valid qw/valid_date/;
 use BSE::Permissions;
 use DevHelp::HTML qw(:default popup_menu);
 use BSE::Arrows;
-use BSE::CfgInfo qw(custom_class);
+use BSE::CfgInfo qw(custom_class admin_base_url);
 
 sub article_dispatch {
   my ($self, $req, $article, $articles) = @_;
@@ -696,7 +696,7 @@ sub tag_movechild {
 
   my $cgi_uri = $self->{cfg}->entry('uri', 'cgi', '/cgi-bin');
   my $images_uri = $self->{cfg}->entry('uri', 'images', '/images');
-  my $urlbase = $req->cfg->entryVar('site', 'url');
+  my $urlbase = admin_base_url($req->cfg);
   my $refresh_url = "$urlbase$ENV{SCRIPT_NAME}?id=$article->{id}";
   my $t = $req->cgi->param('_t');
   if ($t && $t =~ /^\w+$/) {
@@ -751,7 +751,7 @@ sub tag_imgmove {
   $img_prefix = '' unless defined $img_prefix;
   $urladd = '' unless defined $urladd;
 
-  my $urlbase = $req->cfg->entryVar('site', 'url');
+  my $urlbase = admin_base_url($req->cfg);
   my $url = "$urlbase$ENV{SCRIPT_NAME}?id=$article->{id}";
   my $t = $req->cgi->param('_t');
   if ($t && $t =~ /^\w+$/) {
@@ -787,7 +787,7 @@ sub tag_movefiles {
   $$rindex >= 0 && $$rindex < @$files
     or return '** movefiles can only be used in the files iterator **';
 
-  my $urlbase = $self->{cfg}->entryVar('site', 'url');
+  my $urlbase = admin_base_url($req->cfg);
   my $url = "$urlbase$ENV{SCRIPT_NAME}?id=$article->{id}$urladd";
   my $t = $req->cgi->param('_t');
   if ($t && $t =~ /^\w+$/) {
@@ -1304,7 +1304,7 @@ sub save_new {
       if !defined $data{summaryLength} || $data{summaryLength} =~ /^\s*$/;
   }
   $data{generator} = $self->generator;
-  $data{lastModified} = now_sqldate();
+  $data{lastModified} = now_sqldatetime();
   $data{level} = $level;
   $data{listed} = 1 unless defined $data{listed};
 
@@ -1327,8 +1327,8 @@ sub save_new {
     $r .= "id=$article->{id}";
   }
   else {
-    my $urlbase = $self->{cfg}->entryVar('site', 'url');
-    $r = $urlbase . $article->{admin};
+    
+    $r = admin_base_url($req->cfg) . $article->{admin};
   }
   return BSE::Template->get_refresh($r, $self->{cfg});
 
@@ -1433,7 +1433,7 @@ sub save {
   $article->{expire} = sql_date($cgi->param('expire')) || $Constants::D_99
     if defined $cgi->param('expire') && 
       $req->user_can('edit_field_edit_expire', $article);
-  $article->{lastModified} =  now_sqldate();
+  $article->{lastModified} =  now_sqldatetime();
   my $link_titles = $self->{cfg}->entryBool('basic', 'link_titles', 0);
   if ($article->{link} && 
       !$self->{cfg}->entry('protect link', $article->{id})) {
@@ -1822,7 +1822,7 @@ sub refresh {
 
   my $url = $cgi->param('r');
   unless ($url) {
-    my $urlbase = $self->{cfg}->entryVar('site', 'url');
+    my $urlbase = admin_base_url($self->{cfg});
     $url = "$urlbase$ENV{SCRIPT_NAME}?id=$article->{id}";
     $url .= "&message=" . CGI::escape($message) if $message;
     if ($cgi->param('_t')) {
@@ -2172,14 +2172,14 @@ my %types =
    mov  video/quicktime
    moov video/quicktime
    mpg  video/mpeg
+   mp4  video/mp4
    mpeg video/mpeg
    avi  video/avi
    flc  video/flc
    wmv  video/x-ms-wmv
    asf  video/x-ms-asf
-   mp2  audio/mpeg
-   mp3  audio/mpeg
-   mp4  audio/mp4
+   mp2  audio/x-mpeg
+   mp3  audio/x-mpeg
    m4a  audio/m4a
    3gp  audio/3gpp
    aif  audio/aiff
@@ -2464,7 +2464,7 @@ sub remove {
   $article->remove;
   my $url = $req->cgi->param('r');
   unless ($url) {
-    my $urlbase = $self->{cfg}->entryVar('site', 'url');
+    my $urlbase = admin_base_url($req->cfg);
     $url = "$urlbase$ENV{SCRIPT_NAME}?id=$parentid";
     $url .= "&message=Article+deleted";
   }
@@ -2498,7 +2498,8 @@ sub hide {
   }
   my $r = $req->cgi->param('r');
   unless ($r) {
-    $r = $req->cfg->entryVar('site', 'url') . "/cgi-bin/admin/add.pl?id=" . $article->{parentid};
+    $r = admin_base_url($req->cfg)
+      . "/cgi-bin/admin/add.pl?id=" . $article->{parentid};
   }
   return $self->refresh($article, $req->cgi, undef, 'Article hidden');
 }
index a8c795e3fc1a6aeedcf80f12839844be428b1f68..5287324ff72c55c712798ca1f79bfb77c4b86a64 100644 (file)
@@ -22,12 +22,23 @@ sub new {
 }
 
 sub _image {
-  my ($self, $im, $align, $url) = @_;
+  my ($self, $im, $align, $url, $style) = @_;
 
   my $text = qq!<img src="/images/$im->{image}" width="$im->{width}"!
     . qq! height="$im->{height}" alt="! . escape_html($im->{alt}).'"'
       . qq! border="0"!;
   $text .= qq! align="$align"! if $align && $align ne 'center';
+  if ($style) {
+    if ($style =~ /^\w+$/) {
+      $text .= qq! class="$style"!;
+    }
+    elsif ($style =~ /^\d/) {
+      $text .= qq! style="padding: $style"!;
+    }
+    else {
+      $text .= qq! style="$style"!;
+    }
+  }
   $text .= qq! />!;
   $text = qq!<div align="center">$text</div>!
     if $align && $align eq 'center';
@@ -44,7 +55,7 @@ sub _image {
 sub gimage {
   my ($self, $args) = @_;
 
-  my ($name, $align, $url) = split /\|/, $args, 3;
+  my ($name, $align, $url, $style) = split /\|/, $args, 4;
   my $im = $self->{gen}->get_gimage($name);
   if ($im) {
     $self->_image($im, $align, $url);
@@ -58,7 +69,7 @@ sub image {
   my ($self, $args) = @_;
 
   my $images = $self->{images};
-  my ($index, $align, $url) = split /\|/, $args, 3;
+  my ($index, $align, $url, $style) = split /\|/, $args, 4;
   my $text = '';
   my $im;
   if ($index =~ /^\d+$/) {
@@ -77,7 +88,7 @@ sub image {
     }
   }
   if ($im) {
-    return $self->_image($im, $align, $url);
+    return $self->_image($im, $align, $url, $style);
   }
   else {
     return '';
index 9aecd8c5fdf4d50ce368bd7b6eaed3bb0b6c3094..6b5ad93ab326f0ef34d4861c32d25c7e66e9aa3e 100644 (file)
@@ -49,7 +49,8 @@ sub getuser {
 sub url {
   my ($self, $action, $params, $name) = @_;
 
-  my $url = $self->cfg->entryErr('site', 'url');
+  require BSE::CfgInfo;
+  my $url = BSE::CfgInfo::admin_base_url($self->{cfg});
   $url .= "/cgi-bin/admin/$action.pl";
   if ($params && keys %$params) {
     $url .= "?" . join("&", map { "$_=".escape_uri($params->{$_}) } keys %$params);
index 3cd4fcddde1f20a028915093706f1ddb33cd8d6c..46f6866098edd4a1657b4d34b1094d4f9bcb4940 100644 (file)
@@ -12,6 +12,7 @@ use BSE::EmailRequests;
 use BSE::Util::SQL qw/now_datetime/;
 use DevHelp::HTML;
 use BSE::CfgInfo qw(custom_class);
+use BSE::WebUtil qw/refresh_to/;
 
 use constant MAX_UNACKED_CONF_MSGS => 3;
 use constant MIN_UNACKED_CONF_GAP => 2 * 24 * 60 * 60;
@@ -751,7 +752,6 @@ sub register {
     elsif ($subs) {
       return if $self->send_conf_request($session, $cgi, $cfg, $user, 1);
     }
-    use Util qw/refresh_to/;
     
     _got_user_refresh($session, $cgi, $cfg);
 
index c70e02aababa975bb5a9c01d30f46ae5d9fbd963..8bc33d162fef7834609421d827921e8ac7c6d82f 100644 (file)
@@ -64,8 +64,8 @@ sub iter_cfgsection {
 sub tag_adminbase {
   my ($cfg, $arg) = @_;
 
-  require Util;
-  return escape_html(Util::admin_base_url($cfg));
+  require BSE::CfgInfo;
+  return escape_html(BSE::CfgInfo::admin_base_url($cfg));
 }
 
 sub static {
diff --git a/site/cgi-bin/modules/BSE/WebUtil.pm b/site/cgi-bin/modules/BSE/WebUtil.pm
new file mode 100644 (file)
index 0000000..ea30692
--- /dev/null
@@ -0,0 +1,32 @@
+package BSE::WebUtil;
+use strict;
+
+use vars qw(@EXPORT_OK @ISA);
+require Exporter;
+@ISA = qw(Exporter);
+@EXPORT_OK = qw(refresh_to refresh_to_admin);
+
+sub refresh_to {
+  my ($where) = @_;
+
+  print "Content-Type: text/html\n";
+  print qq!Refresh: 0; url=$where\n\n<html></html>\n!;
+}
+
+sub refresh_to_admin {
+  my ($cfg, $where) = @_;
+
+  use Carp 'confess';
+  defined $where or confess 'No url supplied';
+
+
+  unless ($where =~ /^\w+:/) {
+    require BSE::CfgInfo;
+    my $adminbase = BSE::CfgInfo::admin_base_url($cfg);
+    $where = $adminbase . $where;
+  }
+
+  refresh_to($where);
+}
+
+1;
index bc274999fdda8dad48dd15b1f9aaaf8882235855..3c05266350a36d4769254429167ac2cc6543b25d 100644 (file)
@@ -4,9 +4,10 @@ use vars qw(@ISA @EXPORT_OK);
 require Exporter;
 @ISA = qw(Exporter);
 @EXPORT_OK = qw(generate_article generate_all generate_button 
-                refresh_to regen_and_refresh custom_class);
+                regen_and_refresh);
 use Constants qw($CONTENTBASE $GENERATE_BUTTON $SHOPID $AUTO_GENERATE);
 use Carp qw(confess);
+use BSE::WebUtil qw(refresh_to_admin);
 
 # returns non-zero if the Regenerate button should work
 sub generate_button {
@@ -275,13 +276,6 @@ sub generate_all {
   $callback->("Total of ".(time()-$allstart)." seconds") if $callback;
 }
 
-sub refresh_to {
-  my ($where) = @_;
-
-  print "Content-Type: text/html\n";
-  print qq!Refresh: 0; url=$where\n\n<html></html>\n!;
-}
-
 =item regen_and_refresh($articles, $article, $generate, $refreshto, $cfg, $progress)
 
 An error checking wrapper around the page regeneration code.
@@ -358,7 +352,7 @@ sub regen_and_refresh {
   }
 
   unless ($progress) {
-    refresh_to($refreshto);
+    refresh_to_admin($cfg, $refreshto);
   }
 
   return 1;
index d62b2460ffd67aeced6edf2c0244f12605ee30bb..3a4ca35457f6d7c67e0ee211e3d3cfade2f1577c 100755 (executable)
@@ -10,7 +10,7 @@ use Product;
 use Constants qw(:shop $CGI_URI);
 use BSE::Template;
 use CGI::Cookie;
-use Util qw(refresh_to);
+use BSE::WebUtil qw(refresh_to);
 use BSE::CfgInfo qw(custom_class);
 use BSE::Mail;
 use BSE::Shop::Util qw/shop_cart_tags cart_item_opts nice_options total 
@@ -18,7 +18,6 @@ use BSE::Shop::Util qw/shop_cart_tags cart_item_opts nice_options total
                        payment_types/;
 use BSE::Session;
 use BSE::Cfg;
-use Util qw/refresh_to/;
 use BSE::Util::Tags qw(tag_hash);
 
 
index c5d823885cedef50d8a95b09412a932b3b6b3192..600b9e8b09853b0669736baa32a735edf92ae418 100644 (file)
@@ -10,6 +10,45 @@ Maybe I'll add some other bits here.
 
 =head1 CHANGES
 
+=head2 0.14_15
+
+This adds several destabilizing changes, test before using in any
+production setting.
+
+=over
+
+=item *
+
+you can now specify that BSE uses the configured secure URL, the
+normal URL or a separate admin base URL for access to administrative
+functions.  The action parameter on any custom admin/logon.tmpl should
+be changed to include the new <:adminbase:> tag.
+
+=item *
+
+reorder.pl now accepts a more sophisticated C<sort> parameter, it can
+now be a comma separated list of fields to sort by, most significant
+at the front.  Any unknown fields are ignored.  You can put C<-> in
+front of any field name to sort that field in reverse.
+
+=item *
+
+the image[] and gimage[] tags now take a fourth parameter which can
+either be a simple class name (all alphanumeric), a set of parameters
+to the C<padding:> style command, or actual CSS style commands.
+
+=item *
+
+lastModified is now a datetime rather than a date, be sure to run
+upgrade_mysql.pl
+
+=item *
+
+applied a change to the default table mapping from extension to MIME
+content type, sent in by Adrian.
+
+=back
+
 =head2 0.14_14
 
 =over
index 38b8dc8665c885279a91a01c00371fb907b4f69e..4a7aadee84f0c3880036fb43254525b562a09cf6 100644 (file)
@@ -15,6 +15,40 @@ mod_perl, at least if you want more than one site on the machine.
 
 =head1 CONFIGURATION ENTRIES
 
+=head2 [site]
+
+Contains URL configuration for the site.
+
+=over
+
+=item url
+
+The normal URL for the non-secure parts of the site.
+
+=item secureurl
+
+The secure URL for the shop, products and other portions of the site
+that should use SSL.  This isn't checked to make sure it is https.
+
+=item name
+
+Used as the site "name" in a few places.
+
+=item adminurl
+
+If set, this is used as the base URL for accessing the administrative
+functions of your site.
+
+=item secureadmin
+
+Ignored if C<adminurl> is set.
+
+If this is true then C<secureurl> is used as the base URL for
+accessing the administrative functions of your site, otherwise C<url>
+is used as the base URL.  Default: false (C<url>'s value is used)
+
+=back
+
 =head2 [paths]
 
 Contains various file system paths.
index 0413f16f69b0ce07bb233198ca9fdfbfcd15dc91..2c4e9d65b7a4590bed5c2c9d407dac5a66eb22a8 100644 (file)
@@ -36,6 +36,7 @@ text of the link.
 <dd>image[<i>index</i>]</dd>
 <dd>image[<i>index</i>|<i>alignment</i>]</dd>
 <dd>image[<i>index</i>|<i>alignment</i>|<i>url</i>]</dd>
+<dd>image[<i>index</i>|<i>alignment</i>|<i>url</i>|<i>style</i>]</dd>
 
 <dt>Inserts the image number <i>index</i> associated with the article.
 <i>index</i> counts from the top starting with 1.  If no alignment is
@@ -44,12 +45,19 @@ then the images URL is used if there is one.  If either url is present
 the image becomes a link, though no border is shown around the
 image.</dt>
 
+<dt>The <i>style</i> parameter can be either a CSS class name,
+inserted as a <code>class="<i>style</i>"</code> parameter, the
+parameters to the CSS style <code>padding</code>, inserted as a
+<code>style="padding: <i>style</i></code> or as CSS style commands
+inserted as a <code>style="<i>style</i>"</code> parameter.</dt>
+
 <dt>If you use the image[] tag then the normal automatic image
 insertion is not done.</dt>
 
 <dd>image[<i>name</i>]</dd>
 <dd>image[<i>name</i>|<i>alignment</i>]</dd>
 <dd>image[<i>name</i>|<i>alignment</i>|<i>url</i>]</dd>
+<dd>image[<i>name</i>|<i>alignment</i>|<i>url</i>|<i>style</i>]</dd>
 
 <dt>Same as above, but refers to the images by name.  This does not
 prevent the normal automatic image placement.</dt>
@@ -57,6 +65,7 @@ prevent the normal automatic image placement.</dt>
 <dd>gimage[<i>name</i>]</dd>
 <dd>gimage[<i>name</i>|<i>alignment</i>]</dd>
 <dd>gimage[<i>name</i>|<i>alignment</i>|<i>url</i>]</dd>
+<dd>gimage[<i>name</i>|<i>alignment</i>|<i>url</i>|<i>style</i>]</dd>
 
 <dt>Inserts the given global image where the image is identified by
 name.</dt>
index 0cf9bbfa4a3bf8a2d872585b685c73ce49b38c16..973f438c9d0d56627d63855623e5f8ed059e570d 100644 (file)
@@ -1,19 +1,12 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html>
-<head>
-  <title>Administration - Logon</title>
-  <link rel="stylesheet" type="text/css" href="/css/admin.css" />
-</head>
-
-<body>
+<:wrap admin/base.tmpl title=>"Logon":>
 <h1>Logon</h1>
 <:ifMessage:>
 <p><b><:message:></b></p>
 <:or:><:eif:> 
 
-<form method="post" action="<:script:>">
+<form method="post" action="<:adminbase:><:script:>">
 <:if Cgi r:>
-<input type=hidden name=r value="<:cgi r:>">
+<input type="hidden" name="r" value="<:cgi r:>">
 <:or Cgi:><:eif Cgi:>
   <table border="0" cellspacing="0" cellpadding="0" bgcolor="#000000" class="table">
     <tr> 
@@ -43,6 +36,3 @@
     </tr>
   </table>
 </form>
-<p><font size="-1">BSE Release <:release:></font></p>
-</body
-></html>
index 88b732d0fa432ec480275e2f2937ca335c8543ca..af9d006601460392b12b9728f2cf8a7033ec7e1d 100644 (file)
--- a/test.cfg
+++ b/test.cfg
@@ -78,3 +78,5 @@ subscriptions.text_link_list_prefix=X$nX$nXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 subscriptions.text_link_list=[$3] '$1'$n   => $2
 
 #paths.local_templates=/home/tony/dev/bse/base/altadmin/
+
+site.secureadmin=1