Thanks for a great module - and for sharing it with the community. I have a couple of Javascript problems I wondered if you could help with?

I've implemented the module slightly differently from you in that I have a dedicated showcase area and not a showcase on every page. I'm having problems in that the Javascript seems to fire on all pages regardless.

I'm also getting an error

Error: active is not defined
Source File: http://www.liquidcms.ca/modules/showcase/showcase.js
Line: 32

Comments

liquidcms’s picture

a couple things:

- haven't looked at this in a while.. so bare with me

- in my specific application i didn't define a region in my template (likely because i hadn't learned about that part of drupal at the time)
- as a result i can't disable the block for certain pages - which i think i might need to do to test your issue.. but easy to do so i will try it out.

- i am not quite sure i completely understand your setup.. you have the block defined on one page, showcase starts, and then you go to a different page where the block doesnt exist? if this is what you are doing; yes, not sure it will handle that correctly since ajax routine comes back looking for dom element to modify and it won't be there anymore.. but easy enough to fix that if that is the case.

let me know if have your setup correct.

also, no idea how you can get the error msg you list here.. it has an absolute URL to my site in it??? nothing in my code has my domain hard coded.

csc4’s picture

Thanks for the speedy reply - the error message having your site in it is odd, think I must have copied the wrong one out of my error console (I went to your site to check that there wasn't a newer version as the releases bit in this project is still blank). I can't reproduce it now (on your site) but I am getting

Error: [Exception... "Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsIXMLHttpRequest.status]"  nsresult: "0x80040111 (NS_ERROR_NOT_AVAILABLE)"  location: "JS frame :: http://www.liquidcms.ca/modules/showcase/showcase.js :: anonymous :: line 27"  data: no]
Source File: http://www.liquidcms.ca/modules/showcase/showcase.js
Line: 27

from your site.

As to my setup - I have a block but it's conditionally visible (only on showcase pages).

As to the JS errors, despite being horrible at Javascript I think I may have fixes to the other two problems after much Googling.

a simple change to give var a default value var active = false; on line 5 seems to resolve that issue.

Line 28 adding a test for readyState seems to resolve that issue

    if (xmlhttp.readyState == 4 && xmlhttp.status != 200) {
liquidcms’s picture

sounds about right.. these were the 2 things i thought would be breaking if the setup was what i thought you had (which it is).

Thanks for the "patch", i will go ahead and add these to the code.

Now that i am a lot more Drupal happy i can see a lot of improvements for this module... should i ever have time.

- someone early on asked if i could add views support - so what i added was the ability to use a view list of nodes to provide the content; but now i think what they really meant was likely the ability to dump a view block content (with its themeing) into the showcase block.. which would be cool

- also, the ability to have more than one showcase block would be useful

someday,