Commit d54e872ddc7c3bdd03e31b4b1b0332d1bbf94b6b

Authored by Edmar Moretti
1 parent 489ce01e

Incluidas opções para abrir os editores do sistema de administração nas ferramen…

…tas de identificação e lista de WMS
admin/admin.db
No preview for this file type
admin/js/core.js
@@ -1026,7 +1026,12 @@ function core_gravaLinha(mensagem,row,sUrl,nomeFuncao) @@ -1026,7 +1026,12 @@ function core_gravaLinha(mensagem,row,sUrl,nomeFuncao)
1026 var rec = myDataTable.getRecordSet().getRecord(row); 1026 var rec = myDataTable.getRecordSet().getRecord(row);
1027 var linha = myDataTable.getTrEl(rec); 1027 var linha = myDataTable.getTrEl(rec);
1028 if(nomeFuncao != "") 1028 if(nomeFuncao != "")
1029 - {eval(nomeFuncao+"()")} 1029 + {
  1030 + eval(nomeFuncao+"()")
  1031 + try
  1032 + {myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0])}
  1033 + catch(e){}
  1034 + }
1030 else 1035 else
1031 { 1036 {
1032 myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0]) 1037 myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0])
admin/js/identifica.js
@@ -47,6 +47,10 @@ function montaTabela(dados) @@ -47,6 +47,10 @@ function montaTabela(dados)
47 YAHOO.example.InlineCellEditing = new function() 47 YAHOO.example.InlineCellEditing = new function()
48 { 48 {
49 // Custom formatter for "address" column to preserve line breaks 49 // Custom formatter for "address" column to preserve line breaks
  50 + var formatMais = function(elCell, oRecord, oColumn)
  51 + {
  52 + elCell.innerHTML = "<div class=editar style='text-align:center' ></div>";
  53 + };
50 var formatTexto = function(elCell, oRecord, oColumn, oData) 54 var formatTexto = function(elCell, oRecord, oColumn, oData)
51 { 55 {
52 elCell.innerHTML = "<pre ><p>" + oData + "</pre>"; 56 elCell.innerHTML = "<pre ><p>" + oData + "</pre>";
@@ -61,7 +65,7 @@ function montaTabela(dados) @@ -61,7 +65,7 @@ function montaTabela(dados)
61 }; 65 };
62 var myColumnDefs = [ 66 var myColumnDefs = [
63 {key:"excluir",label:"excluir",formatter:formatExclui}, 67 {key:"excluir",label:"excluir",formatter:formatExclui},
64 - {label:"salvar",formatter:formatSalva}, 68 + {key:"mais",label:"editar",formatter:formatMais},
65 {label:"id",key:"id_i", formatter:formatTexto}, 69 {label:"id",key:"id_i", formatter:formatTexto},
66 {label:"nome",resizeable:true,key:"nome_i", formatter:formatTexto, editor:"textbox"}, 70 {label:"nome",resizeable:true,key:"nome_i", formatter:formatTexto, editor:"textbox"},
67 {label:"publicado?",key:"publicado_i",editor:"radio" ,editorOptions:{radioOptions:["SIM","NAO"],disableBtns:false}}, 71 {label:"publicado?",key:"publicado_i",editor:"radio" ,editorOptions:{radioOptions:["SIM","NAO"],disableBtns:false}},
@@ -76,6 +80,7 @@ function montaTabela(dados) @@ -76,6 +80,7 @@ function montaTabela(dados)
76 }; 80 };
77 myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource); 81 myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource);
78 // Set up editing flow 82 // Set up editing flow
  83 + /*
79 myDataTable.highlightEditableCell = function(oArgs) 84 myDataTable.highlightEditableCell = function(oArgs)
80 { 85 {
81 var elCell = oArgs.target; 86 var elCell = oArgs.target;
@@ -96,6 +101,7 @@ function montaTabela(dados) @@ -96,6 +101,7 @@ function montaTabela(dados)
96 }; 101 };
97 myDataTable.subscribe("cellMouseoverEvent", myDataTable.highlightEditableCell); 102 myDataTable.subscribe("cellMouseoverEvent", myDataTable.highlightEditableCell);
98 myDataTable.subscribe("cellMouseoutEvent", myDataTable.unhighlightEditableCell); 103 myDataTable.subscribe("cellMouseoutEvent", myDataTable.unhighlightEditableCell);
  104 + */
99 myDataTable.subscribe('cellClickEvent',function(ev) 105 myDataTable.subscribe('cellClickEvent',function(ev)
100 { 106 {
101 var target = YAHOO.util.Event.getTarget(ev); 107 var target = YAHOO.util.Event.getTarget(ev);
@@ -110,9 +116,28 @@ function montaTabela(dados) @@ -110,9 +116,28 @@ function montaTabela(dados)
110 var record = this.getRecord(target); 116 var record = this.getRecord(target);
111 excluiLinha(record.getData('id_i'),target); 117 excluiLinha(record.getData('id_i'),target);
112 } 118 }
113 - else 119 + if (column.key == 'mais')
114 { 120 {
115 - this.onEventShowCellEditor(ev); 121 + var record = this.getRecord(target);
  122 + core_carregando("ativa");
  123 + core_carregando("buscando dados...");
  124 + $clicouId = record.getData('id_i');
  125 + $recordid = record.getId();
  126 + var sUrl = "../php/identifica.php?funcao=pegafuncoes&id_i="+record.getData('id_i');
  127 + var callback =
  128 + {
  129 + success:function(o)
  130 + {
  131 + try
  132 + {
  133 + montaEditor(YAHOO.lang.JSON.parse(o.responseText),$clicouId,$recordid);
  134 + }
  135 + catch(e){core_handleFailure(e,o.responseText);}
  136 + },
  137 + failure:core_handleFailure,
  138 + argument: { foo:"foo", bar:"bar" }
  139 + };
  140 + core_makeRequest(sUrl,callback)
116 } 141 }
117 }); 142 });
118 // Hook into custom event to customize save-flow of "radio" editor 143 // Hook into custom event to customize save-flow of "radio" editor
@@ -128,6 +153,7 @@ function montaTabela(dados) @@ -128,6 +153,7 @@ function montaTabela(dados)
128 { 153 {
129 this.cancelCellEditor(); 154 this.cancelCellEditor();
130 }); 155 });
  156 + /*
131 myDataTable.subscribe("editorSaveEvent", function(oArgs) 157 myDataTable.subscribe("editorSaveEvent", function(oArgs)
132 { 158 {
133 if(oArgs.newData != oArgs.oldData) 159 if(oArgs.newData != oArgs.oldData)
@@ -135,21 +161,119 @@ function montaTabela(dados) @@ -135,21 +161,119 @@ function montaTabela(dados)
135 linha.style.color = "blue"; 161 linha.style.color = "blue";
136 linha.style.textDecoration = "blink"; 162 linha.style.textDecoration = "blink";
137 }); 163 });
  164 + */
138 }; 165 };
139 core_carregando("desativa"); 166 core_carregando("desativa");
140 } 167 }
141 -function gravaLinha(row) 168 +function montaEditor(dados,id,recordid)
  169 +{
  170 + function on_editorCheckBoxChange(p_oEvent)
  171 + {
  172 + var ins = "";
  173 + if(p_oEvent.newValue.get("value") == "OK")
  174 + {
  175 + gravaDados(id,recordid);
  176 + }
  177 + else
  178 + {
  179 + YAHOO.example.container.panelEditor.destroy();
  180 + YAHOO.example.container.panelEditor = null;
  181 + }
  182 + };
  183 + if(!YAHOO.example.container.panelEditor)
  184 + {
  185 + var novoel = document.createElement("div");
  186 + novoel.id = "janela_editor";
  187 + var ins = '<div class="hd">Editor</div>';
  188 + ins += "<div class='bd' style='height:354px;overflow:auto'>";
  189 + ins += "<div id='okcancel_checkbox'></div><div id='editor_bd'></div>";
  190 + novoel.innerHTML = ins;
  191 + document.body.appendChild(novoel);
  192 + var editorBotoes = new YAHOO.widget.ButtonGroup({id:"okcancel_checkbox_id", name: "okcancel_checkbox_id", container: "okcancel_checkbox" });
  193 + editorBotoes.addButtons([
  194 + { label: "Salva", value: "OK", checked: false},
  195 + { label: "Cancela", value: "CANCEL", checked: false }
  196 + ]);
  197 + editorBotoes.on("checkedButtonChange", on_editorCheckBoxChange);
  198 + YAHOO.example.container.panelEditor = new YAHOO.widget.Panel("janela_editor", { fixedcenter:true,close:false,width:"400px", height:"400px",overflow:"auto", visible:false,constraintoviewport:true } );
  199 + YAHOO.example.container.panelEditor.render();
  200 + }
  201 + YAHOO.example.container.panelEditor.show();
  202 + //carrega os dados na janela
  203 + $i("editor_bd").innerHTML = montaDiv(dados[0])
  204 + core_carregando("desativa");
  205 +}
  206 +function montaDiv(i)
  207 +{
  208 + var param = {
  209 + "linhas":[
  210 + {titulo:"Nome:",id:"Enome_i",size:"50",value:i.nome_i,tipo:"text",div:""},
  211 + {titulo:"Programa:",id:"Eabrir_i",size:"50",value:i.abrir_i,tipo:"text",div:""},
  212 + {titulo:"Abrir como:",id:"Etarget_i",size:"50",value:i.target_i,tipo:"text",div:""}
  213 + ]
  214 + }
  215 + var ins = ""
  216 + ins += core_geraLinhas(param)
  217 +
  218 + ins += "<p>Publicado?<br>"
  219 + ins += "<select id='Epublicado_i' />"
  220 + ins += "<option value='' "
  221 + if (i.publicado_i == ""){ins += "selected";}
  222 + ins += ">---</option>"
  223 + ins += "<option value='SIM' "
  224 + if (i.publicado_i == "SIM"){ins += "selected";}
  225 + ins += " >sim</option>"
  226 + ins += "<option value='NAO' "
  227 + if (i.publicado_i == "NAO"){ins += "selected";}
  228 + ins += " >não</option>"
  229 + ins += "</select></p>"
  230 + return(ins)
  231 +}
  232 +/*
  233 +Function: gravaDados
  234 +
  235 +Aplica as alterações feitas em um WS
  236 +
  237 +<ALTERARWS>
  238 +*/
  239 +function gravaDados(id,recordid)
142 { 240 {
143 - var r = myDataTable.getRecordSet().getRecord(row);  
144 - var publicado_i = r.getData("publicado_i");  
145 - var abrir_i = r.getData("abrir_i")  
146 - var id_i = r.getData("id_i")  
147 - var nome_i = r.getData("nome_i")  
148 - var target_i = r.getData("target_i")  
149 - var mensagem = " gravando o registro do id= "+id_i  
150 - var sUrl = "../php/identifica.php?funcao=alterarFuncoes&publicado_i="+publicado_i+"&abrir_i="+abrir_i+"&nome_i="+nome_i+"&id_i="+id_i+"&target_i="+target_i;  
151 - core_gravaLinha(mensagem,row,sUrl) 241 + var campos = new Array("nome","publicado","abrir","target")
  242 + var par = ""
  243 + for (i=0;i<campos.length;i++)
  244 + {par += "&"+campos[i]+"_i="+($i("E"+campos[i]+"_i").value)}
  245 + par += "&id_i="+id
  246 + core_carregando("ativa");
  247 + core_carregando(" gravando o registro do id= "+id);
  248 + var sUrl = "../php/identifica.php?funcao=alterarFuncoes"+par;
  249 + var callback =
  250 + {
  251 + success:function(o)
  252 + {
  253 + try
  254 + {
  255 + if(YAHOO.lang.JSON.parse(o.responseText) == "erro")
  256 + {
  257 + core_carregando("<span style=color:red >Não foi possível excluir. Verifique se não existem registros vinculados</span>");
  258 + setTimeout("core_carregando('desativa')",3000)
  259 + }
  260 + else
  261 + {
  262 + var rec = myDataTable.getRecordSet().getRecord(recordid);
  263 + myDataTable.updateRow(rec,YAHOO.lang.JSON.parse(o.responseText)[0])
  264 + core_carregando("desativa");
  265 + }
  266 + YAHOO.example.container.panelEditor.destroy();
  267 + YAHOO.example.container.panelEditor = null;
  268 + }
  269 + catch(e){core_handleFailure(e,o.responseText);}
  270 + },
  271 + failure:core_handleFailure,
  272 + argument: { foo:"foo", bar:"bar" }
  273 + };
  274 + core_makeRequest(sUrl,callback)
152 } 275 }
  276 +
153 function excluiLinha(id,row) 277 function excluiLinha(id,row)
154 { 278 {
155 var mensagem = " excluindo o registro do id= "+id; 279 var mensagem = " excluindo o registro do id= "+id;
admin/js/webservices.js
@@ -53,7 +53,17 @@ Obtém a lista de WS @@ -53,7 +53,17 @@ Obtém a lista de WS
53 */ 53 */
54 function pegaWS() 54 function pegaWS()
55 { 55 {
56 - core_pegaDados("buscando endereços...","../php/webservices.php?funcao=pegaWS","montaTabela") 56 + //
  57 + //pega o tipo de WS que será listado se tiver sido definido na url
  58 + //
  59 + var tipows = "";
  60 + try{
  61 + var u = window.location.href.split("?");
  62 + var u = u[1].split("=");
  63 + tipows = u[1];
  64 + }
  65 + catch(e){tipows = "";}
  66 + core_pegaDados("buscando endereços...","../php/webservices.php?funcao=pegaWS&tipows="+tipows,"montaTabela")
57 } 67 }
58 /* 68 /*
59 Function: montaTabela 69 Function: montaTabela
@@ -64,14 +74,13 @@ Monta a tabela de edição @@ -64,14 +74,13 @@ Monta a tabela de edição
64 */ 74 */
65 function montaTabela(dados) 75 function montaTabela(dados)
66 { 76 {
67 - YAHOO.example.InlineCellEditing = new function() 77 + YAHOO.example.InlineCellEditing = new function()
68 { 78 {
69 // Custom formatter for "address" column to preserve line breaks 79 // Custom formatter for "address" column to preserve line breaks
70 var formatTextoId = function(elCell, oRecord, oColumn, oData) 80 var formatTextoId = function(elCell, oRecord, oColumn, oData)
71 { 81 {
72 elCell.innerHTML = "<p>" + oData + "</p>"; 82 elCell.innerHTML = "<p>" + oData + "</p>";
73 }; 83 };
74 -  
75 var formatMais = function(elCell, oRecord, oColumn) 84 var formatMais = function(elCell, oRecord, oColumn)
76 { 85 {
77 elCell.innerHTML = "<div class=editar style='text-align:center' ></div>"; 86 elCell.innerHTML = "<div class=editar style='text-align:center' ></div>";
@@ -90,9 +99,7 @@ function montaTabela(dados) @@ -90,9 +99,7 @@ function montaTabela(dados)
90 myDataSource = new YAHOO.util.DataSource(dados); 99 myDataSource = new YAHOO.util.DataSource(dados);
91 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; 100 myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY;
92 myDataSource.responseSchema = 101 myDataSource.responseSchema =
93 - {  
94 - fields: ["id_ws","nome_ws","tipo_ws"]  
95 - }; 102 + {fields: ["id_ws","nome_ws","tipo_ws"]};
96 myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource); 103 myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource);
97 // Set up editing flow 104 // Set up editing flow
98 myDataTable.subscribe('cellClickEvent',function(ev) 105 myDataTable.subscribe('cellClickEvent',function(ev)
admin/php/admin.php
@@ -135,37 +135,6 @@ function verificaDuplicados($sql,$dbh) @@ -135,37 +135,6 @@ function verificaDuplicados($sql,$dbh)
135 return false; 135 return false;
136 } 136 }
137 /* 137 /*
138 -Function: verificaEditores  
139 -  
140 -Verifica se o usuário atual está cadastrado como editor  
141 -  
142 -Parametros:  
143 -  
144 -editores - array com a lista de editores  
145 -  
146 -Return:  
147 -  
148 -{string} - sim|nao  
149 -*/  
150 -function verificaEditores($editores)  
151 -{  
152 - if (strtolower($_SERVER['HTTP_HOST']) == "localhost")  
153 - {return "sim";}  
154 - $editor = "nao";  
155 - if($editores == ""){return $editor;}  
156 - foreach ($editores as $e)  
157 - {  
158 - //$e = gethostbyname($e);  
159 - $ip = "UNKNOWN";  
160 - if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");  
161 - else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");  
162 - else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");  
163 - else $ip = "UNKNOWN";  
164 - if ($e == $ip){$editor="sim";}  
165 - }  
166 - return $editor;  
167 -}  
168 -/*  
169 Function: exclui 138 Function: exclui
170 139
171 Exlcui um registro de uma tabela do banco de dados de administração 140 Exlcui um registro de uma tabela do banco de dados de administração
admin/php/identifica.php
@@ -64,7 +64,10 @@ switch (strtoupper($funcao)) @@ -64,7 +64,10 @@ switch (strtoupper($funcao))
64 {JSON} 64 {JSON}
65 */ 65 */
66 case "PEGAFUNCOES": 66 case "PEGAFUNCOES":
67 - $dados = pegaDados('SELECT * from i3geoadmin_identifica'); 67 + if(isset($id_i) && $id_i != "")
  68 + {$dados = pegaDados("SELECT * from i3geoadmin_identifica where id_i = $id_i ");}
  69 + else
  70 + {$dados = pegaDados('SELECT * from i3geoadmin_identifica');}
68 retornaJSON($dados); 71 retornaJSON($dados);
69 exit; 72 exit;
70 break; 73 break;
admin/php/webservices.php
@@ -64,7 +64,11 @@ switch (strtoupper($funcao)) @@ -64,7 +64,11 @@ switch (strtoupper($funcao))
64 {JSON} 64 {JSON}
65 */ 65 */
66 case "PEGAWS": 66 case "PEGAWS":
67 - retornaJSON(pegaDados('SELECT id_ws,nome_ws,tipo_ws from i3geoadmin_ws order by tipo_ws,nome_ws')); 67 + if(isset($tipows) && $tipows != "")
  68 + {$sql = "SELECT id_ws,nome_ws,tipo_ws from i3geoadmin_ws where tipo_ws = '".strtoupper($tipows)."' order by tipo_ws,nome_ws ";}
  69 + else
  70 + {$sql = "SELECT id_ws,nome_ws,tipo_ws from i3geoadmin_ws order by tipo_ws,nome_ws";}
  71 + retornaJSON(pegaDados($sql));
68 exit; 72 exit;
69 break; 73 break;
70 /* 74 /*
admin/php/xml.php
@@ -33,6 +33,18 @@ Arquivo: @@ -33,6 +33,18 @@ Arquivo:
33 33
34 i3geo/admin/php/xml.php 34 i3geo/admin/php/xml.php
35 */ 35 */
  36 +if(!function_exists("verificaEditores"))
  37 +{
  38 + if(isset($locaplic))
  39 + {include_once($locaplic."/classesphp/funcoes_gerais.php");}
  40 + else
  41 + {
  42 + if(file_exists("../../classesphp/funcoes_gerais.php"))
  43 + {
  44 + include_once("../../classesphp/funcoes_gerais.php");
  45 + }
  46 + }
  47 +}
36 /* 48 /*
37 Function: geraXmlSistemas (depreciado) 49 Function: geraXmlSistemas (depreciado)
38 50
@@ -762,19 +774,5 @@ function entity_decode($texto) @@ -762,19 +774,5 @@ function entity_decode($texto)
762 { 774 {
763 return html_entity_decode($texto); 775 return html_entity_decode($texto);
764 } 776 }
765 -function verificaEditores($editores)  
766 -{  
767 - $editor = "nao";  
768 - foreach ($editores as $e)  
769 - {  
770 - $e = gethostbyname($e);  
771 - $ip = "UNKNOWN";  
772 - if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");  
773 - else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");  
774 - else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");  
775 - else $ip = "UNKNOWN";  
776 - if ($e == $ip){$editor="sim";}  
777 - }  
778 - return $editor;  
779 -} 777 +
780 ?> 778 ?>
classesjs/classe_arvoredecamadas.js
@@ -817,11 +817,9 @@ i3GEO.arvoreDeCamadas = { @@ -817,11 +817,9 @@ i3GEO.arvoreDeCamadas = {
817 if(ltema.editorsql == "sim" || ltema.editorsql == "SIM") 817 if(ltema.editorsql == "sim" || ltema.editorsql == "SIM")
818 {i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t40"),$trad("t41"),'i3GEO.tema.dialogo.editorsql(\"'+ltema.name+'\")',node);} 818 {i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t40"),$trad("t41"),'i3GEO.tema.dialogo.editorsql(\"'+ltema.name+'\")',node);}
819 if(ltema.permitecomentario.toLowerCase() !== "nao" && i3GEO.arvoreDeTemas.OPCOESADICIONAIS.comentarios == true) 819 if(ltema.permitecomentario.toLowerCase() !== "nao" && i3GEO.arvoreDeTemas.OPCOESADICIONAIS.comentarios == true)
820 - {  
821 - i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t45"),$trad("t45"),'i3GEO.tema.dialogo.comentario(\"'+ltema.name+'\")',node);  
822 - }  
823 - if(i3GEO.arvoreDeTemas.OPCOESADICIONAIS.navegacaoDir == true)  
824 - {i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t44"),"<span style=color:red >"+$trad("t44")+"</span>",'i3GEO.tema.dialogo.salvaMapfile(\"'+ltema.name+'\")',node);} 820 + {i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t45"),$trad("t45"),'i3GEO.tema.dialogo.comentario(\"'+ltema.name+'\")',node);}
  821 + if(i3GEO.parametros.editor == "sim")
  822 + {i3GEO.arvoreDeCamadas.adicionaOpcaoTema($trad("t44"),"<span style=color:red title='Apenas usuários editores podem ver essa opção' >"+$trad("t44")+"</span>",'i3GEO.tema.dialogo.salvaMapfile(\"'+ltema.name+'\")',node);}
825 node.loadComplete(); 823 node.loadComplete();
826 }, 824 },
827 /* 825 /*
classesjs/classe_i3geo.js
@@ -116,6 +116,8 @@ i3GEO = { @@ -116,6 +116,8 @@ i3GEO = {
116 celularef {Numeric} - tamanho da célula do mapa de referência 116 celularef {Numeric} - tamanho da célula do mapa de referência
117 117
118 autenticadoopenid {sim|nao} - indica se o usuário foi autenticado em alguma rede social 118 autenticadoopenid {sim|nao} - indica se o usuário foi autenticado em alguma rede social
  119 +
  120 + editor {sim|nao} - indica se o usuário atual é um editor (administrador)
119 */ 121 */
120 parametros: { 122 parametros: {
121 mapexten: "", 123 mapexten: "",
classesjs/classe_janela.js
@@ -97,7 +97,7 @@ i3GEO.janela = { @@ -97,7 +97,7 @@ i3GEO.janela = {
97 /* 97 /*
98 Propriedade: ANTESFECHA 98 Propriedade: ANTESFECHA
99 99
100 - Lista com os nomes das funções que serão executadas após fechar a janela. 100 + Lista com os nomes das funções que serão executadas antes de fechar a janela.
101 101
102 Este é um array que pode ser modificado utilizando-se as funções javascript de 102 Este é um array que pode ser modificado utilizando-se as funções javascript de
103 manipulação de arrays. 103 manipulação de arrays.
classesphp/classe_menutemas.php
@@ -328,6 +328,7 @@ Array @@ -328,6 +328,7 @@ Array
328 { 328 {
329 error_reporting(0); 329 error_reporting(0);
330 include_once($this->locaplic."/admin/php/xml.php"); 330 include_once($this->locaplic."/admin/php/xml.php");
  331 +
331 $xmlsistemas = simplexml_load_string(geraXmlIdentifica(implode(" ",$this->perfil),$this->locaplic,$this->editores)); 332 $xmlsistemas = simplexml_load_string(geraXmlIdentifica(implode(" ",$this->perfil),$this->locaplic,$this->editores));
332 $sistemas = array(); 333 $sistemas = array();
333 foreach($xmlsistemas->FUNCAO as $s) 334 foreach($xmlsistemas->FUNCAO as $s)
classesphp/funcoes_gerais.php
@@ -2635,4 +2635,36 @@ function carregaquery($mapfile,$objlayer,$objmapa) @@ -2635,4 +2635,36 @@ function carregaquery($mapfile,$objlayer,$objmapa)
2635 } 2635 }
2636 return "nao"; 2636 return "nao";
2637 } 2637 }
  2638 +/*
  2639 +Function: verificaEditores
  2640 +
  2641 +Verifica se o usuário atual está cadastrado como editor
  2642 +
  2643 +Parametros:
  2644 +
  2645 +editores - array com a lista de editores
  2646 +
  2647 +Return:
  2648 +
  2649 +{string} - sim|nao
  2650 +*/
  2651 +function verificaEditores($editores)
  2652 +{
  2653 + if (strtolower($_SERVER['HTTP_HOST']) == "localhost")
  2654 + {return "sim";}
  2655 + $editor = "nao";
  2656 + if($editores == ""){return $editor;}
  2657 + foreach ($editores as $e)
  2658 + {
  2659 + //$e = gethostbyname($e);
  2660 + $ip = "UNKNOWN";
  2661 + if (getenv("HTTP_CLIENT_IP")) $ip = getenv("HTTP_CLIENT_IP");
  2662 + else if(getenv("HTTP_X_FORWARDED_FOR")) $ip = getenv("HTTP_X_FORWARDED_FOR");
  2663 + else if(getenv("REMOTE_ADDR")) $ip = getenv("REMOTE_ADDR");
  2664 + else $ip = "UNKNOWN";
  2665 + if ($e == $ip){$editor="sim";}
  2666 + }
  2667 + return $editor;
  2668 +}
  2669 +
2638 ?> 2670 ?>
2639 \ No newline at end of file 2671 \ No newline at end of file
classesphp/mapa_controle.php
@@ -223,6 +223,10 @@ Inicia o mapa, pegando os parâmetros necessários para a montagem inicial. @@ -223,6 +223,10 @@ Inicia o mapa, pegando os parâmetros necessários para a montagem inicial.
223 */ 223 */
224 case "INICIA": 224 case "INICIA":
225 include_once("mapa_inicia.php"); 225 include_once("mapa_inicia.php");
  226 + //
  227 + //a variável $editores vem do ms_configura.php
  228 + //
  229 + $editor = verificaEditores($editores);
226 iniciaMapa(); 230 iniciaMapa();
227 break; 231 break;
228 /* 232 /*
classesphp/mapa_inicia.php
@@ -98,7 +98,9 @@ Retorno: @@ -98,7 +98,9 @@ Retorno:
98 */ 98 */
99 function iniciaMapa() 99 function iniciaMapa()
100 { 100 {
101 - global $openid,$interfacePadrao,$mensagemInicia,$kmlurl,$tituloInstituicao,$tempo,$navegadoresLocais,$locaplic,$embedLegenda,$map_file,$mapext,$w,$h,$R_path,$locmapserv,$utilizacgi,$expoeMapfile,$interface; 101 + global $openid,$interfacePadrao,$mensagemInicia,$kmlurl,$tituloInstituicao,$tempo,$navegadoresLocais,$editor,$locaplic,$embedLegenda,$map_file,$mapext,$w,$h,$R_path,$locmapserv,$utilizacgi,$expoeMapfile,$interface;
  102 + if(!isset($editor) || empty($editor))
  103 + {$editor = "nao";}
102 if(!isset($kmlurl)) 104 if(!isset($kmlurl))
103 {$kmlurl = "";} 105 {$kmlurl = "";}
104 error_reporting(E_ALL); 106 error_reporting(E_ALL);
@@ -229,7 +231,7 @@ function iniciaMapa() @@ -229,7 +231,7 @@ function iniciaMapa()
229 {$nomer = ($imgo->imageurl).basename($nomer);} 231 {$nomer = ($imgo->imageurl).basename($nomer);}
230 $iref = $m->mapa->reference; 232 $iref = $m->mapa->reference;
231 $irefH = $iref->height; 233 $irefH = $iref->height;
232 - 234 + $res["editor"] = $editor;
233 $res["mapexten"] = $ext; 235 $res["mapexten"] = $ext;
234 $res["mapscale"] = $escalaMapa; 236 $res["mapscale"] = $escalaMapa;
235 $res["mapres"] = $m->mapa->resolution; 237 $res["mapres"] = $m->mapa->resolution;
classesphp/wscliente.php
@@ -430,7 +430,7 @@ function listaRSSws2() @@ -430,7 +430,7 @@ function listaRSSws2()
430 } 430 }
431 else 431 else
432 {$canali = simplexml_load_file($rss);} 432 {$canali = simplexml_load_file($rss);}
433 - $linhas[] = "<a href='".$endereco."' target=blank ><img src='imagens/rss.gif' /></a>####"; 433 + $linhas[] = "<a href='".$endereco."' target=blank ><img style='border:0px solid white' src='imagens/rss.gif' /></a>####";
434 //var_dump($canali); 434 //var_dump($canali);
435 foreach ($canali->channel->item as $item) 435 foreach ($canali->channel->item as $item)
436 { 436 {
@@ -512,10 +512,10 @@ function listaRSSwsARRAY() @@ -512,10 +512,10 @@ function listaRSSwsARRAY()
512 else 512 else
513 {$canali = simplexml_load_file($rss);} 513 {$canali = simplexml_load_file($rss);}
514 if($r != "") 514 if($r != "")
515 - $linhas["rss"] = "<a href='".$r."' target=blank ><img src='imagens/rss.gif' /></a>"; 515 + $linhas["rss"] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='imagens/rss.gif' /></a>";
516 else 516 else
517 { 517 {
518 - $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img src='imagens/rss.gif' /></a>"; 518 + $linhas["rss"] = "<a href='".$linkrss."' target=blank ><img style='border:0px solid white;' src='imagens/rss.gif' /></a>";
519 } 519 }
520 //var_dump($canali); 520 //var_dump($canali);
521 $canais = array(); 521 $canais = array();
@@ -555,7 +555,7 @@ function listaRSSws() @@ -555,7 +555,7 @@ function listaRSSws()
555 if ($rss) 555 if ($rss)
556 { 556 {
557 $erro = ""; 557 $erro = "";
558 - $linhas[] = "<a href='".$r."' target=blank ><img src='imagens/rss.gif' /></a>####"; 558 + $linhas[] = "<a href='".$r."' target=blank ><img style='border:0px solid white;' src='imagens/rss.gif' /></a>####";
559 foreach ( $rss->items as $item ) 559 foreach ( $rss->items as $item )
560 { 560 {
561 $linha[] = $item['title']; 561 $linha[] = $item['title'];
ferramentas/conectarwms/index.htm
@@ -68,24 +68,30 @@ body { @@ -68,24 +68,30 @@ body {
68 <script type="text/javascript" > 68 <script type="text/javascript" >
69 mensagemAjuda("men1",document.getElementById("men1").innerHTML) 69 mensagemAjuda("men1",document.getElementById("men1").innerHTML)
70 mensagemAjuda("men2",document.getElementById("men2").innerHTML) 70 mensagemAjuda("men2",document.getElementById("men2").innerHTML)
71 -g_RSSwms = new Array("") 71 +if(window.parent.i3GEO.parametros.editor == "sim"){
  72 + var temp = "<p><a href='#' style='color:red' onclick='abrejanelaIframe()' title='Opção visível apenas para usuários editores'>Editar a lista de endereços dos serviços</a></p>";
  73 + document.getElementById("opc1").innerHTML += temp;
  74 +}
72 75
73 -aguarde("block")  
74 -//g_locaplic = window.parent.i3GEO.configura.locaplic;  
75 -if (document.getElementById("RSSwms"))  
76 -{  
77 - if (g_RSSwms.length > 0) 76 +iniciaListaWS()
  77 +function iniciaListaWS(){
  78 + g_RSSwms = new Array("")
  79 + aguarde("block")
  80 + //g_locaplic = window.parent.i3GEO.configura.locaplic;
  81 + if (document.getElementById("RSSwms"))
78 { 82 {
79 - var p = g_locaplic+"/classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss="+g_RSSwms.join("|")+"&tipo=WMS";  
80 - var cp = new cpaint();  
81 - //cp.set_debug(2)  
82 - cp.set_response_type("JSON");  
83 - cp.call(p,"listaRSSwsARRAY",mostraRetornowmsRSS); 83 + if (g_RSSwms.length > 0)
  84 + {
  85 + var p = g_locaplic+"/classesphp/wscliente.php?funcao=listaRSSwsARRAY&rss="+g_RSSwms.join("|")+"&tipo=WMS";
  86 + var cp = new cpaint();
  87 + //cp.set_debug(2)
  88 + cp.set_response_type("JSON");
  89 + cp.call(p,"listaRSSwsARRAY",mostraRetornowmsRSS);
  90 + }
84 } 91 }
85 } 92 }
86 function mostraRetornowmsRSS(retorno) 93 function mostraRetornowmsRSS(retorno)
87 { 94 {
88 -  
89 var reg = /Erro/gi; 95 var reg = /Erro/gi;
90 if (retorno.data.rss.search(reg) != -1) 96 if (retorno.data.rss.search(reg) != -1)
91 { 97 {
ferramentas/conectarwms/index.js
@@ -250,7 +250,7 @@ function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag) @@ -250,7 +250,7 @@ function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag)
250 { 250 {
251 var retorno = function(retorno) 251 var retorno = function(retorno)
252 { 252 {
253 - aguarde("none") 253 + aguarde("none");
254 if(retorno.data != "ok") 254 if(retorno.data != "ok")
255 {alert("Ooops! Problemas ao acessar o serviço.");aguarde("none");} 255 {alert("Ooops! Problemas ao acessar o serviço.");aguarde("none");}
256 else 256 else
@@ -264,4 +264,22 @@ function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag) @@ -264,4 +264,22 @@ function seltema(tipo,tema,legenda,nometema,nomecamada,sldflag)
264 cp.set_response_type("JSON"); 264 cp.set_response_type("JSON");
265 cp.call(p,"adicionatemawms",retorno); 265 cp.call(p,"adicionatemawms",retorno);
266 } 266 }
  267 +}
  268 +/*
  269 +Function abrejanelaIframe
  270 +
  271 +Abre uma janela flutuante contendo um iframe
  272 +
  273 +Parametros:
  274 +
  275 +w {string} - largura
  276 +
  277 +h {string} - altura
  278 +
  279 +s {string} - src do iframe
  280 +*/
  281 +function abrejanelaIframe(){
  282 + var s = window.parent.i3GEO.configura.locaplic+"/admin/html/webservices.html?tipo=wms";
  283 + var janelaeditor = window.parent.i3GEO.janela.cria("1000","500",s,parseInt(Math.random()*100,10),10,s,"janela"+window.parent.i3GEO.util.randomRGB(),false);
  284 + YAHOO.util.Event.addListener(janelaeditor[0].close, "click", iniciaListaWS,janelaeditor[0].panel,{id:janelaeditor[0].id},true);
267 } 285 }
268 \ No newline at end of file 286 \ No newline at end of file
ferramentas/identifica/index.js.php
@@ -124,6 +124,9 @@ i3GEOF.identifica = { @@ -124,6 +124,9 @@ i3GEOF.identifica = {
124 i3GEOF.identifica.y = y; 124 i3GEOF.identifica.y = y;
125 i3GEOF.identifica.mostraLinkGeohack = mostraLinkGeohack; 125 i3GEOF.identifica.mostraLinkGeohack = mostraLinkGeohack;
126 i3GEOF.identifica.mostraSistemasAdicionais = mostraSistemasAdicionais; 126 i3GEOF.identifica.mostraSistemasAdicionais = mostraSistemasAdicionais;
  127 + //se o usuário for editor, força mostrar a lista de sistemas
  128 + if(i3GEO.parametros.editor == "sim")
  129 + {i3GEOF.identifica.mostraSistemasAdicionais == true;}
127 i3GEO.guias.mostraGuiaFerramenta("i3GEOidentificaguia1","i3GEOidentificaguia"); 130 i3GEO.guias.mostraGuiaFerramenta("i3GEOidentificaguia1","i3GEOidentificaguia");
128 //eventos das guias 131 //eventos das guias
129 $i("i3GEOidentificaguia1").onclick = function(){i3GEOF.identifica.listaTemas("ligados");i3GEO.guias.mostraGuiaFerramenta("i3GEOidentificaguia1","i3GEOidentificaguia");}; 132 $i("i3GEOidentificaguia1").onclick = function(){i3GEOF.identifica.listaTemas("ligados");i3GEO.guias.mostraGuiaFerramenta("i3GEOidentificaguia1","i3GEOidentificaguia");};
@@ -148,15 +151,18 @@ i3GEOF.identifica = { @@ -148,15 +151,18 @@ i3GEOF.identifica = {
148 // 151 //
149 //verifica se existem sistemas para identificar 152 //verifica se existem sistemas para identificar
150 // 153 //
151 - if(i3GEOF.identifica.mostraSistemasAdicionais === true){  
152 - var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=pegaSistemasIdentificacao&g_sid="+i3GEO.configura.sid;  
153 - cpJSON.call(p,"foo",i3GEOF.identifica.montaListaSistemas);  
154 - } 154 + i3GEOF.identifica.atualizaSistemas();
155 if (i3GEO.temaAtivo !== "") 155 if (i3GEO.temaAtivo !== "")
156 {i3GEOF.identifica.buscaDadosTema(i3GEO.temaAtivo);} 156 {i3GEOF.identifica.buscaDadosTema(i3GEO.temaAtivo);}
157 } 157 }
158 catch(erro){alert(erro);} 158 catch(erro){alert(erro);}
159 }, 159 },
  160 + atualizaSistemas: function(){
  161 + if(i3GEOF.identifica.mostraSistemasAdicionais === true){
  162 + var p = i3GEO.configura.locaplic+"/classesphp/mapa_controle.php?funcao=pegaSistemasIdentificacao&g_sid="+i3GEO.configura.sid;
  163 + cpJSON.call(p,"foo",i3GEOF.identifica.montaListaSistemas);
  164 + }
  165 + },
160 /* 166 /*
161 Function: criaJanelaFlutuante 167 Function: criaJanelaFlutuante
162 168
@@ -416,7 +422,12 @@ i3GEOF.identifica = { @@ -416,7 +422,12 @@ i3GEOF.identifica = {
416 422
417 } 423 }
418 if(divins){ 424 if(divins){
419 - divins.innerHTML = "<table class='lista2' >"+linhas+"</table>"; 425 + if(i3GEO.parametros.editor == "sim"){
  426 + temp = "<p class=paragrafo ><a href='#' title='Opção visível apenas para quem é editor' style=color:red onclick=\"i3GEOF.identifica.abrejanelaIframe('1050','500','"+i3GEO.configura.locaplic+"/admin/html/identifica.html');\" >Editar a lista de sistemas adicionais</a></p>";
  427 + }
  428 + else
  429 + {temp = "";}
  430 + divins.innerHTML = temp+"<table class='lista2' >"+linhas+"</table>";
420 return; 431 return;
421 } 432 }
422 } 433 }
@@ -464,13 +475,34 @@ i3GEOF.identifica = { @@ -464,13 +475,34 @@ i3GEOF.identifica = {
464 if(target === "target") 475 if(target === "target")
465 {window.open(exec);} 476 {window.open(exec);}
466 else { 477 else {
467 - i3GEO.janela.cria("500","500",exec,parseInt(Math.random()*100,10),10,exec,"janela"+i3GEO.util.randomRGB(),false); 478 + i3GEOF.identifica.abrejanelaIframe("500","500",exec);
468 } 479 }
469 var i = $i("i3GEOmarcaIdentifica"); 480 var i = $i("i3GEOmarcaIdentifica");
470 if(i) 481 if(i)
471 {i.style.display = "block";} 482 {i.style.display = "block";}
472 }, 483 },
473 /* 484 /*
  485 + Function abrejanelaIframe
  486 +
  487 + Abre uma janela flutuante contendo um iframe
  488 +
  489 + Parametros:
  490 +
  491 + w {string} - largura
  492 +
  493 + h {string} - altura
  494 +
  495 + s {string} - src do iframe
  496 + */
  497 + abrejanelaIframe: function(w,h,s){
  498 + var janelaeditor = i3GEO.janela.cria(w,h,s,parseInt(Math.random()*100,10),10,s,"janela"+i3GEO.util.randomRGB(),false);
  499 + var temp = function(){
  500 + i3GEOF.identifica.sistemasAdicionais = [];
  501 + i3GEOF.identifica.atualizaSistemas();
  502 + };
  503 + YAHOO.util.Event.addListener(janelaeditor[0].close, "click", temp,janelaeditor[0].panel,{id:janelaeditor[0].id},true);
  504 + },
  505 + /*
474 Function: mostraDadosTema 506 Function: mostraDadosTema
475 507
476 Mostra os dados obtidos de um ou mais temas. 508 Mostra os dados obtidos de um ou mais temas.