Move simple overrides of getEditForm from Dashboard, Folder, and HttpProxy

into relevant definition clauses.
This commit is contained in:
Drake 2006-11-07 22:58:09 +00:00
parent 5a4a1f8fea
commit 46739e813b
4 changed files with 168 additions and 208 deletions

View file

@ -41,6 +41,7 @@
- fix: Rich Edit omitting rows drops subsequent rows
- fix: Phishing Bug... take that spammers!
- fix: Default PM Dashboard Template extra form element not implemented yet
- refactor: move Dashboard, Folder, and HttpProxy getEditForm overrides into definition clauses
7.1.4
- Template variables in the main Survey Template were out of date in the

View file

@ -39,41 +39,59 @@ sub canPersonalize {
sub definition {
my $class = shift;
my $session = shift;
my $definition = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Dashboard");
my %properties;
tie %properties, 'Tie::IxHash';
%properties = (
templateId =>{
fieldType=>"template",
defaultValue=>'DashboardViewTmpl00001',
namespace=>"Dashboard"
templateId => {
fieldType => "template",
defaultValue => 'DashboardViewTmpl00001',
namespace => "Dashboard",
tab => 'display',
label => $i18n->get('dashboard template field label'),
hoverHelp => $i18n->get('dashboard template description'),
},
adminsGroupId =>{
fieldType=>"group",
defaultValue=>'4'
adminsGroupId => {
fieldType => "group",
defaultValue => '4',
tab => 'security',
label => $i18n->get('dashboard adminsGroupId field label'),
hoverHelp=>$i18n->get('dashboard adminsGroupId description'),
},
usersGroupId =>{
fieldType=>"group",
defaultValue=>'2'
usersGroupId => {
fieldType => "group",
defaultValue => '2',
label => $i18n->get('dashboard usersGroupId field label'),
hoverHelp => $i18n->get('dashboard usersGroupId description'),
},
isInitialized =>{
fieldType=>"yesNo",
defaultValue=>0,
noFormPost=>1,
isInitialized => {
fieldType => "yesNo",
defaultValue => 0,
noFormPost => 1,
autoGenerate => 0,
},
assetsToHide => {
defaultValue=>undef,
fieldType=>"checkList"
defaultValue => undef,
fieldType => "checkList",
autoGenerate => 0,
},
);
my $i18n = WebGUI::International->new($session,"Asset_Dashboard");
push(@{$definition}, {
assetName=>$i18n->get('assetName'),
icon=>'dashboard.gif',
tableName=>'Dashboard',
className=>'WebGUI::Asset::Wobject::Dashboard',
properties=>\%properties
assetName => $i18n->get('assetName'),
icon => 'dashboard.gif',
tableName => 'Dashboard',
className => 'WebGUI::Asset::Wobject::Dashboard',
properties => \%properties,
autoGenerateForms => 1,
});
return $class->SUPER::definition($session, $definition);
}
@ -96,25 +114,6 @@ sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm;
my $i18n = WebGUI::International->new($self->session, "Asset_Dashboard");
$tabform->getTab("display")->template(
-name=>"templateId",
-value=>$self->getValue('templateId'),
-namespace=>"Dashboard",
-label=>$i18n->get('dashboard template field label'),
-hoverHelp=>$i18n->get('dashboard template description'),
);
$tabform->getTab("security")->group(
-name=>"adminsGroupId",
-label=>$i18n->get('dashboard adminsGroupId field label'),
-hoverHelp=>$i18n->get('dashboard adminsGroupId description'),
-value=>[$self->getValue("adminsGroupId")]
);
$tabform->getTab("security")->group(
-name=>"usersGroupId",
-label=>$i18n->get('dashboard usersGroupId field label'),
-hoverHelp=>$i18n->get('dashboard usersGroupId description'),
-value=>[$self->getValue("usersGroupId")]
);
if ($self->session->form->process("func") ne "add") {
my @assetsToHide = split("\n",$self->getValue("assetsToHide"));
my $children = $self->getLineage(["children"],{"returnObjects"=>1, excludeClasses=>["WebGUI::Asset::Wobject::Layout"]});

View file

@ -60,12 +60,13 @@ sub definition {
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_Folder");
push(@{$definition}, {
assetName=>$i18n->get("assetName"),
assetName => $i18n->get("assetName"),
uiLevel => 5,
icon=>'folder.gif',
tableName=>'Folder',
className=>'WebGUI::Asset::Wobject::Folder',
properties=>{
icon => 'folder.gif',
tableName => 'Folder',
className => 'WebGUI::Asset::Wobject::Folder',
autoGenerateForms => 1,
properties => {
visitorCacheTimeout => {
tab => "display",
fieldType => "interval",
@ -74,13 +75,22 @@ sub definition {
label => $i18n->get("visitor cache timeout"),
hoverHelp => $i18n->get("visitor cache timeout help")
},
sortAlphabetically => {
fieldType=>"yesNo",
defaultValue=>0
fieldType => "yesNo",
defaultValue => 0,
tab => 'display',
label => $i18n->get('sort alphabetically'),
hoverHelp => $i18n->get('sort alphabetically help'),
},
templateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000078'
templateId => {
fieldType => "template",
defaultValue => 'PBtmpl0000000000000078',
namespace => 'Folder',
tab => 'display',
label => $i18n->get('folder template title'),
hoverHelp => $i18n->get('folder template description'),
}
}
});
@ -101,26 +111,6 @@ sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
my $i18n = WebGUI::International->new($self->session,"Asset_Folder");
$tabform->getTab("display")->interval(
-name=>"visitorCacheTimeout",
-label=>$i18n->get('visitor cache timeout'),
-hoverHelp=>$i18n->get('visitor cache timeout help'),
-value=>$self->getValue('visitorCacheTimeout'),
-uiLevel=>8,
-defaultValue=>3600
);
$tabform->getTab("display")->yesNo(
-value=>$self->getValue('sortAlphabetically'),
-label=>$i18n->get('sort alphabetically'),
-hoverHelp=>$i18n->get('sort alphabetically help'),
-name=>"sortAlphabetically"
);
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>$i18n->get('folder template title'),
-hoverHelp=>$i18n->get('folder template description'),
-namespace=>"Folder"
);
if ($self->get("assetId") eq "new") {
$tabform->getTab("properties")->whatNext(
-options=>{

View file

@ -46,65 +46,121 @@ sub definition {
my $session = shift;
my $definition = shift;
my $i18n = WebGUI::International->new($session,"Asset_HttpProxy");
my %timeoutOptions;
tie %timeoutOptions, 'Tie::IxHash';
%timeoutOptions = map{$_ => $_} (5, 10, 20, 30, 60);
push(@{$definition}, {
assetName=>$i18n->get('assetName'),
assetName => $i18n->get('assetName'),
uiLevel => 5,
icon=>'httpProxy.gif',
tableName=>'HttpProxy',
className=>'WebGUI::Asset::Wobject::HttpProxy',
properties=>{
templateId =>{
fieldType=>"template",
defaultValue=>'PBtmpl0000000000000033'
icon => 'httpProxy.gif',
tableName => 'HttpProxy',
className => 'WebGUI::Asset::Wobject::HttpProxy',
autoGenerateForms => 1,
properties => {
templateId => {
fieldType => "template",
defaultValue => 'PBtmpl0000000000000033',
namespace => 'HttpProxy',
tab => 'display',
label => $i18n->get('http proxy template title'),
hoverHelp => $i18n->get('http proxy template title description'),
},
proxiedUrl=>{
fieldType=>"url",
defaultValue=>'http://'
},
useAmpersand=>{
fieldType=>"yesNo",
defaultValue=>0
proxiedUrl => {
fieldType => "url",
defaultValue => 'http://',
tab => 'properties',
label => $i18n->get(1),
hoverHelp => $i18n->get('1 description'),
},
timeout=>{
fieldType=>"selectBox",
defaultValue=>30
},
removeStyle=>{
fieldType=>"yesNo",
defaultValue=>1
},
cacheTimeout=>{
fieldType=>"interval",
defaultValue=>0
useAmpersand => {
fieldType => "yesNo",
defaultValue => 0,
tab => 'properties',
label => $i18n->get("use ampersand"),
hoverHelp => $i18n->get("use ampersand help")
},
filterHtml=>{
fieldType=>"filterContent",
defaultValue=>"javascript"
},
followExternal=>{
fieldType=>"yesNo",
defaultValue=>1
},
rewriteUrls=>{
fieldType=>"yesNo",
defaultValue=>1
timeout => {
fieldType => "selectBox",
defaultValue => 30,
tab => 'properties',
options => \%timeoutOptions,
label => $i18n->get(4),
hoverHelp => $i18n->get('4 description'),
},
removeStyle => {
fieldType => "yesNo",
defaultValue => 1,
tab => 'display',
label => $i18n->get(6),
hoverHelp => $i18n->get('6 description'),
},
cacheTimeout => {
fieldType => "interval",
defaultValue => 0,
tab => 'display',
label => $i18n->get('cache timeout'),
hoverHelp => $i18n->get('cache timeout description'),
uiLevel => 8,
},
filterHtml => {
fieldType => "filterContent",
defaultValue => "javascript",
tab => 'display',
label => $i18n->get(418, 'WebGUI'),
hoverHelp => $i18n->get('418 description', 'WebGUI'),
},
followExternal => {
fieldType => "yesNo",
defaultValue => 1,
tab => 'security',
label => $i18n->get(5),
hoverHelp => $i18n->get('5 description'),
},
rewriteUrls => {
fieldType => "yesNo",
defaultValue => 1,
tab => 'properties',
label => $i18n->get(12),
hoverHelp => $i18n->get('12 description'),
},
followRedirect=>{
fieldType=>"yesNo",
defaultValue=>0
followRedirect => {
fieldType => "yesNo",
defaultValue => 0,
tab => 'security',
label => $i18n->get(8),
hoverHelp => $i18n->get('8 description'),
},
searchFor=>{
fieldType=>"text",
defaultValue=>undef
searchFor => {
fieldType => "text",
defaultValue => undef,
tab => 'display',
label => $i18n->get(13),
hoverHelp => $i18n->get('13 description'),
},
stopAt=>{
fieldType=>"text",
defaultValue=>undef
stopAt => {
fieldType => "text",
defaultValue => undef,
tab => 'display',
label => $i18n->get(14),
hoverHelp => $i18n->get('14 description'),
},
cookieJarStorageId=>{
noFormPost=>1,
fieldType=>"hidden",
defaultValue=>undef
cookieJarStorageId => {
noFormPost => 1,
fieldType => "hidden",
defaultValue => undef
}
}
});
@ -124,92 +180,6 @@ sub getCookieJar {
return $storage;
}
#-------------------------------------------------------------------
sub getEditForm {
my $self = shift;
my $i18n = WebGUI::International->new($self->session,"Asset_HttpProxy");
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("display")->template(
-value=>$self->getValue('templateId'),
-label=>$i18n->get('http proxy template title'),
-hoverHelp=>$i18n->get('http proxy template title description'),
-namespace=>"HttpProxy"
);
my %hash;
tie %hash, 'Tie::IxHash';
%hash=(5=>5,10=>10,20=>20,30=>30,60=>60);
$tabform->getTab("properties")->url(
-name=>"proxiedUrl",
-label=>$i18n->get(1),
-hoverHelp=>$i18n->get('1 description'),
-value=>$self->getValue("proxiedUrl")
);
$tabform->getTab("security")->yesNo(
-name=>"followExternal",
-label=>$i18n->get(5),
-hoverHelp=>$i18n->get('5 description'),
-value=>$self->getValue("followExternal")
);
$tabform->getTab("security")->yesNo(
-name=>"followRedirect",
-label=>$i18n->get(8),
-hoverHelp=>$i18n->get('8 description'),
-value=>$self->getValue("followRedirect")
);
$tabform->getTab("properties")->yesNo(
-name=>"rewriteUrls",
-label=>$i18n->get(12),
-hoverHelp=>$i18n->get('12 description'),
-value=>$self->getValue("rewriteUrls")
);
$tabform->getTab("display")->interval(
-name=>"cacheTimeout",
-label=>$i18n->get('cache timeout'),
-hoverHelp=>$i18n->get('cache timeout description'),
-uiLevel => 8,
-value=>$self->getValue("cacheTimeout")
);
$tabform->getTab("display")->yesNo(
-name=>"removeStyle",
-label=>$i18n->get(6),
-hoverHelp=>$i18n->get('6 description'),
-value=>$self->getValue("removeStyle")
);
$tabform->getTab("display")->filterContent(
-name=>"filterHtml",
-label=>$i18n->get(418, 'WebGUI'),
-hoverHelp=>$i18n->get('418 description', 'WebGUI'),
-value=>$self->getValue("filterHtml"),
);
$tabform->getTab("properties")->selectBox(
-name=>"timeout",
-options=>\%hash,
-label=>$i18n->get(4),
-hoverHelp=>$i18n->get('4 description'),
-value=>[$self->getValue("timeout")]
);
$tabform->getTab("display")->text(
-name=>"searchFor",
-label=>$i18n->get(13),
-hoverHelp=>$i18n->get('13 description'),
-value=>$self->getValue("searchFor")
);
$tabform->getTab("display")->text(
-name=>"stopAt",
-label=>$i18n->get(14),
-hoverHelp=>$i18n->get('14 description'),
-value=>$self->getValue("stopAt")
);
$tabform->getTab("properties")->yesNo(
name=>"useAmpersand",
value=>$self->getValue("useAmpersand"),
label=>$i18n->get("use ampersand"),
hoverHelp=>$i18n->get("use ampersand help")
);
return $tabform;
}
#-------------------------------------------------------------------
=head2 prepareView ( )