Introduction
Some operations like the SlideSorter want to create the product requests that will populate the page from JavaScript contained in the output template. In order to place such an operation in the context of the Armstrong User Interface, we need a simple operation that forwards the request from the UI directly to the requested output template. This is such a simple operation that no backend service is needed.
The Operation Definition
In order to have this work and to keep the operation definitions somewhat consistent I have created a specical service I call the "template" service. If you create an operation definition that looks like this:
<operation name="Process Template" ID="Template" template="direct_output">
<service>template</service>
</operation>
using the service name "template" in the service Element, you can invoke this new service.
When this service runs, the product server will build the LASUIRequest object that matches your request and place in the template context, but the contents of the UIRequest are largely ignored by the product server. The implication is that you can configure the options into the UI that you would like the user to be able to set for the requests your JavaScript process will be making. If for example, you are using the SlideSorter you can set all of the plot options for contours levels and the like and these option will appear in the UIRequest object. Then by modifying the UIRequest in JavaScript to set the variables or other parameters that will make up the images of the SpreadSheet each image will be customized acording to these options. For example if the request from the UI looks like this:
http://porter.pmel.noaa.gov:8920/testbed/ProductServer.do?xml=%3C%3Fxml+version%3D%221.0%22%3F%3E%3ClasRequest+package%3D%22%22+href%3D%22file%3Alas.xml%22+%3E%3Clink+match%3D%22%2Flasdata%2Foperations%2Foperation%5B%40ID%3D%27Template%27%5D%22+%2F%3E%3Cproperties+%3E%3Cferret+%3E%3Csize+%3E.5%3C%2Fsize%3E%3Cformat+%3Eshade%3C%2Fformat%3E%3Ccontour_levels+%3E%3C%2Fcontour_levels%3E%3Ccontour_style+%3Edefault%3C%2Fcontour_style%3E%3Cdo_contour+%3Edefault%3C%2Fdo_contour%3E%3Cexpression+%3E%3C%2Fexpression%3E%3Cfill_levels+%3E%3C%2Ffill_levels%3E%3Cfill_type+%3Edefault%3C%2Ffill_type%3E%3Cimage_format+%3Edefault%3C%2Fimage_format%3E%3Cinterpolate_data+%3Efalse%3C%2Finterpolate_data%3E%3Cland_type+%3Ereally_silly_land_type_from_UI%3C%2Fland_type%3E%3Cmark_grid+%3Edefault%3C%2Fmark_grid%3E%3Cpalette+%3Edefault%3C%2Fpalette%3E%3Cset_aspect+%3Edefault%3C%2Fset_aspect%3E%3Cuse_graticules+%3Edefault%3C%2Fuse_graticules%3E%3Cuse_ref_map+%3E1%3C%2Fuse_ref_map%3E%3C%2Fferret%3E%3C%2Fproperties%3E%3Cargs+%3E%3Clink+match%3D%22%2Flasdata%2Fdatasets%2Fcoads_climatology_cdf%2Fvariables%2Fairt%22+%2F%3E%3Cregion+%3E%3Crange+low%3D%22-180.0%22+type%3D%22x%22+high%3D%22180.0%22+%2F%3E%3Crange+low%3D%22-89.0%22+type%3D%22y%22+high%3D%2289.0%22+%2F%3E%3Cpoint+v%3D%2215-Jan%22+type%3D%22t%22+%2F%3E%3C%2Fregion%3E%3C%2Fargs%3E%3C%2FlasRequest%3E&JSESSIONID=9k3993jmfp9"
All of the options will trail along in the request object and will be available from the $las_request object in the templage. You can access this object using its methods. For example, a link back to the page is available from the $las_resquest.toEncodedURLString() and a string representation with with no carriage returns is available from $las_request.getCompactString().
An Example Output Template
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- LAS SERVER OK -->
<head>
<title>LAS Output</title>
<table>
<tr>
<td>
<table>
<tr>
<th>Dataset Name</th><th>Dataset ID</th>
</tr>
#foreach ($ds in $las_config.getDatasets())
<tr>
<td>$ds.getName()</td><td>$ds.getValue()</td>
</tr>
#end
</table>
</td>
</tr>
<tr>
<td>
<a href="$las_resquest.toEncodedURLString()">Link to this plot.</a>
</td>
</tr>
</table>
</body>
</html>