mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 07:23:13 +00:00
Add a callback option to Phraseanet Alerts
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user