index.js
3.54 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
function mostraBotoesBT(){
var r, p;
r = function(d){
d = d.data;
var html = "", n, camadas = [], i;
n = d.mapas.length;
for(i=0; i<n; i++){
d.mapas[i] = verificaMapa(d.mapas[i]);
}
html = Mustache.to_html(
"{{#mapas}}" + $("#templateLista").html() + "{{/mapas}}",
$.extend(
{},
i3GEO.idioma.objetoIdioma(g_traducao_mapas),
d
)
);
$("#corpo").html(html);
d.mapas.push({
"ID_MAPA": "topo",
"NOME": "Topo"
});
$('[data-toggle="quadroQrcode"]').popover({
html: true,
placement: "bottom",
trigger: "focus",
container: "body",
content: function(){
var urlqr = "../pacotes/qrcode/php/qr_img.php?host=" + window.location.host + "&u=" + $(this).attr("data-url");
return "<a title='click' href='"+ $(this).attr("data-url") +"'><img style='width:200px; height: 200px;' src='" + urlqr + "' '></a>";
}
});
};
//cpJSON vem de classe_php.js
cpJSON.call("../classesphp/mapa_controle.php?id_mapa=&map_file=&funcao=pegaMapas&g_sid=", "foo", r);
}
//define os links adicionais conforme o tipo de mapa
function verificaMapa(mapa){
var link, nome, combo, links = [], html;
//imagem dinamica ou nao
if(mapa.IMAGEM == "" && mapa.CONTEMMAPFILE == "sim"){
mapa.IMAGEM = i3GEO.configura.locaplic
+ "/ferramentas/salvamapa/geraminiatura.php?w=100&h=90&restauramapa="
+ mapa.ID_MAPA;
}
//constroi o link para o mapa
if(mapa.LINK == ""){
link = i3GEO.configura.locaplic + "/ms_criamapa.php?temasa=" + mapa.TEMAS + "&layers=" + mapa.LIGADOS;
if (mapa.EXTENSAO !== "") {
link += "&mapext=" + mapa.EXTENSAO;
}
if (mapa.OUTROS !== "") {
link += "&" + mapa.OUTROS;
}
mapa.LINK = link;
links.push({
"nome": "Default",
"link": mapa.LINK,
"copiado": $trad("copiado",g_traducao_mapas)
});
} else {
links.push({
"nome": "Default",
"link": mapa.LINK,
"copiado": $trad("copiado",g_traducao_mapas)
});
}
// verifica se o mapfile esta salvo no banco
// diretamente
if (mapa.CONTEMMAPFILE != "nao") {
links = [
{
"copiado": $trad("copiado",g_traducao_mapas),
"nome": "Como foi salvo",
"link": mapa.LINK
},{
"copiado": $trad("copiado",g_traducao_mapas),
"nome": "Openlayers com todos os botoes",
"link": i3GEO.configura.locaplic + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" + mapa.ID_MAPA
},{
"copiado": $trad("copiado",g_traducao_mapas),
"nome": "Sem o fundo",
"link": i3GEO.configura.locaplic + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" + mapa.ID_MAPA + "&fundo=est_wms"
},{
"copiado": $trad("copiado",g_traducao_mapas),
"nome": "Com botoes principais",
"link": i3GEO.configura.locaplic + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" + mapa.ID_MAPA + "&fundo=e_wsm&botoes=legenda pan zoombox zoomtot zoomin zoomout distancia area identifica"
},{
"copiado": $trad("copiado",g_traducao_mapas),
"nome": "Botoes de navegacao",
"link": i3GEO.configura.locaplic + "/mashups/openlayers.php?numzoomlevels=18&restauramapa=" + mapa.ID_MAPA
}
];
}
html = Mustache.to_html(
"{{#d}}" + $("#templateLinks").html() + "{{/d}}",
{"d":links}
);
mapa.subtitulo = html;
return mapa;
}
function mostraLinks(id){
$(".modal-body").html($("#" + id).html());
$("#modal").modal('show');
}
function alerta(texto,d){
if(!d){
d = 500;
}
var a = $(".alert");
a.html(texto);
a.slideDown(d);
a.delay(d).slideUp(d);
}