Added filter selection to frontend.

Improved UI of killmaps page slightly.
This commit is contained in:
Gregory Shikhman 2009-08-13 22:45:56 +00:00
parent c9f365328c
commit 9ebdcebbb3
2 changed files with 36 additions and 2 deletions

View File

@ -101,6 +101,11 @@ class KillGraphController(BaseController):
#check for input sanity, we will be fetching map tiles based on this name
if not ( cur_map.isalnum() and len(cur_map) == 32):
cur_map = ""
cur_map_name = "None"
for map in maps:
if map[1] == cur_map:
cur_map_name = map[0]
break
m_dimensions = ()
if cur_map != "":
@ -125,4 +130,7 @@ class KillGraphController(BaseController):
return dict(maps=maps,cur_map=cur_map,dimensions=m_dimensions,
grid_colors=grid_colors,startdate="",enddate="",
minkillerlev="",maxkillerlev="",minkilledlev="",
maxkilledlev="")
maxkilledlev="",used_filters=used_filters,
ufilters_vals=ufilters_vals,
filters=available_filters+available_filters_map,
fdata=fdata,cur_map_name=cur_map_name)

View File

@ -112,10 +112,36 @@
<div id="map_canvas" style="width: 800px; height: 600px"><noscript>You must enable Javascript in order to see the kill map.</noscript></div>
<br />
<div id="map_selection">
Map
Map: ${cur_map_name}
<div id="used_filters">
Used filters:
<b py:if="len(used_filters) == 0">None</b>
<table border="1">
<tr py:for="filter in used_filters">
<td>${filter}</td>
<td py:for="val in ufilters_vals[filter]">
${val}
</td>
</tr>
</table>
</div>
<form method="get">
<table border="1">
<tr>
<td py:for="filter in filters">
${filter}
</td>
<td>
map/scenario
</td>
</tr>
<tr>
<td py:for="filter in filters">
<select name="${filter}" multiple="multiple" size="5">
<option selected="1" py:for="item in sorted(fdata[filter])" py:if="used_filters.__contains__(filter) and ufilters_vals[filter].__contains__(item)">${item}</option>
<option py:for="item in sorted(fdata[filter])" py:if="not (used_filters.__contains__(filter) and ufilters_vals[filter].__contains__(item))">${item}</option>
</select>
</td>
<td>
<select name="map" size="5">
<option py:for="map in maps" value="${map[1]}">${map[0]}</option>