Upgrade to new Gitlab Version 13.9 on Saturday 19th April 20:00. Expect an interruption of about 30 to 60 minutes

default-header.php 6.37 KB
Newer Older
1
<?php // Copyright (c) 2019, SWITCH?>
haemmer's avatar
haemmer committed
2
<!DOCTYPE HTML>
3 4
<html>
<head>
5 6 7
	<title><?php echo getLocalString('title') ?></title>
	<!-- <meta http-equiv="content-type" content="text/html; charset=utf-8"> -->
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
haemmer's avatar
haemmer committed
8
	<meta name="keywords" content="Home Organisation, Discovery Service, WAYF, Shibboleth, Login, AAI">
haemmer's avatar
haemmer committed
9
	<meta name="description" content="Choose your home organisation to authenticate">
haemmer's avatar
haemmer committed
10
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes">
haemmer's avatar
haemmer committed
11
	<link rel="stylesheet" href="<?php echo $_SERVER['SCRIPT_NAME'] ?>/styles.css" type="text/css">
12
	<script type="text/javascript" src="<?php echo $javascriptURL ?>/jquery.js"></script>
13 14
	<?php

15
    if (isUseSelect2()) {
16
        echo '<link rel="stylesheet" href="'. $_SERVER['SCRIPT_NAME'] .'/select2.css" type="text/css" >'.PHP_EOL;
17 18 19 20 21
        // Version of select2 : 4.0.6-rc.0
        // Availability https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/select2.min.js
        // Languages available at https://cdnjs.cloudflare.com/ajax/libs/select2/4.0.6-rc.0/js/i18n/<2letterCode>.js
        echo '<script type="text/javascript" src="'.$javascriptURL .'/select2.min.js"></script>'.PHP_EOL;
        echo '<script type="text/javascript" src="'.$javascriptURL .'/i18n/'.$language.'.js"></script>'.PHP_EOL;
22 23 24 25 26 27 28
        echo '<script type="text/javascript" src="'.$javascriptURL .'/select2Functions.js"></script>'.PHP_EOL;
    } elseif ($useImprovedDropDownList) {
        echo '<link rel="stylesheet" href="'. $_SERVER['SCRIPT_NAME'] .'/ImprovedDropDown.css" type="text/css">'.PHP_EOL;
        echo '<script type="text/javascript" src="'. $javascriptURL .'/improvedDropDown.js"></script>'.PHP_EOL;
    }

?>
haemmer's avatar
haemmer committed
29
	<script type="text/javascript">
30
	<!--
31

32 33 34 35 36
	// Prevent that WAYF is loaded in an IFRAME
	function preventIframeEmbedding(){
		if (top != self) {
			top.location = self.location;
		}
haemmer's avatar
haemmer committed
37
	}
38

39 40 41 42
	// Set focus to submit button or drop down list
	function setFocus(){
		// Skip this if we cannot access the form elements
		if (
43
			!document.IdPList ||
44 45 46 47
			!document.IdPList.Select
			){
			return;
		}
48

49
		if (
50
				document.IdPList.user_idp &&
51 52 53 54 55 56 57 58
				document.IdPList.user_idp.selectedIndex == 0
			){
			// Set focus to select
			document.IdPList.user_idp.focus();
		} else {
			// Set focus to submit button
			document.IdPList.Select.focus();
		}
haemmer's avatar
haemmer committed
59
	}
60

61 62 63
	// Perform input validation on WAYF form
	function checkForm(){
		if(
64
			document.IdPList.user_idp &&
65 66 67 68
			document.IdPList.user_idp.selectedIndex == 0
		){
			alert(unescape('<?php echo getLocalString('make_selection', 'js') ?>'));
			return false;
haemmer's avatar
haemmer committed
69
		} else {
haemmer's avatar
haemmer committed
70
			return true;
haemmer's avatar
haemmer committed
71 72
		}
	}
73

74 75 76
	// Init WAYF
	function init(){
		preventIframeEmbedding();
77

78
		setFocus();
79

80 81 82
<?php if (isUseSelect2()) {
    if ($bodyType == "settings" || $bodyType == "WAYF") {
        ?>
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
        $('.userIdPSelection').select2({
          ajax: {
            url: <?php echo "'".$apiURL."/idps'" ?>,
            delay: 250,
            dataType: 'json',
            data: function (params) {
            var query = {
            search: params.term,
            page: params.page || 1
            }
            // Query parameters will be ?search=[term]&page=[page]
            return query;
            },
            error: function(jqxhr, status, exception) {
              console.error('Exception:', exception);
              <?php
              if ($developmentMode) {
                  echo("alert('Exception:', exception);");
              } ?>
            }
          },
          placeholder: "<?php echo getLocalString('select_idp') ?>",
          allowClear: true,
          language: "<?php echo $language ?>",
          templateResult: formatIdp,
          templateSelection: formatIdp,
          escapeMarkup: function (text) { return text; }
        });
        // Auto-submit when an idp is selected
        $('.userIdPSelection').on('select2:select', function (e) {
          document.getElementById("IdPList").submit();
        });
115 116 117
		<?php
    } elseif ($bodyType == "notice" && $permanentUserIdP != '') {
        ?>
118 119 120 121 122 123
        $('.userIdPSelectionNotice').select2({
          allowClear: false,
          templateSelection: formatIdpNotice,
          disabled: true,
          escapeMarkup: function (text) { return text; }
        });
124 125 126 127
<?php
    }
} elseif ($useImprovedDropDownList) {
    ?>
128

129 130
			var searchText = '<?php echo getLocalString('search_idp', 'js') ?>';
			$("#userIdPSelection:enabled option[value='-']").text(searchText);
131

132
			// Convert select element into improved drop down list
133
			$("#userIdPSelection:enabled").improveDropDown({
134 135
				iconPath:'<?php echo $imageURL ?>/drop_icon.png',
				noMatchesText: '<?php echo getLocalString('no_idp_found', 'js') ?>',
haemmer's avatar
haemmer committed
136 137
				noItemsText: '<?php echo getLocalString('no_idp_available', 'js') ?>',
				disableRemoteLogos: <?php echo ($disableRemoteLogos) ? 'true' : 'false' ?>
138
			});
139 140
		<?php
} ?>
141
	}
142

haemmer's avatar
haemmer committed
143
	// Call init function when DOM is ready
haemmer's avatar
haemmer committed
144
	$(document).ready(init);
145

146 147 148
	-->
	</script>
</head>
149

150
<body>
151

haemmer's avatar
haemmer committed
152
<div id="container">
haemmer's avatar
haemmer committed
153
	<div class="box">
haemmer's avatar
haemmer committed
154
		<div id="header">
155
			<?php if (!empty($logoURL)) {
156
        ?>
haemmer's avatar
haemmer committed
157
			<a href="<?php echo sprintf($federationURL, $language) ?>"><img src="<?php echo $logoURL ?>" alt="Federation Logo" id="federationLogo"></a>
158
			<?php
159
    } ?>
160
			<?php if (!empty($organizationLogoURL)) {
161
        ?>
haemmer's avatar
haemmer committed
162
			<a href="<?php echo sprintf($organizationURL, $language) ?>"><img src="<?php echo $organizationLogoURL ?>" alt="Organization Logo" id="organisationLogo"></a>
163
			<?php
164
    } ?>
165
		</div>
haemmer's avatar
haemmer committed
166 167
			<div id="content">
				<ul class="menu">
168
					<?php if (!empty($federationURL) && getLocalString('about_federation') != '') {
169
        ?>
haemmer's avatar
haemmer committed
170
					<li><a href="<?php echo sprintf($federationURL, $language) ?>"><?php echo getLocalString('about_federation'); ?></a></li>
171
					<?php
172
    } ?>
173
					<?php if (!empty($faqURL) && getLocalString('faq') != '') {
174
        ?>
haemmer's avatar
haemmer committed
175
					<li class="last"><a href="<?php echo sprintf($faqURL, $language) ?>"><?php echo getLocalString('faq') ?></a></li>
176
					<?php
177
    } ?>
178
					<?php if (!empty($helpURL) && getLocalString('help') != '') {
179
        ?>
haemmer's avatar
haemmer committed
180
					<li class="last"><a href="<?php echo sprintf($helpURL, $language) ?>"><?php echo getLocalString('help') ?></a></li>
181
					<?php
182
    } ?>
183
					<?php if (!empty($privacyURL) && getLocalString('privacy') != '') {
184
        ?>
haemmer's avatar
haemmer committed
185
					<li class="last"><a href="<?php echo sprintf($privacyURL, $language) ?>"><?php echo getLocalString('privacy') ?></a></li>
186
					<?php
187
    } ?>
haemmer's avatar
haemmer committed
188
				</ul>
haemmer's avatar
haemmer committed
189
<!-- Body: Start -->