From 781a2e7c4fb8901e14e5a2b2d537185b88c36e97 Mon Sep 17 00:00:00 2001 From: Fabio Varesano Date: Thu, 21 Sep 2006 12:25:55 +0000 Subject: Patch #82224 by vhmauery (http://drupal.org/user/28957) Bring Video up to date with HEAD: updated all video modules to be used on next drupal 5.0 --- .../video_customfields/video_customfields.module | 24 ++++++- plugins/video_image/video_image.module | 2 +- .../video_multidownload/video_multidownload.module | 14 +++- plugins/video_upload/video_upload.module | 24 ++++++- video.module | 75 ++++++++++++---------- 5 files changed, 95 insertions(+), 44 deletions(-) diff --git a/plugins/video_customfields/video_customfields.module b/plugins/video_customfields/video_customfields.module index 972bdc1..fa48795 100644 --- a/plugins/video_customfields/video_customfields.module +++ b/plugins/video_customfields/video_customfields.module @@ -14,7 +14,7 @@ */ function video_customfields_help($section) { switch ($section) { - case 'admin/modules#description': + case 'admin/settings/modules#description': return t('Enable addition of custom fileds on video nodes created by video module.'); } } @@ -27,6 +27,24 @@ function video_customfields_perm() { return array('insert custom fields'); } +/** + * Implementation of hook_menu(). + */ +function video_customfields_menu($may_cache) { + $items = array(); + if ($may_cache) { + $items[] = array( + 'path' => 'admin/content/video/customfields', + 'title' => t('customfields'), + 'description' => t('administer video_customfields module settings'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('video_customfields_settings_form'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + } + return $items; +} /** * Settings Hook @@ -34,7 +52,7 @@ function video_customfields_perm() { * @return * string of form content or error message */ -function video_customfields_settings() { +function video_customfields_settings_form() { //Must have "administer site configuration" and "administer video" privilages. if (!user_access('administer video')) { drupal_access_denied(); @@ -88,7 +106,7 @@ function video_customfields_settings() { '#default_value' => variable_get('video_customgroupcollapsed', 1), '#description' => t('Should the custom fields group be initially collapsed when creating and editing video nodes?') ); - return $form; + return system_settings_form($form); } diff --git a/plugins/video_image/video_image.module b/plugins/video_image/video_image.module index 9664523..18c249b 100644 --- a/plugins/video_image/video_image.module +++ b/plugins/video_image/video_image.module @@ -63,7 +63,7 @@ function video_image_nodeapi(&$node, $op, $teaser) { break; case 'prepare': // check that image.module is actived - if ( !module_exist("image")) { + if ( !module_exists("image")) { db_query("UPDATE {system} SET status = 0 WHERE name ='video_image' AND type = 'module' LIMIT 1"); drupal_set_message(t('video_image module requires the %module module.
To prevent system errors video_image module has been disabled.
Please install the image module and then reactivate the video_image module.', array('%module' => l('image', 'http://drupal.org/project/image'))), 'error'); break; diff --git a/plugins/video_multidownload/video_multidownload.module b/plugins/video_multidownload/video_multidownload.module index b936224..23b1826 100644 --- a/plugins/video_multidownload/video_multidownload.module +++ b/plugins/video_multidownload/video_multidownload.module @@ -32,7 +32,15 @@ function video_multidownload_help($section) { function video_multidownload_menu($may_cache) { $items = array(); if ($may_cache) { - ; // for further uses + $items[] = array( + 'path' => 'admin/content/video/multidownload', + 'title' => t('multidownload'), + 'description' => t('administer video_multidownload module settings'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('video_multidownload_settings_form'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); } else { if (arg(0) == 'node' && is_numeric(arg(1))) { @@ -66,7 +74,7 @@ function video_multidownload_perm() { /** * Implementation of hook_settings() */ -function video_multidownload_settings() { +function video_multidownload_settings_form() { $form = array(); $options = array(1 => 'Yes', 0 => 'No'); @@ -84,7 +92,7 @@ function video_multidownload_settings() { '#default_value' => variable_get('video_download_ext', 'mov,wmv,rm,flv,avi,divx,mpg,mpeg,mp4,zip'), '#description' => t('The extensions of files to list from the multi-file download folder on the download page. Extensions should be comma seperated with no spaces, for example (mov,wmv,rm).')); - return $form; + return system_settings_form($form); } diff --git a/plugins/video_upload/video_upload.module b/plugins/video_upload/video_upload.module index e467d7e..41e79ae 100644 --- a/plugins/video_upload/video_upload.module +++ b/plugins/video_upload/video_upload.module @@ -14,19 +14,39 @@ */ function video_upload_help($section) { switch ($section) { - case 'admin/modules#description': + case 'admin/settings/modules#description': return t('Enable video files uploading in video module.'); } } +/** + * Implementation of hook_menu(). + */ +function video_upload_menu($may_cache) { + $items = array(); + if ($may_cache) { + $items[] = array( + 'path' => 'admin/content/video/upload', + 'title' => t('upload'), + 'description' => t('administer video_upload module settings'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('video_upload_settings_form'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); + } + return $items; +} + + /** * Settings Hook * * @return * string of form content or error message */ -function video_upload_settings() { +function video_upload_settings_form() { //Must have "administer site configuration" and "administer video" privilages. if (!user_access('administer video')) { drupal_access_denied(); diff --git a/video.module b/video.module index e16868a..5e3e0aa 100644 --- a/video.module +++ b/video.module @@ -35,10 +35,10 @@ function video_help($section = 'admin/help#video') {
  • Create video posts at create content >> video.
  • Administer video module settings at administer >> settings >> video.
  • -', array('%admin-block' => url('admin/block'), '%node-add-video' => url('node/add/video'), '%admin-settings-video' => url('admin/settings/video'))); +', array('%admin-block' => url('admin/settings/block'), '%node-add-video' => url('node/add/video'), '%admin-settings-video' => url('admin/content/video'))); $output .= '

    '. t('For more information please read the configuration and customization handbook Video page.', array('%video' => 'http://www.drupal.org/handbook/modules/video/')) .'

    '; return $output; - case 'admin/modules#description': + case 'admin/settings/modules#description': return t('Allows video nodes.'); case 'node/add#video': return t('Allows you to insert videos as nodes.'); @@ -91,6 +91,15 @@ function video_menu($may_cache) { 'path' => 'node/add/video', 'title' => t('video'), 'access' => user_access('create video')); + $items[] = array( + 'path' => 'admin/content/video', + 'title' => t('video settings'), + 'description' => t('administer video module settings'), + 'callback' => 'drupal_get_form', + 'callback arguments' => array('video_settings_form'), + 'access' => user_access('administer site configuration'), + 'type' => MENU_NORMAL_ITEM, + ); } else { //If $may_cache is false. if (arg(0) == 'node' && is_numeric(arg(1))) { @@ -136,7 +145,7 @@ function video_menu($may_cache) { * array of link information */ function video_link($type, $node = NULL) { - $link = ''; + $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. @@ -149,38 +158,28 @@ function video_link($type, $node = NULL) { if (user_access('play video')) { if (variable_get('video_displayplaylink', 1)) { - $link .= l(t('play'), "node/$node->nid/play", array('class' => 'outgoing', 'title' => t('play %link', array('%link' => $node->title)))); - $link .= ($display_download_link == 1) ? ' ' . t('or') . ' ' : ' | '; + $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 { - $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 .= l(t('download'), "node/$node->nid/download", array('class' => 'outgoing', 'title' => t('download %link', array('%link' => $node->title)))); - $link .= ' | '; - } - if (variable_get('video_displayplaytime', 1)) { - $link .= format_interval($node->playtime_seconds) . ' | '; - } - if (variable_get('video_displayfilesize', 1) and $node->size != 0) { - $link .= format_size($node->size) . ' | '; - } - if (variable_get('video_playcounter', 1) and user_access('view play counter')) { - $link .= $node->play_counter . ' ' . t('plays') . ' | '; - } - if (variable_get('video_downloadcounter', 1) and user_access('view download counter')) { - $link .= $node->download_counter . ' ' . t('downloads') . ' | '; + $link['video_download'] = array( + 'title' => t('download'), + 'href' => "node/$node->nid/download", + 'attributes' => array( + 'class' => 'outgoing', + 'title' => t('download %link', array('%link' => $node->title)), + ), + ); } - - $link = substr($link, 0, -3); //Trim the last " | " off. - return array($link); } - return array(); + return $link; } /** @@ -242,7 +241,7 @@ function video_perm() { * @return * string of form content or error message */ -function video_settings() { +function video_settings_form() { global $base_url; //Must have "administer site configuration" and "administer video" privilages. @@ -318,8 +317,7 @@ function video_settings() { '#default_value' => variable_get('video_downloadcounter', 1), '#description' => t('Counts a hit everytime someone downloads a video.')); - - return $form; + return system_settings_form($form); } /****************************************************************************** @@ -333,7 +331,12 @@ function video_settings() { * array */ function video_node_info() { - return array('video' => array('name' => t('video'), 'base' => 'video')); + return array('video' => array( + 'name' => t('video'), + 'module' => 'video', + 'description' => t('allow a variety of video formats to be posted as nodes in your site'), + ) + ); } /** @@ -625,8 +628,10 @@ function video_view(&$node, $teaser = FALSE, $page = FALSE) { $node = node_prepare($node, $teaser); //Run the body through the standard filters. // include the video css file - theme_add_style(drupal_get_path('module', 'video').'/video.css'); + drupal_add_css(drupal_get_path('module', 'video').'/video.css'); + $node->content['body'] = array('#value' => $node->body); + return $node; } /******************************************************************** -- cgit v1.2.3