From 4ea89f67707fadf957976495272173e2709aaed0 Mon Sep 17 00:00:00 2001 From: Michael RICOIS Date: Wed, 5 May 2010 10:20:20 +0000 Subject: [PATCH] =?UTF-8?q?ajout=20du=20support=20de=20la=20touche=20entr?= =?UTF-8?q?=C3=A9e,=20issue=20#0000271?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/js/scripts.js | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/www/js/scripts.js b/www/js/scripts.js index 27a178871..8c1bca685 100644 --- a/www/js/scripts.js +++ b/www/js/scripts.js @@ -48,27 +48,16 @@ $(document).ready(function(){ modal: true, open: function(event, ui) { $(this).html('Chargement...'); - $(this).load(href); + $(this).load(href); + $('#dialogsurv').keypress(function(e){ + if (e.keyCode == 13){ + e.preventDefault(); + survSubmit(); + } + }); }, buttons: { - 'Ok': function() { - var buttons = $('#dialogsurv').dialog('option','buttons'); - for( var button in buttons ){ - $(":button:contains('"+button+"')").attr('disabled','disabled'); - } - var href = $(location).attr('href'); - var serData = $("#frmSurv").serialize(); - $("#frmSurv").replaceWith('
Mise sous surveillance en cours...
'); - $.post('./pages/ajax_surveillance.php', serData, - function(data) { - if(data==''){ - $('#frmSurv').html("L'entité a été placé sous surveillance.\n"); - $(location).attr('href', href); - }else{ - $('#frmSurv').html(data); - } - }); - }, + Ok: function() { survSubmit(); }, Annuler: function() { $(this).dialog('close'); } }, close: function() { $('#dialogsurv').remove(); } @@ -77,6 +66,26 @@ $(document).ready(function(){ return false; }); + function survSubmit(){ + var buttons = $('#dialogsurv').dialog('option','buttons'); + for( var button in buttons ){ + $(":button:contains('"+button+"')").attr('disabled','disabled'); + } + var formAction = $('#frmSurv').attr('action'); + var href = $(location).attr('href'); + var serData = $('#frmSurv').serialize(); + $('#frmSurv').replaceWith('
Mise sous surveillance en cours...
'); + $.post(formAction, serData, function(data) { + if(data==''){ + $('#frmSurv').html("L'entité a été placé sous surveillance.\n"); + $(location).attr('href', href); + }else{ + $('#frmSurv').html(data); + } + }); + } + + //Tooltip de surveillance $('u[tooltip]').each(function(){ $(this).qtip({ content: $(this).attr('tooltip'),