-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmessage.jsp
266 lines (228 loc) · 10.1 KB
/
message.jsp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
<%@page import="DAO.UserDao"%>
<%@page import="Business.Response"%>
<%@page import="DAO.ResponseDao"%>
<%@page import="java.util.ArrayList"%>
<%@page import="DAO.MessageDao"%>
<%@page import="Business.Messages"%>
<%@page import="Business.User"%>
<%@include file="internationalisationHeader.jsp" %>
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
<title>Message</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css">
<link rel='stylesheet prefetch' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css'>
<!-- Favicons -->
<link href="img/favicon.png" rel="icon">
<!-- Google Fonts -->
<link href="https://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,700,700i|Montserrat:300,400,500,700" rel="stylesheet">
<!-- Bootstrap CSS File -->
<link href="lib/bootstrap/css/bootstrap.min.css" rel="stylesheet">
<!-- Libraries CSS Files -->
<link href="lib/font-awesome/css/font-awesome.min.css" rel="stylesheet">
<link href="lib/animate/animate.min.css" rel="stylesheet">
<link href="lib/ionicons/css/ionicons.min.css" rel="stylesheet">
<link href="lib/owlcarousel/assets/owl.carousel.min.css" rel="stylesheet">
<link href="lib/lightbox/css/lightbox.min.css" rel="stylesheet">
<!-- CSS Library for the video search -->
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/helpers/jquery.fancybox-buttons.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/helpers/jquery.fancybox-thumbs.css'>
<link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/fancybox/2.1.5/jquery.fancybox.css'>
<!-- Main Stylesheet File -->
<link href="css/bootstrap.css" rel="stylesheet">
<style>
body {
background-color: #f3f3f3;
}
h1 {
font-size: 21px;
}
h2 {
font-size: 18px;
}
h3,
h4,
h5,
h6 {
font-size: 16px;
}
.wall-post {
border-color: #eae9e9;
width:100%;
}
.wall-post .wall-post-header {
background-color: #fbfafa;
border-color: #eae9e9;
}
.wall-post .wall-post-header img {
display: inline-block;
float: left;
margin-right: 10px;
}
.wall-post .wall-post-header h2 {
display: inline-block;
margin: 0;
}
.wall-post .wall-post-header h2 small {
display: block;
}
.wall-post .wall-post-footer {
background-color: #fbfafa;
border-color: #eae9e9;
}
h2{
font-weight:bold;
color:black;
font-size:17px;
}
.date{
font-weight:bold;
color:black;
font-size:14px;
}
.title{
font-weight:bold;
color:black;
font-size:17px;
}
.message{
font-weight:bold;
color:black;
font-size:16px;
}
.rdate{
font-weight:bold;
color:#002752;
font-size:14px;
}
h3{
font-weight:bold;
color:#002752;
font-size:17px;
}
.response{
font-weight:bold;
color:#002752;
font-size:14px;
}
body{
background: url(img/womanwithphone.jpg)
}
</style>
<script type="text/javascript">
$(document).ready(function () {
$('#showTextArea').click(function () {
$('#myTextArea').show();
});
});
</script>
</head>
<body>
<% User u = (User) session.getAttribute("login");
if (u != null) {
%>
<main id="main">
<div class="container" style="margin-top:20px;">
<div class="row">
<div class="col-md-12" style="margin-bottom:20px;">
<form action="FrontController" method="post">
<input type="text" style="margin-bottom:20px;" id="messageTitle" name="messageTitle" placeholder="Enter title..">
<div class="status-post">
<textarea style="margin-bottom:20px;" name="message" placeholder="Whats on your mind?" class="form-control" id="message" rows="3"></textarea>
<!-- <input type="file" name="file"/> -->
<input type="submit" value="comment"/>
<input type="hidden" name="action" value="comment"/>
<input type="hidden" name="topicId" value="<%=request.getParameter("id")%>"/>
<input type="hidden" name="userId" value="<%=u.getUserId()%>"/>
</form>
</div>
</div>
</div>
<%
MessageDao messagedao = new MessageDao("healthybunny");
ResponseDao responseDao = new ResponseDao("healthybunny");
ArrayList<Response> responses = null;
ArrayList<Messages> messages
= messagedao.getMessagesById(Integer.parseInt(
request.getParameter("id")));
for (Messages me : messages) {
responses = responseDao.getReponseById(me.getMessageId());
UserDao userdao = new UserDao("healthybunny");
ArrayList<User> users = userdao.getCommentByUser(me.getUserId());
for (User a : users) {
%>
<!--posts-->
<div class="rows">
<div class="col-md-12s">
<div class="panel panel-default wall-post">
<div class="panel-heading wall-post-header">
<h2> <%=a.getFirstName()%> <%=a.getLastName()%></h2>
<p class="date"> <%=me.getMessageDate()%></p>
</div>
<%
}
%>
<div class="panel-body wall-post-body">
<div class="wall-post-content">
<p class="title">
<%=me.getMessageTitle()%></p>
<p class="message">
<%=me.getMessage()%>
</p>
</div>
</div>
<div class="panel-footer wall-post-footer">
<div class="wall-post-comments">
<!-- Comment -->
<ul class="media-list wall-post-comments-list">
<li class="media">
<%
for (Response res : responses) {
ArrayList<User> us = userdao.getCommentByUser(res.getUserId());
for (User eir : us) {
%>
<div class="media-body">
<h3><%=eir.getFirstName()%> <%=eir.getLastName()%></h3>
<p class="rdate"><%=res.getResponseDate()%></p>
<%
}
%>
<p class="response">
<%=res.getResponseMessage()%>
</p>
<%
}
%>
<hr />
</div>
</li>
</ul>
<div class="wall-post-comment-box">
<form action="FrontController" method="post">
<input class="form-control" type="text" id="responseMessage" name="responseMessage" placeholder="Enter response..." />
<input type="submit" value="response"/>
<input type="hidden" name="action" value="response"/>
<input type="hidden" name="messageid" value="<%=me.getMessageId()%>"/>
<input type="hidden" name="topicId" value="<%=me.getTopicId()%>"/>
<input type="hidden" name="userId" value="<%=u.getUserId()%>"/>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<script src='https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.2/js/bootstrap.min.js'></script>
<script src="js/index.js"></script>
</div>
<%
}
} else {
out.println("no user found");
}
%>
</body>
</html>