Concider Access level for item filtering

This commit is contained in:
Lord-Grey 2021-05-21 20:21:43 +02:00
parent 332655abfb
commit 5b0ce3c0f2
2 changed files with 20 additions and 13 deletions

View File

@ -277,13 +277,13 @@ $(document).ready(function () {
fps = parseInt(framerates);
}
//Show Frameskipping only when more than 2 fps
if (fps > 2 && storedAccess === "expert") {
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], true);
}
else {
showInputOptions("framegrabber", ["fpsSoftwareDecimation"], false);
}
////Show Frameskipping only when more than 2 fps
//if (fps > 2) {
// showInputOptionForItem(conf_editor_screen, "framegrabber", "fpsSoftwareDecimation", true);
//}
//else {
// showInputOptionForItem(conf_editor_screen, "framegrabber", "fpsSoftwareDecimation", false);
//}
conf_editor_screen.getEditor("root.framegrabber.fps").setValue(fps);
});
@ -317,9 +317,9 @@ $(document).ready(function () {
true);
if (jQuery.isEmptyObject(properties)) {
showInputOptions("grabberV4L2", [key], false);
showInputOptionForItem(conf_editor_video, "grabberV4L2", key, false);
} else {
showInputOptions("grabberV4L2", [key], true);
showInputOptionForItem(conf_editor_video, "grabberV4L2", key, true);
}
}
@ -620,13 +620,12 @@ $(document).ready(function () {
if (framerates !== "NONE") {
fps = parseInt(framerates);
}
//Show Frameskipping only when more than 2 fps
if (fps > 2 && storedAccess === "expert") {
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], true);
if (fps > 2) {
showInputOptionForItem(conf_editor_video, "grabberV4L2", "fpsSoftwareDecimation", true);
}
else {
showInputOptions("grabberV4L2", ["fpsSoftwareDecimation"], false);
showInputOptionForItem(conf_editor_video, "grabberV4L2", "fpsSoftwareDecimation", false);
}
conf_editor_video.getEditor("root.grabberV4L2.fps").setValue(fps);
});

View File

@ -1155,6 +1155,14 @@ function showInputOptions(path, elements, state) {
}
}
function showInputOptionForItem(editor, path, item, state) {
var accessLevel = editor.schema.properties[path].properties[item].access;
// Enable element only, if access level compliant
if (!state || isAccessLevelCompliant(accessLevel)) {
showInputOptions(path, [item], state);
}
}
function showInputOptionsForKey(editor, item, showForKeys, state) {
var elements = [];
var keysToshow = [];