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/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/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..8b90d60 100644 --- a/WebContent/html/webpages/deviceRedirect.jsp +++ b/WebContent/html/webpages/deviceRedirect.jsp @@ -28,7 +28,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/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/profileSettingsRedirect.jsp b/WebContent/html/webpages/profileSettingsRedirect.jsp index bbce74c..da95137 100644 --- a/WebContent/html/webpages/profileSettingsRedirect.jsp +++ b/WebContent/html/webpages/profileSettingsRedirect.jsp @@ -28,7 +28,6 @@ <% //make instance -MySQLAccess myaccess = new MySQLAccess(); String name = request.getParameter("name").replace("\"","\\\""); int id = Integer.parseInt(request.getParameter("sso")); String phone = request.getParameter("phone"); diff --git a/WebContent/html/webpages/somethingwrong.jsp b/WebContent/html/webpages/somethingwrong.jsp new file mode 100644 index 0000000..d86d296 --- /dev/null +++ b/WebContent/html/webpages/somethingwrong.jsp @@ -0,0 +1,40 @@ + + +
+ + + + + + + +
+ + + + + + + + + +
+