');
var cmVar;
function
fillData(opt)
{
var s = $('#rawDef textarea');
FW_cmd(FW_root+"?cmd=list "+opt+" "+dev+"&XHR=1", function(data) {
var re = new RegExp("^define", "gm");
data = data.replace(re, "defmod");
s.val(data);
var off = $("#rawDef").position().top-20;
$('body, html').animate({scrollTop:off}, 500);
$("#rawDef button").hide();
var propertychange = function() {
var nData = $("#rawDef textarea").val();
if(nData != data)
$("#rawDef button").show();
else
$("#rawDef button").hide();
};
s.bind('input propertychange', propertychange);
if(cmVar) {
cmVar.setValue(data);
} else if(typeof AddCodeMirror == 'function') {
AddCodeMirror(s, function(cm) {
cmVar = cm;
cm.on("change", function() {
s.val(cm.getValue());
propertychange();
})
});
}
});
}
fillData("-r");
$("#rawDef input").click(function(){fillData(this.checked ?"-R":"-r")});
$("#rawDef button").click(function(){
var data = $("#rawDef textarea").val();
var arr = data.split("\n"), str="", i1=-1;
function
doNext()
{
if(++i1 >= arr.length) {
return FW_okDialog("Executed everything, no errors found.");
}
str += arr[i1];
if(arr[i1].charAt(arr[i1].length-1) === "\\") {
str += "\n";
return doNext();
}
if(str != "") {
str = str.replace(/\\\n/g, "\n")
.replace(/;;/g, ";");
FW_cmd(FW_root+"?cmd."+dev+"="+encodeURIComponent(str)+"&XHR=1",
function(r){
if(r)
return FW_okDialog('
'+r+'
');
str = "";
doNext();
});
} else {
doNext();
}
}
doNext();
});
});
});
}
function
FW_treeMenu()
{
var col = 'rgb(39, 135, 38)';
var a = $("a").get(0);
if(window.getComputedStyle && a)
col = getComputedStyle(a,null).getPropertyValue('color');
var arrowRight='data:image/svg+xml;utf8,'
.replace('gray', col);
var arrowDown=arrowRight.replace('/>',' transform="rotate(90,896,896)"/>');
var fnd;
$("div#menu table.room").each(function(){ // one loop per Block
var t = this, ma = {};
$(t).find("td > div > a > span").each(function(e){
var span = this, spanTxt = $(span).html();
var ta = spanTxt.split("--");
if(ta.length <= 1)
return;
fnd = true;
var nxt="", lst="", tr=$(span).closest("tr");
for(var i1=0; i1"+
"
';
delete(selObj[v]);
}
var selArr=[];
for(var i1 in selObj)
selArr.push(i1);
var strict = (vArr[0] == "multiple-strict");
$('body').append(
'
'+
'
'+table+'
'+(!strict ? '' : '')+
'
');
$('#multidlg').dialog(
{ modal:true, closeOnEscape:false, maxHeight:$(window).height()*3/4,
buttons:[
{ text:"Cancel", click:function(){ $('#multidlg').remove(); }},
{ text:"OK", click:function(){
var res=[];
if($("#md_freeText").val())
res.push($("#md_freeText").val());
$("#multidlg table input").each(function(){
if($(this).prop("checked"))
res.push($(this).attr("name"));
});
$('#multidlg').remove();
$(newEl).val(res.join(","));
if(cmd)
cmd(res.join(","));
}}]});
});
return newEl;
}
/*************** WIDGETS END **************/
/*************** SCRIPT LOAD FUNCTIONS START **************/
function
loadScript(sname, callback, force)
{
var h = document.head || document.getElementsByTagName('head')[0];
sname = FW_root+"/"+sname;
if(FW_scripts[sname]) {
if(FW_scripts[sname].loaded) {
if(callback)
callback();
} else {
FW_scripts[sname].callbacks.push(callback);
}
return;
}
if(!FW_docReady && !force) {
FW_scripts[sname] = { callbacks:[ callback] };
return;
}
var script = document.createElement("script");
script.src = sname;
script.async = script.defer = false;
script.type = "text/javascript";
FW_scripts[sname] = { callbacks:[ callback] };
function
scriptLoaded()
{
var p = FW_scripts[sname];
p.loaded = true;
if(!p.called) {
p.called = true;
for(var i1=0; i1< p.callbacks.length; i1++)
if(p.callbacks[i1]) // pushing undefined callbacks on the stack is ok
p.callbacks[i1]();
}
delete(p.callbacks);
}
log("Loading script "+sname);
if(FW_isIE) {
script.onreadystatechange = function() {
if(script.readyState == 'loaded' || script.readyState == 'complete') {
script.onreadystatechange = null;
scriptLoaded();
}
}
} else {
if(FW_isiOS)
FW_closeConn();
script.onload = function(){
scriptLoaded();
}
}
h.appendChild(script);
}
function
loadLink(lname)
{
var h = document.head || document.getElementsByTagName('head')[0];
lname = FW_root+"/"+lname;
var arr = h.getElementsByTagName("link");
for(var i1=0; i1= 0)
attr = $(this).attr("attr");
});
var ua={};
if(attr && attr != "") {
try {
ua=JSON.parse(attr);
} catch(e){
FW_errmsg(sname+" Parameter "+e,5000);
}
}
return ua;
}
/*************** SCRIPT LOAD FUNCTIONS END **************/
function
print_call_stack() {
var stack = new Error().stack;
console.log("PRINTING CALL STACK");
console.log( stack );
}
function
FW_getSVG(emb)
{
if(emb.contentDocument)
return emb.contentDocument;
if(typeof emb.getSVGDocument == "function") {
try {
return emb.getSVGDocument();
} catch(err) {
// dom not loaded -> fall through -> retry;
}
}
return undefined;
}
/*
=pod
=begin html
noArg - show no input field.
time - show a JavaScript driven timepicker.
Example: attr FS20dev widgetOverride on-till:time
textField - show an input field.
Example: attr WEB widgetOverride room:textField
textFieldNL - show the input field and hide the label.
textField-long - show an input-field, but upon
clicking on the input field open a textArea (60x25).
textFieldNL-long - the behaviour is the same
as :textField-long, but no label is displayed.
slider,<min>,<step>,<max>[,1] - show
a JavaScript driven slider. The optional ,1 at the end
avoids the rounding of floating-point numbers.
multiple,<val1>,<val2>,..." - present a
multiple-value-selector with an additional textfield. The result is
comman separated.
multiple-strict,<val1>,<val2>,... - like :multiple, but
without the textfield.
selectnumbers,<min>,<step>,<max>,<number of
digits after decimal point>,lin|log10" - display a select widget
generated with values from min to max with step.
lin generates a constantly increasing series. log10 generates an
exponentially increasing series to base 10, step is related to the
exponent, e.g. 0.0625.
select,<val1>,<val2>,... - show a dropdown with all values.
NOTE: this is also the fallback, if no modifier is found.
=end html
=begin html_DE
noArg - es wird kein weiteres Eingabefeld angezeigt.
time - zeigt ein Zeitauswahlmenü.
Beispiel: attr FS20dev widgetOverride on-till:time
textField - zeigt ein Eingabefeld.
Beispiel: attr WEB widgetOverride room:textField
textField-long - ist wie textField, aber beim Click im Eingabefeld wird
ein Dialog mit einer HTML textarea (60x25) wird geöffnet.
slider,<min>,<step>,<max>[,1] - zeigt einen
Schieberegler. Das optionale 1 (isFloat) vermeidet eine Rundung der
Fliesskommazahlen.
multiple,<val1>,<val2>,... - zeigt eine Mehrfachauswahl mit
einem zusätzlichen Eingabefeld. Das Ergebnis ist Komma
separiert.
multiple-strict,<val1>,<val2>,... - ist wie :multiple,
bloß ohne Eingabefeld.
selectnumbers,<min>,<step>,<max>,<number of
digits after decimal point>,lin|log10" zeigt ein HTML-select mit einer
Zahlenreihe vom Wert min bis Wert max mit Schritten von step
angezeigt.
Die Angabe lin erzeugt eine konstant ansteigende Reihe. Die Angabe
log10 erzeugt eine exponentiell ansteigende Reihe zur Basis 10,
step bezieht sich auf den Exponenten, z.B. 0.0625.
select,<val1>,<val2>,... - zeigt ein HTML select mit allen
Werten. Achtung: so ein Widget wird auch dann angezeigt, falls
kein passender Modifier gefunden wurde.