Skip to content

Commit

Permalink
Merging Support
Browse files Browse the repository at this point in the history
  • Loading branch information
clj13001 committed Apr 13, 2017
2 parents fb62bfc + f22f1a4 commit 722b0ba
Show file tree
Hide file tree
Showing 30 changed files with 498 additions and 210 deletions.
1 change: 1 addition & 0 deletions .classpath
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/servlet-api.jar"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v8.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
Expand Down
4 changes: 4 additions & 0 deletions CREDITS.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ We would like to directly thank the following artists for their contributions:
* Sweater
* Aquarium
* Fruit
* Crying

## Freepik
* Gingerbread man
Expand All @@ -23,3 +24,6 @@ We would like to directly thank the following artists for their contributions:
* Doughnut
* Bird (the red one!)
* Paint Brush

##Roundicons
* Warning
11 changes: 11 additions & 0 deletions WebContent/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>Application Name </display-name>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<error-page>
<error-code>404</error-code>
<location>/html/webpages/error.jsp</location>
</error-page>
</web-app>
17 changes: 12 additions & 5 deletions WebContent/adminLogin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,28 @@ String pass;
Cookie adminCookie;
ssoNum = Integer.parseInt(request.getParameter("ssoNum2"));
pass = request.getParameter("pass");
MySQLAccess myaccess = new MySQLAccess();
Statement statement = myaccess.getStatement();
String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317";
String user = "b372dfe7409692";
String password = "74f6e317";
System.getenv("VCAP_SERVICES");
Class.forName("com.mysql.jdbc.Driver");
Connection connection = DriverManager.getConnection(database, user, password);
Statement stmt = connection.createStatement();
ResultSet result;
result = statement.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + pass + "'");
result = stmt.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + pass + "'");
if (result.next()){
request.getSession();
session.setAttribute("ssoNum", ssoNum);
adminCookie = new Cookie("ssoNum", Integer.toString(ssoNum));
adminCookie.setMaxAge(30*60);
response.addCookie(adminCookie);
statement.close();
stmt.close();
connection.close();
response.sendRedirect("html/webpages/admin.jsp");
} else {
statement.close();
stmt.close();
connection.close();
response.sendRedirect("index.jsp");
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ function IconSelect($$elementID, $$parameters) {
_View.selectedIconImgElement.setAttribute('src', icon.iconFilePath);
if(_selectedIndex != -1) _icons[_selectedIndex].element.setAttribute('class','icon selected');
if(_selectedIndex != -1) $('#profimg').attr("src","../imgs/my-icons-collection-128px/png/" + icon.iconValue + ".png");
if(_selectedIndex != -1) $('#hiddenIMG').val(icon.iconValue);
}

_View.iconSelectElement.dispatchEvent(new Event('changed'));
Expand Down
3 changes: 3 additions & 0 deletions WebContent/html/webpages/adminDeviceSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -265,10 +265,13 @@ window.onclick = function(e){var add = document.getElementById('addModal'); var
var manuHTML = '<option value="" disabled selected>Choose Manufacturer</option>';
var hardwareHTML = '<option value="" disabled selected>Choose Hardware</option>';
var availabilityHTML = '<option value="" disable selected>Choose Availability</option>';
manufacturers.sort();
for(var i = 0; i < manufacturers.length; i++)
manuHTML += '<option value="' + manufacturers[i] + '">' + manufacturers[i] + '</option>';
hardwares.sort();
for(var i = 0; i < hardwares.length; i++)
hardwareHTML += '<option value="' + hardwares[i] + '">' + hardwares[i] + '</option>';
availabilities.sort();
for(var i = 0; i < availabilities.length; i++)
availabilityHTML += '<option value="' + availabilities[i] + '">' + availabilities[i] + '</option>';
document.getElementById('addManu').innerHTML = manuHTML;
Expand Down
13 changes: 11 additions & 2 deletions WebContent/html/webpages/adminLocation.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@
<label for="modifyZip">Zip Code *</label>
<input style = "width: 100px;" name = "zip" type = "number" class="form-control" id="modifyZip" required = "true">
</div>
<button type = "submit" name = "modify" value = "Save Changes" class="btn btn-primary">Save Changes</button>
<button style = "display: inline-block;" type = "submit" name = "delete" value = "Delete Entry" class="btn btn-primary">Delete</button>
<button id = "themodifybutton" type = "submit" name = "modify" value = "Save Changes" class="btn btn-primary">Save Changes</button>
<button id = "thedeletebutton" type = "submit" name = "delete" value = "Delete Entry" class="btn btn-primary" style = "display: inline-block;" title = "hello">Delete</button>
<input type = "text" id = "modifyID" name = "id" style = "display: none;">
</form>
</div>
Expand Down Expand Up @@ -323,6 +323,15 @@ function modifyModal(){
$("#modifyState").val(locations[i].state);
$("#modifyZip").val(locations[i].zip);
$("#modifyID").val(locations[i].id);
if(locations[i].numDevices > 0 || locations[i].numEmployees > 0){
$('#thedeletebutton').attr('disabled',true);
$('#thedeletebutton').attr('title','Cannot delete because devices and/or employees are at this location!');
}
else{
$('#thedeletebutton').attr('disabled',false);
$('#thedeletebutton').removeAttr('title');
}
$("#modifyModal").show();
}
Expand Down
2 changes: 1 addition & 1 deletion WebContent/html/webpages/deviceRedirect.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
</nav>
</head>
<body>
Expand All @@ -28,7 +29,6 @@

<%
//make instance
MySQLAccess myaccess = new MySQLAccess();
String name = request.getParameter("name").replace("\"","\\\"");
String description = request.getParameter("description").replace("\"","\\\"");
String status = request.getParameter("status");
Expand Down
40 changes: 40 additions & 0 deletions WebContent/html/webpages/error.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<meta name="description" content="">
<meta name="author" content="">

<title>Synchrony Financial</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<link rel = "stylesheet" type = "text/css" href = "../css/stylesheet.css">
<link rel = "shortcut icon" href = "../imgs/synchrony-financial-logo-dlpx_1.ico">
<style>
div.error{
text-align: center;
position: absolute;
top: 50%;
left: 50%;
margin-top: -126px;
margin-left: -138px;
}
</style>
</head>

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
</nav>
<div class = "error">
<h2>Error</h2>
<img src="../imgs/my-icons-collection-128px/png/warning.png"/>
<h2>Page Does Not Exist</h2>
</div>
</body>
</html>
6 changes: 5 additions & 1 deletion WebContent/html/webpages/locationRedirect.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ String address = request.getParameter("address").replace("\"","\\\"");
String town = request.getParameter("town").replace("\"","\\\"");
String state = request.getParameter("state");
String zip = request.getParameter("zip");
int er = 0;
//add form was submitted
if(request.getParameter("add") != null){
Location location = new Location(name,address,town,state,zip,0);
Expand All @@ -52,11 +53,14 @@ if(request.getParameter("modify") != null){
if(request.getParameter("delete") != null){
String strID = request.getParameter("id");
int id = Integer.parseInt(strID);
LocationQueries.deleteLocation(id);
er = LocationQueries.deleteLocation(id);
}
%>
<script>
if(<%=er%> == 0)
window.location.replace("adminLocation.jsp");
else
window.location.replace("somethingwrong.jsp");
</script>
<!-- Navbar generation. -->
</body>
Expand Down
37 changes: 27 additions & 10 deletions WebContent/html/webpages/navbar.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,11 @@
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="../webpages/admin.jsp">
<a class="navbar-brand" href="index.jsp">
<img src="../imgs/synchrony-financial-logo-dlpx_1.png" style = "height: 100%; display: inline-block;">
&nbsp;&nbsp;&nbsp;&nbsp;
<p style = "display: inline-block" id = "user"></p>
</a>
<a class="navbar-brand" href="profileSettings.jsp">
<p style = "display: inline-block" id = "user"></p>
</a>
</div>
<div id="navbar" class="navbar-collapse collapse" aria-expanded="false">
Expand All @@ -25,15 +26,31 @@
</div>
<%
Cookie[] usercookies = request.getCookies();
int navsso = 0;
for(Cookie c : usercookies){
if(c.getName().equals("ssoNum")){
navsso = Integer.parseInt(c.getValue());
break;
String navsso = "invalid";
String navname = "error";
User self = new User();
Cookie newCookie;
//iterate cookies
if(usercookies != null){
for(Cookie c : usercookies){
if(c.getName().equals("ssoNum")){//when (and if) we get to user cookie we want to reset it
navsso = c.getValue();
c.setMaxAge(0);//delete current
newCookie = new Cookie("ssoNum",navsso);//make new one
newCookie.setMaxAge(30*60);
response.addCookie(newCookie);
break;
}
}
}
User self = EmployeeQueries.getEmployeeByID(navsso);
String navname = self.getName();
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();
}
%>
</div>
<script>
Expand Down
20 changes: 8 additions & 12 deletions WebContent/html/webpages/orderFormHandler.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html>
<body>
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
</nav>
<script type="text/javascript">
<%
Cookie[] cookies = request.getCookies();
int sso = 0;
for(Cookie c : cookies)
{
if(c.getName().equals("ssoNum")) sso = Integer.parseInt(c.getValue());
}
// If location id is 0, it is a custom location which must be added to the database before employee preffered location can be updated
int location=-1;
if(Integer.parseInt(request.getParameter("location_dropdown"))==0)
Expand All @@ -26,18 +21,19 @@ if(Integer.parseInt(request.getParameter("location_dropdown"))==0)
request.getParameter("locname"),
request.getParameter("state"),
request.getParameter("address"),
request.getParameter("city"),
request.getParameter("town"),
request.getParameter("zip"),
sso
Integer.parseInt(navsso)
);
}
//Now update employee
String userName = request.getParameter("name");
String phone = request.getParameter("phone");
String email = request.getParameter("email");
// read location ID, but only if we haven't already generated it when adding new location to db
if(location==-1){ location = Integer.parseInt(request.getParameter("location_dropdown"));}
EmployeeQueries.updateEmployee(sso, userName, phone, location);
EmployeeQueries.updateEmployee(Integer.parseInt(navsso), userName, phone, location, email);
System.out.print("updated employee "+userName);
// And now for the ticket
Expand All @@ -58,7 +54,7 @@ for(int i=0; i<idStringArray.length; i++)
// Now just call generateTicket once for each device
for(int i=0; i<devIDs.length; i++)
{
TicketQueries.generateTicket(sso, location, devIDs[i], request.getParameter("timeNeeded"));//TODO get ID somehow
TicketQueries.generateTicket(Integer.parseInt(navsso), location, devIDs[i], request.getParameter("timeNeeded"));//TODO get ID somehow
}
%>
Expand Down
14 changes: 8 additions & 6 deletions WebContent/html/webpages/profileSettings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -97,27 +97,28 @@
<div id="my-icon-select" style = "display: inline-block;"></div>
</div>
<!-- Where main user information is edited -->
<form class = "infobar">
<form action = "profileSettingsRedirect.jsp" class = "infobar">
<h2>Profile Settings</h2>
<div class = "form-group">
<label for="inputName">Full Name *</label>
<input style = "width: 350px;" type = "name" class="form-control" id="inputName" placeholder="Name" required = "true">
<input name = "name" style = "width: 350px;" type = "name" class="form-control" id="inputName" placeholder="Name" required = "true">
<span class = "help-block"></span>
</div>
<div class = "form-group">
<label for="inputSSO">SSO Number *</label>
<input style = "width: 100px;" type = "id" class="form-control" id="inputSSO" placeholder="SSO #" required = "true">
<input name = "sso" readonly style = "width: 100px;" type = "id" class="form-control" id="inputSSO" placeholder="SSO #" required = "true">
<span class = "help-block"></span>
</div>
<div class = "form-group">
<label for="inputTelephone">Telephone Number</label>
<input style = "width: 120px;" type = "tel" class="form-control" id="inputTelephone" placeholder="Telephone #">
<input name = "phone" style = "width: 120px;" type = "tel" class="form-control" id="inputTelephone" placeholder="Telephone #">
</div>
<div class = "form-group">
<label for="inputEmail">Email</label>
<input style = "width: 350px;" type = "email" class="form-control" id="inputEmail" placeholder="Email">
<input name = "email" style = "width: 350px;" type = "email" class="form-control" id="inputEmail" placeholder="Email">
</div>
<button type="submit" class="btn btn-primary" id = "apply">Apply Changes</button>
<input id = "hiddenIMG" style = "display: none" name = "img">
<button name = "profile" type="submit" class="btn btn-primary" id = "apply">Apply Changes</button>
</form>
</div>
<script>
Expand Down Expand Up @@ -147,6 +148,7 @@
//around here is where you'll have to define the current image, then this will update as the user selects new ones!
$('#profimg').attr("src","../imgs/my-icons-collection-128px/png/" + '<%=self.getIcon()%>' + ".png");
$('#hiddenIMG').val(<%=self.getIcon()%>);
};
//event listener on the apply changes button
Expand Down
Loading

0 comments on commit 722b0ba

Please sign in to comment.