more cleanup and tagging; remove untranslatable button images; add button css

This commit is contained in:
zzz
2009-12-16 17:29:28 +00:00
parent f58f703ecb
commit fa92beae5a
14 changed files with 115 additions and 56 deletions

View File

@ -122,3 +122,31 @@ p.footer {
line-height: 160% !important; line-height: 160% !important;
-moz-box-shadow: inset 0px 0px 1px 0px #002; -moz-box-shadow: inset 0px 0px 1px 0px #002;
} }
input[type=submit] {
border: 1px outset #999;
background: #ddf;
color: #001;
margin: 5px;
font: bold 8pt "Lucida Sans Unicode", "Bitstream Vera Sans", Verdana, Tahoma, Helvetica, sans-serif;
padding: 1px 2px;
text-decoration: none;
min-width: 110px;
border-radius: 4px;
-moz-border-radius: 4px;
-khtml-border-radius: 4px;
-moz-box-shadow: inset 0px 2px 8px 0px #fff;
color: #006;
opacity: 0.9;
}
input[type=submit]:hover {
background: #22a;
color: #fff;
border: 1px solid #f60;
opacity: 1.0;
-moz-box-shadow: inset 0px 0px 0px 1px #fff;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -194,20 +194,27 @@ public class AddressbookBean
// addressbook.jsp catches the case where the whole book is empty. // addressbook.jsp catches the case where the whole book is empty.
String filterArg = ""; String filterArg = "";
if( search != null && search.length() > 0 ) { if( search != null && search.length() > 0 ) {
message = "Search "; message = _("Search") + ' ';
} }
if( filter != null && filter.length() > 0 ) { if( filter != null && filter.length() > 0 ) {
if( search != null && search.length() > 0 ) if( search != null && search.length() > 0 )
message += "within "; message = _("Search within filtered list") + ' ';
message += "Filtered list "; else
message = _("Filtered list") + ' ';
filterArg = "&filter=" + filter; filterArg = "&filter=" + filter;
} }
if (entries.length == 0) { if (entries.length == 0) {
message += "- no matches"; message += "- " + _("no matches") + '.';
} else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) { } else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) {
if (message.length() == 0) if (message.length() == 0)
message = "Addressbook "; message = _("Addressbook") + ' ';
message += "contains " + entries.length + " entries"; if (entries.length <= 0)
message += _("contains no entries");
else if (entries.length == 1)
message += _("contains 1 entry");
else
message += _("contains {0} entries", entries.length);
message += '.';
} else { } else {
if (getBeginInt() > 0) { if (getBeginInt() > 0) {
int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE); int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE);
@ -216,7 +223,7 @@ public class AddressbookBean
"&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin + "&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
'-' + newEnd + "</a> | "; '-' + newEnd + "</a> | ";
} }
message += "Showing " + getBegin() + '-' + getEnd() + " of " + entries.length; message += _("Showing {0} of {1}", "" + getBegin() + '-' + getEnd(), entries.length);
if (getEndInt() < entries.length - 1) { if (getEndInt() < entries.length - 1) {
int newBegin = Math.min(entries.length - 1, getEndInt() + 1); int newBegin = Math.min(entries.length - 1, getEndInt() + 1);
int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE); int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE);
@ -245,38 +252,43 @@ public class AddressbookBean
if( action != null ) { if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
boolean changed = false; boolean changed = false;
if( action.compareToIgnoreCase( "add") == 0 ) { int deleted = 0;
String name = null;
if (action.equals(_("Add"))) {
if( addressbook != null && hostname != null && destination != null ) { if( addressbook != null && hostname != null && destination != null ) {
addressbook.put( hostname, destination ); addressbook.put( hostname, destination );
changed = true; changed = true;
message += "Destination added.<br/>"; message = _("Destination added.");
// clear search when adding
search = null;
} }
} } else if (action.equals(_("Delete"))) {
if( action.compareToIgnoreCase( "delete" ) == 0 ) {
Iterator it = deletionMarks.iterator(); Iterator it = deletionMarks.iterator();
int deleted = 0;
while( it.hasNext() ) { while( it.hasNext() ) {
String name = (String)it.next(); name = (String)it.next();
addressbook.remove( name ); addressbook.remove( name );
changed = true; changed = true;
deleted++; deleted++;
} }
if( changed ) { if( changed ) {
message += "" + deleted + " destination(s) deleted.<br/>"; if (deleted == 1)
message = _("Destination {0} deleted.", name);
else
message = _("{0} destinations deleted.", deleted);
} }
} }
if( changed ) { if( changed ) {
try { try {
save(); save();
message += "Addressbook saved.<br/>"; message += "<br>" + _("Addressbook saved.");
} catch (Exception e) { } catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() ); Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
message += "ERROR: Could not write addressbook file.<br/>"; message += "<br>" + _("ERROR: Could not write addressbook file.");
} }
} }
} }
else { else {
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit.");
} }
} }
@ -364,4 +376,19 @@ public class AddressbookBean
endIndex = Integer.parseInt(s); endIndex = Integer.parseInt(s);
} catch (NumberFormatException nfe) {} } catch (NumberFormatException nfe) {}
} }
/** translate */
private static String _(String s) {
return Messages.getString(s);
}
/** translate */
private static String _(String s, Object o) {
return Messages.getString(s, o);
}
/** translate */
private static String _(String s, Object o, Object o2) {
return Messages.getString(s, o, o2);
}
} }

View File

@ -136,17 +136,16 @@ public class ConfigBean implements Serializable {
String message = ""; String message = "";
if( action != null ) { if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
if( action.compareToIgnoreCase( "save") == 0 ) { if(action.equals(_("Save"))) {
save(); save();
message = "Configuration saved."; message = _("Configuration saved.");
} } else if (action.equals(_("Reload"))) {
else if( action.compareToIgnoreCase( "reload") == 0 ) {
reload(); reload();
message = "Configuration reloaded."; message = _("Configuration reloaded.");
} }
} }
else { else {
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit.");
} }
} }
if( message.length() > 0 ) if( message.length() > 0 )
@ -162,4 +161,9 @@ public class ConfigBean implements Serializable {
public void setSerial(String serial ) { public void setSerial(String serial ) {
this.serial = serial; this.serial = serial;
} }
/** translate */
private static String _(String s) {
return Messages.getString(s);
}
} }

View File

@ -19,19 +19,15 @@ public class Messages {
return Translate.getString(key, _context, BUNDLE_NAME); return Translate.getString(key, _context, BUNDLE_NAME);
} }
/** public static String getString(String s) {
* translate a string with a parameter return Translate.getString(s, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
* This is a lot more expensive than getString(s, ctx), so use sparingly. }
*
* @param s string to be translated containing {0} public static String getString(String s, Object o) {
* The {0} will be replaced by the parameter. return Translate.getString(s, o, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
* Single quotes must be doubled, i.e. ' -> '' in the string. }
* @param o parameter, not translated.
* To tranlslate parameter also, use _("foo {0} bar", _("baz")) public static String getString(String s, Object o, Object o2) {
* Do not double the single quotes in the parameter. return Translate.getString(s, o, o2, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
* Use autoboxing to call with ints, longs, floats, etc.
*/
public String _(String s, Object o) {
return Translate.getString(s, o, _context, BUNDLE_NAME);
} }
} }

View File

@ -126,7 +126,7 @@ public class SubscriptionsBean
String message = ""; String message = "";
if( action != null ) { if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) { if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
if( action.compareToIgnoreCase( "save") == 0 ) { if (action.equals(_("Save"))) {
save(); save();
String nonce = System.getProperty("addressbook.nonce"); String nonce = System.getProperty("addressbook.nonce");
if (nonce != null) { if (nonce != null) {
@ -135,20 +135,19 @@ public class SubscriptionsBean
// Fetching from the addressbook servlet // Fetching from the addressbook servlet
// with the correct parameters will kick off a // with the correct parameters will kick off a
// config reload and fetch. // config reload and fetch.
message = "Subscriptions saved, updating addressbook from subscription sources now." + message = _("Subscriptions saved, updating addressbook from subscription sources now.") +
"<img height=\"1\" width=\"1\" alt=\"\" " + "<img height=\"1\" width=\"1\" alt=\"\" " +
"src=\"/addressbook/?wakeup=1&nonce=" + nonce + "\">"; "src=\"/addressbook/?wakeup=1&nonce=" + nonce + "\">";
} else { } else {
message = "Subscriptions saved."; message = _("Subscriptions saved.");
} }
} } else if (action.equals(_("Reload"))) {
else if( action.compareToIgnoreCase( "reload") == 0 ) {
reload(); reload();
message = "Subscriptions reloaded."; message = _("Subscriptions reloaded.");
} }
} }
else { else {
message = "Invalid form submission, probably because you used the 'back' or 'reload' button on your browser. Please resubmit."; message = _("Invalid form submission, probably because you used the \"back\" or \"reload\" button on your browser. Please resubmit.");
} }
} }
if( message.length() > 0 ) if( message.length() > 0 )
@ -183,4 +182,9 @@ public class SubscriptionsBean
return content; return content;
} }
/** translate */
private static String _(String s) {
return Messages.getString(s);
}
} }

View File

@ -38,7 +38,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>${book.book} <%=intl._("addressbook")%> - susidns v${version.version}</title> <title>${book.book} <%=intl._("addressbook")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="css.css">
</head> </head>
<body> <body>
@ -111,7 +111,7 @@
<div id="search"> <div id="search">
<table><tr> <table><tr>
<td class="search"><%=intl._("Search")%>: <input type="text" name="search" value="${book.search}" size="20" ></td> <td class="search"><%=intl._("Search")%>: <input type="text" name="search" value="${book.search}" size="20" ></td>
<td class="search"><input type="image" src="images/search.png" name="submitsearch" value="search" alt="Search" ></td> <td class="search"><input type="submit" name="submitsearch" value="<%=intl._("Search")%>" ></td>
</tr> </tr>
</table> </table>
</div> </div>
@ -155,7 +155,7 @@
<c:if test="${book.master || book.router || book.published || book.private}"> <c:if test="${book.master || book.router || book.published || book.private}">
<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="submit" name="action" value="<%=intl._("Delete")%>" >
</p> </p>
</div> </div>
</c:if> </c:if>
@ -174,7 +174,7 @@
<b><%=intl._("Hostname")%>:</b> <input type="text" name="hostname" value="${book.hostname}" size="20"> <b><%=intl._("Hostname")%>:</b> <input type="text" name="hostname" value="${book.hostname}" size="20">
<b><%=intl._("Destination")%>:</b> <textarea name="destination" rows="1" style="height: 3em;" cols="40" wrap="off" >${book.destination}</textarea><br/> <b><%=intl._("Destination")%>:</b> <textarea name="destination" rows="1" style="height: 3em;" cols="40" wrap="off" >${book.destination}</textarea><br/>
</p><p> </p><p>
<input type="image" name="action" value="add" src="images/add.png" alt="Add destination" > <input type="submit" name="action" value="<%=intl._("Add")%>" >
</p> </p>
</div> </div>

View File

@ -34,7 +34,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%=intl._("configuration")%> - susidns v${version.version}</title> <title><%=intl._("configuration")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="css.css">
</head> </head>
<body> <body>
@ -64,8 +64,8 @@
<textarea name="config" rows="10" cols="80">${cfg.config}</textarea> <textarea name="config" rows="10" cols="80">${cfg.config}</textarea>
</div> </div>
<div id="buttons"> <div id="buttons">
<input type="image" src="images/save.png" name="action" value="save" alt="Save Config"> <input type="submit" name="action" value="<%=intl._("Save")%>" >
<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Config"> <input type="submit" name="action" value="<%=intl._("Reload")%>" >
</div> </div>
</form> </form>
<div id="help"> <div id="help">

View File

@ -32,7 +32,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%=intl._("Introduction")%> - SusiDNS v${version.version}</title> <title><%=intl._("Introduction")%> - SusiDNS</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="css.css">
</head> </head>
<body> <body>

View File

@ -34,7 +34,7 @@
<html> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><%=intl._("subscriptions")%> - susidns v${version.version}</title> <title><%=intl._("subscriptions")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="css.css">
</head> </head>
<body> <body>
@ -64,8 +64,8 @@
<textarea name="content" rows="10" cols="80">${subs.content}</textarea> <textarea name="content" rows="10" cols="80">${subs.content}</textarea>
</div> </div>
<div id="buttons"> <div id="buttons">
<input type="image" src="images/save.png" name="action" value="save" alt="Save Subscriptions" > <input type="submit" name="action" value="<%=intl._("Save")%>" >
<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Subscriptions" > <input type="submit" name="action" value="<%=intl._("Reload")%>" >
</div> </div>
</form> </form>
<div id="help"> <div id="help">