Added field_loop to output of Thingy's www_getThingViaAjax method

This commit is contained in:
Yung Han Khoe 2008-09-25 20:05:17 +00:00
parent 4bcf12da02
commit 1378ab0d41
2 changed files with 10 additions and 0 deletions

View file

@ -2308,6 +2308,15 @@ sub www_getThingViaAjax {
return $session->privilege->insufficient() unless $self->canViewThing($thingId,
$thingProperties->{groupIdView});
my @field_loop;
my $fields = $session->db->read('select * from Thingy_fields where assetId=? and thingId=? order by sequenceNumber'
,[$self->getId,$thingId]);
while (my $field = $fields->hashRef) {
$field->{formElement} = $self->getFormElement($field);
push(@field_loop,$field);
}
$thingProperties->{field_loop} = \@field_loop;
$session->http->setMimeType("application/json");
return JSON->new->utf8->encode($thingProperties);
}

View file

@ -116,6 +116,7 @@ cmp_deeply(
onEditWorkflowId=>undef,
onDeleteWorkflowId=>undef,
sortBy=>undef,
field_loop=>[],
},
'Getting newly added thing as JSON: www_getThingViaAjax returns correct data as JSON.'
);