/[openfoncier]/branches/3.2.x/app/js/script.js
ViewVC logotype

Diff of /branches/3.2.x/app/js/script.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 557 by nhaye, Tue Oct 30 15:52:38 2012 UTC revision 660 by fmichon, Mon Nov 12 09:13:10 2012 UTC
# Line 1  Line 1 
1  // specific openfoncier ========================================================  // specific openfoncier ========================================================
2    // OnReady
3    $(function(){
4       // Document is ready
5       $('#avis_code_barre_form #consultation').focus();
6     });
7    
8    
9  function bible(){  function bible(){
10      if(fenetreouverte==true)      if(fenetreouverte==true)
# Line 73  function messageIt(objsf, link, empty) { Line 79  function messageIt(objsf, link, empty) {
79      }else {      }else {
80          link += "&recherche=";          link += "&recherche=";
81      }      }
82      // execution de la requete en POST      // execution de la requete en GET
83      $.ajax({      $.ajax({
84          type: "GET",          type: "GET",
85          url: link,          url: link,
# Line 128  function popupIt(objsf, link) { Line 134  function popupIt(objsf, link) {
134              $(dialog).dialog({              $(dialog).dialog({
135              //OnClose suppression du contenu              //OnClose suppression du contenu
136              close: function(ev, ui) {              close: function(ev, ui) {
                 //Spécifique à la modification de consultation par retour d'avis de service  
                 var redirect = $('<form name="redirect" method="GET" action="../scr/tab.php">'+  
                 '<input type="hidden" name="obj" value="'+$.getQuery('obj')+'" />'+  
                 '<input type="hidden" name="premier" value="'+$.getQuery('premier')+'" />'+  
                 '<input type="hidden" name="advs_id" value="'+$.getQuery('advs_id')+'" />'+  
                 '<input type="hidden" name="recherche" value="'+$.getQuery('recherche')+'" />'+  
                 '<input type="hidden" name="tricol" value="'+$.getQuery('tricol')+'" />'+  
                 '<input type="hidden" name="selectioncol" value="'+$.getQuery('selectioncol')+'" />'+  
                 '</form>').insertAfter('.formControls');  
                   
137                  // Si le formulaire est submit et valide                  // Si le formulaire est submit et valide
138                  var valid=$('#sousform-'+objsf+' div.ui-state-valid');                  var valid=$('#sousform-'+objsf+' div.ui-state-valid');
139                  if(valid.length > 0) {                  if(valid.length > 0) {
140                      redirect.submit();                      document.location.href="../scr/tab.php?obj="+$.getQuery('obj')+"&premier="+$.getQuery('premier')
141                        +"&advs_id="+$.getQuery('advs_id')+"&recherche="+$.getQuery('recherche')+"&tricol="+$.getQuery('tricol')
142                        +"&selectioncol="+$.getQuery('selectioncol');
143                  }                  }
144                  $(this).remove();                  $(this).remove();
145              },              },
# Line 178  function popupIt(objsf, link) { Line 176  function popupIt(objsf, link) {
176                  }                  }
177          };          };
178  })(jQuery);  })(jQuery);
   
179    
180    function changeDataSelect(tn, ds, joker){
181            
182        var idArrondissement = $("#"+ds+" option:selected").val();
183        link = "../app/listData.php?idx=" + idArrondissement + "&tn=" + tn + "&ds=" + ds;
184        $.ajax({
185            type: "GET",
186            url: link,
187            cache: false,
188            dataType: "json",
189            success: function(html){
190                
191                $('#'+tn).empty();
192                
193                if ( joker == true )
194                    $('#'+tn).append(
195                        '<option value="" selected="selected">*</option>'
196                    );
197                else
198                    $('#'+tn).append(
199                        '<option value="" selected="selected">Choisir ' + tn + '</option>'
200                    );
201                
202                if ( html !== '' ){
203                    
204                    html = html.split(';');
205                    for ( i = 0 ; i < html.length - 1 ; i++ ){
206                        
207                        html_temp = html[i].split('_');
208                        $('#'+tn).append(
209                            '<option value="'+html_temp[0]+'" >'+html_temp[1]+'</option>'
210                        );
211                    }
212                }
213            },
214            async: false
215        });
216    }
217    function vuploadMulti(champ) {
218        //
219        if (fenetreouverte == true) {
220            pfenetre.close();
221        }
222        //
223        pfenetre = window.open("../spg/upload.php?origine="+champ+"&form="+$('input[name='+champ+']').closest('form').attr('name'),"upload","width=400,height=300,top=120,left=120");
224        //pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120");
225        //
226        fenetreouverte = true;
227    }
228    function tmpUpload(champ) {
229        //
230        if (fenetreouverte == true) {
231            pfenetre.close();
232        }
233        //
234        pfenetre = window.open("../app/tmpUpload.php?origine="+champ+"&form="+$('input[name='+champ+']').closest('form').attr('name'),"upload","width=400,height=300,top=120,left=120");
235        //pfenetre = window.open("../spg/upload2.php?origine="+champ,"upload2","width=300,height=100,top=120,left=120");
236        //
237        fenetreouverte = true;
238    }
239    
240    //$(function() {
241    //    if ( $('#date_demande').length > 0 && !$('#dossier_autorisation_type_detaille').is(':disabled') )
242    //        hideFields();
243    //        
244    //    
245    //});
246    
247    function changeDemandeType(){
248        
249        var idDossierAutorisationTypeDetaille = $("#dossier_autorisation_type_detaille option:selected").val();
250        
251        if ( $.isNumeric(idDossierAutorisationTypeDetaille) ){
252            
253            changeDataSelect('demande_type','dossier_autorisation_type_detaille');
254            
255           $('#demande_type').parent().parent().show();
256          
257           $('.terrain_references_cadastrales_custom').append(
258               '<div class="field field-type-text" >'+
259                    '<div class="form-libelle">' +
260                        '<label '+
261                            'class="libelle-terrain_references_cadastrales" '+
262                            'for="terrain_references_cadastrales">'+
263                            ' terrain_references_cadastrales '+
264                        '</label>' +
265                    '</div>' +
266                    '<div class="form-content reference_cadastrale_custom_fields">' +
267                        '<input ' +
268                            'class="champFormulaire reference_cadastrale_custom_field" ' +
269                            'type="text" ' +
270                            'onchange="VerifNum(this)" ' +
271                            'maxlength="3" ' +
272                            'size="3" ' +
273                            'value="" />' +
274                        '<input ' +
275                            'class="champFormulaire reference_cadastrale_custom_field" ' +
276                            'type="text" ' +
277                            'maxlength="2" ' +
278                            'size="2" ' +
279                            'value="" />' +
280                        '<input ' +
281                            'class="champFormulaire reference_cadastrale_custom_field" ' +
282                            'type="text" ' +
283                            'onchange="VerifNum(this)" ' +
284                            'maxlength="4" ' +
285                            'size="4" ' +
286                            'value="" />' +
287                    '</div>' +
288               '</div>' +
289               '<div id="moreFieldReferenceCadastrale"> + ajouter d\'autres champs</div>'
290           );
291          
292           $('#moreFieldReferenceCadastrale').click( function() {
293                $('.reference_cadastrale_custom_fields').append(newInputReferenceCadastrale());
294            });
295            
296            $('form').submit(
297                function(){
298                    
299                    var reference_cadastrale = '';
300                    
301                    $('.reference_cadastrale_custom_field').each(
302                        function(){
303                            
304                            reference_cadastrale += $(this).val();
305                        }
306                    );
307                    
308                    $('#terrain_references_cadastrales').val(reference_cadastrale);
309                }
310            );
311            
312            $('.terrain_references_cadastrales_custom:').find(">:first-child").hide();
313        }
314        else {
315            hideFields();
316        }
317    }
318    
319    function hideFields(){
320        $('.bloc').each(
321            function(){
322                if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') )
323                    $(this).hide();
324            }
325        );
326        
327        $('.field-type-text').hide();
328        $('input[type=submit]').hide();
329        $('#demande_type').parent().parent().hide();
330    }
331    
332    function showFormsDemande(){
333        $('.bloc').each(
334            function(){
335                if ( !$(this).hasClass('dossier_type') && !$(this).hasClass('dossier_type_demande_date') )
336                    $(this).show();
337            }
338        );
339        
340        $('.field-type-text').show();
341        $('input[type=submit]').show();
342    }
343    
344    function newInputReferenceCadastrale(){
345        return '<input ' +
346                'class="champFormulaire reference_cadastrale_custom_field" ' +
347                'type="text" ' +
348                'maxlength="1" ' +
349                'size="1" ' +
350                'value="" />' +
351            '<input ' +
352                'class="champFormulaire reference_cadastrale_custom_field" ' +
353                'type="text" ' +
354                'onchange="VerifNum(this)" ' +
355                'maxlength="4" ' +
356                'size="4" ' +
357                'value="" />';
358    }
359    
360    // Desactivation des fonctions widget du tableau de bord inutiles sur le nouveau
361    // tableau de bord
362    function widget_bind_move_actions() {}
363    function widget_bind_add_action() {}
364    function widget_bind_edit_actions(widget_selector) {}
365    

Legend:
Removed from v.557  
changed lines
  Added in v.660

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26