Skip to content
Snippets Groups Projects
Commit 92659486 authored by Olav Morken's avatar Olav Morken
Browse files

Added customizable focus for the consent request form.

git-svn-id: https://simplesamlphp.googlecode.com/svn/trunk@713 44740490-163a-0410-bde0-09ae8108e29a
parent e0a51608
No related branches found
No related tags found
No related merge requests found
......@@ -222,6 +222,16 @@ $config = array (
'consent_pdo_user' => 'simplesamluser',
'consent_pdo_passwd' => 'xxxx',
/*
* This option controls the initial focus in the consent form.
* It has three possible values:
* - NULL No initial focus.
* - 'yes' The "yes"-button has focus.
* - 'no' The "no"-button has focus.
*/
'consent_autofocus' => NULL,
/*
* This option configures the metadata sources. The metadata sources is given as an array with
* different metadata sources. When searching for metadata, simpleSAMPphp will search through
......
<?php
$this->data['autofocus'] = 'yesbutton';
$this->includeAtTemplateBase('includes/header.php');
$this->includeLanguageFile('consent.php');
......@@ -28,7 +27,7 @@
<?php } ?>
</form>
<form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noconsent']); ?>" method="GET">
<input type="submit" value="<?php echo htmlspecialchars($this->t('no')) ?>" />
<input type="submit" id="nobutton" value="<?php echo htmlspecialchars($this->t('no')) ?>" />
</form>
<p>
......
......@@ -297,6 +297,20 @@ if($needAuth && !$isPassive) {
}
$t->data['sppp'] = $privacypolicy;
switch($config->getString('consent_autofocus', NULL)) {
case NULL:
break;
case 'yes':
$t->data['autofocus'] = 'yesbutton';
break;
case 'no':
$t->data['autofocus'] = 'nobutton';
break;
default:
throw new Exception('Invalid value for the consent_autofocus option.' .
' Should be one of NULL, \'yes\' or \'no\'.');
}
$t->show();
exit;
}
......
......@@ -208,6 +208,20 @@ if (!$session->isAuthenticated($authority) ) {
}
$t->data['sppp'] = $privacypolicy;
switch($config->getString('consent_autofocus', NULL)) {
case NULL:
break;
case 'yes':
$t->data['autofocus'] = 'yesbutton';
break;
case 'no':
$t->data['autofocus'] = 'nobutton';
break;
default:
throw new Exception('Invalid value for the consent_autofocus option.' .
' Should be one of NULL, \'yes\' or \'no\'.');
}
$t->show();
exit;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment