Add a callback option to Phraseanet Alerts

This commit is contained in:
Romain Neutron
2012-01-31 11:43:45 +01:00
parent ce11876411
commit 6fb9efe1b3

View File

@@ -12,17 +12,20 @@ var p4 = p4 || {};
return $('#p4_alerts');
}
function alert(title, message)
function alert(title, message, callback)
{
var dialog = create_dialog();
var button = new Object();
button[language.annuler] = function(){
dialog.dialog('close');
button['Ok'] = function(){
if(typeof callback === 'function')
callback();
else
dialog.dialog('close');
};
dialog.attr('title',title)
dialog.dialog('destroy').attr('title',title)
.empty()
.append(message)
.dialog({
@@ -40,6 +43,15 @@ var p4 = p4 || {};
}
}).dialog('open');
if(typeof callback === 'function')
{
dialog.bind( "dialogclose", function(event, ui) {callback();});
}
else
{
}
return;
}