N°5037 - Setup: Add disclaimer about collected data

change ui organization
This commit is contained in:
Benjamin Dalsass
2022-06-14 17:18:34 +02:00
parent 617b6b991f
commit 00e8c11ec2

View File

@@ -708,6 +708,13 @@ class WizStepLicense extends WizardStep
return array('class' => 'WizStepDBParams', 'state' => '');
}
private function NeedsRgpdConsent()
{
$sMode = $this->oWizard->GetParameter('install_mode');
$aModules = SetupUtils::AnalyzeInstallation($this->oWizard);
return $sMode == 'install' && !SetupUtils::IsProductVersion($aModules);
}
/**
* @param WebPage $oPage
*/
@@ -741,8 +748,31 @@ EOF
$oPage->add('</ul>');
$oPage->add('</fieldset>');
$sChecked = ($this->oWizard->GetParameter('accept_license', 'no') == 'yes') ? ' checked ' : '';
$oPage->p('<input type="checkbox" name="accept_license" id="accept" value="yes" '.$sChecked.'><label for="accept">&nbsp;I accept the terms of the licenses of the '.count($aLicenses).' components mentioned above.</label>');
$oPage->add_ready_script('$("#accept").bind("click change", function() { WizardUpdateButtons(); });');
$oPage->p('<input type="checkbox" class="check_select" name="accept_license" id="accept" value="yes" '.$sChecked.'><label for="accept">&nbsp;I accept the terms of the licenses of the '.count($aLicenses).' components mentioned above.</label>');
if ($this->NeedsRgpdConsent()) {
$oPage->add('<div id="rgpd_message" class="message message-info">iTop software is compliant with the processing of personal data according to the European General Data Protection Regulation (GDPR).<p></p>
By installing iTop you agree that some information will be collected by Combodo to help you manage your instances and for statistical purposes.
This data remains anonymous until it is associated to a user account on iTop Hub.</p>
<p>List of collected data available in our <a target="_blank" href="https://www.itophub.io/page/data-privacy">Data privacy section.</p></a>');
$oPage->add('<input type="checkbox" class="check_select" id="rgpd_consent">');
$oPage->add('<label for="rgpd_consent">&nbsp;I accept the processing of my personal data</label>');
$oPage->add('</div>');
}
$oPage->add_ready_script('$(".check_select").bind("click change", function() { WizardUpdateButtons(); });');
$oPage->add_script(
<<<JS
function isRgpdConsentOk(){
let eRgpdConsent = $("#rgpd_consent");
if(eRgpdConsent.length){
if(!eRgpdConsent[0].checked){
return false;
}
}
return true;
}
JS
);
}
/**
@@ -751,7 +781,7 @@ EOF
*/
public function JSCanMoveForward()
{
return 'return ($("#accept").prop("checked"));';
return 'return ($("#accept").prop("checked") && isRgpdConsentOk());';
}
@@ -2143,13 +2173,6 @@ class WizStepSummary extends WizardStep
return array('class' => 'WizStepDone', 'state' => '');
}
private function NeedsRgpdConsent()
{
$sMode = $this->oWizard->GetParameter('install_mode');
$aSelectedModules = json_decode($this->oWizard->GetParameter('selected_modules'), true);
return $sMode == 'install' && !SetupUtils::IsProductVersion(array_flip($aSelectedModules));
}
public function Display(WebPage $oPage)
{
$oPage->add_style(
@@ -2303,30 +2326,6 @@ CSS
$oPage->add('</div>'); // progress_content
$oPage->add('</fieldset>');
if ($this->NeedsRgpdConsent()) {
$oPage->add('<div id="rgpd_message" class="message message-info">iTop software is compliant with the processing of personal data according to the European General Data Protection Regulation (GDPR).
By installing iTop you agree that some information will be collected by Combodo to help you manage your instances and for statistical purposes.
This data remains anonymous until it is associated to a user account on iTop Hub.
List of collected data available in our Data privacy section.<p><a target="_blank" href="https://www.itophub.io/page/data-privacy">More informations here</a></p>');
$oPage->add('<input type="checkbox" id="rgpd_consent">');
$oPage->add('<label for="rgpd_consent">&nbsp;I accept the processing of my personal data</label>');
$oPage->add('</div>');
$oPage->add_ready_script('$("#rgpd_consent").bind("click change", function() { WizardUpdateButtons(); });');
}
$oPage->add_script(
<<<JS
function isRgpdConsentOk(){
let eRgpdConsent = $("#rgpd_consent");
if(eRgpdConsent.length){
if(!eRgpdConsent[0].checked){
return false;
}
}
return true;
}
JS
);
$sJSONData = json_encode($aInstallParams);
$oPage->add('<input type="hidden" id="installer_parameters" value="'.htmlentities($sJSONData, ENT_QUOTES, 'UTF-8').'"/>');
@@ -2467,7 +2466,6 @@ JS
WizardUpdateButtons();
$('#setup_msg').html('$sMessage');
$('#progress').progression( {Current:{$aRes['percentage-completed']}, Maximum: 100} );
$("#rgpd_message").hide();
//$("#percentage").html('{$aRes['percentage-completed']} % completed<br/>{$aRes['next-step-label']}');
ExecuteStep('{$aRes['next-step']}');
@@ -2507,7 +2505,7 @@ EOF
*/
public function JSCanMoveForward()
{
return 'return (($("#wiz_form").data("installation_status") === "not started" && isRgpdConsentOk()) || ($("#wiz_form").data("installation_status") === "completed"));';
return 'return (($("#wiz_form").data("installation_status") === "not started") || ($("#wiz_form").data("installation_status") === "completed"));';
}
/**