diff --git a/CHANGELOG.md b/CHANGELOG.md index f7e61244cad2715cd0fb01f42e6e1c765a69c0ac..ee7f671cd72cd43efd8026c0e8e60515b6eaf38d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ All notable changes to this project will be documented in this file. [Changed] - Changed code style to PSR-2 - addInstitution URL and email in disco-tpl.php are loaded from a config file +- Templates are included from module perun ## [v2.2.0] [Added] diff --git a/dictionaries/bbmri.definition.json b/dictionaries/bbmri.definition.json deleted file mode 100644 index 56d70c290ba5a316c9dc343a3111ad09db8134b6..0000000000000000000000000000000000000000 --- a/dictionaries/bbmri.definition.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "error_report_email_message": { - "en": "Please provide your mail so that we can contact you for further information or let you know the issue was fixed." - }, - "error_number": { - "en": "Error number: " - }, - "error_id": { - "en": "Error ID" - }, - "note": { - "en": "Note:" - }, - "browser_not_support_javascript": { - "en": " Since your browser does not support JavaScript, you must press the button below once to proceed." - }, - "previous_selection": { - "en": "your previous selection" - }, - "cannot_find_institution": { - "en": "Don't have an account? Create it by clicking the button below or contact us at " - }, - "create_account_hostel": { - "en": "Create account at Hostel" - }, - "create_account_lifeScienceHostel": { - "en": "Create account at LifeScience Hostel" - }, - "cannot_find_institution_extended": { - "en": "Can't find your institution? Select it in extended list and help us " - }, - "more": { - "en": "more " - }, - "type_name_institution": { - "en": "Type the name of your institution" - }, - "institutional_account": { - "en": "your institutional account" - }, - "add_institution": { - "en": "Add your institution" - }, - "warning": { - "en": "Warning!" - } -} diff --git a/themes/bbmri/consent/consentform.php b/themes/bbmri/consent/consentform.php index 348eaf30239f2b4632b5569d34139859a8cefc39..16ae7d96d080d8b8b691eb8aa59955f9c5216bcf 100644 --- a/themes/bbmri/consent/consentform.php +++ b/themes/bbmri/consent/consentform.php @@ -1,158 +1,3 @@ <?php -use SimpleSAML\Module; -use SimpleSAML\Utils\Arrays; - -/** - * Template form for giving consent. - * - * Parameters: - * - 'srcMetadata': Metadata/configuration for the source. - * - 'dstMetadata': Metadata/configuration for the destination. - * - 'yesTarget': Target URL for the yes-button. This URL will receive a POST request. - * - 'yesData': Parameters which should be included in the yes-request. - * - 'noTarget': Target URL for the no-button. This URL will receive a GET request. - * - 'noData': Parameters which should be included in the no-request. - * - 'attributes': The attributes which are about to be released. - * - 'sppp': URL to the privacy policy of the destination, or FALSE. - * - * @package SimpleSAMLphp - */ -assert('is_array($this->data["srcMetadata"])'); -assert('is_array($this->data["dstMetadata"])'); -assert('is_string($this->data["yesTarget"])'); -assert('is_array($this->data["yesData"])'); -assert('is_string($this->data["noTarget"])'); -assert('is_array($this->data["noData"])'); -assert('is_array($this->data["attributes"])'); -assert('is_array($this->data["hiddenAttributes"])'); -assert('$this->data["sppp"] === false || is_string($this->data["sppp"])'); - -// Parse parameters -if (array_key_exists('name', $this->data['srcMetadata'])) { - $srcName = $this->data['srcMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['srcMetadata'])) { - $srcName = $this->data['srcMetadata']['OrganizationDisplayName']; -} else { - $srcName = $this->data['srcMetadata']['entityid']; -} - -if (is_array($srcName)) { - $srcName = $this->t($srcName); -} - -if (array_key_exists('name', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['OrganizationDisplayName']; -} else { - $dstName = $this->data['dstMetadata']['entityid']; -} - -if (is_array($dstName)) { - $dstName = $this->t($dstName); -} - -$srcName = htmlspecialchars($srcName); -$dstName = htmlspecialchars($dstName); - -$attributes = $this->data['attributes']; - -$this->data['header'] = $this->t('{consent:consent:consent_header}'); - -$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . - Module::getModuleUrl('consent/assets/css/consent.css') . '" />'; -$this->data['head'] .= '<link rel="stylesheet" media="screen" type="text/css" href="' . - Module::getModuleUrl('bbmri/res/css/consent.css') . '" />'; - -$this->includeAtTemplateBase('includes/header.php'); - -/* -echo $this->t( - '{consent:consent:consent_accept}', - array( 'SPNAME' => $dstName, 'IDPNAME' => $srcName) -); -*/ - -if (array_key_exists('descr_purpose', $this->data['dstMetadata'])) { - echo '</p><p>' . $this->t( - '{consent:consent:consent_purpose}', - array( - 'SPNAME' => $dstName, - 'SPDESC' => $this->getTranslation( - Arrays::arrayize( - $this->data['dstMetadata']['descr_purpose'], - 'en' - ) - ), - ) - ); -} - -if ($this->data['sppp'] !== false) { - echo "<p>" . htmlspecialchars($this->t('{consent:consent:consent_privacypolicy}')) . " "; - echo "<a target='_blank' href='" . htmlspecialchars($this->data['sppp']) . "'>" . $dstName . "</a>"; - echo "</p>"; -} - -echo '<h3 id="attributeheader">' . - $this->t( - '{consent:consent:consent_attributes_header}', - array('SPNAME' => $dstName, 'IDPNAME' => $srcName) - ) . - '</h3>'; - -echo present_attributes($this, $attributes, ''); - -?> - - <div class="row"> - <div class="col-xs-6"> - - <form action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>"> - <?php - if ($this->data['usestorage']) { - $checked = ($this->data['checked'] ? 'checked="checked"' : ''); - echo '<div class="checkbox"> - <label> - <input type="checkbox" name="saveconsent" value="1" /> ' . $this->t('{perun:consent:remember}') . ' - </label> - </div>'; - } - ?> - - <?php - // Embed hidden fields... - foreach ($this->data['yesData'] as $name => $value) { - echo '<input type="hidden" name="' . htmlspecialchars($name) . - '" value="' . htmlspecialchars($value) . '" />'; - } - ?> - - <button type="submit" name="yes" class="btn btn-lg btn-success btn-block" id="yesbutton"> - <?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?> - </button> - - </form> - - </div> - <div class="col-xs-6"> - - <form action="<?php echo htmlspecialchars($this->data['noTarget']); ?>"> - - <?php - foreach ($this->data['noData'] as $name => $value) { - echo('<input type="hidden" name="' . htmlspecialchars($name) . - '" value="' . htmlspecialchars($value) . '" />'); - } - ?> - <button type="submit" class="btn btn-lg btn-default btn-block btn-no" name="no" id="nobutton"> - <?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?> - </button> - </form> - - </div> - </div> -<?php - -$this->includeAtTemplateBase('includes/footer.php'); +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/consent/consentform.php'; diff --git a/themes/bbmri/consent/noconsent.php b/themes/bbmri/consent/noconsent.php index a139c0b3dce83b71b4f414e095a86f98a881e985..f7591fe10dc90c8e20d1fdd0c3fb9e681060bb88 100644 --- a/themes/bbmri/consent/noconsent.php +++ b/themes/bbmri/consent/noconsent.php @@ -1,50 +1,3 @@ <?php -use SimpleSAML\Module; - -if (array_key_exists('name', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['name']; -} elseif (array_key_exists('OrganizationDisplayName', $this->data['dstMetadata'])) { - $dstName = $this->data['dstMetadata']['OrganizationDisplayName']; -} else { - $dstName = $this->data['dstMetadata']['entityid']; -} - -if (is_array($dstName)) { - $dstName = $this->t($dstName); -} - -$dstName = htmlspecialchars($dstName); - -$this->data['header'] = $this->t('{consent:consent:noconsent_title}'); - -$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css"' . - 'href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />'; - -$this->data['head'] .= '<link rel="stylesheet" media="screen" type="text/css" href="' . - Module::getModuleUrl('bbmri/res/css/consent.css') . '" />'; - -$this->includeAtTemplateBase('includes/header.php'); - -echo '<p>' . $this->t('{consent:consent:noconsent_text}', array('SPNAME' => $dstName)) . '</p>'; - -if ($this->data['resumeFrom']) { - echo('<p><a class="btn btn-default" href="' . htmlspecialchars($this->data['resumeFrom']) . '">'); - echo('<i class="glyphicon glyphicon-chevron-left"></i> '); - echo($this->t('{consent:consent:noconsent_return}')); - echo('</a></p>'); -} - -if ($this->data['aboutService']) { - echo('<p><a href="' . htmlspecialchars($this->data['aboutService']) . '">'); - echo('<i class="glyphicon glyphicon-info-sign"></i> '); - echo($this->t('{consent:consent:noconsent_goto_about}')); - echo('</a></p>'); -} - -echo('<p><a class="btn btn-default" href="' . htmlspecialchars($this->data['logoutLink']) . '">'); -echo('<i class="glyphicon glyphicon-ban-circle"></i> '); -echo($this->t('{consent:consent:abort}', array('SPNAME' => $dstName))); -echo('</a></p>'); - -$this->includeAtTemplateBase('includes/footer.php'); +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/consent/noconsent.php'; diff --git a/themes/bbmri/core/loginuserpass.php b/themes/bbmri/core/loginuserpass.php index b961f36ad7b45a75defc56a22cb3039cdf9e720c..f298450d355d8553f08f0cc14119ff4a4d3744e1 100644 --- a/themes/bbmri/core/loginuserpass.php +++ b/themes/bbmri/core/loginuserpass.php @@ -1,169 +1,3 @@ <?php -$this->data['header'] = $this->t('{login:user_pass_header}'); -if (strlen($this->data['username']) > 0) { - $this->data['autofocus'] = 'password'; -} else { - $this->data['autofocus'] = 'username'; -} -$this->includeAtTemplateBase('includes/header.php'); - -if ($this->data['errorcode'] !== null) { - ?> - <div class="alert alert-danger"> - <span class="glyphicon glyphicon-exclamation-sign" - style="float:left; font-size: 38px; margin-right: 10px;"></span> - - <strong> - <?php - echo htmlspecialchars($this->t( - '{errors:title_' . $this->data['errorcode'] . '}', - $this->data['errorparams'] - )); - ?> - </strong> - - <?php - echo htmlspecialchars($this->t( - '{errors:descr_' . $this->data['errorcode'] . '}', - $this->data['errorparams'] - )); - ?> - </div> - <?php -} - -?> - - <p><?php echo $this->t('{login:user_pass_text}'); ?></p> - - <br> - - <form action="?" method="post" name="f" class="form-horizontal"> - - <div class="form-group"> - <label for="username" class="col-sm-2 control-label"><?php echo $this->t('{login:username}'); ?></label> - <div class="col-sm-10"> - <input id="username" <?php echo ($this->data['forceUsername']) ? 'disabled="disabled"' : ''; ?> - type="text" name="username" class="form-control" - <?php - if (!$this->data['forceUsername']) { - echo 'tabindex="1"'; - } - ?> value="<?php echo htmlspecialchars($this->data['username']); ?>"/> - </div> - </div> - - <div class="form-group"> - <label for="password" class="col-sm-2 control-label"><?php echo $this->t('{login:password}'); ?></label> - <div class="col-sm-10"> - <input id="password" type="password" tabindex="2" name="password" class="form-control"/> - </div> - </div> - - <?php - if ($this->data['rememberUsernameEnabled'] && !$this->data['forceUsername']) { - // display the "remember my username" checkbox - ?> - <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <div class="checkbox"> - <label> - <input type="checkbox" id="remember_username" tabindex="4" - <?php echo ($this->data['rememberUsernameChecked']) ? 'checked="checked"' : ''; ?> - name="remember_username" value="Yes"/> - <?php echo $this->t('{login:remember_username}'); ?> - </label> - </div> - </div> - </div> - <?php - } - ?> - - <?php - if ($this->data['rememberMeEnabled']) { - // display the remember me checkbox (keep me logged in) - ?> - <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <div class="checkbox"> - <label> - <input type="checkbox" id="remember_me" tabindex="5" - <?php echo ($this->data['rememberMeChecked']) ? 'checked="checked"' : ''; ?> - name="remember_me" value="Yes"/> - <?php echo $this->t('{login:remember_me}'); ?> - </label> - </div> - </div> - </div> - <?php - } - ?> - - <?php - if (array_key_exists('organizations', $this->data)) { - ?> - <div class="form-group"> - <label for="organization" - class="col-sm-2 control-label"><?php echo $this->t('{login:organization}'); ?></label> - <div class="col-sm-10"> - <select name="organization" tabindex="3" class="form-control"> - <?php - if (array_key_exists('selectedOrg', $this->data)) { - $selectedOrg = $this->data['selectedOrg']; - } else { - $selectedOrg = null; - } - - foreach ($this->data['organizations'] as $orgId => $orgDesc) { - if (is_array($orgDesc)) { - $orgDesc = $this->t($orgDesc); - } - - if ($orgId === $selectedOrg) { - $selected = 'selected="selected" '; - } else { - $selected = ''; - } - - echo '<option ' . $selected . 'value="' . htmlspecialchars($orgId) . '">' . - htmlspecialchars($orgDesc) . '</option>'; - } - ?> - </select> - </div> - </div> - <?php - } - ?> - - <div class="form-group"> - <div class="col-sm-offset-2 col-sm-10"> - <button class="btn btn-success" - onclick="this.value='<?php echo $this->t('{login:processing}'); ?>'; - this.disabled=true; this.form.submit(); return true;" tabindex="6"> - <?php echo $this->t('{login:login_button}'); ?> - </button> - </div> - </div> - - <?php - foreach ($this->data['stateparams'] as $name => $value) { - echo('<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . - htmlspecialchars($value) . '" />'); - } - ?> - </form> - -<?php -if (!empty($this->data['links'])) { - echo '<ul class="links" style="margin-top: 2em">'; - foreach ($this->data['links'] as $l) { - echo '<li><a href="' . htmlspecialchars($l['href']) . '">' . - htmlspecialchars($this->t($l['text'])) . '</a></li>'; - } - echo '</ul>'; -} - -$this->includeAtTemplateBase('includes/footer.php'); +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/core/loginuserpass.php'; diff --git a/themes/bbmri/default/error.php b/themes/bbmri/default/error.php index e47fc8072c045157044b9b0dc4bbe5e19cb30137..d2244cc225f26609df318445a11cb1f5107f6596 100644 --- a/themes/bbmri/default/error.php +++ b/themes/bbmri/default/error.php @@ -1,107 +1,3 @@ <?php -use SimpleSAML\Module; - -$this->data['header'] = '<i class="glyphicon glyphicon-exclamation-sign text-danger"></i> ' . - $this->t($this->data['dictTitle']); - -$this->data['head'] = <<<EOF -<meta name="robots" content="noindex, nofollow" /> -<meta name="googlebot" content="noarchive, nofollow" /> -EOF; - -$this->data['head'] .= '<script src="' . Module::getModuleUrl('bbmri/res/js/jquery.js') . '" ></script>'; -$this->data['head'] .= '<script src="' . Module::getModuleUrl('bbmri/res/bootstrap/js/bootstrap.min.js') - . '" ></script>'; - -$this->includeAtTemplateBase('includes/header.php'); - -?> - - <p> - <?php - echo htmlspecialchars($this->t($this->data['dictDescr'], $this->data['parameters'])); - ?> - <a href="#moreInfo" data-toggle="collapse"><?php echo $this->t('{bbmri:bbmri:more}'); ?><span - class="caret"></span></a> - </p> - -<?php - -// include optional information for error -if (isset($this->data['includeTemplate'])) { - $this->includeAtTemplateBase($this->data['includeTemplate']); -} - -?> - <div id="moreInfo" class="collapse"> - <p id="trackid" - class="input-left"><?php echo $this->t('{bbmri:bbmri:error_number}'); ?> - <?php echo $this->data['error']['trackId']; ?> - </p> - <?php - // print out exception only if the exception is available - if ($this->data['showerrors']) { - ?> - <p style="margin: 1px"><?php echo htmlspecialchars($this->data['error']['exceptionMsg']); ?></p> - <pre style="padding: 1em; font-family: monospace;"><?php - echo htmlspecialchars($this->data['error']['exceptionTrace']); - ?></pre> - <?php - } - ?> - </div> -<?php -/* Add error report submit section if we have a valid technical contact. 'errorreportaddress' will only be set if - * the technical contact email address has been set. - */ -if (isset($this->data['errorReportAddress'])) { - ?> - <br> - <div class="panel panel-default"> - <div class="panel-heading"> - <h3 class="panel-title"><?php echo $this->t('report_header'); ?></h3> - </div> - <div class="panel-body"> - - <form action="<?php echo htmlspecialchars($this->data['errorReportAddress']); ?>" method="post" - class="form-horizontal"> - - <div class="form-group"> - <label class="col-sm-2 control-label" - for="reportId"><?php echo $this->t('{bbmri:bbmri:error_id}'); ?></label> - <div class="col-sm-10"> - <input name="reportId" type="text" class="form-control" id="reportId" - value="<?php echo $this->data['error']['reportId']; ?>" readonly> - </div> - </div> - - <div class="form-group"> - <label class="col-sm-2 control-label" for="email"><?php echo $this->t('report_email'); ?></label> - <div class="col-sm-10"> - <input name="email" type="email" class="form-control" id="email" placeholder="Email" required> - <span class="help-block"> - <?php echo $this->t('{bbmri:bbmri:error_report_email_message}'); ?> - </span> - </div> - </div> - - <div class="form-group"> - <div class="col-sm-12"> - <textarea name="text" class="form-control" rows="3" - placeholder="<?php echo $this->t('report_explain'); ?>"></textarea> - </div> - </div> - - <button type="submit" name="send" - class="btn btn-primary"><?php echo $this->t('report_submit'); ?> - </button> - - </form> - - </div> - </div> - <?php -} - -$this->includeAtTemplateBase('includes/footer.php'); +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/error.php'; diff --git a/themes/bbmri/default/errorreport.php b/themes/bbmri/default/errorreport.php index c69d5a76d3df1eabf63c622664418aa9ec09951b..e45fc9388e513b77289fff29fa4b5a6dc5b16e50 100644 --- a/themes/bbmri/default/errorreport.php +++ b/themes/bbmri/default/errorreport.php @@ -1,10 +1,3 @@ <?php -$this->data['header'] = $this->t('errorreport_header'); -$this->includeAtTemplateBase('includes/header.php'); - -?> - - <p><?php echo $this->t('errorreport_text'); ?></p> - -<?php $this->includeAtTemplateBase('includes/footer.php'); +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/errorreport.php'; diff --git a/themes/bbmri/default/post.php b/themes/bbmri/default/post.php index 74b658b70156c79d6e888454ea6ea0b18aaa5cdc..7c314b73b9ac437af245d3ea26ce4abf3b8e89b9 100644 --- a/themes/bbmri/default/post.php +++ b/themes/bbmri/default/post.php @@ -1,75 +1,3 @@ -<!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" xml:lang="en" lang="en"> -<head> - <meta http-equiv="content-type" content="text/html; charset=utf-8"/> - <title>POST data</title> -</head> -<body onload="document.getElementsByTagName('input')[0].click();"> +<?php -<noscript> - <p> - <strong><?php echo $this->t('{bbmri:bbmri:note}'); ?></strong> - <?php echo $this->t('{bbmri:bbmri:browser_not_support_javascript}'); ?> - </p> -</noscript> - -<form method="post" action="<?php echo htmlspecialchars($this->data['destination']); ?>"> - <!-- Need to add this element and call click method, because calling submit() - on the form causes failed submission if the form has another element with name or id of submit. - See: https://developer.mozilla.org/en/DOM/form.submit#Specification --> - <input type="submit" style="display:none;"/> - <?php - if (array_key_exists('post', $this->data)) { - $post = $this->data['post']; - } else { - // For backwards compatibility - assert('array_key_exists("response", $this->data)'); - assert('array_key_exists("RelayStateName", $this->data)'); - assert('array_key_exists("RelayState", $this->data)'); - - $post = array( - 'SAMLResponse' => $this->data['response'], - $this->data['RelayStateName'] => $this->data['RelayState'], - ); - } - - /** - * Write out one or more INPUT elements for the given name-value pair. - * - * If the value is a string, this function will write a single INPUT element. - * If the value is an array, it will write multiple INPUT elements to - * recreate the array. - * - * @param string $name The name of the element. - * @param string|array $value The value of the element. - */ - function printItem($name, $value) - { - assert('is_string($name)'); - assert('is_string($value) || is_array($value)'); - - if (is_string($value)) { - echo '<input type="hidden" name="' . htmlspecialchars($name) . '" value="' . - htmlspecialchars($value) . '" />'; - return; - } - - // This is an array... - foreach ($value as $index => $item) { - printItem($name . '[' . $index . ']', $item); - } - } - - foreach ($post as $name => $value) { - printItem($name, $value); - } - ?> - - <noscript> - <button type="submit" class="btn">Submit</button> - </noscript> -</form> - -</body> -</html> +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/default/post.php'; diff --git a/themes/bbmri/perun/disco-tpl.php b/themes/bbmri/perun/disco-tpl.php index b74930a53eca6a24d2752d2262c639c01227134c..aed11079b88a1c2c0f1fe5787cf56c2ee449a581 100644 --- a/themes/bbmri/perun/disco-tpl.php +++ b/themes/bbmri/perun/disco-tpl.php @@ -1,318 +1,3 @@ <?php -use SimpleSAML\Module; -use SimpleSAML\Configuration; -use SimpleSAML\Logger; -use SimpleSAML\Error\Exception; -use SimpleSAML\Utils\HTTP; -use SimpleSAML\Module\perun\DiscoTemplate; - -/** - * This is simple example of template for perun Discovery service - * - * Allow type hinting in IDE - * @var DiscoTemplate $this - */ - -$this->data['jquery'] = array('core' => true, 'ui' => true, 'css' => true); - -$this->data['head'] = '<link rel="stylesheet" media="screen" type="text/css" href="' . - Module::getModuleUrl('discopower/assets/css/disco.css') . '" />'; - -$this->data['head'] .= '<link rel="stylesheet" media="screen" type="text/css" href="' . - Module::getModuleUrl('bbmri/res/css/disco.css') . '" />'; - -$this->data['head'] .= '<script type="text/javascript" src="' . - Module::getModuleUrl('discopower/assets/js/jquery.livesearch.js') . '"></script>'; - -$this->data['head'] .= '<script type="text/javascript" src="' . - Module::getModuleUrl('discopower/assets/js/suggest.js') . '"></script>'; - -$this->data['head'] .= searchScript(); - -const WARNING_CONFIG_FILE_NAME = 'config-warning.php'; -const WARNING_IS_ON = 'isOn'; -const WARNING_USER_CAN_CONTINUE = 'userCanContinue'; -const WARNING_TITLE = 'title'; -const WARNING_TEXT = 'text'; - -const PERUN_CONFIG_FILE_NAME = 'module_perun.php'; -const ADD_INSTITUTION_URL = 'disco.addInstitution.URL'; -const ADD_INSTITUTION_EMAIL = 'disco.addInstitution.email'; - -const URN_CESNET_PROXYIDP_IDPENTITYID = "urn:cesnet:proxyidp:idpentityid:"; - -$authContextClassRef = null; -$idpEntityId = null; - -$warningIsOn = false; -$warningUserCanContinue = null; -$warningTitle = null; -$warningText = null; -$configWarning = null; - -$configPerun = null; -$addInstitutionUrl = ''; -$addInstitutionEmail = ''; - -try { - $configWarning = Configuration::getConfig(WARNING_CONFIG_FILE_NAME); -} catch (\Exception $ex) { - Logger::warning("bbmri:disco-tpl: missing or invalid config-warning file"); -} - -try { - $configPerun = Configuration::getConfig(PERUN_CONFIG_FILE_NAME); -} catch (\Exception $ex) { - Logger::warning("bbmri:disco-tpl: invalid module_perun.php file"); -} - -if (!is_null($configPerun)) { - try { - $addInstitutionUrl = $configPerun->getString(ADD_INSTITUTION_URL); - } catch (\Exception $ex) { - Logger::warning("bbmri:disco-tpl: missing or invalid addInstitution.URL parameter in module_perun.php file"); - } -} - -if (!is_null($configPerun)) { - try { - $addInstitutionEmail = $configPerun->getString(ADD_INSTITUTION_EMAIL); - } catch (\Exception $ex) { - Logger::warning("bbmri:disco-tpl: missing or invalid addInstitution.email parameter in module_perun.php file"); - } -} - -if ($configWarning != null) { - try { - $warningIsOn = $configWarning->getBoolean(WARNING_IS_ON); - } catch (\Exception $ex) { - Logger::warning("bbmri:disco-tpl: missing or invalid isOn parameter in config-warning file"); - $warningIsOn = false; - } -} - -if ($warningIsOn) { - try { - $warningUserCanContinue = $configWarning->getBoolean(WARNING_USER_CAN_CONTINUE); - } catch (\Exception $ex) { - Logger::warning( - "bbmri:disco-tpl: missing or invalid userCanContinue parameter in config-warning file" - ); - $warningUserCanContinue = true; - } - try { - $warningTitle = $configWarning->getString(WARNING_TITLE); - $warningText = $configWarning->getString(WARNING_TEXT); - if (empty($warningTitle) || empty($warningText)) { - throw new Exception(); - } - } catch (Exception $ex) { - Logger::warning("bbmri:disco-tpl: missing or invalid title or text in config-warning file"); - $warningIsOn = false; - } -} - -if (isset($this->data['AuthnContextClassRef'])) { - $authContextClassRef = $this->data['AuthnContextClassRef']; -} - -# Do not show social IdPs when using addInstitutionApp, show just header Add Institution -if ($this->isAddInstitutionApp()) { - // Translate title in header - $this->data['header'] = $this->t('{bbmri:bbmri:add_institution}'); - $this->includeAtTemplateBase('includes/header.php'); -} else { - if ($warningIsOn && !$warningUserCanContinue) { - $this->data['header'] = $this->t('{bbmri:bbmri:warning}'); - } - - $this->includeAtTemplateBase('includes/header.php'); - - if ($authContextClassRef != null) { - foreach ($authContextClassRef as $value) { - if (substr($value, 0, strlen(URN_CESNET_PROXYIDP_IDPENTITYID)) - === URN_CESNET_PROXYIDP_IDPENTITYID) { - $idpEntityId = substr($value, strlen(URN_CESNET_PROXYIDP_IDPENTITYID), strlen($value)); - Logger::info("Redirecting to " . $idpEntityId); - $url = $this->getContinueUrl($idpEntityId); - HTTP::redirectTrustedURL($url); - exit; - } - } - } - - if ($warningIsOn) { - if ($warningUserCanContinue) { - echo '<div class="alert alert-warning">'; - } else { - echo '<div class="alert alert-danger">'; - } - echo '<h4> <strong>' . $warningTitle . '</strong> </h4>'; - echo $warningText; - echo '</div>'; - } - - if (!$warningIsOn || $warningUserCanContinue) { - if (!empty($this->getPreferredIdp())) { - echo '<p class="descriptionp">' . $this->t('{bbmri:bbmri:previous_selection}') . '</p>'; - echo '<div class="metalist list-group">'; - echo showEntry($this, $this->getPreferredIdp(), true); - echo '</div>'; - - - echo getOr(); - } - - echo '<div class="row">'; - foreach ($this->getIdps('social') as $idpentry) { - echo '<div class="col-md-4">'; - echo '<div class="metalist list-group">'; - echo showEntry($this, $idpentry, false); - echo '</div>'; - echo '</div>'; - } - echo '</div>'; - - echo getOr(); - - echo '<p class="descriptionp">'; - echo $this->t('{bbmri:bbmri:institutional_account}'); - echo '</p>'; - } -} - -if (!$warningIsOn || $warningUserCanContinue) { - echo '<div class="inlinesearch">'; - echo ' <form id="idpselectform" action="?" method="get"> - <input class="inlinesearchf form-control input-lg" placeholder="' . - $this->t('{bbmri:bbmri:type_name_institution}') . '" - type="text" value="" name="query" id="query" autofocus ' . - 'oninput="document.getElementById(\'list\').style.display=\'block\';"/> - </form>'; - echo '</div>'; - - echo '<div class="metalist list-group" id="list">'; - foreach ($this->getIdps() as $idpentry) { - echo showEntry($this, $idpentry, false); - } - echo '</div>'; - - echo '<br>'; - echo '<br>'; - - echo '<div class="no-idp-found alert alert-info">'; - if ($this->isAddInstitutionApp()) { - echo $this->t('{bbmri:bbmri:cannot_find_institution}') . - '<a href="mailto:' . $addInstitutionEmail . '?subject=Request%20for%20adding%20new%20IdP">' . - $addInstitutionEmail . - '</a>'; - echo '<div class="metalist list-group">'; - echo '<a class="btn btn-block social"' . - 'href="https://adm.hostel.eduid.cz/registrace/k1" style="background: #43554a">'; - echo '<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAYAAACM/rhtAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAAN1wAADdcBQiibeAAAAAd0SU1FB9wMCgofM3x4kc8AAAsRSURBVFjDxZh7dFT1tcc/Z56ZDElmwiThYWYmmQSDhIcSwITb2xTEJqwupQt8PzBYbm+9LqvUutYFuV21rV4rCuKqFNEiy66rovbyKAhaMRDejyIEQgQCSTTvTMgkMjM5c87Z9w+SNGmCCfZ2+V3rrJnz2Pt8f/u39/59f0cJ+Pw2IFPTtEIRGSciCtAqItW6rp8ymUwtdru980JtTSeDIODNpKr2AldDwOenqqb66ve9fkXTNathGA6LxeJUFMWtKEoW4EDYr2R6/QW6ru3LLyhg4sSJOEc4icViBFuD1NbWcPbsuUsXqqqqFEX53GK2HLPZbUftdnvF+eqLQYaJgNdvRuFGYKKATwGPYRjOSDhij3ZF7WaTecSIhBGpXaqarmvaSLvNhj0uDoFnLIpCjaZp7dfn5L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EMAS/34+hG4hwm9K9J3Hquu7Sdd0hhlgNMWKKokTtdvtlk8kUqqqpNv6/W0p2hk+JRFS3iOTbbLb74uPjbzSbzaMMEV3t6rqoadpuBX7/f8CzYtolwEc1AAAAAElFTkSuQmCC">'; - echo '<strong>' . $this->t('{bbmri:bbmri:create_account_hostel}') . '</strong>'; - echo '</a>'; - echo '</div>'; - } else { - echo $this->t('{bbmri:bbmri:cannot_find_institution_extended}') . - '<a class="btn btn-primary" href="' . $addInstitutionUrl . '">' . - $this->t('{bbmri:bbmri:add_institution}') . - '</a>'; - } - echo '</div>'; -} - -$this->includeAtTemplateBase('includes/footer.php'); - -function searchScript() -{ - - $script = '<script type="text/javascript"> - - $(document).ready(function() { - $("#query").liveUpdate("#list"); - }); - - </script>'; - - return $script; -} - -/** - * @param DiscoTemplate $t - * @param array $metadata - * @param bool $favourite - * @return string html - */ -function showEntry($t, $metadata, $favourite = false) -{ - - if (isset($metadata['tags']) && in_array('social', $metadata['tags'])) { - return showEntrySocial($t, $metadata); - } - - $extra = ($favourite ? ' favourite' : ''); - $html = '<a class="metaentry' . $extra . ' list-group-item" href="' . - $t->getContinueUrl($metadata['entityid']) . '">'; - - $html .= '<strong>' . $t->getTranslatedEntityName($metadata) . '</strong>'; - - $html .= showIcon($metadata); - - $html .= '</a>'; - - return $html; -} - -/** - * @param DiscoTemplate $t - * @param array $metadata - * @return string html - */ -function showEntrySocial($t, $metadata) -{ - - $bck = 'white'; - if (!empty($metadata['color'])) { - $bck = $metadata['color']; - } - - $html = '<a class="btn btn-block social" href="' . $t->getContinueUrl($metadata['entityid']) . - '" style="background: ' . $bck . '">'; - - $html .= '<img src="' . $metadata['icon'] . '">'; - - $html .= '<strong>Sign in with ' . $t->getTranslatedEntityName($metadata) . '</strong>'; - - $html .= '</a>'; - - return $html; -} - - -function showIcon($metadata) -{ - $html = ''; - // Logos are turned off, because they are loaded via URL from IdP. Some IdPs have bad configuration, - // so it breaks the WAYF. - - /*if (isset($metadata['UIInfo']['Logo'][0]['url'])) { - $html .= '<img src="' . - htmlspecialchars(\SimpleSAML\Utils\HTTP::resolveURL($metadata['UIInfo']['Logo'][0]['url'])) . - '" class="idp-logo">'; - } else if (isset($metadata['icon'])) { - $html .= '<img src="' . htmlspecialchars(\SimpleSAML\Utils\HTTP::resolveURL($metadata['icon'])) . - '" class="idp-logo">'; - }*/ - - return $html; -} - -function getOr() -{ - $or = '<div class="hrline">'; - $or .= ' <span>or</span>'; - $or .= '</div>'; - return $or; -} +include \SimpleSAML\Module::getModuleDir('perun') . '/themes/perun/perun/disco-tpl.php'; diff --git a/www/res/css/consent.css b/www/res/css/consent.css deleted file mode 100644 index e8f76d6624bc272b79b7a95023df041af01ec027..0000000000000000000000000000000000000000 --- a/www/res/css/consent.css +++ /dev/null @@ -1,35 +0,0 @@ -h3#attributeheader { - margin: 0em 0em 0.5em 0em; -} -.btn:hover { - background-image: none; -} -table.attributes { - border: inherit; - margin-bottom: 20px; -} -table.attributes tr td { - border-bottom: inherit; -} -table#table_with_attributes .attrvalue { - padding-left: 2em; - margin: 0.2em 0 0.1em 0; -} -.table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th { - border-top: none; - border-bottom: 1px solid #ddd; -} -.btn-no { - margin-top: 40px; -} -.checkbox input[type=checkbox], .checkbox-inline input[type=checkbox], .radio input[type=radio], .radio-inline input[type=radio] { - position: absolute; - margin-left: -20px; -} -.checkbox-tight label.form-check-label { - font-weight: 500; -} - -#table_with_attributes { - border: none; -} diff --git a/www/res/css/disco.css b/www/res/css/disco.css deleted file mode 100644 index 8100840326583e47385a894422dbf28089464ec2..0000000000000000000000000000000000000000 --- a/www/res/css/disco.css +++ /dev/null @@ -1,127 +0,0 @@ -div.metalist { - margin: 10px 0px; -} - -a.metaentry { - padding: 10px 15px 10px 35px; -} -a.social { - padding: 10px; - text-align: left; - color: white; - border: 1px solid rgba(0,0,0,0.2); -} -a.social:hover, -a.social:focus { - color: white; - background: rgba(0,0,0,0.2); - border: 1px solid rgba(0,0,0,0.3); - box-shadow: 0px 0px 10px 30px rgba(0,0,0,0.1) inset; -} -a.social img { - display: inline-block; - height: 40px; - max-height: 40px; - width: 40px; - max-width: 40px; - padding: 6px; - margin: -12px 10px -10px -10px; - border-right: 1px solid rgba(0,0,0,0.2); -} -a.social:hover img { - border-right: 1px solid rgba(0,0,0,0.3); -} - - -a.metaentry.favourite { - background-image: url(../../../../resources/icons/silk/star.png); - background-position: 10px center; -} - -a.metaentry:hover { - background-position: 10px center; -} - -a.metaentry .idp-logo { - float: right; - height: 20px; - max-width: 120px; -} - -a.metaentryrow .idp-logo { - max-height: 40px; - max-width: 200px; - padding: 3px; -} - -.no-idp-found a.btn { - text-decoration: none; - color: white; - border-bottom: none; -} - -#misc .container-fluid .col-xs-12:last-child img { - max-height: 42px; - margin-top: -1px; -} - -@media screen and (max-width: 950px) { - a.metaentryrow .idp-logo { - margin-bottom: 10px; - } - #misc .container-fluid .col-xs-12:last-child img { - width: 193px; - } -} - -.inlinesearch { - padding: 0px; - margin: 10px 0px 20px 0px; - float: none; -} -form#idpselectform input { - width: 100%; - background-position: 10px center; - padding: 10px 15px 10px 35px; - height: 46px; -} - - -.search-box { - margin-bottom: 16px; -} -.idp-list { - margin-bottom: 16px; -} -.metarowtable { - margin-left: auto; - margin-right: auto; - width: 500px;; - border: 0px; - text-align: center; -} - -.metarowtable td img{ - display: block; - margin-left: auto; - margin-right: auto; -} -.descriptionp { - text-align: center; - margin-bottom: 20px; -} - -.hrline { - width: 100%; - height: 10px; - border-bottom: 1px solid #F0F0F0; - text-align: center; - margin-top: 20px; - margin-bottom: 30px; -} -.hrline span { - background-color: #ffffff; - padding: 0 20px; -} - -