first batch of Form i18n and compilation patches
This commit is contained in:
parent
44c6fdfc50
commit
08afb14d51
6 changed files with 24 additions and 22 deletions
|
|
@ -70,13 +70,13 @@ sub definition {
|
|||
my $i18n = WebGUI::International->new($session, "Asset");
|
||||
push(@{$definition}, {
|
||||
formName=>{
|
||||
defaultValue=>$i18n->get("asset");
|
||||
defaultValue=>$i18n->get("asset"),
|
||||
},
|
||||
label=>{
|
||||
defaultValue=>$i18n->get("asset");
|
||||
defaultValue=>$i18n->get("asset"),
|
||||
},
|
||||
name=>{
|
||||
defaultValue=>"asset";
|
||||
defaultValue=>"asset",
|
||||
},
|
||||
class=>{
|
||||
defaultValue=> undef
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ sub definition {
|
|||
my $i18n = WebGUI::International->new($session,"WebGUI");
|
||||
push(@{$definition}, {
|
||||
formName=>{
|
||||
defaultValue=>"button"
|
||||
defaultValue=>$i18n->get('button')
|
||||
},
|
||||
defaultValue=>{
|
||||
defaultValue=>$i18n->get(62)
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ sub definition {
|
|||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift || [];
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
push(@{$definition}, {
|
||||
formName=>{
|
||||
defaultValue=>$i18n->get("941"),
|
||||
|
|
@ -92,18 +92,18 @@ sub toHtml {
|
|||
%options = $self->orderedHash();
|
||||
foreach my $key (keys %options) {
|
||||
my $checked = 0;
|
||||
foreach my $item (@{$self->get("value}")) {
|
||||
foreach my $item (@{ $self->{value} }) {
|
||||
if ($item eq $key) {
|
||||
$checked = 1;
|
||||
}
|
||||
}
|
||||
$output .= WebGUI::Form::Checkbox->new({
|
||||
name=>$self->get("name"),
|
||||
name=>$self->{name},
|
||||
value=>$key,
|
||||
extras=>$self->get("extras"),
|
||||
extras=>$self->{extras},
|
||||
checked=>$checked
|
||||
})->toHtml;
|
||||
$output .= ${$self->get("options}"){$key} . $alignment;
|
||||
$output .= ${$self->{options}}{$key} . $alignment;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,8 +60,9 @@ A text label that will be displayed if toHtmlWithWrapper() is called. Defaults t
|
|||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $session = shift;
|
||||
my $definition = shift || [];
|
||||
my $i18n = WebGUI::International->new($self->session);
|
||||
my $i18n = WebGUI::International->new($session);
|
||||
push(@{$definition}, {
|
||||
formName=>{
|
||||
defaultValue=>$i18n->get("fieldtype","WebGUI")
|
||||
|
|
@ -70,10 +71,10 @@ sub definition {
|
|||
defaultValue=>$i18n->get("fieldtype","WebGUI")
|
||||
},
|
||||
types=>{
|
||||
defaultValue=>$class->getTypes
|
||||
defaultValue=>$class->getTypes($session)
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
return $class->SUPER::definition($session, $definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -89,7 +90,8 @@ and DynamicField, the form class dispatcher.
|
|||
|
||||
sub getTypes {
|
||||
my $class = shift;
|
||||
opendir(DIR,$self->session->config->getWebguiRoot."/lib/WebGUI/Form/");
|
||||
my $session = shift;
|
||||
opendir(DIR,$session->config->getWebguiRoot."/lib/WebGUI/Form/");
|
||||
my @rawTypes = readdir(DIR);
|
||||
closedir(DIR);
|
||||
my @types;
|
||||
|
|
@ -127,7 +129,7 @@ sub toHtml {
|
|||
my $self = shift;
|
||||
my %options;
|
||||
tie %options, "Tie::IxHash";
|
||||
foreach my $type (@{$self->get("types}")) {
|
||||
foreach my $type (@{ $self->{types} }) {
|
||||
my $class = "WebGUI::Form::".ucfirst($type);
|
||||
my $cmd = "use ".$class;
|
||||
eval ($cmd);
|
||||
|
|
@ -137,7 +139,7 @@ sub toHtml {
|
|||
}
|
||||
$options{$type} = $class->getName($self->session);
|
||||
}
|
||||
$self->get("options") = \%options;
|
||||
$self->{options} = \%options;
|
||||
|
||||
return $self->SUPER::toHtml();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,10 +71,10 @@ sub correctOptions {
|
|||
s/\s+$//; # remove trailing spaces
|
||||
$options{$_} = $_;
|
||||
}
|
||||
if (exists $self->get("options") && ref($self->get("options")) eq "HASH") {
|
||||
%options = (%{$self->get("options}") , %options);
|
||||
if (exists $self->{options} && ref($self->{options}) eq "HASH") {
|
||||
%options = (%{$self->{options}} , %options);
|
||||
}
|
||||
$self->get("options") = \%options;
|
||||
$self->{options} = \%options;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -237,11 +237,11 @@ sub orderedHash {
|
|||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
if ($self->get("sortByValue")) {
|
||||
foreach my $optionKey (sort {"\L${$self->get("options}"){$a}" cmp "\L${$self->get("options}"){$b}" } keys %{$self->get("options}")) {
|
||||
$options{$optionKey} = $self->get("options"){$optionKey};
|
||||
foreach my $optionKey (sort {"\L${$self->{options}}{$a}" cmp "\L${$self->{options}}{$b}" } keys %{$self->{options}}) {
|
||||
$options{$optionKey} = $self->{options}{$optionKey};
|
||||
}
|
||||
} else {
|
||||
%options = %{$self->get("options}");
|
||||
%options = %{$self->{options}};
|
||||
}
|
||||
return %options;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ sub toHtml {
|
|||
if ($value eq $key) {
|
||||
$output .= ' selected="selected"';
|
||||
}
|
||||
$output .= '>'.${$self->get("options}"){$key}.'</option>';
|
||||
$output .= '>'.${$self->{options}}{$key}.'</option>';
|
||||
}
|
||||
$output .= '</select>'."\n";
|
||||
return $output;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue