mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-04-20 01:06:04 +00:00
01_FHEMWEB.pm/fhemweb.js: confirmDelete Attribute (Forum #55905)
git-svn-id: https://svn.fhem.de/fhem/trunk@11924 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
72cffd1e0c
commit
1511936bd5
@ -145,6 +145,7 @@ FHEMWEB_Initialize($)
|
|||||||
basicAuthMsg
|
basicAuthMsg
|
||||||
closeConn:1,0
|
closeConn:1,0
|
||||||
column
|
column
|
||||||
|
confirmDelete
|
||||||
defaultRoom
|
defaultRoom
|
||||||
deviceOverview:always,iconOnly,onClick,never
|
deviceOverview:always,iconOnly,onClick,never
|
||||||
editConfig:1,0
|
editConfig:1,0
|
||||||
@ -1171,7 +1172,9 @@ FW_doDetail($)
|
|||||||
my $h = $defs{$d};
|
my $h = $defs{$d};
|
||||||
my $t = $h->{TYPE};
|
my $t = $h->{TYPE};
|
||||||
$t = "MISSING" if(!defined($t));
|
$t = "MISSING" if(!defined($t));
|
||||||
FW_pO "<div id=\"content\">";
|
my $cd = AttrVal($FW_wname, "confirmDelete", 1);
|
||||||
|
FW_pO "<div id=\"content\" data-confirmDelete=\"$cd\" ".
|
||||||
|
"data-webName=\"$FW_wname\">";
|
||||||
|
|
||||||
if($FW_ss) { # FS20MS2 special: on and off, is not the same as toggle
|
if($FW_ss) { # FS20MS2 special: on and off, is not the same as toggle
|
||||||
my $webCmd = AttrVal($d, "webCmd", undef);
|
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
|
Space in the room and group name has to be written as %20 for this
|
||||||
attribute.
|
attribute.
|
||||||
</li>
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="confirmDelete"></a>
|
||||||
|
<li>confirmDelete<br>
|
||||||
|
confirm delete actions with a dialog. Default is 1, set it to 0 to
|
||||||
|
disable the feature.
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a name="CORS"></a>
|
||||||
|
<li>CORS<br>
|
||||||
|
If set to 1, FHEMWEB will supply a "Cross origin resource sharing"
|
||||||
|
header, see the wikipedia for details.
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="csrfToken"></a>
|
<a name="csrfToken"></a>
|
||||||
<li>csrfToken<br>
|
<li>csrfToken<br>
|
||||||
@ -3107,13 +3125,6 @@ FW_widgetOverride($$)
|
|||||||
</ul>
|
</ul>
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
<a name="CORS"></a>
|
|
||||||
<li>CORS<br>
|
|
||||||
If set to 1, FHEMWEB will supply a "Cross origin resource sharing"
|
|
||||||
header, see the wikipedia for details.
|
|
||||||
</li>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
<a name="defaultRoom"></a>
|
<a name="defaultRoom"></a>
|
||||||
<li>defaultRoom<br>
|
<li>defaultRoom<br>
|
||||||
show the specified room if no room selected, e.g. on execution of some
|
show the specified room if no room selected, e.g. on execution of some
|
||||||
@ -3782,6 +3793,13 @@ FW_widgetOverride($$)
|
|||||||
%20 zu schreiben.
|
%20 zu schreiben.
|
||||||
</li><br>
|
</li><br>
|
||||||
|
|
||||||
|
<a name="confirmDelete"></a>
|
||||||
|
<li>confirmDelete<br>
|
||||||
|
Löschaktionen weden mit einem Dialog bestätigt.
|
||||||
|
Falls dieses Attribut auf 0 gesetzt ist, entfällt das.
|
||||||
|
</li>
|
||||||
|
<br>
|
||||||
|
|
||||||
<a name="CORS"></a>
|
<a name="CORS"></a>
|
||||||
<li>CORS<br>
|
<li>CORS<br>
|
||||||
Wenn auf 1 gestellt, wird FHEMWEB einen "Cross origin resource sharing"
|
Wenn auf 1 gestellt, wird FHEMWEB einen "Cross origin resource sharing"
|
||||||
|
@ -88,6 +88,7 @@ FW_jqueryReadyFn()
|
|||||||
FW_root = r;
|
FW_root = r;
|
||||||
|
|
||||||
FW_replaceWidgets($("html"));
|
FW_replaceWidgets($("html"));
|
||||||
|
FW_confirmDelete();
|
||||||
|
|
||||||
// Fix the td count by setting colspan on the last column
|
// Fix the td count by setting colspan on the last column
|
||||||
$("table.block.wide").each(function(){ // table
|
$("table.block.wide").each(function(){ // table
|
||||||
@ -214,6 +215,50 @@ FW_jqueryReadyFn()
|
|||||||
FW_inlineModify();
|
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 id='FW_okDialog'>");
|
||||||
|
$(div).html("Do you really want to "+ma[1]+"?<br><br>"+
|
||||||
|
"<input type='checkbox' name='noconf'> 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
|
// Show the webCmd list in a dialog if: smallScreen & hiddenroom=detail & room
|
||||||
function
|
function
|
||||||
FW_smallScreenCommands()
|
FW_smallScreenCommands()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user