FSN#36132 Alerts en confirm via jQuery dialoog
svn path=/Website/trunk/; revision=31592
This commit is contained in:
@@ -1091,8 +1091,39 @@ var FcltMgr =
|
||||
try { document.documentElement.focus(); }
|
||||
catch(e) {/* soms met IE8 op 'remembered' tabbladen */}
|
||||
},
|
||||
// TODO: Uitbreiden tot een meer luxe interface die mensen niet onbedoeld kunnen
|
||||
// disablen
|
||||
mydialog: function (tekst, params, fncallback)
|
||||
{
|
||||
var buttons = // Ok is er altijd
|
||||
[
|
||||
{
|
||||
text: params.oktekst || L("lcl_ok"),
|
||||
click: function ()
|
||||
{
|
||||
if (params.fncallback)
|
||||
params.fncallback();
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
];
|
||||
if (params.buttons)
|
||||
{
|
||||
buttons = buttons.concat(params.buttons);
|
||||
}
|
||||
$('<div></div>').appendTo('body')
|
||||
.html('<div>' + tekst + '</div>')
|
||||
.dialog({
|
||||
modal: true,
|
||||
title: params.title,
|
||||
zIndex: 10000,
|
||||
autoOpen: true,
|
||||
width: 'auto',
|
||||
resizable: false,
|
||||
buttons: buttons,
|
||||
close: function (event, ui) {
|
||||
$(this).remove();
|
||||
}
|
||||
});
|
||||
},
|
||||
confirm: function (tekst, params, fncallback)
|
||||
{
|
||||
if (typeof params == "function")
|
||||
@@ -1105,34 +1136,42 @@ var FcltMgr =
|
||||
fncallback();
|
||||
return;
|
||||
}
|
||||
if (confirm(tekst))
|
||||
if (!$.fn.dialog) // fallback als jQuery-ui niet is geladen
|
||||
{
|
||||
fncallback();
|
||||
if (confirm(tekst))
|
||||
{
|
||||
fncallback();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (params.fncancel)
|
||||
params.fncancel();
|
||||
}
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (params.fncancel)
|
||||
params.fncancel();
|
||||
}
|
||||
|
||||
/*
|
||||
jConfirm(tekst, "Titel", function (r) {
|
||||
if (r)
|
||||
{
|
||||
fncallback();
|
||||
}
|
||||
else
|
||||
params.fncallback = fncallback;
|
||||
params.buttons = [
|
||||
{
|
||||
text: params.canceltekst || L("lcl_cancel"),
|
||||
click: function ()
|
||||
{
|
||||
if (params.fncancel)
|
||||
params.fncancel();
|
||||
$(this).dialog("close");
|
||||
}
|
||||
});
|
||||
*/
|
||||
}];
|
||||
|
||||
this.mydialog (tekst, params, fncallback);
|
||||
},
|
||||
alert: function (tekst)
|
||||
alert: function (tekst, params)
|
||||
{
|
||||
alert(tekst);
|
||||
params = params || {};
|
||||
if (!$.fn.dialog) // fallback als jQuery-ui niet is geladen
|
||||
{
|
||||
alert(tekst);
|
||||
return;
|
||||
}
|
||||
this.mydialog (tekst, params);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -182,7 +182,9 @@ function scaffolding_edit(model, scf_params)
|
||||
FcltMgr.confirm('<%=safe.jsstring(L("lcl_scf_confirm_delete").format(model.record_title, xxx_data.name || xxx_data.id))%>',
|
||||
{ fncancel: function() {
|
||||
iface.button.enable("btn_scf_delete")
|
||||
} },
|
||||
},
|
||||
oktekst: L("lcl_delete")
|
||||
},
|
||||
function() {
|
||||
var data = {
|
||||
key: "<%=key%>"
|
||||
|
||||
@@ -63,7 +63,9 @@ function scaffolding_show(model, scf_params)
|
||||
|
||||
function xxx_delete()
|
||||
{
|
||||
FcltMgr.confirm('<%=safe.jsstring(L("lcl_scf_confirm_delete").format(model.record_title, xxx_data.name || xxx_data.id))%>', function() {
|
||||
FcltMgr.confirm('<%=safe.jsstring(L("lcl_scf_confirm_delete").format(model.record_title, xxx_data.name || xxx_data.id))%>',
|
||||
{ oktekst: L("lcl_delete") },
|
||||
function() {
|
||||
var data = {
|
||||
key: "<%=key%>"
|
||||
};
|
||||
|
||||
@@ -81,10 +81,9 @@ FCLTHeader =
|
||||
switch (params.plugins[i])
|
||||
{
|
||||
case "jQuery":
|
||||
FCLTHeader.Requires({js: ["jQuery.js", "FcltJquery.js", "jquery.alerts.js"]});
|
||||
FCLTHeader.Requires({js: ["jQuery.js", "FcltJquery.js"]});
|
||||
FCLTHeader.Requires({js: ["jquery.toast.min.js"],
|
||||
css: [rooturl + "/appl/localscripts/jquery.toast.min.css",
|
||||
rooturl + "/appl/localscripts/jquery.alerts.css"]});
|
||||
css: [rooturl + "/appl/localscripts/jquery.toast.min.css"]});
|
||||
break;
|
||||
case "suggest":
|
||||
FCLTHeader.Requires({js: [rooturl + "/appl/shared/suggest/suggest.js"],
|
||||
|
||||
Reference in New Issue
Block a user