From 6e1dfe1dbe8c70a04234df5eadbdf9b79b612139 Mon Sep 17 00:00:00 2001 From: Fabio Varesano Date: Fri, 5 Jan 2007 18:30:05 +0000 Subject: Restored original behaviour of node links of 4.7 --- plugins/video_image/video_image.module | 2 +- video.module | 73 +++++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) diff --git a/plugins/video_image/video_image.module b/plugins/video_image/video_image.module index a85455d..9b8c0da 100644 --- a/plugins/video_image/video_image.module +++ b/plugins/video_image/video_image.module @@ -174,7 +174,7 @@ function theme_video_image_teaser($node) { $image = theme('image', $node->serial_data['image_teaser'], $node->title, $node->title, array('class' => 'video_image_teaser'), FALSE); } $output .= l($image, "node/$node->nid", array(), NULL, NULL, FALSE, TRUE); //Create a link with an image in it. - $output .= $node->teaser . '
'; + $output .= '
'; return $output; } diff --git a/video.module b/video.module index b1f3709..82c0c15 100644 --- a/video.module +++ b/video.module @@ -158,6 +158,76 @@ function video_init() { */ function video_link($type, $node = NULL) { $link = array(); + + // Node links for a video + if ($type == 'node' && $node->type == 'video' && $node->vidfile && user_access('access video')) { + //If the video is of type youtube and multi-file downloads aren't turned on don't show the download link. + if ((_video_get_filetype($node->vidfile) == 'youtube' or _video_get_filetype($node->vidfile) == 'googlevideo') and $node->disable_multidownload == 1) { + $display_download_link = 0; + } + else { + $display_download_link = variable_get('video_displaydownloadlink', 1); + } + + if (user_access('play video')) { + if (variable_get('video_displayplaylink', 1)) { + $link['video_play'] = array( + 'title' => t('play'), + 'href' => "node/$node->nid/play", + 'attributes' => array( + 'class' => 'outgoing', + 'title' => t('play %link', array('%link' => $node->title)), + ), + ); + } + } + else { + //TODO: port the code below to 5. How??? + /* + $link .= l(t('login'), "user/login", array('class' => 'outgoing', 'title' => t('login to your account'))); + $link .= ' ' . t('or') . ' '; + $link .= l(t('register'), "user/register", array('class' => 'outgoing', 'title' => t('create a new account'))); + $link .= t(' to play video'); + $link .= ($display_download_link == 1) ? ' ' . t('or') . ' ' : ' | '; + */ + } + if ($display_download_link == 1) { + $link['video_download'] = array( + 'title' => t('download'), + 'href' => "node/$node->nid/download", + 'attributes' => array( + 'class' => 'outgoing', + 'title' => t('download %link', array('%link' => $node->title)), + ), + ); + } + if (variable_get('video_displayplaytime', 1)) { + $link['playtime'] = array( + 'title' => format_interval($node->playtime_seconds), + ); + } + if (variable_get('video_displayfilesize', 1) and $node->size != 0) { + $link['size'] = array( + 'title' => format_size($node->size), + ); + } + if (variable_get('video_playcounter', 1) and user_access('view play counter')) { + $link['play_counter'] = array( + 'title' => format_plural($node->play_counter, '1 play', '@count plays'), + ); + } + if (variable_get('video_downloadcounter', 1) and user_access('view download counter')) { + $link['download_counter'] = array( + 'title' => format_plural($node->download_counter, '1 download', '@count downloads'), + ); + } + + return $link; + } + return array(); +} + + /* // Node links for a video if ($type == 'node' && $node->type == 'video' && $node->vidfile && user_access('access video')) { //If the video is of type youtube and multi-file downloads aren't turned on don't show the download link. @@ -192,7 +262,8 @@ function video_link($type, $node = NULL) { } } return $link; -} + */ + /** * Displays a Drupal page containing recently added videos -- cgit v1.2.3