166
|
1 package app.bbs.thinks;
|
|
2
|
|
3 import java.io.PrintWriter;
|
|
4
|
|
5 import javax.servlet.http.HttpServlet;
|
|
6 import javax.servlet.http.HttpServletRequest;
|
|
7 import javax.servlet.http.HttpServletResponse;
|
|
8
|
|
9 import org.eclipse.jetty.util.thread.ThreadPool;
|
|
10
|
|
11 import app.bbs.NetworkBulletinBoard;
|
|
12 import jp.ac.u_ryukyu.ie.cr.shoshi.jungle.bbs.BoardMessage;
|
|
13
|
|
14 public class ShowMatrix extends HttpServlet {
|
|
15 /**
|
|
16 *
|
|
17 */
|
|
18 private static final long serialVersionUID = 1L;
|
|
19 private final NetworkBulletinBoard bbs;
|
|
20 private final String createBoardMessagePath;
|
|
21 private final String editMessagePath;
|
|
22 private final String showMatrixPath;
|
167
|
23 private final String createAttributePath;
|
166
|
24 private static final String PARAM_BOARD_NAME = "bname";
|
|
25
|
|
26 public ShowMatrix(NetworkBulletinBoard _bbs,
|
167
|
27 String _createBoardMessagePath, String _editMessagePath,
|
|
28 String _showMatrixPath, String _createAttributePath, ThreadPool thp) {
|
166
|
29 bbs = _bbs;
|
|
30 createAttributePath = _createAttributePath;
|
|
31 showMatrixPath = _showMatrixPath;
|
|
32 createBoardMessagePath = _createBoardMessagePath;
|
|
33 editMessagePath = _editMessagePath;
|
|
34 }
|
|
35
|
|
36 public void doGet(HttpServletRequest _req, HttpServletResponse _res) {
|
|
37 final String bname = _req.getParameter(PARAM_BOARD_NAME);
|
167
|
38 String nodeNum = _req.getParameter("uuid");
|
168
|
39 String nodeName = _req.getParameter("nodeName");
|
166
|
40 try {
|
168
|
41 printBoard(bname, nodeNum, nodeName, _res.getWriter());
|
166
|
42 } catch (Exception _e) {
|
|
43 _res.setStatus(500);
|
|
44 }
|
|
45 }
|
|
46
|
168
|
47 private void printBoard(String _bname, String nodeNum, String nodeName, PrintWriter _pw)
|
167
|
48 throws Exception {
|
166
|
49 _pw.write("<html><body>\n");
|
168
|
50
|
|
51 if(nodeName == null )
|
|
52 nodeName = "rootNode" ;
|
|
53
|
|
54
|
|
55 _pw.write("<h1>" + nodeName + " Path = " + nodeNum + "</h1>\n");
|
|
56
|
|
57 _pw.write("<form action='" + createBoardMessagePath + "' method='POST'>\n");
|
|
58 _pw.write("<p><input type='hidden' name='bname' value='" + _bname + "'/> </p>\n");
|
166
|
59 _pw.write("<p>Folder Name<br/> <input type='textarea' name='msg'/> </p>\n");
|
167
|
60 _pw.write("<input type='hidden' name='uuid' value='" + nodeNum + "'/>");
|
|
61 _pw.write("<p><input type='submit' value='submit'/></p>\n");
|
|
62 _pw.write("</form>");
|
|
63
|
|
64 _pw.write("<p><br>add Attribute</p>");
|
|
65 _pw.write("<form action='" + createAttributePath + "' method='POST'\n");
|
168
|
66 _pw.write("<p><input type='hidden' name='bname' value='" + _bname + "'</p>\n");
|
167
|
67 _pw.write("<p>attributeName<br/> <input type='textarea' name='msg'/> </p>\n");
|
|
68 _pw.write("<input type='hidden' name='uuid' value='" + nodeNum + "'/>");
|
166
|
69 _pw.write("<p><input type='submit' value='submit'/></p>\n");
|
|
70 _pw.write("</form>");
|
|
71
|
167
|
72 _pw.write("<p>Folder</p>");
|
|
73
|
166
|
74 for (BoardMessage msg : bbs.getFolder(_bname, nodeNum)) {
|
|
75 _pw.write("<hr/>");
|
168
|
76 _pw.write("<small><a href=" + showMatrixPath + "?bname=" + _bname + "&uuid=" + nodeNum + "/" + msg.getUUID() + "&nodeName=" + msg.getMessage() + ">" + msg.getMessage() + "</a></small>");
|
|
77 _pw.write(" ");
|
|
78 _pw.write("<small><a href='" + createAttributePath + "?bname=" + _bname + "&uuid=" + nodeNum + "/"+ msg.getUUID() + "'>edit(not s)</a></small>");
|
166
|
79 }
|
168
|
80
|
|
81
|
|
82 _pw.write("<br><hr/><p>Value</p><br>");
|
167
|
83 getAttributeImp attribute = (bbs.getAttribute(_bname, nodeNum));
|
|
84 for (int count = 0; attribute.getMessage(count) != null; count++) {
|
168
|
85 _pw.write("<p><b>" + "Varue " + count + " : " + attribute.getMessage(count) + "</b></p>");
|
167
|
86 }
|
166
|
87
|
|
88 _pw.write("</body></html>");
|
|
89 _pw.flush();
|
|
90 }
|
|
91 } |