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
- 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

View file

@ -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

View file

@ -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;
}
#-------------------------------------------------------------------

View file

@ -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;

View file

@ -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 {

View file

@ -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;
}
#-------------------------------------------------------------------

View file

@ -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 {

View file

@ -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 {

View file

@ -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;

View file

@ -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;

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;
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;

View file

@ -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;

View file

@ -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

View file

@ -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 {