forked from flautrup/AccessControlTestModule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSelectUser.htm
156 lines (130 loc) · 5.13 KB
/
SelectUser.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Access Control User Select Page</title>
</head>
<body>
<def>
<style>
@font-face {
font-family: 'QlikView Sans';
src: url(/resource/font/#QlikViewSansRegular) format('svg');
font-weight: normal;
font-style: normal;
}
body
{
margin-left: 100px;
margin-right: 250px;
margin-top: 100px;
font-family: 'QlikView Sans';
font-size: 1.0em;
background-image: url('/resource/qv'),url('/resource/background');
background-size: 220px, 400px;
background-repeat:no-repeat, no-repeat;
background-position: left top, right bottom;
background-attachment: fixed, fixed;
}
.UserBtn {
float: right;
margin-bottom: 0px;
margin-left: 5px;
}
.UserLogin {
vertical-align: middle;
align: left;
}
</style>
</def>
<span class="UserLogin">
<img src="resource/icon" />
<select id="UserList" class="UserLogin" name="QVNCYCLES" onchange="doLogin(this);">
<option value="bbr">Bryan Baker (bbr) - Vice President of Sales</option>
<option value="ams">Amy Alberts (ams) - European Sales Manager</option>
<option value="stg">Stephen Jiang (stg) - North American Sales Manager</option>
<option value="dal">David Campbell (dal) - Sales Representative</option>
<option value="frt">François Ajenstat (frt) - Sales Representative</option>
<option value="raz">Rachel Valdez (raz) - Sales Representative</option>
<option value="lan">Laura Norman (lan) - Chief Financial Officer</option>
<option value="bad">Barbara Moreland (bad) - Accountant</option>
<option value="pas">Paula Barreto de Mattos (pas) - Human Resources Manager</option>
<option value="kag">Karen Berg (kag) - BI Developer</option>
<option value="ran">Ramesh Meyyappan (ran) - BI Developer</option>
<option value="asa">Ashvini Sharma (asa) - Content Administrator</option>
<option value="pey">Peter Connelly (pey) - System Administrator</option>
</select>
</span>
<BUTTON id="logoutspan" class="UserBtn" style="display: none;" onclick="doLogout();">Logout</BUTTON>
<BUTTON id="reset" class="UserBtn" style="display: none;" onclick="doReset();">Reset</BUTTON>
<div id="analysis"><iframe id="targetFrame" style="display: none;" src="" width="100%"></iframe></div>
<div id="selectuser" style="display: block;">Select a user from the list above.</div>
<script>
var query = getQueryParams(document.location.search);
var contentFrame = document.getElementById('targetFrame');
if (query.QlikRedirect) {
//If we get a ticket, show the QlikRedirect URL using the QlikTicket, hide the user selection message, and show the reset/logout button
contentFrame.height = window.innerHeight - 200;
contentFrame.src = query.QlikRedirect;
contentFrame.style.display = "block";
document.getElementById('selectuser').style.display = "none";
document.getElementById('reset').style.display = "block";
document.getElementById('logoutspan').style.display = "block";
} else {
//If we don't have a ticket, show the select user message and hide the reset/iframe/logout items
document.getElementById('selectuser').style.display = "block";
contentFrame.style.display = "none";
document.getElementById('reset').style.display = "none";
document.getElementById('logoutspan').style.display = "none";
}
//If we get an authenticated user, select the user in the drop down and disable the others
if (query.selecteduser) {
var selectElem = document.getElementById( 'UserList');
selectElem.value = query.selecteduser;
for (i = 0; i < selectElem.options.length; i++) {
(selectElem.options[i].selected)
? selectElem.options[i].disabled = false
: selectElem.options[i].disabled = true ;
}
}
function doLogin(my) {
document.location = "/login?selectedUser="+my.value+"&userDirectory="+my.name;
}
function doReset() {
contentFrame = document.getElementById('targetFrame');
contentFrame.height = window.innerHeight - 200;
contentFrame.src = removeURLParameter(query.QlikRedirect,'QlikTicket');
}
function doLogout() {
document.location = "/logout?selectedUser="+query.selecteduser+"&userDirectory="+document.getElementById('UserList').name;
}
function getQueryParams(qs) {
qs = qs.split('+').join(' ');
var params = {},
tokens,
re = /[?&]?([^=]+)=([^&]*)/g;
while (tokens = re.exec(qs)) {
params[decodeURIComponent(tokens[1])] = decodeURIComponent(tokens[2]);
}
return params;
}
function removeURLParameter(url, parameter) {
var urlparts= url.split('?');
if (urlparts.length>=2) {
var prefix= encodeURIComponent(parameter)+'=';
var pars= urlparts[1].split(/[&;]/g);
//reverse iteration as may be destructive
for (var i= pars.length; i-- > 0;) {
//idiom for string.startsWith
if (pars[i].lastIndexOf(prefix, 0) !== -1) {
pars.splice(i, 1);
}
}
url= urlparts[0]+'?'+pars.join('&');
return url;
} else {
return url;
}
}
</script>
</body>
</html>