diff --git a/CREDITS.md b/CREDITS.md
index ce18637..95ae8b2 100644
--- a/CREDITS.md
+++ b/CREDITS.md
@@ -10,6 +10,7 @@ We would like to directly thank the following artists for their contributions:
* Sweater
* Aquarium
* Fruit
+* Crying
## Freepik
* Gingerbread man
@@ -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
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
new file mode 100644
index 0000000..c98448e
--- /dev/null
+++ b/WebContent/WEB-INF/web.xml
@@ -0,0 +1,11 @@
+
+
+ Application Name
+
+ index.jsp
+
+
+ 404
+ /html/webpages/error.jsp
+
+
\ No newline at end of file
diff --git a/WebContent/adminLogin.jsp b/WebContent/adminLogin.jsp
index de40b3c..6341098 100644
--- a/WebContent/adminLogin.jsp
+++ b/WebContent/adminLogin.jsp
@@ -8,10 +8,15 @@ 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();
@@ -19,10 +24,12 @@ if (result.next()){
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");
}
diff --git a/WebContent/html/imgs/my-icons-collection-128px/png/warning.png b/WebContent/html/imgs/my-icons-collection-128px/png/warning.png
new file mode 100644
index 0000000..68f62c6
Binary files /dev/null and b/WebContent/html/imgs/my-icons-collection-128px/png/warning.png differ
diff --git a/WebContent/html/imgs/my-icons-collection-128px/png/wrong.png b/WebContent/html/imgs/my-icons-collection-128px/png/wrong.png
new file mode 100644
index 0000000..6107cee
Binary files /dev/null and b/WebContent/html/imgs/my-icons-collection-128px/png/wrong.png differ
diff --git a/WebContent/html/javascript/iconselect.js-1.0/lib/control/iconselect.js b/WebContent/html/javascript/iconselect.js-1.0/lib/control/iconselect.js
index 3939777..7aff837 100644
--- a/WebContent/html/javascript/iconselect.js-1.0/lib/control/iconselect.js
+++ b/WebContent/html/javascript/iconselect.js-1.0/lib/control/iconselect.js
@@ -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'));
diff --git a/WebContent/html/webpages/adminDeviceSettings.jsp b/WebContent/html/webpages/adminDeviceSettings.jsp
index 798da3e..65db663 100644
--- a/WebContent/html/webpages/adminDeviceSettings.jsp
+++ b/WebContent/html/webpages/adminDeviceSettings.jsp
@@ -265,10 +265,13 @@ window.onclick = function(e){var add = document.getElementById('addModal'); var
var manuHTML = '';
var hardwareHTML = '';
var availabilityHTML = '';
+manufacturers.sort();
for(var i = 0; i < manufacturers.length; i++)
manuHTML += '';
+ hardwares.sort();
for(var i = 0; i < hardwares.length; i++)
hardwareHTML += '';
+availabilities.sort();
for(var i = 0; i < availabilities.length; i++)
availabilityHTML += '';
document.getElementById('addManu').innerHTML = manuHTML;
diff --git a/WebContent/html/webpages/adminLocation.jsp b/WebContent/html/webpages/adminLocation.jsp
index 1e75e6d..1a22413 100644
--- a/WebContent/html/webpages/adminLocation.jsp
+++ b/WebContent/html/webpages/adminLocation.jsp
@@ -230,8 +230,8 @@
-
-
+
+
@@ -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();
}
diff --git a/WebContent/html/webpages/deviceRedirect.jsp b/WebContent/html/webpages/deviceRedirect.jsp
index d0e4ceb..d3e9558 100644
--- a/WebContent/html/webpages/deviceRedirect.jsp
+++ b/WebContent/html/webpages/deviceRedirect.jsp
@@ -20,6 +20,7 @@
@@ -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");
diff --git a/WebContent/html/webpages/error.jsp b/WebContent/html/webpages/error.jsp
new file mode 100644
index 0000000..91076ee
--- /dev/null
+++ b/WebContent/html/webpages/error.jsp
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+ Synchrony Financial
+
+
+
+
+
+
+
+
+
+
+
+
+
Error
+

+
Page Does Not Exist
+
+
+
\ No newline at end of file
diff --git a/WebContent/html/webpages/locationRedirect.jsp b/WebContent/html/webpages/locationRedirect.jsp
index 5483488..3995a44 100644
--- a/WebContent/html/webpages/locationRedirect.jsp
+++ b/WebContent/html/webpages/locationRedirect.jsp
@@ -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);
@@ -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);
}
%>
diff --git a/WebContent/html/webpages/navbar.jsp b/WebContent/html/webpages/navbar.jsp
index a999ed3..ab4cbb2 100644
--- a/WebContent/html/webpages/navbar.jsp
+++ b/WebContent/html/webpages/navbar.jsp
@@ -8,10 +8,11 @@
-
+
-
-
+
+
+
@@ -25,15 +26,31 @@
<%
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();
+ }
%>
+
+
+
+
+
+
+ Redirect Page
+ You shouldn't be seeing this page :)
+
+<%
+//make instance
+String name = request.getParameter("name").replace("\"","\\\"");
+int id = Integer.parseInt(request.getParameter("sso"));
+String phone = request.getParameter("phone");
+String email = request.getParameter("email");
+int img = Integer.parseInt(request.getParameter("img"));
+
+//change form was submitted
+if(request.getParameter("profile") != null){
+ EmployeeQueries.updateEmployee(id, name, img, phone, email);
+}
+
+%>
+
+
+
+