From f256d44421cf0df153756518d295ee7248101ebe Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Thu, 30 Mar 2017 11:01:15 -0400 Subject: [PATCH 1/6] New files --- .../html/webpages/adminDeviceSettings.jsp | 342 ++++++++++++++++++ src/entities/Device.java | 86 +++++ 2 files changed, 428 insertions(+) create mode 100644 WebContent/html/webpages/adminDeviceSettings.jsp create mode 100644 src/entities/Device.java diff --git a/WebContent/html/webpages/adminDeviceSettings.jsp b/WebContent/html/webpages/adminDeviceSettings.jsp new file mode 100644 index 0000000..31c0744 --- /dev/null +++ b/WebContent/html/webpages/adminDeviceSettings.jsp @@ -0,0 +1,342 @@ +<%@ page import = "database.MySQLAccess,entities.Device" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + + + + + + + + + + + Synchrony Financial + + + + + + + + + + + + + + + + + + + + + +
+ +

Device Listing

+ + + + + + + + + + + + + + + + +
NameDescriptionMAC AddressManufacturerHardware TypeModel NameSerial NumberNFC ID
+ +
+<% +//database connection +MySQLAccess myaccess = new MySQLAccess(); +//database query +Location[] locations = myaccess.getAdminLocations(); +//string representation of array. +String locationString = Location.arrayToString(locations); +locationString = locationString.replace("'","\\'"); +%> + + + + + + \ No newline at end of file diff --git a/src/entities/Device.java b/src/entities/Device.java new file mode 100644 index 0000000..8ec6f6a --- /dev/null +++ b/src/entities/Device.java @@ -0,0 +1,86 @@ +package entities; + +/** + * Java representation of a mobile device. + * @author conno + * + */ +public class Device { + private String Device_ID; + private String Device_Name; + private String Device_Description; + private String Ticket_ID; + //Smartphone, tablet, etc. + private String Hardware; + //iPhone, Galaxy S5, etc. + private String Model; + private String Borrow_Date; + + public Device(String id, String name, String desc, String ticketid, String hardware, String model, String date){ + Device_ID = id; + Device_Name = name; + Device_Description = desc; + Ticket_ID = ticketid; + Hardware = hardware; + Model = model; + Borrow_Date = date; + } +/** + * Formatting the device to fit a JSON object. + */ + public String toString(){ + StringBuilder sb = new StringBuilder(); + String comma = ", "; + sb.append("{\"id\": ").append(Device_ID).append(comma); + sb.append("\"name\": \"").append(Device_Name).append("\"").append(comma); + sb.append("\"description\": \"").append(Device_Description).append("\"").append(comma); + sb.append("\"ticket\": \"").append(Ticket_ID).append("\"").append(comma); + sb.append("\"hardware\": \"").append(Hardware).append("\"").append(comma); + sb.append("\"model\": \"").append(Model).append("\"").append(comma); + sb.append("\"checkout\": \"").append(Borrow_Date).append("\""); + sb.append("}"); + return sb.toString(); + } + + /** + * This is a static function which will turn a Rented Device array into its proper string. + * @param array + * @return + */ + public static String arrayToString(Device[] array){ + StringBuilder sb = new StringBuilder(); + sb.append("["); + for(int i = 0; i < array.length; i++){ + sb.append(array[i].toString()); + if(i+1 != array.length){ + sb.append(","); + } + } + sb.append("]"); + return sb.toString(); + } + + public String getID(){ + return Device_ID; + } + + public String getName(){ + return Device_Name; + } + + public String getDesc(){ + return Device_Description; + } + + public String getTicketID(){ + return Ticket_ID; + } + + public String getModel(){ + return Model; + } + + public String getHardware(){ + return Hardware; + } +} From e8e507cf1aed99a3a4a9d3ac97671a45bc688daa Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Thu, 30 Mar 2017 11:12:55 -0400 Subject: [PATCH 2/6] Working off of One Device Class --- WebContent/html/javascript/listing.jsp | 6 +++--- src/database/MySQLAccess.java | 8 ++++---- src/entities/Device.java | 26 ++++++++++---------------- 3 files changed, 17 insertions(+), 23 deletions(-) diff --git a/WebContent/html/javascript/listing.jsp b/WebContent/html/javascript/listing.jsp index 64ca8fc..94fda82 100644 --- a/WebContent/html/javascript/listing.jsp +++ b/WebContent/html/javascript/listing.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.MySQLAccess,entities.ListedDevice" %> +<%@ page import = "database.MySQLAccess,entities.Device" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> @@ -9,10 +9,10 @@ <% MySQLAccess myaccess = new MySQLAccess(); -ListedDevice[] mydevices = myaccess.getAllDevices(); +Device[] mydevices = myaccess.getAllDevices(); //string representation of array. -String deviceString = ListedDevice.arrayToString(mydevices); +String deviceString = Device.arrayToString(mydevices); //out.println(description); //out.println(hardware); diff --git a/src/database/MySQLAccess.java b/src/database/MySQLAccess.java index c2e5fd0..dad52d9 100644 --- a/src/database/MySQLAccess.java +++ b/src/database/MySQLAccess.java @@ -3,7 +3,7 @@ import java.sql.*; import java.util.Date; -import entities.ListedDevice; +import entities.Device; import entities.Location; import entities.RentedDevice; import entities.User; @@ -240,7 +240,7 @@ public RentedDevice[] getUserDevices(String userID) throws SQLException, ClassNo return devices; } - public ListedDevice[] getAllDevices() throws SQLException, ClassNotFoundException{ + public Device[] getAllDevices() throws SQLException, ClassNotFoundException{ //database connect System.getenv("VCAP_SERVICES"); Class.forName("com.mysql.jdbc.Driver"); @@ -254,11 +254,11 @@ public ListedDevice[] getAllDevices() throws SQLException, ClassNotFoundExceptio resultSet.beforeFirst(); //Covers amount of rows, and 6 attributes (indices 0-5) - ListedDevice[] devices = new ListedDevice[rows]; + Device[] devices = new Device[rows]; //iterate result set while(resultSet.next()){ - devices[counter] = new ListedDevice(resultSet.getString("Device_Name"),resultSet.getString("Device_ID"),resultSet.getString("Device_Description"),resultSet.getString("Hardware"), resultSet.getString("Model"), resultSet.getString("Manufacturer"), resultSet.getString("Status")); + devices[counter] = new Device(resultSet.getString("Device_Name"),resultSet.getString("Device_ID"),resultSet.getString("Device_Description"),resultSet.getString("Hardware"), resultSet.getString("Model"), resultSet.getString("Manufacturer"), resultSet.getString("Status")); counter++; } diff --git a/src/entities/Device.java b/src/entities/Device.java index 8ec6f6a..29a5975 100644 --- a/src/entities/Device.java +++ b/src/entities/Device.java @@ -6,24 +6,22 @@ * */ public class Device { - private String Device_ID; private String Device_Name; + private String Device_ID; private String Device_Description; - private String Ticket_ID; - //Smartphone, tablet, etc. private String Hardware; - //iPhone, Galaxy S5, etc. private String Model; - private String Borrow_Date; + private String Manu; + private String Status; - public Device(String id, String name, String desc, String ticketid, String hardware, String model, String date){ + public Device(String name, String id, String desc, String hardware, String model, String manufacturer, String available) { Device_ID = id; Device_Name = name; Device_Description = desc; - Ticket_ID = ticketid; Hardware = hardware; Model = model; - Borrow_Date = date; + Manu = manufacturer; + Status = available; } /** * Formatting the device to fit a JSON object. @@ -31,13 +29,13 @@ public Device(String id, String name, String desc, String ticketid, String hardw public String toString(){ StringBuilder sb = new StringBuilder(); String comma = ", "; - sb.append("{\"id\": ").append(Device_ID).append(comma); - sb.append("\"name\": \"").append(Device_Name).append("\"").append(comma); + sb.append("{\"name\": \"").append(Device_Name).append("\"").append(comma); + sb.append("\"id\": \"").append(Device_ID).append("\"").append(comma); sb.append("\"description\": \"").append(Device_Description).append("\"").append(comma); - sb.append("\"ticket\": \"").append(Ticket_ID).append("\"").append(comma); sb.append("\"hardware\": \"").append(Hardware).append("\"").append(comma); + sb.append("\"status\": \"").append(Status).append("\"").append(comma); sb.append("\"model\": \"").append(Model).append("\"").append(comma); - sb.append("\"checkout\": \"").append(Borrow_Date).append("\""); + sb.append("\"manufacturer\": \"").append(Manu).append("\""); sb.append("}"); return sb.toString(); } @@ -72,10 +70,6 @@ public String getDesc(){ return Device_Description; } - public String getTicketID(){ - return Ticket_ID; - } - public String getModel(){ return Model; } From 3dc05cc1fb5184f4572938d9f271dba8b1f8202a Mon Sep 17 00:00:00 2001 From: Connor L Jackson Date: Fri, 31 Mar 2017 15:30:45 -0400 Subject: [PATCH 3/6] Switching Branch Still need to do work --- WebContent/html/css/stylesheet.css | 4 + .../html/webpages/adminDeviceSettings.jsp | 279 ++++++++---------- WebContent/html/webpages/adminLocation.jsp | 2 - WebContent/html/webpages/deviceRedirect.jsp | 70 +++++ src/database/MySQLAccess.java | 25 +- src/entities/Device.java | 55 +++- 6 files changed, 275 insertions(+), 160 deletions(-) create mode 100644 WebContent/html/webpages/deviceRedirect.jsp diff --git a/WebContent/html/css/stylesheet.css b/WebContent/html/css/stylesheet.css index 96b77b9..f063542 100644 --- a/WebContent/html/css/stylesheet.css +++ b/WebContent/html/css/stylesheet.css @@ -85,6 +85,10 @@ input[type=number]{ width: 60%; } +textarea{ + margin: 0 auto; +} + select{ margin:0 auto; width: 65%; diff --git a/WebContent/html/webpages/adminDeviceSettings.jsp b/WebContent/html/webpages/adminDeviceSettings.jsp index 31c0744..5036700 100644 --- a/WebContent/html/webpages/adminDeviceSettings.jsp +++ b/WebContent/html/webpages/adminDeviceSettings.jsp @@ -32,13 +32,39 @@ } .table{ - width: auto; background-color: #E9EAEB; } tbody{ text-align: left; } + + .column{ + width: 10px; + } + + body{ + overflow: visible; + } + + div.sidebar{ + position: relative; + } + + div.displayDevice{ + padding-right: 30px; + } + + div.modal-content{ + max-height: 100%; + width: 100%; + } + + div.form-group{ + display: inline-block; + vertical-align: top; + } +