From 5dc02992264e8104f8d1e01e05641f3744633ae4 Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 3 Mar 2010 18:43:28 -0800 Subject: [PATCH] First cut at moving Subscribable to an Asset. --- .../Asset}/Subscribable.pm | 92 +++++++++---------- ...t_Subscribable.pm => Role_Subscribable.pm} | 0 2 files changed, 44 insertions(+), 48 deletions(-) rename lib/WebGUI/{AssetAspect => Role/Asset}/Subscribable.pm (90%) rename lib/WebGUI/i18n/English/{AssetAspect_Subscribable.pm => Role_Subscribable.pm} (100%) diff --git a/lib/WebGUI/AssetAspect/Subscribable.pm b/lib/WebGUI/Role/Asset/Subscribable.pm similarity index 90% rename from lib/WebGUI/AssetAspect/Subscribable.pm rename to lib/WebGUI/Role/Asset/Subscribable.pm index bada309bd..7c6743281 100644 --- a/lib/WebGUI/AssetAspect/Subscribable.pm +++ b/lib/WebGUI/Role/Asset/Subscribable.pm @@ -1,12 +1,52 @@ -package WebGUI::AssetAspect::Subscribable; +package WebGUI::Role::Asset::Subscribable; + +=head1 LEGAL + + ------------------------------------------------------------------- + WebGUI is Copyright 2001-2009 Plain Black Corporation. + ------------------------------------------------------------------- + Please read the legal notices (docs/legal.txt) and the license + (docs/license.txt) that came with this distribution before using + this software. + ------------------------------------------------------------------- + http://www.plainblack.com info@plainblack.com + ------------------------------------------------------------------- + +=cut + -use strict; -use Class::C3; use WebGUI::International; +use Moose::Role; +use WebGUI::Definition::Asset; +define tableName => "assetAspect_Subscribable", +property subscriptionGroupId => ( + tab => "security", + fieldType => "subscriptionGroup", + label => ["Subscription Group", 'Role_Subscribable'], + hoverHelp => ["Subscription Group help", 'Role_Subscribable'], + default => undef, + noFormPost => 1, + ); +property subscriptionTemplateId => ( + tab => "display", + fieldType => "template", + namespace => \&_subscriptionTemplateId_namespace, + label => ["Email Template", 'Role_Subscribable'], + hoverHelp => ["Email Template help", 'Role_Subscribable'], + ); +sub _subscriptionTemplateId_namespace { + my $self = shift; + return $self->getSubscriptionTemplateNamespace($session); +} +property skipNotification => ( + autoGenerate => 0, + noFormPost => 1, + fieldType => 'yesNo', + ); =head1 NAME -WebGUI::AssetAspect::Subscribable - Let users subscribe to your asset +WebGUI::Role::Asset::Subscribable - Let users subscribe to your asset =head1 SYNOPSIS @@ -18,50 +58,6 @@ WebGUI::AssetAspect::Subscribable - Let users subscribe to your asset #---------------------------------------------------------------------------- -=head2 definition ( session [, definition ] ) - -=cut - -sub definition { - my $class = shift; - my $session = shift; - my $definition = shift; - my $i18n = WebGUI::International->new($session, 'AssetAspect_Subscribable'); - - tie my %properties, 'Tie::IxHash', ( - subscriptionGroupId => { - tab => "security", - fieldType => "subscriptionGroup", - label => $i18n->get("Subscription Group"), - hoverHelp => $i18n->get("Subscription Group help"), - defaultValue => undef, - noFormPost => 1, - }, - subscriptionTemplateId => { - tab => "display", - fieldType => "template", - namespace => $class->getSubscriptionTemplateNamespace, - label => $i18n->get("Email Template"), - hoverHelp => $i18n->get("Email Template help"), - }, - skipNotification => { - autoGenerate => 0, - noFormPost => 1, - fieldType => 'yesNo', - }, - ); - - push @{ $definition }, { - autoGenerateForms => 1, - tableName => "assetAspect_Subscribable", - properties => \%properties, - }; - - return $class->maybe::next::method( $session, $definition ); -} - -#---------------------------------------------------------------------------- - =head2 duplicate ( [ options ] ) Subclass the method to create a new group for subscribers for the new asset. diff --git a/lib/WebGUI/i18n/English/AssetAspect_Subscribable.pm b/lib/WebGUI/i18n/English/Role_Subscribable.pm similarity index 100% rename from lib/WebGUI/i18n/English/AssetAspect_Subscribable.pm rename to lib/WebGUI/i18n/English/Role_Subscribable.pm