Funcionalidad lista al 100%:
-El método que revisa el acceso a un servlet se encuentra en el método checkPermission en controller.access.AccessControllerView -Ahora agregaré cosas al Front-end.
This commit is contained in:
parent
6c851df937
commit
3750096e23
File diff suppressed because it is too large
Load Diff
@ -25,16 +25,7 @@ public class AccessControllerAdd extends HttpServlet {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
/*Role r = new Role("mesero");
|
|
||||||
Resource re = new Resource("/comida");
|
|
||||||
try {
|
|
||||||
pm.makePersistent(r);
|
|
||||||
pm.makePersistent(re);
|
|
||||||
} finally {
|
|
||||||
pm.close();
|
|
||||||
}*/
|
|
||||||
|
|
||||||
System.out.print(request.getParameter("info"));
|
|
||||||
|
|
||||||
String query = "select from " + Role.class.getName();
|
String query = "select from " + Role.class.getName();
|
||||||
String query2 = "select from " + Resource.class.getName();
|
String query2 = "select from " + Resource.class.getName();
|
||||||
@ -85,7 +76,7 @@ public class AccessControllerAdd extends HttpServlet {
|
|||||||
Access a = new Access(idRole, idResource,true);
|
Access a = new Access(idRole, idResource,true);
|
||||||
//persist the entity
|
//persist the entity
|
||||||
pm.makePersistent(a);
|
pm.makePersistent(a);
|
||||||
|
request.getSession().setAttribute("serverResponse","Access created successfully.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (request.getParameter("info").equals("check")){
|
else if (request.getParameter("info").equals("check")){
|
||||||
@ -96,9 +87,11 @@ public class AccessControllerAdd extends HttpServlet {
|
|||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if (redirect)
|
if (redirect){
|
||||||
|
request.setAttribute("serverResponse","");
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
catch (IllegalStateException e){
|
catch (IllegalStateException e){
|
||||||
System.err.println("IllegalStateException: There was a double redirect.");
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
@ -113,7 +106,6 @@ public class AccessControllerAdd extends HttpServlet {
|
|||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
private boolean accessExist(String role, String resource){
|
private boolean accessExist(String role, String resource){
|
||||||
|
|
||||||
System.out.println("\nCheking...");
|
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
List<Access> accessList = (List<Access>) pm.newQuery("select from " + Access.class.getName()).execute();
|
List<Access> accessList = (List<Access>) pm.newQuery("select from " + Access.class.getName()).execute();
|
||||||
@ -122,17 +114,14 @@ public class AccessControllerAdd extends HttpServlet {
|
|||||||
String roleKey = RolesControllerView.getRole(role).getKey();
|
String roleKey = RolesControllerView.getRole(role).getKey();
|
||||||
String resourceKey = ResourcesControllerView.getResource(resource).getKey();
|
String resourceKey = ResourcesControllerView.getResource(resource).getKey();
|
||||||
for (Access access: accessList){
|
for (Access access: accessList){
|
||||||
if (access.getIdRole().equals(roleKey)){
|
if (access.getRoleKey().equals(roleKey)){
|
||||||
if (access.getIdResource().equals(resourceKey)){
|
if (access.getResourceKey().equals(resourceKey)){
|
||||||
System.out.println("Hey! That Access already Exists!! v:<");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.println("nope :p");
|
|
||||||
return false;
|
return false;
|
||||||
} catch (IllegalArgumentException e){
|
} catch (IllegalArgumentException e){
|
||||||
System.out.println("A parameter is illegal... Maybe the AJAX call is incomplete?");
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,15 +19,20 @@ public class AccessControllerDelete extends HttpServlet {
|
|||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
// create the new account
|
// create the new account
|
||||||
try{
|
try{
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("accessId")).longValue());
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("accessId")));
|
||||||
Access r = pm.getObjectById(Access.class, k);
|
Access r = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
pm.deletePersistent(r);
|
pm.deletePersistent(r);
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Access deleted successfully.");
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package controller.access;
|
|||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
import model.Access;
|
import model.Access;
|
||||||
import model.Resource;
|
import model.Resource;
|
||||||
import model.Role;
|
import model.Role;
|
||||||
@ -15,51 +16,78 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AccessControllerEdit extends HttpServlet {
|
public class AccessControllerEdit extends HttpServlet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
// create the persistence manager instance
|
// create the persistence manager instance
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
try{
|
try{
|
||||||
System.out.print(request.getParameter("info"));
|
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
||||||
|
|
||||||
Access a = pm.getObjectById(Access.class, k);
|
Access a = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
request.setAttribute("access", a);
|
request.setAttribute("access", a);
|
||||||
|
|
||||||
String query = "select from " + Role.class.getName();
|
String query = "select from " + Role.class.getName();
|
||||||
String query2 = "select from " + Resource.class.getName();
|
String query2 = "select from " + Resource.class.getName();
|
||||||
|
|
||||||
List<Role> roles = (List<Role>)pm.newQuery(query).execute();
|
List<Role> roles = (List<Role>)pm.newQuery(query).execute();
|
||||||
List<Resource> resources = (List<Resource>)pm.newQuery(query2).execute();
|
List<Resource> resources = (List<Resource>)pm.newQuery(query2).execute();
|
||||||
|
|
||||||
request.setAttribute("roles", roles);
|
request.setAttribute("roles", roles);
|
||||||
request.setAttribute("resources", resources);
|
request.setAttribute("resources", resources);
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/edit.jsp");
|
|
||||||
dispatcher.forward(request, response);
|
|
||||||
|
|
||||||
try{
|
try{
|
||||||
if(request.getParameter("info").equals("editar")){
|
if(request.getParameter("info").equals("editar")){
|
||||||
String idRole=request.getParameter("rolesl");
|
|
||||||
String idResource=request.getParameter("resourcesl");
|
String idRole = request.getParameter("rolesl");
|
||||||
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){System.out.print("nombre vacio");}
|
String idResource = request.getParameter("resourcesl");
|
||||||
|
|
||||||
|
if(idRole == null || idRole.equals("")|| idResource == null || idResource.equals("")){
|
||||||
|
|
||||||
|
System.out.print("nombre vacio");
|
||||||
|
|
||||||
|
}
|
||||||
else{
|
else{
|
||||||
|
|
||||||
if(!a.getIdRole().equals(idRole)){
|
if(!a.getRoleKey().equals(idRole)){
|
||||||
a.setIdRole(idRole);
|
a.setRoleKey(idRole);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!a.getIdResource().equals(idResource)){
|
if(!a.getResourceKey().equals(idResource)){
|
||||||
a.setIdResource(idResource);
|
a.setResourceKey(idResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Access updated successfully.");
|
||||||
|
|
||||||
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
} else if(request.getParameter("info").equals("redirect")){
|
||||||
|
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/edit.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
dispatcher.forward(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch (java.lang.NullPointerException np){
|
}catch (java.lang.NullPointerException np){
|
||||||
|
System.err.println("AccessControllerEdit Exception -> NPE:");
|
||||||
|
np.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
} catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
response.sendRedirect("/index.html");
|
response.sendRedirect("/index.html");
|
||||||
|
} catch (NumberFormatException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -42,12 +42,15 @@ public class AccessControllerIndex extends HttpServlet {
|
|||||||
// pass the list to the jsp
|
// pass the list to the jsp
|
||||||
request.setAttribute("accesses", accesses);
|
request.setAttribute("accesses", accesses);
|
||||||
|
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
|
|
||||||
// forward the request to the jsp
|
// forward the request to the jsp
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/index.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/index.jsp");
|
||||||
dispatcher.forward(request, response);
|
dispatcher.forward(request, response);
|
||||||
|
|
||||||
}
|
}
|
||||||
//Si no la encuentra, redirige a la pagina inicial.
|
//Si no la encuentra, redirige a la pagina inicial para que se cree la sesion.
|
||||||
catch (Exception e){
|
catch (Exception e){
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head><body></body></html>");
|
||||||
|
@ -3,9 +3,13 @@ package controller.access;
|
|||||||
import com.google.appengine.api.datastore.Key;
|
import com.google.appengine.api.datastore.Key;
|
||||||
import com.google.appengine.api.datastore.KeyFactory;
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
import controller.PMF;
|
import controller.PMF;
|
||||||
|
import controller.resources.ResourcesControllerView;
|
||||||
|
import controller.roles.RolesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
import model.Access;
|
import model.Access;
|
||||||
import model.Resource;
|
import model.Resource;
|
||||||
import model.Role;
|
import model.Role;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
import javax.jdo.PersistenceManager;
|
import javax.jdo.PersistenceManager;
|
||||||
import javax.servlet.RequestDispatcher;
|
import javax.servlet.RequestDispatcher;
|
||||||
@ -14,6 +18,7 @@ import javax.servlet.http.HttpServlet;
|
|||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
@SuppressWarnings("serial")
|
@SuppressWarnings("serial")
|
||||||
public class AccessControllerView extends HttpServlet {
|
public class AccessControllerView extends HttpServlet {
|
||||||
@ -21,34 +26,35 @@ public class AccessControllerView extends HttpServlet {
|
|||||||
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
|
||||||
// create the persistence manager instance
|
// create the persistence manager instance
|
||||||
PersistenceManager pm = PMF.get().getPersistenceManager();
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
try{
|
|
||||||
|
|
||||||
System.out.print(request.getParameter("info"));
|
try{
|
||||||
|
|
||||||
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
Key k = KeyFactory.createKey(Access.class.getSimpleName(), new Long(request.getParameter("id")));
|
||||||
Access a = pm.getObjectById(Access.class, k);
|
Access a = pm.getObjectById(Access.class, k);
|
||||||
|
|
||||||
request.setAttribute("access", a);
|
request.setAttribute("access", a);
|
||||||
|
|
||||||
Key krol = KeyFactory.createKey(Role.class.getSimpleName(), a.getIdRole());
|
Role rol = RolesControllerView.getRole(a.getRoleKey());
|
||||||
Role rol = pm.getObjectById(Role.class, krol);
|
|
||||||
|
|
||||||
String nrol = rol.getName();
|
String nrol = rol.getName();
|
||||||
|
|
||||||
Key kres = KeyFactory.createKey(Resource.class.getSimpleName(), a.getIdResource());
|
Resource res = ResourcesControllerView.getResource(a.getResourceKey());
|
||||||
Resource res = pm.getObjectById(Resource.class, kres);
|
|
||||||
String nres = res.getUrl();
|
String nres = res.getUrl();
|
||||||
|
|
||||||
System.out.print(nres);
|
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
|
||||||
request.setAttribute("role", nrol);
|
|
||||||
request.setAttribute("resource", nres);
|
|
||||||
|
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/view.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Access/view.jsp");
|
||||||
dispatcher.forward(request, response);
|
dispatcher.forward(request, response);
|
||||||
|
|
||||||
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
|
System.err.println("JDOObjectNotFound -> AccessControllerView");
|
||||||
|
nf.printStackTrace();
|
||||||
|
request.getSession().setAttribute("serverResponse","Error trying to view the Access.");
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
System.err.println("NPE -> Trying to access a servlet without logging in.");
|
||||||
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,4 +62,55 @@ public class AccessControllerView extends HttpServlet {
|
|||||||
doGet(request, response);
|
doGet(request, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
private static List<Access> getAllAccess(){
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
List<Access> accessList = (List<Access>) pm.newQuery("select from " + Access.class.getName()).execute();
|
||||||
|
pm.close();
|
||||||
|
return accessList;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Metodo estatico checkPermission.
|
||||||
|
*
|
||||||
|
* Al llamarlo, revisa si un usuario tiene acceso a una URI, devuelve true si es cierto, false si no.
|
||||||
|
* Se debe colocar como primer condicional del Servlet:
|
||||||
|
*
|
||||||
|
* public doGet/doPost ()~~~~{
|
||||||
|
* if (checkPermission(userID,uri){
|
||||||
|
* //El usuario tiene permiso, realizar las acciones necesarias
|
||||||
|
* } else {
|
||||||
|
* //El usuario no tiene permiso, mostrar mensaje de error.
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Los usuarion con rol admin tienen acceso completo por defecto.
|
||||||
|
*
|
||||||
|
* @param userID El id del usuario que ha iniciado sesion. Ver UsersControllerAdd
|
||||||
|
* @param uri El URI al que se intenta acceder. request.getRequestURI()
|
||||||
|
*
|
||||||
|
* */
|
||||||
|
public static boolean checkPermission(String userID, String uri){
|
||||||
|
|
||||||
|
User user = (User) UsersControllerView.getUser(userID);
|
||||||
|
String userRoleName = user.getRoleName();
|
||||||
|
String userRoleKey = user.getRoleKey();
|
||||||
|
if (userRoleKey == null)
|
||||||
|
userRoleKey = "";
|
||||||
|
|
||||||
|
for (Access access: getAllAccess()){
|
||||||
|
if (userRoleName.equals("admin")){
|
||||||
|
return true;
|
||||||
|
} else if (access.getRoleKey().equals(userRoleKey)){
|
||||||
|
System.out.println("Encontrado USuario con Rol coincidente");
|
||||||
|
if (access.getResourceName().equals(uri)){
|
||||||
|
System.out.println("El USuario tiene acceso a esta URI");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -35,7 +35,7 @@ public class ResourcesControllerAdd extends HttpServlet {
|
|||||||
Boolean status = Boolean.parseBoolean(request.getParameter("status"));
|
Boolean status = Boolean.parseBoolean(request.getParameter("status"));
|
||||||
|
|
||||||
createRole(url,status,pm);
|
createRole(url,status,pm);
|
||||||
|
request.getSession().setAttribute("serverResponse","Resource created successfully.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "redirect":
|
case "redirect":
|
||||||
@ -53,6 +53,8 @@ public class ResourcesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
resourc.setUrl(request.getParameter("url"));
|
resourc.setUrl(request.getParameter("url"));
|
||||||
resourc.setStatus(Boolean.parseBoolean(request.getParameter("status")));
|
resourc.setStatus(Boolean.parseBoolean(request.getParameter("status")));
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Resource updated successfully.");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ public class ResourcesControllerDelete extends HttpServlet {
|
|||||||
Key key = KeyFactory.stringToKey(request.getParameter("key"));
|
Key key = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
try{
|
try{
|
||||||
pm.deletePersistent(pm.getObjectById(Resource.class, key));
|
pm.deletePersistent(pm.getObjectById(Resource.class, key));
|
||||||
|
request.getSession().setAttribute("serverResponse","Resource deleted successfully.");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -27,6 +27,8 @@ public class ResourcesControllerIndex extends HttpServlet {
|
|||||||
|
|
||||||
request.setAttribute("User",user);
|
request.setAttribute("User",user);
|
||||||
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
request.setAttribute("ResourceList",ResourcesControllerView.getAllResources());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/index.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Resources/index.jsp");
|
||||||
dispatcher.forward(request,response);
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
@ -47,6 +47,7 @@ public class RolesControllerAdd extends HttpServlet {
|
|||||||
Boolean status = Boolean.parseBoolean(request.getParameter("roleStatus"));
|
Boolean status = Boolean.parseBoolean(request.getParameter("roleStatus"));
|
||||||
|
|
||||||
createRole(name,status,pm);
|
createRole(name,status,pm);
|
||||||
|
request.getSession().setAttribute("serverResponse","Role created successfully.");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -66,7 +67,7 @@ public class RolesControllerAdd extends HttpServlet {
|
|||||||
role1.setName(request.getParameter("roleName"));
|
role1.setName(request.getParameter("roleName"));
|
||||||
role1.setStatus(Boolean.parseBoolean(request.getParameter("roleStatus")));
|
role1.setStatus(Boolean.parseBoolean(request.getParameter("roleStatus")));
|
||||||
//role1.setImgUrl(userImg);
|
//role1.setImgUrl(userImg);
|
||||||
|
request.getSession().setAttribute("serverResponse","Role updated successfully.");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ public class RolesControllerDelete extends HttpServlet {
|
|||||||
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
try{
|
try{
|
||||||
pm.deletePersistent(pm.getObjectById(Role.class, k));
|
pm.deletePersistent(pm.getObjectById(Role.class, k));
|
||||||
|
request.getSession().setAttribute("serverResponse","Role deleted successfully.");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -26,6 +26,8 @@ public class RolesControllerIndex extends HttpServlet {
|
|||||||
|
|
||||||
request.setAttribute("User",user);
|
request.setAttribute("User",user);
|
||||||
request.setAttribute("RoleList",RolesControllerView.getAllRoles());
|
request.setAttribute("RoleList",RolesControllerView.getAllRoles());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/index.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Roles/index.jsp");
|
||||||
dispatcher.forward(request,response);
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.List;
|
|||||||
* public static getAllRoles()
|
* public static getAllRoles()
|
||||||
* Devuelve un List<Role> con todos los roles que existen.
|
* Devuelve un List<Role> con todos los roles que existen.
|
||||||
*
|
*
|
||||||
* public static getRole(String key)
|
* public static getRoleKey(String key)
|
||||||
* Devuelve un Rol dada una key.
|
* Devuelve un Rol dada una key.
|
||||||
* La key se obtiene usando el metodo getKey() de un objeto Role
|
* La key se obtiene usando el metodo getKey() de un objeto Role
|
||||||
*
|
*
|
||||||
|
103
src/controller/services/ServicesControllerAdd.java
Normal file
103
src/controller/services/ServicesControllerAdd.java
Normal file
@ -0,0 +1,103 @@
|
|||||||
|
package controller.services;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.ServletException;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.access.AccessControllerView;
|
||||||
|
import controller.roles.RolesControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Access;
|
||||||
|
import model.Service;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ServicesControllerAdd extends HttpServlet {
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
System.out.println("Request URI Add->" + request.getRequestURI());
|
||||||
|
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
if (action.equals("create")){
|
||||||
|
|
||||||
|
String name = request.getParameter("Name");
|
||||||
|
Double price = Double.parseDouble(request.getParameter("Price"));
|
||||||
|
String description = request.getParameter("Description");
|
||||||
|
String userCreatorKey = request.getParameter("userId");
|
||||||
|
|
||||||
|
Service service = new Service (name, price, description,userCreatorKey);
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Service created successfully.");
|
||||||
|
|
||||||
|
pm.makePersistent(service);
|
||||||
|
|
||||||
|
|
||||||
|
} else if (action.equals("update")){
|
||||||
|
|
||||||
|
Key k = KeyFactory.stringToKey(request.getParameter("key"));
|
||||||
|
|
||||||
|
Service service = pm.getObjectById(Service.class,k);
|
||||||
|
|
||||||
|
service.setName(request.getParameter("Name"));
|
||||||
|
service.setPrice(Double.parseDouble(request.getParameter("Price")));
|
||||||
|
service.setDescription(request.getParameter("Description"));
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Service updated successfully.");
|
||||||
|
|
||||||
|
} else if (action.equals("redirect")){
|
||||||
|
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Services/add.jsp");
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(sesion.getAttribute("userID").toString()));
|
||||||
|
dispatcher.forward(request, response);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
try{
|
||||||
|
response.sendRedirect("/services");
|
||||||
|
}
|
||||||
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
catch (IllegalStateException e){
|
||||||
|
System.err.println("IllegalStateException: There was a double redirect.");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost (HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException{
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
}
|
61
src/controller/services/ServicesControllerDelete.java
Normal file
61
src/controller/services/ServicesControllerDelete.java
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
package controller.services;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.access.AccessControllerView;
|
||||||
|
import model.Service;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ServicesControllerDelete extends HttpServlet {
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
||||||
|
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
String serviceKey = request.getParameter("serviceKey");
|
||||||
|
|
||||||
|
try{
|
||||||
|
Key k = KeyFactory.stringToKey(serviceKey);
|
||||||
|
Service service = pm.getObjectById(Service.class, k);
|
||||||
|
|
||||||
|
pm.deletePersistent(service);
|
||||||
|
|
||||||
|
request.getSession().setAttribute("serverResponse","Service deleted successfully.");
|
||||||
|
} catch (JDOObjectNotFoundException e){
|
||||||
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
|
response.sendRedirect("/services");
|
||||||
|
|
||||||
|
} else {
|
||||||
|
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException{
|
||||||
|
doGet(request, response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
63
src/controller/services/ServicesControllerIndex.java
Normal file
63
src/controller/services/ServicesControllerIndex.java
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
package controller.services;
|
||||||
|
|
||||||
|
import controller.access.AccessControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.User;
|
||||||
|
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import javax.servlet.http.HttpSession;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import static controller.services.ServicesControllerView.getAllServices;
|
||||||
|
|
||||||
|
public class ServicesControllerIndex extends HttpServlet {
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
||||||
|
|
||||||
|
//Se usa para revisar si hay una sesion activa
|
||||||
|
HttpSession sesion= request.getSession();
|
||||||
|
|
||||||
|
//Intenta hallar una sesion activa
|
||||||
|
try{
|
||||||
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
|
request.setAttribute("User",user);
|
||||||
|
request.setAttribute("ServicesList",getAllServices());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Services/index.jsp");
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no la encuentra, redirige a la pagina inicial.
|
||||||
|
catch (Exception e){
|
||||||
|
System.err.println("UserControllerIndex: Error catched. " + e.getMessage());
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\")</script></head></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
|
doPost(req, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
108
src/controller/services/ServicesControllerView.java
Normal file
108
src/controller/services/ServicesControllerView.java
Normal file
@ -0,0 +1,108 @@
|
|||||||
|
package controller.services;
|
||||||
|
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.PMF;
|
||||||
|
import controller.access.AccessControllerView;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
import model.Service;
|
||||||
|
|
||||||
|
import javax.jdo.JDOObjectNotFoundException;
|
||||||
|
import javax.jdo.PersistenceManager;
|
||||||
|
import javax.servlet.RequestDispatcher;
|
||||||
|
import javax.servlet.http.HttpServlet;
|
||||||
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
public class ServicesControllerView extends HttpServlet {
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
|
|
||||||
|
try{
|
||||||
|
|
||||||
|
if (AccessControllerView.checkPermission(request.getSession().getAttribute("userID").toString(),request.getRequestURI())){
|
||||||
|
|
||||||
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
if (action == null)
|
||||||
|
action = "";
|
||||||
|
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
if (action.equals("editRedirect")) {
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Services/view.jsp");
|
||||||
|
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
request.setAttribute("Service",getService(request.getParameter("serviceKey")));
|
||||||
|
|
||||||
|
request.setAttribute("editAllowed",true);
|
||||||
|
request.setAttribute("action","Edit");
|
||||||
|
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (action.equals("viewRedirect")) {
|
||||||
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Services/view.jsp");
|
||||||
|
|
||||||
|
request.setAttribute("User",UsersControllerView.getUser(request.getSession().getAttribute("userID").toString()));
|
||||||
|
request.setAttribute("Service",getService(request.getParameter("serviceKey")));
|
||||||
|
|
||||||
|
request.setAttribute("editAllowed",false);
|
||||||
|
request.setAttribute("action","View");
|
||||||
|
|
||||||
|
try{
|
||||||
|
dispatcher.forward(request,response);
|
||||||
|
} catch (javax.servlet.ServletException e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
//Si no se encontró acción, regresa al inicio
|
||||||
|
else {
|
||||||
|
response.getWriter().println("<html><head><script>window.location.replace(\"../\");</script><body></body></html>");
|
||||||
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (NullPointerException e){
|
||||||
|
response.sendRedirect("/users");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {
|
||||||
|
doGet(req, resp);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings("unchecked")
|
||||||
|
static List<Service> getAllServices(){
|
||||||
|
PersistenceManager pm = controller.PMF.get().getPersistenceManager();
|
||||||
|
List<Service> services = (List<Service>) pm.newQuery("select from " + Service.class.getName()).execute();
|
||||||
|
pm.close();
|
||||||
|
return services;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static Service getService(String key){
|
||||||
|
PersistenceManager pm = PMF.get().getPersistenceManager();
|
||||||
|
|
||||||
|
Key k = KeyFactory.stringToKey(key);
|
||||||
|
Service service = pm.getObjectById(Service.class,k);
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
return service;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,9 +1,7 @@
|
|||||||
package controller.users;
|
package controller.users;
|
||||||
|
|
||||||
import controller.resources.ResourcesControllerView;
|
|
||||||
import controller.roles.RolesControllerAdd;
|
import controller.roles.RolesControllerAdd;
|
||||||
import controller.roles.RolesControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
import model.Resource;
|
|
||||||
import model.Role;
|
import model.Role;
|
||||||
import model.User;
|
import model.User;
|
||||||
|
|
||||||
@ -28,6 +26,9 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
//Accion a realizar
|
//Accion a realizar
|
||||||
String action = request.getParameter("action");
|
String action = request.getParameter("action");
|
||||||
|
|
||||||
|
//Respuesta del servidor
|
||||||
|
String serverResponse = "!";
|
||||||
|
|
||||||
if (action == null)
|
if (action == null)
|
||||||
action = "";
|
action = "";
|
||||||
|
|
||||||
@ -71,6 +72,8 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
//Si no existe la sesion, la crea usando el ID del usuario
|
//Si no existe la sesion, la crea usando el ID del usuario
|
||||||
if (!sesionExist(misesion)) {
|
if (!sesionExist(misesion)) {
|
||||||
|
|
||||||
|
misesion.invalidate();
|
||||||
|
|
||||||
misesion = request.getSession(true);
|
misesion = request.getSession(true);
|
||||||
misesion.setAttribute("userID", userID);
|
misesion.setAttribute("userID", userID);
|
||||||
|
|
||||||
@ -78,6 +81,8 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
misesion.setMaxInactiveInterval(3600);
|
misesion.setMaxInactiveInterval(3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serverResponse = "You are logged-in";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Si lo que se quiere es redirigir al Form para crear usuario
|
//Si lo que se quiere es redirigir al Form para crear usuario
|
||||||
@ -92,6 +97,7 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
//Si lo que se quiere es Crear (proviene del formulario)
|
//Si lo que se quiere es Crear (proviene del formulario)
|
||||||
case "create":
|
case "create":
|
||||||
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
createUser(userID, userEmail, userName, userImg, userRole, pm);
|
||||||
|
serverResponse = "User created successfully.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Si lo que se quiere es actualizar un Usuario
|
//Si lo que se quiere es actualizar un Usuario
|
||||||
@ -102,14 +108,16 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
user.setName(userName);
|
user.setName(userName);
|
||||||
user.setEmail(userEmail);
|
user.setEmail(userEmail);
|
||||||
user.setImgUrl(userImg);
|
user.setImgUrl(userImg);
|
||||||
user.setRole(userRole);
|
user.setRoleKey(userRole);
|
||||||
|
|
||||||
|
serverResponse = "User Updated successfully.";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pm.close();
|
pm.close();
|
||||||
try{
|
try{
|
||||||
|
request.getSession().setAttribute("serverResponse",serverResponse);
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
//Al redirigr al jsp para crear, se usa RequestDispatcher, y este entra en conflicto con sendRedirect.
|
||||||
|
@ -20,10 +20,13 @@ public class UsersControllerDelete extends HttpServlet {
|
|||||||
|
|
||||||
try{
|
try{
|
||||||
pm.deletePersistent(pm.getObjectById(User.class, userID));
|
pm.deletePersistent(pm.getObjectById(User.class, userID));
|
||||||
|
request.getSession().setAttribute("serverResponse","User deleted successfully.");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pm.close();
|
||||||
|
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -22,11 +22,13 @@ public class UsersControllerIndex extends HttpServlet {
|
|||||||
|
|
||||||
//Intenta hallar una sesion activa
|
//Intenta hallar una sesion activa
|
||||||
try{
|
try{
|
||||||
User usario = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
User user = UsersControllerView.getUser(sesion.getAttribute("userID").toString());
|
||||||
if (usario == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
if (user == null) throw new NullPointerException("UsersControllerIndex: El usuario recibido es nulo.");
|
||||||
|
|
||||||
request.setAttribute("User",usario);
|
request.setAttribute("User",user);
|
||||||
request.setAttribute("UsersList",UsersControllerView.getAllUsers());
|
request.setAttribute("UsersList",UsersControllerView.getAllUsers());
|
||||||
|
request.setAttribute("serverResponse",sesion.getAttribute("serverResponse"));
|
||||||
|
sesion.setAttribute("serverResponse","!");
|
||||||
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/index.jsp");
|
RequestDispatcher dispatcher = getServletContext().getRequestDispatcher("/WEB-INF/View/Users/index.jsp");
|
||||||
dispatcher.forward(request,response);
|
dispatcher.forward(request,response);
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ package model;
|
|||||||
|
|
||||||
import controller.resources.ResourcesControllerView;
|
import controller.resources.ResourcesControllerView;
|
||||||
import controller.roles.RolesControllerView;
|
import controller.roles.RolesControllerView;
|
||||||
import org.datanucleus.exceptions.NucleusObjectNotFoundException;
|
|
||||||
|
|
||||||
import javax.jdo.annotations.IdGeneratorStrategy;
|
import javax.jdo.annotations.IdGeneratorStrategy;
|
||||||
import javax.jdo.annotations.IdentityType;
|
import javax.jdo.annotations.IdentityType;
|
||||||
@ -18,17 +17,17 @@ public class Access {
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
@Persistent
|
@Persistent
|
||||||
private String idRole;
|
private String roleKey;
|
||||||
|
|
||||||
@Persistent
|
@Persistent
|
||||||
private String idResource;
|
private String resourceKey;
|
||||||
|
|
||||||
@Persistent
|
@Persistent
|
||||||
private boolean status;
|
private boolean status;
|
||||||
|
|
||||||
public Access(String idRole, String idResource, boolean status) {
|
public Access(String idRole, String idResource, boolean status) {
|
||||||
this.idRole = idRole;
|
this.roleKey = idRole;
|
||||||
this.idResource = idResource;
|
this.resourceKey = idResource;
|
||||||
this.status = status;
|
this.status = status;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,18 +35,18 @@ public class Access {
|
|||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIdRole() {
|
public String getRoleKey() {
|
||||||
return idRole;
|
return roleKey;
|
||||||
}
|
}
|
||||||
public void setIdRole(String idRole) {
|
public void setRoleKey(String roleKey) {
|
||||||
this.idRole = idRole;
|
this.roleKey = roleKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getIdResource() {
|
public String getResourceKey() {
|
||||||
return idResource;
|
return resourceKey;
|
||||||
}
|
}
|
||||||
public void setIdResource(String idResource) {
|
public void setResourceKey(String resourceKey) {
|
||||||
this.idResource = idResource;
|
this.resourceKey = resourceKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getStatus() {
|
public boolean getStatus() {
|
||||||
@ -60,9 +59,9 @@ public class Access {
|
|||||||
public String getRoleName(){
|
public String getRoleName(){
|
||||||
String ret;
|
String ret;
|
||||||
try {
|
try {
|
||||||
ret = RolesControllerView.getRole(idRole).getName();
|
ret = RolesControllerView.getRole(roleKey).getName();
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
ret = "<span style=\"color: red; font-weight: bold\">The Role doesn´t exists.</span>";
|
ret = "<span style=\"color: red; font-weight: bold\">The Role doesn't exists.</span>";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@ -70,11 +69,19 @@ public class Access {
|
|||||||
public String getResourceName(){
|
public String getResourceName(){
|
||||||
String ret;
|
String ret;
|
||||||
try {
|
try {
|
||||||
ret = ResourcesControllerView.getResource(idResource).getUrl();
|
ret = ResourcesControllerView.getResource(resourceKey).getUrl();
|
||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
ret = "<span style=\"color: red; font-weight: bold\">The Resource doesn´t exists.</span>";
|
ret = "<span style=\"color: red; font-weight: bold\">The Resource doesn't exists.</span>";
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "[ ID: " + id +"\n" +
|
||||||
|
"roleKey: " + roleKey + "\n" +
|
||||||
|
"resourceKey: " + resourceKey + "\n" +
|
||||||
|
"status: " + status +"\n" +
|
||||||
|
"]";
|
||||||
|
}
|
||||||
}
|
}
|
80
src/model/Service.java
Normal file
80
src/model/Service.java
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
package model;
|
||||||
|
|
||||||
|
import javax.jdo.annotations.*;
|
||||||
|
import com.google.appengine.api.datastore.Key;
|
||||||
|
import com.google.appengine.api.datastore.KeyFactory;
|
||||||
|
import controller.users.UsersControllerView;
|
||||||
|
|
||||||
|
@PersistenceCapable(identityType=IdentityType.APPLICATION)
|
||||||
|
public class Service {
|
||||||
|
|
||||||
|
@PrimaryKey
|
||||||
|
@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
|
||||||
|
private Key key;
|
||||||
|
|
||||||
|
@Persistent
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@Persistent
|
||||||
|
private double price;
|
||||||
|
|
||||||
|
@Persistent
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
@Persistent
|
||||||
|
private String creatorUserId;
|
||||||
|
|
||||||
|
public Service(String name, double price, String description, String creatorUserKey) {
|
||||||
|
this.name = name;
|
||||||
|
this.price = price;
|
||||||
|
this.description = description;
|
||||||
|
this.creatorUserId = creatorUserKey;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*Getters and Setters*/
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public double getPrice() {
|
||||||
|
return price;
|
||||||
|
}
|
||||||
|
public void setPrice(double price) {
|
||||||
|
this.price = price;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDescription() {
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
public void setDescription(String description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getKey() {
|
||||||
|
return KeyFactory.keyToString(key);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatorUserId(){
|
||||||
|
return creatorUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCreatorUserName(){
|
||||||
|
String name;
|
||||||
|
try{
|
||||||
|
name = UsersControllerView.getUser(creatorUserId).getName();
|
||||||
|
} catch (Exception e){
|
||||||
|
name = "<span style=\"color: red; font-weight: bold\">The User doesn't exists.</span>";
|
||||||
|
}
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*To String*/
|
||||||
|
public String toString(){
|
||||||
|
return "Name: " + name + "\n Price: " + price + "\n Description: " + description + ".\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -30,7 +30,7 @@ public class User {
|
|||||||
|
|
||||||
//Rol del Usuario -> Lo que se almacena no es un objeto Role, sino la llave (key) de ese objeto.
|
//Rol del Usuario -> Lo que se almacena no es un objeto Role, sino la llave (key) de ese objeto.
|
||||||
@Persistent
|
@Persistent
|
||||||
private String role;
|
private String roleKey;
|
||||||
|
|
||||||
//Constructor
|
//Constructor
|
||||||
public User(String id, String name, String imgUrl, String email ,String role){
|
public User(String id, String name, String imgUrl, String email ,String role){
|
||||||
@ -38,7 +38,7 @@ public class User {
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
this.imgUrl = imgUrl;
|
this.imgUrl = imgUrl;
|
||||||
this.email = email;
|
this.email = email;
|
||||||
this.role = role;
|
this.roleKey = role;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -68,26 +68,26 @@ public class User {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRole() {
|
public String getRoleKey() {
|
||||||
return role;
|
return roleKey;
|
||||||
}
|
}
|
||||||
public String getRoleName() {
|
public String getRoleName() {
|
||||||
String roleName;
|
String roleName;
|
||||||
try{
|
try{
|
||||||
roleName = RolesControllerView.getRole(role).getName();
|
roleName = RolesControllerView.getRole(roleKey).getName();
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
roleName = "<span style=\"color: red\">The Role of this User does not exists.</span>";
|
roleName = "<span style=\"color: red; font-weight: bold\">The Role doesn't exists.</span>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return roleName;
|
return roleName;
|
||||||
}
|
}
|
||||||
public void setRole(String role) {
|
public void setRoleKey(String roleKey) {
|
||||||
this.role = role;
|
this.roleKey = roleKey;
|
||||||
}
|
}
|
||||||
|
|
||||||
//To String
|
//To String
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "User name: " + name + "\nUser role: " + role + "\n";
|
return "User name: " + name + "\nUser roleKey: " + roleKey + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,34 +20,12 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
@ -55,18 +33,22 @@
|
|||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -76,12 +58,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink">Access</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li class="active"><a class="whiteLink" href="../access">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -91,6 +96,19 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div style="float: left; display: inline;">
|
||||||
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: x-large; clear: right">
|
||||||
|
The admin Role has full access by default.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
var buttonDisabled = false;
|
var buttonDisabled = false;
|
||||||
</script>
|
</script>
|
||||||
@ -103,8 +121,7 @@
|
|||||||
<% if(roles.size() > 0) {%>
|
<% if(roles.size() > 0) {%>
|
||||||
<select id="formRole" name="rolesl" class="browser-default" required oninput="accessExists()">
|
<select id="formRole" name="rolesl" class="browser-default" required oninput="accessExists()">
|
||||||
<option value="!" disabled selected>Choose a Role</option>
|
<option value="!" disabled selected>Choose a Role</option>
|
||||||
<% for (int i = 0;i<roles.size();i++) { %>
|
<% for (Role r: roles) { %>
|
||||||
<% Role r = roles.get(i); %>
|
|
||||||
<option value="<%= r.getKey() %>"><%= r.getName() %></option>
|
<option value="<%= r.getKey() %>"><%= r.getName() %></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@ -121,6 +138,7 @@
|
|||||||
<% if (resourses.size() > 0) { %>
|
<% if (resourses.size() > 0) { %>
|
||||||
<select id="formResource" name="resourcesl" class="browser-default" required oninput="accessExists()">
|
<select id="formResource" name="resourcesl" class="browser-default" required oninput="accessExists()">
|
||||||
<option value="!" disabled selected>Choose a Resource</option>
|
<option value="!" disabled selected>Choose a Resource</option>
|
||||||
|
|
||||||
<% for (Resource res: resourses) { %>
|
<% for (Resource res: resourses) { %>
|
||||||
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
@ -166,24 +184,6 @@
|
|||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
isUserOptionsEnable = !isUserOptionsEnable;
|
||||||
}
|
}
|
||||||
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
postForm.style.display = "none";
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
postForm.submit();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (buttonDisabled)
|
if (buttonDisabled)
|
||||||
document.getElementById("sendButton").disabled = "disabled";
|
document.getElementById("sendButton").disabled = "disabled";
|
||||||
|
|
||||||
@ -191,7 +191,7 @@
|
|||||||
|
|
||||||
function accessExists() {
|
function accessExists() {
|
||||||
|
|
||||||
var role = document.forms["mainForm"]["formRole"].value;
|
var roleKey = document.forms["mainForm"]["formRole"].value;
|
||||||
var resource = document.forms["mainForm"]["formResource"].value;
|
var resource = document.forms["mainForm"]["formResource"].value;
|
||||||
|
|
||||||
var req = new XMLHttpRequest();
|
var req = new XMLHttpRequest();
|
||||||
@ -199,7 +199,6 @@
|
|||||||
req.onreadystatechange = function () {
|
req.onreadystatechange = function () {
|
||||||
|
|
||||||
if (req.readyState === 4 && req.status === 200){
|
if (req.readyState === 4 && req.status === 200){
|
||||||
console.log("Response -> " + req.responseText);
|
|
||||||
if (req.responseText === "true") {
|
if (req.responseText === "true") {
|
||||||
safeToSend = false;
|
safeToSend = false;
|
||||||
}
|
}
|
||||||
@ -210,7 +209,7 @@
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
req.open("get", "/access/add?info=check&rolesl=" + role + "&resourcesl=" + resource);
|
req.open("get", "/access/add?info=check&rolesl=" + roleKey + "&resourcesl=" + resource);
|
||||||
req.send();
|
req.send();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -4,42 +4,177 @@
|
|||||||
<%@ page import="java.util.List"%>
|
<%@ page import="java.util.List"%>
|
||||||
<%
|
<%
|
||||||
List<Role> roles = (List<Role>)request.getAttribute("roles");
|
List<Role> roles = (List<Role>)request.getAttribute("roles");
|
||||||
List<Resource> resourses = (List<Resource>)request.getAttribute("resources");
|
List<Resource> resources = (List<Resource>)request.getAttribute("resources");
|
||||||
Access a = (Access)request.getAttribute("access");
|
User user = (User) request.getAttribute("User");
|
||||||
|
Access a = (Access) request.getAttribute("access");
|
||||||
%>
|
%>
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<title>Insert title here</title>
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
|
<title>Edit an Access - Hotel Services</title>
|
||||||
|
|
||||||
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<span class="nav"><a href="/access">Back</a></span><p/>
|
|
||||||
<form name="post" method="post" action="edit">
|
|
||||||
<input type="hidden" name="id" value="<%= a.getId() %>"/>
|
|
||||||
<input type="hidden" name="info" value="editar"/>
|
|
||||||
<select name="rolesl">
|
|
||||||
<% if (roles.size() > 0) { %>
|
|
||||||
<% for (int i = 0;i<roles.size();i++) { %>
|
|
||||||
<% Role r = (Role)roles.get(i); %>
|
|
||||||
<option value="<%= r.getKey() %>"><%= r.getName() %></option>
|
|
||||||
<% } %>
|
|
||||||
<% } else { %>
|
|
||||||
<p/><span class="heading">No hay empleados registrados</span>
|
|
||||||
<% } %>
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select name="resourcesl">
|
<nav style="background-color: #67c9b3">
|
||||||
<% if (resourses.size() > 0) { %>
|
<div class="nav-wrapper">
|
||||||
<% for (int i = 0;i<resourses.size();i++) { %>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
<% Resource res = (Resource)resourses.get(i); %>
|
|
||||||
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
|
<%= user.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
|
<ul style="color: black">
|
||||||
|
|
||||||
|
<li style="padding: 0 5px;">
|
||||||
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
|
<i class="small material-icons">arrow_drop_up</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li class="active"><a href="" class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Edit an Access</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<form id="mainForm" name="post" method="post" action="edit" onsubmit="return safeSend()">
|
||||||
|
|
||||||
|
<input type="hidden" name="id" value="<%= a.getId() %>"/>
|
||||||
|
|
||||||
|
<input type="hidden" name="info" value="editar"/>
|
||||||
|
|
||||||
|
New Role:
|
||||||
|
<select id="formRole" name="rolesl" class="browser-default" oninput="accessExists()" required>
|
||||||
|
<option value="!" disabled selected>Choose a Role</option>
|
||||||
|
<% if (roles.size() > 0) { %>
|
||||||
|
|
||||||
|
<% for (Role r: roles) { %>
|
||||||
|
|
||||||
|
<option value="<%= r.getKey() %>"><%= r.getName() %></option>
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
<% } else { %>
|
|
||||||
<p/><span class="heading">No hay empleados registrados</span>
|
<% } else { %>
|
||||||
<% } %>
|
<span class="heading">There are no Roles.</span>
|
||||||
</select>
|
<% } %>
|
||||||
<input type="submit" value="Submit">
|
</select>
|
||||||
</form>
|
<br />
|
||||||
|
|
||||||
|
New Resource:
|
||||||
|
<select id="formResource" name="resourcesl" class="browser-default" oninput="accessExists()" required>
|
||||||
|
<option value="!" disabled selected>Choose a Resource</option>
|
||||||
|
<% if (resources.size() > 0) { %>
|
||||||
|
|
||||||
|
<% for (Resource res: resources) { %>
|
||||||
|
|
||||||
|
<option value="<%= res.getKey() %>"><%= res.getUrl() %></option>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<% } else { %>
|
||||||
|
<span class="heading">There are no Access.</span>
|
||||||
|
<% } %>
|
||||||
|
</select><br />
|
||||||
|
|
||||||
|
<button id="sendButton" class="btn waves-effect waves-light" type="submit" name="action">Edit
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<script>
|
||||||
|
function accessExists() {
|
||||||
|
|
||||||
|
var roleKey = document.forms["mainForm"]["formRole"].value;
|
||||||
|
var resource = document.forms["mainForm"]["formResource"].value;
|
||||||
|
|
||||||
|
var req = new XMLHttpRequest();
|
||||||
|
|
||||||
|
req.onreadystatechange = function () {
|
||||||
|
|
||||||
|
if (req.readyState === 4 && req.status === 200){
|
||||||
|
if (req.responseText === "true") {
|
||||||
|
safeToSend = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
safeToSend = true;
|
||||||
|
console.log("isSafe? -> " + safeToSend);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
req.open("get", "/access/add?info=check&rolesl=" + roleKey + "&resourcesl=" + resource);
|
||||||
|
req.send();
|
||||||
|
|
||||||
|
}
|
||||||
|
function safeSend() {
|
||||||
|
if (!safeToSend){
|
||||||
|
alert("This Access already exists");
|
||||||
|
return false;
|
||||||
|
} else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -4,8 +4,10 @@
|
|||||||
<%@ page import="model.*"%>
|
<%@ page import="model.*"%>
|
||||||
<%
|
<%
|
||||||
List<Access> accesses = (List<Access>)request.getAttribute("accesses");
|
List<Access> accesses = (List<Access>)request.getAttribute("accesses");
|
||||||
|
User usuario = (User) request.getAttribute("User");
|
||||||
|
String serverResponse = (String) request.getAttribute("serverResponse");
|
||||||
|
if (serverResponse == null) serverResponse = "!";
|
||||||
%>
|
%>
|
||||||
<% User usuario = (User) request.getAttribute("User"); %>
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
@ -19,52 +21,34 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-med-and-down" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -74,12 +58,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li class="active"><a class="whiteLink">Access</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
|
<li class="active"><a class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -89,6 +95,37 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<%if (!serverResponse.equals("!")){ %>
|
||||||
|
|
||||||
|
<div id="serverResponse">
|
||||||
|
<div style="margin: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var respDiv = document.getElementById("serverResponse");
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
||||||
|
respDiv.style.maxHeight = "500px";
|
||||||
|
setTimeout(function () {
|
||||||
|
respDiv.style.maxHeight = "0";
|
||||||
|
},1500);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div style="float: left; display: inline;">
|
||||||
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
|
</div>
|
||||||
|
<div style="font-size: x-large; clear: right">
|
||||||
|
The admin Role has full access by default.<br />
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/access/add')"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/access/add')"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -118,12 +155,12 @@
|
|||||||
<td><%= e.getResourceName() %></td>
|
<td><%= e.getResourceName() %></td>
|
||||||
<td><%= e.getStatus() %></td>
|
<td><%= e.getStatus() %></td>
|
||||||
<td>
|
<td>
|
||||||
<a href="/access/view?id=<%= e.getId() %>">View</a> |
|
<a onclick="postRedirect('/access/view',{id: '<%=e.getId() %>'})" class="postLink">View</a> |
|
||||||
<a href="/access/edit?id=<%= e.getId() %>">Edit</a> |
|
<a onclick="postRedirect('/access/edit',{id:'<%= e.getId() %>', info:'redirect'})" class="postLink">Edit</a> |
|
||||||
|
|
||||||
<form name="post_<%= e.getId() %>" style="display:none;" method="post" action="/access/delete"><input type="hidden" name="accessId" value="<%= e.getId() %>"/>
|
<form name="post_<%= e.getId() %>" style="display:none;" method="post" action="/access/delete"><input type="hidden" name="accessId" value="<%= e.getId() %>"/>
|
||||||
</form>
|
</form>
|
||||||
<a href="#" onclick="if (confirm('Are you sure you want to delete # <%= e.getId() %>?')) { document.post_<%= e.getId() %>.submit(); } event.returnValue = false; return false;">Delete</a></td>
|
<a href="#" class="postLink" onclick="if (confirm('Are you sure you want to delete # <%= e.getId() %>?')) { document.post_<%= e.getId() %>.submit(); } event.returnValue = false; return false;">Delete</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
||||||
@ -136,38 +173,6 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
postForm.style.display = "none";
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
postForm.submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -3,30 +3,103 @@
|
|||||||
<%@ page import="model.*"%>
|
<%@ page import="model.*"%>
|
||||||
<%
|
<%
|
||||||
Access access = (Access)request.getAttribute("access");
|
Access access = (Access)request.getAttribute("access");
|
||||||
String role = (String)request.getAttribute("role");
|
User user = (User) request.getAttribute("User");
|
||||||
String resource = (String)request.getAttribute("resource");
|
|
||||||
%>
|
%>
|
||||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
|
||||||
<title>Insert title here</title>
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||||
|
<title>Insert title here</title>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<span class="nav"><a href="/access">Back</a></span><p/>
|
|
||||||
<table border="0" cellspacing="1" cellpadding="5" bgcolor="#CCCCCC">
|
<nav style="background-color: #67c9b3">
|
||||||
<tr bgcolor="#407BA8">
|
<div class="nav-wrapper">
|
||||||
<td style="color: #ffffff; font-weight: bold;">ID</td>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
<td bgcolor="#ffffff"><%= access.getId() %></td>
|
|
||||||
</tr>
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
<tr bgcolor="#407BA8">
|
|
||||||
<td style="color: #ffffff; font-weight: bold;">Role</td>
|
<span style="min-width: 80px;">
|
||||||
<td bgcolor="#ffffff"><%= role %></td>
|
<%= user.getName()%>
|
||||||
</tr>
|
</span>
|
||||||
<tr bgcolor="#407BA8">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<td style="color: #ffffff; font-weight: bold;">Resource</td>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
<td bgcolor="#ffffff"><%= resource %></td>
|
|
||||||
</tr>
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
</table>
|
width: auto; display: none;">
|
||||||
|
<ul style="color: black">
|
||||||
|
|
||||||
|
<li style="padding: 0 5px;">
|
||||||
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
|
<i class="small material-icons">arrow_drop_up</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li class="active"><a href="" class="whiteLink">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">View an Access</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<div style="font-size: x-large">
|
||||||
|
ID: <%=access.getId()%><br />
|
||||||
|
Role: <%=access.getRoleName()%><br />
|
||||||
|
Resource: <%= access.getResourceName() %>
|
||||||
|
</div>
|
||||||
|
<hr/>
|
||||||
|
|
||||||
|
<br />
|
||||||
|
<a href="../access" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
@ -10,7 +10,7 @@
|
|||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<% User user = (User) request.getAttribute("User"); %>
|
<% User user = (User) request.getAttribute("User"); %>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Add a Resource - Hotel Services</title>
|
<title>Add a Resource - Hotel Services</title>
|
||||||
|
|
||||||
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
@ -20,52 +20,33 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -75,12 +56,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
<li class="active"><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -122,38 +125,6 @@
|
|||||||
sourceImg.src = input.value;
|
sourceImg.src = input.value;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
postForm.style.display = "none";
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
postForm.submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
@ -9,8 +9,11 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<% User usuario = (User) request.getAttribute("User"); %>
|
<% User usuario = (User) request.getAttribute("User");
|
||||||
<% List<Resource> resourceList = (List<Resource>) request.getAttribute("ResourceList");%>
|
List<Resource> resourceList = (List<Resource>) request.getAttribute("ResourceList");
|
||||||
|
String serverResponse = (String) request.getAttribute("serverResponse");
|
||||||
|
if (serverResponse == null) serverResponse = "!";
|
||||||
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Resources - Hotel Services</title>
|
<title>Resources - Hotel Services</title>
|
||||||
@ -22,52 +25,34 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-med-and-down" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -77,12 +62,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -92,6 +100,24 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<%if (!serverResponse.equals("!")){ %>
|
||||||
|
|
||||||
|
<div id="serverResponse">
|
||||||
|
<div style="margin: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var respDiv = document.getElementById("serverResponse");
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
||||||
|
respDiv.style.maxHeight = "500px";
|
||||||
|
setTimeout(function () {
|
||||||
|
respDiv.style.maxHeight = "0";
|
||||||
|
},1500);
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/resources/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/resources/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -140,37 +166,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
postForm.style.display = "none";
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
postForm.submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<% Resource resource = (Resource) request.getAttribute("Resource");
|
<% Resource resource = (Resource) request.getAttribute("Resource");
|
||||||
User userLogged = (User) request.getAttribute("UserLogged");
|
User usuario = (User) request.getAttribute("UserLogged");
|
||||||
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
||||||
String action = (String) request.getAttribute("action");
|
String action = (String) request.getAttribute("action");
|
||||||
%>
|
%>
|
||||||
@ -24,51 +24,33 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
<%= userLogged.getName()%>
|
|
||||||
<img src="<%=userLogged.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<span style="min-width: 80px;">
|
||||||
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('/users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -78,12 +60,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
<li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
<li class="active"><a class="whiteLink" href="">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -135,37 +139,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
postForm.style.display = "none";
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
postForm.submit();
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -19,53 +19,33 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -75,12 +55,36 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink">Roles</a></li>
|
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
@ -8,8 +8,11 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<% User usuario = (User) request.getAttribute("User"); %>
|
<% User usuario = (User) request.getAttribute("User");
|
||||||
<% List<Role> roleList = (List<Role>) request.getAttribute("RoleList");%>
|
List<Role> roleList = (List<Role>) request.getAttribute("RoleList");
|
||||||
|
String serverResponse = (String) request.getAttribute("serverResponse");
|
||||||
|
if (serverResponse == null) serverResponse = "!";
|
||||||
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Roles - Hotel Services</title>
|
<title>Roles - Hotel Services</title>
|
||||||
@ -21,53 +24,33 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-med-and-down" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -77,12 +60,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
|
<a onclick="postRedirect('./users')">Users</a>
|
||||||
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -92,6 +98,25 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<%if (!serverResponse.equals("!")){ %>
|
||||||
|
|
||||||
|
<div id="serverResponse">
|
||||||
|
<div style="margin: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var respDiv = document.getElementById("serverResponse");
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
||||||
|
respDiv.style.maxHeight = "500px";
|
||||||
|
setTimeout(function () {
|
||||||
|
respDiv.style.maxHeight = "0";
|
||||||
|
},1500);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/roles/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/roles/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -109,8 +134,8 @@
|
|||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
<% for (int i = 0; i < roleList.size(); i++) {%>
|
<% for (int i = 0; i < roleList.size(); i++) {%>
|
||||||
<% Role role = roleList.get(i); %>
|
<% Role roleKey = roleList.get(i); %>
|
||||||
<% String key = role.getKey();
|
<% String key = roleKey.getKey();
|
||||||
|
|
||||||
String[] arr = key.split("");
|
String[] arr = key.split("");
|
||||||
|
|
||||||
@ -125,9 +150,9 @@
|
|||||||
|
|
||||||
%>
|
%>
|
||||||
<tr>
|
<tr>
|
||||||
<td><%= role.getName()%></td>
|
<td><%= roleKey.getName()%></td>
|
||||||
<td><%= role.getStatus()%></td>
|
<td><%= roleKey.getStatus()%></td>
|
||||||
<td><%= role.getCreateDate()%></td>
|
<td><%= roleKey.getCreateDate()%></td>
|
||||||
<td>
|
<td>
|
||||||
<a class="postLink" onclick="postRedirect('roles/view',{action:'viewRedirect',key:'<%=key%>'})">View</a>
|
<a class="postLink" onclick="postRedirect('roles/view',{action:'viewRedirect',key:'<%=key%>'})">View</a>
|
||||||
| <a class="postLink" onclick="postRedirect('roles/view',{action:'editRedirect',key:'<%=key%>'})">Edit</a>
|
| <a class="postLink" onclick="postRedirect('roles/view',{action:'editRedirect',key:'<%=key%>'})">Edit</a>
|
||||||
@ -143,47 +168,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,8 +7,8 @@
|
|||||||
Time: 16:39
|
Time: 16:39
|
||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<% Role role = (Role) request.getAttribute("Role");
|
<% Role roleKey = (Role) request.getAttribute("Role");
|
||||||
User userLogged = (User) request.getAttribute("UserLogged");
|
User usuario = (User) request.getAttribute("UserLogged");
|
||||||
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
||||||
String action = (String) request.getAttribute("action");%>
|
String action = (String) request.getAttribute("action");%>
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
@ -23,52 +23,33 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
<%= userLogged.getName()%>
|
|
||||||
<img src="<%=userLogged.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<span style="min-width: 80px;">
|
||||||
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('/users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -78,12 +59,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="/roles">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
<li class="active"><a class="whiteLink" href="">Roles</a></li>
|
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">
|
||||||
|
Show Services
|
||||||
|
</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -97,11 +100,11 @@
|
|||||||
|
|
||||||
<form action="./add" method="post">
|
<form action="./add" method="post">
|
||||||
|
|
||||||
<input name="key" value="<%=role.getKey()%>" type="hidden">
|
<input name="key" value="<%=roleKey.getKey()%>" type="hidden">
|
||||||
<input name="action" value="update" type="hidden">
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
Name:<br />
|
Name:<br />
|
||||||
<input name="roleName" value="<%=role.getName()%>" placeholder="Name" required><br/>
|
<input name="roleName" value="<%=roleKey.getName()%>" placeholder="Name" required><br/>
|
||||||
<br/>
|
<br/>
|
||||||
Status:<br />
|
Status:<br />
|
||||||
<select name="roleStatus" class="browser-default" required>
|
<select name="roleStatus" class="browser-default" required>
|
||||||
@ -121,8 +124,8 @@
|
|||||||
|
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
Name: <%=role.getName()%><br />
|
Name: <%=roleKey.getName()%><br />
|
||||||
Email: <%=role.getStatus()%><br />
|
Email: <%=roleKey.getStatus()%><br />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
@ -135,47 +138,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
120
war/WEB-INF/View/Services/add.jsp
Normal file
120
war/WEB-INF/View/Services/add.jsp
Normal file
@ -0,0 +1,120 @@
|
|||||||
|
<%@ page import="model.User" %>
|
||||||
|
<%@ page import="java.util.List" %>
|
||||||
|
<%@ page import="model.Role" %><%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: Fernando
|
||||||
|
Date: 07/06/2018
|
||||||
|
Time: 16:39
|
||||||
|
To change this template use File | Settings | File Templates.
|
||||||
|
--%>
|
||||||
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
|
<% User user = (User) request.getAttribute("User"); %>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<title>Add a Service - Hotel Services</title>
|
||||||
|
|
||||||
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav style="background-color: #67c9b3">
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
||||||
|
<%= user.getName()%>
|
||||||
|
<img src="<%=user.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons right">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
||||||
|
<ul style="color: black">
|
||||||
|
|
||||||
|
<li style="padding: 0 5px;">
|
||||||
|
<a style="color: black" onclick="postRedirect('../view',{action:'closeSession'})">Log Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
|
<i class="small material-icons">arrow_drop_up</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Create a Service</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<form method="post" action="./add">
|
||||||
|
<input name="action" value="create" type="hidden">
|
||||||
|
|
||||||
|
Name of the Service:<br />
|
||||||
|
<input name="Name" placeholder="Name" required><br />
|
||||||
|
|
||||||
|
Price of the Service:<br />
|
||||||
|
<input name="Price" placeholder="Price" type="number" required min="0" step="0.1"><br />
|
||||||
|
|
||||||
|
Description of the Service:<br />
|
||||||
|
<input name="Description" placeholder="Description" required><br />
|
||||||
|
|
||||||
|
<input type="hidden" name="userId" value="<%=user.getId()%>">
|
||||||
|
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Create
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
<hr />
|
||||||
|
<br />
|
||||||
|
<a href="../services" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
160
war/WEB-INF/View/Services/index.jsp
Normal file
160
war/WEB-INF/View/Services/index.jsp
Normal file
@ -0,0 +1,160 @@
|
|||||||
|
<%@ page import="model.User" %>
|
||||||
|
<%@ page import="java.util.List" %>
|
||||||
|
<%@ page import="model.Service" %><%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: Fernando
|
||||||
|
Date: 07/06/2018
|
||||||
|
Time: 16:39
|
||||||
|
To change this template use File | Settings | File Templates.
|
||||||
|
--%>
|
||||||
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
|
<% User usuario = (User) request.getAttribute("User");
|
||||||
|
List<Service> servicesList = (List<Service>) request.getAttribute("ServicesList");
|
||||||
|
String serverResponse = (String) request.getAttribute("serverResponse");
|
||||||
|
if (serverResponse == null) serverResponse = "!";
|
||||||
|
%>
|
||||||
|
<html lang="es">
|
||||||
|
<head>
|
||||||
|
<title>Services - Hotel Services</title>
|
||||||
|
|
||||||
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css?v=2">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav style="background-color: #67c9b3">
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
|
<ul style="color: black">
|
||||||
|
|
||||||
|
<li style="padding: 0 5px;">
|
||||||
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
|
<i class="small material-icons">arrow_drop_up</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./users')">Users</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif">Services</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<%if (!serverResponse.equals("!")){ %>
|
||||||
|
|
||||||
|
<div id="serverResponse">
|
||||||
|
<div style="margin: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var respDiv = document.getElementById("serverResponse");
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
||||||
|
respDiv.style.maxHeight = "500px";
|
||||||
|
setTimeout(function () {
|
||||||
|
respDiv.style.maxHeight = "0";
|
||||||
|
},1500);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/services/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<table class="striped responsive-table">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>Price</td>
|
||||||
|
<td>Description</td>
|
||||||
|
<td>Created by</td>
|
||||||
|
<td>Actions</td>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
|
||||||
|
<tbody>
|
||||||
|
|
||||||
|
<% for (Service service: servicesList) {%>
|
||||||
|
<tr>
|
||||||
|
<td><%= service.getName()%></td>
|
||||||
|
<td><%= service.getPrice() %></td>
|
||||||
|
<td><%= service.getDescription() %></td>
|
||||||
|
<td><%= service.getCreatorUserName() %></td>
|
||||||
|
<td>
|
||||||
|
<a class="postLink" onclick="postRedirect('services/view',{action:'viewRedirect',serviceKey:'<%=service.getKey()%>'})">View</a>
|
||||||
|
| <a class="postLink" onclick="postRedirect('services/view',{action:'editRedirect',serviceKey:'<%=service.getKey()%>'})">Edit</a>
|
||||||
|
| <a class="postLink" onclick="postRedirect('services/delete',{serviceKey:'<%=service.getKey()%>'})">Delete</a></td>
|
||||||
|
</tr>
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
</tbody>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
145
war/WEB-INF/View/Services/view.jsp
Normal file
145
war/WEB-INF/View/Services/view.jsp
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
<%@ page import="model.User" %>
|
||||||
|
<%@ page import="model.Service" %>
|
||||||
|
<%--
|
||||||
|
Created by IntelliJ IDEA.
|
||||||
|
User: Fernando
|
||||||
|
Date: 07/06/2018
|
||||||
|
Time: 16:39
|
||||||
|
To change this template use File | Settings | File Templates.
|
||||||
|
--%>
|
||||||
|
<% Service service = (Service) request.getAttribute("Service");
|
||||||
|
User usuario = (User) request.getAttribute("User");
|
||||||
|
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
||||||
|
String action = (String) request.getAttribute("action");%>
|
||||||
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title><%=action%> a Service - Hotel Services</title>
|
||||||
|
|
||||||
|
<meta name="google-signin-client_id" content="746890482047-c734fgap3p3vb6bdoquufn60bsh2p8l9.apps.googleusercontent.com">
|
||||||
|
|
||||||
|
<script src="https://apis.google.com/js/platform.js" async defer></script>
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
|
||||||
|
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<nav style="background-color: #67c9b3">
|
||||||
|
<div class="nav-wrapper">
|
||||||
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
|
<ul style="color: black">
|
||||||
|
|
||||||
|
<li style="padding: 0 5px;">
|
||||||
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
|
</li>
|
||||||
|
|
||||||
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
|
<i class="small material-icons">arrow_drop_up</i>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../users')">Users</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li class="active"><a class="whiteLink" href="">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">
|
||||||
|
Show Services
|
||||||
|
</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a href="#" style="background-color: lightgray">Roles</a>
|
||||||
|
<a onclick="postRedirect('../users')">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<br />
|
||||||
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a Service</span>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
|
<% if (editAllowed) {%>
|
||||||
|
|
||||||
|
<form action="./add" method="post">
|
||||||
|
|
||||||
|
<input name="key" value="<%=service.getKey()%>" type="hidden">
|
||||||
|
<input name="action" value="update" type="hidden">
|
||||||
|
|
||||||
|
Name of the Service:<br />
|
||||||
|
<input name="Name" value="<%=service.getName()%>" placeholder="Name" required><br/>
|
||||||
|
|
||||||
|
Price of the Service:<br />
|
||||||
|
<input name="Price" type="number" min="0" step="0.1" required placeholder="Price" value="<%= service.getPrice() %>"><br />
|
||||||
|
|
||||||
|
Description of the Service:<br />
|
||||||
|
<input name="Description" placeholder="Description" required value="<%= service.getDescription() %>"><br />
|
||||||
|
|
||||||
|
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Edit
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<% } else {%>
|
||||||
|
|
||||||
|
|
||||||
|
<div style="font-size: x-large">
|
||||||
|
Name: <%= service.getName() %><br />
|
||||||
|
Price: <%= service.getPrice() %><br />
|
||||||
|
Description: <%= service.getDescription() %><br />
|
||||||
|
Created by: <a style="cursor:pointer;" onclick="postRedirect('/users/view',{action:'viewRedirect',userID:'<%=service.getCreatorUserId()%>'})"><%= service.getCreatorUserName() %></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
<br />
|
||||||
|
<a href="../roles" class="waves-effect waves-light btn whiteLink"><i class="material-icons left">arrow_back</i>Go Back</a>
|
||||||
|
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -21,42 +21,19 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
||||||
<%= user.getName()%>
|
<%= user.getName()%>
|
||||||
@ -67,7 +44,7 @@
|
|||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('../view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -77,12 +54,34 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -114,8 +113,8 @@
|
|||||||
Role of the User:<br />
|
Role of the User:<br />
|
||||||
<select name="userRole" class="browser-default" required>
|
<select name="userRole" class="browser-default" required>
|
||||||
<option value="" disabled selected>Choose a Role</option>
|
<option value="" disabled selected>Choose a Role</option>
|
||||||
<% for(Role role: roles){ %>
|
<% for(Role roleKey: roles){ %>
|
||||||
<option value="<%=role.getKey()%>"><%=role.getName()%></option>
|
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
@ -140,47 +139,5 @@
|
|||||||
sourceImg.src = input.value;
|
sourceImg.src = input.value;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -7,8 +7,11 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
|
||||||
<% User usuario = (User) request.getAttribute("User"); %>
|
<% User usuario = (User) request.getAttribute("User");
|
||||||
<% List<User> userList = (List<User>) request.getAttribute("UsersList");%>
|
List<User> userList = (List<User>) request.getAttribute("UsersList");
|
||||||
|
String serverResponse = (String) request.getAttribute("serverResponse");
|
||||||
|
if (serverResponse == null) serverResponse = "!";
|
||||||
|
%>
|
||||||
<html lang="es">
|
<html lang="es">
|
||||||
<head>
|
<head>
|
||||||
<title>Users - Hotel Services</title>
|
<title>Users - Hotel Services</title>
|
||||||
@ -20,53 +23,34 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="/css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="/css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css?v=2">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink hide-on-med-and-down" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
|
|
||||||
|
<span style="min-width: 80px;">
|
||||||
<%= usuario.getName()%>
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -76,12 +60,35 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('./resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('./services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('./roles')">Roles</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
|
<a onclick="postRedirect('./resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('./access')">Access</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@ -91,6 +98,25 @@
|
|||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
|
<%if (!serverResponse.equals("!")){ %>
|
||||||
|
|
||||||
|
<div id="serverResponse">
|
||||||
|
<div style="margin: 10px"></div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
var respDiv = document.getElementById("serverResponse");
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
||||||
|
respDiv.style.maxHeight = "500px";
|
||||||
|
setTimeout(function () {
|
||||||
|
respDiv.style.maxHeight = "0";
|
||||||
|
},1500);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<% } %>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
|
||||||
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/users/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
<a class="waves-effect waves-light btn whiteLink" onclick="postRedirect('/users/add',{action:'redirect'})"><i class="material-icons left">add</i>Create</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
@ -132,47 +158,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
To change this template use File | Settings | File Templates.
|
To change this template use File | Settings | File Templates.
|
||||||
--%>
|
--%>
|
||||||
<% User user = (User) request.getAttribute("User");
|
<% User user = (User) request.getAttribute("User");
|
||||||
User userLogged = (User) request.getAttribute("UserLogged");
|
User usuario = (User) request.getAttribute("UserLogged");
|
||||||
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
boolean editAllowed = (Boolean) request.getAttribute("editAllowed");
|
||||||
String action = (String) request.getAttribute("action");%>
|
String action = (String) request.getAttribute("action");%>
|
||||||
<% List<Role> roles = (List<Role>) request.getAttribute("Roles"); %>
|
<% List<Role> roles = (List<Role>) request.getAttribute("Roles"); %>
|
||||||
@ -25,52 +25,34 @@
|
|||||||
|
|
||||||
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
<link type="text/css" rel="stylesheet" href="../css/Diseno.css">
|
||||||
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
<link type="text/css" rel="stylesheet" href="../css/materialize.min.css">
|
||||||
|
<link type="text/css" rel="stylesheet" href="/css/Elements.css">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||||
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css?family=Roboto" rel="stylesheet">
|
||||||
|
|
||||||
<style>
|
<script src="/js/GlobalJs.js" async defer></script>
|
||||||
.postLink{
|
|
||||||
color: blue;
|
|
||||||
font-size: large;
|
|
||||||
cursor: pointer;
|
|
||||||
|
|
||||||
transition: color 250ms ease-in;
|
|
||||||
}
|
|
||||||
.postLink:hover{
|
|
||||||
color: green;
|
|
||||||
font-size: larger;
|
|
||||||
}
|
|
||||||
body{
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
background-color: white;
|
|
||||||
font-family: Roboto, serif;
|
|
||||||
}
|
|
||||||
.whiteLink{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
.whiteLink:hover{
|
|
||||||
color: white;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
<nav style="background-color: #67c9b3">
|
<nav style="background-color: #67c9b3">
|
||||||
<div class="nav-wrapper">
|
<div class="nav-wrapper">
|
||||||
<a class="whiteLink" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
<a class="whiteLink hide-on-small-only" href="../" style="padding: 0 0 0 20px; font-family: 'Product Sans', Roboto, serif; font-size: xx-large">Hotel Services</a>
|
||||||
|
|
||||||
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer;" onclick="changeUserOptions()">
|
<div class="right valign-wrapper" style="padding: 0 0 0 10px; cursor: pointer; min-width: 150px;" onclick="changeUserOptions()">
|
||||||
<%= userLogged.getName()%>
|
|
||||||
<img src="<%=userLogged.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
|
||||||
<i class="material-icons right">arrow_drop_down</i>
|
|
||||||
|
|
||||||
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute; width: auto; display: none;">
|
<span style="min-width: 80px;">
|
||||||
|
<%= usuario.getName()%>
|
||||||
|
</span>
|
||||||
|
<img src="<%=usuario.getImgUrl()%>" alt="" class="circle responsive-img" style="padding: 5px" width="50px">
|
||||||
|
<i class="material-icons">arrow_drop_down</i>
|
||||||
|
|
||||||
|
<div id="userOptions" style="background-color: white; border:solid 2px #67c9b3; position: absolute;
|
||||||
|
width: auto; display: none;">
|
||||||
<ul style="color: black">
|
<ul style="color: black">
|
||||||
|
|
||||||
<li style="padding: 0 5px;">
|
<li style="padding: 0 5px;">
|
||||||
<a style="color: black" onclick="postRedirect('/users/view',{action:'closeSession'})">Cerrar Sesion</a>
|
<a style="color: black" onclick="postRedirect('./users/view',{action:'closeSession'})">Log Out</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
<li id="cerrar" style="padding: 0 5px; cursor: pointer">
|
||||||
@ -80,18 +62,40 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<ul id="nav-mobile" class="right">
|
<ul id="nav-mobile" class="right hide-on-med-and-down">
|
||||||
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
<li>
|
||||||
|
<a href="https://github.com/Grupo-PW2/Lab08" target="_blank">
|
||||||
|
<svg style="width: 32px; height: 32px; margin: 20px 0" aria-labelledby="simpleicons-github-icon" roleKey="img" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<title id="simpleicons-github-icon">
|
||||||
|
GitHub icon
|
||||||
|
</title>
|
||||||
|
<path fill="white" d="M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12">
|
||||||
|
</path>
|
||||||
|
</svg>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../roles')">Roles</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
<li class="active"><a class="whiteLink" href="">Users</a></li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../resources')">Resources</a></li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
|
<li>|</li>
|
||||||
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
|
<li>|</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
<div id="dropdownContent">
|
||||||
|
<a onclick="postRedirect('../roles')">Roles</a>
|
||||||
|
<a href="#" style="background-color: lightgray">Users</a>
|
||||||
|
<a onclick="postRedirect('../resources')">Resources</a>
|
||||||
|
<a onclick="postRedirect('../access')">Access</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<br />
|
<br />
|
||||||
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a Role</span>
|
<span style="font-size: xx-large; font-family: 'Product Sans',Roboto,serif"><%=action%> a User</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
|
||||||
@ -123,8 +127,8 @@
|
|||||||
Role of the User:<br />
|
Role of the User:<br />
|
||||||
<select name="userRole" class="browser-default" required>
|
<select name="userRole" class="browser-default" required>
|
||||||
<option value="" disabled selected>Choose a Role</option>
|
<option value="" disabled selected>Choose a Role</option>
|
||||||
<% for(Role role: roles){ %>
|
<% for(Role roleKey: roles){ %>
|
||||||
<option value="<%=role.getKey()%>"><%=role.getName()%></option>
|
<option value="<%=roleKey.getKey()%>"><%=roleKey.getName()%></option>
|
||||||
<% } %>
|
<% } %>
|
||||||
</select>
|
</select>
|
||||||
<br />
|
<br />
|
||||||
@ -165,47 +169,6 @@
|
|||||||
sourceImg.src = input.value;
|
sourceImg.src = input.value;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
<script>
|
|
||||||
var userOptions = document.getElementById("userOptions");
|
|
||||||
|
|
||||||
var isUserOptionsEnable = true;
|
|
||||||
|
|
||||||
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
|
||||||
|
|
||||||
function changeUserOptions() {
|
|
||||||
if (isUserOptionsEnable){
|
|
||||||
userOptions.style.display = "none";
|
|
||||||
} else {
|
|
||||||
userOptions.style.display = "block";
|
|
||||||
}
|
|
||||||
|
|
||||||
isUserOptionsEnable = !isUserOptionsEnable;
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
<script>
|
|
||||||
function postRedirect(url, postData){
|
|
||||||
|
|
||||||
var postForm = document.createElement("form");
|
|
||||||
postForm.action = url;
|
|
||||||
postForm.method = "POST";
|
|
||||||
|
|
||||||
postForm.style.display = "none";
|
|
||||||
|
|
||||||
for (var key in postData){
|
|
||||||
if (postData.hasOwnProperty(key)){
|
|
||||||
var input = document.createElement("input");
|
|
||||||
input.type = "hidden";
|
|
||||||
input.name = key;
|
|
||||||
input.value = postData[key];
|
|
||||||
postForm.appendChild(input);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
document.body.appendChild(postForm);
|
|
||||||
|
|
||||||
postForm.submit();
|
|
||||||
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -125,6 +125,7 @@
|
|||||||
<servlet-name>AccessControllerEdit</servlet-name>
|
<servlet-name>AccessControllerEdit</servlet-name>
|
||||||
<url-pattern>/access/edit</url-pattern>
|
<url-pattern>/access/edit</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>AccessControllerAdd</servlet-name>
|
<servlet-name>AccessControllerAdd</servlet-name>
|
||||||
<servlet-class>controller.access.AccessControllerAdd</servlet-class>
|
<servlet-class>controller.access.AccessControllerAdd</servlet-class>
|
||||||
@ -133,6 +134,7 @@
|
|||||||
<servlet-name>AccessControllerAdd</servlet-name>
|
<servlet-name>AccessControllerAdd</servlet-name>
|
||||||
<url-pattern>/access/add</url-pattern>
|
<url-pattern>/access/add</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>AccessControllerIndex</servlet-name>
|
<servlet-name>AccessControllerIndex</servlet-name>
|
||||||
<servlet-class>controller.access.AccessControllerIndex</servlet-class>
|
<servlet-class>controller.access.AccessControllerIndex</servlet-class>
|
||||||
@ -141,6 +143,7 @@
|
|||||||
<servlet-name>AccessControllerIndex</servlet-name>
|
<servlet-name>AccessControllerIndex</servlet-name>
|
||||||
<url-pattern>/access</url-pattern>
|
<url-pattern>/access</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>AccessControllerView</servlet-name>
|
<servlet-name>AccessControllerView</servlet-name>
|
||||||
<servlet-class>controller.access.AccessControllerView</servlet-class>
|
<servlet-class>controller.access.AccessControllerView</servlet-class>
|
||||||
@ -149,6 +152,7 @@
|
|||||||
<servlet-name>AccessControllerView</servlet-name>
|
<servlet-name>AccessControllerView</servlet-name>
|
||||||
<url-pattern>/access/view</url-pattern>
|
<url-pattern>/access/view</url-pattern>
|
||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
<servlet>
|
<servlet>
|
||||||
<servlet-name>AccessControllerDelete</servlet-name>
|
<servlet-name>AccessControllerDelete</servlet-name>
|
||||||
<servlet-class>controller.access.AccessControllerDelete</servlet-class>
|
<servlet-class>controller.access.AccessControllerDelete</servlet-class>
|
||||||
@ -159,6 +163,46 @@
|
|||||||
</servlet-mapping>
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Servlets propios del alumno
|
||||||
|
-->
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>ServicesControllerAdd</servlet-name>
|
||||||
|
<servlet-class>controller.services.ServicesControllerAdd</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>ServicesControllerAdd</servlet-name>
|
||||||
|
<url-pattern>/services/add</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>ServicesControllerDelete</servlet-name>
|
||||||
|
<servlet-class>controller.services.ServicesControllerDelete</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>ServicesControllerDelete</servlet-name>
|
||||||
|
<url-pattern>/services/delete</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>ServicesControllerIndex</servlet-name>
|
||||||
|
<servlet-class>controller.services.ServicesControllerIndex</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>ServicesControllerIndex</servlet-name>
|
||||||
|
<url-pattern>/services</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
<servlet>
|
||||||
|
<servlet-name>ServicesControllerView</servlet-name>
|
||||||
|
<servlet-class>controller.services.ServicesControllerView</servlet-class>
|
||||||
|
</servlet>
|
||||||
|
<servlet-mapping>
|
||||||
|
<servlet-name>ServicesControllerView</servlet-name>
|
||||||
|
<url-pattern>/services/view</url-pattern>
|
||||||
|
</servlet-mapping>
|
||||||
|
|
||||||
|
|
||||||
<welcome-file-list>
|
<welcome-file-list>
|
||||||
<welcome-file>index.html</welcome-file>
|
<welcome-file>index.html</welcome-file>
|
||||||
</welcome-file-list>
|
</welcome-file-list>
|
||||||
|
61
war/css/Elements.css
Normal file
61
war/css/Elements.css
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
.postLink{
|
||||||
|
color: blue;
|
||||||
|
font-size: large;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
transition: color 250ms ease-in;
|
||||||
|
}
|
||||||
|
.postLink:hover{
|
||||||
|
color: green;
|
||||||
|
font-size: larger;
|
||||||
|
}
|
||||||
|
body{
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
background-color: white;
|
||||||
|
font-family: Roboto, serif;
|
||||||
|
}
|
||||||
|
.whiteLink{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
.whiteLink:hover{
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
#serverResponse{
|
||||||
|
color: white;
|
||||||
|
background-color: #26a69a;
|
||||||
|
display: inline-block;
|
||||||
|
font-size: large;
|
||||||
|
border-radius: 4px;
|
||||||
|
box-shadow: 2px 2px gray;
|
||||||
|
cursor: default;
|
||||||
|
overflow: hidden;
|
||||||
|
max-height: 0;
|
||||||
|
transition: max-height 1s ease-in-out;
|
||||||
|
}
|
||||||
|
#serverResponse::selection{
|
||||||
|
background: transparent;
|
||||||
|
text-shadow: 2px 2px gray;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropdown {
|
||||||
|
position: relative;
|
||||||
|
display: inline-block;
|
||||||
|
text-decoration: underline;
|
||||||
|
}
|
||||||
|
#dropdownContent {
|
||||||
|
max-height: 0;
|
||||||
|
position: absolute;
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
min-width: 150px;
|
||||||
|
box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2);
|
||||||
|
z-index: 2;
|
||||||
|
overflow: hidden;
|
||||||
|
transition: max-height 250ms;
|
||||||
|
}
|
||||||
|
#dropdownContent a {
|
||||||
|
color: black;
|
||||||
|
padding: 4px 16px;
|
||||||
|
text-decoration: none;
|
||||||
|
display: block;
|
||||||
|
}
|
@ -51,10 +51,36 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
|
|
||||||
<div style="font-size: x-large">
|
<div style="font-size: x-large">
|
||||||
<span id="mainText">Welcome! Log In to Start:</span>
|
<span id="mainText">Welcome! Log In to Start</span>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
|
<div style="font-size: large">
|
||||||
|
With Google:
|
||||||
<div class="g-signin2" data-onsuccess="onSignIn"></div>
|
<div class="g-signin2" data-onsuccess="onSignIn"></div>
|
||||||
|
<br />
|
||||||
|
<br />
|
||||||
|
Or with your email:<br />
|
||||||
|
<form id="sigInForm" method="post" action="/users/add" onsubmit="return validate()">
|
||||||
|
<script>
|
||||||
|
function validate() {
|
||||||
|
var email = document.forms['sigInForm']['userEmailForm'].value;
|
||||||
|
document.forms['sigInForm']['userNameForm'].value = email.substring(0,email.search('@'));
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<input id="userEmailForm" name="userEmail" placeholder="email" type="email" required><br />
|
||||||
|
|
||||||
|
<input id="userNameForm" name="userName" type="hidden">
|
||||||
|
<input name="userImg" type="hidden" value="https://i.stack.imgur.com/34AD2.jpg">
|
||||||
|
<input name="userRole" type="hidden" value="User">
|
||||||
|
<input name="action" type="hidden" value="logIn">
|
||||||
|
|
||||||
|
<button class="btn waves-effect waves-light" type="submit" name="action">Log In
|
||||||
|
<i class="material-icons right">send</i>
|
||||||
|
</button>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<hr />
|
<hr />
|
||||||
@ -63,7 +89,6 @@
|
|||||||
Jose Rodriguez, 20101650<br />
|
Jose Rodriguez, 20101650<br />
|
||||||
Gustavo Turpo, 20173374<br />
|
Gustavo Turpo, 20173374<br />
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
37
war/js/GlobalJs.js
Normal file
37
war/js/GlobalJs.js
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
var dropdownOpen = false;
|
||||||
|
var dropdown = document.getElementById("dropdownContent");
|
||||||
|
function toggleDropdown() {
|
||||||
|
(dropdownOpen)? dropdown.style.maxHeight = "0": dropdown.style.maxHeight = "300px";
|
||||||
|
dropdownOpen = !dropdownOpen;
|
||||||
|
}
|
||||||
|
|
||||||
|
var userOptions = document.getElementById("userOptions");
|
||||||
|
var isUserOptionsEnable = true;
|
||||||
|
document.getElementById("cerrar").addEventListener("click", changeUserOptions());
|
||||||
|
function changeUserOptions() {
|
||||||
|
if (isUserOptionsEnable){
|
||||||
|
userOptions.style.display = "none";
|
||||||
|
} else {
|
||||||
|
userOptions.style.display = "block";
|
||||||
|
}
|
||||||
|
isUserOptionsEnable = !isUserOptionsEnable;
|
||||||
|
}
|
||||||
|
|
||||||
|
function postRedirect(url, postData){
|
||||||
|
var postForm = document.createElement("form");
|
||||||
|
postForm.action = url;
|
||||||
|
postForm.method = "POST";
|
||||||
|
postForm.style.display = "none";
|
||||||
|
for (var key in postData){
|
||||||
|
if (postData.hasOwnProperty(key)){
|
||||||
|
var input = document.createElement("input");
|
||||||
|
input.type = "hidden";
|
||||||
|
input.name = key;
|
||||||
|
input.value = postData[key];
|
||||||
|
postForm.appendChild(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
document.body.appendChild(postForm);
|
||||||
|
postForm.submit();
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user