Commit ae2c23cc authored by Robert Lyon's avatar Robert Lyon Committed by Gerrit Code Review
Browse files

Merge changes from topic 'GDPR'

* changes:
  Bug 1746259: Add the T&C to the register form
  Bug 1746259: Withdraw consent to the T&C
  Bug 1746259: Show the T&C on the after login page
  Bug 1746259: Display and edit the T&C of an institution
  Bug 1746259: Make the data on the site's 'Legal' page editable
parents f3170517 8c507c8b
......@@ -16,7 +16,7 @@ define('SECTION_PLUGINNAME', 'account');
define('SECTION_PAGE', 'userprivacy');
require(dirname(dirname(__FILE__)) . '/init.php');
require_once(get_config('docroot') . 'lib/user.php');
define('TITLE', get_string('privacy', 'admin'));
define('TITLE', get_string('legal', 'admin'));
if (!is_logged_in()) {
throw new AccessDeniedException();
......@@ -24,8 +24,7 @@ if (!is_logged_in()) {
$form = privacy_form();
// JQuery logic for panel hide/show.
// Needed here because there are multiple dropdown panels on this page.
// JQuery logic for panel hide/show submit button.
$js = <<< EOF
$( document ).ready(function() {
$(".state-label").click(function() {
......@@ -33,19 +32,9 @@ $js = <<< EOF
showSubmitButton();
});
});
function showSubmitButton() {
if ($('body').find(".redraw-consent").length == 0) {
$('#agreetoprivacy_submit_container').addClass('js-hidden');
$('#agreetoprivacy_submit').addClass('js-hidden');
}
else {
$('#agreetoprivacy_submit_container').removeClass('js-hidden');
$('#agreetoprivacy_submit').removeClass('js-hidden');
}
}
EOF;
$smarty = smarty();
$smarty = smarty(array('privacy'));
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('form', $form);
......
......@@ -19,26 +19,24 @@ require(dirname(dirname(dirname(__FILE__))) . '/init.php');
define('TITLE', get_string('legal', 'admin'));
$versionid = param_integer('id', null);
$fs = param_alpha('fs', 'privacy');
if (!is_logged_in()) {
throw new AccessDeniedException();
}
// Get the site privacy statement and T&C.
$data = get_institution_versioned_content('mahara');
$data = get_records_sql_assoc("
SELECT s.id, s.version, u.firstname, u.lastname, u.id AS userid, s.content, s.ctime, s.type
FROM {site_content_version} s
LEFT JOIN {usr} u ON s.author = u.id
WHERE s.institution = ?
ORDER BY s.id DESC", array('mahara'));
if ($data) {
// Add the displayname of user
foreach ($data as $k => $v) {
$v->displayname = display_name($v->userid, null, true);
// Add to an array the latest versions of both T&C and privacy statement.
$latestVersions = array();
foreach ($data as $key => $content) {
if ($content->current != null) {
array_push($latestVersions, $key);
}
$content->displayname = display_name($content->userid, null, true);
}
$selectedtab = 'privacy';
$selectedtab = $fs;
if ($versionid) {
if ($pageoptions = get_record('site_content_version', 'id', $versionid, 'institution', 'mahara')) {
$selectedtab = $pageoptions->type;
......@@ -50,7 +48,7 @@ if ($versionid) {
'version' => array(
'type' => 'text',
'title' => get_string('version', 'admin'),
'description' => get_string('lastversion', 'admin', $pageoptions->version),
'description' => get_string($data[$versionid]->type . 'lastversion', 'admin', $pageoptions->version),
'defaultvalue' => '',
'rules' => array(
'required' => true,
......@@ -58,6 +56,7 @@ if ($versionid) {
)
),
'pageinstitution' => array('type' => 'hidden', 'value' => 'mahara'),
'activetab' => array('type' => 'hidden', 'value' => $selectedtab),
'pagetext' => array(
'name' => 'pagetext',
'type' => 'wysiwyg',
......@@ -74,7 +73,7 @@ if ($versionid) {
'class' => 'btn-primary',
'type' => 'submitcancel',
'value' => array(get_string('savechanges', 'admin'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'admin/site/privacy.php',
'goto' => get_config('wwwroot') . 'admin/site/privacy.php?fs=' . $selectedtab,
),
)
));
......@@ -85,36 +84,46 @@ if ($versionid) {
}
function editsitepage_validate(Pieform $form, $values) {
// Check if the version entered by the user already exists.
if (record_exists('site_content_version', 'institution', $values['pageinstitution'], 'version', $values['version'])) {
$form->set_error('version', get_string('versionalreadyexist', 'admin', $values['version']));
// Check if the version entered by the user already exists for a specific content type.
if (record_exists('site_content_version', 'institution', $values['pageinstitution'], 'version', $values['version'], 'type', $values['activetab'])) {
$form->set_error('version', get_string('versionalreadyexist', 'admin', get_string($values['activetab'] . 'lowcase', 'admin'), $values['version']));
}
}
function editsitepage_submit(Pieform $form, $values) {
global $USER, $SESSION;
$id = get_field('site_content_version', 'id', 'version', $values['version']);
require_once('embeddedimage.php');
// Update the pagetext with any embedded image info
$pagetext = EmbeddedImage::prepare_embedded_images($values['pagetext'], 'staticpages', $id);
$data = new StdClass;
$data->content = $pagetext;
$data->content = $values['pagetext'];
$data->author = $USER->get('id');
$data->institution = $values['pageinstitution'];
$data->ctime = db_format_timestamp(time());
$data->version = $values['version'];
$data->type = 'privacy';
$data->type = $values['activetab'];
try {
insert_record('site_content_version', $data);
$id = insert_record('site_content_version', $data, 'id', true);
if ($id) {
require_once('embeddedimage.php');
$pagetext = EmbeddedImage::prepare_embedded_images($values['pagetext'], 'staticpages', $id);
// If there is an embedded image, update the src so users can have visibility
if ($values['pagetext'] != $pagetext) {
// Update the pagetext with any embedded image info
$updated = new stdClass();
$updated->id = $id;
$updated->content = $pagetext;
update_record('site_content_version', $updated, 'id');
}
// Auto accept the PS/T&C to avoid situation in which
// the admin is asked to agree to the PS/T&C he has just created.
save_user_reply_to_agreement($USER->get('id'), $id, 1);
}
$SESSION->add_ok_msg(get_string('pagesaved', 'admin'));
}
catch (SQLException $e) {
$SESSION->add_ok_msg(get_string('savefailed', 'admin'));
}
redirect(get_config('wwwroot').'admin/site/privacy.php');
redirect(get_config('wwwroot').'admin/site/privacy.php?fs=' . $values['activetab']);
}
// JQuery logic for tab hide/show and to keep the same tab active on page refresh.
......@@ -136,8 +145,7 @@ else {
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('results', $data);
$smarty->assign('latestversion', null);
$smarty->assign('latestVersions', $latestVersions);
$smarty->assign('versionid', $versionid);
$smarty->assign('latestprivacyid', null);
$smarty->assign('link', "admin/site/privacy.php?id=");
$smarty->display('admin/site/privacy.tpl');
......@@ -19,8 +19,8 @@ define('MENUITEM', 'manageinstitutions/privacy');
require_once('institution.php');
define('TITLE', get_string('legal', 'admin'));
define('SUBSECTIONHEADING', get_string('privacy', 'admin'));
$versionid = param_integer('id', null);
$fs = param_alpha('fs', 'privacy');
if (!is_logged_in()) {
throw new AccessDeniedException();
......@@ -51,19 +51,38 @@ $institutionselector = pieform(array(
$wwwroot = get_config('wwwroot');
// The "Add one" link displayed when an institution has no privay statement of its own.
$href = $wwwroot . 'admin/users/institutionprivacy.php?institution=' . $institution . '&id=0';
$privacies = get_records_sql_assoc("
SELECT s.id, s.version, u.firstname, u.lastname, u.id AS userid, s.content, s.ctime
FROM {site_content_version} s
LEFT JOIN {usr} u ON s.author = u.id
WHERE s.type = 'privacy' AND s.institution = ?
ORDER BY s.id DESC", array($institution));
$href = $wwwroot . 'admin/users/institutionprivacy.php?institution=' . $institution . '&id=0&fs=' . $fs;
// Get the institution's privacy statements and T&Cs.
$privacies = get_institution_versioned_content($institution);
// Add to an array the latest versions of both T&C and privacy statement.
$latestVersions = array(); $types = array();
if ($privacies) {
foreach ($privacies as $key => $content) {
if ($content->current != null) {
array_push($latestVersions, $key);
}
if (!in_array($content->type, $types)) {
// Useful in case an institution has just one type of content.
// Will use the $types to know on which tab to display the versions table.
array_push($types, $content->type);
}
$content->displayname = display_name($content->userid, null, true);
}
}
// Add 0 to $latestVersions, to allow the creation of a first privacy/T&C
if (count($types) <= 1) {
array_push($latestVersions, 0);
}
// Site privacy and T&C to display in an expandable panel.
$sitecontent = get_latest_privacy_versions(array('mahara'));
$selectedtab = $fs;
$form = false;
if ($versionid !== null) {
$pageoptions = get_record('site_content_version', 'id', $versionid, 'institution', $institution);
if ($versionid === 0 || $pageoptions) {
$selectedtab = ($versionid === 0) ? $selectedtab : $pageoptions->type;
$form = pieform(array(
'name' => 'editsitepage',
'jsform' => false,
......@@ -72,7 +91,7 @@ if ($versionid !== null) {
'version' => array(
'type' => 'text',
'title' => get_string('version', 'admin'),
'description' => $pageoptions ? get_string('lastversion', 'admin', $pageoptions->version) : '',
'description' => $pageoptions ? get_string($privacies[$versionid]->type . 'lastversion', 'admin', $pageoptions->version) : '',
'defaultvalue' => '',
'rules' => array(
'required' => true,
......@@ -80,6 +99,7 @@ if ($versionid !== null) {
)
),
'pageinstitution' => array('type' => 'hidden', 'value' => $institution),
'activetab' => array('type' => 'hidden', 'value' => $selectedtab),
'pagetext' => array(
'name' => 'pagetext',
'type' => 'wysiwyg',
......@@ -96,7 +116,7 @@ if ($versionid !== null) {
'class' => 'btn-primary',
'type' => 'submitcancel',
'value' => array(get_string('savechanges', 'admin'), get_string('cancel')),
'goto' => get_config('wwwroot') . 'admin/users/institutionprivacy.php?institution=' . $institution,
'goto' => get_config('wwwroot') . 'admin/users/institutionprivacy.php?institution=' . $institution . '&fs=' . $selectedtab,
),
)
));
......@@ -107,69 +127,67 @@ if ($versionid !== null) {
}
function editsitepage_validate(Pieform $form, $values) {
// Check if the version entered by the user already exists
if (record_exists('site_content_version', 'institution', $values['pageinstitution'], 'version', $values['version'])) {
$form->set_error('version', get_string('versionalreadyexist', 'admin', $values['version']));
// Check if the version entered by the user already exists for a specific content type.
if (record_exists('site_content_version', 'institution', $values['pageinstitution'], 'version', $values['version'], 'type', $values['activetab'])) {
$form->set_error('version', get_string('versionalreadyexist', 'admin', get_string($values['activetab'] . 'lowcase', 'admin'), $values['version']));
}
}
function editsitepage_submit(Pieform $form, $values) {
global $USER, $SESSION;
$id = get_field('site_content_version', 'id', 'version', $values['version']);
require_once('embeddedimage.php');
// Update the pagetext with any embedded image info
$pagetext = EmbeddedImage::prepare_embedded_images($values['pagetext'], 'staticpages', $id);
$data = new StdClass;
$data->content = $pagetext;
$data->content = $values['pagetext'];
$data->author = $USER->get('id');
$data->institution = $values['pageinstitution'];
$data->ctime = db_format_timestamp(time());
$data->version = $values['version'];
$data->type = 'privacy';
$data->type = $values['activetab'];
try {
insert_record('site_content_version', $data);
$id = insert_record('site_content_version', $data, 'id', true);
if ($id) {
require_once('embeddedimage.php');
$pagetext = EmbeddedImage::prepare_embedded_images($values['pagetext'], 'staticpages', $id);
// If there is an embedded image, update the src so users can have visibility
if ($values['pagetext'] != $pagetext) {
// Update the pagetext with any embedded image info
$updated = new stdClass();
$updated->id = $id;
$updated->content = $pagetext;
update_record('site_content_version', $updated, 'id');
}
// Auto accept the PS/T&C to avoid situation in which
// the admin is asked to agree to the PS/T&C he has just created.
save_user_reply_to_agreement($USER->get('id'), $id, 1);
}
$SESSION->add_ok_msg(get_string('pagesaved', 'admin'));
}
catch (SQLException $e) {
$SESSION->add_ok_msg(get_string('savefailed', 'admin'));
}
redirect(get_config('wwwroot').'admin/users/institutionprivacy.php?institution=' . $values['pageinstitution']);
redirect(get_config('wwwroot').'admin/users/institutionprivacy.php?institution=' . $values['pageinstitution'] . '&fs=' . $values['activetab']);
}
// Site privacy to display in an expandable panel
$siteprivacycontent = get_record_sql("
SELECT s.content, s.ctime
FROM {site_content_version} s
WHERE s.type = 'privacy' AND s.institution = ?
ORDER BY s.id DESC
LIMIT 1", array('mahara'));
$js = <<< EOF
jQuery(function($) {
function reloadUsers() {
window.location.href = '{$wwwroot}admin/users/institutionprivacy.php?institution=' + $('#usertypeselect_institution').val();
}
$(document).ready(function() {
checkActiveTab('$selectedtab');
$('#usertypeselect_institution').on('change', reloadUsers);
});
EOF;
$smarty = smarty();
$smarty = smarty(array('privacy'));
setpageicon($smarty, 'icon-umbrella');
$smarty->assign('INLINEJAVASCRIPT', $js);
$smarty->assign('href', $href);
$smarty->assign('siteprivacycontent', $siteprivacycontent);
$smarty->assign('lastupdated', get_string('lastupdatedon', 'blocktype.externalfeed', format_date(strtotime($siteprivacycontent->ctime))));
$smarty->assign('sitecontent', $sitecontent);
$smarty->assign('versionid', $versionid);
$smarty->assign('privacies', $privacies);
$smarty->assign('results', $privacies);
$smarty->assign('pageeditform', $form);
$smarty->assign('institution', $institution);
$smarty->assign('latestversion', $privacies ? reset($privacies)->version : 0);
$smarty->assign('latestprivacyid', $privacies ? reset($privacies)->id : 0);
$smarty->assign('version', $versionid && $pageoptions ? $pageoptions->version : '');
$smarty->assign('latestVersions', $latestVersions);
$smarty->assign('institutionselector', $institutionselector);
$smarty->assign('types', implode(' ', $types));
$smarty->assign('link', "admin/users/institutionprivacy.php?institution={$institution}&id=");
$smarty->display('admin/users/institutionprivacy.tpl');
......@@ -765,39 +765,53 @@ function privacy_form($ignoreagreevalue = false) {
}
foreach ($latestversions as $privacy) {
$privacytitle = $privacy->institution == 'mahara' ? get_string('siteprivacystatement', 'admin') : get_string('institutionprivacystatement', 'admin');
if ($privacy->type == 'privacy') {
$title = get_string('institutionprivacystatement', 'admin');
if ($privacy->institution == 'mahara') {
$title = get_string('siteprivacy', 'admin');
}
}
else {
$title = get_string('institutiontermsandconditions', 'admin');
if ($privacy->institution == 'mahara') {
$title = get_string('sitetermsandconditions', 'admin');
}
}
$smarty = smarty_core();
$smarty->assign('privacy', $privacy);
$smarty->assign('privacytitle', $privacytitle);
$smarty->assign('privacytitle', $title);
$smarty->assign('privacytime', format_date(strtotime($privacy->ctime)));
$smarty->assign('ignoreagreevalue', $ignoreagreevalue);
$htmlbegin = $smarty->fetch('privacy_panel_begin.tpl');
//Build form elements.
$elements[$privacy->institution . 'text'] = array(
$elements[$privacy->institution . $privacy->type . 'text'] = array(
'type' => 'markup',
'value' => $htmlbegin,
);
$elements[$privacy->institution . 'id'] = array(
$elements[$privacy->institution . $privacy->type . 'id'] = array(
'type' => 'hidden',
'value' => $privacy->id,
);
$elements[$privacy->institution] = array(
$elements[$privacy->institution . $privacy->type] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin'),
'description' => $privacy->agreed ? get_string('privacyagreedto', 'admin', format_date(strtotime($privacy->agreedtime))) : '',
'title' => get_string('privacyagreement', 'admin', get_string($privacy->type . 'lowcase', 'admin')),
'description' => $privacy->agreed ? get_string('privacyagreedto', 'admin',
get_string($privacy->type . 'lowcase', 'admin'), format_date(strtotime($privacy->agreedtime))) : '',
'defaultvalue' => $privacy->agreed ? true : false,
'disabled' => ($privacy->agreed && $ignoreagreevalue) ? true : false,
'required' => true,
);
$elements[$privacy->institution . 'switch'] = array(
$elements[$privacy->institution . $privacy->type . 'switch'] = array(
'type' => 'hidden',
'value' => ($privacy->agreed && $ignoreagreevalue) ? 'disabled' : 'enabled',
);
$smarty = smarty_core();
$smarty->assign('ignoreagreevalue', $ignoreagreevalue);
$htmlend = $smarty->fetch('privacy_panel_end.tpl');
$elements[$privacy->institution . 'text2'] = array(
$elements[$privacy->institution . $privacy->type . 'text2'] = array(
'type' => 'markup',
'value' => $htmlend,
);
......@@ -838,7 +852,7 @@ function auth_check_required_fields() {
// Build the agree with privacy statement form.
$form = privacy_form(true);
define('TITLE', get_string('privacy', 'admin'));
define('TITLE', get_string('legal', 'admin'));
$smarty = smarty();
setpageicon($smarty, 'icon-umbrella');
if ($USER->get('parentuser')) {
......@@ -1240,13 +1254,20 @@ function requiredfields_submit(Pieform $form, $values) {
function agreetoprivacy_submit(Pieform $form, $values) {
global $USER, $SESSION;
$userinstitutions = array_keys($USER->get('institutions'));
array_push($userinstitutions, 'mahara');
$institutions = array('maharaprivacy', 'maharatermsandconditions');
$userinstitution = array_keys($USER->get('institutions'));
if (!empty($userinstitution)) {
array_push($userinstitution, $userinstitution[0] . 'termsandconditions', $userinstitution[0] . 'privacy');
array_shift($userinstitution);
$institutions = array_merge($institutions, $userinstitution);
}
$hasrefused = param_integer('hasrefused', 0);
$reason = param_variable('reason', '');
$whathasbeenrefused = array();
foreach ($userinstitutions as $institution) {
foreach ($institutions as $institution) {
// check if the institution has a privacy statement
// if not, it depends on the site one and we can skip it
// if yes, check if the user has already accepted it (switch is disabled)
......@@ -1256,23 +1277,26 @@ function agreetoprivacy_submit(Pieform $form, $values) {
try {
$agreed = (empty($values[$institution]) ? 0 : $values[$institution]);
save_user_reply_to_agreement($USER->get('id'), $values[$institution . 'id'], $agreed);
$SESSION->add_ok_msg(get_string('agreementsaved', 'admin'));
if ($hasrefused) {
// Send a message to the institution/site admin informing that the user has refused the privacy statement.
$institution = new Institution($institution);
$institution->send_admin_institution_refused_privacy_message($USER->get('id'), $reason);
suspend_user($USER->get('id'), 'privacyrefusal');
$SESSION->add_ok_msg(get_string('usersuspended', 'admin'));
$USER->logout();
redirect();
if (!$agreed) {
array_push($whathasbeenrefused, strpos($institution , 'privacy') ? 'privacylowcase' : 'termsandconditionslowcase');
}
$SESSION->add_ok_msg(get_string('agreementsaved', 'admin'));
}
catch (SQLException $e) {
$SESSION->add_ok_msg(get_string('savefailed', 'admin'));
}
}
// Moved this here to allow all refused items to be saved in the DB.
if ($hasrefused) {
// Send a message to the institution/site admin informing that the user has refused the privacy statement.
$institution = new Institution(str_replace(array('privacy', 'termsandconditions'), array('', ''), $institution));
$institution->send_admin_institution_refused_privacy_message($USER->get('id'), $reason, $whathasbeenrefused);
suspend_user($USER->get('id'), $whathasbeenrefused);
$SESSION->add_ok_msg(get_string('usersuspended', 'admin'));
$USER->logout();
redirect();
}
$USER->renew();
redirect();
}
......@@ -2374,48 +2398,67 @@ function auth_generate_registration_form($formname, $authname='internal', $goto)
);
}
// Add site privacy statement and T&C to the register form.
$siteprivacy = get_latest_privacy_versions(array('mahara'));
$elements['privacy'] = array(
'type' => 'markup',
'value' => '<div id ="siteprivacy">' .
'<h2>' . get_string('siteprivacystatement', 'admin') . '</h2>' .
'<p class="text-midtone">' . get_string('registerprivacy1') . '</p>' .
'<div id ="siteprivacytext">' . $siteprivacy[0]->content . '</div>' .
'</div>',
);
$elements['privacyswitch'] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin'),
'description' => get_string('registerprivacydetails', 'admin'),
'required' => true,
);
$elements['privacyid'] = array(
'type' => 'hidden',
'value' => $siteprivacy[0]->id,
);
$sitecontent = get_latest_privacy_versions(array('mahara'));
if ($sitecontent) {
$elements['privacytext'] = array(
'type' => 'markup',
'value' => '<p class="text-midtone">' . get_string('registerprivacy1') . '</p>',
);
foreach ($sitecontent as $content) {
$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>',
);
$elements[$content->type . 'switch'] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin', get_string($content->type . 'lowcase', 'admin')),
'description' => get_string('register' . $content->type, 'admin'),
'required' => true,
);
$elements[$content->type . 'id'] = array(
'type' => 'hidden',
'value' => $content->id,
);
}
}
// Add institution privacy if an institution has been selected.
$elements['instprivacy'] = array(
'type' => 'markup',
'value' => '<div id ="instprivacy" class ="js-hidden">' .
'value' => '<div id ="instprivacy" class ="inst js-hidden">' .
'<h2>' . get_string('institutionprivacystatement', 'admin') . '</h2>' .
'<p class="text-midtone">' . get_string('registerprivacy1') . '</p>' .
'<div id ="instprivacytext"></div>' .
'<div id ="instprivacytext" class="insttext"></div>' .
'</div>',
);
$elements['instprivacyswitch'] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin'),
'description' => get_string('registerprivacydetails', 'admin'),
'class' => 'instprivacyswitch js-hidden',
'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',
);
// Add the terms and conditions.
$elements['terms'] = array(
// Add institution terms if an institution has been selected.
$elements['insttermsandconditions'] = array(
'type' => 'markup',
'value' => "<h2>Terms and condititions</h2>" . get_site_page_content('termsandconditions'),
'value' => '<div id ="insttermsandconditions" class ="inst js-hidden">' .
'<h2>' . get_string('institutiontermsandconditions', 'admin') . '</h2>' .
'<div id ="insttermsandconditionstext" class="insttext"></div>' .
'</div>',
);
$elements['insttermsandconditionsswitch'] = array(
'type' => 'switchbox',
'title' => get_string('privacyagreement', 'admin', get_string('termsandconditionslowcase', 'admin')),
'description' => get_string('registertermsandconditions', 'admin'),
'class' => 'insttermsandconditionsswitch js-hidden',
);
$elements['insttermsandconditionsid'] = array(
'type' => 'text',
'class' => 'js-hidden',
);
$registerterms = get_config('registerterms');
......@@ -2507,8 +2550,10 @@ function auth_generate_registration_form_js($aform, $registerconfirm) {
jQuery(function($) {
function show_privacy(institutionid, value) {
$("#register_instprivacyid").attr("value", "");
$("#instprivacy").addClass("js-hidden");
$("#instprivacytext").html("");
$("#register_insttermsandconditionsid").attr("value", "");
$(".inst").addClass("js-hidden");
$(".insttext").html("");
$(".insttermsandconditionsswitch").addClass("js-hidden");
$(".instprivacyswitch").addClass("js-hidden");
if (value !== "0" && value !== "mahara") {