/[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 528 by nhaye, Fri Oct 19 16:50:44 2012 UTC revision 557 by nhaye, Tue Oct 30 15:52:38 2012 UTC
# Line 64  function VerifNumdec(champ) { Line 64  function VerifNumdec(champ) {
64      //}      //}
65            
66  }  }
67    /* -- Debut -- */
68    function messageIt(objsf, link, empty) {
69        // recuperation du terme recherche
70        var recherche = document.getElementById("recherchedyn");
71        if (recherche != null) {
72            link += "&recherche="+recherche.value;
73        }else {
74            link += "&recherche=";
75        }
76        // execution de la requete en POST
77        $.ajax({
78            type: "GET",
79            url: link,
80            cache: false,
81            success: function(html){
82                (empty == true )?$("#sousform-"+objsf).empty():'';
83                $("#sousform-"+objsf).append(html);
84                om_initialize_content();
85            },
86            async: false
87        });
88    }
89    
90    /* Plugin jQuery qui lance un espèce d'appel AJAX vers un script PHP de téléchargement de fichier*/
91    jQuery.download = function(url, data, method){
92        //url and data options required
93        if( url && data ){
94            //data can be string of parameters or array/object
95            data = typeof data == 'string' ? data : jQuery.param(data);
96            //split params into form inputs
97            var inputs = '';
98            jQuery.each(data.split('&'), function(){
99                var pair = this.split('=');
100                inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />';
101            });
102            //send request
103            jQuery('<form action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
104            .prependTo('body').submit().remove();
105        };
106    };
107    
108    /* -- FIN -- */
109    function popupIt(objsf, link) {
110        // Insertion du conteneur du dialog
111        var dialog = $('<div id=\"sousform-'+objsf+'\"></div>').insertAfter('.formControls');
112        $('<input type=\"text\" name=\"recherchedyn\" id=\"recherchedyn\" value=\"\" class=\"champFormulaire\" style=\"display:none\" />').insertAfter('#sousform-'+objsf);
113        
114        // execution de la requete passee en parametre
115        // (idem ajaxIt + callback)
116        $.ajax({
117            type: "GET",
118            url: link,
119            cache: false,
120            success: function(html){
121                //Suppression d'un precedent dialog
122                dialog.empty();
123                //Ajout du contenu recupere
124                dialog.append(html);
125                //Initialisation du theme OM
126                om_initialize_content();
127                //Creation du dialog
128                $(dialog).dialog({
129                //OnClose suppression du contenu
130                close: function(ev, ui) {
131                    //Spécifique à la modification de consultation par retour d'avis de service
132                    var redirect = $('<form name="redirect" method="GET" action="../scr/tab.php">'+
133                    '<input type="hidden" name="obj" value="'+$.getQuery('obj')+'" />'+
134                    '<input type="hidden" name="premier" value="'+$.getQuery('premier')+'" />'+
135                    '<input type="hidden" name="advs_id" value="'+$.getQuery('advs_id')+'" />'+
136                    '<input type="hidden" name="recherche" value="'+$.getQuery('recherche')+'" />'+
137                    '<input type="hidden" name="tricol" value="'+$.getQuery('tricol')+'" />'+
138                    '<input type="hidden" name="selectioncol" value="'+$.getQuery('selectioncol')+'" />'+
139                    '</form>').insertAfter('.formControls');
140                    
141                    // Si le formulaire est submit et valide
142                    var valid=$('#sousform-'+objsf+' div.ui-state-valid');
143                    if(valid.length > 0) {
144                        redirect.submit();
145                    }
146                    $(this).remove();
147                },
148                resizable: false,
149                modal: true,
150                width: 700,
151                height: 520,
152              });
153            },
154            async : false
155        });
156        //Modification des boutons retours du sous formulaire pour fermer le dialog
157        $('#sousform-'+objsf).on("mousedown",'a.retour',function() {
158            $('#sousform-'+objsf+' a.retour').attr('onclick','');
159        });
160        $('#sousform-'+objsf).on("click",'a.retour',function() {
161            $(dialog).dialog('close').remove();
162        });
163        return false;
164    }
165    
 /* -- FIN -- */  
166    // Parse URL Queries Method
167    (function($){
168            $.getQuery = function( query ) {
169                    query = query.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
170                    var expr = "[\\?&]"+query+"=([^&#]*)";
171                    var regex = new RegExp( expr );
172                    var results = regex.exec( window.location.href );
173                    if( results !== null ) {
174                            return results[1];
175                            return decodeURIComponent(results[1].replace(/\+/g, " "));
176                    } else {
177                            return false;
178                    }
179            };
180    })(jQuery);
181    

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26