-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnav.cfm
232 lines (203 loc) · 7.4 KB
/
nav.cfm
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
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
.w3-bar-item {
color: #ccc;
font-size: 15px;
margin: 0px -10px;
}
.w3-bar-item:hover {
color: white;
text-decoration: none;
}
div.sticky {
position: -webkit-sticky; /* Safari */
position: fixed;
top: 0;
z-index: 1030;
}
</style>
<div class="w3-bar sticky" style="background-color: #343a40; padding: 2px 200px; overflow: visible;">
<a class="w3-bar-item" href="index.html"><img src="/cfpimages/golden-ticket.png" height="36" /> <span style="font-family:courier new; font-weight:bold; color:white">College Fast Pass</span></a>
<span id="account" class="w3-bar-item w3-right">
<cfif isDefined("session.user.loggedIn") AND session.user.loggedIn>
<a id="signout" class="w3-bar-item w3-right" href="#">Sign Out</a>
<cfelse>
<a id="signin" class="w3-bar-item w3-right" href="#" onclick="$('#login_form').css('display','block')">Sign In</a>
</cfif>
</span>
<span class="w3-bar-item w3-right"><a href="index.html" class="w3-bar-item">Research</a></span>
<!--- <span class="w3-bar-item w3-right"><a href="table.html" class="w3-bar-item">Analyze</a></span> --->
<span class="w3-bar-item w3-right"><a href="vueSearch.html" class="w3-bar-item">Schools</a></span>
</div>
<!-- LOGIN MODAL -->
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Fredoka+One">
<!-- <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Fredoka+One">
<link rel="preconnect" href="https://fonts.gstatic.com">
<link href="https://fonts.googleapis.com/css2?family=Fredoka+One&display=swap" rel="stylesheet"> -->
<style>
.w3-FredokaOne {
font-family: Courier New, Fredoka One;
font-size:24px;
font-weight: bold;
margin-left: 10px;
}
</style>
<div id="login_form" class="w3-modal">
<div class="w3-modal-content w3-card-4 w3-animate-zoom" style="max-width:480px">
<div class="w3-center">
<br>
<span onclick="navDialog('loginScreens', 'LoginForm'); document.getElementById('login_form').style.display='none'" class="w3-button w3-xlarge w3-hover-red w3-display-topright" title="Close Login Window">×</span>
<table border="0" width="90%" style="margin-left:20px;">
<tr>
<td><img src="/cfpimages/golden-ticket.png" style="height: 100px"></td>
<td width="100%" style="text-align: left"><div id="welcome" class="w3-FredokaOne" style="margin-left:20px;">Welcome to<br />College Fast Pass</div></td>
</tr>
</table>
</div>
<div id="LoginForm" class="loginScreens">
<div class="w3-container">
<div class="w3-section">
<label><b> Email Address:</b></label>
<input class="w3-input w3-border w3-margin-bottom" type="text" placeholder="Enter email address" id="email" required>
<button class="w3-button w3-block w3-green w3-section w3-padding" onclick="loginDialog('checkEmail')">Next >></button>
</div>
</div>
</div>
<div id="PasswordForm" class="loginScreens" style="display:none">
<div class="w3-container">
<div class="w3-section">
<label><b>Password:</b></label>
<input class="w3-input w3-border" type="password" placeholder="Enter Password" id="login_password" required>
<input class="w3-check w3-margin-top" type="checkbox" id="rm_login" value="rememberme" /> Remember me
<button class="w3-button w3-block w3-green w3-section w3-padding" onclick="loginDialog('login')">Login</button>
</div>
</div>
<div class="w3-container w3-border-top w3-padding-16 w3-light-grey">
<button onclick="navDialog('loginScreens', 'LoginForm');" type="button" class="w3-button w3-red"><< Back</button>
<span class="w3-right w3-padding w3-hide-small"><a href="#" onclick="loginDialog('resetpw')">Reset Password?</a></span>
</div>
</div>
<div id="SignupForm" class="loginScreens" style="display:none">
<div class="w3-container">
<div class="w3-section">
<label><b> First Name or Nickname:</b></label>
<input class="w3-input w3-border w3-margin-bottom" type="text" placeholder="Enter first name" id="firstname" required>
<label><b>Password:</b></label>
<input class="w3-input w3-border" type="password" placeholder="Enter password" id="signup_password" required>
<input class="w3-check w3-margin-top" type="checkbox" id="rm_signup" value="signup" /> Remember me
<button class="w3-button w3-block w3-green w3-section w3-padding" onclick="loginDialog('signup')">Join</button>
</div>
</div>
<div class="w3-container w3-border-top w3-padding-16 w3-light-grey">
<button onclick="navDialog('loginScreens', 'LoginForm');" type="button" class="w3-button w3-red"><< Back</button>
</div>
</div>
</div>
</div>
<script>
$("#signout").on("click", function() {
$.ajax({url:"api/user.cfm?action=logout"})
.done(function(data) {
window.location.href = "/cfp";
});
});
function loginDialog(action) {
let reqObj = {};
switch (action) {
case "gotoLoginScreen" :
navDialog("loginScreens", "LoginForm");
break;
case "checkEmail" :
// do validation here
reqObj = {
"action":"checkEmail",
"email": document.getElementById("email").value
}
$.ajax({
data: reqObj,
method: "post",
url:"api/user.cfm?action=checkemail",
dataType: "json",
success: function(response) {
if (response.STATUS == 'Success') {
$("#welcome").html("Welcome back <br />" + response.DATA)
navDialog("loginScreens", "PasswordForm");
} else {
navDialog("loginScreens", "SignupForm");
}
}
});
break;
case "login" :
// do validation here
reqObj = {
"action":"login",
"email": document.getElementById("email").value,
"password": document.getElementById("login_password").value,
"enablerememberme": document.getElementById("rm_login").checked
}
$.ajax({
data: reqObj,
method: "post",
url:"api/user.cfm?action=login",
dataType: "json",
success: function(response) {
if (response.STATUS == 'Success') {
document.location.reload();
} else {
if (response.STATUS == "FailPassword") {
navDialog("loginScreens", "SignupForm");
} else {
navDialog("loginScreens", "LoginForm");
}
}
}
});
break;
case "signup" :
// do validation here
reqObj = {
"action":"signup",
"email": document.getElementById("email").value,
"firstname": document.getElementById("firstname").value,
"password": document.getElementById("signup_password").value,
"enablerememberme": document.getElementById("rm_signup").checked
}
$.ajax({
data: reqObj,
method: "post",
url:"api/user.cfm?action=signup",
dataType: "json",
success: function(response) {
alert(response.MESSAGE);
if (response.STATUS == 'Success') {
document.location.reload();
} else {
navDialog("loginScreens", "SignupForm");
}
}
});
break;
case "gotoPasswordScreen" :
navDialog("loginScreens", "LoginForm");
break;
default:
console.log("~~ Default ~~");
console.log(action);
}
}
function navDialog(dialog, screen) {
var x = document.getElementsByClassName(dialog);
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
document.getElementById(screen).style.display = "block";
}
function navDialog(dialog, screen) {
var x = document.getElementsByClassName(dialog);
for (i = 0; i < x.length; i++) {
x[i].style.display = "none";
}
document.getElementById(screen).style.display = "block";
}
</script>