Commit 9a6a7e75 by Percy Quispe

Add

parent c00e6358
...@@ -78,14 +78,14 @@ public class RequestFilter implements Filter, ServletContextListener { ...@@ -78,14 +78,14 @@ public class RequestFilter implements Filter, ServletContextListener {
if (valid.getBoolean("status")) { if (valid.getBoolean("status")) {
JSONObject menu=new JSONObject(valid.getString("menu"));//Obtiene el menu JSONObject menu=new JSONObject(valid.getString("menu"));//Obtiene el menu
JSONArray views = new JSONArray(menu.get("vistas").toString());//Obtiene las vistas disponibles del usuario JSONArray views = new JSONArray(menu.get("vistas").toString());//Obtiene las vistas disponibles del usuario
List<Object> salida=views.toList(); List<Object> vistas=views.toList();
String ruta = request.getRequestURI(); String ruta = request.getRequestURI();
int indice = GeneralUtils.obtenerIndex(ruta); int indice = GeneralUtils.obtenerIndex(ruta);
String rutaJsp = ruta.substring(indice, ruta.length()); String rutaJsp = ruta.substring(indice, ruta.length());
if(url.contains(".jsp")){ if(url.contains(".jsp")){
boolean acceso = false; boolean acceso = false;
for(Object vista :views){ for(Object vista :vistas){
System.out.println("Vista : "+vista +"rutaJSP : "+rutaJsp); System.out.println("Vista : "+vista +" rutaJSP : "+rutaJsp);
if(vista.toString().equalsIgnoreCase(rutaJsp)){ if(vista.toString().equalsIgnoreCase(rutaJsp)){
acceso=true; acceso=true;
break; break;
......
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package demojsoncrud.utilities;
import java.util.List;
public final class VistasExtras {
private static final String detalleMantenimientoPersona = "detalleMantenimientoPersona";
public static List<String> getVistasExtras(){
return null;
}
}
...@@ -103,7 +103,8 @@ const persona = { ...@@ -103,7 +103,8 @@ const persona = {
{targets: 3, orderable: false, width: '5%', className: 'centrado'}, {targets: 3, orderable: false, width: '5%', className: 'centrado'},
{targets: 4, orderable: false, width: '25%', className: 'centrado'}, {targets: 4, orderable: false, width: '25%', className: 'centrado'},
{targets: 5, orderable: false, width: '10%', className: 'centrado'}, {targets: 5, orderable: false, width: '10%', className: 'centrado'},
{targets: 6, orderable: false, width: '10%', className: 'centrado'} {targets: 6, orderable: false, width: '10%', className: 'centrado'},
{targets: 7, orderable: false, width: '5%', className: 'centrado'}
], ],
dom: '<"datatable-scroll"t><"datatable-footer"ip>', dom: '<"datatable-scroll"t><"datatable-footer"ip>',
fixedColumns: true, fixedColumns: true,
...@@ -152,6 +153,13 @@ const persona = { ...@@ -152,6 +153,13 @@ const persona = {
</li> </li>
</ul>` </ul>`
} }
},
{
data: 'null',
className: 'text-center',
render: function (data, type, row) {
return "<i class='icon-forward'></i>";
}
} }
], ],
'fnInitComplete': function (oSettings, json) { 'fnInitComplete': function (oSettings, json) {
......
...@@ -2,6 +2,9 @@ let getMenu = () => { ...@@ -2,6 +2,9 @@ let getMenu = () => {
return JSON.parse(Cookies.get('menu')); return JSON.parse(Cookies.get('menu'));
} }
let setMenu = () => { let setMenu = () => {
let location = window.location;
let position =getUrl(location.pathname);
let path = location.pathname.substring(position+1);//obtiene el nombre de la vista jsp para activar la clase .active
let menu = document.getElementById("MENU"); let menu = document.getElementById("MENU");
let contenido = getMenu(); let contenido = getMenu();
console.log(contenido) console.log(contenido)
...@@ -10,27 +13,35 @@ let setMenu = () => { ...@@ -10,27 +13,35 @@ let setMenu = () => {
let html = '<li class="navigation-header"><span><i class="icon-menu" title="Main pages"></i>' + titulo['nombre'] + '</span></li>'; let html = '<li class="navigation-header"><span><i class="icon-menu" title="Main pages"></i>' + titulo['nombre'] + '</span></li>';
for (let i in modulo){ for (let i in modulo){
let categoria = modulo[i]['categoria']; let categoria = modulo[i]['categoria'];
html+='<li>' html+='<li >'
+ '<a href="'+modulo[i]['url']+'">' + '<a href="'+modulo[i]['url']+'">'
+ '<i class="fa '+modulo[i]['ico']+' fa-lg"></i>' + '<i class="fa '+modulo[i]['ico']+' fa-lg"></i>'
+ '<span>'+modulo[i]['nombre']+'</span>' + '<span>'+modulo[i]['nombre']+'</span>'
+ '</a>'; + '</a>';
for(let j in categoria){ for(let j in categoria){
let subCategoria = modulo[i]['subCategoria']; let subCategoria = modulo[i]['subCategoria'];
console.log(window.location); html+= '<ul>';
html+= '<ul>' if(path === categoria[j]['url']){
+ '<li>'; html+= '<li class="active">';
}else{
html+= '<li>';
}
if(subCategoria===undefined){ if(subCategoria===undefined){
html+= '<a href="../vistas/'+categoria[j]['url']+'">'; html+= '<a class="addClass" id="'+categoria[j]['url']+'" href="../vistas/'+categoria[j]['url']+'">';
}else{ }else{
html+= '<a href="'+window.location+categoria[j]['url']+'">'; html+= '<a class="addClass" id="'+categoria[j]['url']+'" href="'+window.location+categoria[j]['url']+'">';
} }
html+= '<span>'+categoria[j]['nombre']+'</span>' html+= '<span>'+categoria[j]['nombre']+'</span>'
+ '</a>'; + '</a>';
if(subCategoria!==undefined){ if(subCategoria!==undefined){
for(let k in subCategoria){ for(let k in subCategoria){
html+='<ul class="hidden-ul" style="display: block;">'; html+='<ul class="hidden-ul" style="display: block;">';
+'<li><a href="'+subCategoria[k]['url']+'">'+subCategoria[k]['nombre']+'</a></li>' if(path === subCategoria[k]['url']){
html+= '<li class="active">';
}else{
html+= '<li>';
}
html+='<a href="'+subCategoria[k]['url']+'">'+subCategoria[k]['nombre']+'</a></li>'
+'</ul>'; +'</ul>';
} }
} }
...@@ -41,5 +52,22 @@ let setMenu = () => { ...@@ -41,5 +52,22 @@ let setMenu = () => {
} }
menu.innerHTML=html; menu.innerHTML=html;
} }
let getUrl = (pathname) => {
let position = 0;
for (let i = pathname.length-1; i > 0; i--) {
if(pathname[i]==='/'){
position = i;
break;
}
}
return position;
}
//let setClass = () =>{
// let location = window.location;
// let position =getUrl(location.pathname);
// let path = location.pathname.substring(position+1);
// debugger
// $("#"+path).addClass("test");
//}
setMenu(); setMenu();
//setClass();
<%--
Document : detalleMantenimientoPersona
Created on : 24/04/2018, 10:50:46 AM
Author : sistem08user
--%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>JSP Page</title>
</head>
<body>
<h1>Hello World!</h1>
</body>
</html>
...@@ -65,6 +65,7 @@ ...@@ -65,6 +65,7 @@
<th>CORREO ELECTRONICO</th> <th>CORREO ELECTRONICO</th>
<th>ESTADO</th> <th>ESTADO</th>
<th>ACCIONES</th> <th>ACCIONES</th>
<th>IR DETALLE</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
......
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