I know that this is and example module only meant to demonstrate and help developers. But I tried working with it and found that it is not working properly. On fresh installation of drupal 7 the authcache_example module does not work for few reasons including:
1. Install file uses old d6 schema implementation techniques.
2. The use of db functions not longer supported such as db_result
3. Breaks on save and/or submit
In addition to that the module lacked:
1. Drupal code standards
2. Access issues are not handled properly.
I worked on the module to convert it to proper D7 module file. I am positive it needs more work, but at least I was able to clean it a little and get it to function on a fresh D7 install. Please see patch and review it. If it passes your review and wish to commit it to the working tree, I would appreciate if you attribute the commit to me.
Comment | File | Size | Author |
---|---|---|---|
#1 | authcache_example-d7_does_not_work-1875168-1.patch | 10.28 KB | awm |
Comments
Comment #1
awm CreditAttribution: awm commentedPatch here:
Comment #2
simg CreditAttribution: simg commentedThanks Ali, I will check this out when I get some free time.
Comment #3
awm CreditAttribution: awm commentedUpdate:
Pactch #1 get the module to work without breaking. But, I am still trying to figure out the javascript/Ajax part. It is not very well documented and I am trying to see how it is done in the main authcache module.
That said, I was able to make some progress and get the JS to trigger by:
1. Changing the function _authcache_authcache_example in ajax/authcache.php to
(simple diff)
2. Adding authcache_example_display_block_example_test to authcache_example.module in the following manner (because authcache_example_display_block_0 was not defined anyware)
3. Change authcache_example.js to:
However, the function _authcache_authcache_example is triggered before the DOM is ready and is not behaving properly.
I am somewhat familiar with the drupal behavior system and the way authcahe deal with js is still a bit vague to me.
Please let me know whether I am headed in the right direction or not and some pointers would be much appreciated. Also, I placed a few questions in the js code if anyone could help answering them.
Comment #4
simg CreditAttribution: simg commentedThanks for this Ali.
Committed to the dev branch.
To answer your questions (as best as they are likely to be answered)
>// Does this function have to be in the global scope? I could not get it to evaluate if not placed in global scope
Probably not, I've yet to actually build an authcache module myself for either D6 or 7, so you now already know more about this than me :)
>// Why can't we use drupal behaviors for the authcahce JS?
Can't see any reason (doesn't mean there isn't one though!). What was there is D6 code and IIRC behaviours are a D7 feature?
Comment #5
simg CreditAttribution: simg commentedI've been thinking about this.
Behaviours do seem like a good way to go. That said, I'm not convinced that Authcache should be providing the Javascript callback functionality at all. I think it should be separate module that enables personalisation via Javascript.
(Don't worry, I'm not going to arbitrarily ditch the javascript :) )
Anyone else have any thoughts?
Comment #6
znerol CreditAttribution: znerol commentedThe whole JavaScript part was rewritten into behaviors and AJAX is broken out into an optional module in 7.x-2.x.