1 |
// specific openfoncier ======================================================== |
2 |
// OnReady |
3 |
$(function(){ |
4 |
// Document is ready |
5 |
$('#avis_code_barre_form #consultation').focus(); |
6 |
}); |
7 |
|
8 |
|
9 |
function bible(){ |
10 |
if(fenetreouverte==true) |
11 |
pfenetre.close(); |
12 |
var ev=document.f2.evenement.value; |
13 |
var idx=document.f2.dossier.value; |
14 |
pfenetre=window.open("../app/bible.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
15 |
fenetreouverte=true; |
16 |
} |
17 |
|
18 |
function bible2() |
19 |
{ |
20 |
if(fenetreouverte==true) |
21 |
pfenetre.close(); |
22 |
var ev=document.f2.evenement.value; |
23 |
var idx=document.f2.dossier.value; |
24 |
pfenetre=window.open("../app/bible2.php?ev="+ev+"&idx="+idx,"bible","scrollbars=yes,width=600,height=600,top=120,left=120"); |
25 |
fenetreouverte=true; |
26 |
} |
27 |
|
28 |
function bible_auto(){ |
29 |
if(fenetreouverte==true) |
30 |
pfenetre.close(); |
31 |
var ev=document.f2.evenement.value; |
32 |
var idx=document.f2.dossier.value; |
33 |
pfenetre=window.open("../app/bible_auto.php?idx="+idx+"&ev="+ev,"evenement","width=600,height=300,top=120,left=120"); |
34 |
fenetreouverte=true; |
35 |
} |
36 |
|
37 |
function dossierads_d(debut) |
38 |
{ |
39 |
//if(fenetreouverte==true) |
40 |
window.location="../pdf/pdfetat.php?obj=dossier_ads_d&nature=" |
41 |
+document.f1.nature.value+"&idx=demo&datedebut=" |
42 |
+document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
43 |
} |
44 |
|
45 |
function dossierdepot() |
46 |
{ |
47 |
//if(fenetreouverte==true) |
48 |
window.location="../pdf/pdfetat.php?obj=dossier_depot&nature="+ |
49 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
50 |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
51 |
} |
52 |
|
53 |
function dossierads() |
54 |
{ |
55 |
//if(fenetreouverte==true) |
56 |
window.location="../pdf/pdfetat.php?obj=dossier_ads&nature="+ |
57 |
document.f1.nature.value+"&idx=demo&datedebut="+ |
58 |
document.f1.datedebut.value+"&datefin="+document.f1.datefin.value; |
59 |
} |
60 |
|
61 |
|
62 |
function VerifNumdec(champ) { |
63 |
champ.value = champ.value.replace(",", "."); // remplacement de la virgule |
64 |
//if (champ.value.lastIndexOf(".") == -1){ // champ decimal |
65 |
if (isNaN(champ.value)) { |
66 |
alert(msg_alert_error_verifnum); |
67 |
champ.value = ""; |
68 |
return; |
69 |
} |
70 |
//} |
71 |
|
72 |
} |
73 |
/* -- Debut -- */ |
74 |
function messageIt(objsf, link, empty) { |
75 |
// recuperation du terme recherche |
76 |
var recherche = document.getElementById("recherchedyn"); |
77 |
if (recherche != null) { |
78 |
link += "&recherche="+recherche.value; |
79 |
}else { |
80 |
link += "&recherche="; |
81 |
} |
82 |
// execution de la requete en GET |
83 |
$.ajax({ |
84 |
type: "GET", |
85 |
url: link, |
86 |
cache: false, |
87 |
success: function(html){ |
88 |
(empty == true )?$("#sousform-"+objsf).empty():''; |
89 |
$("#sousform-"+objsf).append(html); |
90 |
om_initialize_content(); |
91 |
}, |
92 |
async: false |
93 |
}); |
94 |
} |
95 |
|
96 |
/* Plugin jQuery qui lance un espèce d'appel AJAX vers un script PHP de téléchargement de fichier*/ |
97 |
jQuery.download = function(url, data, method){ |
98 |
//url and data options required |
99 |
if( url && data ){ |
100 |
//data can be string of parameters or array/object |
101 |
data = typeof data == 'string' ? data : jQuery.param(data); |
102 |
//split params into form inputs |
103 |
var inputs = ''; |
104 |
jQuery.each(data.split('&'), function(){ |
105 |
var pair = this.split('='); |
106 |
inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; |
107 |
}); |
108 |
//send request |
109 |
jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>') |
110 |
.prependTo('body').submit().remove(); |
111 |
}; |
112 |
}; |
113 |
|
114 |
/* -- FIN -- */ |
115 |
function popupIt(objsf, link) { |
116 |
// Insertion du conteneur du dialog |
117 |
var dialog = $('<div id=\"sousform-'+objsf+'\"></div>').insertAfter('.formControls'); |
118 |
$('<input type=\"text\" name=\"recherchedyn\" id=\"recherchedyn\" value=\"\" class=\"champFormulaire\" style=\"display:none\" />').insertAfter('#sousform-'+objsf); |
119 |
|
120 |
// execution de la requete passee en parametre |
121 |
// (idem ajaxIt + callback) |
122 |
$.ajax({ |
123 |
type: "GET", |
124 |
url: link, |
125 |
cache: false, |
126 |
success: function(html){ |
127 |
//Suppression d'un precedent dialog |
128 |
dialog.empty(); |
129 |
//Ajout du contenu recupere |
130 |
dialog.append(html); |
131 |
//Initialisation du theme OM |
132 |
om_initialize_content(); |
133 |
//Creation du dialog |
134 |
$(dialog).dialog({ |
135 |
//OnClose suppression du contenu |
136 |
close: function(ev, ui) { |
137 |
//Spécifique à la modification de consultation par retour d'avis de service |
138 |
var redirect = $('<form name="redirect" method="GET" action="../scr/tab.php">'+ |
139 |
'<input type="hidden" name="obj" value="'+$.getQuery('obj')+'" />'+ |
140 |
'<input type="hidden" name="premier" value="'+$.getQuery('premier')+'" />'+ |
141 |
'<input type="hidden" name="advs_id" value="'+$.getQuery('advs_id')+'" />'+ |
142 |
'<input type="hidden" name="recherche" value="'+$.getQuery('recherche')+'" />'+ |
143 |
'<input type="hidden" name="tricol" value="'+$.getQuery('tricol')+'" />'+ |
144 |
'<input type="hidden" name="selectioncol" value="'+$.getQuery('selectioncol')+'" />'+ |
145 |
'</form>').insertAfter('.formControls'); |
146 |
|
147 |
// Si le formulaire est submit et valide |
148 |
var valid=$('#sousform-'+objsf+' div.ui-state-valid'); |
149 |
if(valid.length > 0) { |
150 |
redirect.submit(); |
151 |
} |
152 |
$(this).remove(); |
153 |
}, |
154 |
resizable: false, |
155 |
modal: true, |
156 |
width: 700, |
157 |
height: 520, |
158 |
}); |
159 |
}, |
160 |
async : false |
161 |
}); |
162 |
//Modification des boutons retours du sous formulaire pour fermer le dialog |
163 |
$('#sousform-'+objsf).on("mousedown",'a.retour',function() { |
164 |
$('#sousform-'+objsf+' a.retour').attr('onclick',''); |
165 |
}); |
166 |
$('#sousform-'+objsf).on("click",'a.retour',function() { |
167 |
$(dialog).dialog('close').remove(); |
168 |
}); |
169 |
return false; |
170 |
} |
171 |
|
172 |
// Parse URL Queries Method |
173 |
(function($){ |
174 |
$.getQuery = function( query ) { |
175 |
query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); |
176 |
var expr = "[\\?&]"+query+"=([^&#]*)"; |
177 |
var regex = new RegExp( expr ); |
178 |
var results = regex.exec( window.location.href ); |
179 |
if( results !== null ) { |
180 |
return results[1]; |
181 |
return decodeURIComponent(results[1].replace(/\+/g, " ")); |
182 |
} else { |
183 |
return false; |
184 |
} |
185 |
}; |
186 |
})(jQuery); |
187 |
|
188 |
function changeQuartier(){ |
189 |
|
190 |
var idArrondissement = $("#arrondissement option:selected").val(); |
191 |
if ( idArrondissement != '' && $.isNumeric(idArrondissement) ){ |
192 |
|
193 |
link = "../app/listeQuartier.php?idx=" + idArrondissement; |
194 |
$.ajax({ |
195 |
type: "GET", |
196 |
url: link, |
197 |
cache: false, |
198 |
success: function(html){ |
199 |
if ( html !== '' ){ |
200 |
|
201 |
$('#quartier').empty(); |
202 |
$('#quartier').append( |
203 |
'<option value="" selected="selected">*</option>' |
204 |
); |
205 |
|
206 |
html = html.split(';'); |
207 |
for ( i = 0 ; i < html.length - 1 ; i++ ){ |
208 |
|
209 |
html_temp = html[i].split('_'); |
210 |
$('#quartier').append( |
211 |
'<option value="'+html_temp[0]+'" >'+html_temp[1]+'</option>' |
212 |
); |
213 |
} |
214 |
} |
215 |
}, |
216 |
async: false |
217 |
}); |
218 |
} |
219 |
} |