This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

User specific default window
#1
Hello
Have you found any way how to make a window default for a specific user?
What I want to do is: Employees works in their offices. If an employee opens the visualization he wants to see his own office at first screen.
Simple re-sorting of Windows is not an option because I want  tree structure based on buildings and floors and some employees share more than one room or use common spaces etc.
Any ideas?
Thank you.
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply
#2
Hi,

You can fetch his/her login username and showPlan(x) based on username with custom JavaScript.

Put this in a file called user.lp inside your ftp user folder:
Code:
<?
  require('apps')
  clientuser = request.username or 'anonymous'
  print(clientuser)
?>
Put this in your custom JS:
Code:
$(function(){
  var xhttp = new XMLHttpRequest();
  xhttp.onreadystatechange = function() {
     if (xhttp.readyState == 4 && xhttp.status == 200) {
        var res = xhttp.responseText;
         res = res.trim();
         if (typeof(res) !== "undefined" && res !== null){
            if (res == 'erwin'){
               showPlan(1);
            }
            if (res == 'admin'){
               showPlan(2);
            }
         }
     }
  };
  xhttp.open("GET", "/user/user.lp", true);
  xhttp.send();
});
BR,

Erwin
Reply
#3
Super! Thank you
LM5Lp, firmware: 2018.08.22 and 2021.12.15, FlashSYS v2, ARMv7 Processor rev 5 (v7l), kernel 4.4.151 and 4.4.259
Reply


Forum Jump: