|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
******************************************************************************* |
|
4
|
|
|
* Copyright 2011-2017 DANTE Ltd. and GÉANT on behalf of the GN3, GN3+, GN4-1 |
|
5
|
|
|
* and GN4-2 consortia |
|
6
|
|
|
* |
|
7
|
|
|
* License: see the web/copyright.php file in the file structure |
|
8
|
|
|
******************************************************************************* |
|
9
|
|
|
*/ |
|
10
|
|
|
?> |
|
11
|
|
|
<?php |
|
12
|
|
|
function escaped_echo($s) { |
|
13
|
|
|
echo preg_replace('/"/', '"', $s); |
|
14
|
|
|
} |
|
15
|
|
|
|
|
16
|
|
|
$langObject = new \core\common\Language(); |
|
17
|
|
|
$langObject->setTextDomain('web_user'); |
|
18
|
|
|
$cat = new core\CAT(); |
|
19
|
|
|
$idpId = filter_input(INPUT_GET, 'idp', FILTER_VALIDATE_INT) ?? filter_input(INPUT_POST, 'idp', FILTER_VALIDATE_INT); |
|
20
|
|
|
$profileId = filter_input(INPUT_GET, 'profile', FILTER_VALIDATE_INT) ?? filter_input(INPUT_POST, 'profile', FILTER_VALIDATE_INT); |
|
21
|
|
|
$skinObject = $Gui->skinObject; |
|
22
|
|
|
?> |
|
23
|
|
|
var n; |
|
24
|
|
|
var profile; |
|
25
|
|
|
// var device_button_bg ="#0a698e"; |
|
26
|
|
|
var generateTimer; |
|
27
|
|
|
var pageWidth = 0; |
|
28
|
|
|
var device_button_fg; |
|
29
|
|
|
var catWelcome; |
|
30
|
|
|
var hide_images = 0; |
|
31
|
|
|
var front_page = 1; |
|
32
|
|
|
var download_link; |
|
33
|
|
|
var profile_list_size = <?php echo $profile_list_size ?>; |
|
34
|
|
|
var generation_error = "<?php escaped_echo(_("This is embarrassing. Generation of your installer failed. System admins have been notified. We will try to take care of the problem as soon as possible.")) ?>"; |
|
35
|
|
|
|
|
36
|
|
|
var roller; |
|
37
|
|
|
if (roller === undefined) |
|
38
|
|
|
roller = 0; |
|
39
|
|
|
var noDisco; |
|
40
|
|
|
if (noDisco === undefined) |
|
41
|
|
|
noDisco = 0; |
|
42
|
|
|
var sbPage; |
|
43
|
|
|
if (sbPage === undefined) |
|
44
|
|
|
sbPage = 0; |
|
45
|
|
|
$.fn.redraw = function(){ |
|
46
|
|
|
$(this).each(function(){ |
|
47
|
|
|
var redraw = this.offsetHeight; |
|
48
|
|
|
}); |
|
49
|
|
|
}; |
|
50
|
|
|
|
|
51
|
|
|
function other_installers() { |
|
52
|
|
|
$("#guess_os").hide(); |
|
53
|
|
|
$("#other_installers").show(); |
|
54
|
|
|
$("#devices").redraw(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
function listProfiles(inst_id,selected_profile){ |
|
58
|
|
|
var j ; |
|
59
|
|
|
$('#welcome').hide(); |
|
60
|
|
|
$("#silverbullet").hide(); |
|
61
|
|
|
$('#user_welcome').hide(); |
|
62
|
|
|
$("#idp_logo").hide(); |
|
63
|
|
|
$("#inst_id").val(inst_id); |
|
64
|
|
|
$("#profile_id").val(''); |
|
65
|
|
|
$(".signin_large").hide(); |
|
66
|
|
|
if (roller) |
|
67
|
|
|
Program.stop_program = 1; |
|
68
|
|
|
$("#profiles").hide(); |
|
69
|
|
|
$("#user_info").hide(); |
|
70
|
|
|
$("#devices").hide(); |
|
71
|
|
|
$("#profile_redirect").hide(); |
|
72
|
|
|
i_s = selected_profile; |
|
73
|
|
|
$.post('<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>', {action: 'listProfiles', api_version: 2, lang: lang, idp: inst_id}, function(data) { |
|
74
|
|
|
//alert(data); |
|
75
|
|
|
j = $.parseJSON(data); |
|
76
|
|
|
result = j.status; |
|
77
|
|
|
if(! result) { |
|
78
|
|
|
alert("<?php escaped_echo(_("no matching data found"))?>"); |
|
79
|
|
|
document.location.href='<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') . '/' ?>'; |
|
80
|
|
|
} |
|
81
|
|
|
j = j.data; |
|
82
|
|
|
n = j.length; |
|
83
|
|
|
$("#profile_list").html(''); |
|
84
|
|
|
inst_name = j[0].idp_name; |
|
85
|
|
|
logo = j[0].logo; |
|
86
|
|
|
$("#inst_name").val(inst_name); |
|
87
|
|
|
$("#inst_name_span").html(inst_name); |
|
88
|
|
|
$(".inst_name").text(inst_name); |
|
89
|
|
|
$("#user_page").show(); |
|
90
|
|
|
$("#institution_name").show(); |
|
91
|
|
|
if(n > profile_list_size) |
|
92
|
|
|
$("#profile_list").append('<option value="0" selected style="color:red"> --<?php escaped_echo(_("select"))?> --</option>'); |
|
93
|
|
|
$.each(j,printP); |
|
94
|
|
|
if(n <= profile_list_size) |
|
95
|
|
|
$("#profile_list").append('<option value="0" selected style="display:none"> </option>'); |
|
96
|
|
|
if(logo) { |
|
97
|
|
|
$("#idp_logo").attr("src","<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>?action=sendLogo&api_version=2&idp="+inst_id); |
|
98
|
|
|
$("#idp_logo").show(); |
|
99
|
|
|
} |
|
100
|
|
|
if (n > 1) { |
|
101
|
|
|
if(n <= profile_list_size) { |
|
102
|
|
|
$("#profile_list").attr('size',n+1); |
|
103
|
|
|
} else { |
|
104
|
|
|
$("#profile_list").attr('size',1); |
|
105
|
|
|
} |
|
106
|
|
|
$("#profiles").show(); |
|
107
|
|
|
} |
|
108
|
|
|
if(n > 1 && selected_profile) { |
|
109
|
|
|
$('#profile_list option[value='+selected_profile+']').attr("selected",true); |
|
110
|
|
|
showProfile(selected_profile); |
|
111
|
|
|
$("#devices").show(); |
|
112
|
|
|
} |
|
113
|
|
|
}); |
|
114
|
|
|
} |
|
115
|
|
|
function printP(i,v) { |
|
116
|
|
|
if(n == 1 ) { |
|
117
|
|
|
$("#profiles").hide(); |
|
118
|
|
|
$("#profile_list").append('<option value="'+v.profile+'" selected>'+v.display+'</option>'); |
|
119
|
|
|
showProfile(v.profile); |
|
120
|
|
|
// $("#devices").show(); |
|
121
|
|
|
} else { |
|
122
|
|
|
$("#profile_list").append('<option value="'+v.profile+'">'+v.display+'</option>'); |
|
123
|
|
|
} |
|
124
|
|
|
} |
|
125
|
|
|
function resetDevices() { |
|
126
|
|
|
if(recognisedOS !== '' ) { |
|
127
|
|
|
$("#guess_os").show(); |
|
128
|
|
|
$("#other_installers").hide(); |
|
129
|
|
|
$("#download_button_header_"+recognisedOS).html(downloadMessage); |
|
130
|
|
|
$("#cross_icon_"+recognisedOS).hide(); |
|
131
|
|
|
} |
|
132
|
|
|
$(".device_list button").removeClass('alertButton'); |
|
133
|
|
|
$(".device_list button").removeClass('disabledDevice'); |
|
134
|
|
|
$(".device_list button").removeClass('additionalInfo'); |
|
135
|
|
|
$('.device_list button').unbind('click'); |
|
136
|
|
|
$('.device_list tr').show(); |
|
137
|
|
|
$('.device_info').html(''); |
|
138
|
|
|
$('.device_info').hide(); |
|
139
|
|
|
$("#user_welcome").hide(); |
|
140
|
|
|
$(".device_list button").click(function(event){ |
|
141
|
|
|
var j ; |
|
142
|
|
|
event.preventDefault(); |
|
143
|
|
|
var button_id = $(this).attr('id'); |
|
144
|
|
|
if(button_id.substr(0,2) == "g_") |
|
145
|
|
|
button_id = button_id.substr(2); |
|
146
|
|
|
if(button_id.substr(0,7) == "info_b_") { |
|
147
|
|
|
var device_id = button_id.substr(7); |
|
148
|
|
|
$("#info_window").html("<h2>"+$('#'+device_id).text()+"</h2>"); |
|
149
|
|
|
$.post('<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>', {action: 'deviceInfo', api_version: 2, lang: lang, device: device_id, profile: profile}, function(data) { |
|
150
|
|
|
var h = $("#info_window").html(); |
|
151
|
|
|
$("#info_window").html(h+data); |
|
152
|
|
|
$("#main_body").fadeTo("fast", 0.2,function() { |
|
153
|
|
|
var x = getWindowHCenter() - 350; |
|
154
|
|
|
$("#info_overlay").show(); |
|
155
|
|
|
} |
|
156
|
|
|
); |
|
157
|
|
|
}); |
|
158
|
|
|
} else { |
|
159
|
|
|
$('.device_info').html(''); |
|
160
|
|
|
$('.device_info').hide(); |
|
161
|
|
|
if($(this).hasClass('disabledDevice')) |
|
162
|
|
|
$(this).addClass('pressedDisabled'); |
|
163
|
|
|
else |
|
164
|
|
|
$(this).addClass('pressed'); |
|
165
|
|
|
pressedButton = $(this); |
|
166
|
|
|
if($(this).hasClass('additionalInfo')) { |
|
167
|
|
|
info_id = 'info_'+pressedButton.attr('id'); |
|
168
|
|
|
$('#'+info_id).show(100); |
|
169
|
|
|
} else { |
|
170
|
|
|
$('#download_info').hide(); |
|
171
|
|
|
generateTimer = $.now(); |
|
172
|
|
|
$("#devices").hide(); |
|
173
|
|
|
$("#user_welcome").show(); |
|
174
|
|
|
$.post('<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>', {action: 'generateInstaller', api_version: 2, lang: lang, device: button_id, profile: profile}, processDownload); |
|
175
|
|
|
} |
|
176
|
|
|
} |
|
177
|
|
|
}); |
|
178
|
|
|
|
|
179
|
|
|
} |
|
180
|
|
|
|
|
181
|
|
|
function showProfile(prof){ |
|
182
|
|
|
$("#profile_redirect").hide(); |
|
183
|
|
|
$("#silverbullet").hide(); |
|
184
|
|
|
if(prof == 0) { |
|
185
|
|
|
$("#user_info").hide(); |
|
186
|
|
|
$("#devices").hide(); |
|
187
|
|
|
return; |
|
188
|
|
|
} |
|
189
|
|
|
var j, txt ; |
|
190
|
|
|
var redirect_profile; |
|
191
|
|
|
redirect_profile = '0'; |
|
192
|
|
|
profile = prof; |
|
193
|
|
|
$("#profile_id").val(prof); |
|
194
|
|
|
txt = ''; |
|
195
|
|
|
$.post('<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>', {action: 'profileAttributes', api_version: 2, lang: lang, profile: profile}, function(data) { |
|
196
|
|
|
j1 = $.parseJSON(data); |
|
197
|
|
|
result = j1.status; |
|
198
|
|
|
if(! result) { |
|
199
|
|
|
alert("<?php escaped_echo(_("no matching data found")) ?>"); |
|
200
|
|
|
document.location.href='<?php echo rtrim(dirname($_SERVER['SCRIPT_NAME']), '/') . '/' ?>'; |
|
201
|
|
|
} |
|
202
|
|
|
j = j1.data; |
|
203
|
|
|
if(j.description !== undefined && j.description) { |
|
204
|
|
|
$("#profile_desc").text(j.description); |
|
205
|
|
|
$("#profile_desc").show(); |
|
206
|
|
|
} else { |
|
207
|
|
|
$("#profile_desc").hide(); |
|
208
|
|
|
$("#profile_desc").text(''); |
|
209
|
|
|
} |
|
210
|
|
|
if(j.local_url !== undefined && j.local_url) |
|
211
|
|
|
txt = txt+'<tr><td><?php escaped_echo(_("WWW:")); ?></td><td><a href="'+j.local_url+'" target="_blank">'+j.local_url+'</a></td></tr>'; |
|
212
|
|
|
if(j.local_email !== undefined && j.local_email) |
|
213
|
|
|
txt = txt+'<tr><td><?php escaped_echo(_("email:")); ?></td><td><a href=mailto:"'+j.local_email+'">'+j.local_email+'</a></td></tr>'; |
|
214
|
|
|
if(j.local_phone !== undefined && j.local_phone) |
|
215
|
|
|
txt = txt+'<tr><td><?php escaped_echo(_("tel:")); ?></td><td>'+j.local_phone+'</td></tr>'; |
|
216
|
|
|
if(txt) |
|
217
|
|
|
txt = "<table><tr><th colspan='2'><?php escaped_echo(sprintf(_("If you encounter problems, then you can obtain direct assistance from your %s at:"), $cat->nomenclature_inst)); ?></th></tr>"+txt+'</table>'; |
|
218
|
|
|
else |
|
219
|
|
|
txt = "<table><tr><th colspan='2'><?php escaped_echo(sprintf(_("If you encounter problems you should ask for help at your %s"), $cat->nomenclature_inst)); ?>.</th></tr></table>"; |
|
220
|
|
|
$("#user_info").html(txt); |
|
221
|
|
|
$("#user_info").show(); |
|
222
|
|
|
if(j.silverbullet) { |
|
223
|
|
|
$("#devices").hide(); |
|
224
|
|
|
$("#silverbullet").show(); |
|
225
|
|
|
return; |
|
226
|
|
|
} |
|
227
|
|
|
resetDevices(); |
|
228
|
|
|
$.each(j.devices,function(i,v) { |
|
229
|
|
|
// test if we have a global profile redirect |
|
230
|
|
|
if(v.id == 0) { |
|
231
|
|
|
redirect_profile = v.redirect; |
|
232
|
|
|
} else { |
|
233
|
|
|
if(v.status > 0 && v.redirect == '0') { |
|
234
|
|
|
$("#g_"+v.id).addClass('alertButton'); |
|
235
|
|
|
$("#cross_icon_"+v.id).show(); |
|
236
|
|
|
$("#"+v.id).addClass('disabledDevice'); |
|
237
|
|
|
$("#download_button_header_"+v.id).html("<?php escaped_echo(sprintf(_("This device cannot be configured with settings provided by your %s"), $cat->nomenclature_inst))?>"); |
|
238
|
|
|
$("#info_b_"+v.id+",#g_info_b_"+v.id).hide(); |
|
239
|
|
|
} else { |
|
240
|
|
|
if(v.status == -1) |
|
241
|
|
|
$("#"+v.id).parent().parent().hide(); |
|
242
|
|
|
else |
|
243
|
|
|
if ($( window ).width() > 389 ) |
|
244
|
|
|
$("#info_b_"+v.id+",#g_info_b_"+v.id).show(); |
|
245
|
|
|
} |
|
246
|
|
|
if(v.redirect != '0') { |
|
247
|
|
|
$("#"+v.id+",#g_"+v.id).addClass('additionalInfo'); |
|
248
|
|
|
$("#"+v.id+",#g_"+v.id).click(function(event){ |
|
249
|
|
|
i_div = $("#info_"+$(this).attr('id')); |
|
250
|
|
|
t = "<?php escaped_echo(_("Your site administrator has specified that this device should be configured with resources located on a local page. When you click <b>Continue</b> this page will be opened in a new window/tab."))?>"+"<br><span class='redirect_link'><a href='"+v.redirect+"' target='_blank'><?php escaped_echo(_("Continue")); ?></a></span>"; |
|
251
|
|
|
i_div.html(t); |
|
252
|
|
|
$(".redirect_link").click(function(event) { |
|
253
|
|
|
i_div.hide(); |
|
254
|
|
|
}); |
|
255
|
|
|
|
|
256
|
|
|
}); |
|
257
|
|
|
} else if(v.device_customtext != '0' || v.eap_customtext != '0' || v.message != '0' || v.status > 0) { |
|
258
|
|
|
var continue_text = "<?php escaped_echo(_("Continue")); ?>"; |
|
259
|
|
|
$("#"+v.id+",#g_"+v.id).addClass('additionalInfo'); |
|
260
|
|
|
$("#"+v.id+",#g_"+v.id).click(function(event){ |
|
261
|
|
|
i_div = $("#info_"+$(this).attr('id')); |
|
262
|
|
|
if(v.status > 0) { |
|
263
|
|
|
t = "<?php escaped_echo(sprintf(_("This device cannot be configured with settings provided by your %s"), $cat->nomenclature_inst))?>"; |
|
264
|
|
|
continue_text = "<?php escaped_echo(_("Close")); ?>"; |
|
265
|
|
|
} else { |
|
266
|
|
|
t = i_div.html(); |
|
267
|
|
|
if(v.message != '0') { |
|
268
|
|
|
if (t != '') |
|
269
|
|
|
t += '<br>'; |
|
270
|
|
|
t += v.message; |
|
271
|
|
|
} |
|
272
|
|
|
if(v.device_customtext != '0') { |
|
273
|
|
|
if (t != '') |
|
274
|
|
|
t += '<br>'; |
|
275
|
|
|
t += v.device_customtext; |
|
276
|
|
|
} |
|
277
|
|
|
if(v.eap_customtext != '0') { |
|
278
|
|
|
if (t != '') |
|
279
|
|
|
t += '<br/> <br/>'; |
|
280
|
|
|
t += v.eap_customtext; |
|
281
|
|
|
} |
|
282
|
|
|
} |
|
283
|
|
|
t += "<br><span class='redirect_link'>"+continue_text+"</span>"; |
|
284
|
|
|
i_div.html(t); |
|
285
|
|
|
$(".redirect_link").click(function(event) { |
|
286
|
|
|
i_div.hide('fast'); |
|
287
|
|
|
var dev_id = pressedButton.attr('id'); |
|
288
|
|
|
if(dev_id.substr(0,2) == "g_") |
|
289
|
|
|
dev_id = dev_id.substr(2); |
|
290
|
|
|
if(v.status == 0) { |
|
291
|
|
|
$('#download_info').hide(); |
|
292
|
|
|
$("#devices").hide(); |
|
293
|
|
|
generateTimer = $.now(); |
|
294
|
|
|
$("#user_welcome").show(); |
|
295
|
|
|
$.post('<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>', {action: 'generateInstaller', api_version: 2, lang: lang, device: dev_id, profile: profile}, processDownload); |
|
296
|
|
|
} |
|
297
|
|
|
}); |
|
298
|
|
|
|
|
299
|
|
|
}); |
|
300
|
|
|
} |
|
301
|
|
|
} |
|
302
|
|
|
}); |
|
303
|
|
|
if(redirect_profile == 0) { |
|
304
|
|
|
$("#devices").show(); |
|
305
|
|
|
} else { |
|
306
|
|
|
$("#devices").hide(); |
|
307
|
|
|
$("#user_info").hide(); |
|
308
|
|
|
$("#profile_redirect_bt").attr('href',redirect_profile); |
|
309
|
|
|
$("#profile_redirect").show(); |
|
310
|
|
|
} |
|
311
|
|
|
}) |
|
312
|
|
|
} |
|
313
|
|
|
|
|
314
|
|
|
function changeLang(l) { |
|
315
|
|
|
$("#lang").val(l); |
|
316
|
|
|
document.cat_form.submit(); |
|
317
|
|
|
} |
|
318
|
|
|
|
|
319
|
|
|
function showInfo(data, title) { |
|
320
|
|
|
if(data.substring(0,8) == 'no_title') { |
|
321
|
|
|
data = data.substring(8,data.length); |
|
322
|
|
|
} else { |
|
323
|
|
|
data = "<h1>"+title+"</h1>"+data; |
|
324
|
|
|
} |
|
325
|
|
|
if (roller) |
|
326
|
|
|
Program.stop_program = 1; |
|
327
|
|
|
$("#main_body").fadeTo("fast", 0.1); |
|
328
|
|
|
$("#main_menu_content").html(data); |
|
329
|
|
|
$("#main_menu_info").show('fast'); |
|
330
|
|
|
} |
|
331
|
|
|
|
|
332
|
|
|
function infoCAT(k,subK,title) { |
|
333
|
|
|
$.post('<?php echo $Gui->skinObject->findResourceUrl("BASE", "user/cat_info.php")?>', {page: k, subpage: subK, lang: lang}, function(data) { |
|
334
|
|
|
showInfo(data, title)}); |
|
335
|
|
|
} |
|
336
|
|
|
|
|
337
|
|
|
function waiting(action) { |
|
338
|
|
|
if (action == 'start') { |
|
339
|
|
|
var x = getWindowHCenter() - 16; |
|
340
|
|
|
$("#loading_ico").css('left',x+'px'); |
|
341
|
|
|
$("#loading_ico").attr('src','resources/images/icons/loading9.gif'); |
|
342
|
|
|
$("#loading_ico").show(); |
|
343
|
|
|
return; |
|
344
|
|
|
} |
|
345
|
|
|
if (action == 'stop') { |
|
346
|
|
|
$("#loading_ico").hide(); |
|
347
|
|
|
return; |
|
348
|
|
|
} |
|
349
|
|
|
} |
|
350
|
|
|
|
|
351
|
|
|
function goAdmin() { |
|
352
|
|
|
waiting('start'); |
|
353
|
|
|
window.location.replace("<?php echo $Gui->skinObject->findResourceUrl("BASE", "admin/overview_user.php")?>?lang="+lang); |
|
354
|
|
|
} |
|
355
|
|
|
|
|
356
|
|
|
function remindIdPF() { |
|
357
|
|
|
mail = $("#remindIdP").val(); |
|
358
|
|
|
key = $("#remindIdPs").val(); |
|
359
|
|
|
if (mail == "") { |
|
360
|
|
|
alert("<?php echo(_("Missing email address")); ?>"); |
|
361
|
|
|
return; |
|
362
|
|
|
} |
|
363
|
|
|
waiting('start'); |
|
364
|
|
|
$.get('<?php echo $skinObject->findResourceUrl("BASE", "user/remindIdP.php"); ?>', {key: key, mail: mail}, function(data) { |
|
365
|
|
|
$("#remindIdPl").html(""); |
|
366
|
|
|
try { |
|
367
|
|
|
j = $.parseJSON(data); |
|
368
|
|
|
} |
|
369
|
|
|
catch(err) { |
|
370
|
|
|
alert(generation_error); |
|
371
|
|
|
return(false); |
|
372
|
|
|
} |
|
373
|
|
|
if (j.status == 0) { |
|
374
|
|
|
$("#remindIdPh").html("<?php echo _("No providers found for this email") ?>"); |
|
375
|
|
|
return; |
|
376
|
|
|
} |
|
377
|
|
|
if (j.data.length == 1) { |
|
378
|
|
|
$("#remindIdPh").html("<?php echo _("Your IdP is:") ?>"); |
|
379
|
|
|
} else { |
|
380
|
|
|
$("#remindIdPh").html("<?php echo _("Your IdP could be one of:") ?>"); |
|
381
|
|
|
} |
|
382
|
|
|
$.each(j.data, function(i, v) { |
|
383
|
|
|
$("#remindIdPl").append('<li>' + v + '</li>'); |
|
384
|
|
|
}); |
|
385
|
|
|
waiting('stop'); |
|
386
|
|
|
}); |
|
387
|
|
|
} |
|
388
|
|
|
|
|
389
|
|
|
|
|
390
|
|
|
/* Get horizontal center of the Browser Window */ |
|
391
|
|
|
|
|
392
|
|
|
function getWindowHCenter() { |
|
393
|
|
|
var windowWidth = 0; |
|
394
|
|
|
if ( typeof( window.innerWidth ) == 'number' ) { |
|
395
|
|
|
windowWidth = window.innerWidth; |
|
396
|
|
|
} else { |
|
397
|
|
|
if ( document.documentElement && document.documentElement.clientWidth ) { |
|
398
|
|
|
windowWidth = document.documentElement.clientWidth; |
|
399
|
|
|
} else { |
|
400
|
|
|
if ( document.body && document.body.clientWidth ) { |
|
401
|
|
|
windowWidth = document.body.clientWidth; |
|
402
|
|
|
} |
|
403
|
|
|
} |
|
404
|
|
|
} |
|
405
|
|
|
return(Math.round(windowWidth/2)); |
|
406
|
|
|
} |
|
407
|
|
|
|
|
408
|
|
|
<?php if ($idpId) { |
|
409
|
|
|
print "front_page = 0;\n"; |
|
410
|
|
|
} ?> |
|
411
|
|
|
|
|
412
|
|
|
function showTOU(){ |
|
413
|
|
|
$("#all_tou_link").hide(); |
|
414
|
|
|
$("#tou_2").show(); |
|
415
|
|
|
|
|
416
|
|
|
} |
|
417
|
|
|
|
|
418
|
|
|
function back_to_downloads() { |
|
419
|
|
|
$("#devices").show(); |
|
420
|
|
|
$("#user_welcome").hide(); |
|
421
|
|
|
} |
|
422
|
|
|
|
|
423
|
|
|
|
|
424
|
|
|
function processDownload(data) { |
|
425
|
|
|
generateTimer = $.now() - generateTimer; |
|
426
|
|
|
if(generateTimer < 3000) |
|
427
|
|
|
generateTimer = 3000 - generateTimer; |
|
428
|
|
|
else |
|
429
|
|
|
generateTimer = 0; |
|
430
|
|
|
|
|
431
|
|
|
var j; |
|
432
|
|
|
//alert(data); |
|
433
|
|
|
try { |
|
434
|
|
|
j = $.parseJSON(data).data; |
|
435
|
|
|
} |
|
436
|
|
|
catch(err) { |
|
437
|
|
|
alert(generation_error); |
|
438
|
|
|
return(false); |
|
439
|
|
|
} |
|
440
|
|
|
if( j.link == 0 ) |
|
441
|
|
|
alert(generation_error); |
|
442
|
|
|
else { |
|
443
|
|
|
download_link = '<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>?action=downloadInstaller&api_version=2&lang='+lang+'&device='+j.device+'&profile='+j.profile; |
|
444
|
|
|
$("#download_info a").attr('href',download_link); |
|
445
|
|
|
$('#download_info').show(); |
|
446
|
|
|
if( generateTimer > 0 ) { |
|
447
|
|
|
setTimeout("document.location.href=download_link",generateTimer); |
|
448
|
|
|
} |
|
449
|
|
|
else { |
|
450
|
|
|
document.location.href=download_link; |
|
451
|
|
|
} |
|
452
|
|
|
} |
|
453
|
|
|
} |
|
454
|
|
|
|
|
455
|
|
|
$(document).ready(function(){ |
|
456
|
|
|
var j ; |
|
457
|
|
|
|
|
458
|
|
|
if(ie_version == 0 ) |
|
459
|
|
|
$('body').addClass("use_borders"); |
|
460
|
|
|
else { |
|
461
|
|
|
if(ie_version == 8) |
|
462
|
|
|
$('body').addClass("old_ie"); |
|
463
|
|
|
if(ie_version < 8) |
|
464
|
|
|
$('body').addClass("no_borders"); |
|
465
|
|
|
if(ie_version > 9) |
|
466
|
|
|
$('body').addClass("no_borders"); |
|
467
|
|
|
} |
|
468
|
|
|
|
|
469
|
|
|
if (sbPage == 0) { |
|
470
|
|
|
$("#user_page").hide(); |
|
471
|
|
|
$("#institution_name").hide(); |
|
472
|
|
|
$("#user_info").hide(); |
|
473
|
|
|
} else { |
|
474
|
|
|
$("#user_page").show(); |
|
475
|
|
|
$("#institution_name").show(); |
|
476
|
|
|
$("#user_info").show(); |
|
477
|
|
|
} |
|
478
|
|
|
$("#profiles").hide(); |
|
479
|
|
|
$("#devices").hide(); |
|
480
|
|
|
$("#download_info a").css('font-weight','bold'); |
|
481
|
|
|
|
|
482
|
|
|
$("#profile_list").change(function(event){ |
|
483
|
|
|
showProfile($(this).val()); |
|
484
|
|
|
}); |
|
485
|
|
|
|
|
486
|
|
|
resetDevices(); |
|
487
|
|
|
<?php |
|
488
|
|
|
if ($profileId) { |
|
489
|
|
|
print "listProfiles($idpId, $profileId);"; |
|
490
|
|
|
} |
|
491
|
|
|
?> |
|
492
|
|
|
|
|
493
|
|
|
$(".signin").click(function(event){ |
|
494
|
|
|
event.preventDefault(); |
|
495
|
|
|
}); |
|
496
|
|
|
|
|
497
|
|
|
$("#main_menu_close").click(function(event){ |
|
498
|
|
|
$("#main_menu_info").hide('fast'); |
|
499
|
|
|
$("#main_body").fadeTo("fast", 1.0); |
|
500
|
|
|
if (roller) { |
|
501
|
|
|
Program.stop_program = 0; |
|
502
|
|
|
Program.nextStep(); |
|
503
|
|
|
} |
|
504
|
|
|
return(false); |
|
505
|
|
|
}); |
|
506
|
|
|
|
|
507
|
|
|
$("#info_menu_close").click(function(event){ |
|
508
|
|
|
$("#info_overlay").hide('fast'); |
|
509
|
|
|
$("#main_body").fadeTo("fast", 1.0); |
|
510
|
|
|
}); |
|
511
|
|
|
|
|
512
|
|
|
$("#hamburger").click(function(event){ |
|
513
|
|
|
$("#menu_top > ul").toggle(); |
|
514
|
|
|
}); |
|
515
|
|
|
|
|
516
|
|
|
$("#menu_top > ul >li").click(function(event){ |
|
517
|
|
|
if ($( window ).width() < 750 ) { |
|
518
|
|
|
$("#menu_top > ul").hide(); |
|
519
|
|
|
} |
|
520
|
|
|
}); |
|
521
|
|
|
|
|
522
|
|
|
|
|
523
|
|
|
catWelcome = $("#main_menu_content").html(); |
|
524
|
|
|
|
|
525
|
|
|
if (noDisco === 0) { |
|
526
|
|
|
$(".signin").DiscoJuice({ |
|
527
|
|
|
"discoPath":"external/discojuice/", |
|
528
|
|
|
"iconPath":"<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>?action=sendLogo&api_version=2&disco=1&lang=en&idp=", |
|
529
|
|
|
"overlay":true,"cookie":true,"type":false, |
|
530
|
|
|
"country":true,"location":true, |
|
531
|
|
|
"title":"<?php escaped_echo($cat->nomenclature_inst) ?>", |
|
532
|
|
|
"subtitle":"<?php escaped_echo(sprintf(_("Select your <strong>%s<\/strong>"), $cat->nomenclature_inst)) ?>", |
|
533
|
|
|
"textHelp": "<?php escaped_echo(sprintf(_("Help, my %s is not on the list"), $cat->nomenclature_inst)) ?>", |
|
534
|
|
|
"textHelpMore": "<?php escaped_echo(sprintf(_("This system relies on information supplied by local %s administrators. If your %s is not on the list, then nag them to add information to the %s database."), CONFIG_CONFASSISTANT['CONSORTIUM']['display_name'], $cat->nomenclature_inst, CONFIG['APPEARANCE']['productname'])); ?>", |
|
535
|
|
|
"textLocateMe": "<?php escaped_echo(_("Locate me more accurately using HTML5 Geo-Location")) ?>", |
|
536
|
|
|
"textShowProviders": "<?php escaped_echo(sprintf(_("Show %ss in"), $cat->nomenclature_inst)) ?>", |
|
537
|
|
|
"textAllCountries": "<?php escaped_echo(_("all countries")) ?>", |
|
538
|
|
|
"textSearch" : "<?php escaped_echo(sprintf(_("or search for an %s, in example Univerity of Oslo"), $cat->nomenclature_inst)) ?>", |
|
539
|
|
|
"textShowAllCountries": "<?php escaped_echo(_("show all countries")) ?>", |
|
540
|
|
|
"textLimited1" : "<?php escaped_echo(_("Results limited to"))?>", |
|
541
|
|
|
"textLimited2" : "<?php escaped_echo(_("entries - show more"))?>", |
|
542
|
|
|
"textNearby" : "<?php escaped_echo(_("Nearby"))?>", |
|
543
|
|
|
"geoLoc_timeout" : "<?php escaped_echo(_("Location timeout"))?>", |
|
544
|
|
|
"geoLoc_posUnavailable" : "<?php escaped_echo(_("Could not get your position"))?>", |
|
545
|
|
|
"geoLoc_permDenied" : "<?php escaped_echo(_("Your browser has denied access to your location"))?>", |
|
546
|
|
|
"geoLoc_unknownError" : "<?php escaped_echo(_("Unknown location error"))?>", |
|
547
|
|
|
"geoLoc_here" : "<?php escaped_echo(_("You are here:"))?>", |
|
548
|
|
|
"geoLoc_getting" : "<?php escaped_echo(_("Getting your location..."))?>", |
|
549
|
|
|
"geoLoc_nearby" : "<?php escaped_echo(_("Nearby providers shown on top."))?>", |
|
550
|
|
|
"countryAPI":"<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>?action=locateUser&api_version=2", |
|
551
|
|
|
"metadata":"<?php echo $skinObject->findResourceUrl("BASE", "user/API.php"); ?>?action=listAllIdentityProviders&api_version=2&lang="+lang, |
|
552
|
|
|
"callback": function(e) { |
|
553
|
|
|
$("#profile_desc").hide(); |
|
554
|
|
|
$("#profile_desc").text(''); |
|
555
|
|
|
$("#welcome_top1").hide(); |
|
556
|
|
|
$("#top_invite").hide(); |
|
557
|
|
|
$("#institution_name").hide(); |
|
558
|
|
|
$("#front_page").hide(); |
|
559
|
|
|
if (roller) |
|
560
|
|
|
Program.stop_program = 1; |
|
561
|
|
|
$(this).addClass('pressed'); |
|
562
|
|
|
$('#welcome').hide(); |
|
563
|
|
|
$("#inst_name_span").html(""); |
|
564
|
|
|
$("#user_info").hide(); |
|
565
|
|
|
$("#devices").hide(); |
|
566
|
|
|
$("#profile_redirect").hide(); |
|
567
|
|
|
$("#profiles").hide(); |
|
568
|
|
|
$("#institutions").hide(); |
|
569
|
|
|
listProfiles(e.idp,0); |
|
570
|
|
|
} |
|
571
|
|
|
}); |
|
572
|
|
|
DiscoJuice.Constants.Countries = { |
|
573
|
|
|
<?php |
|
574
|
|
|
$C = $Gui->printCountryList(1); |
|
575
|
|
|
$ret = ''; |
|
576
|
|
|
foreach ($C as $key => $val) { |
|
577
|
|
|
$ret .= "'$key': \"$val\","; |
|
578
|
|
|
} |
|
579
|
|
|
echo substr($ret, 0, -1); |
|
580
|
|
|
?> |
|
581
|
|
|
}; |
|
582
|
|
|
} |
|
583
|
|
|
|
|
584
|
|
|
|
|
585
|
|
|
// device_button_bg = $("button:first").css('background'); |
|
586
|
|
|
device_button_fg = $("button:first").css('color'); |
|
587
|
|
|
|
|
588
|
|
|
if(front_page) |
|
589
|
|
|
if (roller) |
|
590
|
|
|
$("#img_roll_1").fadeOut(0); |
|
591
|
|
|
$("#cursor").fadeOut(0); |
|
592
|
|
|
if(front_page) { |
|
593
|
|
|
$("#front_page").show(); |
|
594
|
|
|
if (roller) |
|
595
|
|
|
prepareAnimation(); |
|
596
|
|
|
} |
|
597
|
|
|
|
|
598
|
|
|
//alert($("#welcome_top1").css('display')); |
|
599
|
|
|
|
|
600
|
|
|
$( window ).resize(function(event) { |
|
601
|
|
|
if ($( window ).width() > 750) { |
|
602
|
|
|
$("#menu_top > ul").show(); |
|
603
|
|
|
} |
|
604
|
|
|
}); |
|
605
|
|
|
|
|
606
|
|
|
}); |
|
607
|
|
|
|