Index: openacs-4/packages/cookie-consent/cookie-consent.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cookie-consent/cookie-consent.info,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/cookie-consent/cookie-consent.info 3 Aug 2018 09:50:08 -0000 1.5 +++ openacs-4/packages/cookie-consent/cookie-consent.info 26 Apr 2019 11:45:42 -0000 1.5.2.1 @@ -9,15 +9,15 @@ f f - + Gustaf Neumann Cookie Consent Widget based on the free Cookie Consent Library 2017-12-13 MIT License 0 - + @@ -29,8 +29,8 @@ + name="Version" default="cookieconsent2/3.1.0" + description="Version of the cookie-consent library, e.g.: cookieconsent2/3.1.0"/> Index: openacs-4/packages/cookie-consent/tcl/callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cookie-consent/tcl/callback-procs.tcl,v diff -u -r1.1 -r1.1.2.1 --- openacs-4/packages/cookie-consent/tcl/callback-procs.tcl 17 Dec 2017 19:55:03 -0000 1.1 +++ openacs-4/packages/cookie-consent/tcl/callback-procs.tcl 26 Apr 2019 11:45:42 -0000 1.1.2.1 @@ -42,6 +42,9 @@ "Default style: use the following settings, when CookieConsentPalette is set to 'default'" "popup {text #fff background #004570} button {text #000 background #f1d600}" "string" + "ExpiryDays" + "Lifetime of the cookie" + "365" "number" } { apm_parameter_register "CookieConsent$name" \ $description "acs-subsite" $default $datatype "Cookie Consent" @@ -59,6 +62,7 @@ Palette Position DefaultPalette + ExpiryDays } { ns_log notice [list apm_parameter_unregister \ -parameter "CookieConsent$parameter" \ Index: openacs-4/packages/cookie-consent/tcl/cookie-consent-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cookie-consent/tcl/cookie-consent-procs.tcl,v diff -u -r1.12.2.2 -r1.12.2.3 --- openacs-4/packages/cookie-consent/tcl/cookie-consent-procs.tcl 15 Mar 2019 08:59:18 -0000 1.12.2.2 +++ openacs-4/packages/cookie-consent/tcl/cookie-consent-procs.tcl 26 Apr 2019 11:45:42 -0000 1.12.2.3 @@ -29,13 +29,12 @@ # widget also via NaviServer config file: # # ns_section ns/server/${server}/acs/cookie-consent - # ns_param version cookieconsent2/3.0.3 - # + # ns_param version cookieconsent2/3.1.0 - set version [parameter::get \ - -package_id $package_id \ - -parameter Version \ - -default cookieconsent2/3.0.3] + set ::cookieconsent::version [parameter::get \ + -package_id $package_id \ + -parameter Version \ + -default cookieconsent2/3.1.0] ad_proc -private get_relevant_subsite {} { } { @@ -87,6 +86,7 @@ :property {palette default} ;# default|oacs|honeybee|mono|neon|corporate :property {learn-more-link https://cookiesandyou.com/} :property {default-palette {popup {text #fff background #004570} button {text #000 background #f1d600}}} + :property {expiryDays:integer 365} :property {compliance-type inform} ;# inform|opt-out|opt-in :property {message-text "#cookie-consent.message#"} @@ -193,7 +193,7 @@ "name": "$cookie_name", "path": "/", "domain": "", - "expiryDays": "365" + "expiryDays": "${:expiryDays}" }, "theme": "$theme", "position": "$position", @@ -220,16 +220,10 @@ Initialize a cookie-consent widget. } { - if {[catch {ns_conn content}]} { + if {[ns_conn isconnected]} { # # If the connection is already closed, do nothing. # - # "ns_conn content" will raise an exception, when the - # connection is already closed. This is not obvious - # without deeper knowledge. Therefore, NaviServer needs - # probably a "ns_conn closed" flag the check for such - # situations in a more self-expanatory way. - # return } @@ -253,6 +247,7 @@ # Create an instance of the consent widget class from all configuration options # foreach {param default} { + ExpiryDays 365 Layout block Palette oacs Position bottom @@ -267,6 +262,7 @@ set c [CookieConsent new \ -subsite_id $subsite_id \ + -expiryDays $p(ExpiryDays) \ -position $p(Position) \ -palette $p(Palette) \ -layout $p(Layout) \ @@ -290,8 +286,8 @@ cookieconsent packages, either from the local file system, or from CDN. - @return dict containing resourceDir, resourceName, cdn, - cdnHost, prefix, cssFiles, jsFiles and extraFiles. + @return dict containing resourceDir, resourceName, cdn, + cdnHost, prefix, cssFiles, jsFiles and extraFiles. } { # # If no version of the cookie consent library was specified,