Commit 790471c8 authored by Liing Pang Ryan's avatar Liing Pang Ryan
Browse files

Modified text of choices to be centered, some minor improvements on interface.

parent 9a1bf0df
......@@ -31,13 +31,6 @@ public class Login extends HttpServlet {
@Resource(name = "jdbc/projet-web")
private DataSource ds;
private void errorLogin(HttpServletRequest request,
HttpServletResponse response, String errorMessage)
throws ServletException, IOException {
request.setAttribute("errorMessage", errorMessage);
request.getRequestDispatcher("loginError.jsp").forward(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
*
......@@ -60,16 +53,22 @@ public class Login extends HttpServlet {
if (login != null && pass != null && userDAO.isLoginValid(login, pass)) {
HttpSession session = request.getSession();
session.setAttribute("username", login);
if(request.getParameterMap().containsKey("sourcePage")){
if (request.getParameterMap().containsKey("sourcePage")) {
response.sendRedirect(request.getParameter("sourcePage"));
}else {
response.sendRedirect("index.jsp");
} else {
request.setAttribute("action", "Login");
request.setAttribute("status", "Successful!");
request.getRequestDispatcher("response.jsp").forward(request, response);
}
} else {
errorLogin(request, response, "Invalid Login Credentials");
request.setAttribute("action", "Login");
request.setAttribute("status", "Failed! Invalid Login Credentials");
request.getRequestDispatcher("response.jsp").forward(request, response);
}
} catch (Exception e) {
errorLogin(request, response, "Something went wrong. Please contact customer support.");
request.setAttribute("action", "Login");
request.setAttribute("status", "Failed! Un expected error occured. Please contact customer support.");
request.getRequestDispatcher("response.jsp").forward(request, response);
}
}
......
......@@ -2,12 +2,12 @@
<div class="choices" id="choices${paragraph.id}">
<c:forEach items="${choiceList}" var="choice">
<c:if test="${choice['idParagrapheSuite']==0}" var="new" scope="request">
<span class="choice ${choice['published']?'':'edit'}" id ="choice${choice['id']}" style ="${choice['published']?'':'display:none;'}" onclick="${'newParagraphe'}(${choice['idParagraphe']},${choice['id']},${storyid})">
<span class="choice${choice['published']?'':' edit'}" id ="choice${choice['id']}" style ="${choice['published']?'':'display:none;'}" onclick="${'newParagraphe'}(${choice['idParagraphe']},${choice['id']},${storyid})">
<c:out value="${choice['texte']}"/>
</span>
</c:if>
<c:if test="${choice['idParagrapheSuite']!=0}" var="new" scope="request">
<span class="choice ${choice['published']?'':'edit'}" id ="choice${choice['id']}" style ="${choice['published']?'':'display:none;'}" onclick="${'choose'}(${choice['idParagraphe']},${choice['idParagrapheSuite']},${storyid},${choice['id']})">
<span class="choice${choice['published']?'':' edit'}" id ="choice${choice['id']}" style ="${choice['published']?'':'display:none;'}" onclick="${'choose'}(${choice['idParagraphe']},${choice['idParagrapheSuite']},${storyid},${choice['id']})">
<c:out value="${choice['texte']}"/>
<div class="edit">
<c:forEach items="${choice['required']}" var="pid">
......@@ -20,8 +20,7 @@
<!--Check if there are choices for this story !-->
<c:if test="${empty choiceList}">
<!--TODO: Check if it's a conclusion. THen we display another text to say end of story !-->
<div class="no_choices">There are no choices for this paragraph</div>
<div class="no_choices">There are no choices for this paragraph or it's a conclusion</div>
</c:if>
......
......@@ -5,8 +5,8 @@
<title>Story Time</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta charset="UTF-8"/>
<link rel="stylesheet" href="style.css?java=<?=time()?">
<link rel="stylesheet" href="style2.css?java=<?=time()?">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style2.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="index.js"></script>
</head>
......@@ -16,8 +16,14 @@
<%@ include file="login.jsp" %>
<div class="main_block">
<div class="main_title">
<h1>A game where YOU are the story!</h1>
</div>
<c:choose>
<c:when test="${empty sessionScope.username}">
<h1>A game where YOU are the story!</h1>
</c:when>
<c:otherwise>
<h1>Welcome <span>${sessionScope.username}</span> !</h1>
</c:otherwise>
</c:choose> </div>
<div class="storie_list">
<h3>Check out the following stories:</h3>
<div class="all_stories">
......@@ -31,7 +37,7 @@
</c:when>
<c:otherwise>
<div class="create_story">
<a href="createstory.jsp">Create a story</a>
<a href="createstory.jsp">Create new a story</a>
</div>
</c:otherwise>
</c:choose>
......
......@@ -9,8 +9,8 @@
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="style.css?java=<?=time()?">
<link rel="stylesheet" href="style2.css?java=<?=time()?">
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="style2.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="index.js"></script>
<title>Story Time</title>
......
......@@ -23,7 +23,7 @@
<div id="switch_mode" class="${published?"edit_mode":"edit_mode_block"}" onclick="switchMode()"><button>Edit Mode</button></div>
</c:if>
<c:if test="${owner}" var="maVariable" scope="request">
<div class="edit_mode" id="publish" onclick="publish(${story.id})"><button>Publish Story</button></div>
<div class="edit_mode" id="publish" onclick="publish(${story.id})"><button>Publish Changes for Story</button></div>
<c:if test="${!publicStory}" var="maVariable" scope="request">
<div class="edit_mode_invite_author">
......
......@@ -476,8 +476,8 @@
border-radius: 10px;
padding: 5px;
}
.choice {
display:flex;
.choice{
display:block;
min-height: 30px;
color:#5267fa;
background-color: white;
......
......@@ -28,6 +28,9 @@ and open the template in the editor.
text-align: center;
}
.main_title h1 span{
color: #009BFF;
}
.all_stories{
width:250px;
margin-left: auto;
......@@ -99,10 +102,10 @@ and open the template in the editor.
text-decoration: none;
font-size: 20px;
color: white;
width: 250px;
height:50px;
padding-left: 65px;
padding-top:20px;
width:100%;
height:100%;
text-align: center;
padding-top: 20px;
}
.create_story:hover{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment