Skip to content
Snippets Groups Projects
Commit 3d274cba authored by Hanne Moa's avatar Hanne Moa
Browse files

Move faventry-discovery to calling page

For #485
parent ed76d125
No related branches found
No related tags found
No related merge requests found
......@@ -246,6 +246,12 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco
$idpList = $this->getIdPList();
$idpList = $this->idplistStructured($this->filterList($idpList));
$preferredIdP = $this->getRecommendedIdP();
$faventry = NULL;
foreach ($idpList AS $tab => $slist) {
if (!empty($preferredIdP) && array_key_exists($preferredIdP, $slist)) {
$faventry = $slist[$preferredIdP]];
}
}
$t = new SimpleSAML_XHTML_Template($this->config, 'discopower:disco.tpl.php', 'disco');
$discoPowerTabs = array(
......@@ -262,6 +268,7 @@ class sspmod_discopower_PowerIdPDisco extends SimpleSAML_XHTML_IdPDisco
'switzerland' => $t->noop('{discopower:tabs:switzerland}'),
'ukacessfederation' => $t->noop('{discopower:tabs:ukacessfederation}'),
);
$t->data['faventry'] = $faventry;
$t->data['tabNames'] = $discoPowerTabs;
$t->data['idplist'] = $idpList;
$t->data['preferredidp'] = $preferredIdP;
......
<?php
$faventry = NULL;
foreach( $this->data['idplist'] AS $tab => $slist) {
if (!empty($this->data['preferredidp']) && array_key_exists($this->data['preferredidp'], $slist))
$faventry = $slist[$this->data['preferredidp']];
}
if(!array_key_exists('header', $this->data)) {
$this->data['header'] = 'selectidp';
}
......@@ -31,7 +19,7 @@ $(document).ready(function() {
$i = 0;
foreach ($this->data['idplist'] AS $tab => $slist) {
$this->data['head'] .= "\n" . '$("#query_' . $tab . '").liveUpdate("#list_' . $tab . '")' .
(($i++ == 0) && (empty($faventry)) ? '.focus()' : '') .
(($i++ == 0) && (empty($this->data['faventry'])) ? '.focus()' : '') .
';';
......@@ -46,7 +34,7 @@ $this->data['head'] .= '
if (!empty($faventry)) $this->data['autofocus'] = 'favouritesubmit';
if (!empty($this->data['faventry'])) $this->data['autofocus'] = 'favouritesubmit';
$this->includeAtTemplateBase('includes/header.php');
......@@ -101,20 +89,20 @@ function getTranslatedName($t, $metadata) {
if (!empty($faventry)) {
if (!empty($this->data['faventry'])) {
echo('<div class="favourite">');
echo($this->t('previous_auth'));
echo(' <strong>' . htmlspecialchars(getTranslatedName($this, $faventry)) . '</strong>');
echo(' <strong>' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '</strong>');
echo('
<form id="idpselectform" method="get" action="' . $this->data['urlpattern'] . '">
<input type="hidden" name="entityID" value="' . htmlspecialchars($this->data['entityID']) . '" />
<input type="hidden" name="return" value="' . htmlspecialchars($this->data['return']) . '" />
<input type="hidden" name="returnIDParam" value="' . htmlspecialchars($this->data['returnIDParam']) . '" />
<input type="hidden" name="idpentityid" value="' . htmlspecialchars($faventry['entityid']) . '" />
<input type="hidden" name="idpentityid" value="' . htmlspecialchars($this->data['faventry']['entityid']) . '" />
<input type="submit" name="formsubmit" id="favouritesubmit" value="' . $this->t('login_at') . ' ' . htmlspecialchars(getTranslatedName($this, $faventry)) . '" />
<input type="submit" name="formsubmit" id="favouritesubmit" value="' . $this->t('login_at') . ' ' . htmlspecialchars(getTranslatedName($this, $this->data['faventry'])) . '" />
</form>');
echo('</div>');
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment