From 8914e5e66485a1cb9ee1fb741ae47a561167104e Mon Sep 17 00:00:00 2001 From: Heshan Wanigasooriya Date: Mon, 27 Apr 2009 09:40:04 +0000 Subject: add video types to the latest version --- types/video_url/video_url.info | 5 ++ types/video_url/video_url.module | 102 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 107 insertions(+) create mode 100644 types/video_url/video_url.info create mode 100644 types/video_url/video_url.module (limited to 'types/video_url') diff --git a/types/video_url/video_url.info b/types/video_url/video_url.info new file mode 100644 index 0000000..a45f8a6 --- /dev/null +++ b/types/video_url/video_url.info @@ -0,0 +1,5 @@ +name = URL Video +description = Enable URL video support for Video module. +dependencies[] = video +package = "Video" +core = 6.x \ No newline at end of file diff --git a/types/video_url/video_url.module b/types/video_url/video_url.module new file mode 100644 index 0000000..1eaae16 --- /dev/null +++ b/types/video_url/video_url.module @@ -0,0 +1,102 @@ + + * porting to Drupal 6 + * @author Heshan Wanigasooriya + * @todo + */ + + +/** + * Implementation of hook_menu +*/ +function video_url_menu() { + $items = array(); + $maycache=true; + if($maycache) { + $items['node/add/video/url'] = array( + 'title' => 'URL', + 'access arguments' => array('create video') + ); + } + + return $items; +} + + +/** + * Implementation of hook_v_help +*/ +function video_url_v_help() { + + $help = array(); + $help['url']['data'] = '' . t('Url support') . ''; + $help['url']['children'] = array(t('You can link to any video file on the Internet.')); + + return $help; +} + + +/** + * Implementation of hook_v_info() +*/ +function video_url_v_info() { + $info['url'] = array( + '#name' => 'URL Video', + '#description' => t('Post a video available on the Internet to this website.'), + '#downloadable' => TRUE, + '#autothumbable' => FALSE, + '#autoresolution' => FALSE, + '#autoplaytime' => FALSE, + ); + + return $info; +} + + +/** + * Implementation of hook_v_form() +*/ +function video_url_v_form(&$node, &$form) { + + $form['video']['vidfile'] = array( + '#type' => 'textfield', + '#title' => t('URL to the video'), + '#default_value' => $node->vidfile, + '#maxlength' => 700, + '#required' => TRUE, + '#weight' => -20, + '#description' => t('Insert the URL to the video file. This shuold be something similar to http://www.example.com/videos/myvideo.flv') . ' ' . l(t('More information.'), 'video/help', array('fragment' => 'videofile'))); + + return $form; +} + + +/** + * implementation of hook_v_validate +*/ +function video_url_v_validate($node) { + // Can you suggest a validation? + // validation should allow URLs, relative paths but also streaming servers URLs +} + +/** + * Implementation of hook_v_play +*/ +function video_url_v_play($node) { + module_load_include('inc', 'video', 'includes/common'); + return _video_common_get_player($node); +} + + +/** + * Implements the hook_v_download +*/ +function video_url_v_download($node) { + $url = _video_get_fileurl($node->vidfile); + + header("Location: $url"); //Redirect to the video file URL. +} -- cgit v1.2.3