/[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 1099 by vpihour, Tue Dec 18 17:05:32 2012 UTC revision 1242 by vpihour, Tue Feb 12 16:07:06 2013 UTC
# Line 8  $(function(){ Line 8  $(function(){
8      * recherche au chargement de la page.      * recherche au chargement de la page.
9      */      */
10     $('#avis_code_barre_form #consultation').focus();     $('#avis_code_barre_form #consultation').focus();
11    
12        /**
13        * Spécifique app/maj_dates_suivi.php pour donner le focus sur le champ
14        * instruction au chargement de la page si la date n'est pas vide.
15        */
16        if($('#maj_dates_form #date').val()!="") {
17            $('#maj_dates_form #instruction').focus();
18        }
19   });   });
20    
21    
# Line 188  function dossier_reglementaire(){ Line 196  function dossier_reglementaire(){
196          async: false          async: false
197      });      });
198  }  }
199    //Fonction de redirection pour le widget de recherche de dossier
200    function widget_recherche_dossier(data,nbRes){
201        /*$('#msg').show();
202        $('#msg').html(msg_loading);*/
203      
204        // S'il n'y a qu'un seul résultat, afficher un résumé
205        if ( nbRes == 1 ){
206        
207            window.location = "../scr/form.php?obj=dossier_instruction&action=3&" +
208                "idx=" + data + "&premier=0&advs_id=&recherche=&tricol=&" +
209                "selectioncol=&valide=&retour=tab";  
210        }
211        // S'il y a une liste de dossier, redirection vers le tableau
212        else {
213            
214            window.location = "../scr/tab.php?obj=recherche_direct&selectioncol=0&recherche=" + data;
215        }
216    }
217  //  //
218  function dossierdepot()  function dossierdepot()
219  {  {
# Line 409  function editDemandeur(obj,id,type,id_cs Line 435  function editDemandeur(obj,id,type,id_cs
435      } else {      } else {
436          url += '&action=1&idx='+id;          url += '&action=1&idx='+id;
437      }      }
438      popupIt(obj, url, 780, 'auto',      popupIt(obj, url, 860, 'auto',
439              replaceDemandeur, {'type':type,'id': id, 'id_css':id_css});              replaceDemandeur, {'type':type,'id': id, 'id_css':id_css});
440      affichageBoutonsDemandeurs();      affichageBoutonsDemandeurs();
441  }  }
# Line 450  function affichageBoutonsDemandeurs(){ Line 476  function affichageBoutonsDemandeurs(){
476      // Si formulaire après validation on cache les boutons d'ajout de demandeurs      // Si formulaire après validation on cache les boutons d'ajout de demandeurs
477      url = document.location + "" ;      url = document.location + "" ;
478    
479      if (url.indexOf("form.php?obj=demande&") != -1 && $("form[name=f1] .form-is-valid").size() > 0 ) {      if ((url.indexOf("form.php?obj=demande&") != -1
480            || url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1
481            || url.indexOf("form.php?obj=demande_dossier_existant&") != -1)
482            && $("form[name=f1] .form-is-valid").size() > 0 ) {
483    
484          $('#add_petitionnaire_principal').hide();          $('#add_petitionnaire_principal').hide();
485          $('#add_delegataire').hide();          $('#add_delegataire').hide();
# Line 505  $(function() { Line 534  $(function() {
534      $("#formulaire").on("click","#add_petitionnaire_principal",  function() {      $("#formulaire").on("click","#add_petitionnaire_principal",  function() {
535          popupIt('petitionnaire',          popupIt('petitionnaire',
536                  '../scr/sousform.php?obj=petitionnaire&action=0'+                  '../scr/sousform.php?obj=petitionnaire&action=0'+
537                  '&retourformulaire=demande&principal=true', 780, 'auto',                  '&retourformulaire=demande&principal=true', 860, 'auto',
538                  getDemandeurId, 'petitionnaire_principal');                  getDemandeurId, 'petitionnaire_principal');
539      });      });
540      // Bind de la fonction permettant l'ajout du délégataire      // Bind de la fonction permettant l'ajout du délégataire
541      $("#formulaire").on("click","#add_delegataire", function(event) {      $("#formulaire").on("click","#add_delegataire", function(event) {
542          popupIt('delegataire',          popupIt('delegataire',
543                  '../scr/sousform.php?obj=delegataire&action=0'+                  '../scr/sousform.php?obj=delegataire&action=0'+
544                  '&retourformulaire=demande', 780, 'auto',                  '&retourformulaire=demande', 860, 'auto',
545                  getDemandeurId, 'delegataire');                  getDemandeurId, 'delegataire');
546      });      });
547      // Bind de la fonction permettant l'ajout des pétitionnaires      // Bind de la fonction permettant l'ajout des pétitionnaires
548      $("#formulaire").on("click","#add_petitionnaire", function(event) {      $("#formulaire").on("click","#add_petitionnaire", function(event) {
549          popupIt('petitionnaire',          popupIt('petitionnaire',
550                  '../scr/sousform.php?obj=petitionnaire&action=0'+                  '../scr/sousform.php?obj=petitionnaire&action=0'+
551                  '&retourformulaire=demande', 780, 'auto',                  '&retourformulaire=demande', 860, 'auto',
552                  getDemandeurId, 'petitionnaire');                  getDemandeurId, 'petitionnaire');
553      });      });
554    
# Line 531  $(function() { Line 560  $(function() {
560      }      }
561            
562      if (url.indexOf("form.php?obj=demande&") != -1      if (url.indexOf("form.php?obj=demande&") != -1
563          && (url.indexOf("&action=3") == -1 && $(".form-is-valid").size() == 0)) {          && (url.indexOf("&action=3") == -1
564            && url.indexOf("&action=2") == -1
565            && $(".form-is-valid").size() == 0)) {
566                    
567          addButtonCadastraleAdesse();          addButtonCadastraleAdesse();
568          changeDemandeType();          changeDemandeType();
569      }      }
570            
571      // Ajout de demande      // Ajout de demande
572      if (url.indexOf("form.php?obj=demande&") != -1      if ((url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1
573            || url.indexOf("form.php?obj=demande_dossier_existant&") != -1)
574          && url.indexOf("&action=0") != -1 ){          && url.indexOf("&action=0") != -1 ){
575    
576          /*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/          /*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/
# Line 546  $(function() { Line 578  $(function() {
578      }      }
579            
580      // Ajout de demande sur dossier existant      // Ajout de demande sur dossier existant
581      if (url.indexOf("form.php?obj=demande&") != -1      if (url.indexOf("form.php?obj=demande_dossier_existant&") != -1
582          && url.indexOf("&action=0") != -1          && url.indexOf("&action=0") != -1 ){
         && url.indexOf("&idx_dossier=") != -1 ){  
583    
584          /*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/          /*Cache les champs avant que dossier_autorisation_type_detaille soit choisi*/
585          hideFields();          hideFields();
# Line 556  $(function() { Line 587  $(function() {
587      }      }
588            
589      // Modification de demande      // Modification de demande
590      if (url.indexOf("form.php?obj=demande&") ){      if ((url.indexOf("form.php?obj=demande&") != -1
591            || url.indexOf("form.php?obj=demande_nouveau_dossier&") != -1
592            || url.indexOf("form.php?obj=demande_dossier_existant&") != -1)
593            && url.indexOf("&action=3") == -1
594            && url.indexOf("&action=1") == -1 ){
595                    
596          formatFieldReferenceCadastrale();          formatFieldReferenceCadastrale();
597      }      }
# Line 567  $(function() { Line 602  $(function() {
602   */   */
603  function formatFieldReferenceCadastrale(){  function formatFieldReferenceCadastrale(){
604    
     $('.reference_cadastrale_custom_fields').empty();  
   
605      addNewFieldReferencesCadastrales();      addNewFieldReferencesCadastrales();
606      $('#terrain_references_cadastrales').parent().parent().hide();      $('#terrain_references_cadastrales').parent().parent().hide();
607            
# Line 833  function changeDemandeurType(id){ Line 866  function changeDemandeurType(id){
866    
867      /*Réinitialise les champs et cache les champs inutiles selon la qualité du demandeur*/      /*Réinitialise les champs et cache les champs inutiles selon la qualité du demandeur*/
868      /*Si la qualite du demandeur est particulier */      /*Si la qualite du demandeur est particulier */
869      if ( $('#' + id + ' option:selected').val() == 'particulier' ){      if ( $('#' + id ).val() == 'particulier' ){
870                    
871          $('.personne_morale_fields input').each(          $('.personne_morale_fields input').each(
872              function(){              function(){
# Line 994  function actionLineFormReferenceCadastra Line 1027  function actionLineFormReferenceCadastra
1027      dossier_autorisation_type_detaille est choisi      dossier_autorisation_type_detaille est choisi
1028   * */   * */
1029  function changeDemandeType(){  function changeDemandeType(){
1030        
1031      var idDossierAutorisationTypeDetaille =      var idDossierAutorisationTypeDetaille =
1032          $("#dossier_autorisation_type_detaille").val();          $("#dossier_autorisation_type_detaille").val();
1033                    
# Line 1120  function fieldReferenceCadastraleBase(){ Line 1153  function fieldReferenceCadastraleBase(){
1153                  'type="text" ' +                  'type="text" ' +
1154                  'onchange="VerifNum(this)" ' +                  'onchange="VerifNum(this)" ' +
1155                  'maxlength="4" ' +                  'maxlength="4" ' +
1156                  'size="4" ';                  'size="4" '+
1157                    'placeholder="Quart." ';
1158                                    
1159      // désactivation des champs de référence cadastrale      // désactivation des champs de référence cadastrale
1160      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {
# Line 1133  function fieldReferenceCadastraleBase(){ Line 1167  function fieldReferenceCadastraleBase(){
1167                  'class="champFormulaire reference_cadastrale_custom_field" ' +                  'class="champFormulaire reference_cadastrale_custom_field" ' +
1168                  'type="text" ' +                  'type="text" ' +
1169                  'maxlength="3" ' +                  'maxlength="3" ' +
1170                  'size="3" ';                  'size="3" '+
1171                    'placeholder="Sect." ';
1172            
1173      // désactivation des champs de référence cadastrale      // désactivation des champs de référence cadastrale
1174      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {
# Line 1147  function fieldReferenceCadastraleBase(){ Line 1182  function fieldReferenceCadastraleBase(){
1182                  'type="text" ' +                  'type="text" ' +
1183                  'onchange="VerifNum(this)" ' +                  'onchange="VerifNum(this)" ' +
1184                  'maxlength="5" ' +                  'maxlength="5" ' +
1185                  'size="5" ';                  'size="5" '+
1186                    'placeholder="Parc." ';
1187            
1188      // désactivation des champs de référence cadastrale      // désactivation des champs de référence cadastrale
1189      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {      if(type != 'NOUV' || $(".form-is-valid").size() > 0 || url.indexOf('action=3') != -1 ) {
# Line 1260  function newInputReferenceCadastrale(){ Line 1296  function newInputReferenceCadastrale(){
1296              'maxlength="1" ' +              'maxlength="1" ' +
1297              'size="1" ' +              'size="1" ' +
1298              'value="" ' +              'value="" ' +
1299                'placeholder="Sep." ' +
1300              'onchange="testSeparator(this);"/>' +              'onchange="testSeparator(this);"/>' +
1301          '<input ' +          '<input ' +
1302              'class="champFormulaire reference_cadastrale_custom_field" ' +              'class="champFormulaire reference_cadastrale_custom_field" ' +
# Line 1267  function newInputReferenceCadastrale(){ Line 1304  function newInputReferenceCadastrale(){
1304              'onchange="VerifNum(this)" ' +              'onchange="VerifNum(this)" ' +
1305              'maxlength="4" ' +              'maxlength="4" ' +
1306              'size="4" ' +              'size="4" ' +
1307                'placeholder="Parc." ' +
1308              'value="" />';              'value="" />';
1309  }  }
1310    
# Line 1298  function om_initialize_content() { Line 1336  function om_initialize_content() {
1336            
1337  }  }
1338    
1339    // Retourne la valeur d'une variable GET de l'URL
1340    function getQuerystring(key, default_)
1341    {
1342      if (default_==null) default_="";
1343      key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
1344      var regex = new RegExp("[\\?&]"+key+"=([^&#]*)");
1345      var qs = regex.exec(window.location.href);
1346      if(qs == null)
1347        return default_;
1348      else
1349        return qs[1];
1350    }
1351    
1352  /*  /*
1353   * Marque comme lu une consultation   * Marque comme lu une consultation
1354   */   */
1355  function markedAsRead(id, objet, objetc){  function portletUpdateData(id, objet, objetc, file, field, message){
1356            
1357      /*Vérifie que l'identifiant passé en paramètre est bien un chiffre      /*Vérifie que l'identifiant passé en paramètre est bien un chiffre
1358       * et que le type d'objet est défini       * et que le type d'objet est défini
1359       * */       * */
1360      if ( $.isNumeric(id) && objet != '' ){      if ( $.isNumeric(id) && objet != '' ){
1361                    
1362          donnees = "?ido=" + id + '&obj=' + objet + '&objk=' + objetc;          donnees = "?ido=" + id + '&obj=' + objet + '&objk=' + objetc + '&idxDossier=' + getQuerystring('idx');
1363          $.ajax({          $.ajax({
1364              type: "GET",              type: "GET",
1365              url: "../app/marquer_comme_lu.php" + donnees ,              url: "../app/"+file+".php" + donnees ,
1366              cache: false,              cache: false,
1367              success: function(html){              success: function(html){
1368                                    
1369                  $('#sousform-' + objet + ' .message').remove();                  $('#sousform-' + objet + ' .message').remove();
                   
1370                  /*Change la valeur affiché et affiche un message valide*/                  /*Change la valeur affiché et affiche un message valide*/
1371                  if ( $.parseJSON(html) == "Mise a jour effectue avec succes"){                  if ( $.parseJSON(html) == "Mise a jour effectue avec succes" ||
1372                    $.parseJSON(html) == "Transfert effectue avec succes" ){
1373                        
1374                        // On modife le champ field
1375                        if ( field != '' ){
1376                            $('#'+field).html(message);
1377                        }
1378                                            
                     // On modife le champ lu  
                     $('#lu').html('Oui');  
1379                      // On supprime l'action                      // On supprime l'action
1380                      $('span.lu-16').parent().parent().remove();                      $('span.'+field+'-16').parent().parent().remove();
1381                      // On affiche le message                      // On affiche le message
1382                      $('#sousform-' + objet + ' .subtitle').after(                      $('#sousform-' + objet + ' .subtitle').after(
1383                          '<div ' +                          '<div ' +
# Line 1355  function markedAsRead(id, objet, objetc) Line 1409  function markedAsRead(id, objet, objetc)
1409          });          });
1410      }      }
1411  }  }
1412    
1413    // Affiche le sous formulaire onglet
1414    function redirectPortletAction(id, onglet){
1415        
1416        var $tabs = $('.ui-tabs').tabs();
1417    
1418        lien_onglet = $('#' + onglet).attr('href');
1419        lien_onglet = lien_onglet.substring( lien_onglet.length - 1, lien_onglet.length);
1420    
1421        $tabs.tabs('select', lien_onglet);
1422    }

Legend:
Removed from v.1099  
changed lines
  Added in v.1242

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26