Logic Machine Forum
User specific default window - Printable Version

+- Logic Machine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Visualization (https://forum.logicmachine.net/forumdisplay.php?fid=9)
+--- Thread: User specific default window (/showthread.php?tid=1145)



User specific default window - Thomas - 20.12.2017

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.


RE: User specific default window - Erwin van der Zwart - 20.12.2017

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


RE: User specific default window - Thomas - 21.12.2017

Super! Thank you