Form inheritance work for lists, removal of $session{os}{slash}

This commit is contained in:
Colin Kuskie 2005-12-01 20:46:55 +00:00
parent abe85d439e
commit 99df1f414e
90 changed files with 1364 additions and 1168 deletions

View file

@ -193,7 +193,7 @@ sub definition {
defaultValue=>'7'
},
ownerUserId=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>'3'
},
startDate=>{
@ -580,7 +580,7 @@ sub getEditForm {
$clause = "userId=".quote($self->get("ownerUserId"));
}
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username");
$tabform->getTab("security")->selectList(
$tabform->getTab("security")->selectBox(
-name=>"ownerUserId",
-options=>$users,
-label=>WebGUI::International::get(108,"Asset"),

View file

@ -115,7 +115,7 @@ sub getEditForm {
name=>"interval",
defaultValue=>1
})
.WebGUI::Form::selectList({
.WebGUI::Form::selectBox({
name=>"recursEvery",
options=>\%recursEvery
})

View file

@ -65,7 +65,7 @@ sub unzip {
}
$zip->extractTree();
} elsif($filename =~ m/\.tar/i){
Archive::Tar->extract_archive($filepath.$session{os}{slash}.$filename,1);
Archive::Tar->extract_archive($filepath.'/'.$filename,1);
if (Archive::Tar->error){
WebGUI::ErrorHandler::warn(Archive::Tar->error);
return 0;

View file

@ -115,7 +115,7 @@ sub edit {
$clause = "userId=".quote($self->get("ownerUserId"));
}
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username");
$tabform->getTab("security")->selectList(
$tabform->getTab("security")->selectBox(
-name=>"ownerUserId",
-options=>$users,
-label=>WebGUI::International::get(108,"Asset_FilePile"),

View file

@ -108,11 +108,11 @@ sub definition {
defaultValue=>0
},
directionality=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>'ltr'
},
toolbarLocation=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>'bottom'
},
cssFile=>{
@ -120,15 +120,15 @@ sub definition {
defaultValue=>undef
},
toolbarRow1=>{
fieldType=>'checkList',
fieldType=>'checkBox',
defaultValue=>undef
},
toolbarRow2=>{
fieldType=>'checkList',
fieldType=>'checkBox',
defaultValue=>undef
},
toolbarRow3=>{
fieldType=>'checkList',
fieldType=>'checkBox',
defaultValue=>undef
},
enableContextMenu => {
@ -332,7 +332,7 @@ sub getEditForm {
-name=>"nowrap",
-uiLevel=>9
);
$tabform->getTab("properties")->selectList(
$tabform->getTab("properties")->selectBox(
-value=>[$self->getValue("directionality")],
-label=>WebGUI::International::get('directionality', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('directionality description', 'Asset_RichEdit'),
@ -342,7 +342,7 @@ sub getEditForm {
rtl=>WebGUI::International::get('right to left', 'Asset_RichEdit'),
}
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-value=>[$self->getValue("toolbarLocation")],
-label=>WebGUI::International::get('toolbar location', 'Asset_RichEdit'),
-hoverHelp=>WebGUI::International::get('toolbar location description', 'Asset_RichEdit'),

View file

@ -56,7 +56,7 @@ sub _drawQueryBuilder {
value=>$self->getValue("shortcutCriteria"),
extras=>'style="width: 100%" '.$self->{_disabled}
});
my $conjunctionField = WebGUI::Form::selectList({
my $conjunctionField = WebGUI::Form::selectBox({
name=>"conjunction",
options=>{
"AND" => WebGUI::International::get("AND","Asset_Shortcut"),
@ -208,7 +208,7 @@ sub definition {
defaultValue=>0
},
resolveMultiples=>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>"mostRecent",
},
shortcutCriteria=>{
@ -313,7 +313,7 @@ sub getEditForm {
if ($self->getValue("shortcutByCriteria") == 0) {
$self->{_disabled} = 'disabled=true';
}
$tabform->getTab("properties")->selectList(
$tabform->getTab("properties")->selectBox(
-name=>"resolveMultiples",
-value=>[ $self->getValue("resolveMultiples") ],
-label=>WebGUI::International::get("Resolve Multiples","Asset_Shortcut"),

View file

@ -229,7 +229,7 @@ sub process {
return $self->processRaw($self->get("template"),$vars);
# skip all the junk below here for now until we have time to bring it inline with the new system
my $file = _getTemplateFile($self->get("templateId"));
my $fileCacheDir = $session{config}{uploadsPath}.$session{os}{slash}."temp".$session{os}{slash}."templatecache";
my $fileCacheDir = $session{config}{uploadsPath}.'/temp/templatecache';
my %params = (
filename=>$file->getPath,
global_vars=>1,

View file

@ -352,7 +352,7 @@ sub definition {
defaultValue=>'javascript'
},
richEditor =>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>"PBrichedit000000000002"
},
attachmentsPerPost =>{
@ -372,11 +372,11 @@ sub definition {
defaultValue=>1
},
sortOrder =>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>'desc'
},
sortBy =>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>'dateUpdated'
},
rssTemplateId =>{
@ -574,14 +574,14 @@ sub getEditForm {
userDefined4=>WebGUI::International::get('user defined 4', 'Asset_Collaboration'),
userDefined5=>WebGUI::International::get('user defined 5', 'Asset_Collaboration'),
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"sortBy",
-value=>[$self->getValue("sortBy")],
-options=>\%options,
-label=>WebGUI::International::get('sort by', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('sort by description', 'Asset_Collaboration'),
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"sortOrder",
-value=>[$self->getValue("sortOrder")],
-options=>{
@ -621,7 +621,7 @@ sub getEditForm {
-hoverHelp=>WebGUI::International::get('edit stamp description', 'Asset_Collaboration'),
-value=>$self->getValue("addEditStampToPosts")
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"richEditor",
-label=>WebGUI::International::get('rich editor', 'Asset_Collaboration'),
-hoverHelp=>WebGUI::International::get('rich editor description', 'Asset_Collaboration'),
@ -1015,7 +1015,7 @@ sub www_search {
tie %results, 'Tie::IxHash';
%results = (10=>'10', 25=>'25', 50=>'50', 100=>'100');
my $numResults = $session{scratch}{$self->getId."_numResults"} || $self->get("threadsPerPage");
$var{'results.form'} = WebGUI::Form::selectList({
$var{'results.form'} = WebGUI::Form::selectBox({
name=>"numResults",
options=>\%results,
value=>[$numResults]

View file

@ -799,7 +799,7 @@ sub www_editField {
-value=>$field{sequenceNumber}
);
}
$f->selectList(
$f->selectBox(
-name=>"tid",
-options=>$tab,
-label=>WebGUI::International::get(104,"Asset_DataForm"),
@ -812,7 +812,7 @@ sub www_editField {
-label=>WebGUI::International::get(79,"Asset_DataForm"),
-hoverHelp=>WebGUI::International::get('79 description',"Asset_DataForm"),
);
$f->selectList(
$f->selectBox(
-name=>"status",
-options=>\%fieldStatus,
-label=>WebGUI::International::get(22,"Asset_DataForm"),

View file

@ -58,19 +58,19 @@ sub definition {
defaultValue=>'PBtmpl0000000000000023'
},
scope =>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>'0'
},
startMonth=>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>"current"
},
endMonth=>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>"after12"
},
defaultMonth=>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>"current"
},
paginateAfter=>{
@ -89,7 +89,7 @@ sub definition {
sub getEditForm {
my $self = shift;
my $tabform = $self->SUPER::getEditForm();
$tabform->getTab("properties")->selectList(
$tabform->getTab("properties")->selectBox(
-name=>"scope",
-label=>WebGUI::International::get(507,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('507 description',"Asset_EventsCalendar"),
@ -114,7 +114,7 @@ sub getEditForm {
-value=>$self->getValue('eventTemplateId'),
-namespace=>"EventsCalendar/Event",
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"startMonth",
-options=>{
"january"=>WebGUI::International::get('january','Asset_EventsCalendar'),
@ -136,14 +136,14 @@ sub getEditForm {
"after3"=>WebGUI::International::get(89,"Asset_EventsCalendar"),
"current"=>WebGUI::International::get(82,"Asset_EventsCalendar")
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"endMonth",
-options=>\%options,
-label=>WebGUI::International::get(84,"Asset_EventsCalendar"),
-hoverHelp=>WebGUI::International::get('84 description',"Asset_EventsCalendar"),
-value=>[$self->getValue("endMonth")]
);
$tabform->getTab("display")->selectList(
$tabform->getTab("display")->selectBox(
-name=>"defaultMonth",
-options=>{
"current"=>WebGUI::International::get(82,"Asset_EventsCalendar"),

View file

@ -48,7 +48,7 @@ sub definition {
defaultValue=>'http://'
},
timeout=>{
fieldType=>"selectList",
fieldType=>"selectBox",
defaultValue=>30
},
removeStyle=>{
@ -149,7 +149,7 @@ sub getEditForm {
-name=>"filterHtml",
-value=>$self->getValue("filterHtml")
);
$tabform->getTab("properties")->selectList(
$tabform->getTab("properties")->selectBox(
-name=>"timeout",
-options=>\%hash,
-label=>WebGUI::International::get(4,"Asset_HttpProxy"),

View file

@ -184,7 +184,7 @@ sub view {
$nameHash{""} = WebGUI::International::get('myself',"Asset_InOutBoard");
%nameHash = WebGUI::Utility::sortHash(%nameHash);
$f->selectList(
$f->selectBox(
-name=>"delegate",
-options=>\%nameHash,
-value=>[ $session{scratch}{userId} ],
@ -412,7 +412,7 @@ sub www_viewReport {
my $departmentSQLclause = ($defaultDepartment eq WebGUI::International::get('all departments', 'Asset_InOutBoard'))
? ''
: 'and c.fieldData='.quote($defaultDepartment);
$f->selectList(
$f->selectBox(
-name=>"selectDepartment",
-options=>\%depHash,
-value=>[ $defaultDepartment ],
@ -422,7 +422,7 @@ sub www_viewReport {
tie %paginHash, "Tie::IxHash"; ##Because default sort order is alpha
%paginHash = (50 => 50, 100 => 100, 300 => 300, 500 => 500, 1000 => 1000, 10_000 => 10_000,);
my $pageReportAfter = $session{form}{reportPagination} || 50;
$f->selectList(
$f->selectBox(
-name=>"reportPagination",
-options=>\%paginHash,
-value=>[ $pageReportAfter ],

View file

@ -477,7 +477,7 @@ sub www_editListing {
-label=>"Description"
);
if ($self->canEdit) {
$f->selectList(
$f->selectBox(
-name=>"maintainerId",
-value=>[$listing->{maintainerId}],
-label=>"Listing Maintainer",
@ -507,7 +507,7 @@ sub www_editListing {
);
} elsif ($field->{fieldType} eq "goodBad") {
my $value = ($field->{value} || $field->{defaultValue} || "No");
$f->selectList(
$f->selectBox(
-name=>$field->{name},
-value=>[$value],
-label=>$field->{label},
@ -617,7 +617,7 @@ sub www_editListingSave {
while (my ($id, $name, $type) = $a->array) {
my $value;
if ($type eq "goodBad") {
$value = WebGUI::FormProcessor::selectList($name);
$value = WebGUI::FormProcessor::selectBox($name);
} else {
$value = WebGUI::FormProcessor::process($name,$type);
}
@ -652,7 +652,7 @@ sub www_editField {
-value=>$field->{label},
-label=>"Label"
);
$f->selectList(
$f->selectBox(
-name=>"fieldType",
-value=>[$field->{fieldType}],
-label=>"Type",
@ -678,7 +678,7 @@ sub www_editField {
foreach my $category ($self->getCategories) {
$cats{$category} = $category;
}
$f->selectList(
$f->selectBox(
-name=>"category",
-value=>[$field->{category}],
-label=>"Category",
@ -982,7 +982,7 @@ sub www_viewDetail {
-value=>$session{user}{email},
-label=>"Your Email Address"
);
$f->selectList(
$f->selectBox(
-name=>"subject",
-extras=>'class="content"',
-options=>{
@ -1051,7 +1051,7 @@ sub www_viewDetail {
my ($mean,$median,$count) = WebGUI::SQL->quickArray("select meanValue, medianValue, countValue from Matrix_ratingSummary
where listingId=".quote($listingId)." and category=".quote($category));
$ratingsTable .= '<tr><th>'.$category.'</th><td>'.$mean.'</td><td>'.$median.'</td><td>'.$count.'</td></tr>';
$f->selectList(
$f->selectBox(
-name=>$category,
-label=>$category,
-value=>[5],

View file

@ -46,7 +46,7 @@ sub definition {
defaultValue=>"descendants"
},
startType=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>"relativeToCurrentUrl"
},
startPoint=>{
@ -54,11 +54,11 @@ sub definition {
defaultValue=>0
},
ancestorEndPoint=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>55
},
descendantEndPoint=>{
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>55
},
showSystemPages=>{
@ -110,7 +110,7 @@ sub getEditForm {
$pedigreeChecked = 1;
}
}
$tabform->getTab("properties")->selectList(
$tabform->getTab("properties")->selectBox(
-name=>"startType",
-options=>{
specificUrl=>$i18n->get('Specific URL'),
@ -140,7 +140,7 @@ sub getEditForm {
);
$tabform->getTab("properties")->raw(
'</tbody><tbody id="navAncestorEnd"><tr><td class="formDescription">'.$i18n->get("Ancestor End Point").'</td><td>'
.WebGUI::Form::selectList({
.WebGUI::Form::selectBox({
name=>"ancestorEndPoint",
value=>[$self->getValue("ancestorEndPoint")],
options=>\%options
@ -190,7 +190,7 @@ sub getEditForm {
);
$tabform->getTab("properties")->raw(
'</tbody><tbody id="navDescendantEnd"><tr><td class="formDescription">'.$i18n->get('Descendant End Point').'</td><td>'
.WebGUI::Form::selectList({
.WebGUI::Form::selectBox({
name=>"descendantEndPoint",
value=>[$self->getValue("descendantEndPoint")],
options=>\%options

View file

@ -365,7 +365,7 @@ sub www_addAccessory {
@usedAccessories = WebGUI::SQL->buildArray("select accessoryAssetId from Product_accessory where assetId=".quote($self->getId));
push(@usedAccessories,$self->getId);
$accessory = WebGUI::SQL->buildHashRef("select asset.assetId, assetData.title from asset left join assetData on assetData.assetId=asset.assetId where asset.className='WebGUI::Asset::Wobject::Product' and asset.assetId not in (".quoteAndJoin(\@usedAccessories).") and (assetData.status='approved' or assetData.tagId=".quote($session{scratch}{versionTag}).") group by assetData.assetId");
$f->selectList(
$f->selectBox(
-name => "accessoryAccessId",
-options => $accessory,
-label => WebGUI::International::get(17,'Asset_Product'),
@ -404,7 +404,7 @@ sub www_addRelated {
@usedRelated = WebGUI::SQL->buildArray("select relatedAssetId from Product_related where assetId=".quote($self->getId));
push(@usedRelated,$self->getId);
$related = WebGUI::SQL->buildHashRef("select assetId,title from asset where className='WebGUI::Asset::Wobject::Product' and assetId not in (".quoteAndJoin(\@usedRelated).")");
$f->selectList(
$f->selectBox(
-name => "relatedAssetId",
-options => $related,
-label => WebGUI::International::get(20,'Asset_Product'),

View file

@ -246,7 +246,7 @@ sub getEditForm {
-afterEdit => 'func=edit'
);
$tabform->getTab('display')->selectList(
$tabform->getTab('display')->selectBox(
-name => "questionOrder",
-options => {
sequential => WebGUI::International::get(5,'Asset_Survey'),
@ -264,7 +264,7 @@ sub getEditForm {
-label => WebGUI::International::get(83,'Asset_Survey'),
-hoverHelp => WebGUI::International::get('83 description','Asset_Survey')
);
$tabform->getTab('properties')->selectList(
$tabform->getTab('properties')->selectBox(
-name => "mode",
-options => {
survey => WebGUI::International::get(9,'Asset_Survey'),
@ -854,7 +854,7 @@ sub www_editAnswer {
$question = WebGUI::SQL->buildHashRef("select Survey_questionId,question
from Survey_question where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
$question = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$question) };
$f->selectList(
$f->selectBox(
-name=>"gotoQuestion",
-options=>$question,
-value=>[$answer->{gotoQuestion}],
@ -956,7 +956,7 @@ sub www_editQuestion {
my $sectionList = WebGUI::SQL->buildHashRef("select Survey_sectionId,sectionName
from Survey_section where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
$f->selectList(
$f->selectBox(
-name => "section",
-options=> $sectionList,
-value => [$question->{Survey_sectionId}],
@ -967,7 +967,7 @@ sub www_editQuestion {
my $ql = WebGUI::SQL->buildHashRef("select Survey_questionId,question
from Survey_question where Survey_id=".quote($self->get("Survey_id"))." order by sequenceNumber");
$ql = { ('-1' => WebGUI::International::get(82,'Asset_Survey'),%$ql) };
$f->selectList(
$f->selectBox(
-name => "gotoQuestion",
-options=> $ql,
-value => [$question->{gotoQuestion}],

View file

@ -98,7 +98,7 @@ sub definition {
},
displayMode=>{
tab=>"display",
fieldType=>'selectList',
fieldType=>'selectBox',
defaultValue=>'interleaved',
options=>{
'interleaved'=>WebGUI::International::get('interleaved','Asset_SyndicatedContent'),

View file

@ -105,7 +105,7 @@ sub www_editBranch {
-label=>WebGUI::International::get(104,"Asset"),
-uiLevel=>9,
-subtext=>'<br />'.WebGUI::International::get("change","Asset").' '.WebGUI::Form::yesNo({name=>"change_url"}),
-value=>WebGUI::Form::selectList({
-value=>WebGUI::Form::selectBox({
name=>"baseUrlBy",
extras=>'onchange="toggleSpecificBaseUrl()"',
id=>"baseUrlBy",
@ -114,7 +114,7 @@ sub www_editBranch {
specifiedBase=>"Specified Base",
none=>"None"
}
}).'<span id="baseUrl"></span> / '.WebGUI::Form::selectList({
}).'<span id="baseUrl"></span> / '.WebGUI::Form::selectBox({
name=>"endOfUrl",
options=>{
menuTitle=>WebGUI::International::get(411,"Asset"),
@ -221,7 +221,7 @@ sub www_editBranch {
$clause = "userId=".quote($self->get("ownerUserId"));
}
my $users = WebGUI::SQL->buildHashRef("select userId,username from users where $clause order by username");
$tabform->getTab("security")->selectList(
$tabform->getTab("security")->selectBox(
-name=>"ownerUserId",
-options=>$users,
-label=>WebGUI::International::get(108,"Asset"),
@ -302,16 +302,16 @@ sub www_editBranchSave {
$data{encryptPage} = WebGUI::FormProcessor::yesNo("encryptPage") if (WebGUI::FormProcessor::yesNo("change_encryptPage"));
$data{startDate} = WebGUI::FormProcessor::dateTime("startDate") if (WebGUI::FormProcessor::yesNo("change_startDate"));
$data{endDate} = WebGUI::FormProcessor::dateTime("endDate") if (WebGUI::FormProcessor::yesNo("change_endDate"));
$data{ownerUserId} = WebGUI::FormProcessor::selectList("ownerUserId") if (WebGUI::FormProcessor::yesNo("change_ownerUserId"));
$data{ownerUserId} = WebGUI::FormProcessor::selectBox("ownerUserId") if (WebGUI::FormProcessor::yesNo("change_ownerUserId"));
$data{groupIdView} = WebGUI::FormProcessor::group("groupIdView") if (WebGUI::FormProcessor::yesNo("change_groupIdView"));
$data{groupIdEdit} = WebGUI::FormProcessor::group("groupIdEdit") if (WebGUI::FormProcessor::yesNo("change_groupIdEdit"));
$data{extraHeadTags} = WebGUI::FormProcessor::group("extraHeadTags") if (WebGUI::FormProcessor::yesNo("change_extraHeadTags"));
my ($urlBaseBy, $urlBase, $endOfUrl);
my $changeUrl = WebGUI::FormProcessor::yesNo("change_url");
if ($changeUrl) {
$urlBaseBy = WebGUI::FormProcessor::selectList("baseUrlBy");
$urlBaseBy = WebGUI::FormProcessor::selectBox("baseUrlBy");
$urlBase = WebGUI::FormProcessor::text("baseUrl");
$endOfUrl = WebGUI::FormProcessor::selectList("endOfUrl");
$endOfUrl = WebGUI::FormProcessor::selectBox("endOfUrl");
}
my $descendants = $self->getLineage(["self","descendants"],{returnObjects=>1});
foreach my $descendant (@{$descendants}) {

View file

@ -151,7 +151,7 @@ sub www_export {
-name=>"depth",
-value=>99,
);
$f->selectList(
$f->selectBox(
-label=>WebGUI::International::get('Export as user',"Asset"),
-hoverHelp=>WebGUI::International::get('Export as user description',"Asset"),
-name=>"userId",

View file

@ -113,7 +113,7 @@ sub addUserForm {
$jsArray
//-->
</script>|;
$f->selectList(
$f->selectBox(
-name=>"authLDAP_ldapConnection",
-label=>WebGUI::International::get("ldapConnection",'AuthLDAP'),
-hoverHelp=>WebGUI::International::get("ldapConnection description",'AuthLDAP'),
@ -217,7 +217,7 @@ sub createAccount {
$vars->{'create.form.ldapConnection.label'} = WebGUI::International::get("ldapConnection","AuthLDAP");
my $url = WebGUI::URL::page("op=auth;method=createAccount;connection=");
$vars->{'create.form.ldapConnection'} = WebGUI::Form::selectList({
$vars->{'create.form.ldapConnection'} = WebGUI::Form::selectBox({
name=>"ldapConnection",
options=>WebGUI::LDAPLink::getList(),
value=>[$connection->{ldapLinkId}],
@ -361,7 +361,7 @@ sub editUserFormSave {
sub editUserSettingsForm {
my $self = shift;
my $f = WebGUI::HTMLForm->new;
my $ldapConnection = WebGUI::Form::selectList({
my $ldapConnection = WebGUI::Form::selectBox({
name=>"ldapConnection",
options=>WebGUI::LDAPLink::getList(),
value=>[$session{setting}{ldapConnection}]

View file

@ -77,7 +77,7 @@ Flushes the caching system. Must be overridden.
=cut
sub flush {
rmtree($WebGUI::Session::session{config}{uploadsPath}.$WebGUI::Session::session{os}{slash}."temp");
rmtree($WebGUI::Session::session{config}{uploadsPath}."/temp");
}
#-------------------------------------------------------------------

View file

@ -386,7 +386,7 @@ sub checkoutForm {
'Zambia' => 'Zambia',
'Zimbabwe' => 'Zimbabwe'
);
$f->selectList(
$f->selectBox(
-name=>"country",
-label=>$i18n->get("country"),
-value=>[$session{form}{country}],
@ -416,9 +416,9 @@ sub checkoutForm {
$f->readOnly(
-label => $i18n->get('expiration date'),
-value =>
WebGUI::Form::selectList({name => 'expMonth', options => \%months, value => [$session{form}{expMonth}]}).
WebGUI::Form::selectBox({name => 'expMonth', options => \%months, value => [$session{form}{expMonth}]}).
" / ".
WebGUI::Form::selectList({name => 'expYear', options => \%years, value => [$session{form}{expYear}]})
WebGUI::Form::selectBox({name => 'expYear', options => \%years, value => [$session{form}{expYear}]})
);
$f->integer(
-name => 'cvv2',

View file

@ -18,7 +18,6 @@ use FileHandle;
#use Log::Log4perl;
use strict;
use WebGUI::Session;
use Log::Log4perl;
use Apache2::RequestUtil;
$Log::Log4perl::caller_depth++;
@ -202,7 +201,7 @@ Returns a reference to the logger.
=cut
sub getLogger {
Log::Log4perl::init_once($WebGUI::Session::session{config}{webguiRoot}.$WebGUI::Session::session{os}{slash}.'etc'.$WebGUI::Session::session{os}{slash}."log.conf");
Log::Log4perl::init_once($WebGUI::Session::session{config}{webguiRoot}."/etc/log.conf");
return Log::Log4perl->get_logger($WebGUI::Session::session{config}{configFile});
}

View file

@ -69,8 +69,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("asset","Asset")
},
label=>{
defaultValue=>$class->getName()
defaultValue=>WebGUI::International::get("asset","Asset")
},
name=>{
defaultValue=> "asset"
@ -82,20 +85,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("asset","Asset");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -57,6 +57,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("button","WebGUI")
},
defaultValue=>{
defaultValue=>WebGUI::International::get(62,"WebGUI")
},
@ -64,20 +67,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("button","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -15,9 +15,8 @@ package WebGUI::Form::CheckList;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::List';
use WebGUI::Form::Checkbox;
use WebGUI::Form::HiddenList;
use WebGUI::International;
use WebGUI::Session;
@ -31,7 +30,7 @@ Creates a series of check box form fields.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control. Also take a look ath WebGUI::Form::Checkbox as this class creates a list of checkboxes.
This is a subclass of WebGUI::Form::List. Also take a look at WebGUI::Form::Checkbox as this class creates a list of checkboxes.
=head1 METHODS
@ -49,14 +48,6 @@ See the super class for additional details.
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to an empty array reference.
=head4 vertical
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
@ -71,11 +62,8 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[],
formName=>{
defaultValue=>WebGUI::International::get("941","WebGUI"),
},
vertical=>{
defaultValue=>0
@ -87,47 +75,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 displayValue ( )
Return the all options
=cut
sub displayValue {
my ($self) = @_;
return join ", ", @{ $self->{value} };
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("941","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{req}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -139,14 +86,11 @@ Renders a series of checkboxes.
sub toHtml {
my $self = shift;
my $output;
my $alignment;
if ($self->{vertical}) {
$alignment = "<br />\n";
}
else {
$alignment = " &nbsp; &nbsp;\n";
}
foreach my $key (keys %{$self->{options}}) {
my $alignment = $self->alignmentSeparator;
my %options;
tie %options, 'Tie::IxHash';
%options = $self->orderedHash();
foreach my $key (keys %options) {
my $checked = 0;
foreach my $item (@{$self->{value}}) {
if ($item eq $key) {
@ -164,23 +108,5 @@ sub toHtml {
return $output;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::HiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>$self->{options}
)->toHtmlAsHidden;
}
1;

View file

@ -65,6 +65,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("943","WebGUI")
},
checked=>{
defaultValue=> 0
},
@ -91,19 +94,6 @@ sub generateIdParameter {
return undef
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("943","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -59,6 +59,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("codearea","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
@ -66,19 +69,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("codearea","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -40,17 +40,23 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
=head2 getName ()
=head2 definition ( )
Returns the human readable name or type of this form control.
See the super class for additional details.
=cut
sub getName {
return WebGUI::International::get("color","WebGUI");
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("color","WebGUI")
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,7 +15,7 @@ package WebGUI::Form::Combo;
=cut
use strict;
use base 'WebGUI::Form::SelectList';
use base 'WebGUI::Form::SelectBox';
use WebGUI::Form::Text;
use WebGUI::International;
use WebGUI::Session;
@ -30,7 +30,7 @@ Creates a select list merged with a text box form control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::SelectList.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -59,6 +59,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("combobox","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
@ -66,19 +69,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("combobox","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,8 +15,7 @@ package WebGUI::Form::ContentType;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::SelectList;
use base 'WebGUI::Form::SelectBox';
use WebGUI::International;
use WebGUI::Session;
@ -30,7 +29,7 @@ Creates a content type selector which can be used in conjunction with WebGUI::HT
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -66,8 +65,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("1007","WebGUI")
},
label=>{
defaultValue=>$class->getName()
defaultValue=>WebGUI::International::get("1007","WebGUI")
},
types=>{
defaultValue=>[qw(mixed html code text)]
@ -79,33 +81,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("1007","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "mixed".
=cut
sub getValueFromPost {
my $self = shift;
return $session{req}->param($self->{name}) || "mixed";
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -128,18 +103,8 @@ sub toHtml {
$types{html} = WebGUI::International::get(1009);
}
}
return WebGUI::Form::SelectList->new(
options=>\%types,
id=>$self->{id},
name=>$self->{name},
value=>[$self->{value}],
extras=>$self->{extras},
defaultValue=>[$self->{defaultValue}]
)->toHtml;
$self->{options} = \%types,
return $self->SUPER::toHtml();
}
1;

View file

@ -92,6 +92,10 @@ Add extra attributes to the form tag like
onmouseover='doSomething()'
=head4 formName
The internationalized form name.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called.
@ -144,6 +148,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>'A name for this form was not supplied'
},
name=>{
defaultValue=>undef
},
@ -273,7 +280,9 @@ Returns a human readable name for this form control type. You MUST override this
=cut
sub getName {
return "Form control not properly created."
my $self = shift;
my $definition = $self->definition;
return $definition->[0]->{formName}->{defaultValue};
}
@ -358,18 +367,23 @@ sub fixTags {
=head2 getValueFromPost ( )
Retrieves a value from a form GET or POST and returns it. If the value comes back as undef, this method will return the defaultValue instead.
Retrieves a value from a form GET or POST and returns it. If the value
comes back as undef, this method will return the defaultValue instead.
It also handles return data in list or scalar contexts. If a Form
field that supports multiple select requests its values in scalar
context, it will return a newline "\n" separated scalar.
=cut
sub getValueFromPost {
my $self = shift;
my $formValue = $session{req}->param($self->{name});
if (defined $formValue) {
return $formValue;
} else {
return $self->{defaultValue};
my @formValues = $session{req}->param($self->{name});
unless (@formValues) {
@formValues = (ref $self->{defaultValue} eq "ARRAY")
? @{$self->{defaultValue} }
: ( $self->{defaultValue} );
}
return wantarray ? @formValues : join("\n",@formValues);
}
#-------------------------------------------------------------------
@ -467,7 +481,6 @@ sub prepareWrapper {
return ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext);
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -15,9 +15,8 @@ package WebGUI::Form::DatabaseLink;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::SelectBox';
use WebGUI::DatabaseLink;
use WebGUI::Form::SelectList;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
@ -34,7 +33,7 @@ Creates a database connection chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -78,8 +77,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("1075","WebGUI")
},
label=>{
defaultValue=>$class->getName()
defaultValue=>WebGUI::International::get("1075","WebGUI")
},
name=>{
defaultValue=>"databaseLinkId"
@ -99,18 +101,6 @@ sub definition {
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("1075","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
@ -119,13 +109,8 @@ Renders a database connection picker control.
sub toHtml {
my $self = shift;
return WebGUI::Form::SelectList->new(
id=>$self->{id},
name=>$self->{name},
options=>WebGUI::DatabaseLink::getList(),
value=>[$self->{value}],
extras=>$self->{extras}
)->toHtml;
$self->{options} = WebGUI::DatabaseLink::getList();
return $self->SUPER::toHtml();
}
#-------------------------------------------------------------------

View file

@ -77,6 +77,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("479","WebGUI")
},
defaultValue=>{
defaultValue=>time()
},
@ -109,19 +112,6 @@ sub displayValue {
return WebGUI::DateTime::epochToHuman($self->{value},"%z");
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("479","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -72,6 +72,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("972","WebGUI")
},
defaultValue=>{
defaultValue=>time()
},
@ -88,19 +91,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("972","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -38,7 +38,6 @@ The following methods are specifically available from this class. Check the supe
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@ -59,6 +58,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("475","WebGUI"),
},
fieldType=>{
defaultValue=> "Text"
},
@ -66,20 +68,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("475","WebGUI");
}
#-------------------------------------------------------------------
=head2 new ( params)
@ -98,35 +86,21 @@ sub new {
my $param = \%raw;
my $fieldType = ucfirst($param->{fieldType});
delete $param->{fieldType};
# Set options for fields that use a list.
if (isIn($fieldType,qw(SelectList CheckList RadioList))) {
delete $param->{size};
my %options;
tie %options, 'Tie::IxHash';
foreach (split(/\n/, $param->{possibleValues})) {
s/\s+$//; # remove trailing spaces
$options{$_} = $_;
}
if (exists $param->{options} && ref($param->{options}) eq "HASH") {
%options = (%{$param->{options}} , %options);
}
$param->{options} = \%options;
}
# Convert value to list for selectList / checkList
if (isIn($fieldType,qw(SelectList CheckList)) && ref $param->{value} ne "ARRAY") {
my @defaultValues;
foreach (split(/\n/, $param->{value})) {
s/\s+$//; # remove trailing spaces
push(@defaultValues, $_);
}
$param->{value} = \@defaultValues;
}
my $size;
if (exists $param->{size}) {
$size = $param->{size};
delete $param->{size};
}
# Return the appropriate field object.
if ($fieldType eq "") {
WebGUI::ErrorHandler::warn("Something is trying to create a dynamic field called ".$param->{name}.", but didn't pass in a field type.");
$fieldType = "Text";
}
##No infinite loops, please
elsif ($fieldType eq 'DynamicField') {
WebGUI::ErrorHandler::warn("Something is trying to create a DynamicField via DynamicField.");
$fieldType = "Text";
}
no strict 'refs';
my $cmd = "WebGUI::Form::".$fieldType;
my $load = "use ".$cmd;
@ -135,8 +109,19 @@ sub new {
WebGUI::ErrorHandler::error("Couldn't compile form control: ".$fieldType.". Root cause: ".$@);
return undef;
}
return $cmd->new($param);
my $formObj = $cmd->new($param);
##Fix up methods for List type forms and restore the size to all Forms *except*
##List type forms
if ($formObj->isa('WebGUI::Form::List')) {
$formObj->correctValues($param->{value});
$formObj->correctOptions($param->{possibleValues});
}
elsif ($size) {
$formObj->{size} = $size;
}
return $formObj;
}
1;

View file

@ -58,6 +58,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("480","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
@ -65,19 +68,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("480","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,10 +15,10 @@ package WebGUI::Form::FieldType;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::SelectList;
use base 'WebGUI::Form::SelectBox';
use WebGUI::International;
use WebGUI::Session;
use WebGUI::Utility;
use Tie::IxHash;
=head1 NAME
@ -31,7 +31,7 @@ Creates a form control that will allow you to select a form control type.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -49,10 +49,6 @@ See the super class for additional details.
The following additional parameters have been added via this sub class.
=head4 size
Defaults to 1. How many characters tall should this control be represented.
=head4 types
An array reference containing the form control types to be selectable. Defaults to all available types.
@ -67,11 +63,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
formName=>{
defaultValue=>WebGUI::International::get("fieldtype","WebGUI")
},
size=>{
defaultValue=>1
label=>{
defaultValue=>WebGUI::International::get("fieldtype","WebGUI")
},
types=>{
defaultValue=>$class->getTypes
@ -82,21 +78,12 @@ sub definition {
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("744","WebGUI");
}
#-------------------------------------------------------------------
=head2 getTypes ( )
A class method that returns an array reference of all the form control types present in the system.
A class method that returns an array reference of all the valid form
control types present in the system. Invalid form types include
Control.pm, the form master class and List, the list form master class
and DynamicField, the form class dispatcher.
=cut
@ -108,7 +95,7 @@ sub getTypes {
my @types;
foreach my $type (@rawTypes) {
if ($type =~ /^(.*)\.pm$/) {
next if ($1 eq "Control");
next if (isIn($1, qw/Control List DynamicField/));
push(@types,$1);
}
}
@ -150,14 +137,9 @@ sub toHtml {
}
$options{$type} = $class->getName;
}
return WebGUI::Form::SelectList->new(
id=>$self->{id},
name=>$self->{name},
options=>\%options,
value=>[$self->{value}],
extras=>$self->{extras},
size=>$self->{size}
)->toHtml;
$self->{options} = \%options;
return $self->SUPER::toHtml();
}

View file

@ -67,6 +67,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("file","WebGUI")
},
name=>{
defaultValue=>"file"
},
@ -128,20 +131,6 @@ sub displayValue {
return $fileValue;
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("file","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,9 +15,8 @@ package WebGUI::Form::FilterContent;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::SelectBox';
use Tie::IxHash;
use WebGUI::Form::SelectList;
use WebGUI::International;
use WebGUI::Session;
@ -31,7 +30,7 @@ Creates a select list containing the content filter options. This is for use wit
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -53,47 +52,36 @@ The following additional parameters have been added via this sub class.
The name of this field to be passed through the URI. Defaults to "filterContent".
=head4 defaultValue
Defaults to "most". Possible values are "none", "macros", "javascript", "most" and "all".
=head4 hoverHelp
A tooltip for what to do with this field. Defaults to a general explaination of content filters.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
formName=>{
defaultValue=>WebGUI::International::get("418","WebGUI")
},
name=>{
defaultValue=>"filterContent"
},
hoverHelp=>{
defaultValue=>WebGUI::International::get('418 description')
}
defaultValue=>WebGUI::International::get('418 description', 'WebGUI')
},
defaultValue=>{
defaultValue=>"most",
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("418","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
@ -126,17 +114,8 @@ sub toHtml {
'most'=>WebGUI::International::get(421),
'all'=>WebGUI::International::get(419)
);
return WebGUI::Form::SelectList->new(
id=>$self->{id},
options=>\%filter,
name=>$self->{name},
value=>[$self->{value}],
extras=>$self->{extras},
defaultValue=>[$self->{defaultValue}]
)->toHtml;
$self->{options} = \%filter;
return $self->SUPER::toHtml();
}
1;

View file

@ -70,6 +70,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("float","WebGUI")
},
maxlength=>{
defaultValue=> 14
},
@ -86,20 +89,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("float","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,9 +15,7 @@ package WebGUI::Form::Group;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::HiddenList;
use WebGUI::Form::SelectList;
use base 'WebGUI::Form::SelectList';
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
@ -26,7 +24,7 @@ use WebGUI::SQL;
=head1 NAME
Package WebGUI::Form::group
Package WebGUI::Form::Group
=head1 DESCRIPTION
@ -34,7 +32,7 @@ Creates a group chooser field.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectList.
=head1 METHODS
@ -68,10 +66,6 @@ An array reference containing a list of groups to exclude from the list. Default
This will be used if no value is specified. Should be passed as an array reference. Defaults to 7 (Everyone).
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
=head4 profileEnabled
Flag that tells the User Profile system that this is a valid form element in a User Profile
@ -82,18 +76,18 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
label=>{
defaultValue=>$class->getName()
formName=>{
defaultValue=>WebGUI::International::get("group","WebGUI")
},
size=>{
defaultValue=>1
},
defaultValue=>{
defaultValue=>[7]
},
multiple=>{
defaultValue=>0
},
defaultValue=>{
defaultValue=>[7]
},
excludeGroups=>{
defaultValue=>[]
},
@ -104,37 +98,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("group","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns either what's posted or if nothing comes back it returns "2" the ID of the Registered Users group.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{req}->param($self->{name});
if (scalar(@data)) {
return wantarray ? @data : join("\n",@data);
}
return wantarray ? @{[2]} : 2;
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -149,17 +112,8 @@ sub toHtml {
if ($self->{excludeGroups}[0] ne "") {
$where = "and groupId not in (".quoteAndJoin($self->{excludeGroups}).")";
}
return WebGUI::Form::SelectList->new(
options=>WebGUI::SQL->buildHashRef("select groupId,groupName from groups where showInForms=1 $where order by groupName"),
name=>$self->{name},
id=>$self->{id},
value=>$self->{value},
extras=>$self->{extras},
size=>$self->{size},
multiple=>$self->{multiple},
defaultValue=>$self->{defaultValue}
)->toHtml;
$self->{options} = WebGUI::SQL->buildHashRef("select groupId,groupName from groups where showInForms=1 $where order by groupName");
return $self->SUPER::toHtml();
}
#-------------------------------------------------------------------
@ -172,12 +126,8 @@ Creates a series of hidden fields representing the data in the list.
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::HiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>WebGUI::SQL->buildHashRef("select groupId,groupName from groups")
)->toHtmlAsHidden;
$self->{options} = WebGUI::SQL->buildHashRef("select groupId,groupName from groups");
return $self->SUPER::toHtmlAsHidden();
}
#-------------------------------------------------------------------

View file

@ -73,6 +73,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("477","WebGUI")
},
rows=>{
defaultValue=> $session{setting}{textAreaRows}+20
},
@ -89,19 +92,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("477","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -57,9 +57,12 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("hidden","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
},
});
return $class->SUPER::definition($definition);
}
@ -76,19 +79,6 @@ sub generateIdParameter {
return undef
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("hidden","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -15,7 +15,7 @@ package WebGUI::Form::HiddenList;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::List';
use WebGUI::International;
use WebGUI::Session;
@ -25,11 +25,11 @@ Package WebGUI::Form::HiddenList
=head1 DESCRIPTION
Creates a list of hidden fields. This is to be used by list type controls (selectList, checkList, etc) to store their vaiuses as hidden values.
Creates a list of hidden fields.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::List.
=head1 METHODS
@ -65,11 +65,8 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[]
formName=>{
defaultValue=>WebGUI::International::get("hidden list","WebGUI"),
},
profileEnabled=>{
defaultValue=>1
@ -78,20 +75,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("hidden list","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -102,31 +85,7 @@ A synonym for toHtmlAsHidden.
sub toHtml {
my $self = shift;
$self->toHtmlAsHidden;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Renders an input tag of type hidden.
=cut
sub toHtmlAsHidden {
my $self = shift;
my $output;
foreach my $key (keys %{$self->{options}}) {
foreach my $item (@{$self->{value}}) {
if ($item eq $key) {
$output .= WebGUI::Form::Hidden->(
name=>$self->{name},
value=>$key
);
}
}
}
return $output;
return $self->toHtmlAsHidden;
}
#-------------------------------------------------------------------

View file

@ -69,6 +69,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("image","WebGUI")
},
name=>{
defaultValue=>"file"
},
@ -103,18 +106,4 @@ sub displayValue {
return $fileValue;
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("image","WebGUI");
}
1;

View file

@ -70,6 +70,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("482","WebGUI")
},
maxlength=>{
defaultValue=> 11
},
@ -86,20 +89,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("482","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -19,9 +19,9 @@ use warnings;
use base qw(WebGUI::Form::Control);
use Tie::IxHash;
use WebGUI::DateTime;
use WebGUI::Form::SelectBox;
use WebGUI::Form::Hidden;
use WebGUI::Form::Integer;
use WebGUI::Form::SelectList;
use WebGUI::International;
use WebGUI::Session;
@ -67,6 +67,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("interval","WebGUI"),
},
defaultValue=>{
defaultValue=>1,
},
@ -77,20 +80,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("interval","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
@ -133,7 +122,7 @@ sub toHtml {
extras=>$self->{extras},
id=>$self->{id}."_interval",
)->toHtml;
$cmd = "WebGUI::Form::SelectList";
$cmd = "WebGUI::Form::SelectBox";
$out .= $cmd->new(
options=>\%units,
name=>$self->{name}."_units",

View file

@ -15,10 +15,8 @@ package WebGUI::Form::LdapLink;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::SelectList';
use WebGUI::LDAPLink;
use WebGUI::Form::SelectList;
use WebGUI::Form::HiddenList;
use WebGUI::Grouping;
use WebGUI::Icon;
use WebGUI::International;
@ -35,7 +33,7 @@ Creates an LDAP connection chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectList.
=head1 METHODS
@ -57,6 +55,14 @@ The following additional parameters have been added via this sub class.
The identifier for this field. Defaults to "ldapLinkId".
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 multiple
Boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 defaultValue
An LDAP link id. Defaults to "0", which is nothing.
@ -65,14 +71,6 @@ An LDAP link id. Defaults to "0", which is nothing.
A URL that will be acted upon after editing an LDAP link.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 multiple
Boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
@ -83,14 +81,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("LDAPLink_1075","AuthLDAP")
},
label=>{
defaultValue=>$class->getName()
},
name=>{
defaultValue=>"ldapLinkId"
},
defaultValue=>{
defaultValue=>[0]
defaultValue=>WebGUI::International::get("LDAPLink_1075","AuthLDAP")
},
size=>{
defaultValue=>1
@ -98,6 +93,12 @@ sub definition {
multiple=>{
defaultValue=>0
},
name=>{
defaultValue=>"ldapLinkId"
},
defaultValue=>{
defaultValue=>[0]
},
afterEdit=>{
defaultValue=>undef
}
@ -107,32 +108,6 @@ sub definition {
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("LDAPLink_1075","AuthLDAP");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{req}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
@ -141,15 +116,8 @@ Renders a database connection picker control.
sub toHtml {
my $self = shift;
return WebGUI::Form::SelectList->new(
name=>$self->{name},
id=>$self->{id},
options=>WebGUI::LDAPLink::getList(),
value=>$self->{value},
multiple=>$self->{multiple},
size=>$self->{size},
extras=>$self->{extras}
)->toHtml;
$self->{options} = WebGUI::LDAPLink::getList();
return $self->SUPER::toHtml();
}
#-------------------------------------------------------------------
@ -162,11 +130,8 @@ Creates a series of hidden fields representing the data in the list.
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::HiddenList->new(
value=>$self->{value},
name=>$self->{name},
options=>WebGUI::LDAPLink::getList()
)->toHtmlAsHidden;
$self->{options} = WebGUI::LDAPLink::getList();
return $self->SUPER::toHtmlAsHidden();
}
#-------------------------------------------------------------------

257
lib/WebGUI/Form/List.pm Normal file
View file

@ -0,0 +1,257 @@
package WebGUI::Form::List;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::List
=head1 DESCRIPTION
Master class for all list type form elements. Not useful by itself.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 alignmentSeparator ( )
Return an HTML separator to generate either horizontal or vertical lists
of radio/check boxes.
=cut
sub alignmentSeparator {
my ($self) = @_;
if ($self->{vertical}) {
return "<br />\n";
}
else {
return " &nbsp; &nbsp;\n";
}
}
#-------------------------------------------------------------------
=head2 correctOptions ( )
Parse a string for a list of options to present to the user. This method
will mainly be called from WebGUI::Form::DynamicField.
=cut
sub correctOptions {
my ($self, $possibleValues) = @_;
my %options;
tie %options, 'Tie::IxHash';
foreach (split(/\n/, $possibleValues)) {
s/\s+$//; # remove trailing spaces
$options{$_} = $_;
}
if (exists $self->{options} && ref($self->{options}) eq "HASH") {
%options = (%{$self->{options}} , %options);
}
$self->{options} = \%options;
}
##-------------------------------------------------------------------
=head2 correctValues ( )
Parse a string for a list of values that should be selected. This method
will mainly be called from WebGUI::Form::DynamicField. Form types that
don't have multiple select, like RadioLists, need to override this
method.
=cut
sub correctValues {
my ($self, $value) = @_;
return unless defined $value;
my @defaultValues;
foreach (split(/\n/, $self->{value})) {
s/\s+$//; # remove trailing spaces
push(@defaultValues, $_);
}
$self->{value} = \@defaultValues;
}
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to an empty array reference.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 multiple
A boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 sortByValue
A boolean value for whether or not the values in the options hash should be sorted. Defaults to "0".
=head4 profileEnabled
Flag that tells the User Profile system that this is a valid form element in a User Profile
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("486","WebGUI"),
},
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[],
},
multiple=>{
defaultValue=>0
},
sortByValue=>{
defaultValue=>0
},
size=>{
defaultValue=>1
},
profileEnabled=>{
defaultValue=>0
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 displayValue ( )
Return all the options
=cut
sub displayValue {
my ($self) = @_;
return join ", ", $self->getValues();
}
#-------------------------------------------------------------------
=head2 getValues ( )
Handle returning an array regardless of whether the form values are a scalar or array.
=cut
sub getValues {
my $self = shift;
my @values = ();
if (ref $self->{value} eq 'ARRAY') {
@values = @{ $self->{value} };
}
else {
push @values, $self->{value};
}
return @values;
}
#-------------------------------------------------------------------
=head2 orderedHash ( )
Based on whether the sortByValue flag is set, return the options hash
for List type Forms sorted by values. The sort is done without regard
to the case of the values.
=cut
sub orderedHash {
my ($self) = @_;
my %options;
tie %options, 'Tie::IxHash';
if ($self->{sortByValue}) {
foreach my $optionKey (sort {"\L${$self->{options}}{$a}" cmp "\L${$self->{options}}{$b}" } keys %{$self->{options}}) {
$options{$optionKey} = $self->{options}{$optionKey};
}
} else {
%options = %{$self->{options}};
}
return %options;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
my %options;
tie %options, 'Tie::IxHash';
%options = $self->orderedHash();
my $output;
my @values = $self->getValues();
foreach my $key (keys %options) {
foreach my $item (@values) {
if ($item eq $key) {
$output .= WebGUI::Form::Hidden->(
name=>$self->{name},
value=>$key
);
}
}
}
return $output;
}
1;

View file

@ -65,6 +65,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("51","WebGUI")
},
maxlength=>{
defaultValue=>35
},
@ -78,21 +81,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("51","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -58,26 +58,16 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("481","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("944","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -61,6 +61,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("radio","WebGUI")
},
checked=>{
defaultValue=> 0
},
@ -84,19 +87,6 @@ sub generateIdParameter {
return undef
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("radio","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -15,7 +15,7 @@ package WebGUI::Form::RadioList;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::List';
use WebGUI::Form::Radio;
use WebGUI::International;
use WebGUI::Session;
@ -30,7 +30,7 @@ Creates a series of radio button form fields.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control. Also take a look ath WebGUI::Form::checkbox as this class creates a list of checkboxes.
This is a subclass of WebGUI::Form::List. Also take a look at WebGUI::Form::Radio as this class creates a list of radio buttons.
=head1 METHODS
@ -38,6 +38,17 @@ The following methods are specifically available from this class. Check the supe
=cut
##-------------------------------------------------------------------
=head2 correctValues ( )
Override method from master class since RadioList only supports a single value
=cut
sub correctValues { }
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
@ -48,10 +59,6 @@ See the super class for additional details.
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 vertical
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
@ -66,8 +73,8 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
formName=>{
defaultValue=>WebGUI::International::get("942","WebGUI")
},
vertical=>{
defaultValue=>0
@ -80,32 +87,6 @@ sub definition {
}
#-------------------------------------------------------------------
=head2 displayValue ( )
Return the all options
=cut
sub displayValue {
my ($self) = @_;
return join ", ", @{ $self->{value} };
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("942","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -117,14 +98,11 @@ Renders a series of radio buttons.
sub toHtml {
my $self = shift;
my $output;
my $alignment;
if ($self->{vertical}) {
$alignment = "<br />\n";
}
else {
$alignment = " &nbsp; &nbsp;\n";
}
foreach my $key (keys %{$self->{options}}) {
my $alignment = $self->alignmentSeparator;
my %options;
tie %options, 'Tie::IxHash';
%options = $self->orderedHash;
foreach my $key (keys %options) {
my $checked = 0;
if ($self->{value} eq $key) {
$checked = 1;

View file

@ -58,27 +58,16 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("read only","WebGUI")
},
profileEnabled=>{
defaultValue=>1
}
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("read only","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
@ -91,7 +80,6 @@ sub getValueFromPost {
return undef;
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -0,0 +1,104 @@
package WebGUI::Form::SelectBox;
=head1 LEGAL
-------------------------------------------------------------------
WebGUI is Copyright 2001-2005 Plain Black Corporation.
-------------------------------------------------------------------
Please read the legal notices (docs/legal.txt) and the license
(docs/license.txt) that came with this distribution before using
this software.
-------------------------------------------------------------------
http://www.plainblack.com info@plainblack.com
-------------------------------------------------------------------
=cut
use strict;
use base 'WebGUI::Form::List';
use WebGUI::International;
use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::SelectBox
=head1 DESCRIPTION
Creates a select list, aka dropdown list form control with single select.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::List.
=head1 METHODS
The following methods are specifically available from this class. Check the superclass for additional methods.
=cut
#-------------------------------------------------------------------
=head2 definition ( [ additionalTerms ] )
See the super class for additional details.
=head3 additionalTerms
The following additional parameters have been added via this sub class.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
=head4 profileEnabled
Flag that tells the User Profile system that this is a valid form element in a User Profile
=cut
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("487","WebGUI"),
},
size=>{
defaultValue=>1,
},
profileEnabled=>{
defaultValue=>1,
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a select list form control.
=cut
sub toHtml {
my $self = shift;
my $output = '<select name="'.$self->{name}.'" size="'.$self->{size}.'" id="'.$self->{id}.'" '.$self->{extras}.'>';
my %options;
tie %options, 'Tie::IxHash';
%options = $self->orderedHash;
my ($value) = $self->getValues();
foreach my $key (keys %options) {
$output .= '<option value="'.$key.'"';
if ($value eq $key) {
$output .= ' selected="selected"';
}
$output .= '>'.${$self->{options}}{$key}.'</option>';
}
$output .= '</select>'."\n";
return $output;
}
1;

View file

@ -15,8 +15,7 @@ package WebGUI::Form::SelectList;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::HiddenList;
use base 'WebGUI::Form::List';
use WebGUI::International;
use WebGUI::Session;
@ -26,11 +25,11 @@ Package WebGUI::Form::SelectList
=head1 DESCRIPTION
Creates a select list, aka dropdown list form control.
Creates a select list, aka dropdown list form control with multiple select.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::List.
=head1 METHODS
@ -48,25 +47,13 @@ See the super class for additional details.
The following additional parameters have been added via this sub class.
=head4 options
A hash reference containing key values that will be returned with the form post and displayable text pairs. Defaults to an empty hash reference.
=head4 defaultValue
An array reference of the items to be checked if no value is specified. Defaults to an empty array reference.
=head4 size
The number of characters tall this list should be. Defaults to '1'.
The number of characters tall this list should be. Defaults to '5'.
=head4 multiple
Boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "0".
=head4 sortByValue
A boolean value for whether or not the values in the options hash should be sorted. Defaults to "0".
A boolean indicating whether the user can select multiple items from this list like a checkList. Defaults to "1".
=head4 profileEnabled
@ -78,20 +65,14 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
options=>{
defaultValue=>{}
},
defaultValue=>{
defaultValue=>[],
formName=>{
defaultValue=>WebGUI::International::get("484","WebGUI"),
},
multiple=>{
defaultValue=>0
},
sortByValue=>{
defaultValue=>0
defaultValue=>1
},
size=>{
defaultValue=>1
defaultValue=>5
},
profileEnabled=>{
defaultValue=>1
@ -100,47 +81,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 displayValue ( )
Return the all options
=cut
sub displayValue {
my ($self) = @_;
return join ", ", @{ $self->{value} };
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("484","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )
Returns an array or a carriage return ("\n") separated scalar depending upon whether you're returning the values into an array or a scalar.
=cut
sub getValueFromPost {
my $self = shift;
my @data = $session{req}->param($self->{name});
return wantarray ? @data : join("\n",@data);
}
#-------------------------------------------------------------------
=head2 toHtml ( )
@ -151,46 +91,23 @@ Renders a select list form control.
sub toHtml {
my $self = shift;
my $multiple = ' multiple="1"' if ($self->{multiple});
my $output = '<select name="'.$self->{name}.'" size="'.$self->{size}.'" id="'.$self->{id}.'" '.$self->{extras}.$multiple.'>';
my %options;
tie %options, 'Tie::IxHash';
if ($self->{sortByValue}) {
foreach my $optionKey (sort {"\L${$self->{options}}{$a}" cmp "\L${$self->{options}}{$b}" } keys %{$self->{options}}) {
$options{$optionKey} = $self->{options}{$optionKey};
}
} else {
%options = %{$self->{options}};
}
my $multiple = ' multiple="1"' if ($self->{multiple});
my $output = '<select name="'.$self->{name}.'" size="'.$self->{size}.'" id="'.$self->{id}.'" '.$self->{extras}.$multiple.'>';
my %options;
tie %options, 'Tie::IxHash';
%options = $self->orderedHash;
my @values = $self->getValues();
foreach my $key (keys %options) {
$output .= '<option value="'.$key.'"';
foreach my $item (@{$self->{value}}) {
if ($item eq $key) {
$output .= ' selected="selected"';
}
}
$output .= '>'.${$self->{options}}{$key}.'</option>';
$output .= '<option value="'.$key.'"';
foreach my $item (@values) {
if ($item eq $key) {
$output .= ' selected="selected"';
}
}
$output .= '>'.${$self->{options}}{$key}.'</option>';
}
$output .= '</select>'."\n";
return $output;
}
#-------------------------------------------------------------------
=head2 toHtmlAsHidden ( )
Creates a series of hidden fields representing the data in the list.
=cut
sub toHtmlAsHidden {
my $self = shift;
return WebGUI::Form::HiddenList->new(
value=>$self->{value},
defaultValue=>$self->{defaultValue},
name=>$self->{name},
options=>$self->{options}
)->toHtmlAsHidden;
$output .= '</select>'."\n";
return $output;
}
1;

View file

@ -39,17 +39,23 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
=head2 getName ()
=head2 definition ( )
Returns the human readable name or type of this form control.
See the super class for additional details.
=cut
sub getName {
return WebGUI::International::get("submit","WebGUI");
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("submit","WebGUI")
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -15,9 +15,8 @@ package WebGUI::Form::Template;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::SelectBox';
use WebGUI::Asset::Template;
use WebGUI::Form::SelectList;
use WebGUI::Icon;
use WebGUI::International;
use WebGUI::Session;
@ -33,7 +32,7 @@ Creates a template chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -69,8 +68,11 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("assetName","Asset_Template")
},
label=>{
defaultValue=>$class->getName()
defaultValue=>WebGUI::International::get("assetName","Asset_Template")
},
name=>{
defaultValue=>"templateId"
@ -84,18 +86,6 @@ sub definition {
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("assetName","Asset_Template");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a database connection picker control.
@ -112,17 +102,8 @@ sub toHtml {
delete $templateList->{$assetId};
}
}
# not sure why, but for some reason this fails under certain circumstances unless defined
# in this manner. The syndicated content asset is an example where it fails.
my $cmd = "WebGUI::Form::SelectList";
my $selectList = $cmd->new(
id=>$self->{id},
name=>$self->{name},
options=>$templateList,
value=>[$self->{value}],
extras=>$self->{extras}
);
return $selectList->toHtml;
$self->{options} = $templateList;
return $self->SUPER::toHtml();
}
#-------------------------------------------------------------------

View file

@ -65,6 +65,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=> WebGUI::International::get("475","WebGUI")
},
maxlength=>{
defaultValue=> 255
},
@ -78,21 +81,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("475","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -69,6 +69,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("476","WebGUI")
},
rows=>{
defaultValue=> $session{setting}{textAreaRows} || 5
},
@ -85,21 +88,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("476","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )

View file

@ -69,6 +69,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("971","WebGUI")
},
maxlength=>{
defaultValue=>8
},
@ -82,20 +85,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("971","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,9 +15,8 @@ package WebGUI::Form::TimeZone;
=cut
use strict;
use base 'WebGUI::Form::Control';
use base 'WebGUI::Form::SelectBox';
use WebGUI::DateTime;
use WebGUI::Form::SelectList;
use WebGUI::International;
use WebGUI::Session;
@ -31,7 +30,7 @@ Creates a template chooser control.
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -41,14 +40,24 @@ The following methods are specifically available from this class. Check the supe
#-------------------------------------------------------------------
=head2 getName ()
=head2 definition ( )
Returns the human readable name or type of this form control.
See the super class for additional details.
=cut
sub getName {
return WebGUI::International::get("timezone","DateTime");
sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("timezone","DateTime")
},
value=>{
defaultValue=>undef
},
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
@ -61,15 +70,8 @@ Renders a database connection picker control.
sub toHtml {
my $self = shift;
my $cmd = "WebGUI::Form::SelectList";
my $selectList = $cmd->new(
id=>$self->{id},
name=>$self->{name},
options=>WebGUI::DateTime::getTimeZones(),
value=>[$self->{value}],
extras=>$self->{extras}
);
return $selectList->toHtml;
$self->{options} = WebGUI::DateTime::getTimeZones();
return $self->SUPER::toHtml();
}

View file

@ -62,6 +62,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("478","WebGUI")
},
maxlength=>{
defaultValue=> 2048
},
@ -72,20 +75,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("478","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -15,8 +15,7 @@ package WebGUI::Form::WhatNext;
=cut
use strict;
use base 'WebGUI::Form::Control';
use WebGUI::Form::SelectList;
use base 'WebGUI::Form::SelectBox';
use WebGUI::International;
use WebGUI::Session;
@ -30,7 +29,7 @@ Creates a what next question field. This is used to allow users direct the flow
=head1 SEE ALSO
This is a subclass of WebGUI::Form::Control.
This is a subclass of WebGUI::Form::SelectBox.
=head1 METHODS
@ -52,18 +51,6 @@ The following additional parameters have been added via this sub class.
The identifier for this field. Defaults to "proceed".
=head4 defaultValue
A database link id. Defaults to "0", which is the WebGUI database.
=head4 afterEdit
A URL that will be acted upon after editing a database link.
=head4 hoverHelp
A tooltip to tell the user what to do with the field. Defaults a standard piece of help for Database Links.
=head4 label
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
@ -74,33 +61,21 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("744","WebGUI")
},
label=>{
defaultValue=>$class->getName()
defaultValue=>WebGUI::International::get("744","WebGUI")
},
name=>{
defaultValue=>"proceed"
},
options=>{
defaultValue=>{}
}
});
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("744","WebGUI");
}
#-------------------------------------------------------------------
=head2 toHtml ( )
Renders a question selector asking the user where they want to go.
@ -109,16 +84,7 @@ Renders a question selector asking the user where they want to go.
sub toHtml {
my $self = shift;
return WebGUI::Form::SelectList->new(
id=>$self->{id},
name=>$self->{name},
options=>$self->{options},
value=>[$self->{value}],
extras=>$self->{extras}
)->toHtml;
return $self->SUPER::toHtml();
}
1;

View file

@ -22,7 +22,7 @@ use WebGUI::Session;
=head1 NAME
Package WebGUI::Form::yesNo
Package WebGUI::Form::YesNo
=head1 DESCRIPTION
@ -62,6 +62,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=>WebGUI::International::get("483","WebGUI")
},
defaultValue=>{
defaultValue=>0
},
@ -72,20 +75,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("483","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -62,6 +62,9 @@ sub definition {
my $class = shift;
my $definition = shift || [];
push(@{$definition}, {
formName=>{
defaultValue=> WebGUI::International::get("944","WebGUI")
},
maxlength=>{
defaultValue=> 10
},
@ -72,20 +75,6 @@ sub definition {
return $class->SUPER::definition($definition);
}
#-------------------------------------------------------------------
=head2 getName ()
Returns the human readable name or type of this form control.
=cut
sub getName {
return WebGUI::International::get("944","WebGUI");
}
#-------------------------------------------------------------------
=head2 getValueFromPost ( )

View file

@ -238,7 +238,7 @@ sub getToolbarOptions {
my %options;
tie %options, 'Tie::IxHash';
$options{useLanguageDefault} = WebGUI::International::get(1084);
my $dir = $session{config}{extrasPath}.$session{os}{slash}."toolbar";
my $dir = $session{config}{extrasPath}."/toolbar";
opendir (DIR,$dir) or WebGUI::ErrorHandler::warn("Can't open toolbar directory!");
my @files = readdir(DIR);
foreach my $file (@files) {

View file

@ -142,7 +142,7 @@ Returns a hash reference to the languages (languageId/lanugage) installed on thi
sub getLanguages {
my ($hashRef);
my $dir = $session{config}{webguiRoot}.$session{os}{slash}."lib".$session{os}{slash}."WebGUI".$session{os}{slash}."i18n";
my $dir = $session{config}{webguiRoot}."/lib/WebGUI/i18n";
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatal("Can't open I18N directory! ".$dir);
my @files = readdir(DIR);
closedir(DIR);

View file

@ -435,11 +435,11 @@ sub www_editCommerceSettings {
# payment plugin
if (%paymentPlugins) {
WebGUI::Style::setRawHeadTags('<script type="text/javascript">var activePayment="'.$paymentPlugin.'";</script>');
$tabform->getTab("payment")->selectList(
$tabform->getTab("payment")->selectBox(
-name => 'commercePaymentPlugin',
-options => \%paymentPlugins,
-label => $i18n->get('payment form'),
-value => [$paymentPlugin],
-value => $paymentPlugin,
-extras => 'onchange="activePayment=operateHidden(this.options[this.selectedIndex].value,activePayment)"'
);
@ -473,11 +473,11 @@ sub www_editCommerceSettings {
# shipping plugin
if (%shippingPlugins) {
WebGUI::Style::setRawHeadTags('<script type="text/javascript">var activeShipping="'.$shippingPlugin.'";</script>');
$tabform->getTab('shipping')->selectList(
$tabform->getTab('shipping')->selectBox(
-name => 'commerceShippingPlugin',
-options=> \%shippingPlugins,
-label => $i18n->get('shipping plugin label'),
-value => [$shippingPlugin],
-value => $shippingPlugin,
-extras => 'onchange="activeShipping=operateHidden(this.options[this.selectedIndex].value,activeShipping)"'
);
@ -593,12 +593,12 @@ sub www_listTransactions {
$output .= '</tr><tr>';
$output .= '<td></td>';
$output .= '<td align="left">'.$i18n->get('transaction status').'</td>';
$output .= '<td>'.WebGUI::Form::selectList({name => 'tStatus', value => [$session{form}{tStatus}], options => $transactionOptions});
$output .= '<td>'.WebGUI::Form::selectBox({name => 'tStatus', value => [$session{form}{tStatus}], options => $transactionOptions});
$output .= '</tr><tr>';
$output .= '<td></td>';
$output .= '<td align="left">'.$i18n->get('shipping status').'</td>';
$output .= '<td>'.WebGUI::Form::selectList({name => 'sStatus', value => [$session{form}{sStatus}], options => $shippingOptions});
$output .= '<td>'.WebGUI::Form::selectBox({name => 'sStatus', value => [$session{form}{sStatus}], options => $shippingOptions});
$output .= '</tr><tr>';
$output .= '<td></td>';

View file

@ -53,7 +53,7 @@ sub www_richEditPageTree {
-label=>WebGUI::International::get(104),
-hoverHelp=>WebGUI::International::get('104 description'),
);
$f->selectList(
$f->selectBox(
-name=>"target",
-label=>WebGUI::International::get('target'),
-hoverHelp=>WebGUI::International::get('target description'),

View file

@ -117,9 +117,9 @@ sub getGroupSearchForm {
-name=>"doit",
-value=>1
);
$f->selectList(
$f->selectBox(
-name=>"modifier",
-value=>([$session{scratch}{groupSearchModifier} || WebGUI::International::get("contains") ]),
-value=>($session{scratch}{groupSearchModifier} || WebGUI::International::get("contains") ),
-options=>{
startsWith=>WebGUI::International::get("starts with"),
contains=>WebGUI::International::get("contains"),

View file

@ -61,7 +61,7 @@ sub _linkTOC {
#-------------------------------------------------------------------
sub _getHelpFilesList {
my $dir = join $session{os}{slash}, $session{config}{webguiRoot},"lib","WebGUI","Help";
my $dir = join '/', $session{config}{webguiRoot},"lib","WebGUI","Help";
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatal("Can't open Help directory!");
my @files;
foreach my $file (readdir DIR) {

View file

@ -47,35 +47,25 @@ sub getRequiredProfileFields {
$method = $data->{dataType};
$label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
if ($method eq "selectList") {
$values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
# note: this big if statement doesn't look elegant, but doing regular ORs caused problems with the array reference.
if ($session{form}{$data->{fieldName}}) {
$default = [$session{form}{$data->{fieldName}}];
}
elsif ($session{user}{$data->{fieldName}}) {
$default = [$session{user}{$data->{fieldName}}];
}
$hash{'profile.formElement'} = WebGUI::Form::selectList({
"name"=>$data->{fieldName},
"options"=>$values,
"value"=>$default
});
$values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
my $default;
if ($session{form}{$data->{fieldName}}) {
$default = $session{form}{$data->{fieldName}};
}
elsif ($session{user}{$data->{fieldName}}) {
$default = $session{user}{$data->{fieldName}};
}
else {
if ($session{form}{$data->{fieldName}}) {
$default = $session{form}{$data->{fieldName}};
}
elsif (exists $session{user}{$data->{fieldName}}) {
$default = $session{user}{$data->{fieldName}};
}
else {
$default = $data->{dataDefault};
}
my $cmd = 'WebGUI::Form::'.$method.'({"name"=>$data->{fieldName},"value"=>$default})';
$hash{'profile.formElement'} = eval($cmd);
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
}
my $form = WebGUI::Form::DynamicField->new(
name => $data->{fieldName},
value => $default,
options => $values,
fieldType => $method,
);
$hash{'profile.form.element'} = $form->displayForm();
$hash{'profile.formElement.label'} = $label;
push(@array,\%hash)
}
@ -184,6 +174,7 @@ sub www_editProfile {
if ($data->{required}) {
$hash{'profile.form.element.subtext'} = "*";
}
push(@profile,\%hash);
if (($previousCategory && $category ne $previousCategory) || $counter eq $a->rows) {
my @temp = @profile;
my $hashRef;
@ -193,7 +184,6 @@ sub www_editProfile {
@profile = ();
}
$previousCategory = $category;
push(@profile,\%hash);
}
$a->finish;

View file

@ -249,7 +249,7 @@ sub www_editProfileField {
foreach $key (keys %hash) {
$hash{$key} = WebGUI::Operation::Shared::secureEval($hash{$key});
}
$f->selectList(
$f->selectBox(
-name=>"profileCategoryId",
-options=>\%hash,
-label=>WebGUI::International::get(489,"WebGUIProfile"),

View file

@ -118,7 +118,7 @@ sub www_editSettings {
-value=>$session{setting}{metaDataEnabled}
);
# user interface settings
$tabform->getTab("ui")->selectList(
$tabform->getTab("ui")->selectBox(
-name=>"richEditor",
-label=>$i18n->get("default rich editor"),
-hoverHelp=>$i18n->get("default rich editor description"),
@ -207,7 +207,7 @@ sub www_editSettings {
-hoverHelp=>$i18n->get('show performance indicators description'),
-value=>$session{setting}{showPerformanceIndicators}
);
$tabform->getTab("misc")->selectList(
$tabform->getTab("misc")->selectBox(
-name=>"hostToUse",
-value=>[$session{setting}{hostToUse}],
-options=>{
@ -274,7 +274,7 @@ sub www_editSettings {
foreach (@{$session{config}{authMethods}}) {
$options->{$_} = $_;
}
$tabform->getTab("auth")->selectList(
$tabform->getTab("auth")->selectBox(
-name=>"authMethod",
-options=>$options,
-label=>$i18n->get(164),

View file

@ -230,7 +230,7 @@ sub www_editSubscription {
-hoverHelp => $i18n->get('subscription group description'),
-value => [$properties->{subscriptionGroup} || 2]
);
$f->selectList(
$f->selectBox(
-name => 'duration',
-label => $i18n->get('subscription duration'),
-hoverHelp => $i18n->get('subscription duration description'),

View file

@ -125,9 +125,9 @@ sub getUserSearchForm {
-name=>"doit",
-value=>1
)
.WebGUI::Form::selectList(
.WebGUI::Form::selectBox(
-name=>"modifier",
-value=>([$session{scratch}{userSearchModifier} || "contains"]),
-value=>($session{scratch}{userSearchModifier} || "contains"),
-options=>{
startsWith=>WebGUI::International::get("starts with"),
contains=>WebGUI::International::get("contains"),
@ -139,9 +139,9 @@ sub getUserSearchForm {
-value=>$session{scratch}{userSearchKeyword},
-size=>15
)
.WebGUI::Form::selectList(
.WebGUI::Form::selectBox(
-name => "status",
-value => [$session{scratch}{userSearchStatus} || "users.status like '%'"],
-value => ($session{scratch}{userSearchStatus} || "users.status like '%'"),
-options=> {
"" => WebGUI::International::get(821),
Active => WebGUI::International::get(817),
@ -252,22 +252,22 @@ sub www_editUser {
-value => $u->status
);
} else {
$tabform->getTab("account")->selectList(
$tabform->getTab("account")->selectBox(
-name => "status",
-options => \%status,
-label => $i18n->get(816),
-value => [$u->status]
-value => $u->status
);
}
my $options;
foreach (@{$session{config}{authMethods}}) {
$options->{$_} = $_;
}
$tabform->getTab("account")->selectList(
$tabform->getTab("account")->selectBox(
-name=>"authMethod",
-options=>$options,
-label=>$i18n->get(164),
-value=>[$u->authMethod],
-value=>$u->authMethod,
-extras=>"onChange=\"active=operateHidden(this.options[this.selectedIndex].value,active)\""
);
foreach (@{$session{config}{authMethods}}) {

View file

@ -287,10 +287,8 @@ sub open {
$session{os}{name} = $^O;
if ($session{os}{name} =~ /MSWin32/i || $session{os}{name} =~ /^Win/i) {
$session{os}{type} = "Windowsish";
$session{os}{slash} = "\\";
} else {
$session{os}{type} = "Linuxish";
$session{os}{slash} = "/";
}
###----------------------------
### default database handler object

View file

@ -114,7 +114,7 @@ sub _makePath {
my $self = shift;
my $node = $session{config}{uploadsPath};
foreach my $folder ($self->{_part1}, $self->{_part2}, $self->{_id}) {
$node .= $session{os}{slash}.$folder;
$node .= '/'.$folder;
unless (-e $node) { # check to see if it already exists
unless (mkdir($node)) { # check to see if there was an error during creation
$self->_addError("Couldn't create storage location: $node : $!");
@ -482,7 +482,7 @@ sub getFileIconUrl {
my $self = shift;
my $filename = shift;
my $extension = $self->getFileExtension($filename);
my $path = $session{config}{extrasPath}.$session{os}{slash}."fileIcons".$session{os}{slash}.$extension.".gif";
my $path = $session{config}{extrasPath}.'/fileIcons/'.$extension.".gif";
if (-e $path) {
return $session{config}{extrasURL}."/fileIcons/".$extension.".gif";
}
@ -600,11 +600,11 @@ sub getPath {
return undef;
}
my $path = $session{config}{uploadsPath}
.$session{os}{slash}.$self->{_part1}
.$session{os}{slash}.$self->{_part2}
.$session{os}{slash}.$self->getId;
.'/'.$self->{_part1}
.'/'.$self->{_part2}
.'/'.$self->getId;
if (defined $file) {
$path .= $session{os}{slash}.$file;
$path .= '/'.$file;
}
return $path;
}

View file

@ -116,7 +116,7 @@ sub generateThumbnail {
$image->Scale(width=>($x/$r),height=>($y/$r));
$image->Sharpen('0.0x1.0');
}
$error = $image->Write($self->getPath.$session{os}{slash}.'thumb-'.$filename);
$error = $image->Write($self->getPath.'/'.'thumb-'.$filename);
if ($error) {
WebGUI::ErrorHandler::error("Couldn't create thumbnail: ".$error);
return 0;

View file

@ -4,7 +4,7 @@ use WebGUI::Session;
use WebGUI::International;
##Get list of all macros by namespace/module name
my $dir = join $session{os}{slash}, $session{config}{webguiRoot},"lib","WebGUI","Macro";
my $dir = join '/', $session{config}{webguiRoot},"lib","WebGUI","Macro";
opendir (DIR,$dir) or WebGUI::ErrorHandler::fatal("Can't open Macro directory: $dir!");
my @macros = map { s/Macro_//; s/\.pm//; $_; }
grep { /\.pm$/ }

View file

@ -362,6 +362,16 @@ Be aware that any database links you create here will be available to all conten
lastUpdated => 1031514049
},
'486' => {
message => q|List|,
lastUpdated => 1133087205
},
'487' => {
message => q|Select Box|,
lastUpdated => 1133087205
},
'391' => {
message => q|Delete attached file.|,
lastUpdated => 1031514049
@ -3223,6 +3233,12 @@ that Asset and all Assets below it.</p>
context => q|Field type name|
},
'fieldtype' => {
message => q|Field Type|,
lastUpdated =>0,
context => q|Field type name|
},
'hidden list' => {
message => q|Hidden List|,
lastUpdated =>0,