var CurrentUrl="",SiteUrl="",queryLimit=4E3;$(document).ready(function(){null!=document.getElementById("NavegacionPQ")&&setNavigationNodes()});function setNavigationNodes(){SiteUrl=_spPageContextInfo.webAbsoluteUrl;var a=getModulesNode();PaintMainNodes(a);$("#NavegacionAuxiliarPQ").prop("style","position:absolute");-1==document.location.href.indexOf("NewForm.aspx")&&-1==document.location.href.indexOf("EditForm.aspx")&&-1==document.location.href.indexOf("DispForm.aspx")&&PaintIconos()} function PaintMainNodes(a){$("#NavegacionPrincipalPQ").prop("style","display:flex;");for(var b=0;b "+$(a[b]).attr("Titulo")+"")} function SetNavegacion(a){$("#NavegacionPQ").empty();$("#NavegacionAuxiliarPQ1").empty();$("#NavegacionAuxiliarPQ2").empty();var b=[];a=""+a+"";$().SPServices({operation:"GetListItems",async:!1,listName:"NavegacionNodos",CAMLViewFields:"", CAMLQuery:a,completefunc:function(a,e){b=[];$(a.responseXML).SPFilterNode("z:row").each(function(){var a={URL:$(this).attr("ows_Link"),Image:$(this).attr("ows_Imagen"),Titulo:$(this).attr("ows_Title"),Tipo:""==$(this).attr("ows_TipoNodo")||void 0==$(this).attr("ows_TipoNodo")?"":$(this).attr("ows_TipoNodo"),Modulo:$(this).attr("ows_Modulo"),Hijo:""==$(this).attr("ows_ModuloHijo")||void 0==$(this).attr("ows_ModuloHijo")?"":$(this).attr("ows_ModuloHijo"),NombreCorto:""==$(this).attr("ows_NombreCorto")|| void 0==$(this).attr("ows_NombreCorto")?"":$(this).attr("ows_NombreCorto")};b.push(a)})}});PaintNodes(b,"NavegacionPQ")} function SetNavegacionAuxiliar(a,b){if(""!=a){2!=b&&$("#NavegacionAuxiliarPQ1").empty();$("#NavegacionAuxiliarPQ2").empty();var c=[],e=""+a+"";$().SPServices({operation:"GetListItems",async:!1,listName:"NavegacionNodos",CAMLViewFields:"",CAMLQuery:e, completefunc:function(a,b){c=[];$(a.responseXML).SPFilterNode("z:row").each(function(){var a={URL:$(this).attr("ows_Link"),Image:$(this).attr("ows_Imagen"),Titulo:$(this).attr("ows_Title"),Tipo:""==$(this).attr("ows_TipoNodo")||void 0==$(this).attr("ows_TipoNodo")?"":$(this).attr("ows_TipoNodo"),Modulo:$(this).attr("ows_Modulo"),Hijo:""==$(this).attr("ows_ModuloHijo")||void 0==$(this).attr("ows_ModuloHijo")?"":$(this).attr("ows_ModuloHijo"),NombreCorto:""==$(this).attr("ows_NombreCorto")||void 0== $(this).attr("ows_NombreCorto")?"":$(this).attr("ows_NombreCorto")};c.push(a)})}});PaintNodes(c,"NavegacionAuxiliarPQ"+b)}} function PaintNodes(a,b){for(var c=0;c ");$("#NavegacionPQIconos").css("margin-top","7em");break;case "NavegacionAuxiliarPQ2":0== c&&($("#"+b).append(""),$("#"+b).append("")),$("#NavegacionPQIconos").css("margin-top","9em")}$("#"+b).prop("style","display:flex");var d="";""==$(a[c]).attr("NombreCorto")?d=$(a[c]).attr("Titulo"):d=$(a[c]).attr("NombreCorto");var f='"'+SiteUrl+$(a[c]).attr("URL")+'"';0==c?(e="onclick='window.location= "+f+"'",$("#"+b).append("")):(""==$(a[c]).attr("Hijo")&&(e="onclick='window.location="+f+"'"),$("#"+b).append(""))}disableNavButtons()} function getModulesNode(){var a=[];$().SPServices({operation:"GetListItems",async:!1,listName:"NavegacionNodos",CAMLViewFields:"",CAMLQuery:"1",completefunc:function(b,c){$(b.responseXML).SPFilterNode("z:row").each(function(){var b= {URL:$(this).attr("ows_Link"),Titulo:$(this).attr("ows_Title"),Modulo:$(this).attr("ows_Modulo"),Tipo:""==$(this).attr("ows_TipoNodo")||void 0==$(this).attr("ows_TipoNodo")?"":$(this).attr("ows_TipoNodo")};a.push(b)})}});console.log("Nodos: "+a);return a} function PaintIconos(){$("#ContentArea").prop("style","margin:15px auto 40px");if(-1");else if("Enlace"==a[b].Tipo||""==a[b].Tipo)$(a[b]).attr("URL")==decodeURI(CurrentUrl.split(SiteUrl)[1])?$("#NavegacionPQIconos").append(""): $("#NavegacionPQIconos").append("");else if("Calendario"==a[b].Tipo){var c=GetCalendarURL(a[b]);$("#NavegacionPQIconos").append("")}disableNavButtons()} function getNavigationNodes(a){var b="",c="GetListItems",e="NavegacionNodos",d="";a=""+decodeURI(a)+"0";$().SPServices({operation:c,async:!1,listName:e,CAMLViewFields:d,CAMLQuery:a,completefunc:function(a,c){$(a.responseXML).SPFilterNode("z:row").each(function(){b=$(this).attr("ows_Modulo"); console.log("Modulo: "+b)})}});var f=[],c="GetListItems",e="NavegacionNodos",d="";a=""+b+"";$().SPServices({operation:c,async:!1,listName:e,CAMLViewFields:d,CAMLQuery:a,completefunc:function(a,b){f=[];$(a.responseXML).SPFilterNode("z:row").each(function(){var a= {URL:$(this).attr("ows_Link"),Image:$(this).attr("ows_Imagen"),Titulo:$(this).attr("ows_Title"),Tipo:""==$(this).attr("ows_TipoNodo")||void 0==$(this).attr("ows_TipoNodo")?"":$(this).attr("ows_TipoNodo")};f.push(a)})}});return f} function GetCalendarURL(a){var b=_spPageContextInfo.webAbsoluteUrl;a=a.URL;var c="",e=_spPageContextInfo.webTitle,d="",d="GUIDS",f=""+a+"";$().SPServices({operation:"GetListItems",async:!1,listName:d,CAMLRowLimit:queryLimit,CAMLViewFields:"",CAMLQuery:f,completefunc:function(a,b){$(a.responseXML).SPFilterNode("z:row").each(function(){c= $(this).attr("ows_Clave");d=$(this).attr("ows_Title")})}});return"stssync://sts/?ver=1.1&type=calendar&cmd=add-folder&base-url="+encodeURIComponent(b)+"&list-url="+encodeURIComponent(a)+"&guid="+encodeURIComponent("{"+c+"}")+"&site-name="+encodeURIComponent(e)+"&list-name="+encodeURIComponent(d)} function disableNavButtons(){var a=$('[class*="navigationReplace"]'),b=_spPageContextInfo.webAbsoluteUrl;if(0"+b+"";$().SPServices({operation:"GetListItems",async:!1,listName:"GUIDS",CAMLRowLimit:queryLimit,CAMLViewFields:"",CAMLQuery:c,completefunc:function(c,d){$(c.responseXML).SPFilterNode("z:row").each(function(){var b= {ID:parseInt($(this).attr("ows_ID")),Title:void 0!=$(this).attr("ows_Title")?$(this).attr("ows_Title"):"",Clave:void 0!=$(this).attr("ows_Clave")?$(this).attr("ows_Clave"):"",RelativeURL:void 0!=$(this).attr("ows_RelativeURL")?$(this).attr("ows_RelativeURL"):""};a.push(b)});$(c.responseXML).SPFilterNode("z:row").length>=queryLimit&&(b+=queryLimit)}});return a} function getAllSitePages(){var a=[],b=0,c=""+b+"";$().SPServices({operation:"GetListItems",async:!1,listName:"SitePagesLog",CAMLRowLimit:queryLimit,CAMLViewFields:"",CAMLQuery:c,completefunc:function(c,d){$(c.responseXML).SPFilterNode("z:row").each(function(){var b= {ID:parseInt($(this).attr("ows_ID")),Title:void 0!=$(this).attr("ows_Title")?$(this).attr("ows_Title"):"",Clave:void 0!=$(this).attr("ows_Clave")?$(this).attr("ows_Clave"):"",RelativeURL:void 0!=$(this).attr("ows_RelativeURL")?$(this).attr("ows_RelativeURL"):""};a.push(b)});$(c.responseXML).SPFilterNode("z:row").length>=queryLimit&&(b+=queryLimit)}});return a};