-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvoterDashboard.jsp
More file actions
183 lines (166 loc) · 5.49 KB
/
voterDashboard.jsp
File metadata and controls
183 lines (166 loc) · 5.49 KB
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
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page import="javax.servlet.http.HttpSession" %>
<%@ page import="java.net.URLDecoder" %>
<%
String status = request.getParameter("status");
if (status != null) {
status = URLDecoder.decode(status, "UTF-8");
%>
<script>
alert("<%= status %>");
// Remove the status parameter from the URL
const url = new URL(window.location);
url.searchParams.delete('status'); // Remove the 'status' parameter
window.history.replaceState({}, document.title, url);
</script>
<%
}
%>
<%
if (session != null && session.getAttribute("username") != null) {
if (!"voter".equals(session.getAttribute("role"))) { // Check if the user is a voter
response.sendRedirect("accessDenied.jsp"); // Redirect if the role is not voter
return; // Stop further processing
}
} else {
response.sendRedirect("login.jsp"); // Optional: Redirect to login if session is null
return; // Stop further processing
}
%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Pollify - Interactive Sidebar</title>
<link rel="stylesheet" href="css/user_page.css">
<link rel="stylesheet" href="css/navbar.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css" rel="stylesheet"/>
<style>
.disclaimer {
background-color: #f9f9f9;
border: 1px solid #ccc;
border-radius: 5px;
padding: 20px;
margin: 20px 0;
}
.disclaimer h2 {
color: #d9534f; /* Bootstrap danger color for emphasis */
}
.disclaimer ul {
list-style-type: disc;
margin-left: 20px;
}
.apply-button {
background-color: #5cb85c; /* Bootstrap success color */
color: white;
padding: 10px 20px;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s ease;
}
.apply-button:hover {
background-color: #4cae4c; /* Darker shade for hover effect */
}
.welcome-message {
padding: 20px;
background-color: #f0f8ff;
border-radius: 8px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
margin: 20px 0;
text-align: center;
}
.welcome-message h1 {
font-size: 2em;
color: #333;
}
.welcome-message p {
font-size: 1.2em;
color: #555;
margin: 10px 0;
}
.divider {
border: none;
height: 1px;
background-color: #ccc;
margin: 20px 0;
}
.features h2 {
color: #0056b3;
margin-top: 20px;
}
.features ul {
list-style-type: square;
margin-left: 20px;
text-align: left;
}
.features li {
font-size: 1em;
color: #333;
margin-bottom: 8px;
}
.cta {
font-weight: bold;
font-size: 1.2em;
color: #007bff;
margin-top: 20px;
}
</style>
</head>
<body>
<%
String username = (session != null) ? (String) session.getAttribute("username") : null; // Get the username if session exists
%>
<nav>
<div class="logo">Pollify</div>
<div class="menu">
<% if(username==null){ %>
<a href="home.jsp">Home</a>
<a href="register.jsp">Register</a>
<a href="login.jsp">Login</a>
<% } %>
<% if (username != null) { %>
<a>Welcome, <%= username %>!</a>
<a href="logout.jsp">Logout</a> <!-- Link to logout servlet -->
<% } %>
</div>
</nav>
<div class="container">
<div class="sidebar">
<h2>Pollify Voter</h2>
<ul>
<li><a href="findActivePolls"><i class="fas fa-check-circle"></i> Vote</a></li>
<li><a href="viewCandidate"><i class="fas fa-list"></i> Candidate List</a></li>
<li><a href="viewResults"><i class="fas fa-chart-bar"></i> Result</a></li>
<li><a href="viewManifesto.jsp"><i class="fas fa-book"></i> Manifesto</a></li>
<li><a href="applyCandidate.jsp"><i class="fas fa-user-plus"></i> Apply for Candidate</a></li>
</ul>
</div>
<!-- Content Area -->
<div class="content">
<div id="content-area">
<div class="welcome-message">
<h1>Welcome to Pollify!</h1>
<p>
Pollify is your trusted platform for participating in transparent and fair elections.
As a valued voter, you can explore candidate manifestos, cast your vote, and view results
with ease.
</p>
<hr class="divider">
<div class="features">
<h2>What You Can Do:</h2>
<ul>
<li><strong>Vote</strong> in ongoing elections and make your voice heard.</li>
<li><strong>Review Candidates</strong> and understand their vision through detailed manifestos.</li>
<li><strong>Track Results</strong> as they are updated in real-time post-election.</li>
</ul>
</div>
<p class="cta">Explore Pollify and make a difference in your community today!</p>
</div>
</div>
</div>
</div>
</body>
</html>