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 ( ...@@ -222,6 +222,16 @@ $config = array (
'consent_pdo_user' => 'simplesamluser', 'consent_pdo_user' => 'simplesamluser',
'consent_pdo_passwd' => 'xxxx', '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 * 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 * different metadata sources. When searching for metadata, simpleSAMPphp will search through
......
<?php <?php
$this->data['autofocus'] = 'yesbutton';
$this->includeAtTemplateBase('includes/header.php'); $this->includeAtTemplateBase('includes/header.php');
$this->includeLanguageFile('consent.php'); $this->includeLanguageFile('consent.php');
...@@ -28,7 +27,7 @@ ...@@ -28,7 +27,7 @@
<?php } ?> <?php } ?>
</form> </form>
<form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noconsent']); ?>" method="GET"> <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> </form>
<p> <p>
......
...@@ -297,6 +297,20 @@ if($needAuth && !$isPassive) { ...@@ -297,6 +297,20 @@ if($needAuth && !$isPassive) {
} }
$t->data['sppp'] = $privacypolicy; $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(); $t->show();
exit; exit;
} }
......
...@@ -208,6 +208,20 @@ if (!$session->isAuthenticated($authority) ) { ...@@ -208,6 +208,20 @@ if (!$session->isAuthenticated($authority) ) {
} }
$t->data['sppp'] = $privacypolicy; $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(); $t->show();
exit; exit;
} }
......
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