Commit b28b4cda8811e4db5dcb7a0b14868d0c7d5f79b5

Authored by Edmar Moretti
1 parent e012636d

--no commit message

Showing 1 changed file with 66 additions and 53 deletions   Show diff stats
ferramentas/opcoes_fundo/index.js.php
... ... @@ -26,11 +26,11 @@ if(typeof(i3GEOF) === 'undefined'){
26 26 i3GEOF = [];
27 27 }
28 28 /*
29   -Class: i3GEOF.opcoesFundo
  29 +Class: i3GEOF.editorsql
30 30  
31 31 Altera as propriedades do fundo do mapa.
32 32 */
33   -i3GEOF.opcoesFundo = {
  33 +i3GEOF.editorsql = {
34 34 /*
35 35 Variavel: aguarde
36 36  
... ... @@ -48,21 +48,34 @@ i3GEOF.opcoesFundo = {
48 48 */
49 49 inicia: function(iddiv){
50 50 try{
51   - i3GEOF.opcoesFundo.aguarde.visibility = "visible";
52   - $i(iddiv).innerHTML += i3GEOF.opcoesFundo.html();
  51 + $i(iddiv).innerHTML = i3GEOF.editorsql.html();
53 52 new YAHOO.widget.Button(
54   - "i3GEOopcoesFundobotao1",
55   - {onclick:{fn: i3GEOF.opcoesFundo.executa}}
  53 + "i3GEOeditorsqlbotao1",
  54 + {onclick:{fn: i3GEOF.editorsql.altera}}
56 55 );
57   - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=pegacorfundo",
58   - cp = new cpaint(),
59   - retorno = function(retorno){
60   - i3GEOF.opcoesFundo.aguarde.visibility = "hidden";
61   - if(retorno.data.erro){alert("Ocorreu um erro");return;}
62   - $i("i3GEOopcoesFundocor").value = retorno.data;
63   - };
64   - cp.set_response_type("JSON");
65   - cp.call(p,"corQM",retorno);
  56 + i3GEOF.editorsql.pega();
  57 +
  58 + i3GEO.util.comboItens(
  59 + "i3GEOeditorsqlItem",
  60 + i3GEO.temaAtivo,
  61 + function(retorno){
  62 + $i("i3GEOeditorsqlDivItem").innerHTML = retorno.dados;
  63 + $i("i3GEOeditorsqlItem").onchange = function(){
  64 + i3GEO.util.comboValoresItem(
  65 + "i3GEOeditorsqlitens",
  66 + i3GEO.temaAtivo,
  67 + $i("i3GEOeditorsqlItem").value,
  68 + function(retorno){
  69 + $i("i3GEOeditorsqlvalores").innerHTML = "<p class=paragrafo >Valores encontrados:<br><br>"+retorno.dados+"</p>";
  70 + },
  71 + "i3GEOeditorsqlvalores"
  72 + );
  73 +
  74 + };
  75 + },
  76 + "i3GEOeditorsqlDivItem"
  77 + );
  78 +
66 79 }
67 80 catch(erro){alert(erro);}
68 81 },
... ... @@ -76,10 +89,12 @@ i3GEOF.opcoesFundo = {
76 89 String com o código html
77 90 */
78 91 html:function(){
79   - var ins = $inputText("","","i3GEOopcoesFundocor","",12,"") +
80   - '<img alt="aquarela.gif" style=cursor:pointer '+
81   - 'src="'+i3GEO.configura.locaplic+'/imagens/aquarela.gif" onclick="i3GEOF.opcoesFundo.corj(\'i3GEOopcoesFundocor\')" /> ' +
82   - '<br><br><p class=paragrafo ><input size=20 id=i3GEOopcoesFundobotao1 type=button value="Aplica" />';
  92 + var ins = "<textarea rows='4' colums='20' cols='38' id=i3GEOeditorsqlSQL ></textarea>" +
  93 + '<br><br><p class=paragrafo ><input size=20 id=i3GEOeditorsqlbotao1 type=button value="Aplica" />' +
  94 + '<br><br><a class=paragrafo href="http://postgis.refractions.net/documentation/manual-1.4/ch07.html" target=_blank >Veja aqui o manual de funções SQL do Postgis</a>' +
  95 + '<br><p class=paragrafo >Lista de itens existentes na tabela de atributos do tema (escolha um para ver os valores):</p>' +
  96 + '<div class=paragrafo id=i3GEOeditorsqlDivItem ></div>' +
  97 + '<div class=paragrafo id=i3GEOeditorsqlvalores ></div>';
83 98 return ins;
84 99 },
85 100 /*
... ... @@ -88,57 +103,55 @@ i3GEOF.opcoesFundo = {
88 103 Cria a janela flutuante para controle da ferramenta.
89 104 */
90 105 criaJanelaFlutuante: function(){
91   - var janela,divid,temp,titulo,cabecalho,minimiza;
92   - cabecalho = function(){};
93   - minimiza = function(){
94   - i3GEO.janela.minimiza("i3GEOF.opcoesFundo");
95   - };
  106 + var janela,divid,temp,titulo;
96 107 //cria a janela flutuante
97   - titulo = "Cor do fundo <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=1&idajuda=6' >&nbsp;&nbsp;&nbsp;</a>";
  108 + titulo = "Altera SQL <a class=ajuda_usuario target=_blank href='" + i3GEO.configura.locaplic + "/ajuda_usuario.php?idcategoria=5&idajuda=86' >&nbsp;&nbsp;&nbsp;</a>";
98 109 janela = i3GEO.janela.cria(
99   - "210px",
100   - "80px",
  110 + "300px",
  111 + "260px",
101 112 "",
102 113 "",
103 114 "",
104 115 titulo,
105   - "i3GEOF.opcoesFundo",
106   - false,
107   - "hd",
108   - cabecalho,
109   - minimiza
  116 + "i3GEOF.editorsql",
  117 + true,
  118 + "hd"
110 119 );
111 120 divid = janela[2].id;
112   - $i("i3GEOF.opcoesFundo_corpo").style.backgroundColor = "white";
113   - $i("i3GEOF.opcoesFundo_corpo").style.textAlign = "left";
114   - i3GEOF.opcoesFundo.aguarde = $i("i3GEOF.opcoesFundo_imagemCabecalho").style;
115   - i3GEOF.opcoesFundo.inicia(divid);
  121 + $i("i3GEOF.editorsql_corpo").style.backgroundColor = "white";
  122 + $i("i3GEOF.editorsql_corpo").style.textAlign = "left";
  123 + i3GEOF.editorsql.aguarde = $i("i3GEOF.editorsql_imagemCabecalho").style;
  124 + i3GEOF.editorsql.inicia(divid);
116 125 },
117 126 /*
118   - Function: corj
  127 + Function: pega
119 128  
120   - Abre a janela para o usuário selecionar uma cor interativamente
  129 + Pega o SQL
121 130 */
122   - corj: function(obj)
123   - {i3GEO.util.abreCor("",obj);},
  131 + pega: function(){
  132 + if(i3GEOF.editorsql.aguarde.visibility === "visible")
  133 + {return;}
  134 + i3GEOF.editorsql.aguarde.visibility = "visible";
  135 + var temp = function(retorno){
  136 + i3GEOF.editorsql.aguarde.visibility = "hidden";
  137 + $i("i3GEOeditorsqlSQL").innerHTML = retorno.data;
  138 + };
  139 + i3GEO.php.pegaData(temp,i3GEO.temaAtivo);
  140 + },
124 141 /*
125   - Function: executa
  142 + Function: altera
126 143  
127   - Insere a grade no mapa
  144 + Altera o SQL
128 145 */
129   - executa: function(){
130   - if(i3GEOF.opcoesFundo.aguarde.visibility === "visible")
  146 + altera: function(){
  147 + if(i3GEOF.editorsql.aguarde.visibility === "visible")
131 148 {return;}
132   - i3GEOF.opcoesFundo.aguarde.visibility = "visible";
  149 + i3GEOF.editorsql.aguarde.visibility = "visible";
133 150 var temp = function(){
134   - i3GEOF.opcoesFundo.aguarde.visibility = "hidden";
135   - i3GEO.atualiza();
136   - },
137   - cor = $i("i3GEOopcoesFundocor").value,
138   - p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?g_sid="+i3GEO.configura.sid+"&funcao=corfundo&cor="+cor,
139   - cp = new cpaint();
140   - cp.set_response_type("JSON");
141   - cp.call(p,"corQM",temp);
  151 + i3GEOF.editorsql.aguarde.visibility = "hidden";
  152 + i3GEO.atualiza();
  153 + };
  154 + i3GEO.php.alteraData(temp,i3GEO.temaAtivo,$i("i3GEOeditorsqlSQL").value);
142 155 }
143 156 };
144 157 <?php error_reporting(0);if(extension_loaded('zlib')){ob_end_flush();}?>
145 158 \ No newline at end of file
... ...