Looks like a very good solution to a very stupid law.

For those of us not in D7 land yet, any plans / scope / how hard do we think a back port to 6 would be?

Comments

a_c_m’s picture

Ahh crap. RTFFP.

What about Drupal 6?

The Cookie Control user interface requires a minimum of jQuery 1.4.4 which is not supported for Drupal 6.

We sure there isn't a work around? Seems like the lib itself requires 1.4.4 :(

budda’s picture

Status: Active » Postponed

I'm speaking with CivicUK regarding their codebase and what limitations using an older Drupal 6 compatible jQuery library imposes.

I'd like to have it running on Drupal 6 too - as most big sites are still on Drupal 6 for the foreseeable future.

In the meantime, if you have time to comb over the cookiecontrol javascript and suggest any changes to make it jquery 1.3.2 compatible I can feed that back to CivicUK to include in the upcoming update.

Alternatively, find a way to get http://drupal.org/project/jquery_update upgraded to support jquery 1.4.4+

budda’s picture

From some initial jQuery sniffing i noticed the use of .delay() in the cookiecontrol code requires 1.4+

jorditr’s picture

And wouldn't it have the "jQuery Update" module as a requirement?

budda’s picture

@JordiTR Yes it would have that as a requirement, what about it though?

budda’s picture

Status: Postponed » Active

Maybe we can solve Drupal 6 compatibility with http://drupal.org/project/jqmulti ?

mibfire’s picture

Is there any chance that it will be backported for 26 may?

jenifertucker’s picture

I was also looking for a Drupal 6 solution.

With jQuery version 1.4 and above, this solution worked for Drupal 6 by putting both the javascipt function and generated text into a block.

http://www.civicuk.com/cookie-law/configuration

Thanks to guys at CivicUK for their help :-)

Miszel’s picture

I developed a different module for Drupal 6 that dosn't require newer jquery. It is available here

jaredray’s picture

Hi Jenifer,
how were you able to use JQuery 1.4, when Drupal 6 JQuery update only goes to 1.3.2?
Thanks,
Jared

hongpong’s picture

you may wish to add a link on the project description page for the Drupal 5/6 project which is now available: http://drupal.org/project/eu-cookie-compliance

darrenlambert’s picture

This is a great module, and it's a shame it doesn't work with Drupal 6. It does seem trivial to get it working, needing just a requirement of another module, but I suppose that's a heavy dependance for some people.

gpk’s picture

jqmulti module (#6) uses jQuery noConflict http://api.jquery.com/jQuery.noConflict/ which could be invoked directly by this module to inject jQuery 1.4.4.

However the advantage of relying on jqmulti is that it could avoid ending up with jQuery 1.4.4 (or higher) being loaded more than once, by different modules. Perhaps the Rolls Royce solution would be to take advantage of jqmulti if present and use jQuery.noConflict if not.

nickbits’s picture

Hi All,

I did attempt to backport this to Drupal 6. I have attached what I have done as a patch against D7 dev. To use it you need to first install libraries with jQuery 1.7.2. Then install jQMulti module. Then apply apply this patch against the D7 release.

Unfortunately although the module installs, the admin interface works, the jQuery doesn't seem to run. Hoping someone can help to finish it.

Nick

nickbits’s picture

StatusFileSize
new44.21 KB

This time with the patch! Will take another look when I get more time...

nickbits’s picture

I have updated/replaced the D7 API code to D6 code. Also updated the JS to use the jQuery 1.7.2 library. Again please not instructions on previous post (#14). The JS loads, although it doesn't seem to execute for some reason. No other errors are shown.

So the question now is, why doesn't the JS run?

Am still working on it, but if anyone else wants to chip in, please do so.

And yes, before anyone else does mention it, I do use the EU Cookie Compliance module on my D6 sites. I would like to use this module though for various reasons...

nickbits’s picture

Status: Active » Needs work
joachim’s picture

Maybe try using the API from jqmulti rather than just the raw JS way?

http://drupalcode.org/project/jqmulti.git/blob/refs/heads/7.x-1.x:/jqmul...

nickbits’s picture

Thanks for that, but have already tried that and get no where, unless I am doing it wrong. I know it is using the correct JS file as if you add

alert("jQuery version = " + $().jquery);

to cookieControl-4.1.min it comes up saying it is version 1.7.2. I will give it another go, but am assuming that there is something else that I have missed.

Cheers,
Nick

nickbits’s picture

StatusFileSize
new50.72 KB

Last update for a while. Patch removes remaining errors/warnings from the admin page. I ahve no more time today, but will continue as soon as I get some spare time. If you can, take a look and help to get it working.

As noted before:

  • install libraries with jQuery 1.7.2
  • jQMulti module
  • Then apply apply this patch against the D7 release
  • Then enable

I would do each of the modules on their own, I got several error enabling libraries and jQMulti at the same time. The module installs, you can get the admin page and do all the settings, the JavaScript is installed in the page (view the source when you load a page) but at present none of the other code (JS) loads.

nickbits’s picture

StatusFileSize
new51.54 KB

Hi All,

New patch attached. Still not working, but I think I may now have finished removing most of the D7 only code. The JS all loads into the footer now. For some reason it still will not execute. Think this may be the jQuery version again, but am looking into it.

Feel free to chip in and help...

Nick

nickbits’s picture

StatusFileSize
new51.48 KB

Sorry, wrong version attached previously.

nickbits’s picture

Working on last issue, although may be a while before an update. The last issue is that all of the JS code needs to be grouped together to run with the updated jQuery. Or at least that is what it looks like to me...

nickbits’s picture

Category: feature » task
StatusFileSize
new13.31 KB

Yeah....Got it...

Got it working. The code needs a bit of a tidy up and I have not yet tested everything. I ahve had to include the cookiecontrol JS library in the HTML itself. You will note from the code:

function cookiecontrol_init() {
  $path = drupal_get_path('module', 'cookiecontrol');
  drupal_add_css($path . '/css/eu_cookie_compliance.css');
  drupal_add_js($path . '/js/cookieControl-4.1.min.js', 'module', 'footer');
}

essentially the library is loaded twice. Remove the drupal_add_js from above and it still works fine in Safari but not FireFox. Anyway, here is what you need to get it working:

  • Install libraries with jQuery 1.7.2
  • Install the jQMulti module
  • Then apply apply this patch (v6) against the D7 Dev release (31 May 2012)
  • Then enable as normall

Can I ask the module maintainer if we can add this as a starting point to a D6 branch?

Can I also ask you all to try it (NOT ON PRODUCTION SITES), report back on what works and doesn't, and if you can, submit patches/corrections.

nickbits’s picture

Category: task » feature
Status: Needs work » Needs review

Has any one had chance to test it yet?

goron’s picture

Status: Needs review » Needs work

Hi. I'm the maintainer of jQuery Multi. I came across this issue and thought I should comment. First, I'd recommend testing with the latest dev of jqmulti. It has a few fixes, including one for the errors when enabling it and libraries together.

More importantly, you should be able to get this working without this part:

Second, for this part:

+++ b/cookiecontrol.moduleundefined
@@ -19,19 +19,33 @@ define('COOKIECONTROL_FULLTEXT', '<p>' . t("Some cookies on this site are essent
+function cookiecontrol_jqmulti_files() {
+  return array(
+    'http://drupal6.sandbox/sites/all/modules/cookiecontrol/js/cookieControl-4.1.min.js',
+  );
+}*/

Why don't you do drupal_get_path('module', 'cookiecontrol')?

Third, you really don't need to do this:

+++ b/cookiecontrol.moduleundefined
@@ -103,26 +112,32 @@ function cookiecontrol_preprocess_html(&$variables) {
+    $path = drupal_get_path('module', 'cookiecontrol');
+    $library = file_get_contents($path."/js/cookieControl-4.1.min.js");
+
+    $jsource = '<script type="text/javascript">';
+    $jsource .= '(function(jQuery){';
+    $jsource .= $library;
+    $jsource .= $cookiecontrol_settings;
+    $jsource .= '})(jq172)';

That's the point of the jqmulti hooks, that you shouldn't need to add aliases to packaged libraries like this one. You should only need to implement the jqmulti_files() hook, and possibly also call drupal_add_js() on that same file to make sure it gets loaded (the jqmulti hook will ensure it gets loaded with the newer jQuery version).

One way to see whether it's working is to look at the HTML. You should see jQuery 1.4.4 (or whatever version you're using) loading, followed by cookieControl.min.js, followed by a script called switch.js. If this is not happening, something is wrong. Please post in the jqmulti issue queue if you have more issues, so that we can figure out what the problem is and if there is a jqmulti bug at play here.

nickbits’s picture

@goron Thanks for the reply. I was/am using the latest dev release of jqmulti, I always make sure that I use the latest release. I still get the errors though when enabling all the modules together. I had not done it on a clean drupal install so was not too sure if it was jqmulti or something else causing the problem.

As for the other, oops on the second point, didn't spot that, however it is commented out anyway as that was the jqmulti hook, or part of it, that I was having issues with.

As for the third point, I could not get the jqmulti hooks to work, not how I thought they should anyway, hence the reason I did it that way. Also, at that point in the file I was having issues getting drupal_add_js() to output to the footer region. Switch.js was loading fine.

I will then give the hooks another go.

Thanks,
Nick

joachim’s picture

> First, I'd recommend testing with the latest dev of jqmulti. It has a few fixes, including one for the errors when enabling it and libraries together.

Could you make a new beta release if the current one has problems that are fixed? For people to test this module here it would be easier to point them at a release rather than a dev version. Thanks for all your feedback!

goron’s picture

Sure. I was waiting for some things to happen in the D7 version, but no real reason to do that.

New release is out (6.x-1.0-bet2). I'm also including some better instructions in the README. I know that using the module can be a bit confusing, so I've tried to clarify it there.

Nick, the second point in my post could have to do with why jqmulti wasn't working as well. If you still can't get it to work, please write in the jqmulti issue queue and I'd be happy to try to help out there.

nickbits’s picture

@goron thanks, will try and test it out with the new version of jqmulti. I expect that it is me doing something silly. Anyway, I was hoping that people would at least test the current patch in #24 and confirm, or not, if that at least works.

Will see if I can put some time aside later this week and get it to play nicely with jqmulti.

Thanks,
Nick

nickbits’s picture

Hi All,

I have done no more work on this, and unless anyone else gives feedback on it or needs it, I will stop working.

Nick

teranex’s picture

@nickbits: I have tested the module. While I could get it working on Drupal 6, I still see the session and has_js cookies being set. I'm not sure if this is expected behaviour?
If I see the original Cookie Control website, it let's me configure the widget do request explicit permission to set cookies. Is this configurable from in the module?
I would be interested in a fully working Drupal 6 version of this module. Thx for the work so far!

nickbits’s picture

Category: task » feature
Status: Patch (to be ported) » Needs work

That means it works as intended. To disable those cookies need you to use the JS to enable/disable them. see the Developers section on the module page. It may be something that can be added to the module, or as a sub-module, but think first thing is to get a working backport for D6 that replicates the D7 version and then think about additional features.

Also, you may want to look at the no anon module. It removes sessions for anonymous users, I believe. As for the has_js, I would argue that it is essential, for D6, to run. Can look at that anyway as a sep. issue.

Thanks for testing.

nickbits’s picture

Category: feature » task
Status: Needs work » Patch (to be ported)

@budda any chance of having a new D6 branch created using this patch? Can then add extra functions, enhance code, etc. with separate issues rather than one long issue as it now is.

mschudders’s picture

Category: feature » task
Status: Needs work » Patch (to be ported)

Hi Nickbits,

I am also testing out the patch for D6. (Had to clean out a little bug with the patch ==> it didn't remove the core7.x line.)

but I am facing another problem now.

ReferenceError: jq172 is not defined [http://myproejct/admin/settings/jqmulti:122]

  1. I have enabled the libraries module + put jquery1.7.2 in the correct folder.
  2. Updated jQuery update to the latest dev version. (Didn't change the jQuery version in the admin interface of this module)
  3. Enabled jQueryMulti and checked the checkbox : "Load this jQuery library even if no libraries or files are assigned to it" @
  4. /admin/settings/jqmulti

Can you tell me what I am missing or doing wrong ?

Thanks

nickbits’s picture

Hi,

(Had to clean out a little bug with the patch ==> it didn't remove the core7.x line.)

Yes it does. Check the diff/patch file, you should see in there somewhere:

-core = 7.x
-
-configure = admin/config/people/cookiecontrol
+core = 6.x

I would double check that the patch has been applied correctly.

Can you tell me what I am missing or doing wrong ?

From #24:

  • Install libraries and jQuery 1.7.2
  • Install the jQMulti module
  • Then apply apply this patch (v6) against the D7 Dev release (31 May 2012)
  • Then enable as normal

So you don't need jQuery Update.

The jQueryMulti, I never changed any settings from default (don't think I did anyway).

Nick

Anonymous’s picture

I tried following the instructions in #24, and I had some problems. I first tried applying the patch with git-apply, which gave me this error:

../cookiecontrol-backport_to_drupal_6_v6.patch:156: trailing whitespace.

../cookiecontrol-backport_to_drupal_6_v6.patch:165: trailing whitespace.

../cookiecontrol-backport_to_drupal_6_v6.patch:171: trailing whitespace.

../cookiecontrol-backport_to_drupal_6_v6.patch:173: trailing whitespace.

../cookiecontrol-backport_to_drupal_6_v6.patch:191: trailing whitespace.
drupal_add_js($cookiecontrol_acceptancecallback, 'inline', 'footer', FALSE, TRUE, TRUE);
Checking patch cookiecontrol.admin.inc...
Checking patch cookiecontrol.info...
Checking patch cookiecontrol.module...
Checking patch js/cookieControl-4.1.min.js...
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.info...
error: while searching for:
; $Id$
name = "Cookie Control for Google Analytics"
description = "Disabled Google Analytics form tracking until visitor consents"
dependencies[] = "cookiecontrol"
dependencies[] = "googleanalytics"
core = 7.x

error: patch failed: modules/cookie_googleanalytics/cookie_googleanalytics.info:1
error: modules/cookie_googleanalytics/cookie_googleanalytics.info: patch does not apply
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.module...

But as far as I can tell, it is just trying to delete the cookie_googleanalytics sub-module? Anyway, next I tried with the patch -p1 command, and got this:

patching file cookiecontrol.admin.inc
patching file cookiecontrol.info
Hunk #1 FAILED at 2.
1 out of 1 hunk FAILED -- saving rejects to file cookiecontrol.info.rej
patching file cookiecontrol.module
patching file modules/cookie_googleanalytics/cookie_googleanalytics.info
File modules/cookie_googleanalytics/cookie_googleanalytics.info is not empty after patch, as expected
patching file modules/cookie_googleanalytics/cookie_googleanalytics.module

Again, no idea why it was failing - the cookiecontrol.info file looked exactly like in the patch file, so I just applied that manually. I also had to delete the auto-generated content at the bottom of that file, which included a line about core=7:

; Information added by drupal.org packaging script on 2012-05-31
version = "7.x-1.5+1-dev"
core = "7.x"
project = "cookiecontrol"
datestamp = "1338466114"

And the output about cookie_googleanalytics.info not being empty was for the same reason, so i just deleted that file.

Anyway, I'm now getting the same as @SleejR - an error in the JS console in Chrome: "Uncaught ReferenceError: jq172 is not defined". I also have jquery_update installed, so maybe this is the problem? Btw if you have it installed when you install jQMulti when you already have jquery_update installed, it says it is not compatible and asks you to update to the latest dev version, which will be why @SleejR said they did that...

Any ideas? I'm happy to provide any more information that would be useful.

nickbits’s picture

Status: Patch (to be ported) » Postponed (maintainer needs more info)

Hi,

I will take a look at this today. The ga module should be removed, not had the time to port it. Not sure why ou are getting errors. As for jquery update, I do not have it installed at all, sound like a conflict in one of the modules. Can you just confirm what versions of all he modules you ate using?

nickbits’s picture

Hi All,

First off, let me explain my set-up.

  • Install libraries with jQuery 1.7.2
  • Install the jQMulti module (16 June dev version)
  • Then apply apply this patch (v6) against the D7 Dev release (31 May 2012)
  • Then enable as normall

Note I have not changed any default values, that I am aware of and I am NOT using jquery_update (more on that later).

I believe this patch is identical to the previous, but as a few have said they had issues, have re-created it. I have tested the patch and it works fine, or appears to. If you are unsure, this is how to apply the patch:

  1. git clone --recursive --branch 7.x-1.x http://git.drupal.org/project/cookiecontrol.git
  2. cd cookiecontrol
  3. download and save the patch
  4. git apply -v cookiecontrol-backport_to_drupal_6_v7.patch.patch

The patch is NOT production ready, or to the correct coding standard. Partly due to the fact it is unfinished! You may see the following as a result of applying the patch:

Checking patch cookiecontrol.admin.inc...
Checking patch cookiecontrol.info...
Checking patch cookiecontrol.module...
Checking patch js/cookieControl-4.1.min.js...
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.info...
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.module...
Applied patch cookiecontrol.admin.inc cleanly.
Applied patch cookiecontrol.info cleanly.
Applied patch cookiecontrol.module cleanly.
Applied patch js/cookieControl-4.1.min.js cleanly.
Applied patch modules/cookie_googleanalytics/cookie_googleanalytics.info cleanly.
Applied patch modules/cookie_googleanalytics/cookie_googleanalytics.module cleanly.
warning: squelched 17 whitespace errors
warning: 22 lines add whitespace errors.

The google analytic module is removed, no time to convert yet. Apart from that, it appears to work just fine.

The only issue I have found is that having jquery_update enabled seems to disable jqmulti, or at least block it.

Final note, I do not plan on working on this much, I am using a different module now for my D6 sites.

Regards,
Nick

Anonymous’s picture

:) Thanks for your replies. The new patch works! Output:

cookiecontrol-backport_to_drupal_6_v7.patch.patch:157: trailing whitespace.

cookiecontrol-backport_to_drupal_6_v7.patch.patch:167: trailing whitespace.

cookiecontrol-backport_to_drupal_6_v7.patch.patch:174: trailing whitespace.

cookiecontrol-backport_to_drupal_6_v7.patch.patch:176: trailing whitespace.

cookiecontrol-backport_to_drupal_6_v7.patch.patch:194: trailing whitespace.
drupal_add_js($cookiecontrol_acceptancecallback, 'inline', 'footer', FALSE, TRUE, TRUE);
Checking patch cookiecontrol.admin.inc...
Checking patch cookiecontrol.info...
Checking patch cookiecontrol.module...
Checking patch js/cookieControl-4.1.min.js...
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.info...
Checking patch modules/cookie_googleanalytics/cookie_googleanalytics.module...
Applied patch cookiecontrol.admin.inc cleanly.
Applied patch cookiecontrol.info cleanly.
Applied patch cookiecontrol.module cleanly.
Applied patch js/cookieControl-4.1.min.js cleanly.
Applied patch modules/cookie_googleanalytics/cookie_googleanalytics.info cleanly.
Applied patch modules/cookie_googleanalytics/cookie_googleanalytics.module cleanly.
warning: squelched 1 whitespace error
warning: 6 lines add whitespace errors.

Then when I enabled the cookiecontrol module, I was getting an alert popup on every page saying "loaded...", and then I tried what @SleejR did and enabled the jQMulti setting "Load this jQuery library even if no libraries or files are assigned to it", and then FINALLY the cookiecontrol module started working properly! Except I now get an alert popup on every page saying "7. jQuery version = 1.7.2" and then "loaded..." but when I comment those lines out in cookiecontrol.module, everything is working great - thanks so much!

Only problem now is the GA submodule... Is there any chance you might have time to look at this at some point? If not, would you have any advice for someone else thinking about porting it to D6?

Thanks again.

EDIT: or just tell us which other module you are using! Does it provide support for GA?

nickbits’s picture

Excellent. Sorry about the pop ups, that was me doing a bit of debugging. Will re-roll the patch without them in it later today.

I will look at the GA module at the same time, later today. Won't make any promises though.

summit’s picture

Hi, Would love to see a D6 branch arise. Thanks guys!
greetings, Martijn

marco88’s picture

Hi same here,

I run a Drupal 6.x website targeting UK users.

I really need something like this.

Cheers
Marc.

nickbits’s picture

Status: Postponed (maintainer needs more info) » Needs work

Hi All,

I too would love to see this committed to a Drupal 6 branch. I no longer have time to work on it, I am using a different module for Drupal 6, and using this one for Drupal 7. Judging by the lack of updates, I expect what is needed is for someone to help co-maintain the module. Unfortunately I have no real time to do that, but the bases for a Drupal 6 branch is there if anyone wants to pick it up and see if they want to maintain it.

summit’s picture

Hi,

Is there at least a winzip version to be made for the drupal 6 version?
Does somebody have it working for Drupal 6?
Please post version here, or PM me.

Thanks a lot in advance,
greetings, Martijn

summit’s picture

Issue summary: View changes

Hi, Asking the same question for Drupal 6 again...anyone please? Nobody build the patch to the D6 module?
Thanks a lot in advance.
greetings, Martijn

budda’s picture

Would anybody like to co-maintain and sort out the Drupal 6 branch for completeness ?

budda’s picture

Status: Needs work » Closed (won't fix)

I don't have any desire to work on Drupal 6 codebase at this moment.