source: apps/susidns/src/jsp/details.jsp @ 7713284

Last change on this file since 7713284 was 7713284, checked in by zzz <zzz@…>, 3 years ago

SusiDNS: Fix deleting notes (ticket #1433)
Hide advanced fields in published entries

  • Property mode set to 100644
File size: 8.0 KB
Line 
1<%
2/*
3 *  This file is part of susidns project, see http://susi.i2p/
4 * 
5 *  Copyright (C) 2005 <susi23@mail.i2p>
6 *
7 *  This program is free software; you can redistribute it and/or modify
8 *  it under the terms of the GNU General Public License as published by
9 *  the Free Software Foundation; either version 2 of the License, or
10 *  (at your option) any later version.
11 *
12 *  This program is distributed in the hope that it will be useful,
13 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 *  GNU General Public License for more details.
16 *
17 *  You should have received a copy of the GNU General Public License
18 *  along with this program; if not, write to the Free Software
19 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20 * 
21 */
22
23    // http://www.crazysquirrel.com/computing/general/form-encoding.jspx
24    if (request.getCharacterEncoding() == null)
25        request.setCharacterEncoding("UTF-8");
26
27    response.setHeader("X-Frame-Options", "SAMEORIGIN");
28    response.setHeader("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'");
29    response.setHeader("X-XSS-Protection", "1; mode=block");
30    response.setHeader("X-Content-Type-Options", "nosniff");
31    response.setHeader("Referrer-Policy", "no-referrer");
32    response.setHeader("Accept-Ranges", "none");
33
34%>
35<%@page pageEncoding="UTF-8"%>
36<%@ page contentType="text/html"%>
37<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
38<jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application" />
39<jsp:useBean id="book" class="i2p.susi.dns.NamingServiceBean" scope="session" />
40<jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" />
41<jsp:setProperty name="book" property="*" />
42<jsp:setProperty name="book" property="resetDeletionMarks" value="1"/>
43<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
44<html>
45<head>
46<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
47<title>${book.book} <%=intl._t("addressbook")%> - susidns</title>
48<link rel="stylesheet" type="text/css" href="<%=book.getTheme()%>susidns.css?<%=net.i2p.CoreVersion.VERSION%>">
49</head>
50<body>
51<div class="page">
52<div id="logo">
53<a href="index"><img src="<%=book.getTheme()%>images/logo.png" alt="" title="<%=intl._t("Overview")%>" border="0"/></a>
54</div>
55<hr>
56<div id="navi">
57<a id="overview" href="index"><%=intl._t("Overview")%></a>&nbsp;
58<a class="abook" href="addressbook?book=private&amp;filter=none"><%=intl._t("Private")%></a>&nbsp;
59<a class="abook" href="addressbook?book=master&amp;filter=none"><%=intl._t("Master")%></a>&nbsp;
60<a class="abook" href="addressbook?book=router&amp;filter=none"><%=intl._t("Router")%></a>&nbsp;
61<a class="abook" href="addressbook?book=published&amp;filter=none"><%=intl._t("Published")%></a>&nbsp;
62<a id="subs" href="subscriptions"><%=intl._t("Subscriptions")%></a>&nbsp;
63<a id="config" href="config"><%=intl._t("Configuration")%></a>
64</div>
65<hr>
66<div class="headline">
67<h3><%=intl._t("Address book")%>: <%=intl._t(book.getBook())%></h3>
68<h4><%=intl._t("Storage")%>: ${book.displayName}</h4>
69</div>
70<div id="book">
71<%
72    String detail = request.getParameter("h");
73    if (detail == null) {
74        %><p>No host specified</p><%
75    } else {
76        // process save notes form
77        book.saveNotes();
78        detail = net.i2p.data.DataHelper.stripHTML(detail);
79        java.util.List<i2p.susi.dns.AddressBean> addrs = book.getLookupAll();
80        if (addrs == null) {
81            %><p>Not found: <%=detail%></p><%
82        } else {
83            boolean haveImagegen = book.haveImagegen();
84            // use one nonce for all
85            String nonce = book.getSerial();
86            boolean showNotes = !book.getBook().equals("published");
87            for (i2p.susi.dns.AddressBean addr : addrs) {
88                String b32 = addr.getB32();
89%>
90<jsp:setProperty name="book" property="trClass" value="0" />
91<% if (showNotes) { %>
92<form method="POST" action="details">
93<input type="hidden" name="book" value="${book.book}">
94<input type="hidden" name="serial" value="<%=nonce%>">
95<input type="hidden" name="h" value="<%=detail%>">
96<input type="hidden" name="destination" value="<%=addr.getDestination()%>">
97<% }  // showNotes  %>
98<table class="book" id="host_details" cellspacing="0" cellpadding="5">
99<tr class="list${book.trClass}">
100<td><%=intl._t("Hostname")%></td>
101<td><a href="http://<%=addr.getName()%>/" target="_top"><%=addr.getDisplayName()%></a></td>
102</tr>
103<tr class="list${book.trClass}">
104<%
105    if (addr.isIDN()) {
106%>
107<td><%=intl._t("Encoded Name")%></td>
108<td><a href="http://<%=addr.getName()%>/" target="_top"><%=addr.getName()%></a></td>
109</tr>
110<tr class="list${book.trClass}">
111<%
112    }
113%>
114<td><%=intl._t("Base 32 Address")%></td>
115<td><a href="http://<%=b32%>/" target="_top"><%=b32%></a></td>
116</tr>
117<tr class="list${book.trClass}">
118<td><%=intl._t("Base 64 Hash")%></td>
119<td><%=addr.getB64()%></td>
120</tr>
121<tr class="list${book.trClass}">
122<td><%=intl._t("Address Helper")%></td>
123<td><a href="http://<%=addr.getName()%>/?i2paddresshelper=<%=addr.getDestination()%>" target="_top"><%=intl._t("link")%></a></td>
124</tr>
125<tr class="list${book.trClass}">
126<td><%=intl._t("Public Key")%></td>
127<td><%=intl._t("ElGamal 2048 bit")%></td>
128</tr>
129<tr class="list${book.trClass}">
130<td><%=intl._t("Signing Key")%></td>
131<td><%=addr.getSigType()%></td>
132</tr>
133<tr class="list${book.trClass}">
134<td><%=intl._t("Certificate")%></td>
135<td><%=addr.getCert()%></td>
136</tr>
137<tr class="list${book.trClass}">
138<td><%=intl._t("Validated")%></td>
139<td><%=addr.isValidated() ? intl._t("yes") : intl._t("no")%></td>
140</tr>
141<% if (showNotes) { %>
142<tr class="list${book.trClass}">
143<td><%=intl._t("Source")%></td>
144<td><%=addr.getSource()%></td>
145</tr>
146<tr class="list${book.trClass}">
147<td><%=intl._t("Added Date")%></td>
148<td><%=addr.getAdded()%></td>
149</tr>
150<tr class="list${book.trClass}">
151<td><%=intl._t("Last Modified")%></td>
152<td><%=addr.getModded()%></td>
153</tr>
154<% }  // showNotes  %>
155<tr class="list${book.trClass}">
156<td><%=intl._t("Destination")%></td>
157<td class="destinations"><div class="destaddress" tabindex="0"><%=addr.getDestination()%></div></td>
158</tr>
159<% if (showNotes) { %>
160<tr class="list${book.trClass}">
161<td><%=intl._t("Notes")%><br>
162<input class="accept" type="submit" name="action" value="<%=intl._t("Save Notes")%>"></td>
163<td><textarea name="nofilter_notes" rows="3" style="height:6em" wrap="off" cols="70"><%=addr.getNotes()%></textarea></td>
164</tr>
165<% }  // showNotes  %>
166</table>
167<% if (showNotes) { %>
168</form>
169<% }  // showNotes  %>
170<div id="buttons">
171<form method="POST" action="addressbook">
172<p class="buttons">
173<input type="hidden" name="book" value="${book.book}">
174<input type="hidden" name="serial" value="<%=nonce%>">
175<input type="hidden" name="begin" value="0">
176<input type="hidden" name="end" value="49">
177<input type="hidden" name="checked" value="<%=detail%>">
178<input type="hidden" name="destination" value="<%=addr.getDestination()%>">
179<input class="delete" type="submit" name="action" value="<%=intl._t("Delete Entry")%>" >
180</p>
181</form>
182</div><%-- buttons --%>
183<%
184                if (haveImagegen) {
185%>
186<div id="visualid">
187<h3><%=intl._t("Visual Identification for")%> <span id="idAddress"><%=addr.getName()%></span></h3>
188<table>
189<tr>
190<td><img src="/imagegen/id?s=256&amp;c=<%=addr.getB64().replace("=", "%3d")%>" width="256" height="256"></td>
191<td><img src="/imagegen/qr?s=384&amp;t=<%=addr.getName()%>&amp;c=http%3a%2f%2f<%=addr.getName()%>%2f%3fi2paddresshelper%3d<%=addr.getDestination()%>"></td>
192</tr>
193<tr>
194<td colspan="2"><a class="fakebutton" href="/imagegen" title="<%=intl._t("Create your own identification images")%>" target="_blank"><%=intl._t("Launch Image Generator")%></a></td>
195</tr>
196</table>
197</div><%-- visualid --%>
198<%
199                }  // haveImagegen
200%>
201<hr>
202<%
203            }  // foreach addr
204        }  // addrs == null
205    }  // detail == null
206%>
207</div><%-- book --%>
208<div id="footer">
209<p class="footer">susidns v${version.version} &copy; <a href="${version.url}" target="_top">susi</a> 2005</p>
210</div>
211</div><%-- page --%>
212</body>
213</html>
Note: See TracBrowser for help on using the repository browser.