? 992726-jcarousel-drupal7.patch ? includes/jcarousel-view.tpl.php Index: jcarousel.info =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jcarousel/Attic/jcarousel.info,v retrieving revision 1.2.2.2.2.1 diff -u -p -r1.2.2.2.2.1 jcarousel.info --- jcarousel.info 28 Nov 2010 00:04:15 -0000 1.2.2.2.2.1 +++ jcarousel.info 3 Feb 2011 13:22:26 -0000 @@ -3,3 +3,7 @@ name = jCarousel description = Create jQuery-based carousel rotators. package = User interface core = 7.x + +files[] = jcarousel.module +files[] = includes/jcarousel.views.inc +files[] = includes/jcarousel_style_plugin.inc Index: includes/jcarousel.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/jcarousel/includes/Attic/jcarousel.views.inc,v retrieving revision 1.1.2.2.2.4 diff -u -p -r1.1.2.2.2.4 jcarousel.views.inc --- includes/jcarousel.views.inc 20 Dec 2010 17:56:27 -0000 1.1.2.2.2.4 +++ includes/jcarousel.views.inc 3 Feb 2011 13:22:27 -0000 @@ -72,8 +72,8 @@ function jcarousel_views_ajax() { // TODO: $view->pager doesn't even exist in Views 3, yet it seems to // fix the Views 3 handling. Find the "official" approach here. - $view->pager['offset'] = $first; - $view->pager['items_per_page'] = $last - $first; + $view->offset = $first; + $view->items_per_page = $last - $first; } // Reuse the same DOM id so it matches that in Drupal.settings. @@ -115,15 +115,7 @@ function jcarousel_views_add($view, $dis } } - // Get the total number of items in this view. - $count_query = $view->build_info['count_query']; - $replacements = module_invoke_all('views_query_substitutions', $view); - $count_query = str_replace(array_keys($replacements), $replacements, $count_query); - $result = db_query($count_query, $view->build_info['query_args']); - $count = 0; - while ($row = db_fetch_array($result)) { - $count++; - } + $count = count($view->result); // If there is just one item disable the auto-scroll and rotation. if ($count == 1) { @@ -134,32 +126,27 @@ function jcarousel_views_add($view, $dis // If using AJAX, adjust the view's positioning based on the current page. if ($view->use_ajax) { $options['ajax'] = TRUE; - - $use_pager = $view->pager['use_pager']; - $view->pager['use_pager'] = TRUE; $view->build($display_id); - $options['size'] = $count; - $view->pager['use_pager'] = $use_pager; // If starting in the middle of a view, initialize the carousel at that // position. Strangely the carousel must pre-load empty LI items all the way // up until the active item, making this inefficient for large lists. - if ($view->pager['use_pager'] && $view->pager['current_page']) { + if ($view->current_page) { // TODO: Pagers and carousels do not work well together. jCarousel should // give items the class "jcarousel-item-[offset]", but instead it always // starts with "1", making it impossible to define a prepopulated list // as the middle of an AJAX view. - $options['start'] = ($view->pager['current_page'] * $view->pager['items_per_page']) + ($view->pager['offset'] + 1); - $options['offset'] = ($view->pager['current_page'] * $view->pager['items_per_page']) + ($view->pager['offset'] + 1); + $options['start'] = ($view->current_page * $view->items_per_page) + ($view->offset + 1); + $options['offset'] = ($view->current_page * $view->items_per_page) + ($view->offset + 1); } - elseif ($view->pager['offset']) { - $options['start'] = $view->pager['offset'] + 1; - $options['offset'] = $view->pager['offset'] + 1; + if ($view->offset) { + $options['start'] = $view->offset + 1; + $options['offset'] = $view->offset + 1; } } - $identifier = views_css_safe('jcarousel_view__' . $view->name . '__' . $display_id); + $identifier = drupal_clean_css_identifier('jcarousel_view__' . $view->name . '__' . $display_id); return jcarousel_add($identifier, $options); } @@ -174,7 +161,7 @@ function template_preprocess_jcarousel_v $options = $view->style_options; $variables['jcarousel_classes_array'] = array( 'jcarousel', - views_css_safe('jcarousel-view--' . $view->name . '--' . $display_id), + drupal_clean_css_identifier('jcarousel-view--' . $view->name . '--' . $display_id), ); if ($options['skin']) { $variables['jcarousel_classes_array'][] = 'jcarousel-skin-' . $options['skin']; @@ -183,7 +170,7 @@ function template_preprocess_jcarousel_v // Give each item a class to identify where in the carousel it belongs. foreach ($variables['rows'] as $id => $row) { - $variables['classes'][$id] = 'jcarousel-item-' . ($id + 1 + $view->pager['offset']); + $variables['classes'][$id] = 'jcarousel-item-' . ($id + 1 + $view->offset); } }