./misc/testSortTable

{{env whiff.content_type: "text/html",
	whiff.parse_cgi: true,
	Data: [
                {
                        "bynick": "george",
                        "attime": 1,
                        "said": "I like cats",
                        "title": "just making conversation"
                },
                {
                        "bynick": "sally",
                        "attime": 2,
                        "said": "me too",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 2,
                        "said": "they are really cute",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 3,
                        "said": "and cuddly",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 4,
                        "said": "and they purr",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 5,
                        "said": "but they fight",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 6,
                        "said": "and somebody has to clean the litter pan",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 7,
                        "said": "but their ears are pointy",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 8,
                        "said": "and they scare the mice away",
                        "title": "babbling"
                },
                {
                        "bynick": "sally",
                        "attime": 9,
                        "said": "but i'd really rather have a puppy, honestly",
                        "title": "babbling"
                },
                {
                        "bynick": "george",
                        "attime": 10,
                        "said": "... because they are sooo stupid!  It's funny!",
                        "title": "rudeness"
                }
        ]
/}}
{{cgi-default sort_col}}said{{/cgi-default}}
{{cgi-default reverse}}true{{/cgi-default}}
{{require header}}
	{{require page/}}
	<th>
		<a href="{{get-env whiff.entry_point/}}?sort_col={{use page/}}&reverse=true">/\</a>
		{{use page/}}
		<a href="{{get-env whiff.entry_point/}}?sort_col={{use page/}}&reverse=false">\/</a>
	</th>
{{/require}}

<h1> the whole table </h1>
{{include "whiff_middleware/sortTable"}}
	<table border>
	<tr>
		{{use header}}bynick{{/use}}
		{{use header}}attime{{/use}}
		{{use header}}said{{/use}}
		{{use header}}title{{/use}}
	</tr>
	{{include "whiff_middleware/repeat"}}
		{{using sequence}}{{get-id Data/}}{{/using}}
		{{using variable}}row_data{{/using}}
		{{using page}}
			<tr>
				<td> {{get-id row_data["bynick"]}}{{/get-id}} </td>
				<td> {{get-id row_data["attime"]}}{{/get-id}} </td>
				<td> {{get-id row_data["said"]}}{{/get-id}} </td>
				<td> {{get-id row_data["title"]}}{{/get-id}} </td>
			</tr>
		{{/using}}
	{{/include}}
	</table>
{{/include}}

<h1> just the middle </h1>
{{include "whiff_middleware/sortTable"}}
	{{set-cgi start}}3{{/set-cgi}}
	{{set-cgi end}}8{{/set-cgi}}
	{{using page}}
	<table border>
	<tr>
		{{use header}}bynick{{/use}}
		{{use header}}attime{{/use}}
		{{use header}}said{{/use}}
		{{use header}}title{{/use}}
	</tr>
	{{include "whiff_middleware/repeat"}}
		{{using sequence}}{{get-id Data/}}{{/using}}
		{{using variable}}row_data{{/using}}
		{{using page}}
			<tr>
				<td> {{get-id row_data["bynick"]}}{{/get-id}} </td>
				<td> {{get-id row_data["attime"]}}{{/get-id}} </td>
				<td> {{get-id row_data["said"]}}{{/get-id}} </td>
				<td> {{get-id row_data["title"]}}{{/get-id}} </td>
			</tr>
		{{/using}}
	{{/include}}
	</table>
	{{/using}}
{{/include}}