diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index a35138c23..0fcd840bc 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -1,6 +1,8 @@ 6.7.0 - Added the ability to override the UI Level of any field in the edit form of any asset in the WebGUI config file. + - Added the ability to override the UI Level of an entire asset in the config + file. - fix [ 1229042 ] crumbtrail should show full path... - Added asset versioning. - fix [ 1229188 ] typo in Help: Collaboration, Post List Template Variables @@ -34,9 +36,9 @@ Struts or Ruby on Rails this will be very familiar. For all other developers, just know that it will make writing wobjects that much easier. For an example, take a look at the Article wobject's definition() method. - - Added an optional specification of the asset icon and name in the - definition to have getName() and getIcon() autogenerated for WebGUI::Asset - subclasses. + - Added an optional specification of the asset icon, ui level, and name in the + definition to have getName(), getUiLevel(), and getIcon() autogenerated for + WebGUI::Asset subclasses. - fix [ 1239601 ] Thread::getName is not Internationalized (and many other Assets, too) - fix [ 1240316 ] Doc erro in Folder template thumbnail => thumbnail.url - The Navigation template variable "unfolded_page_loop" was removed a long diff --git a/etc/WebGUI.conf.original b/etc/WebGUI.conf.original index fa111c429..3273393e3 100644 --- a/etc/WebGUI.conf.original +++ b/etc/WebGUI.conf.original @@ -137,6 +137,13 @@ utilityAssets = WebGUI::Asset::Template, \ #assetAddPrivilege = WebGUI::Asset::Wobject::SQLReport => 3, \ # WebGUI:::Asset::Template => 4 +# Optionally override the default UI Level of any asset. This +# dermines whether the current user has the appropriate UI Level +# to add assets of that type. + +#assetUiLevel = WebGUI::Asset::Wobject::WSClient => 7, +# WebGUI::Asset::RichEdit => 4 + # You can override the UI Levels of any field in the edit form of # any asset using the following variables. Basically just take the # class name of the asset seperated by underscores, and append diff --git a/lib/WebGUI/Asset.pm b/lib/WebGUI/Asset.pm index 29a5ab900..f0282ccab 100644 --- a/lib/WebGUI/Asset.pm +++ b/lib/WebGUI/Asset.pm @@ -1743,14 +1743,16 @@ sub getToolbarState { =head2 getUiLevel ( ) -Always returns zero. - -=cut +Returns the UI Level specified in the asset definition or from the config file if it's overridden. And if neither of those is specified, then it returns 1. +=cut + sub getUiLevel { - my $self = shift; - return 0; -} + my $self = shift; + my $definition = $self->definition; + return $session{config}{assetUiLevel}{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1; +} + #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Redirect.pm b/lib/WebGUI/Asset/Redirect.pm index acb64cccd..b52789ead 100644 --- a/lib/WebGUI/Asset/Redirect.pm +++ b/lib/WebGUI/Asset/Redirect.pm @@ -61,6 +61,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get('redirect',"Asset_Redirect"), + uiLevel => 9, icon=>'redirect.gif', tableName=>'redirect', className=>'WebGUI::Asset::Redirect', @@ -97,22 +98,6 @@ sub getEditForm { } - - -#------------------------------------------------------------------- - -=head2 getUiLevel () - -Returns the UI level of this asset. - -=cut - -sub getUiLevel { - return 9; -} - - - #------------------------------------------------------------------- sub www_edit { my $self = shift; diff --git a/lib/WebGUI/Asset/RichEdit.pm b/lib/WebGUI/Asset/RichEdit.pm index 59d122103..4db79c13a 100644 --- a/lib/WebGUI/Asset/RichEdit.pm +++ b/lib/WebGUI/Asset/RichEdit.pm @@ -64,6 +64,7 @@ sub definition { push(@{$definition}, { assetName=>'Rich Editor', icon=>'richEdit.gif', + uiLevel => 5, tableName=>'RichEdit', className=>'WebGUI::Asset::RichEdit', properties=>{ @@ -381,18 +382,6 @@ sub getToolbar { } -#------------------------------------------------------------------- - -=head2 getUiLevel () - -Returns the UI level of this asset. - -=cut - -sub getUiLevel { - return 5; -} - #------------------------------------------------------------------- sub getRichEditor { diff --git a/lib/WebGUI/Asset/Snippet.pm b/lib/WebGUI/Asset/Snippet.pm index c858f8631..201adfdbf 100644 --- a/lib/WebGUI/Asset/Snippet.pm +++ b/lib/WebGUI/Asset/Snippet.pm @@ -62,6 +62,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get('snippet',"Asset_Snippet"), + uiLevel => 5, icon=>'snippet.gif', tableName=>'snippet', className=>'WebGUI::Asset::Snippet', @@ -141,18 +142,6 @@ sub getToolbar { } -#------------------------------------------------------------------- - -=head2 getUiLevel () - -Returns the UI level of this asset. - -=cut - -sub getUiLevel { - return 5; -} - #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/DataForm.pm b/lib/WebGUI/Asset/Wobject/DataForm.pm index 2ee36f84b..271227d50 100644 --- a/lib/WebGUI/Asset/Wobject/DataForm.pm +++ b/lib/WebGUI/Asset/Wobject/DataForm.pm @@ -136,6 +136,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(1,"Asset_DataForm"), + uiLevel => 5, tableName=>'DataForm', icon=>'dataForm.gif', className=>'WebGUI::Asset::Wobject::DataForm', @@ -538,10 +539,6 @@ sub getRecordTemplateVars { } -#------------------------------------------------------------------- -sub getUiLevel { - return 5; -} #------------------------------------------------------------------- sub processPropertiesFromFormPost { diff --git a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm index c58b99302..23ef11f22 100644 --- a/lib/WebGUI/Asset/Wobject/EventsCalendar.pm +++ b/lib/WebGUI/Asset/Wobject/EventsCalendar.pm @@ -45,6 +45,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(2,"Asset_EventsCalendar"), + uiLevel => 9, icon=>'calendar.gif', tableName=>'EventsCalendar', className=>'WebGUI::Asset::Wobject::EventsCalendar', @@ -184,11 +185,6 @@ sub getEditForm { } -#------------------------------------------------------------------- -sub getUiLevel { - return 9; -} - #------------------------------------------------------------------- sub view { diff --git a/lib/WebGUI/Asset/Wobject/Folder.pm b/lib/WebGUI/Asset/Wobject/Folder.pm index cef42fe1b..b6259deef 100644 --- a/lib/WebGUI/Asset/Wobject/Folder.pm +++ b/lib/WebGUI/Asset/Wobject/Folder.pm @@ -60,6 +60,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get("folder","Asset_Folder"), + uiLevel => 5, icon=>'folder.gif', tableName=>'Folder', className=>'WebGUI::Asset::Wobject::Folder', @@ -105,19 +106,6 @@ sub getEditForm { } -#------------------------------------------------------------------- - -=head2 getUiLevel () - -Returns the UI level of this asset. - -=cut - -sub getUiLevel { - return 5; -} - - #------------------------------------------------------------------- sub view { my $self = shift; diff --git a/lib/WebGUI/Asset/Wobject/HttpProxy.pm b/lib/WebGUI/Asset/Wobject/HttpProxy.pm index 9e4a170af..6d9f12820 100644 --- a/lib/WebGUI/Asset/Wobject/HttpProxy.pm +++ b/lib/WebGUI/Asset/Wobject/HttpProxy.pm @@ -34,6 +34,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(3,"Asset_HttpProxy"), + uiLevel => 5, icon=>'httpProxy.gif', tableName=>'HttpProxy', className=>'WebGUI::Asset::Wobject::HttpProxy', @@ -171,12 +172,6 @@ sub getEditForm { } -#------------------------------------------------------------------- -sub getUiLevel { - return 5; -} - - #------------------------------------------------------------------- sub purge { my $self = shift; diff --git a/lib/WebGUI/Asset/Wobject/Layout.pm b/lib/WebGUI/Asset/Wobject/Layout.pm index 0ac6421ed..4a18a411a 100644 --- a/lib/WebGUI/Asset/Wobject/Layout.pm +++ b/lib/WebGUI/Asset/Wobject/Layout.pm @@ -132,17 +132,6 @@ sub getEditForm { -#------------------------------------------------------------------- - -=head2 getUiLevel () - -Returns the UI level of this asset. - -=cut - -sub getUiLevel { - return 5; -} #------------------------------------------------------------------- diff --git a/lib/WebGUI/Asset/Wobject/SQLReport.pm b/lib/WebGUI/Asset/Wobject/SQLReport.pm index 71ebca8fb..7310cb915 100644 --- a/lib/WebGUI/Asset/Wobject/SQLReport.pm +++ b/lib/WebGUI/Asset/Wobject/SQLReport.pm @@ -33,6 +33,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(1,"Asset_SQLReport"), + uiLevel => 9, icon=>'sqlReport.gif', tableName=>'SQLReport', className=>'WebGUI::Asset::Wobject::SQLReport', @@ -234,12 +235,6 @@ sub getEditForm { } -#------------------------------------------------------------------- -sub getUiLevel { - return 9; -} - - #------------------------------------------------------------------- sub view { my $self = shift; diff --git a/lib/WebGUI/Asset/Wobject/Survey.pm b/lib/WebGUI/Asset/Wobject/Survey.pm index 933f93075..41bcf706f 100644 --- a/lib/WebGUI/Asset/Wobject/Survey.pm +++ b/lib/WebGUI/Asset/Wobject/Survey.pm @@ -65,6 +65,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(1,'Asset_Survey'), + uiLevel => 5, icon=>'survey.gif', tableName => 'Survey', className => 'WebGUI::Asset::Wobject::Survey', @@ -618,11 +619,6 @@ sub setAnswerType { },1,0,"Survey_id"); } -#------------------------------------------------------------------- -sub getUiLevel { - return 5; -} - #------------------------------------------------------------------- sub view { my $self = shift; diff --git a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm index efed0d02e..7f8bec7f6 100644 --- a/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm +++ b/lib/WebGUI/Asset/Wobject/SyndicatedContent.pm @@ -74,6 +74,7 @@ sub definition { my $definition = shift; push(@{$definition}, { assetName=>WebGUI::International::get(2,'Asset_SyndicatedContent'), + uiLevel=>6, autoGenerateForms=>1, icon=>'syndicatedContent.gif', tableName=>'SyndicatedContent', @@ -131,18 +132,6 @@ sub definition { -#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -=head2 getUiLevel () - -Returns the displayable name of this asset. - -=cut - -sub getUiLevel { - return 6; -} - - #------------------------------------------------------------------- # strip all html tags from the given data structure. This is important to # prevent cross site scripting attacks diff --git a/lib/WebGUI/Asset/Wobject/WSClient.pm b/lib/WebGUI/Asset/Wobject/WSClient.pm index d2007138c..ea1813399 100644 --- a/lib/WebGUI/Asset/Wobject/WSClient.pm +++ b/lib/WebGUI/Asset/Wobject/WSClient.pm @@ -68,6 +68,7 @@ my $httpHeaderFieldType; } push(@{$definition}, { assetName=>WebGUI::International::get(1, "Asset_WSClient"), + uiLevel=>9, icon=>'web_services.gif', tableName=>'WSClient', className=>'WebGUI::Asset::Wobject::WSClient', @@ -133,11 +134,6 @@ my $httpHeaderFieldType; } -#------------------------------------------------------------------- -sub getUiLevel { - return 9; -} - #------------------------------------------------------------------- sub getEditForm {