mirror of https://github.com/zlatinb/muwire
init nickname and download locations
parent
8c33a5e62f
commit
e94ed4eafa
|
@ -11,7 +11,6 @@ public class MuWireBean implements Serializable {
|
|||
|
||||
public MuWireBean() {
|
||||
mwClient = ((RouterContext)I2PAppContext.getGlobalContext()).clientAppManager().getRegisteredApp("MuWire");
|
||||
System.out.println("mwClient is "+mwClient);
|
||||
}
|
||||
|
||||
public Object getMwClient() {
|
||||
|
|
|
@ -133,4 +133,8 @@ public class MuWireClient implements RouterApp {
|
|||
public Core getCore() {
|
||||
return core;
|
||||
}
|
||||
|
||||
public String getHome() {
|
||||
return home;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
<%@ 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" %>
|
||||
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
|
||||
|
||||
<html>
|
||||
<head>
|
||||
|
@ -9,8 +12,24 @@
|
|||
<body>
|
||||
<jsp:useBean id="mwBean" class="com.muwire.webui.MuWireBean"/>
|
||||
<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()}">
|
||||
<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 test = "${!mwClient.needsMWInit()}">
|
||||
<p>MW doesn't need initing</p>
|
||||
|
|
|
@ -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>
|
Loading…
Reference in New Issue