init nickname and download locations
This commit is contained in:
@@ -11,7 +11,6 @@ public class MuWireBean implements Serializable {
|
|||||||
|
|
||||||
public MuWireBean() {
|
public MuWireBean() {
|
||||||
mwClient = ((RouterContext)I2PAppContext.getGlobalContext()).clientAppManager().getRegisteredApp("MuWire");
|
mwClient = ((RouterContext)I2PAppContext.getGlobalContext()).clientAppManager().getRegisteredApp("MuWire");
|
||||||
System.out.println("mwClient is "+mwClient);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Object getMwClient() {
|
public Object getMwClient() {
|
||||||
|
|||||||
@@ -133,4 +133,8 @@ public class MuWireClient implements RouterApp {
|
|||||||
public Core getCore() {
|
public Core getCore() {
|
||||||
return core;
|
return core;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getHome() {
|
||||||
|
return home;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
pageEncoding="UTF-8"%>
|
pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="java.io.File" %>
|
||||||
|
|
||||||
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||||
|
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@@ -9,8 +12,24 @@
|
|||||||
<body>
|
<body>
|
||||||
<jsp:useBean id="mwBean" class="com.muwire.webui.MuWireBean"/>
|
<jsp:useBean id="mwBean" class="com.muwire.webui.MuWireBean"/>
|
||||||
<c:set var="mwClient" scope="application" value="${mwBean.getMwClient()}"/>
|
<c:set var="mwClient" scope="application" value="${mwBean.getMwClient()}"/>
|
||||||
|
|
||||||
|
<%
|
||||||
|
String defaultDownloadLocation = System.getProperty("user.home")+File.separator+"Downloads";
|
||||||
|
String defaultIncompletesLocation = System.getProperty("user.home") + File.separator+"MuWire Incompletes";
|
||||||
|
session.setAttribute("defaultDownloadLocation",defaultDownloadLocation);
|
||||||
|
session.setAttribute("defaultIncompletesLocation",defaultIncompletesLocation);
|
||||||
|
%>
|
||||||
|
|
||||||
<c:if test = "${mwClient.needsMWInit()}">
|
<c:if test = "${mwClient.needsMWInit()}">
|
||||||
<p>MW needs initializing</p>
|
<p>Welcome to MuWire! Please select a nickname and download locations</p>
|
||||||
|
<form action="/MuWire/init.jsp" method="post">
|
||||||
|
Nickname:
|
||||||
|
<input type="text" name="nickname"><br>
|
||||||
|
Directory for saving downloaded files:
|
||||||
|
<input type='text' name='download_location' value="${defaultDownloadLocation}"><br/>
|
||||||
|
Directory for storing incomplete files:
|
||||||
|
<input type='text' name='incomplete_location' value="${defaultIncompletesLocation}"><br/>
|
||||||
|
<input type="submit" value="Submit">
|
||||||
</c:if>
|
</c:if>
|
||||||
<c:if test = "${!mwClient.needsMWInit()}">
|
<c:if test = "${!mwClient.needsMWInit()}">
|
||||||
<p>MW doesn't need initing</p>
|
<p>MW doesn't need initing</p>
|
||||||
|
|||||||
23
webui/src/main/webapp/init.jsp
Normal file
23
webui/src/main/webapp/init.jsp
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
<%@ page language="java" contentType="text/html; charset=UTF-8"
|
||||||
|
pageEncoding="UTF-8"%>
|
||||||
|
<%@ page import="java.io.File" %>
|
||||||
|
|
||||||
|
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
|
||||||
|
|
||||||
|
<html
|
||||||
|
<body>
|
||||||
|
<jsp:useBean id="mwBean" class="com.muwire.webui.MuWireBean"/>
|
||||||
|
<c:set var="mwClient" scope="application" value="${mwBean.getMwClient()}"/>
|
||||||
|
<%
|
||||||
|
String nickname = request.getParameter("nickname");
|
||||||
|
String downloadLocation = request.getParameter("download_location");
|
||||||
|
String incompleteLocation = request.getParameter("incomplete_location");
|
||||||
|
|
||||||
|
session.setAttribute("downloadLocation", new File(downloadLocation));
|
||||||
|
session.setAttribute("incompleteLocation", new File("incompleteLocation"));
|
||||||
|
session.setAttribute("nickname",nickname);
|
||||||
|
%>
|
||||||
|
<c:set var="initResult" scope="session" value="${mwClient.initMWProps(nickname,downloadLocation,incompleteLocation)}"/>
|
||||||
|
<c:redirect url="/index.jsp"/>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user