Mejoras generales
This commit is contained in:
parent
3750096e23
commit
2994b38f08
@ -76,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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Access created successfully.\"}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (request.getParameter("info").equals("check")){
|
else if (request.getParameter("info").equals("check")){
|
||||||
|
@ -24,7 +24,7 @@ public class AccessControllerDelete extends HttpServlet {
|
|||||||
|
|
||||||
pm.deletePersistent(r);
|
pm.deletePersistent(r);
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","Access deleted successfully.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"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");
|
||||||
|
@ -62,7 +62,7 @@ public class AccessControllerEdit extends HttpServlet {
|
|||||||
a.setResourceKey(idResource);
|
a.setResourceKey(idResource);
|
||||||
}
|
}
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","Access updated successfully.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Access updated successfully.\"}");
|
||||||
|
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ public class AccessControllerView extends HttpServlet {
|
|||||||
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
}catch(javax.jdo.JDOObjectNotFoundException nf) {
|
||||||
System.err.println("JDOObjectNotFound -> AccessControllerView");
|
System.err.println("JDOObjectNotFound -> AccessControllerView");
|
||||||
nf.printStackTrace();
|
nf.printStackTrace();
|
||||||
request.getSession().setAttribute("serverResponse","Error trying to view the Access.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"darkorange\",\"response\":\"Error trying to view the Access.\"}");
|
||||||
response.sendRedirect("/access");
|
response.sendRedirect("/access");
|
||||||
|
|
||||||
} catch (NullPointerException e){
|
} catch (NullPointerException e){
|
||||||
|
@ -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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource created successfully.\"}");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "redirect":
|
case "redirect":
|
||||||
@ -54,7 +54,7 @@ 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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource updated successfully.\"}");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -25,7 +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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Resource deleted successfully.\"}");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -47,7 +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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role created successfully.\"}");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -67,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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role updated successfully.\"}");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -22,7 +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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Role deleted successfully.\"}");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
Service service = new Service (name, price, description,userCreatorKey);
|
Service service = new Service (name, price, description,userCreatorKey);
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","Service created successfully.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service created successfully.\"}");
|
||||||
|
|
||||||
pm.makePersistent(service);
|
pm.makePersistent(service);
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","Service updated successfully.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service updated successfully.\"}");
|
||||||
|
|
||||||
} else if (action.equals("redirect")){
|
} else if (action.equals("redirect")){
|
||||||
|
|
||||||
@ -85,7 +85,7 @@ public class ServicesControllerAdd extends HttpServlet {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to create/update a Service.\"}");
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -32,7 +32,7 @@ public class ServicesControllerDelete extends HttpServlet {
|
|||||||
|
|
||||||
pm.deletePersistent(service);
|
pm.deletePersistent(service);
|
||||||
|
|
||||||
request.getSession().setAttribute("serverResponse","Service deleted successfully.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service deleted successfully.\"}");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
@ -42,7 +42,7 @@ public class ServicesControllerDelete extends HttpServlet {
|
|||||||
response.sendRedirect("/services");
|
response.sendRedirect("/services");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to delete a Service.\"}");
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public class ServicesControllerIndex extends HttpServlet {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to access /services.\"}");
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ public class ServicesControllerView extends HttpServlet {
|
|||||||
pm.close();
|
pm.close();
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
request.getSession().setAttribute("serverResponse","You do not have the rights to access.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"red\",\"response\":\"You don\\'t have permission to view/edit a Service.\"}");
|
||||||
response.sendRedirect("/users");
|
response.sendRedirect("/users");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
misesion.setMaxInactiveInterval(3600);
|
misesion.setMaxInactiveInterval(3600);
|
||||||
}
|
}
|
||||||
|
|
||||||
serverResponse = "You are logged-in";
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"You are logged in.\"}";
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -97,7 +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.";
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"User created successfully.\"}";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//Si lo que se quiere es actualizar un Usuario
|
//Si lo que se quiere es actualizar un Usuario
|
||||||
@ -110,7 +110,7 @@ public class UsersControllerAdd extends HttpServlet {
|
|||||||
user.setImgUrl(userImg);
|
user.setImgUrl(userImg);
|
||||||
user.setRoleKey(userRole);
|
user.setRoleKey(userRole);
|
||||||
|
|
||||||
serverResponse = "User Updated successfully.";
|
serverResponse = "{\"color\": \"#26a69a\",\"response\":\"Service updated successfully.\"}";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ 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.");
|
request.getSession().setAttribute("serverResponse","{\"color\": \"#26a69a\",\"response\":\"Service deleted sucessfully.\"}");
|
||||||
} catch (JDOObjectNotFoundException e){
|
} catch (JDOObjectNotFoundException e){
|
||||||
System.err.println("Exception catched -> " + e.getMessage());
|
System.err.println("Exception catched -> " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
@ -101,10 +101,8 @@
|
|||||||
<div style="float: left; display: inline;">
|
<div style="float: left; display: inline;">
|
||||||
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: x-large; clear: right">
|
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
||||||
The admin Role has full access by default.<br />
|
The admin Role has full access by default.
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
@ -102,7 +102,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var respDiv = document.getElementById("serverResponse");
|
var respDiv = document.getElementById("serverResponse");
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
|
||||||
|
var responseData = JSON.parse('<%=serverResponse%>');
|
||||||
|
|
||||||
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
@ -118,10 +123,8 @@
|
|||||||
<div style="float: left; display: inline;">
|
<div style="float: left; display: inline;">
|
||||||
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
<i class="material-icons large" style=" color: #67c9b3">info_outline</i>
|
||||||
</div>
|
</div>
|
||||||
<div style="font-size: x-large; clear: right">
|
<div style="font-size: x-large; clear: right; min-height: 87px;">
|
||||||
The admin Role has full access by default.<br />
|
The admin Role has full access by default.
|
||||||
<br />
|
|
||||||
<br />
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
|
@ -107,11 +107,17 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var respDiv = document.getElementById("serverResponse");
|
var respDiv = document.getElementById("serverResponse");
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
|
||||||
|
var responseData = JSON.parse('<%=serverResponse%>');
|
||||||
|
|
||||||
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
},1500);
|
},1500);
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<% } %>
|
<% } %>
|
||||||
|
@ -74,8 +74,6 @@
|
|||||||
<li>|</li>
|
<li>|</li>
|
||||||
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
<li><a class="whiteLink" onclick="postRedirect('../services')">Services</a></li>
|
||||||
<li>|</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 class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">Show Services</div>
|
||||||
|
@ -105,7 +105,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var respDiv = document.getElementById("serverResponse");
|
var respDiv = document.getElementById("serverResponse");
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
|
||||||
|
var responseData = JSON.parse('<%=serverResponse%>');
|
||||||
|
|
||||||
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
|
@ -76,6 +76,8 @@
|
|||||||
<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><a class="whiteLink" onclick="postRedirect('../access')">Access</a></li>
|
||||||
<li>|</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()">
|
<div class="dropdown hide-on-large-only" style="padding: 0 10px; font-weight: bold" onclick="toggleDropdown()">
|
||||||
|
@ -106,7 +106,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var respDiv = document.getElementById("serverResponse");
|
var respDiv = document.getElementById("serverResponse");
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
|
||||||
|
var responseData = JSON.parse('<%=serverResponse%>');
|
||||||
|
|
||||||
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
|
@ -105,7 +105,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<script>
|
<script>
|
||||||
var respDiv = document.getElementById("serverResponse");
|
var respDiv = document.getElementById("serverResponse");
|
||||||
respDiv.innerHTML = "<div style=\"margin: 10px\"><%= serverResponse %></div>";
|
|
||||||
|
var responseData = JSON.parse('<%=serverResponse%>');
|
||||||
|
|
||||||
|
respDiv.style.backgroundColor = responseData["color"];
|
||||||
|
respDiv.innerHTML = "<div style=\"margin: 10px\">" + responseData["response"] + "</div>";
|
||||||
|
|
||||||
respDiv.style.maxHeight = "500px";
|
respDiv.style.maxHeight = "500px";
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
respDiv.style.maxHeight = "0";
|
respDiv.style.maxHeight = "0";
|
||||||
|
Loading…
Reference in New Issue
Block a user