Adds Thingy template variable to permit Javascript visualisation of search results
This commit is contained in:
parent
980986880f
commit
093f7d67e9
5 changed files with 47 additions and 0 deletions
|
|
@ -16,6 +16,7 @@
|
||||||
- fixed #11876: packing templates, snippets, headtags removes conditional CSS comments
|
- fixed #11876: packing templates, snippets, headtags removes conditional CSS comments
|
||||||
- fixed #11877: Criteria Builder on "shortcut by alternate criteria" gets ugly with many checkbox items
|
- fixed #11877: Criteria Builder on "shortcut by alternate criteria" gets ugly with many checkbox items
|
||||||
- fixed #11878: Addons title not internationalized
|
- fixed #11878: Addons title not internationalized
|
||||||
|
- added Thingy template variable to permit Javascript visualisation of search results (Patrick Donelan, SDH Consulting Group)
|
||||||
|
|
||||||
7.10.0
|
7.10.0
|
||||||
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
- fixed #11812: Checking www_ajaxSave's response in the cart js, urlencoding post parameters
|
||||||
|
|
|
||||||
|
|
@ -26,4 +26,38 @@ templates, you will need to apply these changes manually to your copies.
|
||||||
</tmpl_unless>
|
</tmpl_unless>
|
||||||
<tmpl_loop story_loop>
|
<tmpl_loop story_loop>
|
||||||
|
|
||||||
|
* Thingy searchResults_json
|
||||||
|
This is a JSON-encoded version of searchResults_loop, which allows people to access Thingy search results
|
||||||
|
in Javascript/Flash/etc.. For example, you can use OpenFlashCharts2 (http://teethgrinder.co.uk/open-flash-chart-2)
|
||||||
|
and SWFObject to access the data and then display it as a pretty custom chart via the following:
|
||||||
|
|
||||||
|
<tmpl_if searchResult_loop>
|
||||||
|
<div id="chart-container">
|
||||||
|
<div id="chart">Loading..</div>
|
||||||
|
</div>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function open_flash_chart_data() {
|
||||||
|
var data_json = "<tmpl_var searchResult_json ESCAPE=JS>";
|
||||||
|
var data = YAHOO.lang.JSON.parse(data_json);
|
||||||
|
var chart = {
|
||||||
|
elements: [
|
||||||
|
// populate dynamically from data object
|
||||||
|
]
|
||||||
|
};
|
||||||
|
return YAHOO.lang.JSON.stringify(chart);
|
||||||
|
}
|
||||||
|
// Embed the chart
|
||||||
|
swfobject.embedSWF(
|
||||||
|
'/path/to/open-flash-chart.swf', // url
|
||||||
|
'chart', // container element id
|
||||||
|
'100%', // width
|
||||||
|
'100%', // height
|
||||||
|
'9.0.0', // version
|
||||||
|
'/path/to/swfobject/expressInstall.swf', // expressInstall
|
||||||
|
{ loading: 'Loading...' }, // flashvars
|
||||||
|
{}, // params
|
||||||
|
{} // attributes
|
||||||
|
);
|
||||||
|
</script>
|
||||||
|
</tmpl_if>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3407,7 +3407,11 @@ sequenceNumber');
|
||||||
push(@searchResult_loop,\%templateVars);
|
push(@searchResult_loop,\%templateVars);
|
||||||
}
|
}
|
||||||
$var->{searchResult_loop} = \@searchResult_loop;
|
$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);
|
$var->{searchResult_json} = JSON->new->encode(\@searchResult_loop);
|
||||||
|
|
||||||
$p->appendTemplateVars($var);
|
$p->appendTemplateVars($var);
|
||||||
|
|
||||||
$var->{"form_start"} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl,method=>'GET'})
|
$var->{"form_start"} = WebGUI::Form::formHeader($self->session,{action=>$self->getUrl,method=>'GET'})
|
||||||
|
|
|
||||||
|
|
@ -236,6 +236,8 @@ our $HELP = {
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{ 'name' => 'searchResult_json',
|
||||||
|
},
|
||||||
],
|
],
|
||||||
related => [
|
related => [
|
||||||
{ tag => 'edit thing template',
|
{ tag => 'edit thing template',
|
||||||
|
|
|
||||||
|
|
@ -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.|,
|
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' => {
|
'things_loop' => {
|
||||||
message => q|A loop containing the Things that are defined for this Thingy Asset, with links to management
|
message => q|A loop containing the Things that are defined for this Thingy Asset, with links to management
|
||||||
functions for those Things|,
|
functions for those Things|,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue