mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-18 15:33:15 +00:00
Add a callback option to Phraseanet Alerts
This commit is contained in:
@@ -12,21 +12,24 @@ var p4 = p4 || {};
|
|||||||
return $('#p4_alerts');
|
return $('#p4_alerts');
|
||||||
}
|
}
|
||||||
|
|
||||||
function alert(title, message)
|
function alert(title, message, callback)
|
||||||
{
|
{
|
||||||
var dialog = create_dialog();
|
var dialog = create_dialog();
|
||||||
|
|
||||||
var button = new Object();
|
var button = new Object();
|
||||||
|
|
||||||
button[language.annuler] = function(){
|
button['Ok'] = function(){
|
||||||
dialog.dialog('close');
|
if(typeof callback === 'function')
|
||||||
|
callback();
|
||||||
|
else
|
||||||
|
dialog.dialog('close');
|
||||||
};
|
};
|
||||||
|
|
||||||
dialog.attr('title',title)
|
dialog.dialog('destroy').attr('title',title)
|
||||||
.empty()
|
.empty()
|
||||||
.append(message)
|
.append(message)
|
||||||
.dialog({
|
.dialog({
|
||||||
|
|
||||||
autoOpen:false,
|
autoOpen:false,
|
||||||
closeOnEscape:true,
|
closeOnEscape:true,
|
||||||
resizable:false,
|
resizable:false,
|
||||||
@@ -40,6 +43,15 @@ var p4 = p4 || {};
|
|||||||
}
|
}
|
||||||
}).dialog('open');
|
}).dialog('open');
|
||||||
|
|
||||||
|
if(typeof callback === 'function')
|
||||||
|
{
|
||||||
|
dialog.bind( "dialogclose", function(event, ui) {callback();});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user