/[openfoncier]/trunk/app/js/script.js
ViewVC logotype

Diff of /trunk/app/js/script.js

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

revision 836 by mlimic, Tue Nov 27 09:58:07 2012 UTC revision 838 by nhaye, Tue Nov 27 12:03:05 2012 UTC
# Line 274  function popupIt(objsf, link, width, hei Line 274  function popupIt(objsf, link, width, hei
274      //Fermeture du dialog lors d'un clic sur le bouton retour      //Fermeture du dialog lors d'un clic sur le bouton retour
275      $('#sousform-'+objsf).on("click",'a.retour',function() {      $('#sousform-'+objsf).on("click",'a.retour',function() {
276          $(dialog).dialog('close').remove();          $(dialog).dialog('close').remove();
277            return false;
278      });      });
     return false;  
279  }  }
280    
281  /***  /***
# Line 325  function returnToTab(objsf) { Line 325  function returnToTab(objsf) {
325   */   */
326    
327   /**   /**
328    * Function permettant d'insérer l'id du demandeur ajouté dans un input hidden    * Function permettant de mettre à jour les infos du demandeur
329    **/    **/
330  function getDemandeurId(type) {  function getDemandeurId(type) {
331      var id_demandeur=$('#id_retour').val();      var id_demandeur=$('#id_retour').val();
# Line 333  function getDemandeurId(type) { Line 333  function getDemandeurId(type) {
333          if(type != 'petitionnaire') {          if(type != 'petitionnaire') {
334              $('#add_'+type).hide();              $('#add_'+type).hide();
335          }          }
         if (type == "petitionnaire") {  
             $('<input type="hidden" class="demandeur" name="'+type+'[]" value="'+id_demandeur+'"/>').insertBefore('#add_'+type);  
         } else {  
             $('<input type="hidden" class="demandeur" name="'+type+'" value="'+id_demandeur+'"/>').insertBefore('#add_'+type);  
         }  
336                    
337          afficherDemandeur(id_demandeur,type);          afficherDemandeur(id_demandeur,type);
338          om_initialize_content();          om_initialize_content();
339      }      }
   
340  }  }
341    
342  /**  /**
# Line 354  function afficherDemandeur(id,type) { Line 348  function afficherDemandeur(id,type) {
348          url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+id+'&type='+type,          url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+id+'&type='+type,
349          cache: false,          cache: false,
350          success: function(html){          success: function(html){
351              $(html).insertBefore('#add_'+type);              $(html).insertBefore('#add_'+type).fadeIn(500);;
352          }          }
353      });      });
354  }  }
355    
356  /*  /**
357   * A garder   * Function permettant de modifier un demandeur
  */  
 /*  
  * '<div class="field field-type-text morePetitionnaire" style="display: table-row;">' +  
         '<div class="form-libelle">' +  
             '<label class="libelle-more_petitionnaire" for="terrain_superficie"> + Ajouter un autre p&eacute;titionnaire </label>' +  
         '</div>' +  
         '<div class="form-content">' +  
         '</div>' +  
     '</div>'  
358   */   */
359    function editDemandeur(id,type,id_css) {
360        popupIt(type,
361                    '../scr/sousform.php?obj='+type+'&action=1'+
362                    '&retourformulaire=demande&idx='+id, 780, 500,
363                    replaceDemandeur, {'type':type,'id': id, 'id_css':id_css});
364            changeDemandeurType('qualite');
365            addSearchIcon();
366            addDivDialog('.bloc_demandeur');
367    }
368    
369    /**
370     * Function permettant de remplacer un contenu déjà existant
371     **/
372    function replaceDemandeur(obj) {
373        $.ajax({
374            type: "GET",
375            url: '../app/afficher_synthese_demandeur.view.php?iddemandeur='+obj.id+'&type='+obj.type,
376            cache: false,
377            success: function(html){
378                $(obj.id_css).replaceWith(html);
379            }
380        });
381    }
382    /**
383     * Function permettant de remplacer un contenu déjà existant
384     **/
385    function removeDemandeur(id) {
386        var div_class=$('#'+id).attr("class");
387        $('#'+id).remove();
388        if(div_class == "delegataire") {
389            $('#add_delegataire').fadeIn(500);
390        }
391        if(div_class == "petitionnaire_principal") {
392            $('#add_petitionnaire_principal').fadeIn(500);
393        }
394    }
395    
396  /*  /**
397      Ajoute le formulaire d'ajout de référence cadastrale personnalisé   * Appel au chargement de la page
398   * */   **/
399  $(function() {  $(function() {
400      changeDemandeurType('qualite');      changeDemandeurType('qualite');
401      if ( $('#type_demandeur') == 'petitionnaire' ){      if ( $('#type_demandeur') == 'petitionnaire' ){
# Line 383  $(function() { Line 403  $(function() {
403          addSearchIcon();          addSearchIcon();
404          addDivDialog('.bloc_demandeur');          addDivDialog('.bloc_demandeur');
405      }      }
406        if($('input[name=petitionnaire_principal][type=hidden]').size() == 1) {
407            $('#add_petitionnaire_principal').hide();
408        }
409        if($('input[name=delegataire][type=hidden]').size() == 1) {
410            $('#add_delegataire').hide();
411        }
412      // Bind de la fonction permettant l'ajout du pétitionnaire principal      // Bind de la fonction permettant l'ajout du pétitionnaire principal
413      $("#add_petitionnaire_principal").click( function() {      $("#formulaire").on("click","#add_petitionnaire_principal",  function() {
414          popupIt('petitionnaire',          popupIt('petitionnaire',
415                  '../scr/sousform.php?obj=petitionnaire&action=0'+                  '../scr/sousform.php?obj=petitionnaire&action=0'+
416                  '&retourformulaire=demande&principal=true', 780, 500,                  '&retourformulaire=demande&principal=true', 780, 500,
417                  getDemandeurId, 'petitionnaire_principal');                  getDemandeurId, 'petitionnaire_principal');
418    
419          changeDemandeurType('qualite');          changeDemandeurType('qualite');
420          addSearchIcon();          addSearchIcon();
421          addDivDialog('.bloc_demandeur');          addDivDialog('.bloc_demandeur');

Legend:
Removed from v.836  
changed lines
  Added in v.838

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26