I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit fa92beae authored by zzz's avatar zzz
Browse files

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

parent f58f703e
No related branches found
No related tags found
No related merge requests found
Showing
with 115 additions and 56 deletions
......@@ -121,4 +121,32 @@ p.footer {
font-size: 10pt !important;
line-height: 160% !important;
-moz-box-shadow: inset 0px 0px 1px 0px #002;
}
\ No newline at end of file
}
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;
}
apps/susidns/src/images/add.png

2.43 KiB

apps/susidns/src/images/delete.png

3.21 KiB

apps/susidns/src/images/reload.png

2.65 KiB

apps/susidns/src/images/save.png

2.52 KiB

apps/susidns/src/images/search.png

2.7 KiB

......@@ -194,20 +194,27 @@ public class AddressbookBean
// addressbook.jsp catches the case where the whole book is empty.
String filterArg = "";
if( search != null && search.length() > 0 ) {
message = "Search ";
message = _("Search") + ' ';
}
if( filter != null && filter.length() > 0 ) {
if( search != null && search.length() > 0 )
message += "within ";
message += "Filtered list ";
message = _("Search within filtered list") + ' ';
else
message = _("Filtered list") + ' ';
filterArg = "&filter=" + filter;
}
if (entries.length == 0) {
message += "- no matches";
message += "- " + _("no matches") + '.';
} else if (getBeginInt() == 0 && getEndInt() == entries.length - 1) {
if (message.length() == 0)
message = "Addressbook ";
message += "contains " + entries.length + " entries";
message = _("Addressbook") + ' ';
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 {
if (getBeginInt() > 0) {
int newBegin = Math.max(0, getBeginInt() - DISPLAY_SIZE);
......@@ -216,7 +223,7 @@ public class AddressbookBean
"&begin=" + newBegin + "&end=" + newEnd + "\">" + newBegin +
'-' + newEnd + "</a> | ";
}
message += "Showing " + getBegin() + '-' + getEnd() + " of " + entries.length;
message += _("Showing {0} of {1}", "" + getBegin() + '-' + getEnd(), entries.length);
if (getEndInt() < entries.length - 1) {
int newBegin = Math.min(entries.length - 1, getEndInt() + 1);
int newEnd = Math.min(entries.length, getEndInt() + DISPLAY_SIZE);
......@@ -245,38 +252,43 @@ public class AddressbookBean
if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
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 ) {
addressbook.put( hostname, destination );
changed = true;
message += "Destination added.<br/>";
message = _("Destination added.");
// clear search when adding
search = null;
}
}
if( action.compareToIgnoreCase( "delete" ) == 0 ) {
} else if (action.equals(_("Delete"))) {
Iterator it = deletionMarks.iterator();
int deleted = 0;
while( it.hasNext() ) {
String name = (String)it.next();
name = (String)it.next();
addressbook.remove( name );
changed = true;
deleted++;
}
if( changed ) {
message += "" + deleted + " destination(s) deleted.<br/>";
if (deleted == 1)
message = _("Destination {0} deleted.", name);
else
message = _("{0} destinations deleted.", deleted);
}
}
if( changed ) {
try {
save();
message += "Addressbook saved.<br/>";
message += "<br>" + _("Addressbook saved.");
} catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
message += "ERROR: Could not write addressbook file.<br/>";
message += "<br>" + _("ERROR: Could not write addressbook file.");
}
}
}
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);
} 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);
}
}
......@@ -136,17 +136,16 @@ public class ConfigBean implements Serializable {
String message = "";
if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
if( action.compareToIgnoreCase( "save") == 0 ) {
if(action.equals(_("Save"))) {
save();
message = "Configuration saved.";
}
else if( action.compareToIgnoreCase( "reload") == 0 ) {
message = _("Configuration saved.");
} else if (action.equals(_("Reload"))) {
reload();
message = "Configuration reloaded.";
message = _("Configuration reloaded.");
}
}
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 )
......@@ -162,4 +161,9 @@ public class ConfigBean implements Serializable {
public void setSerial(String serial ) {
this.serial = serial;
}
/** translate */
private static String _(String s) {
return Messages.getString(s);
}
}
......@@ -19,19 +19,15 @@ public class Messages {
return Translate.getString(key, _context, BUNDLE_NAME);
}
/**
* translate a string with a parameter
* This is a lot more expensive than getString(s, ctx), so use sparingly.
*
* @param s string to be translated containing {0}
* The {0} will be replaced by the parameter.
* Single quotes must be doubled, i.e. ' -> '' in the string.
* @param o parameter, not translated.
* To tranlslate parameter also, use _("foo {0} bar", _("baz"))
* Do not double the single quotes in the parameter.
* Use autoboxing to call with ints, longs, floats, etc.
*/
public String _(String s, Object o) {
return Translate.getString(s, o, _context, BUNDLE_NAME);
public static String getString(String s) {
return Translate.getString(s, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
}
public static String getString(String s, Object o) {
return Translate.getString(s, o, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
}
public static String getString(String s, Object o, Object o2) {
return Translate.getString(s, o, o2, I2PAppContext.getGlobalContext(), BUNDLE_NAME);
}
}
......@@ -126,7 +126,7 @@ public class SubscriptionsBean
String message = "";
if( action != null ) {
if( lastSerial != null && serial != null && serial.compareTo( lastSerial ) == 0 ) {
if( action.compareToIgnoreCase( "save") == 0 ) {
if (action.equals(_("Save"))) {
save();
String nonce = System.getProperty("addressbook.nonce");
if (nonce != null) {
......@@ -135,20 +135,19 @@ public class SubscriptionsBean
// Fetching from the addressbook servlet
// with the correct parameters will kick off a
// 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=\"\" " +
"src=\"/addressbook/?wakeup=1&nonce=" + nonce + "\">";
} else {
message = "Subscriptions saved.";
message = _("Subscriptions saved.");
}
}
else if( action.compareToIgnoreCase( "reload") == 0 ) {
} else if (action.equals(_("Reload"))) {
reload();
message = "Subscriptions reloaded.";
message = _("Subscriptions reloaded.");
}
}
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 )
......@@ -183,4 +182,9 @@ public class SubscriptionsBean
return content;
}
/** translate */
private static String _(String s) {
return Messages.getString(s);
}
}
......@@ -38,7 +38,7 @@
<html>
<head>
<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">
</head>
<body>
......@@ -111,7 +111,7 @@
<div id="search">
<table><tr>
<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>
</table>
</div>
......@@ -155,7 +155,7 @@
<c:if test="${book.master || book.router || book.published || book.private}">
<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>
</div>
</c:if>
......@@ -174,7 +174,7 @@
<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/>
</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>
</div>
......
......@@ -34,7 +34,7 @@
<html>
<head>
<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">
</head>
<body>
......@@ -64,8 +64,8 @@
<textarea name="config" rows="10" cols="80">${cfg.config}</textarea>
</div>
<div id="buttons">
<input type="image" src="images/save.png" name="action" value="save" alt="Save Config">
<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Config">
<input type="submit" name="action" value="<%=intl._("Save")%>" >
<input type="submit" name="action" value="<%=intl._("Reload")%>" >
</div>
</form>
<div id="help">
......
......@@ -32,7 +32,7 @@
<html>
<head>
<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">
</head>
<body>
......
......@@ -34,7 +34,7 @@
<html>
<head>
<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">
</head>
<body>
......@@ -64,8 +64,8 @@
<textarea name="content" rows="10" cols="80">${subs.content}</textarea>
</div>
<div id="buttons">
<input type="image" src="images/save.png" name="action" value="save" alt="Save Subscriptions" >
<input type="image" src="images/reload.png" name="action" value="reload" alt="Reload Subscriptions" >
<input type="submit" name="action" value="<%=intl._("Save")%>" >
<input type="submit" name="action" value="<%=intl._("Reload")%>" >
</div>
</form>
<div id="help">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment