allowing UI levels for assets to be overridden in the config file, and allowing developers to specify a default UI level in the definition rather than creating a getUiLevel() method

This commit is contained in:
JT Smith 2005-07-28 21:56:02 +00:00
parent c9cefeca93
commit c7864a0c24
15 changed files with 31 additions and 116 deletions

View file

@ -1,6 +1,8 @@
6.7.0 6.7.0
- Added the ability to override the UI Level of any field in the edit form of - Added the ability to override the UI Level of any field in the edit form of
any asset in the WebGUI config file. 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... - fix [ 1229042 ] crumbtrail should show full path...
- Added asset versioning. - Added asset versioning.
- fix [ 1229188 ] typo in Help: Collaboration, Post List Template Variables - 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 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. 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. 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 - Added an optional specification of the asset icon, ui level, and name in the
definition to have getName() and getIcon() autogenerated for WebGUI::Asset definition to have getName(), getUiLevel(), and getIcon() autogenerated for
subclasses. WebGUI::Asset subclasses.
- fix [ 1239601 ] Thread::getName is not Internationalized (and many other Assets, too) - fix [ 1239601 ] Thread::getName is not Internationalized (and many other Assets, too)
- fix [ 1240316 ] Doc erro in Folder template thumbnail => thumbnail.url - fix [ 1240316 ] Doc erro in Folder template thumbnail => thumbnail.url
- The Navigation template variable "unfolded_page_loop" was removed a long - The Navigation template variable "unfolded_page_loop" was removed a long

View file

@ -137,6 +137,13 @@ utilityAssets = WebGUI::Asset::Template, \
#assetAddPrivilege = WebGUI::Asset::Wobject::SQLReport => 3, \ #assetAddPrivilege = WebGUI::Asset::Wobject::SQLReport => 3, \
# WebGUI:::Asset::Template => 4 # 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 # You can override the UI Levels of any field in the edit form of
# any asset using the following variables. Basically just take the # any asset using the following variables. Basically just take the
# class name of the asset seperated by underscores, and append # class name of the asset seperated by underscores, and append

View file

@ -1743,14 +1743,16 @@ sub getToolbarState {
=head2 getUiLevel ( ) =head2 getUiLevel ( )
Always returns zero. 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
=cut
sub getUiLevel { sub getUiLevel {
my $self = shift; my $self = shift;
return 0; my $definition = $self->definition;
} return $session{config}{assetUiLevel}{$definition->[0]{className}} || $definition->[0]{uiLevel} || 1;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -61,6 +61,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get('redirect',"Asset_Redirect"), assetName=>WebGUI::International::get('redirect',"Asset_Redirect"),
uiLevel => 9,
icon=>'redirect.gif', icon=>'redirect.gif',
tableName=>'redirect', tableName=>'redirect',
className=>'WebGUI::Asset::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 { sub www_edit {
my $self = shift; my $self = shift;

View file

@ -64,6 +64,7 @@ sub definition {
push(@{$definition}, { push(@{$definition}, {
assetName=>'Rich Editor', assetName=>'Rich Editor',
icon=>'richEdit.gif', icon=>'richEdit.gif',
uiLevel => 5,
tableName=>'RichEdit', tableName=>'RichEdit',
className=>'WebGUI::Asset::RichEdit', className=>'WebGUI::Asset::RichEdit',
properties=>{ properties=>{
@ -381,18 +382,6 @@ sub getToolbar {
} }
#-------------------------------------------------------------------
=head2 getUiLevel ()
Returns the UI level of this asset.
=cut
sub getUiLevel {
return 5;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getRichEditor { sub getRichEditor {

View file

@ -62,6 +62,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get('snippet',"Asset_Snippet"), assetName=>WebGUI::International::get('snippet',"Asset_Snippet"),
uiLevel => 5,
icon=>'snippet.gif', icon=>'snippet.gif',
tableName=>'snippet', tableName=>'snippet',
className=>'WebGUI::Asset::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;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -136,6 +136,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_DataForm"), assetName=>WebGUI::International::get(1,"Asset_DataForm"),
uiLevel => 5,
tableName=>'DataForm', tableName=>'DataForm',
icon=>'dataForm.gif', icon=>'dataForm.gif',
className=>'WebGUI::Asset::Wobject::DataForm', className=>'WebGUI::Asset::Wobject::DataForm',
@ -538,10 +539,6 @@ sub getRecordTemplateVars {
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 5;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub processPropertiesFromFormPost { sub processPropertiesFromFormPost {

View file

@ -45,6 +45,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(2,"Asset_EventsCalendar"), assetName=>WebGUI::International::get(2,"Asset_EventsCalendar"),
uiLevel => 9,
icon=>'calendar.gif', icon=>'calendar.gif',
tableName=>'EventsCalendar', tableName=>'EventsCalendar',
className=>'WebGUI::Asset::Wobject::EventsCalendar', className=>'WebGUI::Asset::Wobject::EventsCalendar',
@ -184,11 +185,6 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 9;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub view { sub view {

View file

@ -60,6 +60,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get("folder","Asset_Folder"), assetName=>WebGUI::International::get("folder","Asset_Folder"),
uiLevel => 5,
icon=>'folder.gif', icon=>'folder.gif',
tableName=>'Folder', tableName=>'Folder',
className=>'WebGUI::Asset::Wobject::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 { sub view {
my $self = shift; my $self = shift;

View file

@ -34,6 +34,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(3,"Asset_HttpProxy"), assetName=>WebGUI::International::get(3,"Asset_HttpProxy"),
uiLevel => 5,
icon=>'httpProxy.gif', icon=>'httpProxy.gif',
tableName=>'HttpProxy', tableName=>'HttpProxy',
className=>'WebGUI::Asset::Wobject::HttpProxy', className=>'WebGUI::Asset::Wobject::HttpProxy',
@ -171,12 +172,6 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 5;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub purge { sub purge {
my $self = shift; my $self = shift;

View file

@ -132,17 +132,6 @@ sub getEditForm {
#-------------------------------------------------------------------
=head2 getUiLevel ()
Returns the UI level of this asset.
=cut
sub getUiLevel {
return 5;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------

View file

@ -33,6 +33,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(1,"Asset_SQLReport"), assetName=>WebGUI::International::get(1,"Asset_SQLReport"),
uiLevel => 9,
icon=>'sqlReport.gif', icon=>'sqlReport.gif',
tableName=>'SQLReport', tableName=>'SQLReport',
className=>'WebGUI::Asset::Wobject::SQLReport', className=>'WebGUI::Asset::Wobject::SQLReport',
@ -234,12 +235,6 @@ sub getEditForm {
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 9;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub view { sub view {
my $self = shift; my $self = shift;

View file

@ -65,6 +65,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(1,'Asset_Survey'), assetName=>WebGUI::International::get(1,'Asset_Survey'),
uiLevel => 5,
icon=>'survey.gif', icon=>'survey.gif',
tableName => 'Survey', tableName => 'Survey',
className => 'WebGUI::Asset::Wobject::Survey', className => 'WebGUI::Asset::Wobject::Survey',
@ -618,11 +619,6 @@ sub setAnswerType {
},1,0,"Survey_id"); },1,0,"Survey_id");
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 5;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub view { sub view {
my $self = shift; my $self = shift;

View file

@ -74,6 +74,7 @@ sub definition {
my $definition = shift; my $definition = shift;
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(2,'Asset_SyndicatedContent'), assetName=>WebGUI::International::get(2,'Asset_SyndicatedContent'),
uiLevel=>6,
autoGenerateForms=>1, autoGenerateForms=>1,
icon=>'syndicatedContent.gif', icon=>'syndicatedContent.gif',
tableName=>'SyndicatedContent', 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 # strip all html tags from the given data structure. This is important to
# prevent cross site scripting attacks # prevent cross site scripting attacks

View file

@ -68,6 +68,7 @@ my $httpHeaderFieldType;
} }
push(@{$definition}, { push(@{$definition}, {
assetName=>WebGUI::International::get(1, "Asset_WSClient"), assetName=>WebGUI::International::get(1, "Asset_WSClient"),
uiLevel=>9,
icon=>'web_services.gif', icon=>'web_services.gif',
tableName=>'WSClient', tableName=>'WSClient',
className=>'WebGUI::Asset::Wobject::WSClient', className=>'WebGUI::Asset::Wobject::WSClient',
@ -133,11 +134,6 @@ my $httpHeaderFieldType;
} }
#-------------------------------------------------------------------
sub getUiLevel {
return 9;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub getEditForm { sub getEditForm {