Merge pull request #235 from Mibew/gdpr

Add optional privacy link to pre-chat survey
This commit is contained in:
Fedor A. Fetisov 2018-08-17 18:48:30 +03:00 committed by GitHub
commit e40be770c3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 71 additions and 0 deletions

View File

@ -49,6 +49,14 @@
}
}
function updatePrivacyPolicy() {
if ($("#enable-privacy-policy").is(":checked")) {
$(".under-privacy-policy").show();
} else {
$(".under-privacy-policy").hide();
}
}
$(function() {
$("#enable-presurvey").change(function() {
updateSurvey();
@ -62,9 +70,13 @@
$("#enable-tracking").change(function() {
updateTracking();
});
$("#enable-privacy-policy").change(function() {
updatePrivacyPolicy();
});
updateSurvey();
updateSSL();
updateGroups();
updateTracking();
updatePrivacyPolicy();
});
})(jQuery);

View File

@ -221,6 +221,12 @@ function setup_survey($name, $email, $group_id, $info, $referrer)
'title' => $data['page.title']
);
// Set privacy policy link (if needed)
if (Settings::get('enableprivacypolicy')
&& strcmp('', Settings::get('privacypolicy'))) {
$data['survey']['surveyForm']['privacyPolicyUrl'] = Settings::get('privacypolicy');
}
if (Settings::get('enablegroups') == '1' && Settings::get('surveyaskgroup') == '1') {
$data['survey']['surveyForm']['groups']
= prepare_groups_select($group_id);
@ -438,6 +444,7 @@ function setup_chatview_for_user(
? $asset_url_generator->generate($operator['vcavatar'])
: '';
return $data;
}

View File

@ -47,6 +47,12 @@ class FeaturesController extends AbstractController
$page['form' . $opt] = (Settings::get($opt) == '1');
}
// Load all needed featured values and fill the form.
$values = $this->getValuesList();
foreach ($values as $val) {
$page['form' . $val] = Settings::get($val);
}
$page['canmodify'] = is_capable(CAN_ADMINISTRATE, $operator);
$page['stored'] = $request->query->get('stored');
$page['title'] = getlocal('Messenger settings');
@ -78,6 +84,13 @@ class FeaturesController extends AbstractController
Settings::set($opt, $value);
}
// Update featured values in the database.
$values = $this->getValuesList();
foreach ($values as $val) {
$value = $request->request->get($val);
Settings::set($val, $value);
}
// Redirect the current operator to the same page using GET method.
$redirect_to = $this->generateUrl(
'settings_features',
@ -110,8 +123,21 @@ class FeaturesController extends AbstractController
'enablepopupnotification',
'showonlineoperators',
'enablecaptcha',
'enableprivacypolicy',
'trackoperators',
'autocheckupdates',
);
}
/**
* Returns list with names of all featured values.
*
* @return array Featured values names.
*/
protected function getValuesList()
{
return array(
'privacypolicy',
);
}
}

View File

@ -98,6 +98,8 @@ class Settings
'autocheckupdates' => '1', /* Check updates automatically */
'showonlineoperators' => '0',
'enablecaptcha' => '0',
'enableprivacypolicy' => '0',
'privacypolicy' => '',
'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */
'connection_timeout' => 30, /* Timeout (in seconds) from the last ping when messaging window disconnects */
'updatefrequency_operator' => 2,

View File

@ -42,7 +42,13 @@
<td valign="top"><textarea id="message-survey" name="message" tabindex="0" cols="45" rows="2">{{message}}</textarea></td>
</tr>
{{/if}}
{{#if privacyPolicyUrl}}
<tr>
<td colspan="2"><strong>{{{l10n "Please note that by starting the chat you're explicitly agree with the <a href=\"{0}\" target=\"_blank\">Privacy Policy</a>" privacyPolicyUrl}}}</strong></td>
</tr>
{{/if}}
</table>
<br/>
<a href="javascript:void(0);" class="but" id="submit-survey">{{l10n "Start Chat"}}</a>
<div class="clear">&nbsp;</div>
</form>

View File

@ -143,6 +143,24 @@
<label for="survey-ask-message" class="field-description"> &mdash; {{l10n "Show/hide initial question field in the survey"}}</label>
<br clear="all"/>
</div>
<div class="subfield under-survey">
<label for="enable-privacy-policy" class="field-label">{{l10n "Enable \"Privacy policy\""}}</label>
<div class="field-value">
<input id="enable-privacy-policy" type="checkbox" name="enableprivacypolicy" value="on"{{#if formenableprivacypolicy}} checked="checked"{{/if}}{{#unless canmodify}} disabled="disabled"{{/unless}}/>
</div>
<label for="enable-privacy-policy" class="field-description"> &mdash; {{l10n "Display a notice with the link to privacy policy on the survey page"}}</label>
<br clear="all"/>
<div class="subfield under-privacy-policy">
<label for="privacy-policy" class="field-label">{{l10n "Privacy policy"}}</label>
<div class="field-value">
<input id="privacy-policy" type="text" name="privacypolicy" size="40" value="{{formprivacypolicy}}" class="field-input"{{#unless canmodify}} disabled="disabled"{{/unless}}/>
</div>
<label for="privacy-policy" class="field-description"> &mdash; {{l10n "Enter a URL of your privacy policy"}}</label>
<br clear="all"/>
</div>
</div>
</div>
<div class="field">