Just started using Rotor and I really like the way it works, but I'm having one odd problem that I'm trying to solve on a test site.

Rotor banner is working in a sidebar block as expected for anonymous, non-auth visitors and for the admin user. However, any authenticated user no matter the role gets an exploded version of the block. That is, the block is in its normal position with one advertisement (or sponsor logo, in my case) showing, but the rest of the divs are stacked vertically below it. I'm assuming this is some permissions issues somewhere, but I can't track it down.

Some things I've looked at:
Same thing happens on IE(7) and Firefox(3).

In Firebug, the divs (in the broken case) have only attributes of class="rotor-content". The working version has an additional style attribute that changes as the javascript rotates the divs.

I'm using an imagecache image-preset of none. I checked this for permissions, but since the images actually appear, I'm guessing that's not the problem.

The only permissions differences between anonymous users and auth users are: comment module, ed_classified module, fckeditor module, forum module, poll module (cancel own vote), upload module (upload files), user module, and weather module. Looks like none of these are associated with Rotor.

Tested users with different additional roles. All users whether having auth role alone or auth + something else suffer the same problem.

FWIW, the jQuery plugins module is version 6.x-1.6.

I'm not sure what else to check and would appreciate any help. I'll try to attach cropped screenshots showing the difference. These will show the non-grouped tab operation with titles and png images (fixed with pngfix module for IE).

Comments

tomws’s picture

CORRECTION: After more testing, I've found that the problem also exists for anonymous users. I didn't check them out enough. Apologies for the confusion.

Additional information:
I've tested a bit more and I find that immediately after a Drupal cache clear through one browser, the first page refresh in another browser allows the rotor to function correctly. Refreshing again breaks it. Checking the transfers through Firebug, the first refresh shows all 200 codes for the css and js files meaning, of course, fresh loads. At the second refresh, all css and js files show 304 not modified, as expected. But the rotor is back to being broken again.

EDIT - more info:
Looks like rotor isn't loading on subsequent requests. Here's my javascript load order after purging the cache and a refresh.

  1. jquery
  2. drupal
  3. date_timezone
  4. filefield
  5. jquery.pngfix
  6. thickbox
  7. jcalendar
  8. rotor
  9. jquery.cycle.min

The second refresh shows the same order except it's missing rotor and jquery.cycle.min.

So, it's not loading, but why? Could I have broken something?

br1anwarner’s picture

I can confirm the bug exists for me as well. Drupal 6, fully patched, as well as newest version of Rotor, and JQuery Update/Plugins. Just updated JQuery this morning, if that's helpful?

For what it's worth, this module is fantastic - many kudos to the developers!

tomws’s picture

Thanks for the confirmation. Please also check my edit. Sorry about that. Thought I had time to get in the extra info before someone posted. :)

tomws’s picture

More tests. The rotor.css file isn't getting loaded either. Looking through the .module, the css, js, and jquery_plugin_add are all in the theme_rotor_block function (line 470).

Dropping a die() after the first if statement there, and clearing the Drupal cache, the page dies on the first refresh. I removed the die() to get the page to load, and then re-inserted it and refreshed the page again. Page loads broken same as before. So, something is wrong with the $items array on subsequent page loads, yes? I'm still a Drupal noob, so I don't know where that param is coming from.

mrfelton’s picture

I'm sorry your having trouble with this. I'll try and get to the bottom of it...

Please can you disable imagecache and test again. Also, do you have page caching enabled? or css or JavaScript Optimisation? (you can find all these in Site Configuration -> Performance.

mrfelton’s picture

Assigned: Unassigned » mrfelton
tomws’s picture

Thanks for the response. Disabling Imagecache didn't change anything.

Page compression has been disabled from the start. Same for CSS optimization and JavaScript optimization. And I've had caching mode disabled for the duration of testing. It's usually on normal.

However, block cache has been enabled the whole time. Don't know how I overlooked that one to test. Anyway, I disabled it (with Imagecache enabled again and everything else still disabled) and the rotor works for anon and auth users. Re-enabling it causes the problem to re-appear for both anon and auth users.

mrfelton’s picture

Status: Active » Fixed

Please try latest from CVS (or wait a few hours for the next dev snapshot to be released). I'm pretty sure I have it fixed. I also added severl new effects while I was at it! :) Let me know how it goes.

tomws’s picture

Thanks for your work, mrfelton. I'll give it a shot later this evening.

tomws’s picture

Version: 6.x-1.4 » 6.x-1.x-dev
Category: support » bug
Status: Fixed » Active

Hi, again, mrfelton. I've tested a bit more with the dev version and still have the same problem: the rotor.js appears to not be loading for non-admin users on subsequent page loads. It looks like it works fine as long as the block cache is disabled, but enabling it (marked as recommended) breaks it again.

I've taken the liberty of changing this back to active and converting it to a bug report. I'd appreciate it if others can confirm they're seeing the same problem so I'll know I'm not entirely crazy or suffering from browser cache problems instead.

tomws’s picture

Here's what I'm looking at. Maybe someone can suggest whether I'm thinking correctly, or if I'm actually seeing what I think I'm seeing.

I cleared the Drupal cache and refreshed a page. The block shows works. I refresh again and the block breaks as described previously. Now, to test whether the block caching is indeed to blame, I modified the rotor_block_content() function in the new dev module:

function rotor_block_content() {
  $limit = variable_get('rotor_max_items', 3);
  $random = variable_get('rotor_random_items', 0)? "ORDER BY RAND()" : "";
  $items = array();
  $result = db_query("SELECT nid FROM {node} WHERE type = 'rotor_item' $random LIMIT %d", $limit);
  if ($result) {
    while ($node = db_fetch_array($result)) {
      $items[] = node_load($node);
    }
    drupal_add_css(drupal_get_path('module', 'rotor') .'/rotor.css');
    _rotor_setup_js();
    die("HERE");
    return theme('rotor_block', $items);
  }
}

The only difference is the die(). Now if this function is named intuitively and is where Drupal gets the block content (and loads the javascript, css, etc, according to above), then page loading should die on each subsequent pass after the modification above, yes? But it doesn't. It loads broken, same as before. I know the die() works, too, because if I clear the cache and hit the page again with the die still in place, the page load dies with my message.

I haven't tested it yet, but I'm betting that if I disable the block cache and play with the die(), it'll die every time it's uncommented.

Am I also correct that block cache is new with Drupal 6? That is, it's new in the sense that it's integrated now rather than an add-on?

mrfelton’s picture

ok. new attempt at fix in CVS - this one must do it! Let me know...

tomws’s picture

No luck here, mrfelton. I had also tried setting the cache param under the list case this afternoon and was surprised it didn't work as advertised. I'm looking for more information on the block cache, but it's slow in coming. Think it could be a bug on that side?

For reference, here's the test site: http://arctest.eapdd.com/

The rotor is the 2007 Platinum Sponsors block. If it's not broken, I've most likely just cleared the cache. A refresh should generate a broken block.

tomws’s picture

Related material: http://pingv.com/blog/john-fiala/2008/drupal-6-blocks-need-extra-conside...

Be sure to check the comments to links.

tomws’s picture

Possibly fixed after all! One of the links through that blog posting trails back to a discussion in the block module list about this exact problem. I checked the mentioned blocks table in the db and found that the cache value for rotor under the theme I'm using was still at 1 instead of -1 for BLOCK_NO_CACHE. A manual change looks like it fixes the problem for non-admin users.

Since I didn't do it before, I'm going to completely uninstall and re-install to see if it picks up the cache param as it should. Will report back.

tomws’s picture

Don't know if I should submit a new bug for this one:

Fatal error: Call to undefined function _rotor_get_node_list() in /var/www/drupal-6.6_arctest.eapdd.com/sites/default/modules/rotor/rotor.module on line 312

tomws’s picture

Fixed that one with a function rename to rotor_get_all_items(), but now I'm unable to add rotor-item nodes past the first one, and can't edit that one. Screen blanks like a php error, but I get nothing in logs. The rest of the site works fine.

EDIT: Had to go to the generic Apache error log. Found this when attempting to visit node/add/rotor-item:
[Sun Dec 07 21:46:56 2008] [notice] child pid 11149 exit signal Segmentation fault (11)

I'll poke around a bit more, but may roll back to the stable version and add in the BLOCK_NO_CACHE there for testing.

tomws’s picture

It looks like adding the no cache line ('cache' => BLOCK_NO_CACHE,) to line 91 of stable version 1.4 works. Authenticated users now get the javascript to load each time so the rotor functions as expected. It also works for anon users, though the randomization appears absent. I'm betting that's page caching coming into play for them, though, since I just turned it back on.

I'm going to run with the modified stable version for this test site, but may set up a clone to tinker with the dev version and work on finding those bugs.

mrfelton’s picture

ok. my bad - That call to _rotor_get_node_list() shouldn't even be in there at all - it was left over from some other development I was trying to do (ability reference existing nodes in rotor block).

Please try CVS now.

tomws’s picture

Status: Active » Fixed

Apologies for the delay. Finishing up some other work.

I just cloned into a test site and downloaded the latest dev snapshot. Looks like it works now. Caching issue appears to be fixed, as well as a couple of other hard errors with the dev version that prevented me from working with it a couple of days ago.

There are a few problems specific to some of the transition effects in the new version, but I'll submit a separate bug report for those. Many thanks for your help!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.

dmN86’s picture

I've got the same problem, is there a fixed version?

mrfelton’s picture

Are you using the latest development snapshot?

dmN86’s picture

I try 6.x-1.4 and 6.x-1.x-dev.
In 6.x-2.x-dev i got error after enabling the module (cannot add item, no images, etc) :/

[Query plugins (enabled), Views UI (enabled), Views (enabled)]

"user warning: Unknown column 'link_target' in 'field list' query: SELECT file_path AS rotor_image, alt_text, url, link_target FROM drupalrotor_item WHERE nid = 126 in ...modules/rotor/rotor.module on line 203."

EDIT:

After reinstalaton everything works fine, sorry for taking your time :X

Thank you so much for help.

mrfelton’s picture

That error looks like you didn't run update.php after updating the module. Howeverm its probably best to stick with 6.x-1.x-dev for now. 6.x-2.x-dev is still in early stages of dev. Please try uninstalling the module and then reinstall 6.x-1.x-dev.

mrfelton’s picture

ah, you already did... good stuff.