Skip to content

Commit

Permalink
Drupal: Added code to print description below consent question about …
Browse files Browse the repository at this point in the history
…statistics aggregation.

Description text and link is controled by two admin-menu variables in Preferences: General.

https://dev.gridrepublic.org/browse/DBOINCP-521
  • Loading branch information
Shawn Kwang committed Feb 7, 2020
1 parent b7a0168 commit 01f642b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
15 changes: 15 additions & 0 deletions drupal/sites/default/boinc/modules/boincwork/boincwork.admin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,19 @@ function boincwork_admin_prefs_options_form(&$form_state) {
'#default_value' => variable_get('boinc_prefs_options_beta', 0),
'#required' => TRUE
);
$form['enable_privacy_link'] = array(
'#type' => 'checkbox',
'#title' => t('Enable the privacy link for privacy preferences.'),
'#description' => t('This option deals with the specific consent question \'Do you consent to exporting your data to BOINC statisitcs aggregation Web sites?\' If this question is enabled in the BOINC admin-interface, it will appear in the Privacy Preferences forms. Enable this checkbox to add an additional sentence below this question, with a link to the privacy policy page. Specify the path to the privacy page in Page to privacy page below.'),
'#default_value' => variable_get('boinc_privacypref_enable_link'),
'#required' => TRUE
);
$form['privacylink_path'] = array(
'#type' => 'textfield',
'#title' => t('Path to privacy page'),
'#description' => t('A Drupal path to the privacy page for this Web site, e.g. /privacy'),
'#default_value' => variable_get('boinc_privacypref_privacylink_path', '')
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => t('Submit')
Expand All @@ -37,6 +50,8 @@ function boincwork_admin_prefs_options_form_validate($form, &$form_state) {
*/
function boincwork_admin_prefs_options_form_submit($form, &$form_state) {
variable_set('boinc_prefs_options_beta', $form_state['values']['beta']);
variable_set('boinc_privacypref_enable_link', $form_state['values']['enable_privacy_link']);
variable_set('boinc_privacypref_privacylink_path', $form_state['values']['privacylink_path']);
drupal_set_message('Preference options have been updated.');
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1753,10 +1753,12 @@ function boincwork_privacyprefs_form(&$form_state) {
$default = array(
'privacy' => array(
'send_email' => ($boincuser->send_email) ? 1 : 0,
'show_hosts' => ($boincuser->show_hosts) ? 1 : 0
'show_hosts' => ($boincuser->show_hosts) ? 1 : 0,
'enableprivacylink' => variable_get('boinc_privacypref_enable_link', 0),
'privacylinkpath' => variable_get('boinc_privacypref_privacylink_path', ''),
)
);

// Standard option sets
$form['boolean_options'] = array(
'#type' => 'value',
Expand Down Expand Up @@ -1800,6 +1802,26 @@ function boincwork_privacyprefs_form(&$form_state) {
'#attributes' => array('class' => 'fancy'),
'#default_value' => $currstate,
);

// Add a description with link to the question 'Do you consent to
// exporting your data...'. There are two administration options
// in 'Preferences: General' that control this link. The first
// 'Enable the privacy link' enables/disables the description
// below. The second, 'Path to privacy page', allows the admin to
// give the druapl path to the privacy policy.
if ($default['privacy']['enableprivacylink']) {
$mypatt = '/Do you consent to exporting your data to BOINC statistics aggregation Web sites/';
if (preg_match($mypatt, $ct['description']) ) {
$form['privacy']['privacyconsent_'.$ct['shortname']]['#description'] = bts('See our !privacy_policy_link for the current list of statistics providers.',
array(
'!privacy_policy_link' => l(
bts('privacy policy', array(), NULL, 'boinc:account-preferences-privacy'),
$default['privacy']['privacylinkpath']
)
),
NULL, 'boinc:account-preferences-privacy');
}
}
}

// Ignore and block users
Expand Down

0 comments on commit 01f642b

Please sign in to comment.