diff --git a/lib/WebGUI/Asset/Shortcut.pm b/lib/WebGUI/Asset/Shortcut.pm index 18bba4caf..5078f6f62 100644 --- a/lib/WebGUI/Asset/Shortcut.pm +++ b/lib/WebGUI/Asset/Shortcut.pm @@ -16,9 +16,9 @@ use Tie::IxHash; use WebGUI::Definition::Asset; extends 'WebGUI::Asset'; -attribute assetName => ['assetName', 'Asset_Shortcut']; -attribute icon => 'shortcut.gif'; -attribute tableName => 'Shortcut'; +aspect assetName => ['assetName', 'Asset_Shortcut']; +aspect icon => 'shortcut.gif'; +aspect tableName => 'Shortcut'; property shortcutToAssetId => ( noFormPost => 1, diff --git a/lib/WebGUI/Asset/Sku.pm b/lib/WebGUI/Asset/Sku.pm index 3b6622eaf..fdf32120e 100644 --- a/lib/WebGUI/Asset/Sku.pm +++ b/lib/WebGUI/Asset/Sku.pm @@ -23,9 +23,9 @@ use WebGUI::Inbox; use WebGUI::Shop::Cart; use JSON qw{ from_json to_json }; -attribute assetName => ['assetName', 'Asset_Sku']; -attribute icon => 'Sku.gif'; -attribute tableName => 'sku'; +aspect assetName => ['assetName', 'Asset_Sku']; +aspect icon => 'Sku.gif'; +aspect tableName => 'sku'; property description => ( tab => "properties", diff --git a/lib/WebGUI/Asset/Sku/Product.pm b/lib/WebGUI/Asset/Sku/Product.pm index 2ea285dc7..4380ac4b2 100644 --- a/lib/WebGUI/Asset/Sku/Product.pm +++ b/lib/WebGUI/Asset/Sku/Product.pm @@ -22,9 +22,9 @@ use JSON; use WebGUI::Definition::Asset; extends 'WebGUI::Asset::Sku'; -attribute assetName => ['assetName', 'Asset_Product']; -attribute icon => 'product.gif'; -attribute tableName => 'Product'; +aspect assetName => ['assetName', 'Asset_Product']; +aspect icon => 'product.gif'; +aspect tableName => 'Product'; property cacheTimeout => ( tab => "display", diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index 8ecedf665..4ad1bc288 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -23,10 +23,10 @@ use HTML::Packer; use JavaScript::Packer; use CSS::Packer; -attribute assetName => ['assetName','Asset_Snippet']; -attribute uiLevel => 5; -attribute icon => 'snippet.gif'; -attribute tableName => 'snippet'; +aspect assetName => ['assetName','Asset_Snippet']; +aspect uiLevel => 5; +aspect icon => 'snippet.gif'; +aspect tableName => 'snippet'; property snippet => ( fieldType => 'codearea', diff --git a/lib/WebGUI/Asset/Template.pm b/lib/WebGUI/Asset/Template.pm index 0d07df289..19d8ccb89 100644 --- a/lib/WebGUI/Asset/Template.pm +++ b/lib/WebGUI/Asset/Template.pm @@ -19,9 +19,9 @@ use strict; use WebGUI::Definition::Asset; extends 'WebGUI::Asset'; -attribute assetName => ['assetName', 'Asset_Template'], -attribute icon => 'template.gif', -attribute tableName => 'template', +aspect assetName => ['assetName', 'Asset_Template'], +aspect icon => 'template.gif', +aspect tableName => 'template', property template => ( fieldType => 'codearea', diff --git a/lib/WebGUI/Asset/Wobject.pm b/lib/WebGUI/Asset/Wobject.pm index c0467f5fe..88829de82 100644 --- a/lib/WebGUI/Asset/Wobject.pm +++ b/lib/WebGUI/Asset/Wobject.pm @@ -25,8 +25,8 @@ use WebGUI::SQL; use WebGUI::Utility; use WebGUI::Definition::Asset; extends 'WebGUI::Asset'; -attribute tableName => 'wobject', -attribute assetName => 'Wobject', +aspect tableName => 'wobject', +aspect assetName => 'Wobject', property description => ( fieldType => 'HTMLArea', default => undef, diff --git a/lib/WebGUI/Asset/Wobject/Folder.pm b/lib/WebGUI/Asset/Wobject/Folder.pm index b16a894b0..84643d3d2 100644 --- a/lib/WebGUI/Asset/Wobject/Folder.pm +++ b/lib/WebGUI/Asset/Wobject/Folder.pm @@ -18,10 +18,10 @@ use strict; use WebGUI::Definition::Asset; extends 'WebGUI::Asset::Wobject'; -attribute assetName => ["assetName", 'Asset_Folder']; -attribute uiLevel => 5; -attribute icon => 'folder.gif'; -attribute tableName => 'Folder'; +aspect assetName => ["assetName", 'Asset_Folder']; +aspect uiLevel => 5; +aspect icon => 'folder.gif'; +aspect tableName => 'Folder'; property visitorCacheTimeout => ( tab => "display", diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 9f2aa7ae2..8ccd2c033 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -19,9 +19,9 @@ use WebGUI::AdSpace; use WebGUI::Definition::Asset; extends 'WebGUI::Asset::Wobject'; -attribute assetName => ["assetName", 'Asset_Layout']; -attribute icon => 'layout.gif'; -attribute tableName => 'Layout'; +aspect assetName => ["assetName", 'Asset_Layout']; +aspect icon => 'layout.gif'; +aspect tableName => 'Layout'; property templateId => ( fieldType => "template", diff --git a/lib/WebGUI/Asset/Wobject/Navigation.pm b/lib/WebGUI/Asset/Wobject/Navigation.pm index 4b51f77b4..83dd98d7c 100644 --- a/lib/WebGUI/Asset/Wobject/Navigation.pm +++ b/lib/WebGUI/Asset/Wobject/Navigation.pm @@ -20,9 +20,9 @@ use WebGUI::Utility; use WebGUI::Definition::Asset; extends 'WebGUI::Asset::Wobject'; -attribute assetName => ["assetName", 'Asset_Navigation']; -attribute icon => 'navigation.gif'; -attribute tableName => 'Navigation'; +aspect assetName => ["assetName", 'Asset_Navigation']; +aspect icon => 'navigation.gif'; +aspect tableName => 'Navigation'; property templateId => ( label => ['1096', 'Asset_Navigation'], diff --git a/lib/WebGUI/Asset/Wobject/Shelf.pm b/lib/WebGUI/Asset/Wobject/Shelf.pm index 37d6b3936..7f104a2f2 100644 --- a/lib/WebGUI/Asset/Wobject/Shelf.pm +++ b/lib/WebGUI/Asset/Wobject/Shelf.pm @@ -21,9 +21,9 @@ use WebGUI::Storage; use WebGUI::Exception::Shop; use WebGUI::Asset::Sku::Product; -attribute assetName => ['assetName', 'Asset_Shelf']; -attribute icon => 'Shelf.gif'; -attribute tableName => 'Shelf'; +aspect assetName => ['assetName', 'Asset_Shelf']; +aspect icon => 'Shelf.gif'; +aspect tableName => 'Shelf'; property templateId => ( fieldType => "template", diff --git a/t/Definition.t b/t/Definition.t index 287eb7c81..baf76e0f8 100644 --- a/t/Definition.t +++ b/t/Definition.t @@ -16,7 +16,7 @@ use lib "$FindBin::Bin/lib"; use WebGUI::Test; -use Test::More tests => 10; +use Test::More tests => 12; use Test::Deep; use Test::Exception; @@ -27,7 +27,7 @@ my $called_getProperties; package WGT::Class; use WebGUI::Definition; - attribute 'attribute1' => 'attribute1 value'; + aspect 'aspect1' => 'aspect1 value'; property 'property1' => ( arbitrary_key => 'arbitrary_value', label => 'property1', @@ -37,8 +37,8 @@ my $called_getProperties; label => 'property2', ); - # attributes create methods - ::can_ok +__PACKAGE__, 'attribute1'; + # aspects create methods + ::can_ok +__PACKAGE__, 'aspect1'; # propeties create methods ::can_ok +__PACKAGE__, 'property1'; @@ -60,7 +60,7 @@ my $called_getProperties; package WGT::Class2; use WebGUI::Definition; - attribute 'attribute1' => 'attribute1 value'; + aspect 'aspect1' => 'aspect1 value'; property 'property3' => ( label => 'label' ); property 'property1' => ( label => 'label' ); property 'property2' => ( label => 'label' ); @@ -102,7 +102,7 @@ my $called_getProperties; package WGT::Class3; use WebGUI::Definition; - attribute 'attribute1' => 'attribute1 value'; + aspect 'aspect1' => 'aspect1 value'; property 'property1' => ( label => ['webgui', 'WebGUI'], options => \&property1_options, @@ -127,3 +127,32 @@ my $called_getProperties; ); } + +{ + package WGT::Class4; + use WebGUI::Definition; + extends 'WGT::Class3'; + + aspect 'aspect41' => 'aspect41 value'; + property 'property41' => ( + label => ['webgui', 'WebGUI'], + ); + has something => ( + is => 'rw', + ); + + my $object3 = WGT::Class3->new({session => $session}); + my $object4 = WGT::Class4->new({session => $session}); + + ::cmp_bag ( + [WGT::Class3->meta->get_all_attributes_list], + [qw/ property1 session /], + 'get_all_aspects_list returns all aspects in all metaclasses for the class' + ); + + ::cmp_bag ( + [WGT::Class4->meta->get_all_attributes_list], + [qw/ property41 something property1 session /], + '... checking inherited class' + ); +} diff --git a/t/Definition/Asset.t b/t/Definition/Asset.t index 9fe131d5a..be71e484b 100644 --- a/t/Definition/Asset.t +++ b/t/Definition/Asset.t @@ -24,7 +24,7 @@ use WebGUI::Test; package WGT::Class::Atset; use WebGUI::Definition::Asset; - attribute tableName => 'asset'; + aspect tableName => 'asset'; ::dies_ok { property 'property1' => (); } 'must have a fieldType'; ::dies_ok { property 'property1' => (fieldType => 'text'); } 'must pass either a label or noFormPost flag'; ::lives_ok { property 'property1' => ( @@ -44,7 +44,7 @@ use WebGUI::Test; package WGT::Class::Asset; use WebGUI::Definition::Asset; - attribute tableName => 'asset'; + aspect tableName => 'asset'; property 'property2' => ( fieldType => 'text', label => 'property2', @@ -142,7 +142,7 @@ use WebGUI::Test; package WGT::Class::AlsoAsset; use WebGUI::Definition::Asset; - attribute tableName => 'asset'; + aspect tableName => 'asset'; property 'property1' => ( fieldType => 'text', label => 'property1', @@ -160,7 +160,7 @@ use WebGUI::Test; use WebGUI::Definition::Asset; extends 'WGT::Class::AlsoAsset'; - attribute tableName => 'snippet'; + aspect tableName => 'snippet'; property 'property10' => ( fieldType => 'text', label => 'property10', @@ -215,7 +215,7 @@ use WebGUI::Test; use WebGUI::Definition::Asset; extends 'WGT::Class::AlsoAsset'; - attribute tableName => 'snippet'; + aspect tableName => 'snippet'; property 'property10' => ( fieldType => 'text', label => 'property10', @@ -241,7 +241,7 @@ use WebGUI::Test; use WebGUI::Definition::Asset; extends 'WGT::Class::AlsoAsset'; - attribute tableName => 'tertius'; + aspect tableName => 'tertius'; property 'defaulted' => ( fieldType => 'text', label => 'defaulted',