-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommonNav.jsp
More file actions
226 lines (204 loc) · 8.61 KB
/
commonNav.jsp
File metadata and controls
226 lines (204 loc) · 8.61 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
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
<%@ page language="java" contentType="text/html" pageEncoding="utf-8" %>
<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.PreparedStatement" %>
<%@ page import="java.sql.ResultSet" %>
<%@ page import="java.util.Vector"%>
<%
request.setCharacterEncoding("UTF-8");
String userId = (String)session.getAttribute("userId");
String userPosition = "";
String userDepartment = "";
if(userId != null) {
userPosition = (String)session.getAttribute("userPosition");
userDepartment = (String)session.getAttribute("userDepartment");
}
Class.forName("com.mysql.jdbc.Driver");
Connection connect = DriverManager.getConnection("jdbc:mysql://localhost:3306/ssweb_planner", "kkikki", "tjdals13");
String sql;
PreparedStatement query = null;
ResultSet result = null;
if(userPosition.equals("관리")) {
sql = "SELECT user_id, user_name, user_department, user_position FROM accounts";
query = connect.prepareStatement(sql);
}
else if(userPosition.equals("부장")) {
sql = "SELECT user_id, user_name, user_department, user_position FROM accounts WHERE user_department = ?";
query = connect.prepareStatement(sql);
query.setString(1, userDepartment);
}
Vector<String> userInfoList = new Vector<String>();
if(query != null) {
result = query.executeQuery();
while(result.next()) {
String userInfo = "";
for(int index = 1; index < 4; index++) {
userInfo += result.getString(index) + ",";
}
userInfo += result.getString(4);
userInfoList.add(userInfo);
}
}
%>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="../css/basic.css?as">
<link rel="stylesheet" type="text/css" href="../css/commonNav.css?a">
</head>
<body>
<nav id="headNav">
<button id="menuBtn" class="navBtn" onclick="openAsidNav()">
<img src="../resources/images/menu.png">
</button>
<h1 id="titleText">SSWEB PLANNER</h1>
</nav>
<nav id="asideNav">
<div id="asideNavHeader">
<button id="closeBtn" class="navBtn" onclick="closeAsidNav()">
<img src="../resources/images/close.png">
</button>
</div>
<form id="asideNavMain" action="plannerPage.jsp">
<div class="teamContainer" id="developmentTeamContainer">
<div class="teamNameBox">
<h2 class="largeFont teamNameText">개발팀</h2>
</div>
<ul id="developmentTeamList">
</ul>
</div>
<div class="teamContainer" id="educationTeamContainer">
<div class="teamNameBox">
<h2 class="largeFont teamNameText">교육팀</h2>
</div>
<ul id="educationTeamList">
</ul>
</div>
<div class="teamContainer" id="operationTeamContainer">
<div class="teamNameBox">
<h2 class="largeFont teamNameText">운용팀</h2>
</div>
<ul id="operationTeamList">
</ul>
</div>
<div class="teamContainer" id="financeTeamContainer">
<div class="teamNameBox">
<h2 class="largeFont teamNameText">재무팀</h2>
</div>
<ul id="financeTeamList">
</ul>
</div>
</form>
</nav>
<script>
window.onload = function() {
showMenuBtn()
loadAsideNav()
}
function openAsidNav() {
document.getElementById("asideNav").style.left = "0px";
}
function closeAsidNav() {
var asideNav = document.getElementById("asideNav")
asideNav.style.left = -asideNav.scrollWidth;
}
function showMenuBtn() {
var userPosition = "<%=userPosition%>"
if(userPosition != "부장" && userPosition != "관리") {
document.getElementById("menuBtn").style.display = "none"
document.getElementById("titleText").style.marginLeft = "64px"
document.getElementById("headNav").style.height = "55px"
}
}
function loadAsideNav() {
showTeamContainer()
var userInfoList = makeUserInfoList()
for(var index = 0; index < userInfoList.length; index++) {
loadUser(userInfoList[index])
}
}
function showTeamContainer() {
var userPosition = "<%=userPosition%>"
var userDepartment = "<%=userDepartment%>"
if(userPosition == "관리") {
var teamContainerLsit = document.getElementsByClassName("teamContainer")
for(var index = 0; index < teamContainerLsit.length; index++) {
teamContainerLsit[index].style.display = "block"
}
}
else if(userPosition == "부장") {
if(userDepartment == "개발") {
document.getElementById("developmentTeamContainer").style.display = "block"
}
else if(userDepartment == "교육") {
document.getElementById("educationTeamContainer").style.display = "block"
}
else if(userDepartment == "운용") {
document.getElementById("operationTeamContainer").style.display = "block"
}
else {
document.getElementById("financeTeamContainer").style.display = "block"
}
}
}
function makeUserInfoList() {
var userInfoList = []
<%for(int index = 0; index < userInfoList.size(); index++){%>
var userInfo = "<%=userInfoList.get(index)%>".split(',')
userInfoList.push(userInfo)
<%}%>
userInfoList.sort(function (userInfo1, userInfo2) {
if (userInfo1[3] != userInfo2[3]) {
return userInfo1[3] > userInfo2[3] ? 1 : -1;
}
else if (userInfo1[2] != userInfo2[2]) {
return userInfo1[2] - userInfo2[2];
}
else {
return userInfo1[1] > userInfo2[1] ? 1 : -1;
}
})
return userInfoList
}
function loadUser(userInfo) {
var userBox = document.createElement("li")
userBox.className = "userBox"
var userBtn = document.createElement("input")
userBtn.type = "button"
userBtn.className = "basicFont userBtn"
userBtn.value = "• " + userInfo[1] + " " + userInfo[3]
userBtn.onclick = function() {
changePlanner(userInfo[0])
}
userBox.appendChild(userBtn)
var userDepartment = userInfo[2]
if(userDepartment == "개발") {
document.getElementById("developmentTeamContainer").appendChild(userBox)
}
else if(userDepartment == "교육") {
document.getElementById("educationTeamContainer").appendChild(userBox)
}
else if(userDepartment == "운용") {
document.getElementById("operationTeamContainer").appendChild(userBox)
}
else {
document.getElementById("financeTeamContainer").appendChild(userBox)
}
}
function changePlanner(plannerOwnerId) {
var plannerOwnerIdInput = document.getElementById("plannerOwnerIdInput")
var asideNavMain = document.getElementById("asideNavMain")
if(plannerOwnerIdInput == null) {
plannerOwnerIdInput = document.createElement("input")
plannerOwnerIdInput.type = "hidden"
plannerOwnerIdInput.id = "plannerOwnerIdInput"
plannerOwnerIdInput.name = "plannerOwnerId"
asideNavMain.appendChild(plannerOwnerIdInput)
}
plannerOwnerIdInput.value = plannerOwnerId
asideNavMain.submit()
}
</script>
</body>