? 713750-theme_views_slideshow_main_section3.patch Index: views-slideshow.tpl.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views-slideshow.tpl.php,v retrieving revision 1.1.2.2.2.1 diff -u -p -r1.1.2.2.2.1 views-slideshow.tpl.php --- views-slideshow.tpl.php 17 Jan 2010 23:17:31 -0000 1.1.2.2.2.1 +++ views-slideshow.tpl.php 14 Feb 2010 03:09:44 -0000 @@ -1,8 +1,9 @@ Index: views_slideshow.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/views_slideshow.install,v retrieving revision 1.1.2.2.2.1 diff -u -p -r1.1.2.2.2.1 views_slideshow.install --- views_slideshow.install 27 Sep 2009 01:44:14 -0000 1.1.2.2.2.1 +++ views_slideshow.install 14 Feb 2010 03:09:44 -0000 @@ -2,13 +2,13 @@ // $Id: views_slideshow.install,v 1.1.2.2.2.1 2009/09/27 01:44:14 redndahead Exp $ /** - * Implementation of hook_install(). + * Implements hook_install(). */ function views_slideshow_install() { } /** - * we had to change the names of the plugins + * We had to change the names of the plugins */ function views_slideshow_update_1() { return _views_slideshow_update_reset_cache(); @@ -42,8 +42,8 @@ function views_slideshow_update_6000() { } /** - * We changed our views handler to group slideshow modes. - * We also moved everything out to new modules, so have to change our views. + * We changed our views handler to group slideshow modes. + * We also moved everything out to new modules, so have to change our views. */ function views_slideshow_update_6001() { $ret = array(); Index: views_slideshow.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/views_slideshow.module,v retrieving revision 1.11.2.2.2.4 diff -u -p -r1.11.2.2.2.4 views_slideshow.module --- views_slideshow.module 15 Oct 2009 08:47:01 -0000 1.11.2.2.2.4 +++ views_slideshow.module 14 Feb 2010 03:09:44 -0000 @@ -28,16 +28,16 @@ function views_slideshow_views_api() { } /** - * Implementation of hook_help(). + * Implements hook_help(). */ function views_slideshow_help($path, $arg) { switch ($path) { case 'admin/help#views_slideshow': if (module_exists('advanced_help')) { - $output = '

'. t('Click here to view the documentation for Views Slideshow.', array('@help' => base_path() . 'admin/advanced_help/views_slideshow')) .'

'; + $output = '

' . l(t('Click here to view the documentation for Views Slideshow'), 'admin/advanced_help/views_slideshow') . '

'; } else { - $output = '

'. t('Views Slideshow help can be found by installing and enabling the Advanced Help module.', array('@advanced_help' => 'http://drupal.org/project/advanced_help')) .'

'; + $output = '

' . t('Views Slideshow help can be found by installing and enabling the !help.', array('!advanced_help' => l(t('Advanced Help module'), 'http://drupal.org/project/advanced_help'))) . '

'; } return $output; } Index: views_slideshow.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/Attic/views_slideshow.theme.inc,v retrieving revision 1.1.2.2.2.3 diff -u -p -r1.1.2.2.2.3 views_slideshow.theme.inc --- views_slideshow.theme.inc 6 Nov 2009 06:21:55 -0000 1.1.2.2.2.3 +++ views_slideshow.theme.inc 14 Feb 2010 03:09:44 -0000 @@ -2,11 +2,18 @@ // $Id: views_slideshow.theme.inc,v 1.1.2.2.2.3 2009/11/06 06:21:55 fearlsgroove Exp $ /** - * This displays the main element, where the current slide is shown. + * The current element of the slideshow. + * + * @ingroup themeable */ function theme_views_slideshow_main_section($id, $hidden_elements, $plugin) { - $output = "\n\n" . '
' . "\n "; - $output .= $hidden_elements; - $output .= '
\n\n"; - return $output; + $attributes['id'] = "views_slideshow_${plugin}_main_${id}"; + $attributes['class'] = "views_slideshow_${plugin}_main views_slideshow_main"; + $attributes = drupal_attributes($attributes); + + return "$hidden_elements"; +} + +function template_preprocess_views_slideshow(&$vars) { + } 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 diff -u -p -r1.1.2.1 views_slideshow.views.inc --- views_slideshow.views.inc 16 Apr 2009 02:04:55 -0000 1.1.2.1 +++ views_slideshow.views.inc 14 Feb 2010 03:09:44 -0000 @@ -2,13 +2,12 @@ // $Id: views_slideshow.views.inc,v 1.1.2.1 2009/04/16 02:04:55 aaron Exp $ /** - * @file - * views_slideshow.views.inc - * Defines slideshow view style plugins. + * @file + * Defines the View Style Plugins for Views Slideshow module. */ /** - * Slideshow View style plugins. Implementation of hook_views_plugins() + * Implements hook_views_plugins(). */ function views_slideshow_views_plugins() { return array( @@ -26,4 +25,3 @@ function views_slideshow_views_plugins() ), ); } - 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.3 diff -u -p -r1.1.2.1.2.3 views_slideshow_plugin_style_slideshow.inc --- views_slideshow_plugin_style_slideshow.inc 28 Sep 2009 21:37:38 -0000 1.1.2.1.2.3 +++ views_slideshow_plugin_style_slideshow.inc 14 Feb 2010 03:09:44 -0000 @@ -1,7 +1,6 @@ t('There is no Views Slideshow plugin enabled. Go to the Modules Page and enable a Views Slideshow plugin module. For example Views Slideshow Singleframe.'), + '#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'))), ); } } Index: contrib/views_slideshow_singleframe/views-slideshow-singleframe.tpl.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views-slideshow-singleframe.tpl.php,v retrieving revision 1.1.2.1.2.4 diff -u -p -r1.1.2.1.2.4 views-slideshow-singleframe.tpl.php --- contrib/views_slideshow_singleframe/views-slideshow-singleframe.tpl.php 17 Jan 2010 23:17:31 -0000 1.1.2.1.2.4 +++ contrib/views_slideshow_singleframe/views-slideshow-singleframe.tpl.php 14 Feb 2010 03:09:44 -0000 @@ -2,29 +2,31 @@ // $Id: views-slideshow-singleframe.tpl.php,v 1.1.2.1.2.4 2010/01/17 23:17:31 redndahead Exp $ /** - * @file - * Views Slideshow: Single Frame + * @file + * Views Slideshow: Single Frame template file. */ - // these are hidden elements, used to cycle through the main div - $hidden_elements = theme('views_slideshow_singleframe_no_display_section', $view, $rows, $id, $options['mode']); - if ($options['singleframe']['controls'] == 1) { - print theme('views_slideshow_singleframe_controls',$id,$view,$options); - } - if ($options['singleframe']['pager'] == 1) { - print theme('views_slideshow_singleframe_pager', $id, $view, $options); - } - if ($options['singleframe']['image_count'] == 1) { - print theme('views_slideshow_singleframe_image_count', $id, $view, $options); - } - print theme('views_slideshow_main_section', $id, $hidden_elements, 'singleframe'); - if ($options['singleframe']['controls'] == 2) { - print theme('views_slideshow_singleframe_controls',$id,$view,$options); - } - if ($options['singleframe']['pager'] == 2) { - print theme('views_slideshow_singleframe_pager', $id, $view, $options); - } - if ($options['singleframe']['image_count'] == 2) { - print theme('views_slideshow_singleframe_image_count', $id, $view, $options); - } -?> +// Add controls, pager and image count above the main slideshow. +if ($options['singleframe']['controls'] == 1) { + print $controls; +} +if ($options['singleframe']['pager'] == 1) { + print $pager; +} +if ($options['singleframe']['image_count'] == 1) { + print $image_count; +} + +// The main slideshow elements. +print $slideshow; + +// Add controls, pager and image counter below the main slideshow. +if ($options['singleframe']['controls'] == 2) { + print $controls; +} +if ($options['singleframe']['pager'] == 2) { + print $pager; +} +if ($options['singleframe']['image_count'] == 2) { + print $image_count; +} Index: contrib/views_slideshow_singleframe/views_slideshow_singleframe.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views_slideshow_singleframe.module,v retrieving revision 1.1.2.1.2.4 diff -u -p -r1.1.2.1.2.4 views_slideshow_singleframe.module --- contrib/views_slideshow_singleframe/views_slideshow_singleframe.module 15 Oct 2009 08:47:02 -0000 1.1.2.1.2.4 +++ contrib/views_slideshow_singleframe/views_slideshow_singleframe.module 14 Feb 2010 03:09:44 -0000 @@ -2,12 +2,12 @@ // $Id: views_slideshow_singleframe.module,v 1.1.2.1.2.4 2009/10/15 08:47:02 redndahead Exp $ /** - * @file - * The Views Slideshow: SingleFrame adds a Single Frame slideshow mode to Views Slideshows. + * @file + * Views Slideshow: SingleFrame is typically used for field views. */ /** - * Implements hook_theme(). + * Implements hook_theme(). */ function views_slideshow_singleframe_theme($existing, $type, $theme, $path) { return array( @@ -52,18 +52,17 @@ function views_slideshow_singleframe_the } /** - * Implementation of hook_help(). + * Implements hook_help(). */ function views_slideshow_singleframe_help($path, $arg) { switch ($path) { case 'admin/help#views_slideshow_singleframe': if (module_exists('advanced_help')) { - $output = '

'. t('Click here to view the documentation for Views Slideshow SingleFrame.', array('@help' => base_path() . 'admin/advanced_help/views_slideshow_singleframe')) .'

'; + $output = '

' . l(t('Click here to view the documentation for Views Slideshow SingleFrame.'), 'admin/advanced_help/views_slideshow_singleframe') . '

'; } else { - $output = '

'. t('Views Slideshow SingleFrame help can be found by installing and enabling the Advanced Help module.', array('@advanced_help' => 'http://drupal.org/project/advanced_help')) .'

'; + $output = '

' . t('Views Slideshow SingleFrame help can be found by installing and enabling the !advanced_help', array('!advanced_help' => l('Advanced Help module', 'http://drupal.org/project/advanced_help'))) . '

'; } return $output; } } - Index: contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_singleframe/Attic/views_slideshow_singleframe.theme.inc,v retrieving revision 1.1.2.1.2.14 diff -u -p -r1.1.2.1.2.14 views_slideshow_singleframe.theme.inc --- contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc 18 Jan 2010 01:00:51 -0000 1.1.2.1.2.14 +++ contrib/views_slideshow_singleframe/views_slideshow_singleframe.theme.inc 14 Feb 2010 03:09:44 -0000 @@ -2,24 +2,26 @@ // $Id: views_slideshow_singleframe.theme.inc,v 1.1.2.1.2.14 2010/01/18 01:00:51 redndahead Exp $ /** - * @file - * Theme & preprocess functions for the Views Slideshow: SingleFrame module. + * @file + * Theme & preprocess functions for the Views Slideshow: SingleFrame module. */ /** - * Implement template_preprocess_hook_THEMENAME(). + * Implements template_preprocess_hook_THEMENAME(). */ function template_preprocess_views_slideshow_singleframe(&$vars) { - $options = $vars['options']; - $base = drupal_get_path('module', 'views_slideshow_singleframe'); - drupal_add_js($base . '/views_slideshow.js', 'module'); - drupal_add_css($base . '/views_slideshow.css', 'module'); + $module_path = drupal_get_path('module', 'views_slideshow_singleframe'); + drupal_add_js($module_path . '/views_slideshow.js', 'module'); + drupal_add_css($module_path . '/views_slideshow.css', 'module'); - $num_divs = sizeof($vars['rows']); + $options = $vars['options']; + $id = $vars['id']; + $rows = $vars['rows']; + $view = $vars['view']; $settings = array_merge( array( - 'num_divs' => $num_divs, + 'num_divs' => sizeof($vars['rows']), 'id_prefix' => '#views_slideshow_singleframe_main_', 'div_prefix' => '#views_slideshow_singleframe_div_', 'id' => $vars['id'], @@ -29,16 +31,22 @@ function template_preprocess_views_slide drupal_add_js(array('viewsSlideshowSingleFrame' => array('#views_slideshow_singleframe_main_'. $vars['id'] => $settings)), 'setting'); -} + $hidden_elements = theme('views_slideshow_singleframe_no_display_section', $view, $rows, $id, $options['mode']); + $vars['controls'] = theme('views_slideshow_singleframe_controls', $id, $view, $options); + $vars['pager'] = theme('views_slideshow_singleframe_pager', $id, $view, $options); + $vars['image_count'] = theme('views_slideshow_singleframe_image_count', $id, $view, $options); + $vars['slideshow'] = theme('views_slideshow_main_section', $id, $hidden_elements, 'singleframe'); +} /** - * These are the slideshow elements themselves; not actually displayed, but used to give the html to the main element. + * Add the jQuery Cycle plugin the HTML for the hidden slideshow elements. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_no_display_section($view, $rows, $id, $mode) { - // Add support for the jQuery Cycle plugin. - // If we have the jQ module installed, use that to add the Cycle plugin if possible. - // That allows for version control. + // If the jQ module is installed, use that to add the jQuery Cycle plugin. + // This allows different versions of the plugin to be used. $js = FALSE; if (module_exists('jq')) { $loaded_plugins = jq_plugins(); @@ -49,45 +57,62 @@ function theme_views_slideshow_singlefra // Otherwise, we'll add the version included with this module. if (!$js) { - drupal_add_js(drupal_get_path('module', 'views_slideshow') .'/js/jquery.cycle.all.min.js', 'module'); + drupal_add_js(drupal_get_path('module', 'views_slideshow') . '/js/jquery.cycle.all.min.js'); } - $output = '
' . "\n"; + // Add the slideshow elements. + $attributes['id'] = "views_slideshow_singleframe_teaser_section_$id"; + $attributes['class'] = 'views_slideshow_singleframe_teaser_section'; + $attributes = drupal_attributes($attributes); + $output = ""; foreach ($rows as $count => $item) { $output .= theme('views_slideshow_singleframe_no_display_teaser', $item, $id, $count); } - $output .= "
\n\n"; + $output .= "\n"; + return $output; } /** - * The html that will be placed into the element in its turn during its frame. + * The slideshow elements. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_no_display_teaser($item, $id, $count) { - $class = 'views_slideshow_singleframe_slide views_slideshow_slide views-row-' . ($count + 1); + $current = $count + 1; + $classes = array( + 'views_slideshow_singleframe_slide', + "views_slideshow_slide views-row-$current", + ); if ($count) { - $class .= ' views_slideshow_singleframe_hidden'; + $classes[] = 'views_slideshow_singleframe_hidden'; } + $classes[] = ($count % 2) ? 'views-row-even' : 'views-row-odd'; - if ($count % 2) { - $class .= ' views-row-even'; - } - else { - $class .= ' views-row-odd'; - } + $attributes['class'] = implode(' ', $classes); + $attributes['id'] = "views_slideshow_singleframe_div_${id}_${count}"; + $attributes = drupal_attributes($attributes); - $output = '
' . "\n "; - $output .= $item . "\n"; - $output .= '
' . "\n\n"; - return $output; + return "$item\n"; } /** - * Themed slideshow controls. + * The slideshow controls. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_controls($id, $view, $options) { - $output = '
' . "\n"; + $classes = array( + 'views_slideshow_singleframe_controls', + 'views_slideshow_controls', + ); + + $attributes['class'] = implode(' ', $classes); + $attributes['id'] = "views_slideshow_singleframe_controls_$id"; + $attributes = drupal_attributes($attributes); + + $output = ""; $output .= theme('views_slideshow_singleframe_control_previous', $id, $view, $options); $output .= theme('views_slideshow_singleframe_control_pause', $id, $view, $options); $output .= theme('views_slideshow_singleframe_control_next', $id, $view, $options); @@ -96,30 +121,67 @@ function theme_views_slideshow_singlefra } /** - * Themed Previous Control + * The "previous" control. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_control_previous($id, $view, $options) { - return '' . t('Previous') . "\n"; + return l(t('Previous'), '#', array('attributes' => array( + 'class' => 'views_slideshow_singleframe_previous views_slideshow_previous', + 'id' => "views_slideshow_singleframe_prev_$id", + ))); } /** - * Themed Pause Control + * The "pause" control. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_control_pause($id, $view, $options) { - return '' . t('Pause') . "\n"; + return l(t('Pause'), '#', array('attributes' => array( + 'class' => 'views_slideshow_singleframe_pause views_slideshow_pause', + 'id' => "views_slideshow_singleframe_playpause_$id", + ))); } /** - * Themed Next Control + * The "next" control. + * + * @ingroup themeable */ function theme_views_slideshow_singleframe_control_next($id, $view, $options) { - return '' . t('Next') . "\n"; + return l(t('Next'), '#', array('attributes' => array( + 'class' => 'views_slideshow_singleframe_next views_slideshow_next', + 'id' => "views_slideshow_singleframe_next_$id", + ))); } +/** + * The pager. + * + * @ingroup themeable + */ function theme_views_slideshow_singleframe_pager($id, $view, $options) { - return '
'; + $pager_type = $options['singleframe']['pager_type']; + + $attributes['class'] = "views_slideshow_singleframe_pager views_slideshow_pager$pager_type"; + $attributes['id'] = "views_slideshow_singleframe_pager_$id"; + $attributes = drupal_attributes($attributes); + + return "
"; } +/** + * The image counter. + * + * @ingroup themeable + */ function theme_views_slideshow_singleframe_image_count($id, $view, $options) { - return '
' . t('of') .'
'; + $attributes['class'] = 'views_slideshow_singleframe_image_count views_slideshow_image_count'; + $attributes['id'] = "views_slideshow_singleframe_image_count_$id"; + $attributes = drupal_attributes($attributes); + + $counter = ' ' . t('of') . ' '; + + return "$counter"; } Index: contrib/views_slideshow_thumbnailhover/views-slideshow-thumbnailhover.tpl.php =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views-slideshow-thumbnailhover.tpl.php,v retrieving revision 1.1.2.1.2.5 diff -u -p -r1.1.2.1.2.5 views-slideshow-thumbnailhover.tpl.php --- contrib/views_slideshow_thumbnailhover/views-slideshow-thumbnailhover.tpl.php 17 Nov 2009 05:55:19 -0000 1.1.2.1.2.5 +++ contrib/views_slideshow_thumbnailhover/views-slideshow-thumbnailhover.tpl.php 14 Feb 2010 03:09:45 -0000 @@ -2,41 +2,31 @@ // $Id: views-slideshow-thumbnailhover.tpl.php,v 1.1.2.1.2.5 2009/11/17 05:55:19 redndahead Exp $ /** - * @file - * Views Slideshow: Thumbnail Hover + * @file + * Views Slideshow: Thumbnail Hover template file. */ - if ($options['thumbnailhover']['controls'] == 1) { - print theme('views_slideshow_thumbnailhover_controls', $id, $view, $options); - } - - if ($options['thumbnailhover']['image_count'] == 1) { - print theme('views_slideshow_thumbnailhover_image_count', $id, $view, $options); - } - - $teaser = ($options['thumbnailhover']['hover_breakout'] == 'teaser' ? TRUE : FALSE); - $output = ''; - $view_teasers = FALSE; - // As we're using the 'thumbnail hover' mode, then we need to display all the view thumbnails. - $view_teasers = theme('views_slideshow_thumbnailhover_breakout_teasers', $view, $rows, $id, $options); - if (!$options['thumbnailhover']['teasers_last']) { - $output .= $view_teasers; - } +// Add controls, image count and teasers above the main slideshow. +if ($options['thumbnailhover']['controls'] == 1) { + print $controls; +} +if ($options['thumbnailhover']['image_count'] == 1) { + print $image_count; +} +if (!$options['thumbnailhover']['teasers_last']) { + print $view_teasers; +} - // These are hidden elements, used to cycle through the main div - $hidden_elements = theme('views_slideshow_thumbnailhover_no_display_section', $view, $rows, $id, $options, $teaser); - $output .= theme('views_slideshow_main_section', $id, $hidden_elements, 'thumbnailhover'); +// The main slideshow including all the hidden elements. +print $slideshow; - if ($view_teasers && $options['thumbnailhover']['teasers_last']) { - $output .= $view_teasers; - } - if ($options['thumbnailhover']['controls'] == 2) { - print theme('views_slideshow_thumbnailhover_controls',$id, $view, $options); - } - - if ($options['thumbnailhover']['image_count'] == 2) { - print theme('views_slideshow_thumbnailhover_image_count', $id, $view, $options); - } - print $output; - -?> +// Add controls, image count and teasers below the main slideshow. +if ($view_teasers && $options['thumbnailhover']['teasers_last']) { + print $view_teasers; +} +if ($options['thumbnailhover']['controls'] == 2) { + print $controls; +} +if ($options['thumbnailhover']['image_count'] == 2) { + print $image_count; +} Index: contrib/views_slideshow_thumbnailhover/views_slideshow.js =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow.js,v retrieving revision 1.1.2.2.2.14 diff -u -p -r1.1.2.2.2.14 views_slideshow.js --- contrib/views_slideshow_thumbnailhover/views_slideshow.js 17 Nov 2009 04:26:19 -0000 1.1.2.2.2.14 +++ contrib/views_slideshow_thumbnailhover/views_slideshow.js 14 Feb 2010 03:09:45 -0000 @@ -103,7 +103,7 @@ Drupal.behaviors.viewsSlideshowThumbnail ); }); } - + if (settings.controls > 0) { // Show controls for people who have js enabled browsers. $('#views_slideshow_thumbnailhover_controls_' + settings.id).show(); Index: contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow_thumbnailhover.module,v retrieving revision 1.1.2.1.2.4 diff -u -p -r1.1.2.1.2.4 views_slideshow_thumbnailhover.module --- contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.module 15 Oct 2009 08:47:04 -0000 1.1.2.1.2.4 +++ contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.module 14 Feb 2010 03:09:45 -0000 @@ -2,17 +2,18 @@ // $Id: views_slideshow_thumbnailhover.module,v 1.1.2.1.2.4 2009/10/15 08:47:04 redndahead Exp $ /** - * @file - * The Views Slideshow: ThumbnailHover works with node views only. - * It adds two parts to the view: the first part is a series of items - * displayed as a list, while the second part is either full or teaser. - * The slide show will synchronize the two, so that the 'active' item - * will correspond to the single full/teaser item. The slide show can - * be set to move automatically and/or on mouse hover. + * @file + * Views Slideshow: ThumbnailHover has options for working with node views. + * + * The ThumbnailHover mode adds two parts to the view: the first part is a + * series of items displayed as a list, the second part is either a full node + * or a node teaser. The slideshow will synchronize the two, so that the + * 'active' item will correspond to the single full/teaser item. The slide show + * can be set to advance automatically or on mouse hover/click. */ /** - * Implements hook_theme(). + * Implements hook_theme(). */ function views_slideshow_thumbnailhover_theme($existing, $type, $theme, $path) { return array( @@ -61,17 +62,17 @@ function views_slideshow_thumbnailhover_ } /** - * Implementation of hook_help(). + * Implements hook_help(). */ function views_slideshow_thumbnailhover_help($path, $arg) { switch ($path) { case 'admin/help#views_slideshow_thumbnailhover': if (module_exists('advanced_help')) { - $output = '

'. t('Click here to view the documentation for Views Slideshow Thumbnailhover.', array('@help' => base_path() . 'admin/advanced_help/views_slideshow_thumbnailhover')) .'

'; + $output = '

' . l(t('Click here to view the documentation for Views Slideshow Thumbnailhover'), 'admin/advanced_help/views_slideshow_thumbnailhover') . '

'; } else { - $output = '

'. t('Views Slideshow Thumbnailhover help can be found by installing and enabling the Advanced Help module.', array('@advanced_help' => 'http://drupal.org/project/advanced_help')) .'

'; + $output = '

' . t('Views Slideshow Thumbnailhover help can be found by installing and enabling the !advanced_help.', array('!advanced_help' => l(t('Advanced Help module'), 'http://drupal.org/project/advanced_help'))) . '

'; } return $output; } -} \ No newline at end of file +} Index: contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/views_slideshow/contrib/views_slideshow_thumbnailhover/Attic/views_slideshow_thumbnailhover.theme.inc,v retrieving revision 1.1.2.1.2.15 diff -u -p -r1.1.2.1.2.15 views_slideshow_thumbnailhover.theme.inc --- contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc 18 Jan 2010 01:00:51 -0000 1.1.2.1.2.15 +++ contrib/views_slideshow_thumbnailhover/views_slideshow_thumbnailhover.theme.inc 14 Feb 2010 03:09:45 -0000 @@ -2,26 +2,27 @@ // $Id: views_slideshow_thumbnailhover.theme.inc,v 1.1.2.1.2.15 2010/01/18 01:00:51 redndahead Exp $ /** - * @file - * Theme & preprocess functions for the Views Slideshow: ThumbnailHover module. + * @file + * Theme & preprocess functions for the Views Slideshow: ThumbnailHover module. */ /** - * Implement template_preprocess_hook_THEMENAME(). + * Implements template_preprocess_hook_THEMENAME(). */ function template_preprocess_views_slideshow_thumbnailhover(&$vars) { - $options = $vars['options']; - $base = drupal_get_path('module', 'views_slideshow_thumbnailhover'); - drupal_add_js($base . '/views_slideshow.js', 'module'); - drupal_add_css($base . '/views_slideshow.css', 'module'); + $module_path = drupal_get_path('module', 'views_slideshow_thumbnailhover'); + drupal_add_js($module_path . '/views_slideshow.js', 'module'); + drupal_add_css($module_path . '/views_slideshow.css', 'module'); - $num_divs = sizeof($vars['rows']); - $teasers_last = $options['thumbnailhover']['teasers_last'] ? 'true' : 'false'; + $options = $vars['options']; + $id = $vars['id']; + $view = $vars['view']; + $rows = $vars['rows']; $settings = array_merge( array( - 'num_divs' => $num_divs, - 'teasers_last' => $teasers_last, + 'num_divs' => sizeof($vars['rows']), + 'teasers_last' => ($options['thumbnailhover']['teasers_last']) ? 'true' : 'false', 'id_prefix' => '#views_slideshow_thumbnailhover_main_', 'div_prefix' => '#views_slideshow_thumbnailhover_div_', 'id' => $vars['id'], @@ -29,7 +30,10 @@ function template_preprocess_views_slide $options['thumbnailhover'] ); - drupal_add_js(array('viewsSlideshowThumbnailHover' => array('#views_slideshow_thumbnailhover_main_'. $vars['id'] => $settings)), 'setting'); + drupal_add_js(array('viewsSlideshowThumbnailHover' => array( + "#views_slideshow_thumbnailhover_main_$id" => $settings)), 'setting'); + + // Add the hoverIntent plugin. if ($settings['pager_event'] == 'hoverIntent') { if (module_exists('jq')) { $loaded_plugins = jq_plugins(); @@ -41,17 +45,25 @@ function template_preprocess_views_slide hoverintent_add(); } } -} + $teaser = ($options['thumbnailhover']['hover_breakout'] == 'teaser') ? TRUE : FALSE; + $hidden_elements = theme('views_slideshow_thumbnailhover_no_display_section', $view, $rows, $id, $options, $teaser); + + $vars['controls'] = theme('views_slideshow_thumbnailhover_controls', $id, $view, $options); + $vars['image_count'] = theme('views_slideshow_thumbnailhover_image_count', $id, $view, $options); + $vars['view_teasers'] = theme('views_slideshow_thumbnailhover_breakout_teasers', $view, $rows, $id, $options); + $vars['slideshow'] = theme('views_slideshow_main_section', $id, $hidden_elements, 'thumbnailhover'); +} /** - * These are the slideshow elements themselves; not actually displayed, but used to give the html to the main element. + * Add the jQuery Cycle plugin the HTML for the hidden slideshow elements. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_no_display_section($view, $rows, $id, $options, $teaser = TRUE) { - // Add support for the jQuery Cycle plugin. - // If we have the jQ module installed, use that to add the Cycle plugin if possible. - // That allows for version control. - $js = 0; + // If the jQ module is installed, use that to add the jQuery Cycle plugin. + // This allows different versions of the plugin to be used. + $js = FALSE; if (module_exists('jq')) { $loaded_plugins = jq_plugins(); if (!empty($loaded_plugins['cycle'])) { @@ -61,9 +73,15 @@ function theme_views_slideshow_thumbnail // Otherwise, we'll add the version included with this module. if (!$js) { - drupal_add_js(drupal_get_path('module', 'views_slideshow') .'/js/jquery.cycle.all.min.js', 'module'); + drupal_add_js(drupal_get_path('module', 'views_slideshow') . '/js/jquery.cycle.all.min.js'); } - $output = '
' . "\n"; + + // Add the slideshow elements. + $attributes['id'] = "views_slideshow_thumbnailhover_teaser_section_$id"; + $attributes['class'] = 'views_slideshow_thumbnailhover_teaser_section views_slideshow_teaser_section'; + $attributes = drupal_attributes($attributes); + + $output = ""; foreach ($view->result as $count => $node) { if ($view->display_handler->uses_fields()) { $rendered = ''; @@ -81,36 +99,46 @@ function theme_views_slideshow_thumbnail } $output .= theme('views_slideshow_thumbnailhover_no_display_teaser', $rendered, $id, $count); } - $output .= "
\n\n"; + $output .= ""; return $output; } /** - * The html that will be placed into the element in its turn during its frame. + * The active element. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_no_display_teaser($item, $id, $count) { - $class = 'views_slideshow_thumbnailhover_slide views_slideshow_slide views-row-' . ($count + 1); + $current = $count + 1; + + $classes = array( + 'views_slideshow_thumbnailhover_slide', + "views_slideshow_slide views-row-$current", + ); + if ($count) { - $class = ' views_slideshow_thumbnailhover_hidden'; + $classes[] = 'views_slideshow_thumbnailhover_hidden'; } + $classes[] = ($count % 2) ? 'views-row-even' : 'views-row-odd'; - if ($count % 2) { - $class .= ' views-row-even'; - } - else { - $class .= ' views-row-odd'; - } - $output = '
' . "\n "; - $output .= $item . "\n"; - $output .= '
' . "\n\n"; - return $output; + $attributes['id'] = "views_slideshow_thumbnailhover_div_${id}_${count}"; + $attributes['class'] = implode(' ', $classes); + $attributes = drupal_attributes($attributes); + + return "$item"; } /** - * These are teasers that may be pointed at with a mouse to change the element directly. + * The pager in the form of node teasers. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_breakout_teasers($view, $items, $id, $options) { - $output = '
' . "\n"; + $attributes['id'] = "views_slideshow_thumbnailhover_breakout_teasers_$id"; + $attributes['class'] = 'views_slideshow_thumbnailhover_breakout_teasers clear-block'; + $attributes = drupal_attributes($attributes); + + $output = ""; if ($view->display_handler->uses_fields()) { foreach ($view->result as $count => $node) { $rendered_fields = ''; @@ -130,39 +158,50 @@ function theme_views_slideshow_thumbnail $output .= theme('views_slideshow_thumbnailhover_breakout_teaser', $item, $id, $count); } } - - $output .= "
\n\n"; + $output .= "\n"; return $output; } /** - * An individual breakout teaser. + * The breakout teaser. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_breakout_teaser($item, $id, $count) { - $class = 'views_slideshow_thumbnailhover_div_breakout_teaser'; + $current = $count + 1; + $classes = array( + 'views_slideshow_thumbnailhover_div_breakout_teaser', + ); if (!$count) { - $class .= ' views_slideshow_thumbnailhover_active_teaser'; + $classes[] = 'views_slideshow_thumbnailhover_active_teaser'; } + $classes[] = ($count % 2) ? 'views-row-even' : 'views-row-odd'; - if ($count % 2) { - $class .= ' views-row-even'; - } - else { - $class .= ' views-row-odd'; - } - $output = '
' . "\n "; - $output .= $item . "\n"; - $output .= '
' . "\n\n"; - return $output; -} + $attributes['class'] = implode(' ', $classes); + $attributes['id'] = "views_slideshow_thumbnailhover_div_breakout_teaser_${id}_${count}"; + $attributes = drupal_attributes($attributes); + return "$item\n"; +} /** - * Themed slideshow controls. + * The slideshow controls. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_controls($id, $view, $options) { - $output = '
' . "\n"; + $classes = array( + 'views_slideshow_thumbnailhover_controls', + 'views_slideshow_controls', + ); + + $attributes['class'] = implode(' ', $classes); + + $attributes['id'] = "views_slideshow_thumbnailhover_controls_$id"; + $attributes = drupal_attributes($attributes); + + $output = ""; $output .= theme('views_slideshow_thumbnailhover_control_previous', $id, $view, $options); $output .= theme('views_slideshow_thumbnailhover_control_pause', $id, $view, $options); $output .= theme('views_slideshow_thumbnailhover_control_next', $id, $view, $options); @@ -171,27 +210,52 @@ function theme_views_slideshow_thumbnail } /** - * Themed Previous Control + * The "previous" control. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_control_previous($id, $view, $options) { - return '' . t('Previous') . "\n"; + return l(t('Previous'), '#', array('attributes' => array( + 'class' => 'views_slideshow_thumbnailhover_previous views_slideshow_previous', + 'id' => "views_slideshow_thumbnailhover_prev_$id", + ))); } /** - * Themed Pause Control + * The "pause" control. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_control_pause($id, $view, $options) { - return '' . t('Pause') . "\n"; + return l(t('Pause'), '#', array('attributes' => array( + 'class' => 'views_slideshow_thumbnailhover_pause views_slideshow_pause', + 'id' => "views_slideshow_thumbnailhover_playpause_$id", + ))); } /** - * Themed Next Control + * The "next" control. + * + * @ingroup themeable */ function theme_views_slideshow_thumbnailhover_control_next($id, $view, $options) { - return '' . t('Next') . "\n"; + return l(t('Next'), '#', array('attributes' => array( + 'class' => 'views_slideshow_thumbnailhover_next views_slideshow_next', + 'id' => "views_slideshow_thumbnailhover_next_$id", + ))); } +/** + * The image counter. + * + * @ingroup themeable + */ function theme_views_slideshow_thumbnailhover_image_count($id, $view, $options) { - $output = '
' . t('of') .'
'; - return $output; + $attributes['class'] = 'views_slideshow_thumbnailhover_image_count views_slideshow_image_count'; + $attributes['id'] = "views_slideshow_thumbnailhover_image_count_$id"; + $attributes = drupal_attributes($attributes); + + $counter = ' ' . t('of') .' '; + + return "$counter
"; }