[tor-commits] [metrics-web/master] Remember checked statuses of check boxes and radio buttons.
karsten at torproject.org
karsten at torproject.org
Sun Apr 24 13:15:59 UTC 2011
commit f88f0fe407f983f340e1e8a0fe46613ad8997a85
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date: Sun Apr 24 15:14:28 2011 +0200
Remember checked statuses of check boxes and radio buttons.
---
web/WEB-INF/network.jsp | 15 ++++++++-------
web/WEB-INF/packages.jsp | 9 +++++----
web/WEB-INF/performance.jsp | 29 +++++++++++++++--------------
3 files changed, 28 insertions(+), 25 deletions(-)
diff --git a/web/WEB-INF/network.jsp b/web/WEB-INF/network.jsp
index bba1d4b..28a7c34 100644
--- a/web/WEB-INF/network.jsp
+++ b/web/WEB-INF/network.jsp
@@ -1,4 +1,5 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
@@ -102,15 +103,15 @@ average number of relays with these flags assigned.</p>
value="${relayflags_end[0]}">
</p><p>
<label>Relay flags: </label>
- <input type="checkbox" name="flag" value="Running"> Running
- <input type="checkbox" name="flag" value="Exit"> Exit
- <input type="checkbox" name="flag" value="Fast"> Fast
- <input type="checkbox" name="flag" value="Guard"> Guard
- <input type="checkbox" name="flag" value="Stable"> Stable
+ <input type="checkbox" name="flag" value="Running"<c:if test="${fn:length(relayflags_flag) == 0 or fn:contains(fn:join(relayflags_flag, ','), 'Running')}"> checked</c:if>> Running
+ <input type="checkbox" name="flag" value="Exit"<c:if test="${fn:length(relayflags_flag) == 0 or fn:contains(fn:join(relayflags_flag, ','), 'Exit')}"> checked</c:if>> Exit
+ <input type="checkbox" name="flag" value="Fast"<c:if test="${fn:length(relayflags_flag) == 0 or fn:contains(fn:join(relayflags_flag, ','), 'Fast')}"> checked</c:if>> Fast
+ <input type="checkbox" name="flag" value="Guard"<c:if test="${fn:length(relayflags_flag) == 0 or fn:contains(fn:join(relayflags_flag, ','), 'Guard')}"> checked</c:if>> Guard
+ <input type="checkbox" name="flag" value="Stable"<c:if test="${fn:length(relayflags_flag) == 0 or fn:contains(fn:join(relayflags_flag, ','), 'Stable')}"> checked</c:if>> Stable
</p><p>
Granularity:
- <input type="radio" name="granularity" value="day"> 1 day
- <input type="radio" name="granularity" value="hour"> 1 hour
+ <input type="radio" name="granularity" value="day" <c:if test="${fn:length(relayflags_granularity) == 0 or relayflags_granularity[0] eq 'day'}"> checked</c:if>> 1 day
+ <input type="radio" name="granularity" value="hour" <c:if test="${relayflags_granularity[0] eq 'hour'}"> checked</c:if>> 1 hour
</p><p>
Resolution: <select name="dpi">
<option value="72"<c:if test="${relayflags_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
diff --git a/web/WEB-INF/packages.jsp b/web/WEB-INF/packages.jsp
index bd8f756..b4ecb5f 100644
--- a/web/WEB-INF/packages.jsp
+++ b/web/WEB-INF/packages.jsp
@@ -1,4 +1,5 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
@@ -33,10 +34,10 @@ graph shows the number of packages requested from GetTor per day.</p>
value="${gettor_end[0]}">
</p><p>
Packages:
- <input type="radio" name="bundle" value="all"> Total packages
- <input type="radio" name="bundle" value="en"> TBB (en)
- <input type="radio" name="bundle" value="zh_CN"> TBB (zh_CN)
- <input type="radio" name="bundle" value="fa"> TBB (fa)
+ <input type="radio" name="bundle" value="all" <c:if test="${fn:length(gettor_bundle) == 0 or gettor_bundle[0] eq 'all'}"> checked</c:if>> Total packages
+ <input type="radio" name="bundle" value="en" <c:if test="${gettor_bundle[0] eq 'en'}"> checked</c:if>> TBB (en)
+ <input type="radio" name="bundle" value="zh_CN" <c:if test="${gettor_bundle[0] eq 'zh_CN'}"> checked</c:if>> TBB (zh_CN)
+ <input type="radio" name="bundle" value="fa" <c:if test="${gettor_bundle[0] eq 'fa'}"> checked</c:if>> TBB (fa)
</p><p>
Resolution: <select name="dpi">
<option value="72"<c:if test="${gettor_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
diff --git a/web/WEB-INF/performance.jsp b/web/WEB-INF/performance.jsp
index 6793a08..939beec 100644
--- a/web/WEB-INF/performance.jsp
+++ b/web/WEB-INF/performance.jsp
@@ -1,4 +1,5 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
@@ -34,15 +35,15 @@ quartile of request times.</p>
value="${torperf_end[0]}">
</p><p>
Source:
- <input type="radio" name="source" value="all"> all
- <input type="radio" name="source" value="torperf"> torperf
- <input type="radio" name="source" value="moria"> moria
- <input type="radio" name="source" value="siv"> siv
+ <input type="radio" name="source" value="all"<c:if test="${fn:length(torperf_source) == 0 or torperf_source[0] eq 'all'}"> checked</c:if>> all
+ <input type="radio" name="source" value="torperf"<c:if test="${torperf_source[0] eq 'torperf'}"> checked</c:if>> torperf
+ <input type="radio" name="source" value="moria"<c:if test="${torperf_source[0] eq 'moria'}"> checked</c:if>> moria
+ <input type="radio" name="source" value="siv"<c:if test="${torperf_source[0] eq 'siv'}"> checked</c:if>> siv
</p><p>
<label>File size: </label>
- <input type="radio" name="filesize" value="50kb"> 50 KiB
- <input type="radio" name="filesize" value="1mb"> 1 MiB
- <input type="radio" name="filesize" value="5mb"> 5 MiB
+ <input type="radio" name="filesize" value="50kb"<c:if test="${fn:length(torperf_filesize) == 0 or torperf_filesize[0] eq '50kb'}"> checked</c:if>> 50 KiB
+ <input type="radio" name="filesize" value="1mb"<c:if test="${torperf_filesize[0] eq '1mb'}"> checked</c:if>> 1 MiB
+ <input type="radio" name="filesize" value="5mb"<c:if test="${torperf_filesize[0] eq '5mb'}"> checked</c:if>> 5 MiB
</p><p>
Resolution: <select name="dpi">
<option value="72"<c:if test="${torperf_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
@@ -80,15 +81,15 @@ than 50 KiB (1 MiB, 5 MiB).</p>
value="${torperf_failures_end[0]}">
</p><p>
Source:
- <input type="radio" name="source" value="all"> all
- <input type="radio" name="source" value="torperf"> torperf
- <input type="radio" name="source" value="moria"> moria
- <input type="radio" name="source" value="siv"> siv
+ <input type="radio" name="source" value="all"<c:if test="${fn:length(torperf_failures_source) == 0 or torperf_failures_source[0] eq 'all'}"> checked</c:if>> all
+ <input type="radio" name="source" value="torperf"<c:if test="${torperf_failures_source[0] eq 'torperf'}"> checked</c:if>> torperf
+ <input type="radio" name="source" value="moria"<c:if test="${torperf_failures_source[0] eq 'moria'}"> checked</c:if>> moria
+ <input type="radio" name="source" value="siv"<c:if test="${torperf_failures_source[0] eq 'siv'}"> checked</c:if>> siv
</p><p>
<label>File size: </label>
- <input type="radio" name="filesize" value="50kb"> 50 KiB
- <input type="radio" name="filesize" value="1mb"> 1 MiB
- <input type="radio" name="filesize" value="5mb"> 5 MiB
+ <input type="radio" name="filesize" value="50kb"<c:if test="${fn:length(torperf_failures_filesize) == 0 or torperf_failures_filesize[0] eq '50kb'}"> checked</c:if>> 50 KiB
+ <input type="radio" name="filesize" value="1mb"<c:if test="${torperf_failures_filesize[0] eq '1mb'}"> checked</c:if>> 1 MiB
+ <input type="radio" name="filesize" value="5mb"<c:if test="${torperf_failures_filesize[0] eq '5mb'}"> checked</c:if>> 5 MiB
</p><p>
Resolution: <select name="dpi">
<option value="72"<c:if test="${torperf_failures_dpi[0] eq '72'}"> selected</c:if>>Screen - 576x360</option>
More information about the tor-commits
mailing list