Commit 96380b0706fc42629e24b05fd25bb5f1cf8c30b8

Authored by Edmar Moretti
1 parent 41d56aca

--no commit message

admin/admin.db
No preview for this file type
classesjs/classe_analise.js
@@ -50,6 +50,14 @@ i3GEO.analise = { @@ -50,6 +50,14 @@ i3GEO.analise = {
50 */ 50 */
51 dialogo:{ 51 dialogo:{
52 /* 52 /*
  53 + Function: saiku
  54 +
  55 + Abre a janela de dialogo da ferramenta SAIKU
  56 + */
  57 + saiku: function(){
  58 + i3GEO.util.dialogoFerramenta("i3GEO.analise.dialogo.saiku()","saiku","saiku");
  59 + },
  60 + /*
53 Function: graficoInterativo 61 Function: graficoInterativo
54 62
55 Abre a janela de dialogo da ferramenta graficointerativo versao flash 63 Abre a janela de dialogo da ferramenta graficointerativo versao flash
classesjs/dicionario_ajuda.js
@@ -978,6 +978,15 @@ g_traducao_ajuda = { @@ -978,6 +978,15 @@ g_traducao_ajuda = {
978 //tela:"ferramentas/upload/exemplo.htm", 978 //tela:"ferramentas/upload/exemplo.htm",
979 apijs:"" 979 apijs:""
980 }, 980 },
  981 + "117": {
  982 + titulo: "SAIKU",
  983 + diretorio:"i3geo/ferramentas/saiku",
  984 + categoria:"5",
  985 + pt:"Abre o sistema Saiku que permite o cruzamento de variáveis estatísticas. O Saiku utiliza o sistema de metadados estatísticos para gerar cubos tridimensionais que permitem ao cruzamento de dados tabulares, geração de gráficos e relatórios. O usuário deve adicionar ao mapa pelo menos uma camada com localidades originadas do sistema de metadados. Os elementos dessa camada que estiverem selecionados serão utilizados como filtro no Saiku.",
  986 + complemento:"",
  987 + //tela:"ferramentas/upload/exemplo.htm",
  988 + apijs:""
  989 + }
981 } 990 }
982 }; 991 };
983 992
ferramentas/metaestat/index.js
@@ -1360,7 +1360,7 @@ i3GEOF.metaestat = { @@ -1360,7 +1360,7 @@ i3GEOF.metaestat = {
1360 return ""; 1360 return "";
1361 } 1361 }
1362 //se tiver parametro e todos estiverem vazios, aborta 1362 //se tiver parametro e todos estiverem vazios, aborta
1363 - var i,n,c,j,k,val, 1363 + var i,n,c,j,val,
1364 t=[], 1364 t=[],
1365 dados = i3GEOF.metaestat.parametros.dados; 1365 dados = i3GEOF.metaestat.parametros.dados;
1366 n = dados.length; 1366 n = dados.length;
ferramentas/saiku/Settings.js
@@ -1,157 +0,0 @@ @@ -1,157 +0,0 @@
1 -/*  
2 - * Copyright 2012 OSBI Ltd  
3 - *  
4 - * Licensed under the Apache License, Version 2.0 (the "License");  
5 - * you may not use this file except in compliance with the License.  
6 - * You may obtain a copy of the License at  
7 - *  
8 - * http://www.apache.org/licenses/LICENSE-2.0  
9 - *  
10 - * Unless required by applicable law or agreed to in writing, software  
11 - * distributed under the License is distributed on an "AS IS" BASIS,  
12 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  
13 - * See the License for the specific language governing permissions and  
14 - * limitations under the License.  
15 - */  
16 -  
17 -/**  
18 - * Change settings here  
19 - */  
20 -var Settings = {  
21 - VERSION: "Saiku 2.5",  
22 - BIPLUGIN: false,  
23 - BASE_URL: "",  
24 - TOMCAT_WEBAPP: "/saiku",  
25 - REST_MOUNT_POINT: "/rest/saiku/",  
26 - DIMENSION_PREFETCH: true,  
27 - ERROR_LOGGING: false,  
28 - // number of erroneous ajax calls in a row before UI cant recover  
29 - ERROR_TOLERANCE: 3,  
30 - QUERY_PROPERTIES: {  
31 - 'saiku.olap.query.automatic_execution': 'true',  
32 - 'saiku.olap.query.nonempty': 'true',  
33 - 'saiku.olap.query.nonempty.rows': 'true',  
34 - 'saiku.olap.query.nonempty.columns': 'true',  
35 - 'saiku.ui.render.mode' : 'table'  
36 - },  
37 - /* Valid values for CELLSET_FORMATTER:  
38 - * 1) flattened  
39 - * 2) flat  
40 - */  
41 - CELLSET_FORMATTER: "flattened",  
42 - // limits the number of rows in the result  
43 - // 0 - no limit  
44 - RESULT_LIMIT: 0,  
45 - MEMBERS_FROM_RESULT: true,  
46 - PLUGINS: [  
47 - "Chart"  
48 - ],  
49 - TELEMETRY_SERVER: 'http://telemetry.analytical-labs.com:7000',  
50 - LOCALSTORAGE_EXPIRATION: 10 * 60 * 60 * 1000 /* 10 hours, in ms */  
51 -};  
52 -  
53 -/**  
54 - * Extend settings with query parameters  
55 - */  
56 -Settings.GET = function () {  
57 - var qs = document.location.search;  
58 - qs = qs.split("+").join(" ");  
59 - var params = {},  
60 - tokens,  
61 - re = /[?&]?([^=]+)=([^&]*)/g;  
62 -  
63 - while (tokens = re.exec(qs)) {  
64 - var value = decodeURIComponent(tokens[2]);  
65 - if (! isNaN(value)) value = parseInt(value);  
66 - if (value === "true") value = true;  
67 - if (value === "false") value = false;  
68 - params[decodeURIComponent(tokens[1]).toUpperCase()]  
69 - = value;  
70 - }  
71 -  
72 - return params;  
73 -}();  
74 -_.extend(Settings, Settings.GET);  
75 -  
76 -Settings.REST_URL = Settings.BASE_URL  
77 - + Settings.TOMCAT_WEBAPP  
78 - + Settings.REST_MOUNT_POINT;  
79 -  
80 -// lets assume we dont need a min width/height for table mode  
81 -if (Settings.MODE == "table") {  
82 - Settings.DIMENSION_PREFETCH = false;  
83 - $('body, html').css('min-height',0);  
84 - $('body, html').css('min-width',0);  
85 -  
86 -}  
87 -  
88 -  
89 -/**  
90 - * < IE9 doesn't support Array.indexOf  
91 - */  
92 -if (!Array.prototype.indexOf)  
93 -{  
94 - Array.prototype.indexOf = function(elt /*, from*/)  
95 - {  
96 - var len = this.length >>> 0;  
97 -  
98 - var from = Number(arguments[1]) || 0;  
99 - from = (from < 0)  
100 - ? Math.ceil(from)  
101 - : Math.floor(from);  
102 - if (from < 0)  
103 - from += len;  
104 -  
105 - for (; from < len; from++)  
106 - {  
107 - if (from in this &&  
108 - this[from] === elt)  
109 - return from;  
110 - }  
111 - return -1;  
112 - };  
113 -}  
114 -  
115 -var tagsToReplace = {  
116 - '&': '&amp;',  
117 - '<': '&lt;',  
118 - '>': '&gt;'  
119 -};  
120 -  
121 -function replaceTag(tag) {  
122 - return tagsToReplace[tag] || tag;  
123 -}  
124 -  
125 -function safe_tags_replace(str) {  
126 - return str.replace(/[&<>]/g, replaceTag);  
127 -}  
128 -  
129 -if ($.blockUI) {  
130 - $.blockUI.defaults.css = {};  
131 - $.blockUI.defaults.overlayCSS = {};  
132 - $.blockUI.defaults.blockMsgClass = 'processing';  
133 - $.blockUI.defaults.fadeOut = 0;  
134 - $.blockUI.defaults.fadeIn = 0;  
135 - $.blockUI.defaults.ignoreIfBlocked = false;  
136 -  
137 -}  
138 -//original alterado por Edmar Moretti  
139 -/*  
140 -if (window.location.hostname && (window.location.hostname == "dev.analytical-labs.com" || window.location.hostname == "demo.analytical-labs.com" )) {  
141 - Settings.USERNAME = "admin";  
142 - Settings.PASSWORD = "admin";  
143 -}  
144 -*/  
145 -Settings.USERNAME = "admin";  
146 -Settings.PASSWORD = "admin";  
147 -  
148 -var isIE = (function(){  
149 - var undef, v = 3, div = document.createElement('div');  
150 -  
151 - while (  
152 - div.innerHTML = '<!--[if gt IE '+(++v)+']><i></i><![endif]-->',  
153 - div.getElementsByTagName('i')[0]  
154 - );  
155 -  
156 - return v> 4 ? v : false;  
157 -}());  
ferramentas/saiku/dicionario.js 0 → 100755
@@ -0,0 +1,15 @@ @@ -0,0 +1,15 @@
  1 +//+$trad(1,i3GEOF.saiku.dicionario)+
  2 +i3GEOF.saiku.dicionario = {
  3 + 1: [{
  4 + pt:"Voc&ecirc; pode selecionar elementos de camadas com localidades e que tenham origem no sistema de metadados estat&iacute;sticos. Caso essa camada n&atilde;o possua nenhum elemento selecionado, todos ser&atilde;o considerados. Para adicionar uma camada desse tipo utilize a op&ccedil;&atilde;o <i>Limites e localidades</i> existente no cat&aacute;logo de temas.",
  5 + en:"",
  6 + es:"",
  7 + it:""
  8 + }],
  9 + 2: [{
  10 + pt:"Abrir o Saiku em uma nova janela",
  11 + en:"",
  12 + es:"",
  13 + it:""
  14 + }]
  15 +};
ferramentas/saiku/esquemaxml.php
1 <?php 1 <?php
2 -var_dump($_COOKIE);exit;  
3 include(dirname(__FILE__)."/../../admin/php/classe_metaestat.php"); 2 include(dirname(__FILE__)."/../../admin/php/classe_metaestat.php");
4 $m = new Metaestat(); 3 $m = new Metaestat();
5 - 4 +$selecaoRegiao = array();
  5 +//pega o filtro da sessao PHP aberta pelo i3Geo
  6 +if(!empty($_COOKIE["i3GeoPHP"])){
  7 + include(dirname(__FILE__)."/../../classesphp/funcoes_gerais.php");
  8 + session_name("i3GeoPHP");
  9 + session_id($_COOKIE["i3GeoPHP"]);
  10 + session_start();
  11 + //obtem os layers que sao do sistema metaestat, sao regioes e que possuem selecao
  12 + $map_file = $_SESSION["map_file"];
  13 + $mapa = ms_newMapObj($map_file);
  14 + $c = $mapa->numlayers;
  15 + for ($i=0;$i < $c;++$i){
  16 + $l = $mapa->getlayer($i);
  17 + $registros = array();
  18 + $codigo_tipo_regiao = $l->getmetadata("METAESTAT_CODIGO_TIPO_REGIAO");
  19 + if($codigo_tipo_regiao != "" && $l->getmetadata("METAESTAT_ID_MEDIDA_VARIAVEL") == ""){
  20 + //verifica se tem selecao
  21 + $qyfile = dirname($map_file)."/".$l->name.".php";
  22 + if(file_exists($qyfile)){
  23 + //pega os registros
  24 + $shapes = retornaShapesSelecionados($l,$map_file,$mapa);
  25 + //pega o nome da coluna que identifica cada registro
  26 + $regiao = $m->listaTipoRegiao($codigo_tipo_regiao);
  27 + $item = $regiao["identificador"];
  28 + foreach($shapes as $shape){
  29 + $registros[] = $shape->values[$item];
  30 + }
  31 + $reg = $item." IN ('".implode("','",$registros)."') ";
  32 + $selecaoRegiao[$codigo_tipo_regiao] = array(
  33 + "item" => $item,
  34 + "sql" => $reg
  35 + );
  36 + }
  37 + else{
  38 + $selecaoRegiao[$codigo_tipo_regiao] = "";
  39 + }
  40 + }
  41 + }
  42 + $regiao = "";
  43 + $item = "";
  44 + $registros = "";
  45 +}
  46 +//echo "<pre>".var_dump($_SESSION);exit;
6 $regioes = $m->listaTipoRegiao(); 47 $regioes = $m->listaTipoRegiao();
7 $xml = "<Schema name='i3Geo Metaestat'>"; 48 $xml = "<Schema name='i3Geo Metaestat'>";
8 -/*  
9 -echo "<pre>";  
10 -foreach($regioes as $regiao){  
11 - echo $regiao["codigo_tipo_regiao"]."<br>";  
12 - $caminho = $m->hierarquiaPath($regiao["codigo_tipo_regiao"]);  
13 - var_dump($caminho);  
14 -}  
15 -exit;  
16 -*/  
17 -  
18 //cria as dimensoes de tipo temporal 49 //cria as dimensoes de tipo temporal
19 $sqlAno = "select nu_ano from i3geo_metaestat.dim_tempo group by nu_ano order by nu_ano"; 50 $sqlAno = "select nu_ano from i3geo_metaestat.dim_tempo group by nu_ano order by nu_ano";
20 $sqlMes = "select nu_ano,nu_mes,ds_mes_abreviado as mes,nu_ano::text||'-'||nu_mes::text as nu_anomes from i3geo_metaestat.dim_tempo group by nu_ano,nu_mes,mes,nu_anomes order by nu_ano,nu_mes"; 51 $sqlMes = "select nu_ano,nu_mes,ds_mes_abreviado as mes,nu_ano::text||'-'||nu_mes::text as nu_anomes from i3geo_metaestat.dim_tempo group by nu_ano,nu_mes,mes,nu_anomes order by nu_ano,nu_mes";
@@ -35,98 +66,89 @@ $xml .= &quot; @@ -35,98 +66,89 @@ $xml .= &quot;
35 "; 66 ";
36 foreach($regioes as $regiao){ 67 foreach($regioes as $regiao){
37 $caminho = $m->hierarquiaPath($regiao["codigo_tipo_regiao"]); 68 $caminho = $m->hierarquiaPath($regiao["codigo_tipo_regiao"]);
38 - //  
39 - //verifica se a regiao tem hierarquia  
40 - if(empty($caminho)){  
41 - $xml .= "  
42 - <Dimension name='codigo_tipo_regiao_".$regiao["codigo_tipo_regiao"]."' caption='Onde: ".converte($regiao["nome_tipo_regiao"])."'>  
43 - <Hierarchy hasAll='true' primaryKey='".$regiao["identificador"]."'>  
44 - <Table name='".$regiao["tabela"]."' schema='".$regiao["esquemadb"]."' />  
45 - <Level name='Nome - ".converte($regiao["nome_tipo_regiao"])."' column='".$regiao["colunanomeregiao"]."' uniqueMembers='true'/>  
46 - </Hierarchy>  
47 - </Dimension> 69 + $xml .= "
  70 + <Dimension name='codigo_tipo_regiao_".$regiao["codigo_tipo_regiao"]."' caption='Onde:".converte($regiao["nome_tipo_regiao"])."'>
  71 + <Hierarchy hasAll='true' primaryKey='codigo'>
  72 + ";
  73 + //cria uma view juntando as tabelas da hierarquia de regioes
  74 + $n = count($caminho);
  75 + $colunas = array();
  76 + $niveis = array();
  77 + $sql = "SELECT __COLUNAS__ FROM {$regiao['esquemadb']}.{$regiao['tabela']} AS regiao ";
  78 + $colunas[] = "regiao.{$regiao['identificador']} AS codigo ";
  79 + $colunas[] = "regiao.{$regiao['colunanomeregiao']} AS nome";
  80 + $tabelaAnt = "regiao";
  81 + for($i=0;$i<$n;$i++){
  82 + $r = $m->listaTipoRegiao($caminho[$i]);
  83 + $colunas[] = "j$i.{$r['colunanomeregiao']} AS j$i{$r['colunanomeregiao']}";
  84 + $colunas[] = "j$i.{$r['identificador']} AS j$i{$r['identificador']}";
  85 + $sql .= "INNER JOIN {$r['esquemadb']}.{$r['tabela']}
  86 + AS j$i ON j$i.{$r['identificador']}::text = {$tabelaAnt}.{$r['identificador']}::text
48 "; 87 ";
49 - }  
50 - else{  
51 - $xml .= "  
52 - <Dimension name='codigo_tipo_regiao_".$regiao["codigo_tipo_regiao"]."' caption='Onde: ".converte($regiao["nome_tipo_regiao"])."'>  
53 - <Hierarchy hasAll='true' primaryKey='codigo'> 88 + $tabelaAnt = "j".$i;
  89 + $niveis[] = "
  90 + <Level name='".converte($r["nome_tipo_regiao"])."'
  91 + column='j$i{$r['identificador']}'
  92 + nameColumn='j$i{$r["colunanomeregiao"]}' uniqueMembers='false'/>
54 "; 93 ";
55 - //cria uma view juntando as tabelas da hierarquia de regioes  
56 - $n = count($caminho);  
57 - $colunas = array();  
58 - $niveis = array();  
59 - $sql = "SELECT __COLUNAS__ FROM {$regiao['esquemadb']}.{$regiao['tabela']} AS regiao ";  
60 - $colunas[] = "regiao.{$regiao['identificador']} AS codigo ";  
61 - $colunas[] = "regiao.{$regiao['colunanomeregiao']} AS nome";  
62 - $tabelaAnt = "regiao";  
63 - for($i=0;$i<$n;$i++){  
64 - $r = $m->listaTipoRegiao($caminho[$i]);  
65 - $colunas[] = "j$i.{$r['colunanomeregiao']} AS j$i{$r['colunanomeregiao']}";  
66 - $colunas[] = "j$i.{$r['identificador']} AS j$i{$r['identificador']}";  
67 - $sql .= "INNER JOIN {$r['esquemadb']}.{$r['tabela']}  
68 - AS j$i ON j$i.{$r['identificador']}::text = {$tabelaAnt}.{$r['identificador']}::text  
69 - ";  
70 - $tabelaAnt = "j".$i;  
71 - $niveis[] = "  
72 - <Level name='".converte($r["nome_tipo_regiao"])."'  
73 - column='j$i{$r['identificador']}'  
74 - nameColumn='j$i{$r["colunanomeregiao"]}' uniqueMembers='false'/>  
75 - "; 94 + }
  95 + $niveis[] = "
  96 + <Level name='".converte($regiao["nome_tipo_regiao"])."'
  97 + column='codigo'
  98 + nameColumn='nome' uniqueMembers='true'>
  99 + ";
76 100
  101 + //verifica outras colunas
  102 + $vis = $regiao['colunasvisiveis'];
  103 + if($vis != ""){
  104 + $vis = str_replace(";",",",$vis);
  105 + $vis = str_replace(",,",",",$vis);
  106 + $vis = explode(",",$vis);
  107 + foreach($vis as $v){
  108 + $colunas[] = "regiao.".$v." as ".$v;
77 } 109 }
78 - $niveis[] = "  
79 - <Level name='".converte($regiao["nome_tipo_regiao"])."'  
80 - column='codigo'  
81 - nameColumn='nome' uniqueMembers='true'>  
82 - "; 110 + $colunas = array_unique($colunas);
  111 + }
  112 + $colunas = implode($colunas,",");
  113 + $sql = str_replace("__COLUNAS__",$colunas,$sql);
  114 + //inclui a selecao se houver
  115 + if(!empty($selecaoRegiao[$regiao["codigo_tipo_regiao"]]))
  116 + $rs = $selecaoRegiao[$regiao["codigo_tipo_regiao"]];
  117 + $pos = strpos($sql, "regiao.".$rs["item"]." ");
  118 + if($rs != "" || !$pos === false){
  119 + $sql .= " WHERE regiao.".$rs["sql"];
  120 + }
83 121
84 - //verifica outras colunas  
85 - $vis = $regiao['colunasvisiveis'];  
86 - if($vis != ""){  
87 - $vis = str_replace(";",",",$vis);  
88 - $vis = str_replace(",,",",",$vis);  
89 - $vis = explode(",",$vis);  
90 - foreach($vis as $v){  
91 - //if($v != $regiao['colunanomeregiao'] && $v != $regiao['identificador']){  
92 - $colunas[] = "regiao.".$v." as ".$v;  
93 - //}  
94 - }  
95 - $colunas = array_unique($colunas); 122 + $xml .= "
  123 + <view alias='view_codigo_tipo_regiao_".$regiao["codigo_tipo_regiao"]."' ><SQL dialect='generic' >$sql</SQL></view>
  124 + ";
  125 + $xml .= implode(" ",$niveis);
  126 + //verifica se existem propriedades (colunas adicionais)
  127 + if($vis != ""){
  128 + //apelidos
  129 + $apelidos = $regiao['apelidos'];
  130 + if($apelidos != ""){
  131 + $apelidos = str_replace(";",",",$apelidos);
  132 + $apelidos = str_replace(",,",",",$apelidos);
  133 + $apelidos = converte($apelidos);
  134 + $apelidos = explode(",",$apelidos);
96 } 135 }
97 - $colunas = implode($colunas,",");  
98 - $sql = str_replace("__COLUNAS__",$colunas,$sql);  
99 - $xml .= "  
100 - <view alias='view_codigo_tipo_regiao_".$regiao["codigo_tipo_regiao"]."' ><SQL dialect='generic' >$sql</SQL></view>  
101 - ";  
102 - $xml .= implode(" ",$niveis);  
103 - //verifica se existem propriedades (colunas adicionais)  
104 - if($vis != ""){  
105 - //apelidos  
106 - $apelidos = $regiao['apelidos'];  
107 - if($apelidos != ""){  
108 - $apelidos = str_replace(";",",",$apelidos);  
109 - $apelidos = str_replace(",,",",",$apelidos);  
110 - $apelidos = converte($apelidos);  
111 - $apelidos = explode(",",$apelidos);  
112 - }  
113 - else{  
114 - $apelidos = $vis;  
115 - }  
116 - $nvis = count($vis);  
117 - for($i = 0; $i < $nvis; $i++){  
118 - $xml .= "  
119 - <Property name='{$apelidos[$i]}' column='{$vis[$i]}'/>  
120 - ";  
121 - } 136 + else{
  137 + $apelidos = $vis;
  138 + }
  139 + $nvis = count($vis);
  140 + for($i = 0; $i < $nvis; $i++){
  141 + $xml .= "
  142 + <Property name='{$apelidos[$i]}' column='{$vis[$i]}'/>
  143 + ";
122 } 144 }
123 - //fecha os elementos. LEVEL deve ser fechado pois o ultimo recebe as propriedades  
124 - $xml .= "  
125 - </Level>  
126 - </Hierarchy>  
127 - </Dimension>  
128 - ";  
129 } 145 }
  146 + //fecha os elementos. LEVEL deve ser fechado pois o ultimo recebe as propriedades
  147 + $xml .= "
  148 + </Level>
  149 + </Hierarchy>
  150 + </Dimension>
  151 + ";
130 } 152 }
131 //junta as medidas conforme o nome da tabela utilizada 153 //junta as medidas conforme o nome da tabela utilizada
132 $medidas = $m->listaMedidaVariavel(); 154 $medidas = $m->listaMedidaVariavel();
@@ -183,7 +205,7 @@ foreach($tbs as $tb){ @@ -183,7 +205,7 @@ foreach($tbs as $tb){
183 //echo "<pre>";var_dump($parametro);exit; 205 //echo "<pre>";var_dump($parametro);exit;
184 } 206 }
185 $xml .= " 207 $xml .= "
186 - <Cube name='{$c["esquemadb"]}{$c["tabela"]}'>"; 208 + <Cube cache='false' name='{$c["esquemadb"]}{$c["tabela"]}'>";
187 $sql = "select * from {$c["esquemadb"]}.{$c["tabela"]}"; 209 $sql = "select * from {$c["esquemadb"]}.{$c["tabela"]}";
188 if(count($parComposto) > 0){ 210 if(count($parComposto) > 0){
189 $sql = "select *,".implode("||'-'||",$parComposto)." as ".implode("_",$parComposto)." from {$c["esquemadb"]}.{$c["tabela"]}"; 211 $sql = "select *,".implode("||'-'||",$parComposto)." as ".implode("_",$parComposto)." from {$c["esquemadb"]}.{$c["tabela"]}";
ferramentas/saiku/index.js 0 → 100755
@@ -0,0 +1,145 @@ @@ -0,0 +1,145 @@
  1 +/*
  2 +Title: Saiku
  3 +
  4 +Formulario para obtencao de parametros para abertura do SAIKU
  5 +
  6 +Veja:
  7 +
  8 +<i3GEO.analise.dialogo.saiku>
  9 +
  10 +Arquivo:
  11 +
  12 +i3geo/ferramentas/saiku/index.js
  13 +
  14 +Licenca:
  15 +
  16 +GPL2
  17 +
  18 +i3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet
  19 +
  20 +Direitos Autorais Reservados (c) 2006 Minist&eacute;rio do Meio Ambiente Brasil
  21 +Desenvolvedor: Edmar Moretti edmar.moretti@gmail.com
  22 +
  23 +Este programa &eacute; software livre; voc&ecirc; pode redistribu&iacute;-lo
  24 +e/ou modific&aacute;-lo sob os termos da Licen&ccedil;a P&uacute;blica Geral
  25 +GNU conforme publicada pela Free Software Foundation;
  26 +
  27 +Este programa &eacute; distribu&iacute;do na expectativa de que seja &uacute;til,
  28 +por&eacute;m, SEM NENHUMA GARANTIA; nem mesmo a garantia impl&iacute;cita
  29 +de COMERCIABILIDADE OU ADEQUA&Ccedil;&Atilde;O A UMA FINALIDADE ESPEC&Iacute;FICA.
  30 +Consulte a Licen&ccedil;a P&uacute;blica Geral do GNU para mais detalhes.
  31 +Voc&ecirc; deve ter recebido uma c&oacute;pia da Licen&ccedil;a P&uacute;blica Geral do
  32 +GNU junto com este programa; se n&atilde;o, escreva para a
  33 +Free Software Foundation, Inc., no endere&ccedil;o
  34 +59 Temple Street, Suite 330, Boston, MA 02111-1307 USA.
  35 +*/
  36 +if(typeof(i3GEOF) === 'undefined'){
  37 + var i3GEOF = {};
  38 +}
  39 +/*
  40 +Classe: i3GEOF.saiku
  41 +
  42 +*/
  43 +i3GEOF.saiku = {
  44 + /*
  45 + Variavel: aguarde
  46 +
  47 + Estilo do objeto DOM com a imagem de aguarde existente no cabe&ccedil;alho da janela.
  48 + */
  49 + aguarde: "",
  50 + /*
  51 + Para efeitos de compatibilidade antes da vers&atilde;o 4.7 que n&atilde;o tinha dicion&aacute;rio
  52 + */
  53 + criaJanelaFlutuante: function(){
  54 + i3GEOF.saiku.iniciaDicionario();
  55 + },
  56 + /*
  57 + Function: iniciaDicionario
  58 +
  59 + Carrega o dicion&aacute;rio e chama a fun&ccedil;&atilde;o que inicia a ferramenta
  60 +
  61 + O Javascript &eacute; carregado com o id i3GEOF.nomedaferramenta.dicionario_script
  62 + */
  63 + iniciaDicionario: function(){
  64 + if(typeof(i3GEOF.saiku.dicionario) === 'undefined'){
  65 + i3GEO.util.scriptTag(
  66 + i3GEO.configura.locaplic+"/ferramentas/saiku/dicionario.js",
  67 + "i3GEOF.saiku.iniciaJanelaFlutuante()",
  68 + "i3GEOF.saiku.dicionario_script"
  69 + );
  70 + }
  71 + else{
  72 + i3GEOF.saiku.iniciaJanelaFlutuante();
  73 + }
  74 + },
  75 + /*
  76 + Function: inicia
  77 +
  78 + Inicia a ferramenta. &Eacute; chamado por criaJanelaFlutuante
  79 +
  80 + Parametro:
  81 +
  82 + iddiv {String} - id do div que receber&aacute; o conteudo HTML da ferramenta
  83 + */
  84 + inicia: function(iddiv){
  85 + try{
  86 + $i(iddiv).innerHTML += i3GEOF.saiku.html();
  87 + new YAHOO.widget.Button(
  88 + "i3GEOFsaikubotao1",
  89 + {onclick:{fn: i3GEOF.saiku.aplicar}}
  90 + );
  91 + }
  92 + catch(erro){i3GEO.janela.tempoMsg(erro);}
  93 + },
  94 + /*
  95 + Function: html
  96 +
  97 + Gera o c&oacute;digo html para apresenta&ccedil;&atilde;o das op&ccedil;&otilde;es da ferramenta
  98 +
  99 + Retorno:
  100 +
  101 + String com o c&oacute;digo html
  102 + */
  103 + html:function(){
  104 + var ins = "<p class=paragrafo >Saiku: <a href=http://meteorite.bi/saiku target=_blank >http://meteorite.bi/saiku</a></p>" +
  105 + "<p class=paragrafo >" + $trad(1,i3GEOF.saiku.dicionario) + "<p>" +
  106 + "<input id=i3GEOFsaikubotao1 size=20 type=button value='"+$trad(2,i3GEOF.saiku.dicionario)+"' />";
  107 +
  108 + return ins;
  109 + },
  110 + /*
  111 + Function: iniciaJanelaFlutuante
  112 +
  113 + Cria a janela flutuante para controle da ferramenta.
  114 + */
  115 + iniciaJanelaFlutuante: function(){
  116 + var janela,divid,titulo,cabecalho,minimiza;
  117 + cabecalho = function(){};
  118 + minimiza = function(){
  119 + i3GEO.janela.minimiza("i3GEOF.saiku");
  120 + };
  121 + //cria a janela flutuante
  122 + titulo = "Saiku <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=4&idajuda=117' >&nbsp;&nbsp;&nbsp;</a>";
  123 + janela = i3GEO.janela.cria(
  124 + "300px",
  125 + "200px",
  126 + "",
  127 + "",
  128 + "",
  129 + titulo,
  130 + "i3GEOF.saiku",
  131 + false,
  132 + "hd",
  133 + cabecalho,
  134 + minimiza
  135 + );
  136 + divid = janela[2].id;
  137 + $i("i3GEOF.saiku_corpo").style.backgroundColor = "white";
  138 + $i("i3GEOF.saiku_corpo").style.textAlign = "left";
  139 + i3GEOF.saiku.aguarde = $i("i3GEOF.saiku_imagemCabecalho").style;
  140 + i3GEOF.saiku.inicia(divid);
  141 + },
  142 + aplicar: function(){
  143 + window.open("http://localhost:9090");
  144 + }
  145 +};