Add pref utility function

This commit is contained in:
emanuele-f 2017-12-18 19:25:24 +01:00
parent 3c83a73602
commit 3fadd94708

View file

@ -438,13 +438,13 @@ end
function multipleTableButtonPrefs(label, comment, array_labels, array_values, default_value, selected_color,
submit_field, redis_key, disabled, elementToSwitch, showElementArray,
javascriptAfterSwitch, showElement)
javascriptAfterSwitch, showElement, initialValue)
if(_POST[submit_field] ~= nil) then
ntop.setPref(redis_key, _POST[submit_field])
value = _POST[submit_field]
notifyNtopng(submit_field)
else
value = ntop.getPref(redis_key)
value = initialValue or ntop.getPref(redis_key)
if(value == "") then
if(default_value ~= nil) then
ntop.setPref(redis_key, default_value)
@ -565,3 +565,11 @@ function loggingSelector(label, comment, submit_field, redis_key)
return(value)
end
function printPageSection(section_name)
print('<tr><th colspan=2 class="info">'..section_name..'</th></tr>')
end
function printSaveButton()
print('<tr><th colspan=2 style="text-align:right;"><button type="submit" class="btn btn-primary" style="width:115px" disabled="disabled">'..i18n("save")..'</button></th></tr>')
end