? .DS_Store ? 991708-rewrite_api-6.patch ? 991708-rewrite_api.patch ? theme ? views_slideshow.api.php.txt ? contrib/.DS_Store ? contrib/views_slideshow_cycle/.DS_Store ? contrib/views_slideshow_cycle/theme/.DS_Store ? js/views_slideshow.js Index: views_slideshow.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/views_slideshow.module,v retrieving revision 1.11.2.2.2.12.2.1 diff -u -p -r1.11.2.2.2.12.2.1 views_slideshow.module --- views_slideshow.module 20 Apr 2010 22:04:17 -0000 1.11.2.2.2.12.2.1 +++ views_slideshow.module 15 Dec 2010 13:33:24 -0000 @@ -13,7 +13,59 @@ function views_slideshow_theme($existing return array( 'views_slideshow_main_section' => array( 'arguments' => array('id' => NULL, 'hidden_elements' => NULL, 'plugin' => NULL), - 'file' => 'views_slideshow.theme.inc', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_pager_widget_render' => array( + 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_pager_fields_render' => array( + 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'settings' => array(), 'attributes' => array(), 'location' => NULL), + 'template' => 'theme/views-slideshow-pager-field', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_pager_field_field' => array( + 'arguments' => array('view' => NULL, 'field' => NULL, 'count' => NULL), + 'template' => 'theme/views-slideshow-pager-field-field', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_pager_field_item' => array( + 'arguments' => array('item' => NULL, 'vss_id' => NULL, 'count' => NULL), + 'template' => 'theme/views-slideshow-pager-field-item', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_controls_widget_render' => array( + 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_controls' => array( + 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), + 'template' => 'theme/views-slideshow-controls', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_controls_previous' => array( + 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), + 'template' => 'theme/views-slideshow-controls-previous', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_controls_pause' => array( + 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), + 'template' => 'theme/views-slideshow-controls-pause', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_controls_next' => array( + 'arguments' => array('vss_id' => '', 'view' => NULL, 'settings' => array()), + 'template' => 'theme/views-slideshow-controls-next', + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_slide_counter_widget_render' => array( + 'arguments' => array('vss_id' => NULL, 'view' => NULL, 'rows' => array(), 'settings' => array(), 'location' => NULL), + 'file' => 'theme/views_slideshow.theme.inc', + ), + 'views_slideshow_slide_counter' => array( + 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), + 'template' => 'theme/views-slideshow-slide-counter', + 'file' => 'theme/views_slideshow.theme.inc', ), ); } @@ -44,12 +96,176 @@ function views_slideshow_help($path, $ar } /** - * Views Slideshow: preprocess function for the slideshow. + * Implements hook_init(). + */ +function views_slideshow_init() { + // Load javascript on the page in init to help fool caching. + drupal_add_js(drupal_get_path('module', 'views_slideshow') . '/js/views_slideshow.js'); +} + +function views_slideshow_views_slideshow_js_method_register() { + return array( + 'views_slideshow_pager_fields', + 'views_slideshow_controls', + 'views_slideshow_slide_counter', + ); +} + +/** + * Implementation of hook_views_slideshow_skins(). */ -function template_preprocess_views_slideshow(&$vars) { - $options = $vars['options']; - if (in_array($options['mode'], array('singleframe', 'thumbnailhover', 'menu', 'ddblock', 'slider'))) { - $options['mode'] = 'views_slideshow_' . $options['mode']; +function views_slideshow_views_slideshow_skins() { + return array( + 'default' => array( + 'title' => t('Default'), + ), + ); +} + +/** + * Implements hook_views_slideshow_widget_info(). + */ +function views_slideshow_views_slideshow_widget_info() { + return array( + 'views_slideshow_pager' => 'Pager', + 'views_slideshow_controls' => 'Controls', + 'views_slideshow_slide_counter' => 'Slide Counter', + ); +} + +/** + * Implements [widget]_views_slideshow_widget_form_options(). + */ +function views_slideshow_pager_views_slideshow_widget_form_options(&$form, $form_state, $view, $defaults, $dependency) { + // Get all the pager info from other modules. + // hook_views_slideshow_pager_settings($view, $option_values, $dependency_prefix) + $pagers = module_invoke_all('views_slideshow_pager_settings', $view, $defaults, $dependency . '-type'); + + if (!empty($pagers)) { + // Prep the pager options and the fields + foreach ($pagers as $pager_key => $pager_info) { + $pager_options[$pager_key] = $pager_info['title']; + if (isset($pager_info['fields'])) { + foreach ($pager_info['fields'] as $pager_field_key => $pager_field) { + $pager_field['#dependency'][$dependency . '-enable'] = array(1); + $pager_field['#dependency'][$dependency . '-type'] = array($pager_key); + $pager_field['#dependency_count'] = count($pager_field['#dependency']); + if (!isset($pager_field['#process']) || !in_array('views_process_dependency', $pager_field['#process'])) { + $pager_field['#process'][] = 'views_process_dependency'; + } + + if ($pager_field['#type'] == 'checkboxes' || $pager_field['#type'] == 'checkbox') { + $old_prefix = ''; + if (isset($pager_field['#prefix'])) { + $old_prefix = $pager_field['#prefix']; + } + $pager_field['#prefix'] = '
' . $old_prefix; + + $old_suffix = ''; + if (isset($pager_field['#suffix'])) { + $old_suffix = $pager_field['#suffix']; + } + $pager_field['#suffix'] = $old_suffix . '
'; + } + + $pager_fields[$pager_field_key] = $pager_field; + } + } + } + asort($pager_options); + + // Create the widget type field. + $form['type'] = array( + '#type' => 'select', + '#title' => t('Pager Type'), + '#description' => t('Style of the pager'), + '#default_value' => $defaults['type'], + '#options' => $pager_options, + '#process' => array('views_process_dependency'), + '#dependency' => array($dependency . '-enable' => array(1)), + ); + + // Add user defined pager fields to the form. + $form = array_merge($form, $pager_fields); + + } + else { + $form['enable_pager'] = array( + '#value' => 'There are no pagers available.', + ); } - $vars['slideshow'] = theme($options['mode'], $vars['view'], $options, $vars['rows'], $vars['title']); } + +/** + * Implementation of hook_views_slideshow_pager_settings + */ +function views_slideshow_views_slideshow_pager_settings($view, $defaults, $dependency_prefix) { + // Settings for fields pager. + // First verfiy that the view is using fields. + if ($view->row_plugin->uses_fields()) { + $options = array(); + // Get each field and it's name. + foreach ($view->display->handler->get_handlers('field') as $field => $handler) { + $options[$field] = $handler->ui_name(); + } + $return_value['views_slideshow_pager_fields'] = array( + 'title' => t('Fields'), + 'fields' => array( + 'views_slideshow_pager_fields_fields' => array( + '#type' => 'checkboxes', + '#title' => t('Pager fields'), + '#options' => $options, + '#default_value' => $defaults['views_slideshow_pager_fields_fields'], + '#description' => t("Choose the fields that will appear in the pager."), + '#process' => array( + 'expand_checkboxes', + ), + ), + 'views_slideshow_pager_fields_hover' => array( + '#type' => 'checkbox', + '#title' => t('Activate Slide and Pause on Pager Hover'), + '#default_value' => $defaults['views_slideshow_pager_fields_hover'], + '#description' => t('Should the slide be activated and paused when hovering over a pager item.'), + ), + ), + ); + } + + return $return_value; +} + +/** + * Implements hook_views_slideshow_option_definition. + */ +function views_slideshow_views_slideshow_option_definition() { + + // Default slideshow type and skins + $options['slideshow_type'] = array('default' => ''); + $options['slideshow_skin'] = array('default' => ''); + + // Set default widgets and weight values. + $widgets = module_invoke_all('views_slideshow_widget_info'); + if ($widgets) { + $locations = array('top', 'bottom'); + foreach ($locations as $location) { + foreach ($widgets as $widget_id => $widget_name) { + $options['widgets']['contains'][$location]['contains'][$widget_id . '_enable'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains'][$widget_id]['contains']['weight'] = array('default' => 1); + } + } + } + + // Defaults for the pager widget. + foreach ($locations as $location) { + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['type'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_numbered_hover'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_numbered_click_to_page'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_thumbnails_hover'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_thumbnails_click_to_page'] = array('default' => 0); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_fields_fields'] = array('default' => array()); + $options['widgets']['contains'][$location]['contains']['views_slideshow_pager']['contains']['views_slideshow_pager_fields_hover'] = array('default' => 0); + } + + return $options; +} + Index: views_slideshow.views.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views_slideshow.views.inc,v retrieving revision 1.1.2.1.2.1.2.1 diff -u -p -r1.1.2.1.2.1.2.1 views_slideshow.views.inc --- views_slideshow.views.inc 20 Apr 2010 22:04:17 -0000 1.1.2.1.2.1.2.1 +++ views_slideshow.views.inc 15 Dec 2010 13:33:24 -0000 @@ -18,13 +18,13 @@ function views_slideshow_views_plugins() 'handler' => 'views_slideshow_plugin_style_slideshow', 'uses options' => TRUE, 'uses row plugin' => TRUE, - 'uses_grouping' => FALSE, + 'uses grouping' => FALSE, 'type' => 'normal', 'parent' => 'list', 'path' => drupal_get_path('module', 'views_slideshow'), 'theme' => 'views_slideshow', - 'theme path' => drupal_get_path('module', 'views_slideshow'), - 'theme file' => 'views_slideshow.theme.inc', + 'theme path' => drupal_get_path('module', 'views_slideshow') . '/theme', + 'theme file' => 'theme/views_slideshow.theme.inc', ), ), ); Index: views_slideshow_plugin_style_slideshow.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views_slideshow_plugin_style_slideshow.inc,v retrieving revision 1.1.2.1.2.9.2.5 diff -u -p -r1.1.2.1.2.9.2.5 views_slideshow_plugin_style_slideshow.inc --- views_slideshow_plugin_style_slideshow.inc 5 Oct 2010 05:45:50 -0000 1.1.2.1.2.9.2.5 +++ views_slideshow_plugin_style_slideshow.inc 15 Dec 2010 13:33:24 -0000 @@ -12,7 +12,7 @@ * @ingroup views_style_plugins */ class views_slideshow_plugin_style_slideshow extends views_plugin_style_list { - // if the view is still using the old variables replace with the new ones. + function init(&$view, &$display, $options = NULL) { // These are required for the view to continue to work. $this->view = &$view; @@ -20,45 +20,69 @@ class views_slideshow_plugin_style_slide // Overlay incoming options on top of defaults $this->unpack_options($this->options, isset($options) ? $options : $display->handler->get_option('style_options')); - if ($this->uses_row_plugin() && $display->handler->get_option('row_plugin')) { $this->row_plugin = $display->handler->get_plugin('row'); } - - // Eveything below here is what's needed for views slideshow. - if (in_array($options['mode'], array('singleframe', 'thumbnailhover', 'menu', 'slider', 'ddblock')) && is_array($options[$options['mode']])) { - foreach ($options[$options['mode']] as $index => $value) { - $this->options['views_slideshow_' . $options['mode']][$index] = $value; - } - } } // Set default options function option_definition() { - module_load_all_includes('views_slideshow.inc'); $options = parent::option_definition(); - - $options = array_merge($options, module_invoke_all('views_slideshow_option_definition')); - $options['mode'] = array('default' => ''); - - return $options; + + // Load all include files from views slideshow addons. + module_load_all_includes('views_slideshow.inc'); + + // call every module using hook_views_slideshow_option_definition and merge + // it's return value with the other default options. + return array_merge($options, module_invoke_all('views_slideshow_option_definition')); } - // Render the given style. + // Build the settings form for the view. function options_form(&$form, &$form_state) { + // load up all views slideshow modules functions. module_load_all_includes('views_slideshow.inc'); parent::options_form($form, $form_state); - $modules = module_invoke_all('views_slideshow_modes'); + // Style + $form['slideshow_skin_header'] = array( + '#value' => '

' . t('Style') . '

', + ); + + // Get a list of all available skins. + $skin_info = $this->views_slideshow_get_skins(); + foreach ($skin_info as $skin => $info) { + $skins[$skin] = $info['title']; + } + asort($skins); + + // Create the drop down box so users can choose an available skin. + $form['slideshow_skin'] = array( + '#type' => 'select', + '#title' => t('Skin'), + '#options' => $skins, + '#default_value' => $this->options['slideshow_skin'], + '#description' => t('Select the skin to use for this display. Skins allow for easily swappable layouts of things like next/prev links and thumbnails. Note that not all skins support all widgets, so a combination of skins and widgets may lead to unpredictable results in layout.'), + ); + + /** + * Slides + */ + $form['slides_header'] = array( + '#value' => '

' . t('Slides') . '

', + ); + + // Get all slideshow types. + $modules = module_invoke_all('views_slideshow_slideshow_types'); - if ($modules) { - $form['mode'] = array( + if ($modules) { + $form['slideshow_type'] = array( '#type' => 'select', - '#title' => t('Slideshow mode'), + '#title' => t('Slideshow Type'), '#options' => $modules, - '#default_value' => $this->options['mode'], + '#default_value' => $this->options['slideshow_type'], ); - foreach (module_implements('views_slideshow_options_form') as $module) { + + foreach (module_implements('views_slideshow_slideshow_type_form') as $module) { // We wrap our fieldsets in a div so we can use dependent.js to // show/hide our fieldsets. $form[$module . '-prefix'] = array( @@ -66,18 +90,18 @@ class views_slideshow_plugin_style_slide '#id' => $module . '-options-wrapper', '#prefix' => '
', '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-mode' => array($module)), + '#dependency' => array('edit-style-options-slideshow-type' => array($module)), ); - + $form[$module] = array( '#type' => 'fieldset', '#title' => t('!module options', array('!module' => $modules[$module])), '#collapsible' => TRUE, '#attributes' => array('class' => $module), ); - $function = $module .'_views_slideshow_options_form'; - call_user_func_array($function, array(&$form, &$form_state, &$this)); + $type_form = module_invoke($module, 'views_slideshow_slideshow_type_form', $form, $form_state, $this); + $form = array_merge($form, $type_form); $form[$module . '-suffix'] = array( '#value' => '
', ); @@ -85,24 +109,129 @@ class views_slideshow_plugin_style_slide } else { $form['enable_module'] = array( - '#value' => t('There is no Views Slideshow plugin enabled. Go to the !modules and enable a Views Slideshow plugin module. For example Views Slideshow Singleframe.', array('!modules' => l('Modules Page', 'admin/build/modules'))), + '#value' => t('There is no Views Slideshow plugin enabled. Go to the !modules and enable a Views Slideshow plugin module. For example Views Slideshow Cycle.', array('!modules' => l('Modules Page', 'admin/build/modules'))), ); } + + /** + * Widgets + */ + $form['widgets'] = array( + '#value' => '

' . t('Widgets') . '

', + ); + + // Loop through all locations so we can add header for each location. + $location = array('top' => t('Top'), 'bottom' => t('Bottom')); + foreach ($location as $location_id => $location_name) { + // Widget Header + $form['widgets'][$location_id]['header'] = array( + '#value' => '

' . t('!location Widgets', array('!location' => $location_name)) . '

', + ); + } + + // Get all widgets that are registered. + // If we have widgets then build it's form fields. + $widgets = module_invoke_all('views_slideshow_widget_info'); + if (!empty($widgets)) { + + // Build our weight values by number of widgets + $weights = array(); + for ($i = 1; $i <= count($widgets); $i++) { + $weights[$i] = $i; + } + + // Loop through our widgets and locations to build our form values for + // each widget. + foreach ($widgets as $widget_id => $widget_name) { + foreach ($location as $location_id => $location_name) { + $widget_dependency = 'edit-style-options-widgets-' . $location_id . '-' . str_replace('_', '-', $widget_id); + // Use Widget Checkbox + $form['widgets'][$location_id][$widget_id . '_enable'] = array( + '#type' => 'checkbox', + '#title' => t($widget_name), + '#default_value' => $this->options['widgets'][$location_id][$widget_id . '_enable'], + '#description' => t('Should a !name be rendered at the !location of the slides.', array('!name' => $widget_name, '!location' => $location_name)), + ); + + // Widget weight + // We check to see if the default value is greater than the number of + // widgets just in case a widget has been removed and the form hasn't + // hasn't been saved again. + $form['widgets'][$location_id][$widget_id]['weight'] = array( + '#type' => 'select', + '#title' => t('Weight of the !name', array('!name' => $widget_name)), + '#default_value' => ($this->options['widgets'][$location_id][$widget_id]['weight'] > count($widgets)) ? count($widgets) : $this->options['widgets'][$location_id][$widget_id]['weight'], + '#options' => $weights, + '#description' => t('Determines in what order the !name appears. A lower weight will cause the !name to be above higher weight items.', array('!name' => $widget_name)), + '#process' => array('views_process_dependency'), + '#dependency' => array($widget_dependency . '-enable' => array(1)), + ); + + // Add all the widget settings. + if (function_exists($widget_id . '_views_slideshow_widget_form_options')) { + call_user_func_array($widget_id . '_views_slideshow_widget_form_options', array($form['widgets'][$location_id][$widget_id], $form_state, $this, $this->options['widgets'][$location_id][$widget_id], $widget_dependency)); + } + } + } + } } + // Run any validation on the form settings. function options_validate(&$form, &$form_state) { module_load_all_includes('views_slideshow.inc'); + + // Call all modules that use hook_views_slideshow_options_form_validate foreach (module_implements('views_slideshow_options_form_validate') as $module) { $function = $module . '_views_slideshow_options_form_validate'; - call_user_func_array($function, array(&$form, &$form_state, &$this)); + call_user_func_array($function, array($form, $form_state, $this)); } } + // Run any necessary actions on submit. function options_submit($form, &$form_state) { module_load_all_includes('views_slideshow.inc'); + + // Call all modules that use hook_views_slideshow_options_form_submit foreach (module_implements('views_slideshow_options_form_submit') as $module) { $function = $module . '_views_slideshow_options_form_submit'; - call_user_func_array($function, array($form, &$form_state)); + call_user_func_array($function, array($form, $form_state)); + } + + // In addition to the skin, we also pre-save the definition that + // correspond to it. That lets us avoid a hook lookup on every page. + $skins = $this->views_slideshow_get_skins(); + $form_state['values']['style_options']['skin_info'] = $skins[$form_state['values']['style_options']['slideshow_skin']]; + } + + /** + * Retrieve a list of all available skins in the system. + */ + function views_slideshow_get_skins() { + static $skins; + + if (empty($skins)) { + $skins = array(); + + // Call all modules that use hook_views_slideshow_skins + foreach (module_implements('views_slideshow_skins') as $module) { + $skin_items = call_user_func($module .'_views_slideshow_skins'); + if (isset($skin_items) && is_array($skin_items)) { + foreach (array_keys($skin_items) as $skin) { + // Ensure that the definition is complete, so we don't need lots + // of error checking later. + $skin_items[$skin] += array( + 'class' => 'default', + 'title' => t('Untitled skin'), + 'module' => $module, + 'path' => '', + 'stylesheets' => array(), + ); + } + $skins = array_merge($skins, $skin_items); + } + } } + + return $skins; } } Index: contrib/views_slideshow_cycle/views_slideshow_cycle.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/Attic/views_slideshow_cycle.js,v retrieving revision 1.1.2.13 diff -u -p -r1.1.2.13 views_slideshow_cycle.js --- contrib/views_slideshow_cycle/views_slideshow_cycle.js 29 Sep 2010 03:29:45 -0000 1.1.2.13 +++ contrib/views_slideshow_cycle/views_slideshow_cycle.js 15 Dec 2010 13:33:24 -0000 @@ -13,6 +13,7 @@ Drupal.behaviors.viewsSlideshowCycle = f var fullId = '#' + $(this).attr('id'); var settings = Drupal.settings.viewsSlideshowCycle[fullId]; settings.targetId = '#' + $(fullId + " :first").attr('id'); + settings.slideshowId = settings.targetId.replace('#views_slideshow_cycle_teaser_section_', ''); settings.paused = false; settings.opts = { @@ -21,37 +22,16 @@ Drupal.behaviors.viewsSlideshowCycle = f delay:settings.delay, sync:settings.sync, random:settings.random, - pagerAnchorBuilder:function(idx, slide) { - var classes = 'pager-item pager-num-' + (idx+1); - if (idx == 0) { - classes += ' first'; - } - if ($(slide).siblings().length == idx) { - classes += ' last'; - } - - if (idx % 2) { - classes += ' odd'; - } - else { - classes += ' even'; - } - - // Call the theme function for the pager. - var theme = 'viewsSlideshowPager' + settings.pager_type; - return Drupal.theme.prototype[theme] ? Drupal.theme(theme, classes, idx, slide, settings) : ''; - }, - allowPagerClickBubble:(settings.pager_hover), - prev:(settings.controls != 0)?'#views_slideshow_cycle_prev_' + settings.vss_id:null, - next:(settings.controls != 0)?'#views_slideshow_cycle_next_' + settings.vss_id:null, - pager:(settings.pager != 0)?'#views_slideshow_cycle_pager_' + settings.vss_id:null, nowrap:settings.nowrap, after:function(curr, next, opts) { - // Used for Slide Counter. - if (settings.slide_counter) { - $('#views_slideshow_cycle_slide_counter_' + settings.vss_id + ' span.num').html(opts.currSlide + 1); - $('#views_slideshow_cycle_slide_counter_' + settings.vss_id + ' span.total').html(opts.slideCount); + // Need to do some special handling on first load. + var slideNum = opts.currSlide; + if (typeof settings.processedAfter == 'undefined' || !settings.processedAfter) { + settings.processedAfter = 1; + slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide; } + + viewsSlideshowTransitionEnd(settings.slideshowId, '', slideNum); }, before:function(curr, next, opts) { // Remember last slide. @@ -66,10 +46,18 @@ Drupal.behaviors.viewsSlideshowCycle = f //set the container's height to that of the current slide $(this).parent().animate({height: $ht}); } + + // Need to do some special handling on first load. + var slideNum = opts.nextSlide; + if (typeof settings.processedBefore == 'undefined' || !settings.processedBefore) { + settings.processedBefore = 1; + slideNum = (typeof settings.opts.startingSlide == 'undefined') ? 0 : settings.opts.startingSlide; + } + + viewsSlideshowTransitionBegin(settings.slideshowId, '', slideNum); }, cleartype:(settings.cleartype)? true : false, - cleartypeNoBg:(settings.cleartypenobg)? true : false, - activePagerClass:'active-slide' + cleartypeNoBg:(settings.cleartypenobg)? true : false } // Set the starting slide if we are supposed to remember the slide @@ -106,8 +94,8 @@ Drupal.behaviors.viewsSlideshowCycle = f // Pause on clicking of the slide. if (settings.pause_on_click) { - $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() { - viewsSlideshowCyclePause(settings); + $('#views_slideshow_cycle_teaser_section_' + settings.vss_id).click(function() { + viewsSlideshowPause(settings.slideshowId, ''); }); } @@ -306,7 +294,7 @@ Drupal.behaviors.viewsSlideshowCycle = f // Start Paused if (settings.start_paused) { - viewsSlideshowCyclePause(settings); + viewsSlideshowPause(settings.slideshowId, ''); } // Pause if hidden. @@ -317,10 +305,10 @@ Drupal.behaviors.viewsSlideshowCycle = f // pause it. var visible = viewsSlideshowCycleIsVisible(settings.targetId, settings.pause_when_hidden_type, settings.amount_allowed_visible); if (visible && settings.paused) { - viewsSlideshowCycleResume(settings); + viewsSlideshowPlay(settings.slideshowId, ''); } else if (!visible && !settings.paused) { - viewsSlideshowCyclePause(settings); + viewsSlideshowPause(settings.slideshowId, ''); } } @@ -334,101 +322,23 @@ Drupal.behaviors.viewsSlideshowCycle = f checkPause(settings); }); } - - // Show image count for people who have js enabled. - $('#views_slideshow_cycle_image_count_' + settings.vss_id).show(); - - if (settings.controls != 0) { - // Show controls for people who have js enabled browsers. - $('#views_slideshow_cycle_controls_' + settings.vss_id).show(); - - $('#views_slideshow_cycle_playpause_' + settings.vss_id).click(function(e) { - if (settings.paused) { - viewsSlideshowCycleResume(settings); - } - else { - viewsSlideshowCyclePause(settings); - } - e.preventDefault(); - }); - } }); } -// Pause the slideshow -viewsSlideshowCyclePause = function (settings) { - // Make Resume translatable - var resume = Drupal.t('Resume'); - - $(settings.targetId).cycle('pause'); - if (settings.controls != 0) { - $('#views_slideshow_cycle_playpause_' + settings.vss_id) - .addClass('views_slideshow_cycle_play') - .addClass('views_slideshow_play') - .removeClass('views_slideshow_cycle_pause') - .removeClass('views_slideshow_pause') - .text(resume); - } - settings.paused = true; -} - -// Resume the slideshow -viewsSlideshowCycleResume = function (settings) { - // Make Pause translatable - var pause = Drupal.t('Pause'); - - $(settings.targetId).cycle('resume'); - if (settings.controls != 0) { - $('#views_slideshow_cycle_playpause_' + settings.vss_id) - .addClass('views_slideshow_cycle_pause') - .addClass('views_slideshow_pause') - .removeClass('views_slideshow_cycle_play') - .removeClass('views_slideshow_play') - .text(pause); - } - settings.paused = false; +views_slideshow_cycle_viewsSlideshowPause = function (slideshowID) { + $('#views_slideshow_cycle_teaser_section_' + slideshowID).cycle('pause'); } -// Theme the thumbnails type pager. -Drupal.theme.prototype.viewsSlideshowPagerthumbnails = function (classes, idx, slide, settings) { - var href = '#'; - if (settings.thumbnails_pager_click_to_page) { - href = $(slide).find('a').attr('href'); - } - var img = $(slide).find('img') - return '
' + $(img).attr('alt') + '
'; +views_slideshow_cycle_viewsSlideshowPlay = function (slideshowID) { + $('#views_slideshow_cycle_teaser_section_' + slideshowID).cycle('resume'); } -// Make some adjustments for thumbnails pagers. -function viewsSlideshowCyclePagerthumbnailsSettingsAlter(settings) { - if (settings.thumbnails_pager_click_to_page) { - settings.opts.allowPagerClickBubble = true; - settings.opts.pagerEvent = "mouseover"; - } - return settings; -} - -// Theme the numbered type pager. -Drupal.theme.prototype.viewsSlideshowPagernumbered = function (classes, idx, slide, settings) { - var href = '#'; - if (settings.numbered_pager_click_to_page) { - href = $(slide).find('a').attr('href'); - } - return '
' + (idx+1) + '
'; -} - -// Make some adjustments for numbered pagers. -function viewsSlideshowCyclePagernumberedSettingsAlter(settings) { - if (settings.numbered_pager_click_to_page) { - settings.opts.allowPagerClickBubble = true; - settings.opts.pagerEvent = "mouseover"; - } - return settings; +views_slideshow_cycle_viewsSlideshowPreviousSlide = function (slideshowID) { + $('#views_slideshow_cycle_teaser_section_' + slideshowID).cycle('prev'); } -// Theme the fields type pager. -Drupal.theme.prototype.viewsSlideshowPagerfields = function (classes, idx, slide, settings) { - return '#views_slideshow_cycle_div_pager_item_' + settings.vss_id + '_' + idx; +views_slideshow_cycle_viewsSlideshowNextSlide = function (slideshowID) { + $('#views_slideshow_cycle_teaser_section_' + slideshowID).cycle('next'); } // Verify that the value is a number. Index: contrib/views_slideshow_cycle/views_slideshow_cycle.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/Attic/views_slideshow_cycle.module,v retrieving revision 1.1.2.6 diff -u -p -r1.1.2.6 views_slideshow_cycle.module --- contrib/views_slideshow_cycle/views_slideshow_cycle.module 29 Sep 2010 03:07:49 -0000 1.1.2.6 +++ contrib/views_slideshow_cycle/views_slideshow_cycle.module 15 Dec 2010 13:33:24 -0000 @@ -40,62 +40,8 @@ function views_slideshow_cycle_theme($ex 'template' => 'theme/views-slideshow-cycle', 'file' => 'theme/views_slideshow_cycle.theme.inc', ), - 'views_slideshow_cycle_controls' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-controls', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_control_previous' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-control-previous', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_control_pause' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-control-pause', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_control_next' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-control-next', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager_numbered' => array( - 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-pager-numbered', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager_thumbnails' => array( - 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-pager-thumbnails', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager_field' => array( - 'arguments' => array('view' => NULL, 'attributes' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-pager-field', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager_field_field' => array( - 'arguments' => array('view' => NULL, 'field' => NULL, 'count' => NULL), - 'template' => 'theme/views-slideshow-cycle-pager-field-field', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_pager_field_item' => array( - 'arguments' => array('item' => NULL, 'vss_id' => NULL, 'count' => NULL), - 'template' => 'theme/views-slideshow-cycle-pager-field-item', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), - 'views_slideshow_cycle_slide_counter' => array( - 'arguments' => array('vss_id' => '', 'view' => NULL, 'options' => array()), - 'template' => 'theme/views-slideshow-cycle-slide-counter', - 'file' => 'theme/views_slideshow_cycle.theme.inc', - ), 'views_slideshow_cycle_main_frame' => array( - 'arguments' => array('view' => NULL, 'rows' => NULL, 'vss_id' => NULL, 'mode' => NULL), + 'arguments' => array('view' => NULL, 'settings' => NULL, 'rows' => NULL, 'vss_id' => NULL, 'mode' => NULL), 'template' => 'theme/views-slideshow-cycle-main-frame', 'file' => 'theme/views_slideshow_cycle.theme.inc', ), @@ -128,13 +74,8 @@ function views_slideshow_cycle_help($pat } } -/** - * Implementation of hook_views_cycle_skins(). - */ -function views_slideshow_cycle_views_slideshow_cycle_skins() { - $skins['default'] = array( - 'title' => t('Default'), +function views_slideshow_cycle_views_slideshow_js_method_register() { + return array( + 'views_slideshow_cycle', ); - - return $skins; } Index: contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/Attic/views_slideshow_cycle.views_slideshow.inc,v retrieving revision 1.1.2.14 diff -u -p -r1.1.2.14 views_slideshow_cycle.views_slideshow.inc --- contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc 5 Oct 2010 05:45:50 -0000 1.1.2.14 +++ contrib/views_slideshow_cycle/views_slideshow_cycle.views_slideshow.inc 15 Dec 2010 13:33:24 -0000 @@ -6,7 +6,7 @@ * The default options available with Views Slideshow: cycle. */ -function views_slideshow_cycle_views_slideshow_modes() { +function views_slideshow_cycle_views_slideshow_slideshow_types() { $options = array( 'views_slideshow_cycle' => t('Cycle'), ); @@ -39,18 +39,6 @@ function views_slideshow_cycle_views_sli 'fixed_height' => array('default' => 1), 'items_per_slide' => array('default' => 1), - // Pager and Controls - 'pager' => array('default' => 0), - 'pager_type' => array('default' => 'numbered'), - 'pager_fields' => array('default' => array()), - 'pager_hover' => array('default' => 0), - 'pager_click_to_page' => array('default' => 0), - 'pager_weight' => array('default' => 1), - 'controls' => array('default' => 0), - 'controls_weight' => array('default' => 1), - 'slide_counter' => array('default' => 0), - 'slide_counter_weight' => array('default' => 1), - // Internet Explorer Tweaks 'cleartype' => array('default' => 'true'), 'cleartypenobg' => array('default' => 'false'), @@ -164,29 +152,7 @@ function views_slideshow_cycle_views_sli return $options; } -function views_slideshow_cycle_views_slideshow_options_form(&$form, &$form_state, &$view) { - - // Style - $form['views_slideshow_cycle']['style'] = array( - '#value' => '

' . t('Style') . '

', - ); - - // Get a list of all available stylesheet plugins. - $skin_info = views_slideshow_cycle_get_skins(); - foreach ($skin_info as $skin => $info) { - $skins[$skin] = $info['title']; - } - asort($skins); - - // And now our own form additions. - $form['views_slideshow_cycle']['skin'] = array( - '#type' => 'select', - '#title' => t('Skin'), - '#options' => $skins, - '#default_value' => $view->options['views_slideshow_cycle']['skin'], - '#description' => t('Select the skin to use for this display. Skins allow for easily swappable layouts of things like next/prev links and thumbnails. Note that not all skins support thumbnails, so mis-matching skins and thumbnails may lead to unpredictable results.'), - ); - +function views_slideshow_cycle_views_slideshow_slideshow_type_form($form, $form_state, $view) { // Transition $form['views_slideshow_cycle']['transition'] = array( '#value' => '

' . t('Transition') . '

', @@ -399,123 +365,6 @@ function views_slideshow_cycle_views_sli '#dependency' => array('edit-style-options-views-slideshow-cycle-action-advanced' => array(1)), ); - // Pager and Controls - $form['views_slideshow_cycle']['pager_and_controls'] = array( - '#value' => '

' . t('Pager and Controls') . '

', - ); - $form['views_slideshow_cycle']['pager'] = array( - '#type' => 'select', - '#title' => t('Pager'), - '#options' => array( - 0 => t('None'), - 'top' => t('Top'), - 'bottom' => t('Bottom'), - ), - '#default_value' => $view->options['views_slideshow_cycle']['pager'], - '#description' => t('Determine if a pager should appear and if so whether they should appear before or after the slideshow.'), - ); - - // Get all the pager info from other modules. - // hook_views_slideshow_pager_settings($view, $option_values, $dependency_prefix) - $pagers = module_invoke_all('views_slideshow_cycle_pager_settings', $view, $view->options['views_slideshow_cycle'], 'edit-style-options-views-slideshow-cycle-pager'); - - // Prep the pager options and the fields - $options = array(); - $pager_fields = array(); - foreach ($pagers as $pager_key => $pager_info) { - $options[$pager_key] = $pager_info['title']; - if (isset($pager_info['fields'])) { - foreach ($pager_info['fields'] as $pager_field_key => $pager_field) { - $pager_field['#dependency']['edit-style-options-views-slideshow-cycle-pager'] = array('top', 'bottom'); - $pager_field['#dependency']['edit-style-options-views-slideshow-cycle-pager-type'] = array($pager_key); - $pager_field['#dependency_count'] = count($pager_field['#dependency']); - if (!isset($pager_field['#process']) || !in_array('views_process_dependency', $pager_field['#process'])) { - $pager_field['#process'][] = 'views_process_dependency'; - } - - $pager_fields[$pager_field_key] = $pager_field; - } - } - } - - // Sort the options alphabetically. - asort($options); - $form['views_slideshow_cycle']['pager_type'] = array( - '#type' => 'select', - '#title' => t('Pager Type'), - '#options' => $options, - '#default_value' => $view->options['views_slideshow_cycle']['pager_type'], - '#description' => t('Style of the pager.'), - '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')), - ); - - // Add user defined pager fields to the form. - $form['views_slideshow_cycle'] = array_merge($form['views_slideshow_cycle'], $pager_fields); - - $form['views_slideshow_cycle']['pager_hover'] = array( - '#type' => 'checkbox', - '#title' => t('Activate Slide and Pause on Pager Hover'), - '#default_value' => $view->options['views_slideshow_cycle']['pager_hover'], - '#description' => t('Should the slide be activated and paused when hovering over a pager item.'), - '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')), - ); - - $weights = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5); - $form['views_slideshow_cycle']['pager_weight'] = array( - '#type' => 'select', - '#title' => t('Weight of the Pager'), - '#options' => $weights, - '#default_value' => $view->options['views_slideshow_cycle']['pager_weight'], - '#description' => t('Determines in what order the pager appears. A lower weight will cause the pager to be above higher weight items.'), - '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-views-slideshow-cycle-pager' => array('top', 'bottom')), - ); - - $form['views_slideshow_cycle']['controls'] = array( - '#type' => 'select', - '#title' => t('Controls'), - '#options' => array( - 0 => t('None'), - 'top' => t('Top'), - 'bottom' => t('Bottom'), - ), - '#default_value' => $view->options['views_slideshow_cycle']['controls'], - '#description' => t('Determine if controls for the slideshow (start/stop/next/previous) should appear, and if so whether they should appear before or after the slideshow.'), - ); - $form['views_slideshow_cycle']['controls_weight'] = array( - '#type' => 'select', - '#title' => t('Weight of the Controls'), - '#options' => $weights, - '#default_value' => $view->options['views_slideshow_cycle']['controls_weight'], - '#description' => t('Determines in what order the controls appear. A lower weight will cause the controls to be above higher weight items.'), - '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-views-slideshow-cycle-controls' => array('top', 'bottom')), - ); - - $form['views_slideshow_cycle']['slide_counter'] = array( - '#type' => 'select', - '#title' => t('Slide Counter'), - '#options' => array( - 0 => t('None'), - 'top' => t('Top'), - 'bottom' => t('Bottom'), - ), - '#default_value' => $view->options['views_slideshow_cycle']['slide_counter'], - '#description' => t('Determine if the Slide Counter (1 of 4) should be displayed and if so whether they should appear before or after the slideshow.'), - ); - - $form['views_slideshow_cycle']['slide_counter_weight'] = array( - '#type' => 'select', - '#title' => t('Weight of the Slide Counter'), - '#options' => $weights, - '#default_value' => $view->options['views_slideshow_cycle']['slide_counter_weight'], - '#description' => t('Determines in what order the slide counter appears. A lower weight will cause the slide counter to be above higher weight items.'), - '#process' => array('views_process_dependency'), - '#dependency' => array('edit-style-options-views-slideshow-cycle-slide-counter' => array('top', 'bottom')), - ); - // Internet Explorer Tweaks $form['views_slideshow_cycle']['ie_tweaks'] = array( '#value' => '

' . t('Internet Explorer Tweaks') . '

', @@ -626,63 +475,7 @@ function views_slideshow_cycle_views_sli ), ); } -} - -/** - * Implementation of hook_views_slideshow_cycle_pager_settings - */ -function views_slideshow_cycle_views_slideshow_cycle_pager_settings($view, $option_values, $dependency_prefix) { - // Settings for Numbered Pager - $return_value['numbered'] = array( - 'title' => t('Numbered'), - 'fields' => array( - 'numbered_pager_click_to_page' => array( - '#type' => 'checkbox', - '#title' => t('Make Pager Linked to Slide Link'), - '#default_value' => $option_values['numbered_pager_click_to_page'], - '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'), - ), - ), - ); - - // Settings for Thumbnails pager. - $return_value['thumbnails'] = array( - 'title' => t('Thumbnails'), - 'fields' => array( - 'thumbnails_pager_click_to_page' => array( - '#type' => 'checkbox', - '#title' => t('Make Pager Linked to Slide Link'), - '#default_value' => $option_values['thumbnails_pager_click_to_page'], - '#description' => t('Should the pager use the main frame link so when it is clicked it goes to the same url that the main frame goes to when clicked.'), - ), - ), - ); - - if ($view->row_plugin->uses_fields()) { - $options = array(); - foreach ($view->display->handler->get_handlers('field') as $field => $handler) { - $options[$field] = $handler->ui_name(); - } - $return_value['fields'] = array( - 'title' => t('Fields'), - 'fields' => array( - 'pager_fields' => array( - '#type' => 'checkboxes', - '#title' => t('Pager fields'), - '#options' => $options, - '#default_value' => $option_values['pager_fields'], - '#description' => t("Choose the fields that will appear in the pager."), - '#prefix' => '
', - '#process' => array( - 'expand_checkboxes', - ), - '#suffix' => '
', - ), - ), - ); - } - - return $return_value; + return $form; } function views_slideshow_cycle_views_slideshow_options_form_validate(&$form, &$form_state, &$view) { @@ -696,39 +489,3 @@ function views_slideshow_cycle_views_sli form_error($form['views_slideshow_cycle']['remember_slide_days'], t('!setting must be numeric!', array('Slide days'))); } } - -function views_slideshow_cycle_views_slideshow_options_form_submit($form, &$form_state) { - // In addition to the skin, we also pre-save the definition that - // correspond to it. That lets us avoid a hook lookup on every page. - $skins = views_slideshow_cycle_get_skins(); - $form_state['values']['style_options']['views_slideshow_cycle']['skin_info'] = $skins[$form_state['values']['style_options']['views_slideshow_cycle']['skin']]; -} - -/** - * Retrieve a list of all available skins in the system. - */ -function views_slideshow_cycle_get_skins() { - static $skins; - - if (empty($skins)) { - $skins = array(); - foreach (module_implements('views_slideshow_cycle_skins') as $module) { - $skin_items = call_user_func($module .'_views_slideshow_cycle_skins'); - if (isset($skin_items) && is_array($skin_items)) { - foreach (array_keys($skin_items) as $skin) { - // Ensure that the definition is complete, so we don't need lots - // of error checking later. - $skin_items[$skin] += array( - 'title' => t('Untitled skin'), - 'module' => $module, - 'path' => '', - 'stylesheets' => array(), - ); - } - $skins = array_merge($skins, $skin_items); - } - } - } - - return $skins; -} Index: contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_cycle/theme/Attic/views_slideshow_cycle.theme.inc,v retrieving revision 1.1.2.3 diff -u -p -r1.1.2.3 views_slideshow_cycle.theme.inc --- contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc 29 Sep 2010 07:18:41 -0000 1.1.2.3 +++ contrib/views_slideshow_cycle/theme/views_slideshow_cycle.theme.inc 15 Dec 2010 13:33:24 -0000 @@ -7,15 +7,17 @@ */ /** - * Implements template_preprocess_hook_THEMENAME(). + * Views Slideshow: Theme the main frame wrapper. + * + * @ingroup themeable */ -function template_preprocess_views_slideshow_cycle(&$vars) { - $options = $vars['options']; + +function template_preprocess_views_slideshow_cycle_main_frame(&$vars) { +dsm($vars); + $settings = $vars['settings']; $rows = $vars['rows']; $view = $vars['view']; - $vss_id = $view->name . '-' . $view->current_display; - $settings = $options['views_slideshow_cycle']; - $skin_info = $settings['skin_info']; + $vss_id = $vars['vss_id']; // Cast the strings into int or bool as necessary. $new_settings = array(); @@ -51,7 +53,7 @@ function template_preprocess_views_slide $settings = array_merge( array( - 'num_divs' => sizeof($vars['rows']), + 'num_divs' => sizeof($rows), 'id_prefix' => '#views_slideshow_cycle_main_', 'div_prefix' => '#views_slideshow_cycle_div_', 'vss_id' => $vss_id, @@ -92,84 +94,19 @@ function template_preprocess_views_slide hoverintent_add(); } } - - // Enqueue any stylesheets set for the skin on this view are added. - $skin_path = drupal_get_path('module', $skin_info['module']); - if ($skin_info['path']) { - $skin_path .= '/'. $skin_info['path']; - } - - if (!empty($skin_info['stylesheets'])) { - foreach ($skin_info['stylesheets'] as $stylesheet) { - drupal_add_css($skin_path .'/'. $stylesheet); - } - } - - $hidden_elements = theme('views_slideshow_cycle_main_frame', $view, $rows, $vss_id, $options['mode']); - $vars['slideshow'] = theme('views_slideshow_main_section', $vss_id, $hidden_elements, 'views_slideshow_cycle'); - - $weight = array( - 'top' => array(), - 'bottom' => array(), - ); - // Put our pager in the right location. - $vars['pager_location'] = (isset($skin_info['pager_location'])) ? $skin_info['pager_location'] : $settings['pager']; - $vars['pager'] = ''; - if ($vars['pager_location']) { - $weight[$vars['pager_location']]['pager'] = (isset($skin_info['pager_weight'])) ? $skin_info['pager_weight'] : $settings['pager_weight']; - } - - // Put our controls in the right location. - // Only show controls when there is more than one result. - $vars['controls_location'] = (isset($skin_info['controls_location'])) ? $skin_info['controls_location'] : $settings['controls']; - $vars['controls_location'] = ($settings['num_divs'] > 1) ? $vars['controls_location'] : 0; - $vars['controls'] = ''; - if ($vars['controls_location']) { - $weight[$vars['controls_location']]['controls'] = (isset($skin_info['controls_weight'])) ? $skin_info['controls_weight'] : $settings['controls_weight']; - } - - // Put our slide counter in the right location. - $vars['slide_counter_location'] = (isset($skin_info['slide_counter_location'])) ? $skin_info['slide_counter_location'] : $settings['slide_counter']; - $vars['slide_counter'] = ''; - if ($vars['slide_counter_location']) { - $weight[$vars['slide_counter_location']]['slide_counter'] = (isset($skin_info['slide_counter_weight'])) ? $skin_info['slide_counter_weight'] : $settings['slide_counter_weight']; - } - - // Build our widgets - foreach ($weight as $location => $data) { - // Build our top widgets - if (!empty($data)) { - asort($data); - - $vars[$location . '_widget_rendered'] = ''; - foreach ($data as $type => $order) { - $vars[$type] = theme('views_slideshow_cycle_' . $type, $vss_id, $view, $options); - $vars[$location . '_widget_rendered'] .= $vars[$type]; - } - } - } -} - -/** - * Views Slideshow: Theme the main frame wrapper. - * - * @ingroup themeable - */ - -function template_preprocess_views_slideshow_cycle_main_frame(&$vars) { // Add the slideshow elements. - $vars['attributes']['id'] = "views_slideshow_cycle_teaser_section_" . $vars['vss_id']; + $vars['attributes']['id'] = "views_slideshow_cycle_teaser_section_" . $vss_id; $vars['attributes']['class'] = 'views_slideshow_cycle_teaser_section'; $styles = ''; - if (isset($vars['view']->display_handler->display->display_options['style_options']['views_slideshow_cycle'])) { - $styles = $vars['view']->display_handler->display->display_options['style_options']['views_slideshow_cycle']; + if (isset($view->display_handler->display->display_options['style_options']['views_slideshow_cycle'])) { + $styles = $view->display_handler->display->display_options['style_options']['views_slideshow_cycle']; } $styles_default = ''; - if (isset($vars['view']->display['default']->display_options['style_options']['views_slideshow_cycle'])) { - $styles_default = $vars['view']->display['default']->display_options['style_options']['views_slideshow_cycle']; + if (isset($view->display['default']->display_options['style_options']['views_slideshow_cycle'])) { + $styles_default = $view->display['default']->display_options['style_options']['views_slideshow_cycle']; } // Retrive the number of items per frame @@ -188,10 +125,10 @@ function template_preprocess_views_slide $items = array(); $slideshow_count = 0; $rendered_rows = ''; - foreach ($vars['rows'] as $count => $item) { + foreach ($rows as $count => $item) { $items[] = $item; if (count($items) == $items_per_slide || $count == (count($rows)-1)) { - $rendered_rows .= theme('views_slideshow_cycle_main_frame_row', $items, $vars['vss_id'], $slideshow_count); + $rendered_rows .= theme('views_slideshow_cycle_main_frame_row', $items, $vss_id, $slideshow_count); $items = array(); $slideshow_count++; } @@ -238,160 +175,3 @@ function template_preprocess_views_slide } $vars['attributes']['class'] = implode(' ', $classes); } - -/** - * The slideshow controls. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_controls(&$vars) { - $classes = array( - 'views_slideshow_cycle_controls', - 'views_slideshow_controls', - ); - - $vars['attributes']['class'] = implode(' ', $classes); - $vars['attributes']['id'] = "views_slideshow_cycle_controls_" . $vars['vss_id']; - - $vars['rendered_control_previous'] = theme('views_slideshow_cycle_control_previous', $vars['vss_id'], $vars['view'], $vars['options']); - - $vars['rendered_control_pause'] = ''; - if ($vars['options']['views_slideshow_cycle']['timeout']) { - $vars['rendered_control_pause'] = theme('views_slideshow_cycle_control_pause', $vars['vss_id'], $vars['view'], $vars['options']); - } - - $vars['rendered_control_next'] = theme('views_slideshow_cycle_control_next', $vars['vss_id'], $vars['view'], $vars['options']); -} - -/** - * Views Slideshow: "previous" control. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_control_previous(&$vars) { - $vars['rendered_previous_link'] = l(t('Previous'), '#', array( - 'attributes' => array( - 'class' => 'views_slideshow_cycle_previous views_slideshow_previous', - 'id' => "views_slideshow_cycle_prev_" . $vars['vss_id'], - ), - 'fragment' => ' ', - 'external' => TRUE, - )); -} - -/** - * Views Slideshow: "pause" control. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_control_pause(&$vars) { - $vars['rendered_pause_link'] = l(t('Pause'), '', array( - 'attributes' => array( - 'class' => 'views_slideshow_cycle_pause views_slideshow_pause', - 'id' => "views_slideshow_cycle_playpause_" . $vars['vss_id'], - ), - 'fragment' => ' ', - 'external' => TRUE, - )); -} - -/** - * Views Slideshow: "next" control. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_control_next(&$vars) { - $vars['rendered_next_link'] = l(t('Next'), '#', array( - 'attributes' => array( - 'class' => 'views_slideshow_cycle_next views_slideshow_next', - 'id' => "views_slideshow_cycle_next_" . $vars['vss_id'], - ), - 'fragment' => ' ', - 'external' => TRUE, - )); -} - -/** - * Views Slideshow: pager. - * - * @ingroup themeable - */ -function theme_views_slideshow_cycle_pager($vss_id, $view, $options) { - $output = ''; - - // Create some attributes - $attributes['class'] = 'views_slideshow_cycle_pager'; - $attributes['id'] = 'views_slideshow_cycle_pager_' . $vss_id; - - // Allow other modules change the output - // Using foreach instead of module_invoke_all because module_invoke_all - // doesn't support pass by reference. - foreach (module_implements('views_slideshow_cycle_pager_theme') as $module) { - $hook = $module . '_views_slideshow_cycle_pager_theme'; - $hook($output, $vss_id, $view, $options['views_slideshow_cycle'], $attributes); - } - - return $output; -} - -/** - * Implementation of hook_views_slideshow_cycle_pager_theme. - */ -function views_slideshow_cycle_views_slideshow_cycle_pager_theme(&$output, $vss_id, $view, $options, $attributes) { - switch ($options['pager_type']) { - case 'numbered': - $output = theme('views_slideshow_cycle_pager_numbered', $view, $attributes, $options); - break; - - case 'thumbnails': - $output = theme('views_slideshow_cycle_pager_thumbnails', $view, $attributes, $options); - break; - - case 'fields': - $output = theme('views_slideshow_cycle_pager_field', $view, $attributes, $options); - break; - } -} - -function template_preprocess_views_slideshow_cycle_pager_field(&$vars) { - $vars['attributes']['class'] .= ' views_slideshow_pager_field'; - $vars['rendered_field_items'] = ''; - foreach ($vars['view']->result as $count => $node) { - $rendered_fields = ''; - foreach ($vars['options']['pager_fields'] as $field => $use) { - if ($use !== 0 && is_object($vars['view']->field[$field])) { - $rendered_fields .= theme('views_slideshow_cycle_pager_field_field', $vars['view'], $field, $count); - } - } - $vars['rendered_field_items'] .= theme('views_slideshow_cycle_pager_field_item', $rendered_fields, $vars['vss_id'], $count); - } -} - -/** - * Views Slideshow: pager item. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_pager_field_item(&$vars) { - $current = $vars['count'] + 1; - $classes = array( - 'views_slideshow_cycle_div_pager_item', - ); - if (!$count) { - $classes[] = 'views_slideshow_cycle_active_pager_item'; - } - $classes[] = ($vars['count'] % 2) ? 'views-row-even' : 'views-row-odd'; - - $vars['attributes']['class'] = implode(' ', $classes); - $vars['attributes']['id'] = 'views_slideshow_cycle_div_pager_item_' . $vars['vss_id'] . '_' . $vars['count']; -} - -/** - * Views Slideshow: slide counter. - * - * @ingroup themeable - */ -function template_preprocess_views_slideshow_cycle_slide_counter(&$vars) { - $vars['attributes']['class'] = 'views_slideshow_cycle_slide_counter views_slideshow_slide_counter'; - $vars['attributes']['id'] = "views_slideshow_cycle_slide_counter_" . $vars['vss_id']; -}