Fix the Post handling Metadata possibleValues differently from other Assets.
This commit is contained in:
parent
a75e83b52d
commit
7901e1d398
4 changed files with 42 additions and 24 deletions
|
|
@ -1473,32 +1473,19 @@ sub www_edit {
|
|||
my @meta_loop = ();
|
||||
foreach my $field (keys %{ $meta }) {
|
||||
my $fieldType = $meta->{$field}{fieldType} || "Text";
|
||||
my %options;
|
||||
tie %options, 'Tie::IxHash';
|
||||
if ($meta->{$field}{possibleValues}){
|
||||
my $values = WebGUI::Operation::Shared::secureEval($self->session,$meta->{$field}{possibleValues});
|
||||
if (ref $values eq 'HASH') {
|
||||
%options = %{$values};
|
||||
}
|
||||
else{
|
||||
foreach (split(/\n/x, $meta->{$field}{possibleValues})) {
|
||||
s/\s+$//x; # remove trailing spaces
|
||||
$options{$_} = $_;
|
||||
}
|
||||
}
|
||||
}
|
||||
my $options = $meta->{$field}{possibleValues};
|
||||
# Add a "Select..." option on top of a select list to prevent from
|
||||
# saving the value on top of the list when no choice is made.
|
||||
if($fieldType eq "selectBox") {
|
||||
%options = ("" => $i18n->get("Select", "Asset"),%options);
|
||||
if("\l$fieldType" eq "selectBox") {
|
||||
$options = "|" . $i18n->get("Select") . "\n" . $options;
|
||||
}
|
||||
my $form = WebGUI::Form::DynamicField->new($session,
|
||||
name=>"metadata_".$meta->{$field}{fieldId},
|
||||
uiLevel=>5,
|
||||
value=>$meta->{$field}{value},
|
||||
extras=>qq/title="$meta->{$field}{description}"/,
|
||||
options=>\%options,
|
||||
fieldType=>$fieldType,
|
||||
name => "metadata_".$meta->{$field}{fieldId},
|
||||
uiLevel => 5,
|
||||
value => $meta->{$field}{value},
|
||||
extras => qq/title="$meta->{$field}{description}"/,
|
||||
options => $options,
|
||||
fieldType => $fieldType,
|
||||
)->toHtml;
|
||||
push @meta_loop, {
|
||||
field => $form,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue