index.js
3.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
ogc = {};
ogc.menus = {
//variavel global indicando o elemento que recebera a lista de menus
ondeLista: "",
init: function(onde){
ogc.menus.ondeLista = onde;
//ogc.menus.lista();
ogc.menus.listaCompleta();
},
/*
Function: lista
Lista de menus
*/
lista: function(){
$.post(
"exec.php",
"funcao=lista"
)
.done(
function(data, status){
var json = jQuery.parseJSON(data);
var html = Mustache.to_html(
"{{#data}}" + $("#templateLista").html() + "{{/data}}",
$.extend(
{},
ogc.menus.dicionario,
{
"data": json["dados"],
"onclick": "ogc.menus.proximoNivel"
}
)
);
ogc.menus.ondeLista.html(html);
$.material.init();
}
)
.fail(function(data){
ogc.menus.ondeLista.html('<div class="alert alert-danger alert-dismissible" role="alert">' + data.status + " " +data.statusText + '</div>');
});
},
proximoNivel: function(id,nome){
window.location.href = "menu/index.php?id_menu=" + id + "&nome_menu=" + nome;
},
mostraLinksServico: function(codigo_tema){
$(".modal-body").html('<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i><span class="sr-only">Aguarde</span>');
var html;
tradLinks["tema"] = codigo_tema;
html = Mustache.to_html(
$("#templateLinksOgc").html(),
tradLinks
);
$(".modal-body").html(html);
},
mostraLinksDownload: function(codigo_tema){
$(".modal-body").html('<i class="fa fa-spinner fa-pulse fa-2x fa-fw"></i><span class="sr-only">Aguarde</span>');
tradLinks["tema"] = codigo_tema;
$.post(
"../classesphp/mapa_controle.php",
"map_file=&funcao=download3&tema="+codigo_tema
)
.done(
function(data, status){
var retorno = jQuery.parseJSON(data).data;
var html,arqs,i,n,ins = "";
tradLinks["mapfile"] = window.location.protocol + "//" + window.location.host + "/" + retorno.mapfileurl;
tradLinks["sldurl"] = tradLinks["urli3geo"] + "/ferramentas/legenda/exec.php?funcao=TEMA2SLD&tema=" + retorno.tema + "&map_file=" + retorno.mapfile;
arqs = retorno.arquivos.split(",");
n = arqs.length;
for (i=0; i<n; i++){
ins += "<p><a href='"+window.location.protocol+"//"+window.location.host+"/"+arqs[i]+"'>"+arqs[i]+"</a></p>";
}
tradLinks["shp"] = ins;
html = Mustache.to_html(
$("#templateLinksDownload").html(),
tradLinks
);
tradLinks["shp"] = "";
tradLinks["mapfile"] = "";
tradLinks["sldurl"] = "";
$(".modal-body").html(html);
}
)
.fail(function(data){
ogc.grupo.ondeLista.html('<div class="alert alert-danger alert-dismissible" role="alert">' + data.status + " " +data.statusText + '</div>');
});
},
listaCompleta: function (onde){
$.post(
"exec.php",
"funcao=listatodas"
)
.done(
function(data, status){
var json = jQuery.parseJSON(data);
//
//monta a lista de camadas
//
var htmlcamadas = Mustache.to_html(
"{{#data}}" + $("#templateCamadas").html() + "{{/data}}",
$.extend(
{},
ogc.menus.dicionario,
{
"data": json["camadas"],
"dominio": "ogc.menus",
"disabledlink": function(){
if(this.link_tema == ""){
return "hidden";
}
else {
return "";
}
},
"disableddown": function(){
if(this.download_tema != "nao"){
return "";
}
else {
return "hidden";
}
},
"disabledogc": function(){
if(this.ogc_tema != "nao"){
return "";
}
else {
return "hidden";
}
}
}
)
);
ogc.menus.ondeLista.html(htmlcamadas);
$.material.init();
}
)
.fail(function(data){
ogc.menus.ondeLista.html('<div class="alert alert-danger alert-dismissible" role="alert">' + data.status + " " +data.statusText + '</div>');
});
}
};