Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introducing unselect field in services settings #321

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions assets/consent_manager_frontend.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,12 @@ const cmCookieAPI = Cookies.withAttributes({ expires: cmCookieExpires, path: '/'
cookieUids.forEach(function (uid) {
consents.push(uid);
addScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
removeScript(consent_managerBox.querySelector('[data-uid="script-unselect-' + uid + '"]'));
});
} else {
cookieUids.forEach(function (uid) {
removeScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
addScript(consent_managerBox.querySelector('[data-uid="script-unselect-' + uid + '"]'));
});
}
});
Expand All @@ -144,11 +146,13 @@ const cmCookieAPI = Cookies.withAttributes({ expires: cmCookieExpires, path: '/'
cookieUids.forEach(function (uid) {
consents.push(uid);
addScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
removeScript(consent_managerBox.querySelector('[data-uid="script-unselect-' + uid + '"]'));
});
} else {
el.checked = false;
cookieUids.forEach(function (uid) {
removeScript(consent_managerBox.querySelector('[data-uid="script-' + uid + '"]'));
addScript(consent_managerBox.querySelector('[data-uid="script-unselect-' + uid + '"]'));
});
}
});
Expand Down
2 changes: 1 addition & 1 deletion assets/consent_manager_frontend.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions fragments/consent_manager_box.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@
foreach ($consent_manager->scripts as $uid => $script) {
echo '<div style="display: none" class="consent_manager-script" data-uid="script-' . $uid . '" data-script="' . $script . '"></div>';
}
foreach ($consent_manager->scriptsUnselect as $uid => $script) {
echo '<div style="display: none" class="consent_manager-script" data-uid="script-unselect-' . $uid . '" data-script="' . $script . '"></div>';
}
?>
</div>
<?php endif ?>
1 change: 1 addition & 0 deletions install.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
->ensureColumn(new rex_sql_column('provider_link_privacy', 'varchar(255)'))
->ensureColumn(new rex_sql_column('definition', 'text'))
->ensureColumn(new rex_sql_column('script', 'text'))
->ensureColumn(new rex_sql_column('script_unselect', 'text'))
->ensureColumn(new rex_sql_column('placeholder_text', 'text'))
->ensureColumn(new rex_sql_column('placeholder_image', 'varchar(255)'))
->ensureColumn(new rex_sql_column('createuser', 'varchar(255)'))
Expand Down
1 change: 1 addition & 0 deletions lang/de_de.lang
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ consent_manager_cookiegroup_add = Gruppe erstellen
consent_manager_cookiegroup_edit = Gruppe bearbeiten
consent_manager_cookiegroup_required = diese Gruppe enthält die technisch notwendigen Dienste und Cookies
consent_manager_cookiegroup_scripts = Skripte, die nach Einverständnis geladen werden
consent_manager_cookiegroup_scripts_unselect = Skripte, die nach Widerrufen des Einverständnisses geladen werden
consent_manager_cookiegroup_scripts_notice = Skripte inklusive <code><script>...</script></code> eingeben
consent_manager_cookiegroup_nodomain_notice = Es wurde noch keine Domain oder keine Dienste zugeordnet! Im Frontent wird evtl. keine Consent-Box angezeigt.

Expand Down
3 changes: 2 additions & 1 deletion lang/en_gb.lang
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ consent_manager_cookiegroups = Services
consent_manager_cookiegroup_add = Create service
consent_manager_cookiegroup_edit = Edit service
consent_manager_cookiegroup_required = this group contains required services and cookies
consent_manager_cookiegroup_scripts = Scripts which will be loaded once cookies are approved
consent_manager_cookiegroup_scripts = Scripts which will be loaded once consent is set
consent_manager_cookiegroup_scripts_unselect = Scripts will be loaded once consent is withdrawn
consent_manager_cookiegroup_scripts_notice = Enter scripts including <code><script>...</script></code>

consent_manager_texts = Texts
Expand Down
1 change: 1 addition & 0 deletions lang/sv_se.lang
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ consent_manager_cookiegroup_add = Skapa cookie grupp
consent_manager_cookiegroup_edit = Bearbeta cookie grupp
consent_manager_cookiegroup_required = denna cookie-grupp innehåller de tekniskt nödvändiga cookies
consent_manager_cookiegroup_scripts = Skript som laddas efter godkännande
consent_manager_cookiegroup_scripts_unselect = Skript som laddas efter att samtycket har återkallats
consent_manager_cookiegroup_scripts_notice = Ange skript inklusive <code> <script> ... </script> </code>

consent_manager_texts = Cookie texter
Expand Down
1 change: 1 addition & 0 deletions lib/consent_manager_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ private function prepareCookie($clangId)
}
$cookie['definition'] = $defs;
$cookie['script'] = base64_encode($cookie['script']);
$cookie['script_unselect'] = base64_encode($cookie['script_unselect']);
$this->cookies[$clangId][$uid] = $cookie; /** @phpstan-ignore-line */
}
}
Expand Down
Loading