Adds Thingy template variable to permit Javascript visualisation of search results

This commit is contained in:
Patrick Donelan 2010-09-21 15:04:09 -04:00
parent 980986880f
commit 093f7d67e9
5 changed files with 47 additions and 0 deletions

View file

@ -3407,7 +3407,11 @@ sequenceNumber');
push(@searchResult_loop,\%templateVars);
}
$var->{searchResult_loop} = \@searchResult_loop;
# Also expose the search results in the template as a json-encoded string
# so that people can e.g. visualise the results via Javascript
$var->{searchResult_json} = JSON->new->encode(\@searchResult_loop);
$p->appendTemplateVars($var);
$var->{"form_start"} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl,method=>'GET'})

View file

@ -236,6 +236,8 @@ our $HELP = {
},
]
},
{ 'name' => 'searchResult_json',
},
],
related => [
{ tag => 'edit thing template',

View file

@ -659,6 +659,12 @@ Simply replace "key1"/"value1" with your own name/value pairs},
context => q|Description of a tmpl_var for the template help.|,
},
'searchResult_json' => {
message => q|JSON-encoded version of searchResult_loop so that you can access the data in Javascript|,
lastUpdated => 1285094918,
context => q|Description of a tmpl_var for the template help.|,
},
'things_loop' => {
message => q|A loop containing the Things that are defined for this Thingy Asset, with links to management
functions for those Things|,