ajout du support de la touche entrée, issue #0000271

This commit is contained in:
Michael RICOIS 2010-05-05 10:20:20 +00:00
parent d063544a19
commit 4ea89f6770

View File

@ -49,26 +49,15 @@ $(document).ready(function(){
open: function(event, ui) {
$(this).html('Chargement...');
$(this).load(href);
},
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('<div id="frmSurv">Mise sous surveillance en cours...</div>');
$.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);
$('#dialogsurv').keypress(function(e){
if (e.keyCode == 13){
e.preventDefault();
survSubmit();
}
});
},
buttons: {
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('<div id="frmSurv">Mise sous surveillance en cours...</div>');
$.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'),