Skip to content
Snippets Groups Projects
Commit 0d5c9ba8 authored by Jaime Perez Crespo's avatar Jaime Perez Crespo
Browse files

Reformat and enhance the consent form page.

parent c65e767e
No related branches found
No related tags found
No related merge requests found
......@@ -12,7 +12,7 @@
* - 'attributes': The attributes which are about to be released.
* - 'sppp': URL to the privacy policy of the destination, or FALSE.
*
* @package simpleSAMLphp
* @package SimpleSAMLphp
*/
assert('is_array($this->data["srcMetadata"])');
assert('is_array($this->data["dstMetadata"])');
......@@ -60,7 +60,6 @@ $this->data['head'] = '<link rel="stylesheet" type="text/css" href="/' .
$this->includeAtTemplateBase('includes/header.php');
?>
<p>
<?php
echo $this->t(
......@@ -70,7 +69,7 @@ echo $this->t(
if (array_key_exists('descr_purpose', $this->data['dstMetadata'])) {
echo '</p><p>' . $this->t(
'{consent:consent:consent_purpose}',
'{consent:consent:consent_purpose}',
array(
'SPNAME' => $dstName,
'SPDESC' => $this->getTranslation(
......@@ -85,7 +84,8 @@ if (array_key_exists('descr_purpose', $this->data['dstMetadata'])) {
?>
</p>
<form style="display: inline; margin: 0px; padding: 0px" action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>">
<form style="display: inline; margin: 0px; padding: 0px"
action="<?php echo htmlspecialchars($this->data['yesTarget']); ?>">
<p style="margin: 1em">
<?php
......@@ -102,10 +102,13 @@ foreach ($this->data['yesData'] as $name => $value) {
}
?>
</p>
<input type="submit" name="yes" id="yesbutton" value="<?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?>" />
<button type="submit" name="yes" class="btn" id="yesbutton">
<?php echo htmlspecialchars($this->t('{consent:consent:yes}')) ?>
</button>
</form>
<form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noTarget']); ?>" method="get">
<form style="display: inline; margin-left: .5em;" action="<?php echo htmlspecialchars($this->data['noTarget']); ?>"
method="get">
<?php
foreach ($this->data['noData'] as $name => $value) {
......@@ -113,7 +116,9 @@ foreach ($this->data['noData'] as $name => $value) {
'" value="' . htmlspecialchars($value) . '" />');
}
?>
<input type="submit" style="display: inline" name="no" id="nobutton" value="<?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?>" />
<button type="submit" class="btn" name="no" id="nobutton">
<?php echo htmlspecialchars($this->t('{consent:consent:no}')) ?>
</button>
</form>
<?php
......@@ -124,7 +129,7 @@ if ($this->data['sppp'] !== false) {
}
/**
* Recursiv attribute array listing function
* Recursive attribute array listing function
*
* @param SimpleSAML_XHTML_Template $t Template object
* @param array $attributes Attributes to be presented
......@@ -153,14 +158,14 @@ function present_attributes($t, $attributes, $nameParent)
$name = $t->getAttributeTranslation($parentStr . $nameraw);
if (preg_match('/^child_/', $nameraw)) {
// Insert child table
// insert child table
$parentName = preg_replace('/^child_/', '', $nameraw);
foreach ($value AS $child) {
foreach ($value as $child) {
$str .= "\n" . '<tr class="odd"><td style="padding: 2em">' .
present_attributes($t, $child, $parentName) . '</td></tr>';
}
} else {
// Insert values directly
// insert values directly
$str .= "\n" . '<tr class="' . $alternate[($i++ % 2)] .
'"><td><span class="attrname">' . htmlspecialchars($name) . '</span>';
......@@ -175,9 +180,9 @@ function present_attributes($t, $attributes, $nameParent)
}
if (sizeof($value) > 1) {
// We hawe several values
// we hawe several values
$str .= '<ul>';
foreach ($value AS $listitem) {
foreach ($value as $listitem) {
if ($nameraw === 'jpegPhoto') {
$str .= '<li><img src="data:image/jpeg;base64,' .
htmlspecialchars($listitem) .
......@@ -188,7 +193,7 @@ function present_attributes($t, $attributes, $nameParent)
}
$str .= '</ul>';
} elseif (isset($value[0])) {
// We hawe only one value
// we hawe only one value
if ($nameraw === 'jpegPhoto') {
$str .= '<img src="data:image/jpeg;base64,' .
htmlspecialchars($value[0]) .
......@@ -196,13 +201,14 @@ function present_attributes($t, $attributes, $nameParent)
} else {
$str .= htmlspecialchars($value[0]);
}
} // end of if multivalue
} // end of if multivalue
$str .= '</div>';
if ($isHidden) {
$str .= '<div class="attrvalue consent_showattribute" id="visible_' . $hiddenId . '">';
$str .= '... ';
$str .= '<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId . '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');">';
$str .= '<a class="consent_showattributelink" href="javascript:SimpleSAML_show(\'hidden_' . $hiddenId;
$str .= '\'); SimpleSAML_hide(\'visible_' . $hiddenId . '\');">';
$str .= $t->t('{consent:consent:show_attribute}');
$str .= '</a>';
$str .= '</div>';
......@@ -222,6 +228,6 @@ echo '<h3 id="attributeheader">' .
) .
'</h3>';
echo(present_attributes($this, $attributes, ''));
echo present_attributes($this, $attributes, '');
$this->includeAtTemplateBase('includes/footer.php');
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