move subscription module into bse module dir
authorAdrian Oldham <adriann@visualthought.com.au>
Sat, 30 Aug 2014 02:00:12 +0000 (12:00 +1000)
committerAdrian Oldham <adriann@visualthought.com.au>
Mon, 1 Sep 2014 10:14:40 +0000 (20:14 +1000)
MANIFEST
site/cgi-bin/modules/BSE/Generate/Subscription.pm [new file with mode: 0644]
site/cgi-bin/modules/BSE/SubscriptionType.pm
site/cgi-bin/modules/Generate/Subscription.pm [deleted file]

index 7d43d38..ee7aace 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -346,7 +346,7 @@ site/cgi-bin/modules/Generate.pm
 site/cgi-bin/modules/BSE/Generate/Article.pm
 site/cgi-bin/modules/BSE/Generate/Catalog.pm
 site/cgi-bin/modules/BSE/Generate/Product.pm
-site/cgi-bin/modules/Generate/Subscription.pm
+site/cgi-bin/modules/BSE/Generate/Subscription.pm
 site/cgi-bin/modules/OtherParent.pm
 site/cgi-bin/modules/OtherParents.pm
 site/cgi-bin/modules/Product.pm
diff --git a/site/cgi-bin/modules/BSE/Generate/Subscription.pm b/site/cgi-bin/modules/BSE/Generate/Subscription.pm
new file mode 100644 (file)
index 0000000..9ed6723
--- /dev/null
@@ -0,0 +1,71 @@
+package BSE::Generate::Subscription;
+use strict;
+use vars qw(@ISA);
+use BSE::Generate::Article;
+@ISA = qw(BSE::Generate::Article);
+use BSE::Util::HTML;
+
+our $VERSION = "1.001";
+
+sub set_user {
+  my ($self, $user) = @_;
+
+  $self->{user} = $user;
+}
+
+sub set_sub {
+  my ($self, $sub) = @_;
+
+  #use Data::Dumper;
+  #print STDERR "set sub ",Dumper($sub);
+  $self->{sub} = $sub;
+}
+
+sub tag_ifUser {
+  my ($user, $args) = @_;
+
+  $user or return '';
+  $args or return 1;
+
+  my $value = $user->{$args};
+  defined $value or return '';
+
+  return escape_html($value);
+}
+
+sub baseActs {
+  my ($self, $articles, $acts, $article, $embedded) = @_;
+  return 
+    (
+     $self->SUPER::baseActs($articles, $acts, $article, $embedded),
+     ifUser => [ \&tag_ifUser, $self->{user} ],
+     user =>
+     sub {
+       $self->{user} or return '';
+       escape_html($self->{user}{$_[0]});
+     },
+     sub => sub { escape_html($self->{sub}{$_[0]}) },
+    );
+}
+
+sub abs_urls {
+  1;
+}
+
+sub abs_image_urls {
+  1;
+}
+
+sub formatter_class {
+  require BSE::Formatter::Subscription;
+  return 'BSE::Formatter::Subscription'
+}
+
+sub image_url {
+  my ($self, $im) = @_;
+
+  $self->{cfg}->entryVar('site', 'url') . $self->SUPER::image_url($im);
+}
+
+1;
+
index f020bde..31adada 100644 (file)
@@ -46,7 +46,7 @@ sub _build_article {
   my $template = $opts->{html_template};
   $template = $sub->{html_template} unless defined $template;
   $article->{template} = $template;
-  $article->{generator} = 'Generate::Subscription';
+  $article->{generator} = 'BSE::Generate::Subscription';
   $article->{id} = -5;
 
   $article->{threshold} = $parent->{threshold};
@@ -243,7 +243,7 @@ sub _text_format_low {
   my ($sub, $cfg, $user, $opts, $article) = @_;
 
   my $template = $opts->{text_template} || $sub->{text_template};
-  $article->{generator} = 'Generate::Subscription';
+  $article->{generator} = 'BSE::Generate::Subscription';
   $article->{id} = -5;
   my %acts;
   %acts =
@@ -289,10 +289,10 @@ sub html_format {
 
   my %article;
   $sub->_build_article(\%article, $opts);
-  require Generate::Subscription;
+  require BSE::Generate::Subscription;
   require BSE::DummyArticle;
   bless \%article, "BSE::DummyArticle";
-  my $gen = Generate::Subscription->new(cfg=>$cfg, top => \%article);
+  my $gen = BSE::Generate::Subscription->new(cfg=>$cfg, top => \%article);
   $gen->set_user($user);
   $gen->set_sub($sub);
 
@@ -325,8 +325,8 @@ sub _send {
   my $gen;
   if ($article->{template}) {
     #print STDERR "Making generator\n";
-    require Generate::Subscription;
-    $gen = Generate::Subscription->new(cfg=>$cfg, top=>$article);
+    require BSE::Generate::Subscription;
+    $gen = BSE::Generate::Subscription->new(cfg=>$cfg, top=>$article);
     $gen->set_sub($sub);
   }
   my $from = $cfg->entryIfVar('subscriptions', 'from');
diff --git a/site/cgi-bin/modules/Generate/Subscription.pm b/site/cgi-bin/modules/Generate/Subscription.pm
deleted file mode 100644 (file)
index b569d94..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-package Generate::Subscription;
-use strict;
-use vars qw(@ISA);
-use BSE::Generate::Article;
-@ISA = qw(BSE::Generate::Article);
-use BSE::Util::HTML;
-
-our $VERSION = "1.001";
-
-sub set_user {
-  my ($self, $user) = @_;
-
-  $self->{user} = $user;
-}
-
-sub set_sub {
-  my ($self, $sub) = @_;
-
-  #use Data::Dumper;
-  #print STDERR "set sub ",Dumper($sub);
-  $self->{sub} = $sub;
-}
-
-sub tag_ifUser {
-  my ($user, $args) = @_;
-
-  $user or return '';
-  $args or return 1;
-
-  my $value = $user->{$args};
-  defined $value or return '';
-
-  return escape_html($value);
-}
-
-sub baseActs {
-  my ($self, $articles, $acts, $article, $embedded) = @_;
-  return 
-    (
-     $self->SUPER::baseActs($articles, $acts, $article, $embedded),
-     ifUser => [ \&tag_ifUser, $self->{user} ],
-     user =>
-     sub {
-       $self->{user} or return '';
-       escape_html($self->{user}{$_[0]});
-     },
-     sub => sub { escape_html($self->{sub}{$_[0]}) },
-    );
-}
-
-sub abs_urls {
-  1;
-}
-
-sub abs_image_urls {
-  1;
-}
-
-sub formatter_class {
-  require BSE::Formatter::Subscription;
-  return 'BSE::Formatter::Subscription'
-}
-
-sub image_url {
-  my ($self, $im) = @_;
-
-  $self->{cfg}->entryVar('site', 'url') . $self->SUPER::image_url($im);
-}
-
-1;
-