diff --git a/README.md b/README.md index 8ee797b..bf30d82 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ -# [Synchrony Financial Mobile Device Tracking System](https://seniordesign.cfapps.io/html/webpages/) +# [Innovation Hub](https://seniordesign.cfapps.io/html/webpages/) In the Innovation Station at Synchrony Financial, applications are used by over 60 million cardholders across the US, and those customers use a huge variety of devices to access them. To make sure applications work on all devices they house hundreds of smart phones, tablets, and other connected devices to test with. The devices are lent to employees across the country for their individual testing needs. The goal of this project is to build and design an application that allows employees to view a list of available devices, allow employees to request one of those devices, and for it to be shipped for their testing needs. The current goal of this project is to design this as a Java web application that will work proficiently on phones and desktops. Team member on this project include: -* Brianna Boyce +* Connor Jackson * Adam Claxton +* Brianna Boyce * John Costa * Maegan Dyakiw -* Connor Jackson + diff --git a/Senior Design.war b/Senior Design.war new file mode 100644 index 0000000..75fff92 Binary files /dev/null and b/Senior Design.war differ diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp index 3ac93cc..9c3445f 100644 --- a/WebContent/adminLogin.jsp +++ b/WebContent/adminLogin.jsp @@ -1,67 +1,161 @@ <%@ page import = "database.*" %> -<%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@ page import = "java.sql.*" %> <%@ page import = "java.security.MessageDigest" %> <%@ page import = "java.security.NoSuchAlgorithmException" %> -<% -int ssoNum; -String pass; -Cookie adminCookie; +<%@ page import = "java.util.Random" %> + + + + + + + + + -ssoNum = Integer.parseInt(request.getParameter("ssoNum2")); -pass = request.getParameter("pass"); -String generatedPass = null; + Innovation Hub -try { - MessageDigest md = MessageDigest.getInstance("MD5"); - md.update(pass.getBytes()); - byte[] bytes = md.digest(); - StringBuilder sb = new StringBuilder(); - for(int i = 0; i + + + + + + + + + +<% +/* + If admin chose to login, we work on this form. +*/ +if(request.getParameter("login") != null){ + /* + Get form information from last page. + */ + int ssoNum = Integer.parseInt(request.getParameter("username")); + String pass = request.getParameter("pass"); + Cookie adminCookie; + String generatedPass = null; - generatedPass = sb.toString(); -} -catch (NoSuchAlgorithmException e){ + /* + Hash what the user put in, so we can see if the passwords match up. + */ + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(pass.getBytes()); + byte[] bytes = md.digest(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i \ No newline at end of file +/* + If the user wants to reset their password, we will keep them on this page. +*/ +%> + + \ No newline at end of file diff --git a/WebContent/html/imgs/cat.png b/WebContent/html/imgs/cat.png deleted file mode 100644 index 23058ae..0000000 Binary files a/WebContent/html/imgs/cat.png and /dev/null differ diff --git a/WebContent/html/imgs/cat_admin.png b/WebContent/html/imgs/cat_admin.png deleted file mode 100644 index f0bca6b..0000000 Binary files a/WebContent/html/imgs/cat_admin.png and /dev/null differ diff --git a/WebContent/html/imgs/loader.gif b/WebContent/html/imgs/loader.gif new file mode 100644 index 0000000..9bfca92 Binary files /dev/null and b/WebContent/html/imgs/loader.gif differ diff --git a/WebContent/html/imgs/potato.png b/WebContent/html/imgs/potato.png deleted file mode 100644 index d98bd68..0000000 Binary files a/WebContent/html/imgs/potato.png and /dev/null differ diff --git a/WebContent/html/imgs/synchrony logo.png b/WebContent/html/imgs/synchrony logo.png new file mode 100644 index 0000000..0751a83 Binary files /dev/null and b/WebContent/html/imgs/synchrony logo.png differ diff --git a/WebContent/html/imgs/user_icon.png b/WebContent/html/imgs/user_icon.png deleted file mode 100644 index feff4b3..0000000 Binary files a/WebContent/html/imgs/user_icon.png and /dev/null differ diff --git a/WebContent/html/javascript/request.jsp b/WebContent/html/javascript/request.jsp index 21f9d45..e1e8f4c 100644 --- a/WebContent/html/javascript/request.jsp +++ b/WebContent/html/javascript/request.jsp @@ -11,6 +11,7 @@ Device[] mydevices = DeviceQueries.getAvailableDevices(); //string representation of array. String deviceString = Device.arrayToString(mydevices); +deviceString = deviceString.replace("'","\\'"); //out.println(description); //out.println(hardware); %> @@ -32,6 +33,8 @@ showAll(); // searchbar listener var searchbar = document.getElementsByName('searchBar'); searchbar[0].onkeyup = refresh; +// populate page with all devices by default +show(devices); function refresh() { show(fuzzyFilter(filter(devices))); } diff --git a/WebContent/html/webpages/administration/admin.jsp b/WebContent/html/webpages/administration/admin.jsp index 6719058..d74b3fc 100644 --- a/WebContent/html/webpages/administration/admin.jsp +++ b/WebContent/html/webpages/administration/admin.jsp @@ -7,7 +7,7 @@ -Synchrony Financial +Innovation Hub @@ -74,12 +74,10 @@ div.approveConfirm { <%@ include file="../components/adminsidebar.jsp" %>
-

Welcome to the admin page

+

Welcome to The Admin Hub!

+

Select from any option in the sidebar to exert your administrative power!

- - - \ No newline at end of file diff --git a/WebContent/html/webpages/administration/adminApprove.jsp b/WebContent/html/webpages/administration/adminApprove.jsp index aa4b08e..d6a304e 100644 --- a/WebContent/html/webpages/administration/adminApprove.jsp +++ b/WebContent/html/webpages/administration/adminApprove.jsp @@ -1,6 +1,6 @@ <%@ page import = "database.*,entities.*" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> +pageEncoding="ISO-8859-1"%> @@ -11,51 +11,19 @@ - Synchrony Financial - - - - - - + Innovation Hub + + + + + + + + + + + @@ -107,6 +84,7 @@ Location Name Device Name Status + Permanent? Return Date @@ -118,6 +96,7 @@ + @@ -125,15 +104,19 @@

Admin View Approvals

- + + + +
- - - - - - + + + + + + + @@ -142,89 +125,215 @@ <% - TicketQueries query = new TicketQueries(); - Ticket[] tickets = query.getTickets(); - User[] users = EmployeeQueries.getAllUsers(); - Location[] locations = LocationQueries.getAllLocations(); - Device[] devices = DeviceQueries.getAllDevices(); - String ticketStr = Ticket.arrayToString(tickets); - String userStr = User.arrayToString(users); - String locationStr = Location.arrayToString(locations).replace("'","\\'"); - String deviceStr = Device.arrayToString(devices); +/* + Get all tickets that need to be reviewed for approval from the server. +*/ +Ticket[] tickets = TicketQueries.getRequestedTickets(); +String ticketStr = Ticket.arrayToString(tickets); %> - - - + return finalResults; + } + + /* + Params: arrays - a set of arrays that will be unioned together. + Output: One array, union of the input + Unions array results and removes duplicates. This is needed to support + fuzzy filter search. + */ + function union(arrays) { + if(arrays.length == 2) + return(unionBaseCase(arrays[0],arrays[1])) + if(arrays.length == 1) + return(arrays[0]) + else{ + var pivot = Math.floor(arrays.length/2); + var arrayA=arrays.slice(0,pivot); + var arrayB=arrays.slice(pivot); + return union([union(arrayA),union(arrayB)]); + } + } + + /* + Params: array1 - first array we are unioning, array2 - second array we are unioning + Output: results - One array, the union of the two inputs. + This is where tha magic happens and the actual union occurs between two arrays. + */ + function unionBaseCase(array1,array2) { + var results = new Array(); + while(array1.length>0 && array2.length>0) { + if(array1[0].index == array2[0].index){ + array1.splice(0,1); + } + else + results.push((array1[0].index > array2[0].index ? array2.splice(0,1)[0] : array1.splice(0,1)[0])) + } + results = results.concat(array1); + results = results.concat(array2); + return results; + } + + + \ No newline at end of file diff --git a/WebContent/html/webpages/administration/adminDeviceSettings.jsp b/WebContent/html/webpages/administration/adminDeviceSettings.jsp index f19c36f..476c6a3 100644 --- a/WebContent/html/webpages/administration/adminDeviceSettings.jsp +++ b/WebContent/html/webpages/administration/adminDeviceSettings.jsp @@ -11,10 +11,16 @@ pageEncoding="ISO-8859-1"%> - Synchrony Financial + Innovation Hub + + + + + +
Ticket IDRequestor NameLocation NameDevice NameStatusReturn DateTicket IDRequestor NameLocation NameDevice NameStatusPermanent?Return Date
- - - - - - - - - - - - +
NameAddressTownStateZip Code
+ + + + + + + + + + + +
NameAddressTownStateZip Code
<% - //database query to get locations that all employees can access Location[] locations = LocationQueries.getAdminLocations(); //string representation of array. String locationString = Location.arrayToString(locations); locationString = locationString.replace("'","\\'"); %> - \ No newline at end of file diff --git a/WebContent/html/webpages/administration/adminpassword.jsp b/WebContent/html/webpages/administration/adminpassword.jsp index 6ccf7bc..02199d0 100644 --- a/WebContent/html/webpages/administration/adminpassword.jsp +++ b/WebContent/html/webpages/administration/adminpassword.jsp @@ -7,7 +7,7 @@ - Synchrony Financial + Innovation Hub diff --git a/WebContent/html/webpages/administration/adminpasswordsetting.jsp b/WebContent/html/webpages/administration/adminpasswordsetting.jsp new file mode 100644 index 0000000..332a828 --- /dev/null +++ b/WebContent/html/webpages/administration/adminpasswordsetting.jsp @@ -0,0 +1,62 @@ + + + + + + + + + + Innovation Hub + + + + + + + + + + + + + + + +
+ +
+

Change Your Password

+
+ + +
+
+ + +
+
+ + +
+ +
+
+

Change Pincode

+
+ + +
+ +
+
+ + \ No newline at end of file diff --git a/WebContent/html/webpages/administration/adminpasswordsettingtryagain.jsp b/WebContent/html/webpages/administration/adminpasswordsettingtryagain.jsp new file mode 100644 index 0000000..306e39b --- /dev/null +++ b/WebContent/html/webpages/administration/adminpasswordsettingtryagain.jsp @@ -0,0 +1,63 @@ + + + + + + + + + + Innovation Hub + + + + + + + + + + + + + + + +
+ +
+

Something went wrong. Try again!

+

Change Your Password

+
+ + +
+
+ + +
+
+ + +
+ +
+
+

Change Pincode

+
+ + +
+ +
+
+ + \ No newline at end of file diff --git a/WebContent/html/webpages/administration/adminpasswordtryagain.jsp b/WebContent/html/webpages/administration/adminpasswordtryagain.jsp index b72bd36..29ac487 100644 --- a/WebContent/html/webpages/administration/adminpasswordtryagain.jsp +++ b/WebContent/html/webpages/administration/adminpasswordtryagain.jsp @@ -7,7 +7,7 @@ - Synchrony Financial + Innovation Hub diff --git a/WebContent/html/webpages/administration/allTickets.jsp b/WebContent/html/webpages/administration/allTickets.jsp new file mode 100644 index 0000000..0ea097a --- /dev/null +++ b/WebContent/html/webpages/administration/allTickets.jsp @@ -0,0 +1,256 @@ +<%@ page import = "database.*,entities.*" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" +pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Innovation Hub + + + + + + + + + + + + + + + + + + + + + + +
+

All Tickets

+ +
+ +
+
+ + + + + + + + + + + + + + +
Ticket IDRequestor NameLocation NameDevice NameStatusPermanent?Return Date
+
+
+ +<% +/* + Get all tickets. +*/ +Ticket[] tickets = TicketQueries.getAllTickets(); +String ticketStr = Ticket.arrayToString(tickets); +%> + + + + + \ No newline at end of file diff --git a/WebContent/html/webpages/administration/newadmin.jsp b/WebContent/html/webpages/administration/newadmin.jsp new file mode 100644 index 0000000..a9a8675 --- /dev/null +++ b/WebContent/html/webpages/administration/newadmin.jsp @@ -0,0 +1,239 @@ +<%@ page import="database.*,entities.*"%> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + + Synchrony Financial + + + + + + + + + + + + + + + + + + + + + +
+

Administrator Management Settings

+ + + + + + + + + + +
NameSSOFingerprint Registered?
+ +
+ + + + + + + +<% + Admin[] admins = AdminQueries.getAllAdmins(); + String adminString = Admin.arrayToString(admins); + adminString = adminString.replace("'", "\\'"); +%> + + + + diff --git a/WebContent/html/webpages/administration/ticketApprove.jsp b/WebContent/html/webpages/administration/ticketApprove.jsp new file mode 100644 index 0000000..72a968a --- /dev/null +++ b/WebContent/html/webpages/administration/ticketApprove.jsp @@ -0,0 +1,70 @@ +<%@ page import = "database.*,entities.Location" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Innovation Hub + + + + + + + + + + + + + +
+

Approving Tickets

+

Thanks for approving a ticket!

+

You can ship the devices to the following address:

+
+ Synchrony Financial

+
+
+ +
+
+ +<% +int locationid = -1; +for(Cookie c : usercookies){ + if(c.getName().equals("location")){ + locationid = Integer.parseInt(c.getValue()); + c.setMaxAge(0); + c.setPath("/"); + response.addCookie(c); + } +} +Location location = LocationQueries.getLocationByID(locationid); +String address = location.getAddress(); +String town = location.getTown(); +String state = location.getState(); +String zip = location.getZip(); +%> + + \ No newline at end of file diff --git a/WebContent/html/webpages/components/adminnavbar.jsp b/WebContent/html/webpages/components/adminnavbar.jsp index 7993b01..19dc020 100644 --- a/WebContent/html/webpages/components/adminnavbar.jsp +++ b/WebContent/html/webpages/components/adminnavbar.jsp @@ -9,7 +9,7 @@ - +

@@ -19,10 +19,23 @@
@@ -30,7 +43,6 @@ Cookie[] usercookies = request.getCookies(); String navsso = "invalid"; String navname = "error"; - User self = new User(); int admin = 0; //iterate cookies @@ -38,7 +50,6 @@ for(Cookie c : usercookies){ if(c.getName().equals("ssoNum") || c.getName().equals("admin")){//when (and if) we get to user cookie we want to reset it navsso = c.getValue(); - String cookiename = c.getName(); c.setMaxAge(30*60);//delete current c.setPath("/"); response.addCookie(c); @@ -46,6 +57,12 @@ if(c.getName().equals("admin")){ admin = 1; } + if(c.getName().equals("name")){ + navname = c.getValue(); + c.setMaxAge(30*60); + c.setPath("/"); + response.addCookie(c); + } } } if(navsso.equals("invalid")){//if we didn't get a cookie, redirect to the homepage to log in again! @@ -53,8 +70,10 @@ return; } else{ - self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso)); - navname = self.getName(); + if(admin == 0){//non admin trying to trespass + response.sendRedirect("../index.jsp"); + return; + } } %> @@ -62,5 +81,5 @@ var name = '<%=navname%>'; document.getElementById('user').innerHTML = "Hi " + name + "!"; if(<%=admin%> == 1) -document.getElementById('adminbar').innerHTML = 'Admin Hub' +document.getElementById('adminbar').innerHTML = '' \ No newline at end of file diff --git a/WebContent/html/webpages/components/adminsidebar.jsp b/WebContent/html/webpages/components/adminsidebar.jsp index 10b20d6..72c0223 100644 --- a/WebContent/html/webpages/components/adminsidebar.jsp +++ b/WebContent/html/webpages/components/adminsidebar.jsp @@ -2,9 +2,11 @@
\ No newline at end of file diff --git a/WebContent/html/webpages/components/navbar.jsp b/WebContent/html/webpages/components/navbar.jsp index 70e6caa..16e9d1d 100644 --- a/WebContent/html/webpages/components/navbar.jsp +++ b/WebContent/html/webpages/components/navbar.jsp @@ -9,7 +9,7 @@ - +

@@ -18,11 +18,24 @@
@@ -30,7 +43,6 @@ Cookie[] usercookies = request.getCookies(); String navsso = "invalid"; String navname = "error"; - User self = new User(); int admin = 0; //iterate cookies @@ -38,7 +50,6 @@ for(Cookie c : usercookies){ if(c.getName().equals("ssoNum") || c.getName().equals("admin")){//when (and if) we get to user cookie we want to reset it navsso = c.getValue(); - String cookiename = c.getName(); c.setMaxAge(30*60);//delete current c.setPath("/"); response.addCookie(c); @@ -46,21 +57,23 @@ if(c.getName().equals("admin")){ admin = 1; } + if(c.getName().equals("name")){ + navname = c.getValue(); + c.setMaxAge(30*60); + c.setPath("/"); + response.addCookie(c); + } } } if(navsso.equals("invalid")){//if we didn't get a cookie, redirect to the homepage to log in again! response.sendRedirect("../../index.jsp"); return; } - else{ - self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso)); - navname = self.getName(); - } %> \ No newline at end of file diff --git a/WebContent/html/webpages/error.jsp b/WebContent/html/webpages/error.jsp index be4cdeb..ca6df45 100644 --- a/WebContent/html/webpages/error.jsp +++ b/WebContent/html/webpages/error.jsp @@ -8,7 +8,7 @@ - Synchrony Financial + Innovation Hub @@ -16,7 +16,7 @@ @@ -86,9 +85,9 @@

Device Dictionary - +
- +

diff --git a/WebContent/html/webpages/mytickets.jsp b/WebContent/html/webpages/mytickets.jsp new file mode 100644 index 0000000..47047c1 --- /dev/null +++ b/WebContent/html/webpages/mytickets.jsp @@ -0,0 +1,247 @@ +<%@ page import = "database.*,entities.*" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" +pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Innovation Hub + + + + + + + + + + + + + + + + + + + +
+

My Tickets

+ +
+ +
+ + + + + + + + + + + + + + +
Ticket IDRequestor NameLocation NameDevice NameStatusPermanent?Return Date
+
+ +<% +/* + Get all tickets in users name. +*/ +Ticket[] tickets = TicketQueries.getAllTickets(Integer.parseInt(navsso)); +String ticketStr = Ticket.arrayToString(tickets); +%> + + + + + \ No newline at end of file diff --git a/WebContent/html/webpages/profileSettings.jsp b/WebContent/html/webpages/profileSettings.jsp index 71cd20b..8cf0fec 100644 --- a/WebContent/html/webpages/profileSettings.jsp +++ b/WebContent/html/webpages/profileSettings.jsp @@ -9,7 +9,7 @@ - Synchrony Financial + Innovation Hub @@ -63,6 +63,9 @@ + <% + User self = EmployeeQueries.getEmployeeByID(Integer.parseInt(navsso)); + %> -
+
@@ -123,36 +126,45 @@
-
+ +
+ + + + + + + + +

Redirect Page

+

You shouldn't be seeing this page :)

+ +<% +/* + We follow into this "if" statement if the password change form was submitted. +*/ +if(request.getParameter("password") != null){ + /* + Gathering form information that the user submitted. + */ + String old = request.getParameter("old"); + String newpass = request.getParameter("new"); + String confirm = request.getParameter("confirm"); + String generatedOldPass = null; + + /* + This uses MD5 to hash the old password the user entered in, so it can be compared against what is in the DB. + */ + try { + MessageDigest md = MessageDigest.getInstance("MD5"); + md.update(old.getBytes()); + byte[] bytes = md.digest(); + StringBuilder sb = new StringBuilder(); + for(int i = 0; i + + \ No newline at end of file diff --git a/WebContent/html/webpages/redirect/createProfile.jsp b/WebContent/html/webpages/redirect/createProfile.jsp new file mode 100644 index 0000000..af9796c --- /dev/null +++ b/WebContent/html/webpages/redirect/createProfile.jsp @@ -0,0 +1,54 @@ +<%@ page import = "database.*,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + + + +

Redirect Page

+

You shouldn't be seeing this page :)

+ +<% +//make instance +Cookie userCookie,newCookie; +String sso = request.getParameter("sso"); +String name = request.getParameter("name"); +String loc = request.getParameter("loc"); +String ph = request.getParameter("ph"); +String email = request.getParameter("email"); +//form was submitted +if(request.getParameter("submit") != null){ + EmployeeQueries.addEmployee(Integer.parseInt(sso),Integer.parseInt(loc),name,ph,email); + request.getSession(); + session.setAttribute("ssoNum", sso); + userCookie = new Cookie("ssoNum", sso); + userCookie.setMaxAge(30*60); + userCookie.setPath("/"); + response.addCookie(userCookie); + newCookie = new Cookie("name",name); + newCookie.setMaxAge(30*60); + newCookie.setPath("/"); + response.addCookie(newCookie); + response.sendRedirect("../index.jsp"); +} + +%> + + \ No newline at end of file diff --git a/WebContent/html/webpages/redirect/deviceRedirect.jsp b/WebContent/html/webpages/redirect/deviceRedirect.jsp index 1c2273b..9fc22b5 100644 --- a/WebContent/html/webpages/redirect/deviceRedirect.jsp +++ b/WebContent/html/webpages/redirect/deviceRedirect.jsp @@ -36,9 +36,12 @@ String hardware = request.getParameter("hardware").replace("\"","\\\""); String model = request.getParameter("model").replace("\"","\\\""); String serial = request.getParameter("serial"); String nfc = request.getParameter("NFC"); +String os = request.getParameter("OS"); +String locker = request.getParameter("locker"); +String comment = request.getParameter("admincomments"); //add form was submitted if(request.getParameter("add") != null){ - Device device = new Device(name,1,description,hardware,model,manufacturer,status,mac,serial,nfc); + Device device = new Device(name,1,description,hardware,model,manufacturer,status,mac,serial,nfc,locker,os,comment,""); DeviceQueries.addDevice(device); } @@ -48,7 +51,7 @@ if(request.getParameter("modify") != null){ String strID = request.getParameter("id"); //turn to int for constructor int id = Integer.parseInt(strID); - Device device = new Device(name,id,description,hardware,model,manufacturer,status,mac,serial,nfc); + Device device = new Device(name,id,description,hardware,model,manufacturer,status,mac,serial,nfc,locker,os,comment,""); DeviceQueries.modifyDevice(device); } diff --git a/WebContent/html/webpages/redirect/locationRedirect.jsp b/WebContent/html/webpages/redirect/locationRedirect.jsp index 58bdd32..9c80f3d 100644 --- a/WebContent/html/webpages/redirect/locationRedirect.jsp +++ b/WebContent/html/webpages/redirect/locationRedirect.jsp @@ -32,10 +32,12 @@ String address = request.getParameter("address").replace("\"","\\\""); String town = request.getParameter("town").replace("\"","\\\""); String state = request.getParameter("state"); String zip = request.getParameter("zip"); +String lat = request.getParameter("lat"); +String lng = request.getParameter("lng"); int er = 0; //add form was submitted if(request.getParameter("add") != null){ - Location location = new Location(name,address,town,state,zip,0); + Location location = new Location(0,name,address,town,state,zip,0,lat,lng,0,0); LocationQueries.addLocation(location); } //modify form was submitted @@ -44,7 +46,7 @@ if(request.getParameter("modify") != null){ String strID = request.getParameter("id"); //turn to int for constructor int id = Integer.parseInt(strID); - Location location = new Location(id,name,address,town,state,zip); + Location location = new Location(id,name,address,town,state,zip,0,lat,lng,0,0); LocationQueries.modifyLocation(location); } //delete form was submitted diff --git a/WebContent/html/webpages/redirect/newadminRedirect.jsp b/WebContent/html/webpages/redirect/newadminRedirect.jsp new file mode 100644 index 0000000..12e7e93 --- /dev/null +++ b/WebContent/html/webpages/redirect/newadminRedirect.jsp @@ -0,0 +1,83 @@ +<%@ page import = "database.*,entities.*" %> +<%@ page import = "java.util.Random" %> +<%@ page import = "database.*" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> +<%@ page import = "java.sql.*" %> +<%@ page import = "java.security.MessageDigest" %> +<%@ page import = "java.security.NoSuchAlgorithmException" %> +<%@ page import = "utilities.Mail" %> + + + + + + + + + + + + + + \ No newline at end of file diff --git a/WebContent/html/webpages/redirect/notificationSettingsRedirect.jsp b/WebContent/html/webpages/redirect/notificationSettingsRedirect.jsp new file mode 100644 index 0000000..171a581 --- /dev/null +++ b/WebContent/html/webpages/redirect/notificationSettingsRedirect.jsp @@ -0,0 +1,33 @@ +<%@ page import = "database.*,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" +pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + +<% + int user = Integer.parseInt(request.getParameter("prefferedNotificationInteger")); + int prefs = Integer.parseInt(request.getParameter("user")); + EmployeeQueries.updateNotificationPreferences(prefs,user); +%> + + + + \ No newline at end of file diff --git a/WebContent/html/webpages/redirect/orderFormHandler.jsp b/WebContent/html/webpages/redirect/orderFormHandler.jsp index dd8e9ba..aff74f9 100644 --- a/WebContent/html/webpages/redirect/orderFormHandler.jsp +++ b/WebContent/html/webpages/redirect/orderFormHandler.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.*" %> +<%@ page import = "database.*,entities.Location" %> <%@ page import = "entities.User" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> @@ -19,17 +19,20 @@ pageEncoding="ISO-8859-1"%> - -

Redirect Page

-

You shouldn't be seeing this page :)

- <% -//make instance +// Get form information. String ticketidstr = request.getParameter("ticketid"); String deviceidstr = request.getParameter("deviceid"); String locationidstr = request.getParameter("locationid"); +String permanent = request.getParameter("permField"); int ticketid = Integer.parseInt(ticketidstr); int deviceid = Integer.parseInt(deviceidstr); int locationid = Integer.parseInt(locationidstr); +int perm = permanent.equals("Yes") ? 1 : 0; -//add form was submitted +/* + Approve ticket form was submitted. +*/ if(request.getParameter("approve") != null){ - TicketQueries.acceptTicket(ticketid,deviceid,locationid,Integer.parseInt(navsso)); + // The location name that is being shipped is currently being stored in a temporary cookie. + Cookie location = new Cookie("location",Integer.toString(locationid)); + location.setMaxAge(30*60); + location.setPath("/"); + response.addCookie(location); + + // Accept the ticket + TicketQueries.acceptTicket(ticketid,deviceid,locationid,Integer.parseInt(navsso),perm); + + // Dispatch email. User client = EmployeeQueries.getEmployeeByID(TicketQueries.getUserID(ticketid)); - boolean notificationPreferences = true; //TODO get real preference + boolean notificationPreferences = (Math.floor(client.getNotificationPreferences()/2)%2==1); + //The second least significant bit of notificationPreferences - the 2's place - is used for ticket approval notifications. if(notificationPreferences){ NotificationQueue q = new NotificationQueue(client,"ticketConfirmations"); - q.run(); + q.start(); + response.sendRedirect("../administration/ticketApprove.jsp"); + return; } } -//modify form was submitted + +/* + Ticket reject form was submitted. +*/ if(request.getParameter("reject") != null){ + // Reject the ticket. TicketQueries.rejectTicket(ticketid); + + // Dispatch email. + User client = EmployeeQueries.getEmployeeByID(TicketQueries.getUserID(ticketid)); + boolean notificationPreferences = (Math.floor(client.getNotificationPreferences()/4)%2==1); + //The third least significantbit of notificationPreferences - te 4's place - is used for ticket rejection notifications. + if(notificationPreferences){ + NotificationQueue q = new NotificationQueue(client, "ticketRejections"); + q.start(); + response.sendRedirect("../administration/adminApprove.jsp"); + return; + } } %> - - \ No newline at end of file diff --git a/WebContent/html/webpages/requestPage.jsp b/WebContent/html/webpages/requestPage.jsp index f1ebda2..0e2822c 100644 --- a/WebContent/html/webpages/requestPage.jsp +++ b/WebContent/html/webpages/requestPage.jsp @@ -7,7 +7,7 @@ - Synchrony Financial + Innovation Hub @@ -58,11 +58,11 @@ border-radius: 5px; } #pup{ - background-color: #E9EAEB; - border: solid; - text-align: center; - padding: 10px; - } + background-color: #E9EAEB; + border: solid; + text-align: center; + padding: 10px; + } @@ -97,7 +97,7 @@
- +

Or choose an option to the left to begin requesting!

diff --git a/WebContent/html/webpages/returnComplete.jsp b/WebContent/html/webpages/returnComplete.jsp index 9496be2..398daa8 100644 --- a/WebContent/html/webpages/returnComplete.jsp +++ b/WebContent/html/webpages/returnComplete.jsp @@ -1,6 +1,6 @@ -<%@ page import = "database.*,entities.RentedDevice" %> +<%@ page import = "database.*" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> +pageEncoding="ISO-8859-1"%> @@ -11,7 +11,7 @@ - Synchrony Financial + Innovation Hub @@ -24,15 +24,21 @@ -

Returning Devices

-

Thanks for returning some devices!

-
- -
-<% +
+

Returning Devices

+

Thanks for returning some devices!

+

You can ship the devices to the following address:

+
+ Synchrony Financial
ATTN: Jake Miller
777 Long Ridge Road
Stamford, CT
06902 +
+
+ +
+
+ <% //get string from request form -String devices = request.getParameter("devicesToReturn"); -DeviceQueries.returnDevices(devices); -%> + String devices = request.getParameter("devicesToReturn"); + DeviceQueries.returnDevices(devices); + %> \ No newline at end of file diff --git a/WebContent/html/webpages/returnPage.jsp b/WebContent/html/webpages/returnPage.jsp index a677b37..8d5e862 100644 --- a/WebContent/html/webpages/returnPage.jsp +++ b/WebContent/html/webpages/returnPage.jsp @@ -1,6 +1,6 @@ <%@ page import = "database.*,entities.Device" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" - pageEncoding="ISO-8859-1"%> +pageEncoding="ISO-8859-1"%> @@ -11,7 +11,7 @@ - Synchrony Financial + Innovation Hub @@ -72,58 +72,58 @@ width: 20px; } #pup{ - background-color: #E9EAEB; - border: solid; - text-align: center; - padding: 10px; - } + background-color: #E9EAEB; + border: solid; + text-align: center; + padding: 10px; + } - + - -