Fix linking to other things and autocreating the form field for it.
This commit is contained in:
parent
312d1f2f8b
commit
6964c2f1d2
2 changed files with 9 additions and 5 deletions
|
|
@ -25,6 +25,7 @@
|
||||||
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
|
- fixed #9387: Asset Manager breaks navigating into a Gallery Album
|
||||||
- fixed #9001: Thingy add image broken
|
- fixed #9001: Thingy add image broken
|
||||||
- fixed #9386: Gallery: "Image resolutions" issue
|
- fixed #9386: Gallery: "Image resolutions" issue
|
||||||
|
- fixed #9342: Thingy - Cannot edit a thing
|
||||||
|
|
||||||
7.6.7
|
7.6.7
|
||||||
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
|
- fixed #9263: Thingy possibleValues processing, and List type autodetection.
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ use WebGUI::Text;
|
||||||
use WebGUI::Form::File;
|
use WebGUI::Form::File;
|
||||||
use WebGUI::DateTime;
|
use WebGUI::DateTime;
|
||||||
use base 'WebGUI::Asset::Wobject';
|
use base 'WebGUI::Asset::Wobject';
|
||||||
|
use Data::Dumper;
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------
|
#-------------------------------------------------------------------
|
||||||
|
|
@ -840,9 +841,10 @@ sub getFormElement {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $data = shift;
|
my $data = shift;
|
||||||
my %param;
|
my %param;
|
||||||
my $db = $self->session->db;
|
my $session = $self->session;
|
||||||
|
my $db = $session->db;
|
||||||
my $dbh = $db->dbh;
|
my $dbh = $db->dbh;
|
||||||
my $i18n = WebGUI::International->new($self->session,"Asset_Thingy");
|
my $i18n = WebGUI::International->new($session,"Asset_Thingy");
|
||||||
|
|
||||||
$param{name} = "field_".$data->{fieldId};
|
$param{name} = "field_".$data->{fieldId};
|
||||||
my $name = $param{name};
|
my $name = $param{name};
|
||||||
|
|
@ -865,7 +867,7 @@ sub getFormElement {
|
||||||
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) {
|
if (WebGUI::Utility::isIn($data->{fieldType},qw(SelectList CheckList SelectBox Attachments))) {
|
||||||
my @defaultValues;
|
my @defaultValues;
|
||||||
if ($self->session->form->param($name)) {
|
if ($self->session->form->param($name)) {
|
||||||
@defaultValues = $self->session->form->selectList($name);
|
@defaultValues = $session->form->selectList($name);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
foreach (split(/\n/x, $data->{value})) {
|
foreach (split(/\n/x, $data->{value})) {
|
||||||
|
|
@ -881,7 +883,7 @@ sub getFormElement {
|
||||||
if ($class->isa('WebGUI::Form::List')) {
|
if ($class->isa('WebGUI::Form::List')) {
|
||||||
delete $param{size};
|
delete $param{size};
|
||||||
|
|
||||||
my $values = WebGUI::Operation::Shared::secureEval($self->session,$data->{possibleValues});
|
my $values = WebGUI::Operation::Shared::secureEval($session,$data->{possibleValues});
|
||||||
if (ref $values eq 'HASH') {
|
if (ref $values eq 'HASH') {
|
||||||
$param{options} = $values;
|
$param{options} = $values;
|
||||||
}
|
}
|
||||||
|
|
@ -909,6 +911,7 @@ sub getFormElement {
|
||||||
my $otherThingId = $data->{fieldType};
|
my $otherThingId = $data->{fieldType};
|
||||||
$otherThingId =~ s/^otherThing_(.*)/$1/x;
|
$otherThingId =~ s/^otherThing_(.*)/$1/x;
|
||||||
$param{fieldType} = "SelectList";
|
$param{fieldType} = "SelectList";
|
||||||
|
$class = 'WebGUI::Form::'. $param{fieldType};
|
||||||
my $options = ();
|
my $options = ();
|
||||||
my $tableName = 'Thingy_'.$otherThingId;
|
my $tableName = 'Thingy_'.$otherThingId;
|
||||||
my ($otherThingTableExists) = $db->quickArray('show tables like ?',[$tableName]);
|
my ($otherThingTableExists) = $db->quickArray('show tables like ?',[$tableName]);
|
||||||
|
|
@ -932,7 +935,7 @@ sub getFormElement {
|
||||||
$param{value} = $data->{value} || $data->{defaultValue};
|
$param{value} = $data->{value} || $data->{defaultValue};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$self->session, \%param ])};
|
my $formElement = eval { WebGUI::Pluggable::instanciate($class, "new", [$session, \%param ])};
|
||||||
return $formElement->toHtml();
|
return $formElement->toHtml();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue