Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/master' into bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
clj13001 committed Apr 17, 2017
2 parents 0a58ded + 8dda270 commit dd292c9
Show file tree
Hide file tree
Showing 42 changed files with 873 additions and 446 deletions.
26 changes: 22 additions & 4 deletions WebContent/adminLogin.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,39 @@
<%@ 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;
ssoNum = Integer.parseInt(request.getParameter("ssoNum2"));
pass = request.getParameter("pass");
String generatedPass = null;
try {
MessageDigest md = MessageDigest.getInstance("MD5");
md.update(pass.getBytes());
byte[] bytes = md.digest();
StringBuilder sb = new StringBuilder();
for(int i = 0; i<bytes.length; i++)
sb.append(Integer.toString((bytes[i] & 0xff) + 0x100, 16).substring(1));
generatedPass = sb.toString();
}
catch (NoSuchAlgorithmException e){
}
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 = stmt.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + pass + "'");
result = stmt.executeQuery("select * FROM admin where Admin_ID='" + ssoNum + "' AND Password='" + generatedPass + "'");
if (result.next()){
request.getSession();
Expand All @@ -31,13 +49,13 @@ if (result.next()){
if(result.getInt("Password_Flag") == 1){
stmt.close();
connection.close();
response.sendRedirect("html/webpages/admin.jsp");
response.sendRedirect("html/webpages/administration/admin.jsp");
return;
}
else{
stmt.close();
connection.close();
response.sendRedirect("html/webpages/adminpassword.jsp");
response.sendRedirect("html/webpages/administration/adminpassword.jsp");
return;
}
} else {
Expand Down
63 changes: 62 additions & 1 deletion WebContent/html/css/stylesheet.css
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ div.displayDevice{
overflow: scroll;
}

div.profileContainer{
div.profileContainer,
div.notificationContainer{
display: inline-block;
position: absolute;
padding-left: 30px;
Expand Down Expand Up @@ -94,3 +95,63 @@ span.close:focus{
ul.nav{
padding: 0px;
}

/*this is all to make slider-switches*/
/* The switch - the box around the slider */
.switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}

/* Hide default HTML checkbox */
.switch input {display:none;}

/* The slider */
.slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}

.slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}

input:checked + .slider {
background-color: #2196F3;
}

input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}

input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}

/* Rounded sliders */
.slider.round {
border-radius: 34px;
}

.slider.round:before {
border-radius: 50%;
}
10 changes: 7 additions & 3 deletions WebContent/html/javascript/listing.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
//out.println(description);
//out.println(hardware);
%>

<script src = "../javascript/nhpup_1.1.js"></script>
<script type=text/javascript>
//gets variables for database data
var devices = makeDeviceArray();
Expand All @@ -35,8 +35,10 @@ searchbar[0].onkeyup = refresh;
showAll();
function showAll(){
var html = '';
var part1 = "nhpup.popup('";
var part2 = "');"
for(var i = 0; i < devices.length; i++){
html += '<div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + devices[i].hardware + '.png" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i) + '"></div></div></div><br><br>';
html += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + devices[i].hardware + '<br><br>' + 'Manufacturer: ' + devices[i].manufacturer + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + devices[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + devices[i].name + '</div><div class = "deviceDescp"><p>' + devices[i].description + '</p><div class = "availableAnchor" id = "' + (i) + '"></div></div></div></a><br><br>';
}
document.getElementById('devContainer').innerHTML = html;
var anchors = document.getElementsByClassName('availableAnchor');
Expand All @@ -61,9 +63,11 @@ function refresh() {
}
function show(deviceArray){
var html = '';
var part1 = "nhpup.popup('";
var part2 = "');"
for (var i = 0; i < deviceArray.length; i++)
{
html += '<div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><div class = "availableAnchor" id = "' + (deviceArray[i].id) + '"></div></div></div><br><br>'
html += '<div class = "deviceContainer"><a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + part2 + '"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><div class = "availableAnchor" id = "' + (deviceArray[i].id) + '"></div></div></a></div><br><br>'
}
document.getElementById('devContainer').innerHTML = html;
var anchors = document.getElementsByClassName('availableAnchor');
Expand Down
30 changes: 16 additions & 14 deletions WebContent/html/javascript/request.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ String deviceString = Device.arrayToString(mydevices);
//out.println(description);
//out.println(hardware);
%>

<script src = "../javascript/nhpup_1.1.js"></script>
<script type=text/javascript>
//gets variables for database data
var devices = makeDeviceArray();
Expand All @@ -38,8 +38,10 @@ function refresh() {
function show(deviceArray){
// var type = this.getAttribute('data-type');
var html = '';
var part1 = "nhpup.popup('";
var part2 = "');"
for (var i = 0; i < deviceArray.length; i++) {
html += '<div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><button class = "requestbutton" id = "button' + (deviceArray[i].id) + '" type="button">Order device</button></div></div><br><br>'
html += '<a class = "divlink" href = "#" onmouseover = "'+ part1 + 'Hardware type: ' + deviceArray[i].hardware + '<br><br>' + 'Manufacturer: ' + deviceArray[i].manufacturer + part2 + '"><div class = "deviceContainer"><div class = "imgContainer"><img src="../imgs/my-icons-collection-devices/png/' + deviceArray[i].hardware + '.png" onerror="this.src=\'../imgs/synchrony-financial-logo-dlpx_1.png\';" class = "device">' + deviceArray[i].name + '</div><div class = "deviceDescp"><p>' + deviceArray[i].description + '</p><button class = "requestbutton" id = "button' + (deviceArray[i].id) + '" type="button">Order device</button></div></div></a><br><br>'
}
if(html.localeCompare("")==0)
Expand Down Expand Up @@ -92,21 +94,21 @@ function filter(deviceArray) {
if (activeHOptions.length == 0) {
hardwareMatch = true;
}
for(var j = 0; j < activeSOptions.length; j++) {
if (activeSOptions[j] == devices[i].manufacturer){
softwareMatch = true;
}
// now we must handle the 'other' case
// there is no 'other' catagory, so if that is the option selected we must make sure
// that the device in question is not one of the categories we DO have options for
if(activeSOptions[j] === 'Other')
{
var othermatch = true;
for (var k = 0; k < softwareOptions.length; k++) {
if(devices[i].manufacturer == softwareOptions[k].getAttribute('data-type'))
othermatch = false;
}
if(othermatch) softwareMatch = true;
}
for(var j = 0; j < activeSOptions.length; j++) {
if (activeSOptions[j] == deviceArray[i].manufacturer){
softwareMatch = true;
if(activeSOptions[j] === 'Other')
{
var othermatch = true;
for (var k = 0; k < softwareOptions.length; k++) {
if(devices[i].manufacturer == softwareOptions[k].getAttribute('data-type'))
othermatch = false;
}
if(othermatch) softwareMatch = true;
}
}
if (activeSOptions.length == 0) {
Expand Down
30 changes: 21 additions & 9 deletions WebContent/html/javascript/statistics.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,34 @@ displayData();
function displayData() {
var html = "";
var totalDevices = 0;
var availableDevices;
var loanDevices;
var lostDevices;
var availableDevices=0;
var loanDevices=0;
var lostDevices=0;
//umbrella sections
var pendingDevices=0;
var unavailDevices=0;
var returnDevices=0;
var brokenDevices=0;
if (statistics.status != "" && statistics.count != ""){
for (var i = 0; i<statistics.length; i++){
totalDevices = totalDevices + statistics[i].count;
}
//data for info section
availableDevices = statistics[0].count;
loanDevices = statistics[1].count;
//lostDevices = statistics[2].count;
//returnDevices = statistics[6].count;
//umbrella divisions
//pendingDevices = statistics[0].count;
unavailDevices = statistics[2].count;
availableDevices = statistics[1].count;
loanDevices = statistics[5].count;
lostDevices = statistics[4].count;
html += '<div class = "info-container">Total Devices: '+ totalDevices +
'<br>Loaned Devices: ' + loanDevices +
'<br>Available Devices: ' + availableDevices +
'<br>Loaned Devices: ' + loanDevices +
'<br>Returning Devices: ' + returnDevices +
'<br>Lost Devices: ' + lostDevices +
'</div>'
Expand All @@ -54,8 +66,8 @@ function displayData() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Status');
data.addColumn('number', 'Count');
data.addRows([['Total Devices', totalDevices],['Available Devices', availableDevices],
['Loaned Devices',loanDevices],['Lost Devices',lostDevices]]);
data.addRows([['Available Devices', availableDevices],['Unavailable Devices',unavailDevices],
['Loaned Devices',loanDevices]]);
// Set chart options
var options = {'title':'Chart of Devices',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/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="stylesheet" type="text/css" href="../../css/stylesheet.css">
<link rel="shortcut icon"
href="../imgs/synchrony-financial-logo-dlpx_1.ico">
href="../../imgs/synchrony-financial-logo-dlpx_1.ico">
<style>
div.deviceContainer {
border: solid;
Expand Down Expand Up @@ -67,25 +67,19 @@ div.approveConfirm {

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
<%@ include file="../components/adminnavbar.jsp"%>
</nav>

<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
<%@ include file="../components/adminsidebar.jsp" %>
</div>
<div class="displayDevice">
<h2>Welcome to the admin page</h2>
<div id="admin"></div>
</div>


<script src="../javascript/admin.js"></script>
<script src="../javascript/nhpup_1.1.js"></script>
<script src="../../javascript/admin.js"></script>
<script src="../../javascript/nhpup_1.1.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
<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/3.1.1/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">
<link rel = "stylesheet" type = "text/css" href = "../../css/stylesheet.css">
<link rel = "shortcut icon" href = "../../imgs/synchrony-financial-logo-dlpx_1.ico">
<style>
div.deviceContainer{
border: solid;
Expand Down Expand Up @@ -82,17 +82,11 @@

<body>
<nav class="navbar navbar-inverse navbar-fixed-top" id = "navbaruniversal">
<%@ include file="navbar.jsp"%>
<%@ include file="../components/adminnavbar.jsp"%>
</nav>

<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<h4>Admin Options</h4>
<li class="option"><a href="adminApprove.jsp">Approve Devices</a></li>
<!-- will add in when maegan is done <li class="option"><a href="#">Manage Admins</a></li> -->
<li class="option"><a href="adminDeviceSettings.jsp">Manage Devices</a></li>
<li class="option"><a href="adminLocation.jsp">Manage Locations</a></li>
</ul>
<%@ include file="../components/adminsidebar.jsp" %>
</div>

<!-- Modal for choosing ticket action. -->
Expand All @@ -104,7 +98,7 @@
</div><br>
<div class="modal-body">
<!-- Where new information is added. -->
<form ACTION = "ticketAdminRedirect.jsp" METHOD = "POST">
<form ACTION = "../redirect/ticketAdminRedirect.jsp" METHOD = "POST">
<table style = 'margin: 0 auto;' class="table table-bordered table-hover">
<thead>
<tr>
Expand Down Expand Up @@ -147,16 +141,17 @@
</table>
</div>

<%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);
%>
<%
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);
%>

<script>
window.json = '<%=ticketStr%>';
Expand Down
Loading

0 comments on commit dd292c9

Please sign in to comment.