index.js 7.3 KB
botoesIni = [
{
	"img":"openlayers",
	"href": location.href.replace("init/index.php"+window.location.search,"") + customDir + "/black_ol.htm",
	"titulo":$trad(4,g_traducao_init),
	"subtitulo": $trad("4a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"osm",
	"href": location.href.replace("init/index.php"+window.location.search,"") + customDir + "/black_osm.htm",
	"titulo":$trad(23,g_traducao_init),
	"subtitulo": $trad("23a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"googlemaps",
	"href": location.href.replace("init/index.php"+window.location.search,"") + customDir + "/black_gm.phtml",
	"titulo":$trad(6,g_traducao_init),
	"subtitulo": $trad("6a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"mashup",
	"href": "../mashups/index.php",
	"titulo":$trad(18,g_traducao_init) + "<br><a href='../mashups/osm.php?temas=&largura=800&altura=500' target=_blank >OSM</a>" + " - <a href='../mashups/openlayers.php?temas=&largura=800&altura=500' target=_blank >OpenLayers</a>",
	"subtitulo": $trad("18a",g_traducao_init),
	"fa": "map-o",
	"target": "_self"
},{
	"img":"googleearth",
	"href": location.href.replace("init/index.php"+window.location.search,"") + customDir + "/googleearth.phtml",
	"titulo":$trad(7,g_traducao_init),
	"subtitulo": $trad("7a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"cartogramas",
	"href": location.href.replace("init/index.php"+window.location.search,"") + customDir + "/black_carto_ol.htm",
	"titulo":$trad(8,g_traducao_init),
	"subtitulo": $trad("8a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"editor",
	"href": "../ferramentas/metaestat/editorlimites.php",
	"titulo":$trad(9,g_traducao_init),
	"subtitulo": $trad("9a",g_traducao_init),
	"fa": "map-o",
	"target": "_blank"
},{
	"img":"window-duplicate",
	"href": "../mapas/index.php",
	"titulo":$trad(34,g_traducao_init),
	"subtitulo": $trad("34a",g_traducao_init),
	"fa": "map-o",
	"target": "_self"
},{
	"img":"ogc_logo",
	"href": "../ogc/index.php",
	"titulo":$trad(11,g_traducao_init),
	"subtitulo": $trad("11a",g_traducao_init),
	"fa": "download",
	"target": "_self"
},{
	"img":"application-vnd-google-earth-kml",
	"href": "../kml.php",
	"titulo":$trad(12,g_traducao_init),
	"subtitulo": $trad("12a",g_traducao_init),
	"fa": "download",
	"target": "_self"
},{
	"img":"saiku_free_small",
	"href": "../ferramentas/saiku/esquemaxml.php?locaplic="+window.location.href.replace("/init/index.php",""),
	"titulo":$trad(25,g_traducao_init),
	"subtitulo": $trad("25a",g_traducao_init),
	"fa": "bar-chart",
	"target": "_self"
},{
	"img":"insert-link",
	"href": "../permlinks/index.php",
	"titulo":$trad(13,g_traducao_init),
	"subtitulo": $trad("13a",g_traducao_init),
	"fa": "map-o",
	"target": "_self"
},{
	"img":"openlayersdebug",
	"href": location.href.replace("init/index.php"+window.location.search,"") +  customDir + "/openlayersdebug.htm",
	"titulo":$trad(5,g_traducao_init),
	"subtitulo": $trad("5a",g_traducao_init),
	"fa": "cogs",
	"target": "_blank"
},{
	"img":"certificate-server",
	"href": "../testainstal/index.php",
	"titulo":$trad(2,g_traducao_init),
	"subtitulo": $trad("2a",g_traducao_init),
	"fa": "cogs",
	"target": "_self"
},{
	"img":"applications-development-web",
	"href": "../admin",
	"titulo":$trad(3,g_traducao_init),
	"subtitulo": $trad("3a",g_traducao_init),
	"fa": "cogs",
	"target": "_self"
},{
	"img":"folder-image",
	"href": "../exemplos/index.php",
	"titulo":$trad(14,g_traducao_init),
	"subtitulo": $trad("14a",g_traducao_init),
	"fa": "cogs",
	"target": "_self"
},{
	"img":"applications-development",
	"href": "../utilitarios/index.php",
	"titulo":$trad(33,g_traducao_init),
	"subtitulo": $trad("33a",g_traducao_init),
	"fa": "wrench",
	"target": "_self"
},{
	"img":"guiamigracao",
	"href": "../guia_de_migracao.txt",
	"titulo":$trad(17,g_traducao_init),
	"subtitulo": $trad("17a",g_traducao_init),
	"fa": "cogs",
	"target": "_self"
},{
	"img":"docapi",
	"href": "../documentacao",
	"titulo":$trad(24,g_traducao_init),
	"subtitulo": $trad("24a",g_traducao_init),
	"fa": "book",
	"target": "_self"
},{
	"img":"gvsigtraining",
	"href":"http://moodle.gvsig-training.com/course/view.php?id=11",
	"titulo":$trad(28,g_traducao_init),
	"subtitulo": $trad("28a",g_traducao_init),
	"fa": "book",
	"target": "_self"
},{
	"img":"tools-report-bug",
	"href":"https://softwarepublico.gov.br/gitlab/i3geo/i3geo/issues",
	"titulo":$trad(16,g_traducao_init),
	"subtitulo": $trad("16a",g_traducao_init),
	"fa": "group",
	"target": "_self"
},{
	"img":"apple-touch-icon",
	"href":"https://softwarepublico.gov.br/gitlab/groups/i3geo",
	"titulo":$trad(30,g_traducao_init),
	"subtitulo": $trad("30a",g_traducao_init),
	"fa": "group",
	"target": "_self"
},{
	"img":"logo_psp",
	"href":"https://portal.softwarepublico.gov.br/social/i3geo/",
	"titulo":$trad(31,g_traducao_init),
	"subtitulo": $trad("31a",g_traducao_init),
	"fa": "group",
	"target": "_self"
},{
	"img":"mailman",
	"href":"http://lists.osgeo.org/cgi-bin/mailman/listinfo/i3geo",
	"titulo":$trad(32,g_traducao_init),
	"subtitulo": $trad("32a",g_traducao_init),
	"fa": "group",
	"target": "_self"
}
];
reordenaBotoesPorFavoritos();
//TODO um dia, remover as imagens da pasta init e deixar apenas as da pasta init/imagens
function mostraBotoesBT(men){
	var html = "";
	//menu
	html = Mustache.to_html(
			$("#menuTpl").html(),
			i3GEO.idioma.objetoIdioma(g_traducao_init)
	);
	$("#menuTpl").html(html);
	//
	$("#mensagemLogin").html(men);
	html = Mustache.to_html(
			$("#jumbotron").html(),
			{
				"jumbotron" : $trad(35,g_traducao_init),
				"host" : location.host,
				"href" : location.href
			}
	);
	$("#jumbotron").html(html);
	i3GEO.configura = {"locaplic" : ".."};
	i3GEO.idioma.IDSELETOR = "bandeiras";
	i3GEO.idioma.mostraSeletor();
	html = Mustache.to_html(
			"{{#d}}" + $("#botoesTpl").html() + "{{/d}}",
			{"d":botoesIni,"abrir" : $trad(36,g_traducao_init)}
	);
	$("#botoesTpl").html(html);
	aplicaFavoritos();
}
function findBootstrapDeviceSize() {
	var dsize = ['lg', 'md', 'sm', 'xs'];
	for (var i = dsize.length - 1; i >= 0; i--) {

		// Need to add &nbsp; for Chrome. Works fine in Firefox/Safari/Opera without it.
		// Chrome seem to have an issue with empty div's
		$el = $('<div id="sizeTest" class="hidden-'+dsize[i]+'">&nbsp;</div>');
		$el.appendTo($('body'));

		if ($el.is(':hidden')) {
			$el.remove();
			return dsize[i];
		}
	}
	return 'unknown';
}
//cookies sao armazenados em favoritosInit
function favorita(obj){
	$(obj).find("span").toggleClass("amarelo");
	//
	//modifica os cookies
	//
	var cookies = [];
	$(".amarelo").each(
			function(i,el){
				cookies.push($(el).attr("data-cookie"));
			}
	);
	i3GEO.util.insereCookie("favoritosInit",cookies.join("|"),200);
}
function aplicaFavoritos(){
	var favoritos = i3GEO.util.pegaCookie("favoritosInit");
	if(favoritos){
		favoritos = favoritos.split("|");
		$(favoritos).each(
				function(i,el){
					$('span[data-cookie="'+el+'"]').toggleClass("amarelo");
				}
		);
	}
}
function reordenaBotoesPorFavoritos(){
	var f = [],
	nf = [],
	favoritos = i3GEO.util.pegaCookie("favoritosInit");
	$(botoesIni).each(
		function(i,el){
			el.href = el.href.replace("#topo","");
		}
	);
	if(favoritos){
		favoritos = favoritos.split("|");
		$(botoesIni).each(
				function(i,el){
					if(jQuery.inArray(el.img,favoritos) >= 0){
						f.push(el);
					}
					else{
						nf.push(el);
					}
				}
		);
		botoesIni = jQuery.merge( f, nf );
	}
}