05.12.2019, 15:16
(This post was last modified: 05.12.2019, 15:21 by Erwin van der Zwart.)
Hi,
Try this:
Give each element a unique additional class like first object "hideobject_1", second object "hideobject_2" etcetera.
Run this script once to create the user.lp:
Add this to your custom Javascript:
By adding the corresponding numbers hideobject_# in the hideobject array (next to the username) you can change the visibility of a object that is mapped to a user.
Have fun (:
BR,
Erwin
Try this:
Give each element a unique additional class like first object "hideobject_1", second object "hideobject_2" etcetera.
Run this script once to create the user.lp:
Code:
dst = '/www/user/user.lp'
io.writefile(dst, [[
<?
require('apps')
clientuser = request.username or 'anonymous'
print(clientuser)
?>
]])
script.disable(_SCRIPTNAME)
Code:
$(function(){
var configtable = [
{ username:"admin", hideobject: [1,2] },
{ username:"erwin", hideobject: [1,2,3,4,5,6,7,8,9,10,11] },
];
// Function to hide objects
function hideObject(objnr){
$(".hideobject_" + objnr).addClass("hide");
}
$.get("/user/user.lp", function(data, status){
if (status === "success"){
var username = data.trim();
for (var i in configtable) {
if(username == configtable[i].username){
for (var j in configtable[i].hideobject) {
hideObject(configtable[i].hideobject[j]);
}
}
}
}
});
})
Have fun (:
BR,
Erwin