Commit 9a6a7e75 by Percy Quispe

Add

parent c00e6358
......@@ -78,14 +78,14 @@ public class RequestFilter implements Filter, ServletContextListener {
if (valid.getBoolean("status")) {
JSONObject menu=new JSONObject(valid.getString("menu"));//Obtiene el menu
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();
int indice = GeneralUtils.obtenerIndex(ruta);
String rutaJsp = ruta.substring(indice, ruta.length());
if(url.contains(".jsp")){
boolean acceso = false;
for(Object vista :views){
System.out.println("Vista : "+vista +"rutaJSP : "+rutaJsp);
for(Object vista :vistas){
System.out.println("Vista : "+vista +" rutaJSP : "+rutaJsp);
if(vista.toString().equalsIgnoreCase(rutaJsp)){
acceso=true;
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 = {
{targets: 3, orderable: false, width: '5%', className: 'centrado'},
{targets: 4, orderable: false, width: '25%', 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>',
fixedColumns: true,
......@@ -152,6 +153,13 @@ const persona = {
</li>
</ul>`
}
},
{
data: 'null',
className: 'text-center',
render: function (data, type, row) {
return "<i class='icon-forward'></i>";
}
}
],
'fnInitComplete': function (oSettings, json) {
......
......@@ -2,6 +2,9 @@ let getMenu = () => {
return JSON.parse(Cookies.get('menu'));
}
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 contenido = getMenu();
console.log(contenido)
......@@ -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>';
for (let i in modulo){
let categoria = modulo[i]['categoria'];
html+='<li>'
html+='<li >'
+ '<a href="'+modulo[i]['url']+'">'
+ '<i class="fa '+modulo[i]['ico']+' fa-lg"></i>'
+ '<span>'+modulo[i]['nombre']+'</span>'
+ '</a>';
for(let j in categoria){
let subCategoria = modulo[i]['subCategoria'];
console.log(window.location);
html+= '<ul>'
+ '<li>';
html+= '<ul>';
if(path === categoria[j]['url']){
html+= '<li class="active">';
}else{
html+= '<li>';
}
if(subCategoria===undefined){
html+= '<a href="../vistas/'+categoria[j]['url']+'">';
html+= '<a class="addClass" id="'+categoria[j]['url']+'" href="../vistas/'+categoria[j]['url']+'">';
}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>'
+ '</a>';
if(subCategoria!==undefined){
for(let k in subCategoria){
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>';
}
}
......@@ -41,5 +52,22 @@ let setMenu = () => {
}
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();
//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 @@
<th>CORREO ELECTRONICO</th>
<th>ESTADO</th>
<th>ACCIONES</th>
<th>IR DETALLE</th>
</tr>
</thead>
<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