2006-09-03 Complication
* Limit form size in SusiDNS to avoid exceeding a POST size limit on postback * Print messages about addressbook size to give better overview * Enable delete function in published addressbook
This commit is contained in:
@ -19,7 +19,7 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
* $Revision: 1.7 $
|
* $Revision: 1.1 $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package i2p.susi.dns;
|
package i2p.susi.dns;
|
||||||
@ -99,7 +99,6 @@ public class AddressbookBean
|
|||||||
return ConfigBean.addressbookPrefix + filename;
|
return ConfigBean.addressbookPrefix + filename;
|
||||||
}
|
}
|
||||||
private Object[] entries;
|
private Object[] entries;
|
||||||
|
|
||||||
public Object[] getEntries()
|
public Object[] getEntries()
|
||||||
{
|
{
|
||||||
return entries;
|
return entries;
|
||||||
@ -130,10 +129,59 @@ public class AddressbookBean
|
|||||||
public void setSerial(String serial) {
|
public void setSerial(String serial) {
|
||||||
this.serial = serial;
|
this.serial = serial;
|
||||||
}
|
}
|
||||||
|
/** Load addressbook and apply filter, returning messages about this. */
|
||||||
|
public String getLoadBookMessages()
|
||||||
|
{
|
||||||
|
// Config and addressbook now loaded here, hence not needed in getMessages()
|
||||||
|
loadConfig();
|
||||||
|
addressbook = new Properties();
|
||||||
|
|
||||||
|
String message = "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
addressbook.load( new FileInputStream( getFileName() ) );
|
||||||
|
LinkedList list = new LinkedList();
|
||||||
|
Enumeration e = addressbook.keys();
|
||||||
|
while( e.hasMoreElements() ) {
|
||||||
|
String name = (String)e.nextElement();
|
||||||
|
String destination = addressbook.getProperty( name );
|
||||||
|
if( filter != null && filter.length() > 0 ) {
|
||||||
|
if( filter.compareTo( "0-9" ) == 0 ) {
|
||||||
|
char first = name.charAt(0);
|
||||||
|
if( first < '0' || first > '9' )
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if( search != null && search.length() > 0 ) {
|
||||||
|
if( name.indexOf( search ) == -1 ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list.addLast( new AddressBean( name, destination ) );
|
||||||
|
}
|
||||||
|
// Format a message about filtered addressbook size, and the number of displayed entries
|
||||||
|
message = "Filtered list contains " + list.size() + " entries";
|
||||||
|
if (list.size() > 300) message += ", displaying the first 300."; else message += ".";
|
||||||
|
|
||||||
|
Object array[] = list.toArray();
|
||||||
|
Arrays.sort( array, sorter );
|
||||||
|
entries = array;
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( message.length() > 0 )
|
||||||
|
message = "<p>" + message + "</p>";
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
/** Perform actions, returning messages about this. */
|
||||||
public String getMessages()
|
public String getMessages()
|
||||||
{
|
{
|
||||||
loadConfig();
|
// Loading config and addressbook moved into getLoadBookMessages()
|
||||||
|
|
||||||
String message = "";
|
String message = "";
|
||||||
|
|
||||||
if( action != null ) {
|
if( action != null ) {
|
||||||
@ -176,41 +224,6 @@ public class AddressbookBean
|
|||||||
|
|
||||||
action = null;
|
action = null;
|
||||||
|
|
||||||
addressbook = new Properties();
|
|
||||||
|
|
||||||
try {
|
|
||||||
addressbook.load( new FileInputStream( getFileName() ) );
|
|
||||||
LinkedList list = new LinkedList();
|
|
||||||
Enumeration e = addressbook.keys();
|
|
||||||
while( e.hasMoreElements() ) {
|
|
||||||
String name = (String)e.nextElement();
|
|
||||||
String destination = addressbook.getProperty( name );
|
|
||||||
if( filter != null && filter.length() > 0 ) {
|
|
||||||
if( filter.compareTo( "0-9" ) == 0 ) {
|
|
||||||
char first = name.charAt(0);
|
|
||||||
if( first < '0' || first > '9' )
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
else if( ! name.toLowerCase().startsWith( filter.toLowerCase() ) ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if( search != null && search.length() > 0 ) {
|
|
||||||
if( name.indexOf( search ) == -1 ) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
list.addLast( new AddressBean( name, destination ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Object array[] = list.toArray();
|
|
||||||
Arrays.sort( array, sorter );
|
|
||||||
entries = array;
|
|
||||||
}
|
|
||||||
catch (Exception e) {
|
|
||||||
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( message.length() > 0 )
|
if( message.length() > 0 )
|
||||||
message = "<p class=\"messages\">" + message + "</p>";
|
message = "<p class=\"messages\">" + message + "</p>";
|
||||||
return message;
|
return message;
|
||||||
@ -234,6 +247,10 @@ public class AddressbookBean
|
|||||||
{
|
{
|
||||||
return getBook().compareToIgnoreCase( "router" ) == 0;
|
return getBook().compareToIgnoreCase( "router" ) == 0;
|
||||||
}
|
}
|
||||||
|
public boolean isPublished()
|
||||||
|
{
|
||||||
|
return getBook().compareToIgnoreCase( "published" ) == 0;
|
||||||
|
}
|
||||||
public void setFilter(String filter) {
|
public void setFilter(String filter) {
|
||||||
if( filter != null && ( filter.length() == 0 || filter.compareToIgnoreCase( "none" ) == 0 ) ) {
|
if( filter != null && ( filter.length() == 0 || filter.compareToIgnoreCase( "none" ) == 0 ) ) {
|
||||||
filter = null;
|
filter = null;
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
* along with this program; if not, write to the Free Software
|
* along with this program; if not, write to the Free Software
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*
|
*
|
||||||
* $Revision: 1.1 $
|
* $Revision: 1.2 $
|
||||||
*/
|
*/
|
||||||
%>
|
%>
|
||||||
<%@ page contentType="text/html"%>
|
<%@ page contentType="text/html"%>
|
||||||
@ -60,6 +60,8 @@
|
|||||||
|
|
||||||
<div id="messages">${book.messages}</div>
|
<div id="messages">${book.messages}</div>
|
||||||
|
|
||||||
|
<span>${book.loadBookMessages}</span>
|
||||||
|
|
||||||
<div id="filter">
|
<div id="filter">
|
||||||
<p>Filter: <a href="addressbook.jsp?filter=a">a</a>
|
<p>Filter: <a href="addressbook.jsp?filter=a">a</a>
|
||||||
<a href="addressbook.jsp?filter=b">b</a>
|
<a href="addressbook.jsp?filter=b">b</a>
|
||||||
@ -115,16 +117,17 @@
|
|||||||
<table class="book" cellspacing="0" cellpadding="5">
|
<table class="book" cellspacing="0" cellpadding="5">
|
||||||
<tr class="head">
|
<tr class="head">
|
||||||
|
|
||||||
<c:if test="${book.master || book.router}">
|
<c:if test="${book.master || book.router || book.published}">
|
||||||
<th> </th>
|
<th> </th>
|
||||||
</c:if>
|
</c:if>
|
||||||
|
|
||||||
<th>Name</th>
|
<th>Name</th>
|
||||||
<th>Destination</th>
|
<th>Destination</th>
|
||||||
</tr>
|
</tr>
|
||||||
<c:forEach items="${book.entries}" var="addr">
|
<!-- limit iterator to 300, or "Form too large" may result on submit -->
|
||||||
|
<c:forEach items="${book.entries}" var="addr" begin="0" end="299">
|
||||||
<tr class="list${book.trClass}">
|
<tr class="list${book.trClass}">
|
||||||
<c:if test="${book.master || book.router}">
|
<c:if test="${book.master || book.router || book.published}">
|
||||||
<td class="checkbox"><input type="checkbox" name="checked" value="${addr.name}" alt="Mark for deletion"></td>
|
<td class="checkbox"><input type="checkbox" name="checked" value="${addr.name}" alt="Mark for deletion"></td>
|
||||||
</c:if>
|
</c:if>
|
||||||
<td class="names"><a href="http://${addr.name}/">${addr.name}</a> -
|
<td class="names"><a href="http://${addr.name}/">${addr.name}</a> -
|
||||||
@ -136,7 +139,7 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<c:if test="${book.master || book.router}">
|
<c:if test="${book.master || book.router || book.published}">
|
||||||
<div id="buttons">
|
<div id="buttons">
|
||||||
<p class="buttons"><input type="image" name="action" value="delete" src="images/delete.png" alt="Delete checked" />
|
<p class="buttons"><input type="image" name="action" value="delete" src="images/delete.png" alt="Delete checked" />
|
||||||
</p>
|
</p>
|
||||||
|
@ -1,4 +1,9 @@
|
|||||||
$Id: history.txt,v 1.505 2006-08-03 17:34:25 jrandom Exp $
|
$Id: history.txt,v 1.506 2006-08-21 00:55:34 complication Exp $
|
||||||
|
|
||||||
|
2006-09-03 Complication
|
||||||
|
* Limit form size in SusiDNS to avoid exceeding a POST size limit on postback
|
||||||
|
* Print messages about addressbook size to give better overview
|
||||||
|
* Enable delete function in published addressbook
|
||||||
|
|
||||||
2006-08-21 Complication
|
2006-08-21 Complication
|
||||||
* Fix error reporting discrepancy (thanks for helping notice, yojoe!)
|
* Fix error reporting discrepancy (thanks for helping notice, yojoe!)
|
||||||
|
@ -15,9 +15,9 @@ import net.i2p.CoreVersion;
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class RouterVersion {
|
public class RouterVersion {
|
||||||
public final static String ID = "$Revision: 1.445 $ $Date: 2006-08-03 17:34:26 $";
|
public final static String ID = "$Revision: 1.446 $ $Date: 2006-08-21 00:55:34 $";
|
||||||
public final static String VERSION = "0.6.1.24";
|
public final static String VERSION = "0.6.1.24";
|
||||||
public final static long BUILD = 4;
|
public final static long BUILD = 5;
|
||||||
public static void main(String args[]) {
|
public static void main(String args[]) {
|
||||||
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
System.out.println("I2P Router version: " + VERSION + "-" + BUILD);
|
||||||
System.out.println("Router ID: " + RouterVersion.ID);
|
System.out.println("Router ID: " + RouterVersion.ID);
|
||||||
|
Reference in New Issue
Block a user