Skip to content
Snippets Groups Projects
Commit b8714f2a authored by Yannis Devos's avatar Yannis Devos
Browse files

Correction dans l'affichage des messages

parent de97e41d
No related branches found
No related tags found
No related merge requests found
...@@ -45,7 +45,6 @@ public class Account extends HttpServlet { ...@@ -45,7 +45,6 @@ public class Account extends HttpServlet {
out.println("<input name=\"newPwd\" type=\"password\" placeholder=\"New password\">"); out.println("<input name=\"newPwd\" type=\"password\" placeholder=\"New password\">");
out.println("<button type=\"submit\">Change it !</button>"); out.println("<button type=\"submit\">Change it !</button>");
out.println("</form>"); out.println("</form>");
out.println("</section>");
String npwd = req.getParameter("newPwd"); String npwd = req.getParameter("newPwd");
if (npwd != null){ if (npwd != null){
...@@ -62,6 +61,8 @@ public class Account extends HttpServlet { ...@@ -62,6 +61,8 @@ public class Account extends HttpServlet {
} }
} }
out.println("</section>");
// out.println("<h2>JE SAIS PAS</h2>"); // out.println("<h2>JE SAIS PAS</h2>");
// out.println("<form class=\"changepwdForm\" action=\"/s4a021-web-backend/Account?interact=del\">"); // out.println("<form class=\"changepwdForm\" action=\"/s4a021-web-backend/Account?interact=del\">");
// out.println("<button type=\"submit\">Delete Account</button>"); // out.println("<button type=\"submit\">Delete Account</button>");
......
...@@ -51,9 +51,10 @@ public class Feed extends HttpServlet { ...@@ -51,9 +51,10 @@ public class Feed extends HttpServlet {
out.println(PageGeneration.generateNavMenu()); out.println(PageGeneration.generateNavMenu());
MyThread msgThread = new MyThread(0,null);
if (!messages.isEmpty()) { if (!messages.isEmpty()) {
for (Message message : messages) { for (Message message : messages) {
MyThread msgThread;
try { try {
msgThread = threadDao.getThreadById(message.getThreadId()); msgThread = threadDao.getThreadById(message.getThreadId());
} catch (SQLException e) { } catch (SQLException e) {
...@@ -63,13 +64,6 @@ public class Feed extends HttpServlet { ...@@ -63,13 +64,6 @@ public class Feed extends HttpServlet {
out.println("<h3 class=\"msgThread\">" + msgThread.getThreadName() + "</h3>"); out.println("<h3 class=\"msgThread\">" + msgThread.getThreadName() + "</h3>");
out.println("<p class=\"msgContent\">" + message.getContent() + "</p>"); out.println("<p class=\"msgContent\">" + message.getContent() + "</p>");
out.println("<form action=\"http://localhost:8080/s4a021-web-backend/PostMessage\" method=\"post\">");
out.println("<textarea name=\"message\" rows=\"2\" cols=\"30\" placeholder=\"Post a message in this thread\"></textarea>");
out.println("<input name=\"threadid\" type=\"hidden\" value=\"" + msgThread.getId() + "\">");
out.println("<button type=\"submit\">Post</button>");
out.println("</form>");
boolean msgIsLiked = false; boolean msgIsLiked = false;
try { try {
msgIsLiked = messageDao.isMessageLikedByUser(message.getMsgId(), user); msgIsLiked = messageDao.isMessageLikedByUser(message.getMsgId(), user);
...@@ -78,7 +72,7 @@ public class Feed extends HttpServlet { ...@@ -78,7 +72,7 @@ public class Feed extends HttpServlet {
sqle.getStackTrace(); sqle.getStackTrace();
} }
out.println("<form action=\"http://localhost:8080/s4a021-web-backend/LikeMessage\" method=\"post\">"); out.println("<form class=\"feedForm\" action=\"http://localhost:8080/s4a021-web-backend/LikeMessage\" method=\"post\">");
out.println("<input name=\"messageid\" type=\"hidden\" value=\"" + message.getMsgId() +"\">"); out.println("<input name=\"messageid\" type=\"hidden\" value=\"" + message.getMsgId() +"\">");
if (msgIsLiked) { if (msgIsLiked) {
...@@ -93,6 +87,12 @@ public class Feed extends HttpServlet { ...@@ -93,6 +87,12 @@ public class Feed extends HttpServlet {
out.println("<p class=\"information\">You are not following any thread yet.</p>"); out.println("<p class=\"information\">You are not following any thread yet.</p>");
} }
out.println("<form class=\"feedForm\" action=\"http://localhost:8080/s4a021-web-backend/PostMessage\" method=\"post\">");
out.println("<textarea name=\"message\" rows=\"2\" cols=\"30\" placeholder=\"Post a message in this thread\"></textarea>");
out.println("<input name=\"threadid\" type=\"hidden\" value=\"" + msgThread.getId() + "\">");
out.println("<button type=\"submit\">Post</button>");
out.println("</form>");
out.println("<div class=\"discover\">"); out.println("<div class=\"discover\">");
out.println("<a href=\"http://localhost:8080/s4a021-web-backend/Discover\">Discover new threads</a>"); out.println("<a href=\"http://localhost:8080/s4a021-web-backend/Discover\">Discover new threads</a>");
out.println("<a href=\"http://localhost:8080/s4a021-web-backend/NewThread\">Create a new thread</a>"); out.println("<a href=\"http://localhost:8080/s4a021-web-backend/NewThread\">Create a new thread</a>");
......
...@@ -58,9 +58,11 @@ public class NewThread extends HttpServlet { ...@@ -58,9 +58,11 @@ public class NewThread extends HttpServlet {
out.println("<html><body><meta charset=\"utf-8\">"); out.println("<html><body><meta charset=\"utf-8\">");
out.println("<link rel=\"icon\" type=\"image/png\" href=\"css/campus_talk.png\">"); out.println("<link rel=\"icon\" type=\"image/png\" href=\"css/campus_talk.png\">");
out.println("<link rel=\"stylesheet\" href=\"css/feed.css\">");
out.println("<title>New thread</title>"); out.println("<title>New thread</title>");
out.println("<section>");
out.println("<div class=\"write\">"); out.println("<div class=\"write\">");
out.println("<h1>Create a new thread</h1>"); out.println("<h1>Create a new thread</h1>");
out.println(PageGeneration.generateNavMenu()); out.println(PageGeneration.generateNavMenu());
...@@ -68,14 +70,15 @@ public class NewThread extends HttpServlet { ...@@ -68,14 +70,15 @@ public class NewThread extends HttpServlet {
out.println("<input name=\"threadname\" type=\"text\" placeholder=\"Name of new thread\">"); out.println("<input name=\"threadname\" type=\"text\" placeholder=\"Name of new thread\">");
out.println("<textarea name=\"first_message\" type=\"text\" rows=\"2\" cols=\"30\" placeholder=\"Post the first message of your new thread!\"></textarea>"); out.println("<textarea name=\"first_message\" type=\"text\" rows=\"2\" cols=\"30\" placeholder=\"Post the first message of your new thread!\"></textarea>");
out.println("<button type=\"submit\">Create</button>"); out.println("<button type=\"submit\">Create</button>");
out.println("<a class=\"link\" href=\"http://localhost:8080/s4a021-web-backend/Welcome\">Back to feed</a>");
out.println("</form>"); out.println("</form>");
out.println("</section>");
if (newThreadWasCreated) { if (newThreadWasCreated) {
out.println("<p class=\"information\">The thread <strong>\"" + threadname + "\"</strong> was successfully created</p>"); out.println("<p class=\"information\">The thread <strong>\"" + threadname + "\"</strong> was successfully created</p>");
} }
out.println("<button><a href=\"http://localhost:8080/s4a021-web-backend/Welcome\">Back to feed</a></button>");
out.println("</body>"); out.println("</body>");
out.println("<footer>"); out.println("<footer>");
out.println("Connected as " + login); out.println("Connected as " + login);
......
...@@ -9,8 +9,8 @@ ...@@ -9,8 +9,8 @@
<body> <body>
<div class="form"> <div class="form">
<section> <section>
<h1>REGISTER</h1>
<form action="http://localhost:8080/s4a021-web-backend/SignUp" method="post"> <form action="http://localhost:8080/s4a021-web-backend/SignUp" method="post">
<h1>REGISTER</h1>
<input name="login" type="text" placeholder="username"> <input name="login" type="text" placeholder="username">
<input name="pwd" type="password" placeholder="password"> <input name="pwd" type="password" placeholder="password">
<button type="submit">Create my Account !</button> <button type="submit">Create my Account !</button>
......
...@@ -31,6 +31,16 @@ ul{ ...@@ -31,6 +31,16 @@ ul{
padding : 0; padding : 0;
} }
form:not(.followThread, .feedForm) {
text-align: center;
display: flex;
flex-direction: column;
width: 25%;
margin-right: auto;
margin-left: auto;
margin-top: 5%;
}
.menu_option{ .menu_option{
text-align : center; text-align : center;
list-style: none; list-style: none;
...@@ -45,7 +55,18 @@ ul{ ...@@ -45,7 +55,18 @@ ul{
transition : 0.2s; transition : 0.2s;
} }
.menu_option>a:hover{ form>.link {
margin-top : 5%;
background-color : white;
text-decoration: none;
color: black;
padding : 1%;
margin-right :auto;
margin-left :auto;
transition : 0.2s;
}
.menu_option>a:hover, .link:hover{
transition : 0.3s; transition : 0.3s;
padding : 3%; padding : 3%;
border-radius : 5px; border-radius : 5px;
......
...@@ -12,8 +12,8 @@ ...@@ -12,8 +12,8 @@
<body> <body>
<div class="form"> <div class="form">
<section> <section>
<h1>LOGIN</h1>
<form action="http://localhost:8080/s4a021-web-backend/LogIn" method="post"> <form action="http://localhost:8080/s4a021-web-backend/LogIn" method="post">
<h1>LOGIN</h1>
<input name="login" type="text" placeholder="username"> <input name="login" type="text" placeholder="username">
<input name="pwd" type="password" placeholder="password"> <input name="pwd" type="password" placeholder="password">
<button type="submit">Let's go !</button> <button type="submit">Let's go !</button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment