* Console: Split initialNews.xml into a file for each language;

don't copy to config dir at install.
This commit is contained in:
zzz
2010-11-26 00:32:00 +00:00
parent ab57b55e64
commit ec51ea6513
14 changed files with 163 additions and 137 deletions

View File

@@ -92,6 +92,11 @@
<!-- jar again to get the latest messages_*.class files -->
<jar destfile="./build/routerconsole.jar" basedir="./build/obj" includes="**/*.class" update="true" />
</target>
<target name="jarWithJavadoc" depends="jar">
<jar destfile="build/routerconsole.war" basedir="../../../build/" includes="javadoc/**/*" update="true" />
</target>
<target name="poupdate" depends="build">
<ant target="war" />
<!-- Update the messages_*.po files.

View File

@@ -6,13 +6,11 @@ import java.util.Locale;
import net.i2p.util.FileUtil;
public class ContentHelper extends HelperBase {
private String _page;
protected String _page;
private int _maxLines;
private boolean _startAtBeginning;
private String _lang;
public ContentHelper() {}
/**
* Caution, use absolute paths only, do not assume files are in CWD
*/

View File

@@ -0,0 +1,20 @@
package net.i2p.router.web;
import java.io.File;
/**
* If news file does not exist, use file from the initialNews directory
* in $I2P
*
* @since 0.8.2
*/
public class NewsHelper extends ContentHelper {
@Override
public String getContent() {
File news = new File(_page);
if (!news.exists())
_page = (new File(_context.getBaseDir(), "docs/initialNews/initialNews.xml")).getAbsolutePath();
return super.getContent();
}
}

View File

@@ -14,7 +14,8 @@ if (System.getProperty("router.consoleNonce") == null) {
<%@include file="summary.jsi" %><h1><%=intl._("I2P Router Console")%></h1>
<div class="news" id="news">
<jsp:useBean class="net.i2p.router.web.ContentHelper" id="newshelper" scope="request" />
<jsp:useBean class="net.i2p.router.web.NewsHelper" id="newshelper" scope="request" />
<jsp:setProperty name="newshelper" property="contextId" value="<%=(String)session.getAttribute("i2p.contextId")%>" />
<% java.io.File fpath = new java.io.File(net.i2p.I2PAppContext.getGlobalContext().getRouterDir(), "docs/news.xml"); %>
<jsp:setProperty name="newshelper" property="page" value="<%=fpath.getAbsolutePath()%>" />
<jsp:setProperty name="newshelper" property="maxLines" value="300" />