Commit 1d0aef8d authored by Liam's avatar Liam Committed by Robert Lyon

Bug #1758735: Consolidate styles of registration agreements

behatnotneeded

Change-Id: Id2c5dce74097413b137174ac7c08555c59f37572
(cherry picked from commit 8a4d578a)
parent ac1eab11
......@@ -2416,18 +2416,23 @@ function auth_generate_registration_form($formname, $authname='internal', $goto)
'type' => 'markup',
'value' => '<p class="text-midtone">' . get_string('registerprivacy1') . '</p>',
);
foreach ($sitecontent as $content) {
$smarty = smarty_core();
$smarty->assign('privacy', $content);
$smarty->assign('privacytitle', get_string('site' . $content->type, 'admin'));
$htmlbegin = $smarty->fetch('privacy_panel_begin.tpl');
$htmlend = $smarty->fetch('privacy_panel_end.tpl');
// Show nothing if we are NOT forcing registering user to agree to anything
if (!$registerterms && !$strictprivacy) {
continue;
}
$elements[$content->type] = array(
'type' => 'markup',
'value' => '<div id ="siteprivacy">' .
'<h2>' . get_string('site' . $content->type, 'admin') . '</h2>' .
'<div id ="siteprivacytext">' . $content->content . '</div>' .
'</div>',
'value' => $htmlbegin,
);
if ($strictprivacy || $registerterms) {
$elements[$content->type . 'switch'] = array(
'type' => 'switchbox',
......@@ -2440,38 +2445,59 @@ function auth_generate_registration_form($formname, $authname='internal', $goto)
'type' => 'hidden',
'value' => $content->id,
);
$elements[$content->type . 'close'] = array(
'type' => 'markup',
'value' => $htmlend,
);
}
}
// Add institution privacy if an institution has been selected and we are forcing registering user to agree to them
if ($strictprivacy || $registerterms) {
$smarty = smarty_core();
$smarty->assign('institutionprivacy', true);
$smarty->assign('privacytitle', get_string('institutionprivacystatement', 'admin'));
$htmlbegin = $smarty->fetch('privacy_panel_begin.tpl');
$htmlend = $smarty->fetch('privacy_panel_end.tpl');
$elements['instprivacy'] = array(
'type' => 'markup',
'value' => '<div id ="instprivacy" class ="inst js-hidden">' .
'<h2>' . get_string('institutionprivacystatement', 'admin') . '</h2>' .
'<div id ="instprivacytext" class="insttext"></div>' .
'</div>',
'value' => $htmlbegin,
);
$elements['instprivacyid'] = array(
'type' => 'text',
'class' => 'js-hidden',
);
$elements['instprivacyswitch'] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin', get_string('privacylowcase', 'admin')),
'description' => get_string('registerprivacy1'),
'class' => 'instprivacyswitch js-hidden',
);
$elements['instprivacyid'] = array(
'type' => 'text',
'class' => 'js-hidden',
$elements['instprivacyclose'] = array(
'type' => 'markup',
'value' => $htmlend,
);
}
// Add institution terms if an institution has been selected.
$smarty = smarty_core();
$smarty->assign('institutionterms', true);
$smarty->assign('privacytitle', get_string('institutiontermsandconditions', 'admin'));
$htmlbegin = $smarty->fetch('privacy_panel_begin.tpl');
$htmlend = $smarty->fetch('privacy_panel_end.tpl');
$elements['insttermsandconditions'] = array(
'type' => 'markup',
'value' => '<div id ="insttermsandconditions" class ="inst js-hidden">' .
'<h2>' . get_string('institutiontermsandconditions', 'admin') . '</h2>' .
'<div id ="insttermsandconditionstext" class="insttext"></div>' .
'</div>',
'value' => $htmlbegin,
);
$elements['insttermsandconditionsid'] = array(
'type' => 'text',
'class' => 'js-hidden',
);
if ($strictprivacy || $registerterms) {
$elements['insttermsandconditionsswitch'] = array(
'type' => 'switchbox',
......@@ -2480,9 +2506,10 @@ function auth_generate_registration_form($formname, $authname='internal', $goto)
'class' => 'insttermsandconditionsswitch js-hidden',
);
}
$elements['insttermsandconditionsid'] = array(
'type' => 'text',
'class' => 'js-hidden',
$elements['insttermsandconditionsclose'] = array(
'type' => 'markup',
'value' => $htmlend,
);
if (call_static_method('Auth'.ucfirst($authname), 'can_use_registration_captcha')) {
......
{if $institutionprivacy}
<div id="instprivacy" class="inst js-hidden panel panel-default">
{elseif $institutionterms}
<div id ="insttermsandconditions" class ="inst js-hidden panel panel-default">
{else}
<div class="panel panel-default">
{/if}
<div class="last form-group collapsible-group">
<fieldset class="pieform-fieldset last collapsible">
<legend>
<h4>
<a href="#dropdown{$privacy->id}" data-toggle="collapse" aria-expanded="false" aria-controls="dropdown" class="collapsed">
<a
{if $institutionprivacy}
href="#dropdowninstprivacy"
{elseif $institutionterms}
href="#dropdowninstterms"
{else}
href="#dropdown{$privacy->id}"
{/if}
data-toggle="collapse" aria-expanded="false" aria-controls="dropdown" class="collapsed">
{$privacytitle}
<span class="icon icon-chevron-down collapse-indicator right pull-right"></span>
</a>
</h4>
</legend>
<div class="fieldset-body collapse {if (!($privacy->agreed && $ignoreagreevalue) || $ignoreformswitch)}in{/if}" id="dropdown{$privacy->id}">
<span class="text-midtone pull-right">{str tag='lastupdated' section='admin'} {$privacytime} </span>
<div class="last-updated-offset">
{$privacy->content|safe}
</div>
<div class="fieldset-body collapse {if (!($privacy->agreed && $ignoreagreevalue) || $ignoreformswitch)}in{/if}"
{if $institutionprivacy}
id="dropdowninstprivacy">
{elseif $institutionterms}
id="dropdowninstterms">
{else}
id="dropdown{$privacy->id}">
{/if}
{if $privacytime}
<span class="text-midtone pull-right">{str tag='lastupdated' section='admin'} {$privacytime} </span>
{/if}
{if $institutionprivacy}
<div id ="instprivacytext" class="insttext"></div>
{elseif $institutionterms}
<div id ="insttermsandconditionstext" class="insttext"></div>
{else}
<div class="last-updated-offset">
{$privacy->content|safe}
</div>
{/if}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment