diff --git a/.classpath b/.classpath index 3a233b8..cb479a4 100644 --- a/.classpath +++ b/.classpath @@ -12,16 +12,16 @@ - + + - + - + - diff --git a/.settings/org.eclipse.wst.common.project.facet.core.xml b/.settings/org.eclipse.wst.common.project.facet.core.xml index 3b1bc05..059c316 100644 --- a/.settings/org.eclipse.wst.common.project.facet.core.xml +++ b/.settings/org.eclipse.wst.common.project.facet.core.xml @@ -1,10 +1,8 @@ - - + - 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/profileSettings.jsp b/WebContent/html/webpages/profileSettings.jsp index a17f077..b2cca18 100644 --- a/WebContent/html/webpages/profileSettings.jsp +++ b/WebContent/html/webpages/profileSettings.jsp @@ -97,27 +97,28 @@
-
+

Profile Settings

- +
- +
- +
- +
- + +
+ + + + + + +

Redirect Page

+

You shouldn't be seeing this page :)

+ +<% +//make instance +MySQLAccess myaccess = new MySQLAccess(); +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); +} + +%> + + + + \ No newline at end of file diff --git a/src/database/DeviceQueries.java b/src/database/DeviceQueries.java index 54986d5..86afc5a 100644 --- a/src/database/DeviceQueries.java +++ b/src/database/DeviceQueries.java @@ -11,7 +11,6 @@ public class DeviceQueries { private static String password = "74f6e317"; public static Device[] getUserDevices(String userID) throws SQLException, ClassNotFoundException{ - //Not sure how to get cookie information (if that is how we choose to accomplish this...) ? But this should be a passed parameter System.getenv("VCAP_SERVICES"); Class.forName("com.mysql.jdbc.Driver"); Connection connection = DriverManager.getConnection(database, user, password); diff --git a/src/database/EmployeeQueries.java b/src/database/EmployeeQueries.java index 08a3fba..c8f1468 100644 --- a/src/database/EmployeeQueries.java +++ b/src/database/EmployeeQueries.java @@ -6,6 +6,10 @@ public class EmployeeQueries { + private static String database = "jdbc:mysql://us-cdbr-iron-east-04.cleardb.net/ad_15a989204c2ff8a?user=b372dfe7409692&password=74f6e317"; + private static String user = "b372dfe7409692"; + private static String password = "74f6e317"; + public static void initializeEmployee(int id) throws ClassNotFoundException, SQLException { MySQLAccess access = new MySQLAccess(); @@ -29,6 +33,26 @@ public static void updateEmployee(int id, String name, String phone, int locatio statement.executeUpdate(query); access.closeConnection(); } + + public static void updateEmployee(int id, String name, int icon, String phone, String email) throws ClassNotFoundException, SQLException + { + System.getenv("VCAP_SERVICES"); + Class.forName("com.mysql.jdbc.Driver"); + Connection connection = DriverManager.getConnection(database, user, password); + Statement stmt = connection.createStatement(); + System.out.println("Updating employee "+id+": "+name+".\nPhone: "+phone+", icon: "+icon+", email: "+email); + String query = ""; + query+="UPDATE employee SET "; + query+="Name='"+name; + query+="', Phone_Number='"+phone; + query+="', Email ='"+email; + query+="', Img_Index="+icon; + query+=" WHERE Employee_ID="+id; + System.out.println(query); + stmt.executeUpdate(query); + stmt.close(); + connection.close(); + } public static User getEmployeeByID(int id) throws ClassNotFoundException, SQLException {