-
Notifications
You must be signed in to change notification settings - Fork 292
/
index.html
339 lines (305 loc) · 7.55 KB
/
index.html
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="robots" content="noindex,nofollow" />
<meta name="googlebot" content="noindex,nofollow" />
<title>Bahmni</title>
<style>
html {
overflow: auto;
}
body {
font-family: OpenSans, Arial, sans-serif;
position: relative;
background: #f8f8f8;
overflow: hidden;
padding-bottom: 40px;
}
a {
text-decoration: none;
}
.container {
width: 750px;
margin: 20px auto 0;
padding: 0 15px 20px;
overflow: hidden;
background: #f8f8f8;
z-index: 2;
}
.container>h4 {
margin: 0;
text-align: center;
color: #646464;
font-size: 16px;
}
.section {
position: relative;
width: 207px;
min-height: 200px;
display: inline-block;
margin: 10px 15px;
background: #fff;
padding: 5px;
border-radius: 11px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.24);
transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
z-index: 2;
vertical-align: top;
}
.section:hover {
box-shadow: 0 14px 28px rgba(0, 0, 0, 0.25),
0 10px 10px rgba(0, 0, 0, 0.22);
}
.launch {
text-align: center;
font-size: 20px;
}
.launch img {
width: 100px;
height: 100px;
display: block;
margin: 15px auto;
}
.launch span {
min-height: 55px;
display: inline-block;
color: #f4834d;
font-weight: bold;
font-size: 18px;
text-transform: uppercase;
}
.warning-message {
text-align: center;
margin: 0 auto;
color: #ffac2e;
width: 50%;
background: #f8f8f8;
padding-top: 10px;
}
.warning-message span {
font-weight: bolder;
font-size: 13px;
display: inline-block;
margin-bottom: 5px;
}
.warning-message p {
padding: 0 50px;
margin: 0;
font-size: 14px;
}
.header_text {
text-align: center;
margin: 35px auto 25px;
color: #646464;
font-size: 24px;
width: 100%;
}
.power-by {
position: fixed;
width: 100%;
bottom: 7px;
text-align: center;
background: #f8f8f8;
padding-bottom: 5px;
font-size: 12px;
z-index: -1;
color: #898989;
}
.power-by img {
width: 55px;
vertical-align: middle;
margin: 0 1px;
}
.power-by a {
color: #000;
}
.clint-logo-wrapper {
display: block;
text-align: center;
padding-top: 10px;
}
.clint-logo-wrapper img {
max-width: 200px;
vertical-align: middle;
max-height: 120px;
}
.clint-logo-wrapper span {
vertical-align: middle;
color: #888;
font-size: 20px;
}
.bottom-banner-wrapper {
position: fixed;
text-align: center;
bottom: 20px;
width: 100%;
}
.bottom-banner-wrapper img {
max-width: 35%;
height: auto;
}
.sections {
min-width: 200px;
text-align: center;
margin: 10px auto;
}
</style>
<script>
function init() {
serverTimeZone();
getLogoAndHeaderText();
getApps();
}
function callAjax(url, callback) {
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
try {
callback(JSON.parse(xmlhttp.responseText));
} catch (ex) {
callback(undefined);
}
}
};
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function serverTimeZone() {
callAjax("/cgi-bin/systemdate", function (data) {
if (data) {
var serverTime = data.date;
var offset = data.offset;
var localTime = new Date().toLocaleString();
var localTimeZone = getLocalTimeZone();
if (offset && !new Date().toString().includes(offset)) {
var warningMessageParagraph = document.getElementsByClassName(
"warning-message-paragraph"
)[0];
var warningMessage = document.getElementsByClassName(
"warning-message-span"
)[0];
warningMessage.innerHTML =
"<img src='/bahmni/images/warning.png'> Warning";
warningMessageParagraph.innerHTML =
"The server timezone (" +
serverTime +
") is different from your browser's time/timezone (" +
localTime +
" " +
localTimeZone +
"). This can cause some data or reports to appear incorrect. Please contact the administrator for further assistance.";
}
}
});
}
var getLocalTimeZone = function () {
var currentLocalTime = new Date().toString();
var localTimeZoneList = currentLocalTime.split(" ");
var localTimeZone = localTimeZoneList[localTimeZoneList.length - 1];
localTimeZone = localTimeZone.substring(1, localTimeZone.length - 1);
return localTimeZone;
};
function getLogoAndHeaderText() {
callAjax(
"/bahmni_config/openmrs/apps/home/whiteLabel.json",
function (data) {
if (data) {
if (data.homePage.header_text) {
var headerTextElement =
document.getElementsByClassName("header_text")[0];
headerTextElement.innerHTML =
"<b>" + data.homePage.header_text + "</b>";
}
if (data.homePage.logo) {
var logoImage =
document.getElementsByClassName("client_logo")[0];
logoImage.src = data.homePage.logo;
}
if (data.helpLink.url) {
var headerTextElement =
document.getElementsByClassName("helper_url")[0];
headerTextElement.href = data.helpLink.url;
}
if (data.homePage.title_text) {
var titleTextElement =
document.getElementsByClassName("title_text")[0];
titleTextElement.innerHTML = data.homePage.title_text;
}
if (data.homePage.bottomBanner) {
document.getElementById("bottom-banner-image").src =
data.homePage.bottomBanner;
}
}
}
);
}
const getAppLink = (app) => {
if (app.name === "crater" || app.name === "odoo") {
let url = '/';
if (window.location.host === "localhost") {
if (app.name === "odoo")
url = `http://${window.location.host}:8069`;
else
url = `http://${window.location.host}:81`;
} else if (app.linkPrefix) {
url =
window.location.protocol +
`//${app.linkPrefix}-` +
window.location.host;
}
return url;
}
return app.link ?? "/";
};
function getApps() {
callAjax(
"/bahmni_config/openmrs/apps/home/whiteLabel.json",
function (data) {
if (data && data.landingPage) {
const sections = document.getElementsByClassName("sections")[0];
for (app of data.landingPage) {
if (app.enabled) {
sections.innerHTML += `<div class="section">
<div class="launch">
<a href="${getAppLink(app)}">
<img src="${app.logo}" />
<span> ${app.title}</span>
</a>
</div>
</div>`;
}
}
}
}
);
}
</script>
</head>
<body onload="init()">
<div class="clint-logo-wrapper">
<img class="client_logo" src="/bahmni/images/bahmniLogoFull.png" />
<span class="title_text"> TITLE TEXT </span>
</div>
<div class="header_text">
<b>WELCOME TO<br />BAHMNI EMR & HOSPITAL SERVICE</b>
</div>
<div class="container">
<h4>GET STARTED</h4>
<div class="sections" />
</div>
<div class="warning-message">
<span class="warning-message-span"></span>
<p class="warning-message-paragraph"></p>
</div>
</div>
<div class="bottom-banner-wrapper">
<img id="bottom-banner-image" />
</div>
<div class="power-by">
<img src="/bahmni/images/bahmniLogoFull.png" alt="Bahmni" />
<a class="helper_url" href="https://bahmni.atlassian.net/wiki/display/BAH/Bahmni+Home">
Bahmni Help</a>
</div>
</body>
</html>