Moved susidns CSS into themes dir (required moving loadConfig into BaseBean.java)

This commit is contained in:
str4d
2012-07-14 06:27:23 +00:00
parent e0ff0c63c8
commit 50cfd52c23
12 changed files with 80 additions and 72 deletions

View File

@@ -40,11 +40,10 @@ import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.util.SecureFileOutputStream; import net.i2p.util.SecureFileOutputStream;
public class AddressbookBean public class AddressbookBean extends BaseBean
{ {
protected String book, action, serial, lastSerial, filter, search, hostname, destination; protected String book, action, serial, lastSerial, filter, search, hostname, destination;
protected int beginIndex, endIndex; protected int beginIndex, endIndex;
protected final Properties properties;
private Properties addressbook; private Properties addressbook;
private int trClass; private int trClass;
protected final LinkedList<String> deletionMarks; protected final LinkedList<String> deletionMarks;
@@ -82,41 +81,12 @@ public class AddressbookBean
public AddressbookBean() public AddressbookBean()
{ {
properties = new Properties(); super();
deletionMarks = new LinkedList(); deletionMarks = new LinkedList();
beginIndex = 0; beginIndex = 0;
endIndex = DISPLAY_SIZE - 1; endIndex = DISPLAY_SIZE - 1;
} }
private long configLastLoaded = 0;
private static final String PRIVATE_BOOK = "private_addressbook";
private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt";
protected void loadConfig()
{
long currentTime = System.currentTimeMillis();
if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 )
return;
FileInputStream fis = null;
try {
properties.clear();
fis = new FileInputStream( ConfigBean.configFileName );
properties.load( fis );
// added in 0.5, for compatibility with 0.4 config.txt
if( properties.getProperty(PRIVATE_BOOK) == null)
properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK);
configLastLoaded = currentTime;
}
catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
} finally {
if (fis != null)
try { fis.close(); } catch (IOException ioe) {}
}
}
public String getFileName() public String getFileName()
{ {
loadConfig(); loadConfig();

View File

@@ -0,0 +1,64 @@
package i2p.susi.dns;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.Properties;
/**
* Holds methods common to several Beans.
* @since 0.9.1
*/
public class BaseBean
{
protected final Properties properties;
private long configLastLoaded = 0;
private static final String PRIVATE_BOOK = "private_addressbook";
private static final String DEFAULT_PRIVATE_BOOK = "../privatehosts.txt";
public static final String PROP_THEME_NAME = "theme";
public static final String DEFAULT_THEME = "light";
public static final String BASE_THEME_PATH = "/themes/susidns/";
public BaseBean()
{
properties = new Properties();
}
protected void loadConfig()
{
long currentTime = System.currentTimeMillis();
if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 )
return;
FileInputStream fis = null;
try {
properties.clear();
fis = new FileInputStream( ConfigBean.configFileName );
properties.load( fis );
// added in 0.5, for compatibility with 0.4 config.txt
if( properties.getProperty(PRIVATE_BOOK) == null)
properties.setProperty(PRIVATE_BOOK, DEFAULT_PRIVATE_BOOK);
configLastLoaded = currentTime;
}
catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
} finally {
if (fis != null)
try { fis.close(); } catch (IOException ioe) {}
}
}
/**
* Returns the theme path
* @since 0.9.1
*/
public String getTheme() {
loadConfig();
String url = BASE_THEME_PATH;
String theme = properties.getProperty(PROP_THEME_NAME, DEFAULT_THEME);
url += theme + "/";
return url;
}
}

View File

@@ -36,38 +36,10 @@ import java.util.Properties;
import net.i2p.I2PAppContext; import net.i2p.I2PAppContext;
import net.i2p.util.SecureFileOutputStream; import net.i2p.util.SecureFileOutputStream;
public class SubscriptionsBean public class SubscriptionsBean extends BaseBean
{ {
private String action, fileName, content, serial, lastSerial; private String action, fileName, content, serial, lastSerial;
Properties properties;
public SubscriptionsBean()
{
properties = new Properties();
}
private long configLastLoaded = 0;
private void loadConfig()
{
long currentTime = System.currentTimeMillis();
if( !properties.isEmpty() && currentTime - configLastLoaded < 10000 )
return;
FileInputStream fis = null;
try {
properties.clear();
fis = new FileInputStream( ConfigBean.configFileName );
properties.load( fis );
configLastLoaded = currentTime;
}
catch (Exception e) {
Debug.debug( e.getClass().getName() + ": " + e.getMessage() );
} finally {
if (fis != null)
try { fis.close(); } catch (IOException ioe) {}
}
}
public String getAction() { public String getAction() {
return action; return action;
} }

View File

@@ -47,12 +47,12 @@
<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._("address book")%> - susidns</title> <title>${book.book} <%=intl._("address book")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="<%=book.getTheme()%>susidns.css">
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div id="logo"> <div id="logo">
<a href="index"><img src="images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a> <a href="index"><img src="<%=book.getTheme()%>images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a>
</div> </div>
<hr> <hr>
<div id="navi"> <div id="navi">

View File

@@ -36,6 +36,7 @@
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application"/> <jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application"/>
<jsp:useBean id="cfg" class="i2p.susi.dns.ConfigBean" scope="session"/> <jsp:useBean id="cfg" class="i2p.susi.dns.ConfigBean" scope="session"/>
<jsp:useBean id="base" class="i2p.susi.dns.BaseBean" scope="session" />
<jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" /> <jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" />
<jsp:setProperty name="cfg" property="*" /> <jsp:setProperty name="cfg" property="*" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
@@ -43,12 +44,12 @@
<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</title> <title><%=intl._("configuration")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="<%=base.getTheme()%>susidns.css">
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div id="logo"> <div id="logo">
<a href="index"><img src="images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a> <a href="index"><img src="<%=base.getTheme()%>images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a>
</div><hr> </div><hr>
<div id="navi"> <div id="navi">
<p> <p>

View File

@@ -41,12 +41,12 @@
<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</title> <title>${book.book} <%=intl._("addressbook")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="<%=book.getTheme()%>susidns.css">
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div id="logo"> <div id="logo">
<a href="index"><img src="images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a> <a href="index"><img src="<%=book.getTheme()%>images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a>
</div> </div>
<hr> <hr>
<div id="navi"> <div id="navi">

View File

@@ -35,18 +35,19 @@
<%@ page contentType="text/html"%> <%@ page contentType="text/html"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application" /> <jsp:useBean id="version" class="i2p.susi.dns.VersionBean" scope="application" />
<jsp:useBean id="base" class="i2p.susi.dns.BaseBean" scope="session" />
<jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" /> <jsp:useBean id="intl" class="i2p.susi.dns.Messages" scope="application" />
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<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</title> <title><%=intl._("Introduction")%> - SusiDNS</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="<%=base.getTheme()%>susidns.css">
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div id="logo"> <div id="logo">
<img src="images/logo.png" alt="susidns logo" border="0"> <img src="<%=base.getTheme()%>images/logo.png" alt="susidns logo" border="0">
</div> </div>
<hr> <hr>
<div id="navi"> <div id="navi">
@@ -85,7 +86,7 @@
<%=intl._("Hosts in the private address book can be accessed by you but their addresses are never distributed to others.")%> <%=intl._("Hosts in the private address book can be accessed by you but their addresses are never distributed to others.")%>
<%=intl._("The private address book can also be used for aliases of hosts in your other address books.")%> <%=intl._("The private address book can also be used for aliases of hosts in your other address books.")%>
</p> </p>
<center><img src="images/how.png" border="0" alt="address book working scheme" title="How the address book works" class="illustrate" /></center> <center><img src="<%=base.getTheme()%>images/how.png" border="0" alt="address book working scheme" title="How the address book works" class="illustrate" /></center>
</div> </div>
<hr> <hr>
<div id="footer"> <div id="footer">

View File

@@ -43,12 +43,12 @@
<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</title> <title><%=intl._("subscriptions")%> - susidns</title>
<link rel="stylesheet" type="text/css" href="css.css"> <link rel="stylesheet" type="text/css" href="<%=subs.getTheme()%>susidns.css">
</head> </head>
<body> <body>
<div class="page"> <div class="page">
<div id="logo"> <div id="logo">
<a href="index"><img src="images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a> <a href="index"><img src="<%=subs.getTheme()%>images/logo.png" alt="" title="<%=intl._("Overview")%>" border="0"/></a>
</div><hr> </div><hr>
<div id="navi"> <div id="navi">
<p> <p>

View File

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 4.4 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB