1'use strict'; 2 3/** 4 * @ngdoc function 5 * @name minovateApp.controller: MainCtrl and HomeCtrl 6 * @description 7 * # Página mãe e inicial 8 * Controller of the portalgovApp 9 */ 10angular.module('portalgovApp') 11 .controller('MainCtrl', function ($scope, $modal, $http, $state) { 12 13 $http({method: 'POST', url: '../controllers/config/class_config.php', data: $.param({func:'8'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }). 14 then(function(response) { 15 var r=response.data; 16 $scope.page = { 17 titulo_init: '', 18 cidade: r[0].cidade, 19 endereco: r[0].endereco, 20 bairro: r[0].bairro, 21 cep: r[0].cep, 22 telefone: r[0].telefone, 23 email: r[0].email, 24 foto: r[0].foto_brazao, 25 expediente: r[0].expediente 26 }; 27 }); 28 29 $http({method: 'POST', url: '../controllers/categoria_menu/class_categoria.php', data: $.param({func:'8', posicao: 'horizontal'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }). 30 then(function(response) { 31 var r=response.data; 32 $scope.menus_horizontal = r; 33 }); 34 35 $http({method: 'POST', url: '../controllers/categoria_menu/class_categoria.php', data: $.param({func:'8', posicao: 'vertical'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }). 36 then(function(response) { 37 var r=response.data; 38 $scope.menus_vertical = r; 39 }); 40 41 $http({method: 'POST', url: '../controllers/categoria_menu/class_categoria.php', data: $.param({func:'9'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }). 42 then(function(response) { 43 var r=response.data; 44 $scope.contextos = r; 45 }); 46 $scope.contexto_atual=localStorage.getItem("contexto"); 47 48 $scope.abre_link = function(id_contexto, link, tipo, nova){ 49 if(id_contexto!=""){ 50 localStorage.setItem("contexto",id_contexto); 51 } 52 else{ 53 localStorage.setItem("contexto","0") 54 } 55 56 if(tipo=="externo"){ 57 if(nova=='nova'){ 58 window.open(link,"_blank"); 59 } 60 else{ 61 location.href=link; 62 63 } 64 } 65 if(tipo=="modulo1"){ 66 var url = $state.href('site.'+link, {parameter: "parameter"}); 67 location.href=url; 68 69 } 70 if(tipo=="modulo2"){ 71 var url = $state.href('site.pagina_view', {titulo: link.split('#')[0], id: link.split('#')[1], param: link.split('#')[2] }); 72 location.href=url; 73 } 74 }; 75 76 $scope.$state=$state; 77 78 }) 79 .controller('homeCtrl', function ($scope, $modal, $rootScope,MetaService, $window, $state) { 80 $rootScope.metaservice = MetaService; 81 $rootScope.metaservice.set("Página Inicial","",""); 82 83 $scope.busca_legislacoes_home = function(param){ 84 var descricao = document.getElementById('search_desc').value; 85 var tipo = document.getElementById('select_tipo_leg').value; 86 var numero = document.getElementById('search_num').value; 87 var data_pub =document.getElementById('data_pub').value; 88 var data_pub_2 =document.getElementById('data_pub_2').value; 89 90 if(descricao=="" && tipo=="0" && numero=="" && data_pub=="" && data_pub_2==""){ 91 bootbox.dialog({ 92 message: "Preencha algum campo para efetuar a busca!", 93 title: "Informação sobre a pesquisa", 94 buttons: { 95 main: { 96 label: "Ok", 97 className: "btn-primary", 98 } 99 } 100 }); 101 } 102 else{ 103 104 if(descricao==""){ 105 descricao="none"; 106 } 107 if(numero==""){ 108 numero="none"; 109 } 110 if(data_pub!="" && data_pub_2!=""){ 111 var data=data_pub.split("/"); 112 data_pub=data[2]+"-"+data[1]+"-"+data[0]; 113 data=data_pub_2.split("/"); 114 data_pub_2=data[2]+"-"+data[1]+"-"+data[0]; 115 116 } 117 if(data_pub==""){ 118 data_pub="none"; 119 } 120 if(data_pub_2==""){ 121 data_pub_2="none"; 122 } 123 124 $window.location.href="/site/legislacao/"+descricao+"/"+tipo+"/"+numero+"/"+data_pub+"/"+data_pub_2; 125 } 126 127 }; 128 129 $scope.abre_link = function(id_contexto, link, tipo, nova){ 130 if(id_contexto!=""){
131 localStorage.setItem("contexto",id_contexto); 132 } 133 else{ 134 localStorage.setItem("contexto","0") 135 } 136 137 if(tipo=="externo"){ 138 if(nova=='nova'){ 139 window.open(link,"_blank"); 140 } 141 else{ 142 location.href=link; 143 144 } 145 } 146 if(tipo=="modulo1"){ 147 var url = $state.href('site.'+link, {parameter: "parameter"}); 148 location.href=url; 149 150 } 151 if(tipo=="modulo2"){ 152 var url = $state.href('site.pagina_view', {titulo: link.split('#')[0], id: link.split('#')[1], param: link.split('#')[2] }); 153 location.href=url; 154 } 155 }; 156 157 }) 158 .controller('arquivo_viewCtrl', function ($scope, $modal, $rootScope,MetaService, $stateParams, $http) { 159 var tipo=$stateParams.tipo; 160 var nome=$stateParams.nome; 161 162 $http({method: 'POST', url: 'config_general.php', data: $.param({function:'1'}), headers: {'Content-Type': 'application/x-www-form-urlencoded'} }). 163 then(function(response) { 164 var r=response.data; 165 $scope.base_url = r; 166 location.href=$scope.base_url+"arquivos/"+tipo+"/"+nome; 167 }); 168 169 }) 170 .controller('DatepickerDemoCtrl', function ($scope) { 171 172 $scope.today = function() { 173 /*$scope.dt = (new Date()).getDate()+"/"+( ((new Date()).getMonth()+1)<10 ? '0'+((new Date()).getMonth()+1) : ((new Date()).getMonth()+1) )+"/"+(new Date()).getFullYear();*/ 174 $scope.dt =""; 175 }; 176 177 $scope.today(); 178 179 $scope.clear = function () { 180 $scope.dt = null; 181 }; 182 183 // Disable weekend selection 184 $scope.disabled = function(date, mode) { 185 return ( mode === 'day' && ( date.getDay() === 0 || date.getDay() === 6 ) ); 186 }; 187 188 $scope.toggleMin = function() { 189 $scope.minDate = $scope.minDate ? null : new Date(); 190 }; 191 $scope.toggleMin(); 192 193 $scope.open = function($event) { 194 $event.preventDefault(); 195 $event.stopPropagation(); 196 197 $scope.opened = true; 198 }; 199 200 $scope.dateOptions = { 201 formatYear: 'yy', 202 startingDay: 1, 203 'class': 'datepicker' 204 }; 205 206 $scope.formats = ['dd-MMMM-yyyy', 'yyyy/MM/dd', 'dd.MM.yyyy', 'shortDate']; 207 $scope.format = $scope.formats[0]; 208 }); 209
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.