2017-10-04 17:46:12 +00:00
|
|
|
|
|
|
|
FW_version["fhemweb_iconRadio.js"] = "$Id$";
|
|
|
|
|
|
|
|
FW_widgets['iconRadio'] = {
|
|
|
|
createFn:FW_iconRadioCreate,
|
|
|
|
};
|
|
|
|
|
|
|
|
/********* iconRadio *********/
|
|
|
|
function
|
|
|
|
FW_iconRadioCreate(elName, devName, vArr, currVal, set, params, cmd)
|
|
|
|
{
|
|
|
|
if( 0 ) {
|
|
|
|
console.log( "elName: "+elName );
|
|
|
|
console.log( "devName: "+devName );
|
|
|
|
console.log( "vArr: "+vArr );
|
|
|
|
console.log( "currVal: "+currVal );
|
|
|
|
console.log( "set: "+set );
|
|
|
|
console.log( "params: "+params );
|
|
|
|
console.log( "cmd: "+cmd );
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!vArr.length || vArr[0] != "iconRadio")
|
|
|
|
return undefined;
|
|
|
|
var ipar = 2;
|
|
|
|
|
2017-11-03 19:16:10 +00:00
|
|
|
var iconclass = "";
|
|
|
|
if(vArr[1].match(/class.*?@/)) {
|
|
|
|
var m = vArr[1].match(/class(.*?)@/);
|
|
|
|
iconclass = m && m[1] ? m[1] : "";
|
|
|
|
vArr[1] = vArr[1].replace(/class.*?@/,"");
|
|
|
|
}
|
|
|
|
|
2017-10-24 12:11:24 +00:00
|
|
|
var use4icon = false;
|
2017-10-25 18:37:37 +00:00
|
|
|
if(vArr[1].match(/^use4icon@|^@/)) {
|
2017-10-24 12:11:24 +00:00
|
|
|
use4icon = true;
|
2017-10-25 18:37:37 +00:00
|
|
|
vArr[1] = vArr[1].replace(/^use4icon@|^@/,"");
|
2017-10-24 12:11:24 +00:00
|
|
|
}
|
|
|
|
|
2017-11-06 14:47:33 +00:00
|
|
|
if( vArr[1].match(/^[A-F0-9]{6}$/i))
|
2017-10-04 17:46:12 +00:00
|
|
|
vArr[1] = "#"+vArr[1];
|
2017-10-24 12:11:24 +00:00
|
|
|
|
2017-10-04 17:46:12 +00:00
|
|
|
var newEl = $("<div style='display:inline-block;'>").get(0);
|
|
|
|
$(newEl).addClass(vArr[0]);
|
|
|
|
|
|
|
|
var hidden;
|
|
|
|
if(elName)
|
|
|
|
hidden = $('<input type="hidden" name="'+elName+'" value="'+currVal+'">');
|
|
|
|
$(newEl).append(hidden);
|
|
|
|
|
|
|
|
var clicked = function(arg) { var new_val=newEl.getValueFn(arg);
|
|
|
|
newEl.setValueFn( new_val );
|
|
|
|
if( cmd )
|
|
|
|
cmd(new_val);
|
|
|
|
};
|
|
|
|
|
|
|
|
var buttons = [];
|
2017-11-03 19:16:10 +00:00
|
|
|
var istart = 2;
|
|
|
|
for( var i = 2; i < (vArr.length-1); i+=ipar ) {
|
|
|
|
if(!isNaN(parseFloat(vArr[i]))) {
|
|
|
|
istart = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var iend = vArr.length-ipar;
|
|
|
|
for( var i = istart+ipar; i < (vArr.length-1); i+=ipar ) {
|
|
|
|
if(isNaN(parseFloat(vArr[i]))) {
|
|
|
|
iend = i-ipar;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var ascd = true;
|
|
|
|
if(!isNaN(parseFloat(vArr[istart+ipar])) && parseFloat(vArr[istart]) > parseFloat(vArr[istart+ipar]))
|
|
|
|
ascd = false;
|
|
|
|
|
2017-10-04 17:46:12 +00:00
|
|
|
for( var i = 2; i < (vArr.length); i+=ipar ) {
|
2017-11-03 19:16:10 +00:00
|
|
|
|
2017-10-04 17:46:12 +00:00
|
|
|
var button = $('<input type="radio" name="radio">').uniqueId();
|
2017-11-03 19:16:10 +00:00
|
|
|
var label = $('<label for="'+button.attr("id")+'" iconr=":'+((i-2)/ipar)+':" name="'+vArr[i+1]+'" title="'+vArr[i]+'" >'+vArr[i]+'</label>');
|
2017-10-04 17:46:12 +00:00
|
|
|
buttons.push(button);
|
|
|
|
|
|
|
|
$(newEl).append(button);
|
|
|
|
$(newEl).append(label);
|
|
|
|
|
|
|
|
$(button).change(clicked);
|
|
|
|
|
2017-10-24 12:11:24 +00:00
|
|
|
// console.log("currVal: "+currVal+", vArr["+i+"]: "+vArr[i]+", is: "+ (currVal == vArr[i]));
|
2017-11-03 19:16:10 +00:00
|
|
|
if( currVal ) {
|
|
|
|
// console.log("FW_cmd, i:",i,"ascd:",ascd,"istart:",istart,"iend:",iend);
|
|
|
|
// console.log("FW_cmd, parseFloat(currVal):", parseFloat(currVal),"i+ipar:",i+ipar,"parseFloat(vArr[i+ipar]):",parseFloat(vArr[i+ipar]),"i:",i,"parseFloat(vArr[i]):",parseFloat(vArr[i]));
|
|
|
|
if(ascd && i>istart && !isNaN(parseFloat(vArr[i-ipar])) && !isNaN(parseFloat(currVal)) && !isNaN(parseFloat(vArr[i]))){
|
|
|
|
button.prop("checked", parseFloat(currVal) > parseFloat(vArr[i-ipar]) && parseFloat(currVal) <= parseFloat(vArr[i]));
|
|
|
|
} else if(!ascd && i<iend && !isNaN(parseFloat(vArr[i+ipar])) && !isNaN(parseFloat(currVal)) && !isNaN(parseFloat(vArr[i]))) {
|
|
|
|
button.prop("checked", parseFloat(currVal) > parseFloat(vArr[i+ipar]) && parseFloat(currVal) <= parseFloat(vArr[i]));
|
|
|
|
} else if(ascd && i==istart && !isNaN(parseFloat(currVal)) && !isNaN(parseFloat(vArr[i]))) {
|
|
|
|
button.prop("checked", parseFloat(currVal) <= parseFloat(vArr[i]));
|
|
|
|
} else if(!ascd && i==iend && !isNaN(parseFloat(currVal)) && !isNaN(parseFloat(vArr[i]))) {
|
|
|
|
button.prop("checked", parseFloat(currVal) <= parseFloat(vArr[i]));
|
|
|
|
} else {
|
|
|
|
button.prop("checked", currVal == vArr[i]);
|
|
|
|
}
|
|
|
|
}
|
2017-10-04 17:46:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$(newEl).buttonset();
|
|
|
|
$(newEl).find("label").css({"margin":"0","border":"0","border-radius":"4px","background":"inherit"});
|
2017-10-24 12:11:24 +00:00
|
|
|
$(newEl).find("span").css({"padding":"0.0em 0.3em"})
|
|
|
|
.attr( "selectcolor",use4icon ? vArr[1] : "");
|
|
|
|
$(newEl).find("input").each(function(ind,val){
|
|
|
|
$(val).next().find("span").attr("ischecked",$(val).prop("checked"));
|
|
|
|
// console.log("input checked("+ind+"): "+$(val).prop("checked"));
|
|
|
|
});
|
2018-01-13 16:32:12 +00:00
|
|
|
$(newEl).find("label").each(function(indx,val){
|
2017-10-24 12:11:24 +00:00
|
|
|
$(val).addClass("iconRadio_widget")
|
2017-10-04 17:46:12 +00:00
|
|
|
|
2018-01-13 16:32:12 +00:00
|
|
|
var ico = vArr[indx*ipar+3];
|
2017-10-24 12:11:24 +00:00
|
|
|
var m = ico.match(/.*@(.*)/);
|
2017-10-27 22:05:16 +00:00
|
|
|
var uscol = m && m[1] ? m[1] : "none";
|
2017-11-06 14:47:33 +00:00
|
|
|
if( uscol.match(/^[A-F0-9]{6}$/i))
|
2017-10-24 12:11:24 +00:00
|
|
|
uscol = "#"+uscol;
|
2017-10-27 22:05:16 +00:00
|
|
|
if(uscol == 'none')
|
2018-01-13 16:32:12 +00:00
|
|
|
ico += "@none"; //@none
|
2017-10-24 12:11:24 +00:00
|
|
|
$(val).find("span").attr( "unselectcolor",uscol);
|
|
|
|
|
2018-01-13 16:32:12 +00:00
|
|
|
FW_cmd(FW_root+"?cmd={FW_makeImage('"+ico+"','"+ico+"',':"+indx+": "+(iconclass.length > 0 ? iconclass :'')+"')}&XHR=1",function(data){
|
2017-11-03 19:16:10 +00:00
|
|
|
data = data.replace(/\n$/,'');
|
|
|
|
// console.log($(data).attr("class"));
|
|
|
|
var m = $(data).attr("class").match(/(:\d+?:)/);
|
|
|
|
var iconr = m && m[1] ? m[1] : "error";
|
|
|
|
$(newEl).find("label[iconr='"+iconr+"']").each(function(ind,val){
|
2017-10-24 12:11:24 +00:00
|
|
|
var span = $(val).find("span");
|
|
|
|
var sc = $(span).attr("selectcolor");
|
2018-01-13 16:32:12 +00:00
|
|
|
var usc = $(span).attr("unselectcolor") == "none" ? "none" : $(span).attr("unselectcolor");
|
|
|
|
// console.log($(span).attr("unselectcolor") == "none");
|
2017-11-15 14:10:56 +00:00
|
|
|
if( usc.match(/^[A-F0-9]{6}$/i))
|
|
|
|
usc = "#"+usc;
|
2017-10-24 12:11:24 +00:00
|
|
|
var isc = $(span).attr("ischecked");
|
|
|
|
// console.log("span usc_"+ind+": "+usc+", sc_"+ind+": "+sc);
|
2017-11-03 19:16:10 +00:00
|
|
|
// console.log("Fw_cmd checked: "+ind+": "+isc);
|
|
|
|
if(isc == "true") {
|
|
|
|
if(sc.length > 0) {
|
2017-11-15 14:10:56 +00:00
|
|
|
var re1 = new RegExp('fill="'+usc+'"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?"'+usc+'[;\\s]','gi');
|
2018-01-13 16:32:12 +00:00
|
|
|
// console.log("FW_cmd re1u=",re1+"",", re2u=",re2+"");
|
2017-11-15 14:10:56 +00:00
|
|
|
data = data.replace(re1,'fill="'+sc+'"')
|
|
|
|
.replace(re2,'fill:'+sc+';');
|
2017-11-03 19:16:10 +00:00
|
|
|
// console.log("Fw_cmd sc_ind: "+ind+": "+sc+", isc:"+isc+"\n"+data);
|
2018-01-13 16:32:12 +00:00
|
|
|
} else {
|
|
|
|
var re1 = new RegExp('fill="none"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?none[;\\s]','gi');
|
|
|
|
data = data.replace(re1,'fill=""')
|
|
|
|
.replace(re2,'fill:; ');
|
|
|
|
// console.log("Fw_cmd sc_ind: "+ind+": "+sc+", isc:"+isc+"\n"+data);
|
2017-11-03 19:16:10 +00:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if(sc.length > 0) {
|
2018-01-13 16:32:12 +00:00
|
|
|
var re1 = new RegExp('fill="none|'+sc+'"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?(none|"'+sc+')[;\\s]','gi');
|
|
|
|
// console.log("FW_cmd re1=",re1+"",", re2=",re2+"");
|
|
|
|
data = data.replace(re1,'fill="'+(usc=="none"?"":usc)+'"')
|
|
|
|
.replace(re2,'fill:'+(usc=="none"?"":usc)+';');
|
|
|
|
// console.log("Fw_cmd usc_ind: "+ind+": "+usc+", isc:"+isc+"\n"+data);
|
|
|
|
} else {
|
|
|
|
var re1 = new RegExp('fill="none"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?none[;\\s]','gi');
|
|
|
|
data = data.replace(re1,'fill=""')
|
|
|
|
.replace(re2,'fill:; ');
|
2017-11-03 19:16:10 +00:00
|
|
|
// console.log("Fw_cmd usc_ind: "+ind+": "+usc+", isc:"+isc+"\n"+data);
|
2017-10-24 12:11:24 +00:00
|
|
|
}
|
2017-10-04 17:46:12 +00:00
|
|
|
}
|
2017-11-03 19:16:10 +00:00
|
|
|
$(span).addClass("iconRadio_widget").html(data);
|
2017-10-04 17:46:12 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
});
|
|
|
|
if( !currVal )
|
|
|
|
currVal = ",";
|
|
|
|
|
|
|
|
newEl.getValueFn = function(arg) { var new_val="";
|
|
|
|
for( var i = 0; i < buttons.length; ++i ) {
|
|
|
|
var button = buttons[i];
|
2017-10-24 12:11:24 +00:00
|
|
|
var span = button.next().find("span");
|
|
|
|
var sc = $(span).attr("selectcolor");
|
2017-11-15 14:10:56 +00:00
|
|
|
var usc = $(span).attr("unselectcolor");
|
|
|
|
if( usc.match(/^[A-F0-9]{6}$/i))
|
|
|
|
usc = "#"+usc;
|
2017-10-24 12:11:24 +00:00
|
|
|
if( $(button).prop("checked") == true) {
|
|
|
|
if(sc.length > 0) {
|
2017-11-15 14:10:56 +00:00
|
|
|
|
|
|
|
var re1 = new RegExp('fill="'+usc+'"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?"'+usc+'[;\\s]','gi');
|
|
|
|
// console.log("getFn re1u=",re1,", re2u=",re2);
|
|
|
|
var html = $(span).html().replace(re1,'fill="'+sc+'"')
|
|
|
|
.replace(re2,'fill:'+sc+';');
|
2017-10-24 12:11:24 +00:00
|
|
|
// console.log("getFn sc_i:"+i+": "+sc+"\n"+html);
|
|
|
|
$(span).html(html);
|
|
|
|
} else {
|
2017-10-04 17:46:12 +00:00
|
|
|
button.next().css({"background-color":vArr[1]});
|
2017-10-24 12:11:24 +00:00
|
|
|
}
|
2017-11-03 19:16:10 +00:00
|
|
|
// console.log("getFn new_val: ",new_val)
|
2017-10-04 17:46:12 +00:00
|
|
|
if( new_val ) new_val += ',';
|
|
|
|
new_val += $(button).button( "option", "label")
|
|
|
|
}
|
|
|
|
}
|
2017-11-03 19:16:10 +00:00
|
|
|
|
2017-10-24 12:11:24 +00:00
|
|
|
if( !new_val ) return ',';
|
|
|
|
return new_val;
|
2017-10-04 17:46:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
newEl.setValueFn = function(arg){ if( !arg ) arg = ',';
|
|
|
|
if( hidden )
|
|
|
|
hidden.attr("value", arg);
|
2017-11-03 19:16:10 +00:00
|
|
|
var istart = 0;
|
|
|
|
for( var i = 0; i < buttons.length; i++ ) {
|
|
|
|
if(!isNaN(parseFloat(vArr[i*ipar+2]))) {
|
|
|
|
istart = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var iend = buttons.length-1;
|
|
|
|
for( var i = istart+1; i < buttons.length; i++ ) {
|
|
|
|
if(isNaN(parseFloat(vArr[i*ipar+2]))) {
|
|
|
|
iend = i-1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
var ascd = true;
|
|
|
|
if(!isNaN(parseFloat(vArr[(istart+1)*ipar+2])) && parseFloat(vArr[istart*ipar+2]) > parseFloat(vArr[(istart+1)*ipar+2]))
|
|
|
|
ascd = false;
|
2017-10-04 17:46:12 +00:00
|
|
|
for( var i = 0; i < buttons.length; ++i ) {
|
|
|
|
var button = buttons[i];
|
2017-10-24 12:11:24 +00:00
|
|
|
var span = button.next().find("span");
|
|
|
|
var sc = $(span).attr("selectcolor");
|
2017-10-27 22:05:16 +00:00
|
|
|
var usc = $(span).attr("unselectcolor") == "none" ? "" : $(span).attr("unselectcolor");
|
2017-11-06 14:47:33 +00:00
|
|
|
if( usc.match(/^[A-F0-9]{6}$/i))
|
2017-10-24 12:11:24 +00:00
|
|
|
usc = "#"+usc;
|
2017-11-03 19:16:10 +00:00
|
|
|
// console.log("setFn usc_"+i+": "+usc+": sc_"+i+": "+sc+", arg: "+arg);
|
|
|
|
// console.log("setFn, i:",i,"ascd:",ascd,"istart:",istart,"iend:",iend);
|
|
|
|
// console.log("setFn, parseFloat(arg):", parseFloat(arg),"(i+1)*ipar+2:",(i+1)*ipar+2,"parseFloat(vArr[(i+1)*ipar+2]):",parseFloat(vArr[(i+1)*ipar+2]),"i*ipar+2:",i*ipar+2,"parseFloat(vArr[i*ipar+2]):",parseFloat(vArr[i*ipar+2]));
|
|
|
|
if(ascd && i>istart && !isNaN(parseFloat(vArr[(i-1)*ipar+2])) && !isNaN(parseFloat(arg)) && !isNaN(parseFloat(vArr[i*ipar+2]))){
|
|
|
|
button.prop("checked", parseFloat(arg) > parseFloat(vArr[(i-1)*ipar+2]) && parseFloat(arg) <= parseFloat(vArr[i*ipar+2]));
|
|
|
|
} else if(!ascd && i<iend && !isNaN(parseFloat(vArr[(i+1)*ipar+2])) && !isNaN(parseFloat(arg)) && !isNaN(parseFloat(vArr[i*ipar+2]))) {
|
|
|
|
button.prop("checked", parseFloat(arg) > parseFloat(vArr[(i+1)*ipar+2]) && parseFloat(arg) <= parseFloat(vArr[i*ipar+2]));
|
|
|
|
} else if(ascd && i==istart && !isNaN(parseFloat(arg)) && !isNaN(parseFloat(vArr[i*ipar+2]))) {
|
|
|
|
button.prop("checked", parseFloat(arg) <= parseFloat(vArr[i*ipar+2]));
|
|
|
|
} else if(!ascd && i==iend && !isNaN(parseFloat(arg)) && !isNaN(parseFloat(vArr[i*ipar+2]))) {
|
|
|
|
button.prop("checked", parseFloat(arg) <= parseFloat(vArr[i*ipar+2]));
|
|
|
|
} else {
|
|
|
|
button.prop("checked", arg == vArr[i*ipar+2]);
|
|
|
|
}
|
|
|
|
|
2017-10-24 12:11:24 +00:00
|
|
|
if (button.prop("checked") == true){
|
|
|
|
if(sc.length > 0) {
|
2017-11-15 14:10:56 +00:00
|
|
|
var re1 = new RegExp('fill="'+usc+'"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?"'+usc+'[;\\s]','gi');
|
|
|
|
// console.log("setFn re1u=",re1,", re2u=",re2);
|
|
|
|
var html = $(span).html().replace(re1,'fill="'+sc+'"')
|
|
|
|
.replace(re2,"fill:"+sc+";");
|
2017-10-24 12:11:24 +00:00
|
|
|
$(span).html(html);
|
|
|
|
} else {
|
|
|
|
button.next().css({"background-color":vArr[1]});
|
|
|
|
}
|
2017-10-04 17:46:12 +00:00
|
|
|
} else {
|
2017-10-24 12:11:24 +00:00
|
|
|
if(sc.length > 0) {
|
2017-11-15 14:10:56 +00:00
|
|
|
var re1 = new RegExp('fill="'+sc+'"','gi');
|
|
|
|
var re2 = new RegExp('fill:\\s?"'+sc+'[;\\s]','gi');
|
|
|
|
// console.log("setFn re1=",re1,", re2=",re2);
|
|
|
|
var html = $(span).html().replace(re1,'fill="'+usc+'"')
|
|
|
|
.replace(re2,'fill:'+usc+';');
|
2017-10-24 12:11:24 +00:00
|
|
|
$(span).html(html);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
button.next().css({"background-color":"inherit"});
|
|
|
|
}
|
2017-10-04 17:46:12 +00:00
|
|
|
}
|
|
|
|
button.button("refresh");
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
newEl.setValueFn( currVal );
|
|
|
|
return newEl;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
=pod
|
|
|
|
=begin html
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<u>To the icon.* widgets listed below applies:</u><br>
|
|
|
|
<color> is specified by a color name or a color number without leading <b>#</b> e.g. FFA500 or orange. Depending on the context <b>@</b> has to be escaped <b>\@</b>.<br>
|
|
|
|
<icon> is the icon name.<br>
|
2017-11-03 19:16:10 +00:00
|
|
|
[class<classname>@] as prefix in front of the second parameter, assigns a css-class to the icons.<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
Examples for import with raw definition, will be found in <a href="https://wiki.fhem.de/wiki/FHEMWEB/Widgets">FHEMWEB-Widgets</a>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconRadio,[class<classname>@][use4icon@]<select color>,<value>,<icon>[@<color>][,<value>,<icon>[@<color>]]...
|
|
|
|
- displays Icons as radio button and returns value if pushed.<br>
|
|
|
|
<value> return or compare value. If a numerical sequence of <value> is specified, the current value will match the next higher <value>. It is allowed to place non numerical <value> in front of or after the sequence but not in between. The numerical sequence has to be ascendind or descending.<br>
|
|
|
|
<u>Example:</u> <code>iconRadio,808080,<b>closed</b>,control_arrow_down,<b>10</b>,fts_shutter_10,<b>20</b>,fts_shutter_20,<b>30</b>,fts_shutter_30,<b>open</b>,control_arrow_up</code><br>
|
2017-10-24 12:11:24 +00:00
|
|
|
<select color> the background color of the selected icon or the icon color if the prefix <i>use4icon@</i> is used.<br>
|
2017-10-04 18:19:18 +00:00
|
|
|
The widget contains a CSS-class "iconRadio_widget".<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
</li>
|
|
|
|
<li>
|
2017-11-03 19:16:10 +00:00
|
|
|
iconButtons,[class<classname>@][use4icon@]<select color>,<value>,<icon>[@<color>][,<value>,<icon>[@<color>]]...
|
|
|
|
- displays Icons as button bar and returns comma separated values of pushed buttons.<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
<value> return value.<br>
|
2017-10-24 12:11:24 +00:00
|
|
|
<select color> the background color of the selected icon or the icon color if the prefix <i>use4icon@</i> is used.<br>
|
2017-10-04 18:19:18 +00:00
|
|
|
The widget contains a CSS-class "iconButtons_widget".<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
</li>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconLabel[,[class<classname>@]<reference value>,[<icon>][@<color>]][,<reference value>,[<icon>][@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- displays states by colorized values, labels and icons, if the current
|
|
|
|
value fits to the reference value. A state is described by a parameter peer.
|
|
|
|
The number of peers is arbitrarily. A peer consists of a <reference
|
|
|
|
value> and an optional display value with an optional color value
|
|
|
|
<reference value> is a number or a regular expression.<br>
|
|
|
|
If <icon> is no icon name, the text will be displayed, otherwise
|
|
|
|
the icon. If nothing is specified, the current value will be displayed.<br>
|
|
|
|
</li>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconSwitch,[class<classname>@]<reference value>,[<icon>][@<color>][,<reference value>,[<icon>][@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- switches cyclic after actuation to the diplayed state and the actual
|
|
|
|
value is set to the reference Value. A state is described by a
|
|
|
|
parameter peer. The number of peers is arbitrarily. A peer consists
|
|
|
|
of a <reference value> and an optional display value with an
|
|
|
|
optional color value [<icon>][@<color>].<br>
|
|
|
|
<reference value> is a number or a string.<br>
|
|
|
|
If <icon> is no icon name, the text will be displayed, otherwise
|
|
|
|
the icon. If nothing is specified, the reference value will be displayed.<br>
|
|
|
|
</li>
|
2017-10-10 11:50:17 +00:00
|
|
|
<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
=end html
|
|
|
|
=begin html_DE
|
|
|
|
|
|
|
|
<br>
|
|
|
|
<u>Für die folgenden icon.* Widgets gilt:</u><br>
|
|
|
|
<color> kann ein Farbname oder eine Farbnummer ohne führende <b>#</b> sein, z.B. orange oder FFA500. Abhängig vom Kontext ist <b>@</b> zu escapen <b>\@</b>.<br>
|
|
|
|
<icon> ist der Iconname.<br>
|
2017-11-03 19:16:10 +00:00
|
|
|
[class<classname>@] als Prefix vor dem zweiten Parameter, weist den SVG-Icons eine CSS-Klasse zu.<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
Beispiele zum Import über Raw definition findet man im FHEM-Wiki unter <a href="https://wiki.fhem.de/wiki/FHEMWEB/Widgets">FHEMWEB-Widgets</a>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconRadio,[class<classname>@][use4icon@]<select color>,<value>,<icon>[@<color>][,<value>,<icon>[@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- zeigt Icons als Radiobutton an und gibt Value bei Betätigung zurück.<br>
|
2017-11-03 19:16:10 +00:00
|
|
|
<value> ist der Rückgabe- u.Vergleichswert. Wenn eine numerische Folge von <value> angegeben wird, dann passt der laufende Wert zum nächsten höheren Vergleichswert. Vor und hinter der numerischen Folge dürfen nicht numerische Werte angegeben werden, dazwischen nicht. Die numerische Folge muss auf- oder absteigend sein.<br>
|
|
|
|
<u>Beispiel:</u> <code>iconRadio,808080,<b>zu</b>,control_arrow_down,<b>10</b>,fts_shutter_10,<b>20</b>,fts_shutter_20,<b>30</b>,fts_shutter_30,<b>auf</b>,control_arrow_up</code><br>
|
2017-10-25 06:19:01 +00:00
|
|
|
<select color> die Hintergrundfarbe des gewählten Icons oder die Farbe des Icons wenn der Prefix use4icon@ vorangestellt wird.<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
Das Widget enthält eine CSS-Klasse "iconRadio_widget".<br>
|
|
|
|
</li>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconButtons,[class<classname>@][use4icon@]<select color>,<value>,<icon>[@<color>][,<value>,<icon>[@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- zeigt Icons als Tastenleiste an und gibt durch Komma getrennte Werte der betätigten Tasten zurück.<br>
|
|
|
|
<value> ist der Rückgabewert.<br>
|
2017-10-25 06:19:01 +00:00
|
|
|
<select color> die Hintergrundfarbe des gewählten Icons oder die Farbe des Icons wenn der Prefix use4icon@ vorangestellt wird.<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
Das Widget enthält eine CSS-Klasse "iconButton_widget".<br>
|
|
|
|
</li>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconLabel[,[class<classname>@]<reference value>,[<icon>][@<color>]][,<reference value>,[<icon>][@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- zeigt Zustände durch colorierte Werte, Beschriftungen und Icons an, wenn
|
|
|
|
der aktuelle Wert zum Vergleichswert passt. Ein Zustand wird durch
|
|
|
|
ein Parameterpaar beschrieben. Es können beliebig viele Paare angegeben
|
|
|
|
werden. Ein Paar besteht aus einem Vergleichswert <reference
|
|
|
|
value> und einem optionalen Anzeigewert mit optionaler mit
|
|
|
|
Farbangabe [,<reference value>,[<icon>][@<color>]].<br>
|
|
|
|
<reference value> kann eine Zahl oder ein regulärer Ausdruck sein.<br>
|
|
|
|
Wenn <icon> keinem Iconnamen entspricht, wird der Text angezeigt,
|
|
|
|
sonst das Icon. Wird <icon> nicht angegeben, wird der aktuelle
|
|
|
|
Wert angezeigt.<br>
|
|
|
|
</li>
|
2017-11-03 19:16:10 +00:00
|
|
|
<li>iconSwitch,[class<classname>@]<reference value>,[<icon>][@<color>][,<reference value>,[<icon>][@<color>]]...
|
2017-10-04 17:46:12 +00:00
|
|
|
- schaltet zyklisch nach jeder Betätigung in den angezeigten
|
|
|
|
Zustand, dabei wird der aktuelle Wert auf den Vergleichswert
|
|
|
|
gesetzt. Ein Zustand wird durch ein Parameterpaar beschrieben.
|
|
|
|
Es können beliebig viele Paare angegeben werden. Ein Paar
|
|
|
|
besteht aus einem Vergleichswert <reference value> und einem
|
|
|
|
optionalen Anzeigewert mit optionaler mit Farbangabe [,<reference
|
|
|
|
value>,[<icon>][@<color>]].<br>
|
|
|
|
<reference value> kann eine Zahl oder eine Zeichenkette sein.<br>
|
|
|
|
Wenn <icon> keinem Iconnamen entspricht, wird der Text
|
|
|
|
angezeigt, sonst das Icon. Wird <icon> nicht angegeben,
|
|
|
|
wird der Vergleichwert angezeigt.<br>
|
|
|
|
</li>
|
2017-10-10 11:50:17 +00:00
|
|
|
<br>
|
2017-10-04 17:46:12 +00:00
|
|
|
=end html_DE
|
|
|
|
=cut
|
|
|
|
*/
|