Commit d372e6289e5938f9110e00efbe29e9cf1882a8ff

Authored by Edmar Moretti
1 parent 0e94bce8

Adaptação do editor de menus para bootstrap

admin/admin.db
No preview for this file type
admin1/catalogo/menus/grupos/subgrupos/exec.php
@@ -136,7 +136,7 @@ function alterar($id_n2, $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $ @@ -136,7 +136,7 @@ function alterar($id_n2, $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $
136 } 136 }
137 return $id_n2; 137 return $id_n2;
138 } 138 }
139 -function excluir($id_n1, $dbhw) { 139 +function excluir($id_n2, $dbhw) {
140 global $esquemaadmin; 140 global $esquemaadmin;
141 $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geoadmin_n2", "id_n2", $id_n2, $dbhw, false ); 141 $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geoadmin_n2", "id_n2", $id_n2, $dbhw, false );
142 if ($resultado === false) { 142 if ($resultado === false) {
admin1/catalogo/menus/grupos/subgrupos/temas/exec.php
@@ -47,7 +47,7 @@ include (dirname ( __FILE__ ) . "/../../../../../../admin/php/conexao.php"); @@ -47,7 +47,7 @@ include (dirname ( __FILE__ ) . "/../../../../../../admin/php/conexao.php");
47 $funcao = strtoupper ( $funcao ); 47 $funcao = strtoupper ( $funcao );
48 switch ($funcao) { 48 switch ($funcao) {
49 case "ADICIONAR" : 49 case "ADICIONAR" :
50 - $novo = adicionar( $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $dbhw ); 50 + $novo = adicionar( $id_tema, $id_n2, $publicado, $n3_perfil, $ordem, $dbhw );
51 if ($novo === false) { 51 if ($novo === false) {
52 header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); 52 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
53 exit (); 53 exit ();
@@ -55,12 +55,12 @@ switch ($funcao) { @@ -55,12 +55,12 @@ switch ($funcao) {
55 exit (); 55 exit ();
56 break; 56 break;
57 case "ALTERAR" : 57 case "ALTERAR" :
58 - $novo = alterar ( $id_n2, $id_subgrupo, $id_menu, $publicado, $n2_perfil, $ordem, $dbhw ); 58 + $novo = alterar ( $id_n3, $id_tema, $id_n2, $publicado, $n3_perfil, $ordem, $dbhw );
59 if ($novo === false) { 59 if ($novo === false) {
60 header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); 60 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
61 exit (); 61 exit ();
62 } 62 }
63 - $dados = pegaDados ( "SELECT id_n2 from ".$esquemaadmin."i3geoadmin_n2 WHERE id_n2 = $id_n2", $dbh, false ); 63 + $dados = pegaDados ( "SELECT id_n3 from ".$esquemaadmin."i3geoadmin_n3 WHERE id_n3 = $id_n3", $dbh, false );
64 64
65 if ($dados === false) { 65 if ($dados === false) {
66 header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); 66 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
@@ -85,58 +85,53 @@ switch ($funcao) { @@ -85,58 +85,53 @@ switch ($funcao) {
85 retornaJSON($temassubgrupo); 85 retornaJSON($temassubgrupo);
86 break; 86 break;
87 case "EXCLUIR" : 87 case "EXCLUIR" :
88 - $r = pegaDados("SELECT id_n3 from ".$esquemaadmin."i3geoadmin_n3 where id_n2 ='$id'");  
89 - if(count($r) > 0){  
90 - header ( "HTTP/1.1 500 erro ao excluir. Exclua os subgrupos primeiro" );  
91 - exit ();  
92 - }  
93 - $retorna = excluir ( $id_n2, $dbhw ); 88 + $retorna = excluir ( $id_n3, $dbhw );
94 $dbhw = null; 89 $dbhw = null;
95 $dbh = null; 90 $dbh = null;
96 if ($retorna === false) { 91 if ($retorna === false) {
97 header ( "HTTP/1.1 500 erro ao consultar banco de dados" ); 92 header ( "HTTP/1.1 500 erro ao consultar banco de dados" );
98 exit (); 93 exit ();
99 } 94 }
100 - retornaJSON ( $id_n2 ); 95 + retornaJSON ( $id_n3 );
101 exit (); 96 exit ();
102 break; 97 break;
103 } 98 }
104 cpjson ( $retorno ); 99 cpjson ( $retorno );
105 100
106 -function adicionar( $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $dbhw) { 101 +function adicionar( $id_tema, $id_n2, $publicado, $n3_perfil, $ordem, $dbhw) {
107 global $esquemaadmin; 102 global $esquemaadmin;
108 try { 103 try {
109 $dataCol = array( 104 $dataCol = array(
110 - "id_n1" => $id_n1, 105 + "id_n2" => $id_n2,
111 "publicado" => 'NAO', 106 "publicado" => 'NAO',
112 "ordem" => 0, 107 "ordem" => 0,
113 - "n2_perfil" => '' 108 + "n3_perfil" => ''
114 ); 109 );
115 - $id_n2 = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_n2",$dataCol,"n2_perfil","id_n2");  
116 - $retorna = alterar ( $id_n2, $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $dbhw ); 110 + $id_n3 = i3GeoAdminInsertUnico($dbhw,"i3geoadmin_n3",$dataCol,"n3_perfil","id_n3");
  111 + $retorna = alterar ( $id_n3, $id_tema, $id_n2, $publicado, $n3_perfil, $ordem, $dbhw );
117 return $retorna; 112 return $retorna;
118 } catch ( PDOException $e ) { 113 } catch ( PDOException $e ) {
119 return false; 114 return false;
120 } 115 }
121 } 116 }
122 // $papeis deve ser um array 117 // $papeis deve ser um array
123 -function alterar($id_n2, $id_subgrupo, $id_n1, $publicado, $n2_perfil, $ordem, $dbhw) { 118 +function alterar($id_n3, $id_tema, $id_n2, $publicado, $n3_perfil, $ordem, $dbhw) {
124 global $esquemaadmin; 119 global $esquemaadmin;
125 $dataCol = array( 120 $dataCol = array(
126 "publicado" => $publicado, 121 "publicado" => $publicado,
127 - "id_subgrupo" => $id_subgrupo, 122 + "id_tema" => $id_tema,
128 "ordem" => $ordem, 123 "ordem" => $ordem,
129 - "n2_perfil" => $n2_perfil 124 + "n3_perfil" => $n3_perfil
130 ); 125 );
131 - $resultado = i3GeoAdminUpdate($dbhw,"i3geoadmin_n2",$dataCol,"WHERE id_n2 = $id_n2"); 126 + $resultado = i3GeoAdminUpdate($dbhw,"i3geoadmin_n3",$dataCol,"WHERE id_n3 = $id_n3");
132 if ($resultado === false) { 127 if ($resultado === false) {
133 return false; 128 return false;
134 } 129 }
135 - return $id_n2; 130 + return $id_n3;
136 } 131 }
137 -function excluir($id_n1, $dbhw) { 132 +function excluir($id_n3, $dbhw) {
138 global $esquemaadmin; 133 global $esquemaadmin;
139 - $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geoadmin_n2", "id_n2", $id_n2, $dbhw, false ); 134 + $resultado = i3GeoAdminExclui ( $esquemaadmin . "i3geoadmin_n3", "id_n3", $id_n3, $dbhw, false );
140 if ($resultado === false) { 135 if ($resultado === false) {
141 return false; 136 return false;
142 } 137 }
admin1/catalogo/menus/grupos/subgrupos/temas/index.js
@@ -51,6 +51,19 @@ i3GEOadmin.temas = { @@ -51,6 +51,19 @@ i3GEOadmin.temas = {
51 "{{#data}}" + $("#templateOpcoesPerfil").html() + "{{/data}}", 51 "{{#data}}" + $("#templateOpcoesPerfil").html() + "{{/data}}",
52 {"data":json["perfis"]} 52 {"data":json["perfis"]}
53 ); 53 );
  54 + //valor do filtro atual
  55 + var filtro = i3GEOadmin.core.valorFiltro();
  56 + //filtro
  57 + html = Mustache.to_html(
  58 + "{{#data}}" + $("#templateFiltro").html() + "{{/data}}",
  59 + {"data":json["dados"]}
  60 + );
  61 + $("#filtro").html("<option value='' >Todos</option>" + html);
  62 + $("#filtro").combobox();
  63 + if(filtro != ""){
  64 + i3GEOadmin.core.defineFiltro(filtro);
  65 + i3GEOadmin.core.filtra(i3GEOadmin.core.pegaFiltro());
  66 + }
54 i3GEOadmin.temas.listaTemas(json["dados"],opcoesPerfil,json["temas"]); 67 i3GEOadmin.temas.listaTemas(json["dados"],opcoesPerfil,json["temas"]);
55 $.material.init(); 68 $.material.init();
56 } 69 }
@@ -101,19 +114,19 @@ i3GEOadmin.temas = { @@ -101,19 +114,19 @@ i3GEOadmin.temas = {
101 i3GEOadmin.temas.onde.html(html); 114 i3GEOadmin.temas.onde.html(html);
102 115
103 //monta um template para o modal de inclusao de novo tema 116 //monta um template para o modal de inclusao de novo tema
104 - if(i3GEOadmin.temas.formAdicionaRaiz == ""){ 117 + if(i3GEOadmin.temas.formAdiciona == ""){
105 html = Mustache.to_html( 118 html = Mustache.to_html(
106 - $("#templateRaiz").html(), 119 + $("#templateTemas").html(),
107 $.extend( 120 $.extend(
108 {}, 121 {},
109 i3GEOadmin.temas.dicionario, 122 i3GEOadmin.temas.dicionario,
110 { 123 {
111 - "id_raiz": "modal", 124 + "id_n3": "modal",
112 "escondido": "hidden", 125 "escondido": "hidden",
113 "opcoesPerfil": opcoesPerfil, 126 "opcoesPerfil": opcoesPerfil,
114 "excluir": i3GEOadmin.temas.dicionario.cancelar, 127 "excluir": i3GEOadmin.temas.dicionario.cancelar,
115 "onExcluir": "i3GEOadmin.core.fechaModalGeral",//funcao 128 "onExcluir": "i3GEOadmin.core.fechaModalGeral",//funcao
116 - "onSalvar": "i3GEOadmin.temas.adicionaTemaRaiz",//funcao 129 + "onSalvar": "i3GEOadmin.temas.adicionaTema",//funcao
117 "opcoesTema": function(){ 130 "opcoesTema": function(){
118 var html = '<option value="">---</option>' + Mustache.to_html( 131 var html = '<option value="">---</option>' + Mustache.to_html(
119 "{{#data}}" + $("#templateOpcoesTema").html() + "{{/data}}", 132 "{{#data}}" + $("#templateOpcoesTema").html() + "{{/data}}",
@@ -124,26 +137,26 @@ i3GEOadmin.temas = { @@ -124,26 +137,26 @@ i3GEOadmin.temas = {
124 } 137 }
125 ) 138 )
126 ); 139 );
127 - i3GEOadmin.temas.formAdicionaRaiz = html; 140 + i3GEOadmin.temas.formAdiciona = html;
128 } 141 }
129 }, 142 },
130 adicionaTemaDialogo: function(){ 143 adicionaTemaDialogo: function(){
131 - i3GEOadmin.core.abreModalGeral(i3GEOadmin.temas.formAdicionaRaiz);  
132 - $("#body-formRaiz-modal").collapse('show'); 144 + i3GEOadmin.core.abreModalGeral(i3GEOadmin.temas.formAdiciona);
  145 + $("#body-form-modal").collapse('show');
133 }, 146 },
134 // os parametros sao obtidos do formulario aberto do modal 147 // os parametros sao obtidos do formulario aberto do modal
135 adicionaTema: function(){ 148 adicionaTema: function(){
136 - var parametros = $("#formRaiz-modal form").serialize(); 149 + var parametros = $("#form-modal form").serialize();
137 i3GEOadmin.core.fechaModalGeral(); 150 i3GEOadmin.core.fechaModalGeral();
138 i3GEOadmin.core.modalAguarde(true); 151 i3GEOadmin.core.modalAguarde(true);
139 $.post( 152 $.post(
140 - "execraiz.php?funcao=adicionar",  
141 - parametros + "&id_menu=" + i3GEOadmin.temas.id_menu + "&id_n1=" + i3GEOadmin.temas.id_n1 153 + "exec.php?funcao=adicionar",
  154 + parametros + "&id_menu=" + i3GEOadmin.temas.id_menu + "&id_n2=" + i3GEOadmin.temas.id_n2
142 ) 155 )
143 .done( 156 .done(
144 function(data, status){ 157 function(data, status){
145 i3GEOadmin.core.modalAguarde(false); 158 i3GEOadmin.core.modalAguarde(false);
146 - i3GEOadmin.core.iconeAguarde(i3GEOadmin.temas.ondeRaiz); 159 + i3GEOadmin.core.iconeAguarde(i3GEOadmin.temas.onde);
147 i3GEOadmin.temas.lista(); 160 i3GEOadmin.temas.lista();
148 } 161 }
149 ) 162 )
@@ -167,14 +180,14 @@ i3GEOadmin.temas = { @@ -167,14 +180,14 @@ i3GEOadmin.temas = {
167 excluirTema: function(id){ 180 excluirTema: function(id){
168 i3GEOadmin.core.modalAguarde(true); 181 i3GEOadmin.core.modalAguarde(true);
169 $.post( 182 $.post(
170 - "execraiz.php?funcao=excluir",  
171 - "id_raiz=" + id + "&id_menu=" + i3GEOadmin.temas.id_menu 183 + "exec.php?funcao=excluir",
  184 + "id_n3=" + id
172 ) 185 )
173 .done( 186 .done(
174 function(data, status){ 187 function(data, status){
175 i3GEOadmin.core.modalAguarde(false); 188 i3GEOadmin.core.modalAguarde(false);
176 var json = jQuery.parseJSON(data)*1; 189 var json = jQuery.parseJSON(data)*1;
177 - $("#formRaiz-" + json).remove(); 190 + $("#form-" + json).remove();
178 } 191 }
179 ) 192 )
180 .fail( 193 .fail(
@@ -195,17 +208,17 @@ i3GEOadmin.temas = { @@ -195,17 +208,17 @@ i3GEOadmin.temas = {
195 i3GEOadmin.core.abreModalConfirma(hash); 208 i3GEOadmin.core.abreModalConfirma(hash);
196 }, 209 },
197 salvarTema: function(id){ 210 salvarTema: function(id){
198 - var parametros = $("#formRaiz-" + id + " form").serialize(); 211 + var parametros = $("#form-" + id + " form").serialize();
199 i3GEOadmin.core.fechaModalGeral(); 212 i3GEOadmin.core.fechaModalGeral();
200 i3GEOadmin.core.modalAguarde(true); 213 i3GEOadmin.core.modalAguarde(true);
201 $.post( 214 $.post(
202 - "execraiz.php?funcao=alterar",  
203 - "id_raiz="+ id + "&"+parametros + "&id_menu=" + i3GEOadmin.temas.id_menu 215 + "exec.php?funcao=alterar",
  216 + "id_n3="+ id + "&"+parametros + "&id_menu=" + i3GEOadmin.temas.id_menu
204 ) 217 )
205 .done( 218 .done(
206 function(data, status){ 219 function(data, status){
207 i3GEOadmin.core.modalAguarde(false); 220 i3GEOadmin.core.modalAguarde(false);
208 - i3GEOadmin.core.iconeAguarde(i3GEOadmin.temas.ondeRaiz); 221 + i3GEOadmin.core.iconeAguarde(i3GEOadmin.temas.onde);
209 i3GEOadmin.temas.lista(); 222 i3GEOadmin.temas.lista();
210 } 223 }
211 ) 224 )