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
|
|
@ -1,5 +1,6 @@
|
|||
7.7.13
|
||||
- fixed #10574: Creating Calendar Entry
|
||||
- fixed #10522: Metadata value & label problem
|
||||
|
||||
7.7.12
|
||||
- Updated auth to allow sending back of non-text/html mime types.
|
||||
|
|
|
|||
|
|
@ -13,6 +13,12 @@ save you many hours of grief.
|
|||
* Due to changes in the userSession database table, you must upgrade
|
||||
to 7.7.13 before upgrading to 7.7.14 or beyond.
|
||||
|
||||
* WebGUI has allowed metadata possible values to be processed differently
|
||||
by Posts than from other Assets. This causes problems when metadata is
|
||||
shared between Posts and other Assets. To rememdy this, all metadata
|
||||
possible values are being moved into the standard "pipe format", and
|
||||
the Post will no longer process data in the other format.
|
||||
|
||||
7.7.8
|
||||
--------------------------------------------------------------------
|
||||
* A basic behavior of the Inbox has been changed. If a message is
|
||||
|
|
@ -125,7 +131,9 @@ save you many hours of grief.
|
|||
Tags field. Extra Head Tags are now added for all templates and
|
||||
assets included on a page, except for Style templates, which do
|
||||
not have Extra Head Tags. Existing Extra Head Tags for Style
|
||||
templates have been removed.
|
||||
templates will be lost. If your current Style template uses
|
||||
the Head Block please put any content from there directly into your
|
||||
style template inside the <head></head> tags.
|
||||
|
||||
* Web Services Client is no longer part of the official distribution of
|
||||
WebGUI, but is still available to be maintained by third-parties. However,
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ my $session = start(); # this line required
|
|||
|
||||
# upgrade functions go here
|
||||
addSessionTokenId($session);
|
||||
correctPostMetaData($session);
|
||||
|
||||
finish($session); # this line required
|
||||
|
||||
|
|
@ -46,7 +47,6 @@ finish($session); # this line required
|
|||
#}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
# Describe what our function does
|
||||
sub addSessionTokenId {
|
||||
my $session = shift;
|
||||
print "\tAdding CSRF token to userSession, if needed... " unless $quiet;
|
||||
|
|
@ -58,6 +58,28 @@ sub addSessionTokenId {
|
|||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
#----------------------------------------------------------------------------
|
||||
sub correctPostMetaData {
|
||||
my $session = shift;
|
||||
my $root = WebGUI::Asset->getRoot($session);
|
||||
print "\tPutting metadata associated with posts into the standard metadata possibleValues format... " unless $quiet;
|
||||
# and here's our code
|
||||
my $meta = $root->getMetaDataFields();
|
||||
FIELD: foreach my $field (keys %{ $meta }) {
|
||||
next FIELD unless $meta->{$field}->{possibleValues} && $meta->{$field}->{possibleValues} =~ m/\}/;
|
||||
my $values = WebGUI::Operation::Shared::secureEval($session, $meta->{$field}->{possibleValues});
|
||||
next FIELD unless ref $values eq 'HASH';
|
||||
my $newValues = '';
|
||||
while (my ($key, $value) = each %{ $values }) {
|
||||
$newValues .= join '|', $key, $value;
|
||||
$newValues .= "\n";
|
||||
}
|
||||
print "\n\t\tUpdating ".$meta->{$field}->{fieldName};
|
||||
$root->addMetaDataField(@{ $meta->{$field} }{ qw/fieldId fieldName defaultValue description fieldType/ }, $newValues);
|
||||
}
|
||||
print "DONE!\n" unless $quiet;
|
||||
}
|
||||
|
||||
|
||||
# -------------- DO NOT EDIT BELOW THIS LINE --------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -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