Commit 0d7294a06819bc74f085f99b1612827f694f022d
1 parent
bc9c15d8
Exists in
master
and in
7 other branches
--no commit message
Showing
2 changed files
with
120 additions
and
145 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,120 @@ |
| 1 | +YAHOO.namespace("example.container"); | |
| 2 | +function initMenu() | |
| 3 | +{ | |
| 4 | + core_ativaBotaoAdicionaLinha("../php/identifica.php?funcao=alterarFuncoes") | |
| 5 | + core_carregando("ativa"); | |
| 6 | + core_ativaPainelAjuda("ajuda","botaoAjuda"); | |
| 7 | + pegaFuncoes(); | |
| 8 | +} | |
| 9 | +function pegaFuncoes() | |
| 10 | +{ | |
| 11 | + core_pegaDados("buscando funções...","../php/identifica.php?funcao=pegaFuncoes","montaTabela") | |
| 12 | +} | |
| 13 | +function montaTabela(dados) | |
| 14 | +{ | |
| 15 | + YAHOO.example.InlineCellEditing = new function() | |
| 16 | + { | |
| 17 | + // Custom formatter for "address" column to preserve line breaks | |
| 18 | + var formatTexto = function(elCell, oRecord, oColumn, oData) | |
| 19 | + { | |
| 20 | + elCell.innerHTML = "<pre ><p>" + oData + "</pre>"; | |
| 21 | + }; | |
| 22 | + var formatSalva = function(elCell, oRecord, oColumn) | |
| 23 | + { | |
| 24 | + elCell.innerHTML = "<div class=aplicar style='text-align:center' onclick='gravaLinha(\""+oRecord._sId+"\")'></div>"; | |
| 25 | + }; | |
| 26 | + var formatExclui = function(elCell, oRecord, oColumn) | |
| 27 | + { | |
| 28 | + elCell.innerHTML = "<div class=excluir style='text-align:center' ></div>";//onclick='excluiLinha(\""+oRecord.getData("id_menu")+"\",\""+oRecord.getId()+"\")'></div>"; | |
| 29 | + }; | |
| 30 | + var myColumnDefs = [ | |
| 31 | + {key:"excluir",label:"excluir",formatter:formatExclui}, | |
| 32 | + {label:"salvar",formatter:formatSalva}, | |
| 33 | + {label:"id",key:"id_i", formatter:formatTexto}, | |
| 34 | + {label:"nome",resizeable:true,key:"nome_i", formatter:formatTexto, editor:"textbox"}, | |
| 35 | + {label:"publicado?",key:"publicado_i",editor:"radio" ,editorOptions:{radioOptions:["SIM","NAO"],disableBtns:false}}, | |
| 36 | + {label:"programa",resizeable:true,key:"abrir_i", formatter:formatTexto, editor:"textbox"}, | |
| 37 | + {label:"abrir como?",key:"target_i", formatter:formatTexto,editor:"dropdown" ,editorOptions:{dropdownOptions:["self","target"],disableBtns:false}} | |
| 38 | + ]; | |
| 39 | + myDataSource = new YAHOO.util.DataSource(dados); | |
| 40 | + myDataSource.responseType = YAHOO.util.DataSource.TYPE_JSARRAY; | |
| 41 | + myDataSource.responseSchema = | |
| 42 | + { | |
| 43 | + fields: ["publicado_i","abrir_i","id_i","nome_i","target_i"] | |
| 44 | + }; | |
| 45 | + myDataTable = new YAHOO.widget.DataTable("tabela", myColumnDefs, myDataSource); | |
| 46 | + // Set up editing flow | |
| 47 | + myDataTable.highlightEditableCell = function(oArgs) | |
| 48 | + { | |
| 49 | + var elCell = oArgs.target; | |
| 50 | + var column = myDataTable.getColumn(oArgs.target); | |
| 51 | + //if(column.editor != "null") | |
| 52 | + if(!YAHOO.lang.isNull(column.editor)) | |
| 53 | + { | |
| 54 | + YAHOO.util.Dom.addClass(elCell,'yui-dt-highlighted'); | |
| 55 | + } | |
| 56 | + }; | |
| 57 | + myDataTable.unhighlightEditableCell = function(oArgs) | |
| 58 | + { | |
| 59 | + var elCell = oArgs.target; | |
| 60 | + if(elCell.style.cursor="pointer") | |
| 61 | + { | |
| 62 | + YAHOO.util.Dom.removeClass(elCell,'yui-dt-highlighted'); | |
| 63 | + } | |
| 64 | + }; | |
| 65 | + myDataTable.subscribe("cellMouseoverEvent", myDataTable.highlightEditableCell); | |
| 66 | + myDataTable.subscribe("cellMouseoutEvent", myDataTable.unhighlightEditableCell); | |
| 67 | + myDataTable.subscribe('cellClickEvent',function(ev) | |
| 68 | + { | |
| 69 | + var target = YAHOO.util.Event.getTarget(ev); | |
| 70 | + var column = this.getColumn(target); | |
| 71 | + if(YAHOO.example.container.panelCK) | |
| 72 | + { | |
| 73 | + YAHOO.example.container.panelCK.destroy(); | |
| 74 | + YAHOO.example.container.panelCK = null; | |
| 75 | + } | |
| 76 | + if (column.key == 'excluir') | |
| 77 | + { | |
| 78 | + var record = this.getRecord(target); | |
| 79 | + excluiLinha(record.getData('id_i'),target); | |
| 80 | + } | |
| 81 | + else | |
| 82 | + { | |
| 83 | + this.onEventShowCellEditor(ev); | |
| 84 | + } | |
| 85 | + }); | |
| 86 | + // Hook into custom event to customize save-flow of "radio" editor | |
| 87 | + myDataTable.subscribe("editorUpdateEvent", function(oArgs) | |
| 88 | + { | |
| 89 | + if(oArgs.editor.column.key === "active") | |
| 90 | + { | |
| 91 | + this.saveCellEditor(); | |
| 92 | + | |
| 93 | + } | |
| 94 | + }); | |
| 95 | + myDataTable.subscribe("editorBlurEvent", function(oArgs) | |
| 96 | + { | |
| 97 | + this.cancelCellEditor(); | |
| 98 | + }); | |
| 99 | + }; | |
| 100 | + core_carregando("desativa"); | |
| 101 | +} | |
| 102 | +function gravaLinha(row) | |
| 103 | +{ | |
| 104 | + var r = myDataTable.getRecordSet().getRecord(row); | |
| 105 | + var publicado_i = r.getData("publicado_i"); | |
| 106 | + var abrir_i = r.getData("abrir_i") | |
| 107 | + var id_i = r.getData("id_i") | |
| 108 | + var nome_i = r.getData("nome_i") | |
| 109 | + var target_i = r.getData("target_i") | |
| 110 | + var mensagem = " gravando o registro do id= "+id_i | |
| 111 | + 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; | |
| 112 | + core_gravaLinha(mensagem,row,sUrl) | |
| 113 | +} | |
| 114 | +function excluiLinha(id,row) | |
| 115 | +{ | |
| 116 | + var mensagem = " excluindo o registro do id= "+id; | |
| 117 | + var sUrl = "../php/identifica.php?funcao=excluir&id="+id; | |
| 118 | + core_excluiLinha(sUrl,row,mensagem) | |
| 119 | +} | |
| 120 | +YAHOO.util.Event.addListener(window, "load", initMenu); | |
| 0 | 121 | \ No newline at end of file | ... | ... |
admin/js/identificaold.js
| ... | ... | @@ -1,145 +0,0 @@ |
| 1 | -/* | |
| 2 | -Title: Identifica | |
| 3 | - | |
| 4 | -Funções javascript utilizadas no sistema de administração do cadastro de sistemas da ferramenta identifica | |
| 5 | - | |
| 6 | -File: i3geo/admin/webservices.js | |
| 7 | - | |
| 8 | -About: Licença | |
| 9 | - | |
| 10 | -I3Geo Interface Integrada de Ferramentas de Geoprocessamento para Internet | |
| 11 | - | |
| 12 | -Direitos Autorais Reservados (c) 2006 Ministério do Meio Ambiente Brasil | |
| 13 | -Desenvolvedor: Edmar Moretti edmar.moretti@mma.gov.br | |
| 14 | - | |
| 15 | -Este programa é software livre; você pode redistribuí-lo | |
| 16 | -e/ou modificá-lo sob os termos da Licença Pública Geral | |
| 17 | -GNU conforme publicada pela Free Software Foundation; | |
| 18 | -tanto a versão 2 da Licença. | |
| 19 | -Este programa é distribuído na expectativa de que seja útil, | |
| 20 | -porém, SEM NENHUMA GARANTIA; nem mesmo a garantia implícita | |
| 21 | -de COMERCIABILIDADE OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. | |
| 22 | -Consulte a Licença Pública Geral do GNU para mais detalhes. | |
| 23 | -Você deve ter recebido uma cópia da Licença Pública Geral do | |
| 24 | -GNU junto com este programa; se não, escreva para a | |
| 25 | -Free Software Foundation, Inc., no endereço | |
| 26 | -59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. | |
| 27 | -*/ | |
| 28 | -/* | |
| 29 | -Function: iniciaAdmin | |
| 30 | - | |
| 31 | -Inicializa as variáveis globais e checa o cadastro do editor do sistema de administração | |
| 32 | - | |
| 33 | -Ao retornar, por default, executa a função montaParametros() | |
| 34 | -*/ | |
| 35 | -function iniciaAdmin() | |
| 36 | -{ | |
| 37 | - verificaEditores() | |
| 38 | -} | |
| 39 | -function montaParametros() | |
| 40 | -{ | |
| 41 | - if(!$i("resultado")) | |
| 42 | - {document.body.innerHTML += "<div id=resultado ></div>"} | |
| 43 | - $i("resultado").innerHTML = $mensagemAguarde | |
| 44 | - var p = "../php/identifica.php?funcao=pegaFuncoes"; | |
| 45 | - cPaint.call(p,"",listaFuncoes); | |
| 46 | -} | |
| 47 | -/* | |
| 48 | -Function: listaFuncoes | |
| 49 | - | |
| 50 | -Monta o html com os parametros e os divs que receberão os dados dos formulários. | |
| 51 | -*/ | |
| 52 | -function listaFuncoes(retorno) | |
| 53 | -{ | |
| 54 | - ins = "<p><input style=font-size:10px onclick='alterarFuncoes(\"\",\"resultado\")' type=button value='Adicionar uma nova função' /></p>" | |
| 55 | - montaFuncoes(retorno,"resultado") | |
| 56 | - | |
| 57 | -} | |
| 58 | -function montaFuncoes(retorno,onde) | |
| 59 | -{ | |
| 60 | - var d = retorno.data; | |
| 61 | - var nm = retorno.data.length | |
| 62 | - for (i=0;i<nm;i++) | |
| 63 | - { | |
| 64 | - if(!$i(d[i].id_i)) | |
| 65 | - {ins += "<div id='"+d[i].id_i+"' >"} | |
| 66 | - ins += "<fieldset><legend style='background-color:white;'><b>+- "+d[i].nome_i+"</b></legend>" | |
| 67 | - ins += "<div style=display:none ><table class=lista ><tr><td></td><td></td></tr>"; | |
| 68 | - var param = { | |
| 69 | - "linhas":[ | |
| 70 | - {titulo:"Nome",prefixoid:"nome_",id:"id_i",valor:"nome_i"}, | |
| 71 | - {titulo:"Destino",prefixoid:"destino_",id:"id_i",valor:"target_i"}, | |
| 72 | - {titulo:"Programa",prefixoid:"abrir_",id:"id_i",valor:"abrir_i"} | |
| 73 | - ] | |
| 74 | - } | |
| 75 | - ins += (geraLinhas(d[i],param,2)); | |
| 76 | - | |
| 77 | - ins += "<tr>" | |
| 78 | - ins += "<td>Publicado: </td>" | |
| 79 | - ins += "<td><select onchange=this.style.color='blue' id='publicado_"+d[i].id_i+"' >" | |
| 80 | - ins += combosimnao(d[i].publicado_i) | |
| 81 | - ins += "</td></tr>" | |
| 82 | - | |
| 83 | - ins += "</table>" | |
| 84 | - ins += "<table><tr><td><div class=excluir title='Excluir' onclick='excluir(\""+d[i].id_i+"\")'/></td>" | |
| 85 | - ins += "<td><div class=aplicar title='Aplicar alterações' onclick='alterarFuncoes(\""+d[i].id_i+"\",\""+d[i].id_i+"\")'/></td>" | |
| 86 | - ins += "</tr></table>" | |
| 87 | - ins += "</div></fieldset><br>" | |
| 88 | - if(!$i(d[i].id_i)) | |
| 89 | - ins += "</div>" | |
| 90 | - } | |
| 91 | - $i(onde).innerHTML = ins | |
| 92 | - ativaLegenda() | |
| 93 | -} | |
| 94 | - | |
| 95 | -function alterarFuncoes(id,onde) | |
| 96 | -{ | |
| 97 | - //if(confirm("Você realmente quer fazer isso?")) | |
| 98 | - //{ | |
| 99 | - var retorna = function(retorno) | |
| 100 | - { | |
| 101 | - if(id == "") | |
| 102 | - listaFuncoes(retorno); | |
| 103 | - else | |
| 104 | - {ins = "";montaFuncoes(retorno,onde)} | |
| 105 | - } | |
| 106 | - if (id != "") | |
| 107 | - { | |
| 108 | - var nome = $i("nome_"+id).value | |
| 109 | - var destino = $i("destino_"+id).value | |
| 110 | - var abrir = $i("abrir_"+id).value | |
| 111 | - var publicado = $i("publicado_"+id).value | |
| 112 | - } | |
| 113 | - else | |
| 114 | - { | |
| 115 | - var id = ""; | |
| 116 | - var destino = "" | |
| 117 | - var abrir = "" | |
| 118 | - var nome = "" | |
| 119 | - var publicado = "" | |
| 120 | - } | |
| 121 | - var p = "../php/identifica.php?funcao=alterarFuncoes&publicado_i="+publicado+"&id_i="+id+"&nome_i="+nome+"&target_i="+destino+"&abrir_i="+abrir | |
| 122 | - cPaint.call(p,"",retorna); | |
| 123 | - //} | |
| 124 | -} | |
| 125 | -function excluir(id) | |
| 126 | -{ | |
| 127 | - if(confirm("Você realmente quer fazer isso?")) | |
| 128 | - { | |
| 129 | - $i("resultado").innerHTML = $mensagemAguarde; | |
| 130 | - var retorna = function() | |
| 131 | - { | |
| 132 | - montaParametros() | |
| 133 | - } | |
| 134 | - var p = "../php/identifica.php?funcao=excluir&id="+id; | |
| 135 | - cPaint.call(p,"",retorna); | |
| 136 | - } | |
| 137 | -} | |
| 138 | -function importarXmlI() | |
| 139 | -{ | |
| 140 | - $i("resultado").innerHTML = $mensagemAguarde | |
| 141 | - var retorna = function(retorno) | |
| 142 | - {$i("resultado").innerHTML = retorno.data} | |
| 143 | - var p = "../php/identifica.php?funcao=importarXmlI&xml="+$i("arquivo").value; | |
| 144 | - cPaint.call(p,"",retorna); | |
| 145 | -} | |
| 146 | 0 | \ No newline at end of file |