diff --git a/fhem/fhem.pl b/fhem/fhem.pl index b78548cbc..53dd4e5d6 100755 --- a/fhem/fhem.pl +++ b/fhem/fhem.pl @@ -1257,7 +1257,7 @@ CommandSave($$) foreach my $fh (values %fh) { close($fh) if($fh ne "1"); } - return ($ret ? $ret : undef); + return ($ret ? $ret : "Wrote configuration to $param"); } ##################################### diff --git a/fhem/www/pgm2/brightstyle.css b/fhem/www/pgm2/brightstyle.css index 889fdeccc..ac3aee496 100644 --- a/fhem/www/pgm2/brightstyle.css +++ b/fhem/www/pgm2/brightstyle.css @@ -8,7 +8,7 @@ div#logo { position: fixed; z-index:12000; top:3px; left:5px; float:left; wid #console { width:100%; height:100%; position:absolute; overflow-y:auto;} #hdr { position: fixed; z-index: 1000; float: left; clear: both; height:32px; width: 100%; -webkit-box-sizing: border-box; moz-box-sizing: border-box; box-sizing: border-box; background:black; background-image: linear-gradient(#333333,#222222); } #content { width:70%; float:right; margin-top:60px; } -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } table { margin: 0; padding: 0; border-spacing: 0px; border-collapse:separate; } td, th { font-family: Arial, sans-serif; font-size:11px; line-height:13px; vertical-align:middle; } th { font-weight:bold; font-size:12px; text-align:left; } diff --git a/fhem/www/pgm2/console.js b/fhem/www/pgm2/console.js index 175a990b6..b5c7af884 100644 --- a/fhem/www/pgm2/console.js +++ b/fhem/www/pgm2/console.js @@ -6,13 +6,11 @@ function consUpdate() { if(consConn.readyState == 4) { - var errdiv = document.createElement('div'); - errdiv.innerHTML = "Connection lost, reconnecting in 5 seconds..."; - errdiv.setAttribute("id","connect_err"); - document.body.appendChild(errdiv); - setTimeout("consFill()", 5000); + FW_errmsg("Connection lost, trying a reconnect every 5 seconds."); + setTimeout(consFill, 5000); return; // some problem connecting } + if(consConn.readyState != 3) return; @@ -26,12 +24,8 @@ consUpdate() function consFill() { - var errdiv = document.getElementById("connect_err"); - if(errdiv) - document.body.removeChild(errdiv); - + FW_errmsg(""); consConn = new XMLHttpRequest(); - // Needed when using multiple FF windows var query = document.location.pathname+"?XHR=1"+ "&inform=type=raw;filter=.*"+ "×tamp="+new Date().getTime(); diff --git a/fhem/www/pgm2/darkfloorplanstyle.css b/fhem/www/pgm2/darkfloorplanstyle.css index fa11d7790..3eb500090 100644 --- a/fhem/www/pgm2/darkfloorplanstyle.css +++ b/fhem/www/pgm2/darkfloorplanstyle.css @@ -13,7 +13,7 @@ body[id~=Media] { background-color: #A5A5A5; font-family:Arial, Helvetica, s box-shadow:5px 5px 5px #000; margin-bottom: 10px;} #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} #startcontent {position:absolute; top:20px; left:200px; text-align:left; font-size: 16px; color:gray; } -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color:#CCCCCC; text-decoration:none;} td {padding-left: 3px; padding-right: 3px; padding-top: 3px; padding-bottom: 3px;} diff --git a/fhem/www/pgm2/darksmallscreenstyle.css b/fhem/www/pgm2/darksmallscreenstyle.css index 8d2384d18..f8ec1d414 100644 --- a/fhem/www/pgm2/darksmallscreenstyle.css +++ b/fhem/www/pgm2/darksmallscreenstyle.css @@ -6,7 +6,7 @@ body { background-color: #444444; background-image:url(../images/default/fhe #menu { position:absolute; top: 2px; left:65px; } #hdr { position:absolute; top:40px; left:65px; } #content { position:absolute; top:75px; left: 0px; right: 0px;} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } a { color: #CCCCCC; text-decoration: none;} a:hover { color: #ffffff; } diff --git a/fhem/www/pgm2/darkstyle.css b/fhem/www/pgm2/darkstyle.css index 4aa551192..bbd01a33e 100644 --- a/fhem/www/pgm2/darkstyle.css +++ b/fhem/www/pgm2/darkstyle.css @@ -7,7 +7,7 @@ body { background-color: #444444; background-image:url(../images/default/fhe #console { width:100%; height:100%; position:absolute; overflow-y:auto;} #hdr { position:absolute; top:10px; left:180px; } #content { position:absolute; top:50px; left:180px; bottom:20px; right:10px; } -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color: #CCCCCC; text-decoration: none;} a:hover { color: #ffffff; } diff --git a/fhem/www/pgm2/darksvg_style.css b/fhem/www/pgm2/darksvg_style.css index 02f7f1897..3a83f0b60 100644 --- a/fhem/www/pgm2/darksvg_style.css +++ b/fhem/www/pgm2/darksvg_style.css @@ -1,6 +1,4 @@ /* Author: Volker */ -.background { fill:none; fill-opacity:0.0; } - text { font-family:Arial, Helvetica, sans-serif; font-size:12px; fill:#CCCCCC;} text.title {font-family:Arial, Helvetica, sans-serif; font-size:16px; fill:#CCCCCC;} text.copy { text-decoration:underline; stroke:none; fill:blue;} diff --git a/fhem/www/pgm2/fhemweb.js b/fhem/www/pgm2/fhemweb.js index ff0804a4f..b1084999b 100644 --- a/fhem/www/pgm2/fhemweb.js +++ b/fhem/www/pgm2/fhemweb.js @@ -10,22 +10,44 @@ FW_cmd(arg) /* see also FW_devState */ var req = new XMLHttpRequest(); req.open("GET", arg, true); req.send(null); + req.onreadystatechange = function(){ + if(req.readyState == 4) + FW_errmsg(req.responseText, 5000); + } +} + +function +FW_errmsg(txt, timeout) +{ + var errmsg = document.getElementById("errmsg"); + if(!errmsg) { + if(txt == "") + return; + errmsg = document.createElement('div'); + errmsg.setAttribute("id","errmsg"); + document.body.appendChild(errmsg); + } + if(txt == "") { + document.body.removeChild(errmsg); + return; + } + errmsg.innerHTML = txt; + if(timeout) + setTimeout("FW_errmsg('')", timeout); } function FW_doUpdate() { if(FW_pollConn.readyState == 4 && !FW_leaving) { - var errdiv = document.createElement('div'); - errdiv.innerHTML = "Connection lost, reconnecting in 5 seconds..."; - errdiv.setAttribute("id","connect_err"); - document.body.appendChild(errdiv); - setTimeout("FW_longpoll()", 5000); + FW_errmsg("Connection lost, trying a reconnect every 5 seconds.", 4900); + setTimeout(FW_longpoll, 5000); return; // some problem connecting } if(FW_pollConn.readyState != 3) return; + var lines = FW_pollConn.responseText.split("\n"); //Pop the last (maybe empty) line after the last "\n" //We wait until it is complete, i.e. terminated by "\n" @@ -76,12 +98,7 @@ FW_doUpdate() function FW_longpoll() { - var errdiv = document.getElementById("connect_err"); - if(errdiv) - document.body.removeChild(errdiv); - FW_curLine = 0; - FW_pollConn = new XMLHttpRequest(); var filter = document.body.getAttribute("longpollfilter"); @@ -131,7 +148,7 @@ FW_replaceLinks() for(var i1=0; i1< elArr.length; i1++) { var a = elArr[i1]; var ma = a.getAttribute("href").match(/^(.*\?)(cmd[^=]*=.*)$/); - if(ma == null || ma.length == 0 || ma[2].match(/=(style|save)/)) + if(ma == null || ma.length == 0 || !ma[2].match(/=(save|set)/)) continue; a.removeAttribute("href"); a.setAttribute("onclick", "FW_cmd('"+ma[1]+"XHR=1&"+ma[2]+"')"); diff --git a/fhem/www/pgm2/floorplanstyle.css b/fhem/www/pgm2/floorplanstyle.css index c5aff84e9..ca8a0e8a2 100644 --- a/fhem/www/pgm2/floorplanstyle.css +++ b/fhem/www/pgm2/floorplanstyle.css @@ -19,7 +19,7 @@ body[id~=Media] { background-color: #A5A5A5; table a:hover {font-weight:bold;} #hdr { position:absolute; top:10px; left:180px; border:1px solid gray; } #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color: #278727; } img { border-style: none; } table { -moz-border-radius:8px; border-radius:8px; } diff --git a/fhem/www/pgm2/ios7floorplanstyle.css b/fhem/www/pgm2/ios7floorplanstyle.css index c5aff84e9..ca8a0e8a2 100644 --- a/fhem/www/pgm2/ios7floorplanstyle.css +++ b/fhem/www/pgm2/ios7floorplanstyle.css @@ -19,7 +19,7 @@ body[id~=Media] { background-color: #A5A5A5; table a:hover {font-weight:bold;} #hdr { position:absolute; top:10px; left:180px; border:1px solid gray; } #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color: #278727; } img { border-style: none; } table { -moz-border-radius:8px; border-radius:8px; } diff --git a/fhem/www/pgm2/ios7smallscreenfloorplanstyle.css b/fhem/www/pgm2/ios7smallscreenfloorplanstyle.css index c5aff84e9..ca8a0e8a2 100644 --- a/fhem/www/pgm2/ios7smallscreenfloorplanstyle.css +++ b/fhem/www/pgm2/ios7smallscreenfloorplanstyle.css @@ -19,7 +19,7 @@ body[id~=Media] { background-color: #A5A5A5; table a:hover {font-weight:bold;} #hdr { position:absolute; top:10px; left:180px; border:1px solid gray; } #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color: #278727; } img { border-style: none; } table { -moz-border-radius:8px; border-radius:8px; } diff --git a/fhem/www/pgm2/ios7smallscreenstyle.css b/fhem/www/pgm2/ios7smallscreenstyle.css index c80e94784..ca08c5383 100644 --- a/fhem/www/pgm2/ios7smallscreenstyle.css +++ b/fhem/www/pgm2/ios7smallscreenstyle.css @@ -15,7 +15,7 @@ select { font-family:Helvetica; font-weight:300; font-size:16px;} #console { width:100%; height:100%; position:absolute; overflow-y:auto;} #hdr { position:absolute; top:40px; left:65px; } #content { position:absolute; top:85px; left: 0px; right: 0px;} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } .devType { padding-top:10px; font-size:16px;} a { color: #151515; } diff --git a/fhem/www/pgm2/ios7style.css b/fhem/www/pgm2/ios7style.css index 33ff7781b..6a7fee033 100644 --- a/fhem/www/pgm2/ios7style.css +++ b/fhem/www/pgm2/ios7style.css @@ -23,7 +23,7 @@ select { font-family:Helvetica; font-weight:300; font-size:16px; } #content { position:absolute; top:50px; left:250px; bottom:20px; right:20px; } -#connect_err { background-color: #e5e5e5; color: #151515; text-align: center; padding-top: 25%; font-size: 350%; font-weight: bold; +#errmsg { background-color: #e5e5e5; color: #151515; text-align: center; padding-top: 25%; font-size: 350%; font-weight: bold; position:fixed; top:0px; left:0px; z-index: 10; width:100%; height: 100%; opacity: 0.7; } @@ -136,4 +136,4 @@ table#TYPE_remotecontrol td { padding: 5px 7px; } background: #e5e5e5; font-size:6px;} .rc_button { padding: 5px 7px;} .rc_button img { border-style: solid; border-width: 1px; border-color: transparent; } -.rc_button img:active { border-color: gray; } \ No newline at end of file +.rc_button img:active { border-color: gray; } diff --git a/fhem/www/pgm2/ios7svg_style.css b/fhem/www/pgm2/ios7svg_style.css index 5688a678e..f737f3f0c 100644 --- a/fhem/www/pgm2/ios7svg_style.css +++ b/fhem/www/pgm2/ios7svg_style.css @@ -1,6 +1,4 @@ /* Author: Volker Edit: fhainz */ -.background { fill:none; fill-opacity:0.0; } - text { font-family: Helvetica; font-weight:300; font-size:12px; fill:#343434;} text.title {font-family: Helvetica; font-weight:300; font-size:16px; fill:#343434;} text.copy { text-decoration:underline; stroke:none; fill:blue;} diff --git a/fhem/www/pgm2/ios7touchpadfloorplanstyle.css b/fhem/www/pgm2/ios7touchpadfloorplanstyle.css index c5aff84e9..ca8a0e8a2 100644 --- a/fhem/www/pgm2/ios7touchpadfloorplanstyle.css +++ b/fhem/www/pgm2/ios7touchpadfloorplanstyle.css @@ -19,7 +19,7 @@ body[id~=Media] { background-color: #A5A5A5; table a:hover {font-weight:bold;} #hdr { position:absolute; top:10px; left:180px; border:1px solid gray; } #content { position:absolute; top:50px; left:180px; bottom:10px; right:10px; text-align:center} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } a { color: #278727; } img { border-style: none; } table { -moz-border-radius:8px; border-radius:8px; } diff --git a/fhem/www/pgm2/smallscreenstyle.css b/fhem/www/pgm2/smallscreenstyle.css index c6972e6c3..cea1df25d 100644 --- a/fhem/www/pgm2/smallscreenstyle.css +++ b/fhem/www/pgm2/smallscreenstyle.css @@ -12,7 +12,7 @@ select { font-family:Arial, sans-serif; font-size:16px;} #console { width:100%; height:100%; position:absolute; overflow-y:auto;} #hdr { position:absolute; top:40px; left:65px; } #content { position:absolute; top:85px; left: 0px; right: 0px;} -#connect_err { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:0px; z-index: 10; } .devType { padding-top:10px; font-size:12px;} a { color: #278727; } @@ -79,3 +79,4 @@ svg { height:32px; width:32px; fill:#278727; } g.on { fill:red; } .changed { color:red; } +#cloudfree { display:none; } diff --git a/fhem/www/pgm2/style.css b/fhem/www/pgm2/style.css index 4d614efc3..37b11daa1 100644 --- a/fhem/www/pgm2/style.css +++ b/fhem/www/pgm2/style.css @@ -15,7 +15,7 @@ select { font-family:Arial, sans-serif; font-size:16px; } #hdr { position:absolute; top:10px; left:180px; } #content { position:absolute; top:50px; left:180px; bottom:20px; right:10px; } -#connect_err { background-color: #000000; color: #FFFFFF; +#errmsg { background-color: #000000; color: #FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } .devType { padding-top:20px; } a { color: #278727; } diff --git a/fhem/www/pgm2/svg_style.css b/fhem/www/pgm2/svg_style.css index 54c7ed42b..f6c65682f 100644 --- a/fhem/www/pgm2/svg_style.css +++ b/fhem/www/pgm2/svg_style.css @@ -1,5 +1,3 @@ -.background { fill:none; fill-opacity:0.0; } - text { font-family:Times; font-size:12px; } text.title { font-size:16px; } text.copy { text-decoration:underline; stroke:none; fill:blue; } diff --git a/fhem/www/pgm2/touchpadstyle.css b/fhem/www/pgm2/touchpadstyle.css index d257a37c8..765a9db06 100644 --- a/fhem/www/pgm2/touchpadstyle.css +++ b/fhem/www/pgm2/touchpadstyle.css @@ -12,7 +12,7 @@ select { font-family:Arial, sans-serif; font-size:18px} #hdr { position:absolute; top:10px; left:160px; } #console { width:100%; height:100%; position:absolute; overflow-y:auto;} #content { position:absolute; top:50px; left:160px; bottom:20px; right:10px; } -#connect_err { background-color:#000000; color:#FFFFFF; +#errmsg { background-color:#000000; color:#FFFFFF; position:absolute; top:0px; left:40px; z-index: 10; } .devType { padding-top:20px; }