* Console: Fix HTML errors in

configpeer.jsp, configtunnels.jsp, configupdate.jsp
This commit is contained in:
zzz
2011-03-12 17:32:15 +00:00
parent 0f91899aa9
commit e47afffd09
5 changed files with 38 additions and 24 deletions

View File

@ -18,17 +18,24 @@ public class ConfigTunnelsHelper extends HelperBase {
public String getForm() {
StringBuilder buf = new StringBuilder(1024);
// HTML: <input> cannot be inside a <table>
buf.append("<input type=\"hidden\" name=\"pool.0\" value=\"exploratory\" >\n");
int cur = 1;
Set<Destination> clients = _context.clientManager().listClients();
for (Destination dest : clients) {
buf.append("<input type=\"hidden\" name=\"pool.").append(cur).append("\" value=\"");
buf.append(dest.calculateHash().toBase64()).append("\" >\n");
cur++;
}
buf.append("<table>\n");
TunnelPoolSettings exploratoryIn = _context.tunnelManager().getInboundSettings();
TunnelPoolSettings exploratoryOut = _context.tunnelManager().getOutboundSettings();
buf.append("<input type=\"hidden\" name=\"pool.0\" value=\"exploratory\" >");
renderForm(buf, 0, "exploratory", _("Exploratory tunnels"), exploratoryIn, exploratoryOut);
int cur = 1;
Set clients = _context.clientManager().listClients();
for (Iterator iter = clients.iterator(); iter.hasNext(); ) {
Destination dest = (Destination)iter.next();
cur = 1;
for (Destination dest : clients) {
TunnelPoolSettings in = _context.tunnelManager().getInboundSettings(dest.calculateHash());
TunnelPoolSettings out = _context.tunnelManager().getOutboundSettings(dest.calculateHash());
@ -41,9 +48,7 @@ public class ConfigTunnelsHelper extends HelperBase {
name = dest.calculateHash().toBase64().substring(0,6);
String prefix = dest.calculateHash().toBase64().substring(0,4);
buf.append("<input type=\"hidden\" name=\"pool.").append(cur).append("\" value=\"");
buf.append(dest.calculateHash().toBase64()).append("\" >");
renderForm(buf, cur, prefix, _("Client tunnels for") + " " + _(name), in, out);
renderForm(buf, cur, prefix, _("Client tunnels for {0}", _(name)), in, out);
cur++;
}

View File

@ -82,7 +82,7 @@ public class ConfigUpdateHelper extends HelperBase {
for (int i = 0; i < PERIODS.length; i++) {
buf.append("<option value=\"").append(PERIODS[i]);
if (PERIODS[i] == ms)
buf.append("\" selected=\"true\"");
buf.append("\" selected=\"true");
if (PERIODS[i] == -1)
buf.append("\">" + _("Never") + "</option>\n");

View File

@ -43,6 +43,11 @@ public class ShitlistRenderer {
Map<Hash, Shitlist.Entry> entries = new TreeMap(new HashComparator());
entries.putAll(_context.shitlist().getEntries());
if (entries.isEmpty()) {
buf.append("<i>").append(_("none")).append("</i>");
out.write(buf.toString());
return;
}
buf.append("<ul>");

View File

@ -15,15 +15,19 @@ function toggleAll(category)
var inputs = document.getElementsByTagName("input");
for(index = 0; index < inputs.length; index++)
{
if(inputs[index].id == category)
var classes = inputs[index].className.split(' ');
for (var idx = 0; idx < classes.length; idx++)
{
if(inputs[index].checked == 0)
if(classes[idx] == category)
{
inputs[index].checked = 1;
}
else if(inputs[index].checked == 1)
{
inputs[index].checked = 0;
if(inputs[index].checked == 0)
{
inputs[index].checked = 1;
}
else if(inputs[index].checked == 1)
{
inputs[index].checked = 0;
}
}
}
if(category == '*')
@ -75,15 +79,15 @@ function toggleAll(category)
if (statshelper.getIsFull()) { %>checked="true" <% } %> >
(<%=intl._("change requires restart to take effect")%>)<br>
<%=intl._("Stat file")%>: <input type="text" name="filename" value="<%=statshelper.getFilename()%>" ><br>
<%=intl._("Filter")%>: (<a href="javascript: void(null);" onclick="toggleAll('*')"><%=intl._("toggle all")%></a>)<br></p>
<%=intl._("Filter")%>: (<a href="javascript:void(null);" onclick="toggleAll('*')"><%=intl._("toggle all")%></a>)<br></p>
<div class="wideload">
<p><table>
<table>
<% while (statshelper.hasMoreStats()) {
while (statshelper.groupRequired()) { %>
<tr class="tablefooter">
<td align="left" colspan="3">
<td align="left" colspan="3" id=<%=statshelper.getCurrentGroupName()%>>
<b><%=statshelper.getCurrentGroupName()%></b>
(<a href="javascript: void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>)
(<a href="javascript:void(null);" onclick="toggleAll('<%=statshelper.getCurrentGroupName()%>')"><%=intl._("toggle all")%></a>)
</td></tr>
<tr class="tablefooter">
<td align="center"><b><%=intl._("Log")%></b></td>
@ -93,11 +97,11 @@ function toggleAll(category)
} // end iterating over required groups for the current stat %>
<tr><td align="center">
<a name="<%=statshelper.getCurrentStatName()%>"></a>
<input id="<%=statshelper.getCurrentGroupName()%>" type="checkbox" class="optbox" name="statList" value="<%=statshelper.getCurrentStatName()%>" <%
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="statList" value="<%=statshelper.getCurrentStatName()%>" <%
if (statshelper.getCurrentIsLogged()) { %>checked="true" <% } %> ></td>
<td align="center">
<% if (statshelper.getCurrentCanBeGraphed()) { %>
<input id="<%=statshelper.getCurrentGroupName()%>" type="checkbox" class="optbox" name="graphList" value="<%=statshelper.getCurrentGraphName()%>" <%
<input type="checkbox" class="optbox <%=statshelper.getCurrentGroupName()%>" name="graphList" value="<%=statshelper.getCurrentGraphName()%>" <%
if (statshelper.getCurrentIsGraphed()) { %>checked="true" <% } %> ><% } %></td>
<td align="left"><b><%=statshelper.getCurrentStatName()%>:</b><br>
<%=statshelper.getCurrentStatDescription()%></td></tr><%
@ -110,4 +114,4 @@ function toggleAll(category)
<input type="reset" value="<%=intl._("Cancel")%>" >
<input type="submit" name="shouldsave" value="<%=intl._("Save changes")%>" >
</td></tr>
</table></p></div></form></div></div></body></html>
</table></div></form></div></div></body></html>

View File

@ -41,4 +41,4 @@
<input type="reset" value="<%=intl._("Cancel")%>" >
<input type="submit" name="shouldsave" value="<%=intl._("Save changes")%>" >
</div>
</form></p></div></div></div></body></html>
</form></div></div></div></body></html>