";
if($FW_ss) { # FS20MS2 special: on and off, is not the same as toggle
my $webCmd = AttrVal($d, "webCmd", undef);
@@ -3077,6 +3080,21 @@ FW_widgetOverride($$)
Space in the room and group name has to be written as %20 for this
attribute.
+
+
+
+
confirmDelete
+ confirm delete actions with a dialog. Default is 1, set it to 0 to
+ disable the feature.
+
+
+
+
+
CORS
+ If set to 1, FHEMWEB will supply a "Cross origin resource sharing"
+ header, see the wikipedia for details.
+
+
csrfToken
@@ -3107,13 +3125,6 @@ FW_widgetOverride($$)
-
-
CORS
- If set to 1, FHEMWEB will supply a "Cross origin resource sharing"
- header, see the wikipedia for details.
-
-
-
defaultRoom
show the specified room if no room selected, e.g. on execution of some
@@ -3782,6 +3793,13 @@ FW_widgetOverride($$)
%20 zu schreiben.
+
+
confirmDelete
+ Löschaktionen weden mit einem Dialog bestätigt.
+ Falls dieses Attribut auf 0 gesetzt ist, entfällt das.
+
+
+
CORS
Wenn auf 1 gestellt, wird FHEMWEB einen "Cross origin resource sharing"
diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js
index 342f9e66d..ce0421014 100644
--- a/fhem/www/pgm2/fhemweb.js
+++ b/fhem/www/pgm2/fhemweb.js
@@ -88,6 +88,7 @@ FW_jqueryReadyFn()
FW_root = r;
FW_replaceWidgets($("html"));
+ FW_confirmDelete();
// Fix the td count by setting colspan on the last column
$("table.block.wide").each(function(){ // table
@@ -214,6 +215,50 @@ FW_jqueryReadyFn()
FW_inlineModify();
}
+function
+FW_confirmDelete()
+{
+ var d = $("div#content");
+ var cd = $(d).attr("data-confirmDelete");
+ if(!cd || cd == 0)
+ return;
+ var wn = $(d).attr("data-webName");
+ $(d).find("a").each(function(){
+ var href = $(this).attr("href");
+ if(!href)
+ return;
+ var ma = $(this).attr("href").match(/.*cmd[^=]*=(delete[^&]*)&.*$/);
+ if(!ma || ma.length != 2)
+ return;
+ $(this).attr("href", "#");
+ $(this).unbind("click");
+ $(this).click(function(e){
+ e.preventDefault();
+
+ var div = $("");
+ $(div).html("Do you really want to "+ma[1]+"? "+
+ " Skip this dialog in the future");
+ $("body").append(div);
+
+ function
+ doClose()
+ {
+ if($(div).find("input:checked").length)
+ FW_cmd(FW_root+"?cmd=attr "+wn+" confirmDelete 0&XHR=1");
+ $(this).dialog("close"); $(div).remove();
+ }
+
+ $(div).dialog({
+ dialogClass:"no-close", modal:true, width:"auto", closeOnEscape:true,
+ maxWidth:$(window).width()*0.9, maxHeight:$(window).height()*0.9,
+ buttons: [
+ {text:"Yes", click:function(){ location.href = ma[0]; doClose(); }},
+ {text:"No", click:function(){ doClose(); }}]
+ });
+ });
+ });
+}
+
// Show the webCmd list in a dialog if: smallScreen & hiddenroom=detail & room
function
FW_smallScreenCommands()