").get(0);
$(newEl).addClass(vArr[0]);
var hidden;
if(elName)
hidden = $('
');
$(newEl).append(button);
$(newEl).append(label);
button.button();
$(newEl).change(function(arg) { var new_val = newEl.getValueFn();
newEl.setValueFn( new_val );
if( cmd )
cmd(new_val);
} );
newEl.getValueFn = function(arg){ return button.prop("checked")?vArr[2]:vArr[1]; };
newEl.setValueFn = function(arg){ if( !arg )
arg = vArr[1];
if( hidden )
hidden.attr("value", arg);
button.button( "option", "label", arg);
button.prop("checked", arg.match(new RegExp('(^|,)'+vArr[2]+'($|,)') ) );
button.button("refresh");
};
newEl.setValueFn( currVal );
return newEl;
}
function
FW_uzsuTimerEntryCreate(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] != "uzsuTimerEntry")
return undefined;
if( !currVal )
currVal = '';
currVals = currVal.split('|');
if( !currVals[2] );
currVals[2] = "enabled";
var newEl = $("
").get(0);
$(newEl).addClass(vArr[0]);
var hidden;
if(elName)
hidden = $('
');
$(newEl).append(hidden);
var changed = function(arg) { $(newEl).change();
if(hidden)
hidden.attr("value", newEl.getValueFn());
if(cmd && newEl.getValueFn)
cmd(newEl.getValueFn())};
var wval;
var wchanged = function(arg) { wval = arg; changed() };
var days = FW_uzsuSelectCreate(undefined, devName+"Days", ["uzsuSelect","Mo","Di","Mi","Do","Fr","Sa","So"],
currVals[0], undefined, params, changed);
$(newEl).append(days); //days.activateFn();
var time = FW_uzsuDropDownCreate(undefined, devName+"Time", ["uzsuDropDown"],
currVals[1], undefined, params, changed);
$(newEl).append(time); //time.activateFn();
var widget;
if( vArr[1] )
{
var vArr = vArr;
var params = vArr.slice(1).join(',').split(',');
var wn = params[0];
if( FW_widgets[wn]
&& FW_widgets[wn].createFn ) {
widget = FW_widgets[wn].createFn(elName+'-'+wn, devName+'-'+wn, params,
currVals[3], undefined, undefined, wchanged);
if( widget ) {
if( widget.activateFn )
widget.activateFn();
wval = currVals[3];
if( typeof wval == 'undefined' )
wval = params[1];
if( widget.setValueFn
&&( typeof wval !== 'undefined' ) )
widget.setValueFn(wval);
$(widget).css('margin','0 8px 0 4px');
$(newEl).append(widget)
}
} else {
var button = $('
');
button.button();
button.val(wn);
button.css('margin','0 8px 0 4px');
button.css('height','29px');
button.button("disable");
$(newEl).append(button);
}
}
var enabled = FW_uzsuToggleCreate(undefined, devName+"Enabled", ["uzsuToggle","disabled","enabled"],
currVals[2], undefined, params, changed);
$(newEl).append(enabled); //enabled.activateFn();
newEl.getValueFn = function() { var ret = "";
ret += days.getValueFn();
ret += '|';
ret += time.getValueFn();
ret += '|';
ret += enabled.getValueFn();
if( widget
&& ( typeof wval !== 'undefined' ) ) {
ret += '|';
ret += wval;
//ret += $(widget).val();
}
return ret;
}
newEl.setValueFn = function(arg){ if( hidden )
hidden.attr("value", arg);
var args = arg.split('|');
days.setValueFn(args[0]);
time.setValueFn(args[1])
enabled.setValueFn(args[2])
wval = args[3];
if( widget && widget.setValueFn
&& ( typeof wval !== 'undefined' ) ) {
widget.setValueFn(wval);
}
};
if( currVal )
newEl.setValueFn( currVal );
return newEl;
}
function
FW_uzsuListCreate(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] != "uzsuList")
return undefined;
var newEl = $("
").get(0);
$(newEl).addClass(vArr[0]);
var button = $('