[EDIT] CAMBIOS PARA LA EDICION DE MENU Y PERMISOS POR VISTA

parent 72fb43bf
......@@ -8,91 +8,98 @@ package com.mycompany.moduloseguridad.dao;
import org.json.JSONArray;
import org.json.JSONObject;
import java.sql.SQLException;
/**
*
* @author sistem17user
*/
public interface MenuDAO {
public JSONArray listarProyecto(int estado) throws Exception;
JSONArray listarProyecto(int estado) throws Exception;
JSONArray listarTipoDeUsuario(int proyecto) throws Exception;
JSONArray listarTituloCompleto(int proyecto_detalle, int proyecto, int tipo) throws Exception;
JSONArray listarModuloCompleto(int titulo, int proyecto_detalle, int proyecto, int tipo) throws Exception;
public JSONArray listarTipoDeUsuario(int proyecto) throws Exception;
JSONArray listarCategoriaCompleto(int modulo, int proyecto_detalle, int proyecto, int tipo) throws Exception;
public JSONArray listarTituloCompleto(int proyecto_detalle, int proyecto, int tipo) throws Exception;
JSONArray listarSubCategoriaCompleto(int categoria, int proyecto_detalle, int proyecto, int tipo) throws Exception;
public JSONArray listarModuloCompleto(int titulo, int proyecto_detalle, int proyecto, int tipo) throws Exception;
JSONObject editarTitulo(JSONObject datos) throws Exception;
public JSONArray listarCategoriaCompleto(int modulo, int proyecto_detalle, int proyecto, int tipo) throws Exception;
JSONObject editarModulo(JSONObject datos) throws Exception;
public JSONArray listarSubCategoriaCompleto(int categoria, int proyecto_detalle, int proyecto, int tipo) throws Exception;
JSONObject editarCategoria(JSONObject datos) throws Exception;
public JSONObject editarTitulo(JSONObject datos) throws Exception;
JSONObject editarSubCategoria(JSONObject datos) throws Exception;
public JSONObject editarModulo(JSONObject datos) throws Exception;
JSONObject nuevoTitulo(JSONObject datos) throws Exception;
public JSONObject editarCategoria(JSONObject datos) throws Exception;
JSONObject nuevoModulo(JSONObject datos) throws Exception;
public JSONObject editarSubCategoria(JSONObject datos) throws Exception;
JSONObject nuevoCategoria(JSONObject datos) throws Exception;
public JSONObject nuevoTitulo(JSONObject datos) throws Exception;
JSONObject nuevoSubCategoria(JSONObject datos) throws Exception;
public JSONObject nuevoModulo(JSONObject datos) throws Exception;
JSONObject eliminarDetalleTitulo(JSONObject datos) throws Exception;
public JSONObject nuevoCategoria(JSONObject datos) throws Exception;
JSONObject eliminarDetalleModulo(JSONObject datos) throws Exception;
public JSONObject nuevoSubCategoria(JSONObject datos) throws Exception;
JSONObject eliminarDetalleCategoria(JSONObject datos) throws Exception;
public JSONObject eliminarDetalleTitulo(JSONObject datos) throws Exception;
JSONObject eliminarDetalleSubCategoria(JSONObject datos) throws Exception;
public JSONObject eliminarDetalleModulo(JSONObject datos) throws Exception;
JSONObject cambiarOrdenTitulo(JSONObject datos) throws Exception;
public JSONObject eliminarDetalleCategoria(JSONObject datos) throws Exception;
JSONObject cambiarOrdenModulo(JSONObject datos) throws Exception;
public JSONObject eliminarDetalleSubCategoria(JSONObject datos) throws Exception;
JSONObject cambiarOrdenCategoria(JSONObject datos) throws Exception;
public JSONObject cambiarOrdenTitulo(JSONObject datos) throws Exception;
JSONObject cambiarOrdenSubCategoria(JSONObject datos) throws Exception;
public JSONObject cambiarOrdenModulo(JSONObject datos) throws Exception;
JSONObject reconocerNombreSimilar(JSONObject datos) throws Exception;
public JSONObject cambiarOrdenCategoria(JSONObject datos) throws Exception;
JSONObject nuevoTituloExistente(JSONObject datos) throws Exception;
public JSONObject cambiarOrdenSubCategoria(JSONObject datos) throws Exception;
JSONObject nuevoModuloExistente(JSONObject datos) throws Exception;
public JSONObject reconocerNombreSimilar(JSONObject datos) throws Exception;
JSONObject nuevoCategoriaExistente(JSONObject datos) throws Exception;
public JSONObject nuevoTituloExistente(JSONObject datos) throws Exception;
JSONObject nuevoSubCategoriaExistente(JSONObject datos) throws Exception;
public JSONObject nuevoModuloExistente(JSONObject datos) throws Exception;
JSONObject validarEdicionTitulo(JSONObject datos) throws Exception;
public JSONObject nuevoCategoriaExistente(JSONObject datos) throws Exception;
JSONObject validarEdicionModulo(JSONObject datos) throws Exception;
public JSONObject nuevoSubCategoriaExistente(JSONObject datos) throws Exception;
JSONObject validarEdicionCategoria(JSONObject datos) throws Exception;
public JSONObject validarEdicionTitulo(JSONObject datos) throws Exception;
JSONObject validarEdicionSubCategoria(JSONObject datos) throws Exception;
public JSONObject validarEdicionModulo(JSONObject datos) throws Exception;
JSONObject listarTitulo(JSONObject datos, String draw, String start, String length) throws Exception;
public JSONObject validarEdicionCategoria(JSONObject datos) throws Exception;
JSONObject listarModulo(JSONObject datos, String draw, String start, String length) throws Exception;
public JSONObject validarEdicionSubCategoria(JSONObject datos) throws Exception;
JSONObject listarCategoria(JSONObject datos, String draw, String start, String length) throws Exception;
public JSONObject listarTitulo(JSONObject datos, String draw, String start, String length) throws Exception;
JSONObject listarSubCategoria(JSONObject datos, String draw, String start, String length) throws Exception;
public JSONObject listarModulo(JSONObject datos, String draw, String start, String length) throws Exception;
JSONObject validarElminarTitulo(JSONObject datos) throws Exception;
public JSONObject listarCategoria(JSONObject datos, String draw, String start, String length) throws Exception;
JSONObject validarElminarModulo(JSONObject datos) throws Exception;
public JSONObject listarSubCategoria(JSONObject datos, String draw, String start, String length) throws Exception;
JSONObject validarElminarCategoria(JSONObject datos) throws Exception;
public JSONObject validarElminarTitulo(JSONObject datos) throws Exception;
JSONObject validarElminarSubCategoria(JSONObject datos) throws Exception;
public JSONObject validarElminarModulo(JSONObject datos) throws Exception;
JSONObject eliminarMenusAninado(JSONObject datos) throws Exception;
public JSONObject validarElminarCategoria(JSONObject datos) throws Exception;
JSONObject eliminarMenusAninadoGeneral(JSONObject datos) throws Exception;
public JSONObject validarElminarSubCategoria(JSONObject datos) throws Exception;
JSONArray obtenerAcciones(int codigo, int jerarquia, int tipo_usuario) throws Exception;
public JSONObject eliminarMenusAninado(JSONObject datos) throws Exception;
JSONObject listarPermisosPorVista(JSONObject datos) throws Exception;
public JSONObject eliminarMenusAninadoGeneral(JSONObject datos) throws Exception;
JSONObject asignarAccionesPorVista(JSONObject json) throws SQLException;
}
\ No newline at end of file
......@@ -429,4 +429,33 @@ public class MenuService {
return obj;
}
public JSONObject listarPermisosPorVista(JSONObject datos) {
JSONObject obj = null;
try {
obj = dao.listarPermisosPorVista(datos);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONArray obtenerAcciones(int codigo, int jerarquia, int tipo_usuario) {
JSONArray obj = null;
try {
obj = dao.obtenerAcciones(codigo,jerarquia,tipo_usuario);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
public JSONObject asignarAccionesPorVista(JSONObject json) {
JSONObject obj = null;
try {
obj = dao.asignarAccionesPorVista(json);
} catch (Exception e) {
e.printStackTrace();
}
return obj;
}
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ package com.mycompany.moduloseguridad.servlets;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Objects;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
......@@ -65,10 +66,16 @@ public class MantenimientoMenuServlet extends HttpServlet {
case "eliminarMenusAninado":
eliminarMenusAninado(request, response);
break;
case "listarPermisosPorVista":
listarPermisosPorVista(request, response);
break;
case "asignarAccionesPorVista":
asignarAccionesPorVista(request, response);
break;
default:
break;
}
}
}
private void listarProyecto(HttpServletRequest request, HttpServletResponse response) throws IOException {
......@@ -84,7 +91,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
MenuService srv = new MenuService();
int codigo = Integer.parseInt(request.getParameter("codigo"));
int codigo = Integer.parseInt(Objects.equals(request.getParameter("codigo"), "") ? "0" : request.getParameter("codigo"));
JSONArray rs = srv.listarTipoDeUsuario(codigo);
out.println(rs);
}
......@@ -129,8 +136,7 @@ public class MantenimientoMenuServlet extends HttpServlet {
int iCategoria = 0;
JSONObject obj2 = new JSONObject();
JSONObject objModulo = (JSONObject) listaModulo.get(j);
System.out.println("objModulo "+i + " - "+j+" : "+ objModulo);
boolean esVisible = objModulo.getBoolean("esVisible");
boolean esVisible1 = objModulo.getBoolean("esVisible");
String nombreModulo = objModulo.getString("nombreModulo");
int codigoModulo = objModulo.getInt("codigoModulo");
int configuracionModulo = objModulo.getInt("configuracionModulo");
......@@ -150,14 +156,32 @@ public class MantenimientoMenuServlet extends HttpServlet {
obj2.put("configuracion", configuracionModulo);
obj2.put("padre", padreModulo);
obj2.put("orden", ordenModulo);
obj2.put("esVisible", esVisible);
obj2.put("esVisible", esVisible1);
lista.put(obj2);
JSONArray listarModuloAcc = srv.obtenerAcciones(codigoModulo, 2,proyecto_detalle);
for(int modacc = 0; modacc < listarModuloAcc.length(); modacc++) {
JSONObject objModuloAcc = (JSONObject) listarModuloAcc.get(modacc);
JSONObject objModuloAcc2 = new JSONObject();
objModuloAcc2.put("conta", modacc + 1);
objModuloAcc2.put("jerarquia", 5);
objModuloAcc2.put("nombre", objModuloAcc.getString("nom_accion"));
objModuloAcc2.put("codigo", objModuloAcc.getInt("cod_accion"));
objModuloAcc2.put("icono", "");
objModuloAcc2.put("url", "");
objModuloAcc2.put("tipo", 3);
objModuloAcc2.put("configuracion", 0);
objModuloAcc2.put("padre", codigoModulo);
objModuloAcc2.put("orden", 0);
// objModuloAcc2.put("esVisible", true);
lista.put(objModuloAcc2);
}
JSONArray listaCategoria = srv.listarCategoriaCompleto(codigoModulo, proyecto_detalle, proyecto, tipo);
for (int k = 0; k < listaCategoria.length(); k++) {
int iSubCategoria = 0;
JSONObject obj3 = new JSONObject();
JSONObject objCategoria = (JSONObject) listaCategoria.get(k);
String nombreCategoria = objCategoria.getString("nombreCategoria");
boolean esVisible2 = objModulo.getBoolean("esVisible");
int codigoCategoria = objCategoria.getInt("codigoCategoria");
int configuracionCategoria = objCategoria.getInt("configuracionCategoria");
String urlCategoria = objCategoria.getString("urlCategoria");
......@@ -175,12 +199,30 @@ public class MantenimientoMenuServlet extends HttpServlet {
obj3.put("configuracion", configuracionCategoria);
obj3.put("padre", padreCategoria);
obj3.put("orden", ordenCategoria);
obj3.put("esVisible", esVisible2);
lista.put(obj3);
JSONArray listarCategoriaAcc = srv.obtenerAcciones(codigoCategoria, 3,proyecto_detalle);
for(int catacc = 0; catacc < listarCategoriaAcc.length(); catacc++) {
JSONObject objCategoriaAcc = (JSONObject) listarCategoriaAcc.get(catacc);
JSONObject objCategoriaAcc2 = new JSONObject();
objCategoriaAcc2.put("conta", catacc + 1);
objCategoriaAcc2.put("jerarquia", 6);
objCategoriaAcc2.put("nombre", objCategoriaAcc.getString("nom_accion"));
objCategoriaAcc2.put("codigo", objCategoriaAcc.getInt("cod_accion"));
objCategoriaAcc2.put("icono", "");
objCategoriaAcc2.put("url", "");
objCategoriaAcc2.put("tipo", 3);
objCategoriaAcc2.put("configuracion", 0);
objCategoriaAcc2.put("padre", codigoCategoria);
objCategoriaAcc2.put("orden", 0);
lista.put(objCategoriaAcc2);
}
JSONArray listaSubCategoria = srv.listarSubCategoriaCompleto(codigoCategoria, proyecto_detalle, proyecto, tipo);
for (int l = 0; l < listaSubCategoria.length(); l++) {
JSONObject obj4 = new JSONObject();
JSONObject objSubCategoria = (JSONObject) listaSubCategoria.get(l);
String nombreSubCategoria = objSubCategoria.getString("nombreSubCategoria");
boolean esVisible3 = objSubCategoria.getBoolean("esVisible");
int codigoSubCategoria = objSubCategoria.getInt("codigoSubCategoria");
int configuracionSubCategoria = objSubCategoria.getInt("configuracionSubCategoria");
String urlSubCategoria = objSubCategoria.getString("urlSubCategoria");
......@@ -197,7 +239,24 @@ public class MantenimientoMenuServlet extends HttpServlet {
obj4.put("configuracion", configuracionSubCategoria);
obj4.put("padre", padreSubCategoria);
obj4.put("orden", ordenSubCategoria);
obj4.put("esVisible", esVisible3);
lista.put(obj4);
JSONArray listarSubAcc = srv.obtenerAcciones(codigoSubCategoria, 4,proyecto_detalle);
for(int subacc = 0; subacc < listarSubAcc.length(); subacc++) {
JSONObject objSubAcc = (JSONObject) listarSubAcc.get(subacc);
JSONObject objSubAcc2 = new JSONObject();
objSubAcc2.put("conta", subacc + 1);
objSubAcc2.put("jerarquia", 7);
objSubAcc2.put("nombre", objSubAcc.getString("nom_accion"));
objSubAcc2.put("codigo", objSubAcc.getInt("cod_accion"));
objSubAcc2.put("icono", "");
objSubAcc2.put("url", "");
objSubAcc2.put("tipo", 3);
objSubAcc2.put("configuracion", 0);
objSubAcc2.put("padre", codigoSubCategoria);
objSubAcc2.put("orden", 0);
lista.put(objSubAcc2);
}
}
}
}
......@@ -449,4 +508,42 @@ public class MantenimientoMenuServlet extends HttpServlet {
out.print(rs);
}
private void listarPermisosPorVista(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
MenuService srv = new MenuService();
JSONObject rs;
int codigo = Integer.parseInt(request.getParameter("codigo"));
int jerarquia = Integer.parseInt(request.getParameter("jerarquia"));
JSONObject json = new JSONObject().put("codigo", codigo).put("jerarquia", jerarquia);
rs = srv.listarPermisosPorVista(json);
out.print(rs);
}
public void asignarAccionesPorVista(HttpServletRequest request, HttpServletResponse response) throws IOException {
response.setContentType("application/json");
PrintWriter out = response.getWriter();
MenuService srv = new MenuService();
JSONObject rs;
int tipo_accion = Integer.parseInt( request.getParameter("tipo_accion"));
int v_cod_accion = Integer.parseInt( request.getParameter("v_cod_accion"));
String v_nom_accion = request.getParameter("v_nom_accion");
int v_jerarquia = Integer.parseInt( request.getParameter("v_jerarquia"));
int v_cod_proyecto = Integer.parseInt( request.getParameter("v_cod_proyecto"));
int v_cod_vista = Integer.parseInt( request.getParameter("v_cod_vista"));
int v_cod_vista_acc = Integer.parseInt( request.getParameter("v_cod_vista_acc"));
int v_tipo_usuario = Integer.parseInt(request.getParameter("v_tipo_usuario"));
JSONObject json = new JSONObject()
.put("tipo_accion", tipo_accion)
.put("v_cod_accion", v_cod_accion)
.put("v_nom_accion", v_nom_accion)
.put("v_jerarquia", v_jerarquia)
.put("v_cod_proyecto", v_cod_proyecto)
.put("v_cod_vista", v_cod_vista)
.put("v_cod_vista_acc", v_cod_vista_acc)
.put("v_tipo_usuario", v_tipo_usuario);
rs = srv.asignarAccionesPorVista(json);
out.print(rs);
}
}
\ No newline at end of file
......@@ -312,6 +312,10 @@ table.display tbody tr:hover td {
padding-left: 15vw;
}
.supercategoria{
padding-left: 20vw;
}
.modal-header[class*=bg-] {
padding: 10px 15px;
}
......
......@@ -29,7 +29,7 @@
"infoEmpty": "&nbsp;&nbsp;&nbsp; Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"processing": '<span style="width:100%;"><img src="https://upload.wikimedia.org/wikipedia/commons/7/7a/Ajax_loader_metal_512.gif?20180219130538"></span>',
"scrollY": false,
"paginate": {
"first": "First",
......@@ -683,7 +683,7 @@
"infoEmpty": "&nbsp;&nbsp;&nbsp; Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"processing": '<span style="width:100%;"><img src="https://upload.wikimedia.org/wikipedia/commons/7/7a/Ajax_loader_metal_512.gif?20180219130538"></span>',
"scrollY": false,
"paginate": {
"first": "First",
......
......@@ -61,7 +61,7 @@
"infoEmpty": "&nbsp;&nbsp;&nbsp; Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"processing": '<span style="width:100%;"><img src="https://upload.wikimedia.org/wikipedia/commons/7/7a/Ajax_loader_metal_512.gif?20180219130538"></span>',
"scrollY": false,
"paginate": {
"first": "First",
......@@ -260,7 +260,7 @@
"infoEmpty": "&nbsp;&nbsp;&nbsp; Mostrando 0 de 0 registros",
"search": "Filtrar:",
"loadingRecords": "Cargando...",
"processing": '<span style="width:100%;"><img src="http://www.snacklocal.com/images/ajaxload.gif"></span>',
"processing": '<span style="width:100%;"><img src="https://upload.wikimedia.org/wikipedia/commons/7/7a/Ajax_loader_metal_512.gif?20180219130538"></span>',
"scrollY": false,
"paginate": {
"first": "First",
......@@ -980,9 +980,7 @@
}
}
});
listadoAcciones.init(function () {
//cargar el combo de acciones
listarCboAcciones();
});
}
......
......@@ -45,8 +45,11 @@
<div class="translucentMe card-3"></div>
<div class="contentMe">
<div class="text-center">
<div class="icon-object border-white text-white"><img src="../img/securityIconWhite.png" alt="" style="width: 85px; height: 85px;"></div>
<h5 class="content-group text-white">MÓDULO DE SEGURIDAD<small class="display-block" style="color: white">LOGIN</small></h5>
<div class="icon-object border-white text-white">
<img src="../img/securityIconBlack.png" alt="" style="width: 85px; height: 85px;filter: brightness(1000)"></div>
<h5 class="content-group text-white">MÓDULO DE SEGURIDAD
<small class="display-block" style="color: white">LOGIN</small>
</h5>
</div>
<div class="form-group has-feedback has-feedback-left">
......@@ -125,4 +128,4 @@
})(window);
</script>
</body>
</html>
</html>
\ No newline at end of file
......@@ -8,6 +8,7 @@
<!DOCTYPE html>
<html lang="en">
<head>
<link href="../css/lib/jquery-editable-select.min.css" rel="stylesheet" type="text/css"/>
<%@include file="templates/header.jsp" %>
<!--template-core-->
......@@ -122,7 +123,7 @@
<div>
No visibles :
</div>
<div style="background: #ffeaea; width: 1rem; height: 1rem; border: 1px solid black; display: block"></div>
<div style="background: #e0f8ff; width: 1.5rem; height: 1.5rem; border: 1px solid black; display: block"></div>
</div>
</div>
<div class="form-group">
......@@ -170,7 +171,7 @@
</div>
<%@include file="templates/footer-body.jsp" %>
<script src="../js/lib/jquery-editable-select.min.js" type="text/javascript"></script>
<script src="../js/pages/MantenimientoMenu.js" type="text/javascript"></script>
<script>
let switchery = new Switchery(document.querySelector('#cbkEstado'), {color: 'red', secondaryColor: 'green'})
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment