aboutsummaryrefslogtreecommitdiff
path: root/types
diff options
context:
space:
mode:
authorHeshan Wanigasooriya <heshanmw@gmail.com>2010-12-05 12:52:20 +0000
committerHeshan Wanigasooriya <heshanmw@gmail.com>2010-12-05 12:52:20 +0000
commit973537f36c8f33473a00190aa64fc30b82d94c04 (patch)
tree2c2f99a3bd254b145453fab186fdc824d34a260f /types
parent07e453e2ff2f66017eb49cc0374aa1531805a043 (diff)
downloadvideo-973537f36c8f33473a00190aa64fc30b82d94c04.tar.gz
video-973537f36c8f33473a00190aa64fc30b82d94c04.tar.bz2
Removing all files
Diffstat (limited to 'types')
-rw-r--r--types/uploadfield/uploadfield.css114
-rw-r--r--types/uploadfield/uploadfield.info18
-rw-r--r--types/uploadfield/uploadfield.install25
-rw-r--r--types/uploadfield/uploadfield.module540
-rw-r--r--types/uploadfield/uploadfield.theme.inc18
-rw-r--r--types/uploadfield/uploadfield_convert.inc102
-rw-r--r--types/uploadfield/uploadfield_file.inc123
-rw-r--r--types/uploadfield/uploadfield_formatter.inc173
-rw-r--r--types/uploadfield/uploadfield_thumb.inc47
-rw-r--r--types/uploadfield/uploadfield_transcode.inc13
-rw-r--r--types/uploadfield/uploadfield_widget.inc308
-rw-r--r--types/videoftp/videoftp.info12
-rw-r--r--types/videoftp/videoftp.install25
-rw-r--r--types/videoftp/videoftp.module200
-rw-r--r--types/videoftp/videoftp.theme.inc57
-rw-r--r--types/videoftp/videoftp_widget.inc313
16 files changed, 0 insertions, 2088 deletions
diff --git a/types/uploadfield/uploadfield.css b/types/uploadfield/uploadfield.css
deleted file mode 100644
index dc5b21a..0000000
--- a/types/uploadfield/uploadfield.css
+++ /dev/null
@@ -1,114 +0,0 @@
-/* $Id$ */
-
-.filefield-element .filefield-file-info, .video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-preview {
- min-width: 100px;
- min-height: 100px;
-}
-
-.filefield-element .imagefield-text {
- max-width: 40em; /* Reflect the maxlength of the ALT attribute (80 characters). */
-}
-
-.filefield-element .uploadfield-text {
- max-width: 40em;
-}
-
-.video_thumbnail {
- min-width: 100px;
- min-height: 100px;
-}
-
-.uploadfield {
-
-}
-
-.uploadfield-nodelink {
-
-}
-
-.uploadfield-video-thumb {
-
-}
-
-.uploadfield-video-thumb img{
- width : 250px;
-/* min-width: 100px; */
- min-height: 210px;
-
-}
-
-.uploadfield-video-thumb span{
- /* This is the overlay image for use as a play button. */
- background: url(../../images/play.png) no-repeat;
-
- /* This is the size of our button. DOES NOT WORK WITH DEFAULT THUMB SIZE! */
- width: 50px;
- height: 112px;
- position : absolute;
- margin : 65px 100px;
-}
-
-.uploadfield-video-thumb span:hover {
- background-position: -50px 0px;
-}
-
-.video-width-text {
- width:10px;
-}
-
-.video-thumb-selection{
-
-}
-
-.video-thumb-selection .form-item {
-
-}
-
-.video-thumbnails{
-/* display : block;*/
-}
-.video-thumbnails .form-item{
- float:left;
- margin-right:10px;
- max-width:30%;
- padding-right:10px;
-}
-
-.video-bypass-auto-conversion{
-
-}
-.video-default-thumbnail{
-
-}
-
-.video-data{
-
-}
-
-.video_image_teaser {
- float: left;
- padding: 0.5em;
-}
-
-br.video_image_clear {
- clear: both;
-}
-
-.video_image_view {
- /* inser here rules for node page image */
-}
-
-.video-ffmpeg-helper-inprogress {
- border: 1px solid red;
- padding: .5em;
-}
-
-/* override filefield entry */
-.widget-edit{
- max-width:70%;
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.info b/types/uploadfield/uploadfield.info
deleted file mode 100644
index a609098..0000000
--- a/types/uploadfield/uploadfield.info
+++ /dev/null
@@ -1,18 +0,0 @@
-; $Id$
-name = Video Upload
-description = handle video upload for video module using filefield and CCK.
-core = 7.x
-files[]= uploadfield.module
-files[]= uploadfield.install
-files[]= uploadfield.theme.inc
-files[]= uploadfield_convert.inc
-files[]= uploadfield_file.inc
-files[]= uploadfield_formatter.inc
-files[]= uploadfield_thumb.inc
-files[]= uploadfield_transcode.inc
-files[]= uploadfield_widget.inc
-dependencies[] = content
-dependencies[] = filefield
-dependencies[] = video
-package = "Video"
-
diff --git a/types/uploadfield/uploadfield.install b/types/uploadfield/uploadfield.install
deleted file mode 100644
index a2e1b65..0000000
--- a/types/uploadfield/uploadfield.install
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// $Id$
-
-/**
- * Implementation of hook_install().
- */
-function uploadfield_install() {
- drupal_load('module', 'content');
- content_notify('install', 'uploadfield');
-}
-
-function uploadfield_uninstall() {
- drupal_load('module', 'content');
- content_notify('uninstall', 'uploadfield');
-}
-
-function uploadfield_enable() {
- drupal_load('module', 'content');
- content_notify('enable', 'uploadfield');
-}
-
-function uploadfield_disable() {
- drupal_load('module', 'content');
- content_notify('disable', 'uploadfield');
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.module b/types/uploadfield/uploadfield.module
deleted file mode 100644
index a76f112..0000000
--- a/types/uploadfield/uploadfield.module
+++ /dev/null
@@ -1,540 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield core hooks and menu callbacks.
- */
-
-include_once dirname(__FILE__) . '/uploadfield_file.inc';
-include_once dirname(__FILE__) . '/uploadfield_widget.inc';
-
-/**
- * Implementation of hook_init().
- *
- * Load required includes.
- */
-function uploadfield_init() {
-// add CSS file
- drupal_add_css(drupal_get_path('module', 'video') .'/types/uploadfield/uploadfield.css');
- // If FileField is not available, immediately disable uploadfield.
- if (!module_exists('filefield')) {
- module_disable(array('uploadfield'));
- drupal_set_message(t('The uploadfield module has been disabled. The <a href="http://drupal.org/project/filefield">FileField module</a> needs to be installed for it to work properly.'));
- return;
- }
-}
-
-/**
- * Implementation of hook_theme().
- */
-function uploadfield_theme() {
- $theme = array();
- $theme = array(
- // Theme an image uploaded to uploadfield with alt and title.
- // TODO: Switch to core theme image if possible.
- 'uploadfield_image' => array(
- 'arguments' => array('file' => NULL,
- 'alt' => '',
- 'title' => '',
- 'attributes' => NULL,
- 'getsize' => TRUE),
- ),
- // Theme an uploadfield field item. It calls imagefied_image with the proper
- // item properties as arguments.
- 'uploadfield_item' => array(
- 'arguments' => array('item' => NULL),
- ),
- // uploadfield_widget form element type theme function.
- 'uploadfield_widget' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_widget.inc',
- ),
- // Use to generate a preview (admin view) of an uploadfield item for use in
- // field item forms and filefield widgets. Invoked by filefield_widget_process.
- 'uploadfield_widget_preview' => array(
- 'arguments' => array('item' => NULL),
- ),
- // Theme function for the field item elements. allows you to place children
- // within the context of the parent.
- 'uploadfield_widget_item' => array(
- 'arguments' => array('element' => NULL),
- ),
- // Generates and img tag to the admin thumbnail of an uploadfield upload.
- 'uploadfield_admin_thumbnail' => array(
- 'arguments' => array('item' => NULL),
- ),
- // Generates and img tag to the video thumbnails.
- 'uploadfield_widget_video_thumb' => array(
- 'arguments' => array('item' => NULL),
- ),
-
- // uploadfield formatter theme functions.
- 'uploadfield_formatter_video_plain' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
- 'uploadfield_formatter_video_nodelink' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
- 'uploadfield_formatter_video_imagelink' => array(
- 'arguments' => array('element' => NULL),
- 'file' => 'uploadfield_formatter.inc',
- ),
-
- //from includes/common.inc
- 'video_format_play' => array(
- 'arguments' => array( 'output' => NULL,
- 'url' => NULL,
- 'title' => NULL,
- 'link_text' => NULL
- ),
- ),
- 'video_play_dcr' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_divx' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_flash' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_ogg_theora' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_quicktime' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_realmedia' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_swf' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_play_windowsmedia' => array(
- 'arguments' => array('node' => NULL),
- ),
- 'video_encoding_failed' => array(
- 'arguments' => array(),
- ),
- 'video_inprogress' => array(
- 'arguments' => array(),
- ),
- );
- if(module_exists('imagecache')) {
- // imagecache presets
- foreach (imagecache_presets() as $preset) {
- $theme['uploadfield_formatter_'. $preset['presetname'] .'_videolinked'] = array(
- 'arguments' => array('element' => NULL),
- 'function' => 'theme_uploadfield_formatter_videolinked',
- 'file' => 'uploadfield_formatter.inc'
- );
- }
- }
-
- return $theme;
-}
-
-/**
- * Implementation of hook_elements().
- */
-function uploadfield_elements() {
- $elements = array();
-
- // An uploadfield is really just a FileField with extra processing.
- $filefield_elements = module_invoke('filefield', 'elements');
- $elements['uploadfield_widget'] = $filefield_elements['filefield_widget'];
- $elements['uploadfield_widget']['#process'][] = 'uploadfield_widget_process';
- $elements['uploadfield_widget']['#element_validate'][] = 'uploadfield_widget_validate';
-
- // uploadfield needs a separate value callback to save its alt and title texts.
- $elements['uploadfield_widget']['#value_callback'] = 'uploadfield_widget_value';
-
- return $elements;
-}
-
-/**
- * Implementation of hook_file_download.
- */
-function uploadfield_file_download($filepath) {
-// watchdog('video', 'file path is ' . $filepath);
-// echo $filepath;
-// Return headers for admin thumbnails if private files are enabled.
-// if (strpos($filepath, 'video_thumbs') !== FALSE) {
-// $original_path = str_replace('video_thumbs/', '', $filepath);
-// $original_full_path = file_create_path($original_path);
-// $thumb_full_path = file_create_path($filepath);
-//
-// // Allow access to temporary thumbnails, since they're not yet associated
-// // with a node. If not temporary, check access on the original file.
-// $status = db_result(db_query("SELECT status FROM {files} WHERE filepath = '%s'", $original_full_path));
-// $access = ($status == 0 || module_invoke_all('file_download', $original_path));
-// if ($access && $info = getimagesize($thumb_full_path)) {
-// return array(
-// 'Content-Type: ' . $info['mime'],
-// 'Content-Length: ' . filesize($thumb_full_path)
-// );
-// }
-// }
-
- // Return headers for default images.
-// if (strpos($filepath, 'uploadfield_default_images') !== FALSE) {
- if (strpos($filepath, 'video_thumbs') !== FALSE) {
- $full_path = file_create_path($filepath);
- if ($info = getimagesize($full_path)) {
- return array(
- 'Content-Type: ' . $info['mime'],
- 'Content-Length: ' . filesize($full_path)
- );
- }
- }
-}
-
-/**
- * Implementation of CCK's hook_widget_info().
- */
-function uploadfield_widget_info() {
- $module_path = drupal_get_path('module', 'uploadfield');
- return array(
- 'uploadfield_widget' => array(
- 'label' => t('Video'),
- 'field types' => array('filefield'),
- 'multiple values' => CONTENT_HANDLE_CORE,
- 'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
- 'description' => t('An edit widget for video files, including video thumbnails and transcoding to flash.'),
- ),
- );
-}
-
-/**
- * Implementation of CCK's hook_widget_settings().
- */
-function uploadfield_widget_settings($op, $widget) {
- switch ($op) {
- case 'form':
- return uploadfield_widget_settings_form($widget);
- case 'validate':
- return uploadfield_widget_settings_validate($widget);
- case 'save':
- return uploadfield_widget_settings_save($widget);
- }
-}
-
-/**
- * Implementation of CCK's hook_widget().
- *
- * Assign default properties to item and delegate to FileField.
- */
-function uploadfield_widget(&$form, &$form_state, $field, $items, $delta = 0) {
-// Add default values to items.
-// TODO: use CCK's default value callback.
- if (empty($items[$delta])) {
- $items[$delta] = array('alt' => '', 'title' => '');
- }
-
- // Start with the FileField widget as a basic start.
- // Note that FileField needs to modify $form by reference.
- $element = filefield_widget($form, $form_state, $field, $items, $delta);
-
- // Add uploadfield specific validators.
- // $element['#upload_validators'] = array_merge($element['#upload_validators'], uploadfield_widget_upload_validators($field));
-
- return $element;
-}
-
-/**
- * Get the additional upload validators for an image field.
- *
- * @param $field
- * The CCK field array.
- * @return
- * An array suitable for passing to file_save_upload() or the file field
- * element's '#upload_validators' property.
- */
-function uploadfield_widget_upload_validators($field) {
- $validators = array();
-
- // Ensure that only web images are supported.
- $web_extensions = array(
- 'mov', 'mp4', '3gp', '3g2', 'mpg', 'mpeg', // quicktime
- 'divx', //divx
- 'rm', // realplayer
- 'flv', 'f4v', //flash player
- 'swf', // swf player
- 'dir', 'dcr', // dcr player
- 'asf', 'wmv', 'avi', 'mpg', 'mpeg', // windows media
- 'ogg' // ogg theora
- );
- $extensions = array_filter(explode(' ', $field['widget']['file_extensions']));
- if (empty($extensions)) {
- $extensions = $web_extensions;
- }
- $validators['filefield_validate_extensions'][0] = implode(' ', array_intersect($extensions, $web_extensions));
-
- // Add the image validator as a basic safety check.
- // $validators['filefield_validate_is_image'] = array();
-
- // Add validators for resolutions.
- // if (!empty($field['widget']['max_resolution']) || !empty($field['widget']['min_resolution'])) {
- // $validators['filefield_validate_image_resolution'] = array(
- // $field['widget']['max_resolution'],
- // $field['widget']['min_resolution'],
- // );
- // }
-
- return $validators;
-}
-
-/**
- * Implementation of CCK's hook_field_formatter_info().
- */
-function uploadfield_field_formatter_info() {
- $module_path = drupal_get_path('module', 'uploadfield');
- $formatters = array(
- 'video_plain' => array(
- 'label' => t('video'),
- 'field types' => array('filefield'),
- 'description' => t('Displays video files with player embedded.'),
- ),
- 'video_nodelink' => array(
- 'label' => t('video thumbnail linked to video'),
- 'field types' => array('filefield'),
- 'description' => t('Displays video thumb files then the video.'),
- ),
- // 'video_imagelink' => array(
- // 'label' => t('Video Thumbnail linked to video file download'),
- // 'field types' => array('filefield'),
- // 'description' => t('Displays video files in their original size.'),
- // ),
- );
-
-if(module_exists('imagecache')) {
- foreach (imagecache_presets() as $preset) {
- $formatters[$preset['presetname'] .'_videolinked'] = array(
- 'label' => t('Preset @preset of video thumbnail linked to video', array('@preset' => $preset['presetname'])),
- 'field types' => array('filefield'),
- );
- }
-}
- return $formatters;
-}
-
-/**
- * Implementation of CCK's hook_default_value().
- */
-function uploadfield_default_value(&$form, &$form_state, $field, $delta) {
- return filefield_default_value($form, $form_state, $field, $delta);
-}
-
-/**
- * Implementation of hook_form_[form_id]_alter().
- *
- * Modify the add new field form to make "Image" the default formatter.
- */
-function uploadfield_form_content_field_overview_form_alter(&$form, &$form_state) {
- $form['#submit'][] = 'uploadfield_form_content_field_overview_submit';
-}
-
-/**
- * Submit handler to set a new field's formatter to "video_plain".
- */
-function uploadfield_form_content_field_overview_submit(&$form, &$form_state) {
- if (isset($form_state['fields_added']['_add_new_field']) && isset($form['#type_name'])) {
- $new_field = $form_state['fields_added']['_add_new_field'];
- $node_type = $form['#type_name'];
- $field = content_fields($new_field, $node_type);
- if ($field['widget']['module'] == 'uploadfield') {
- foreach ($field['display_settings'] as $display_type => $display_settings) {
- if ($field['display_settings'][$display_type]['format'] == 'default') {
- $field['display_settings'][$display_type]['format'] = 'video_plain';
- }
- }
- content_field_instance_update($field);
- }
- }
-}
-
-/**
- * @defgroup "Theme Callbacks"
- * @{
- * @see uploadfield_theme().
- */
-function theme_uploadfield_image($file, $alt = '', $title = '', $attributes = NULL, $getsize = TRUE) {
- $file = (array)$file;
- // return $file['filepath'];
- if (!is_file($file['filepath'])) {
- return '<!-- File not found: '. $file['filepath'] .' -->';
- }
-
- if ($getsize) {
- // Use cached width and height if available.
- if (!empty($file['data']['width']) && !empty($file['data']['height'])) {
- $attributes['width'] = $file['data']['width'];
- $attributes['height'] = $file['data']['height'];
- }
- // Otherwise pull the width and height from the file.
- elseif (list($width, $height, $type, $image_attributes) = @getimagesize($file['filepath'])) {
- $attributes['width'] = $width;
- $attributes['height'] = $height;
- }
- }
-
- if (!empty($title)) {
- $attributes['title'] = $title;
- }
-
- // Alt text should be added even if it is an empty string.
- $attributes['alt'] = $alt;
-
- // Add a timestamp to the URL to ensure it is immediately updated after editing.
- $query_string = '';
- if (isset($file['timestamp'])) {
- $query_character = (variable_get('file_downloads', FILE_DOWNLOADS_PUBLIC) == FILE_DOWNLOADS_PRIVATE && variable_get('clean_url', '0') == '0') ? '&' : '?';
- $query_string = $query_character . $file['timestamp'];
- }
-
- $url = file_create_url($file['filepath']) . $query_string;
- $attributes['src'] = $url;
- $attributes = drupal_attributes($attributes);
- return '<span></span><img '. $attributes .' />';
-}
-
-function theme_uploadfield_item($item) {
- return theme('uploadfield_image', $item, $item['alt'], $item['title']);
-}
-
-function theme_uploadfield_widget_preview($item = NULL) {
- return '<div class="uploadfield-preview">' . theme('uploadfield_admin_thumbnail', $item) . '</div>';
-}
-
-function theme_uploadfield_widget_item($element) {
- return theme('filefield_widget_item', $element);
-}
-
-function theme_uploadfield_admin_thumbnail($item = NULL) {
- if (is_null($item) || empty($item['filepath'])) {
- return '<!-- link to default admin thumb -->';
- }
- $thumb_path = uploadfield_file_admin_thumb_path($item);
- return '<img src="'. file_create_url($thumb_path) .'" title="' . check_plain($item['filename']) . '" />';
-}
-
-function theme_uploadfield_widget_video_thumb($item = NULL) {
- return '<div class="uploadfield-video-thumb">' . theme('uploadfield_image', $item, '', '', '', FALSE) . '</div>';
-}
-/**
- * @} End defgroup "Theme Callbacks".
- */
-
-/**
- * Implementing video module API
- * hook_v_perm()
- */
-
-function uploadfield_v_perm() {
- return array('use default thumbnail', 'bypass conversion video');
-}
-
-/**
- * Implementation of hook_v_help
- */
-function video_upload_v_help() {
-
- $help = array();
- $help['upload']['data'] = '<b>' . t('Upload support') . '</b>';
- $help['upload']['children'] = array(t('You can upload a video file from your computer to this website.'));
-
- return $help;
-}
-
-
-/**
- * Implements the hook_v_auto_resolution
- */
-function uploadfield_v_auto_resolution($vidfile) {
-//TODO : add dynamic converter selector
- module_load_include('inc', 'video', '/plugins/ffmpeg');
- if(module_hook('ffmpeg', 'auto_playtime')) {
- return ffmpeg_auto_playtime($vidfile);
- }
- return false;
-}
-
-
-/**
- * Implements the hook_v_auto_resolution
- */
-function uploadfield_v_auto_playtime($vidfile) {
-//TODO : add dynamic converter selector
- module_load_include('inc', 'video', '/plugins/ffmpeg');
- if(module_hook('ffmpeg', 'auto_playtime')) {
- return ffmpeg_auto_playtime($vidfile);
- }
- return false;
-}
-
-/**
- * Implementation of hook_v_video()
- */
-function uploadfield_v_video($op, &$element) {
- global $user;
- switch ($op) {
- case 'insert':
- case 'update':
- // TODO : need to add validation on just submit scenario
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // auto thumbnailing
- if($field['widget']['autothumbnail']) {
- $update = NULL;
- $vidfile = $element['#value'];
- $vid = $vidfile['fid'];
- $vid_path = $vidfile['data']['video_thumb'];
- $vid_dir = explode('/', $vid_path);
- $vid_name = $vid_dir[count($vid_dir) - 1];
-
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->status = FILE_STATUS_PERMANENT;
- $file->filename = $vid_name;
- $file->filepath = $vid_path;
- $file->filemime = file_get_mimetype($vid_name);
- $file->filesize = filesize($vid_path);
- $file->timestamp = REQUEST_TIME;
-
- if($op == 'update') {
- $old_fid = $element['#default_value']['data']['video_thumb_fid'];
- $update = 'fid';
- $file->fid = $old_fid;
- }
- drupal_write_record ('files', $file, $update);
- // get fid if and only if insert
- if($op == 'insert')
- $file->fid = db_last_insert_id('files', 'fid');
- // add file id to the data
- $element['data']['video_thumb_fid'] = array (
- '#type'=> 'value',
- '#value' => $file->fid
- );
- }
-
- // auto covnersion
- if($field['widget']['autoconversion']) {
- video_auto_transcode_add_to_queue($element, $op);
- }
- break;
- case 'delete':
- //delete thumbnails
- break;
- case 'thumbs':
- include_once dirname(__FILE__) . '/uploadfield_thumb.inc';
- //create thumbs and display
- video_auto_thumb_process($element);
- break;
- case 'convert':
- include_once dirname(__FILE__) . '/uploadfield_convert.inc';
- //create FLV file
-// video_auto_transcode_process($element);
- break;
- }
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield.theme.inc b/types/uploadfield/uploadfield.theme.inc
deleted file mode 100644
index 5a81efd..0000000
--- a/types/uploadfield/uploadfield.theme.inc
+++ /dev/null
@@ -1,18 +0,0 @@
-<?php
-//$Id$
-/**
- *
- * @file
- * Theme functions for the videoftp module.
- */
-
-/**
- * FormAPI theme function. Theme the output of an video upload field.
- */
-function theme_uploadfield_widget($element) {
- return theme('form_element', $element, $element['#children']);
-}
-
-function theme_uploadfield_widget_item($element) {
- return theme('filefield_widget_item', $element);
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_convert.inc b/types/uploadfield/uploadfield_convert.inc
deleted file mode 100644
index fbd13ac..0000000
--- a/types/uploadfield/uploadfield_convert.inc
+++ /dev/null
@@ -1,102 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable conversion control on video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-
-/**
- * Define some constants
- */
-define('VIDEO_RENDERING_PENDING', 1);
-define('VIDEO_RENDERING_ACTIVE', 5);
-define('VIDEO_RENDERING_COMPLETE', 10);
-define('VIDEO_RENDERING_FAILED', 20);
-
-function video_auto_transcode_process(&$element) {
-// $file = $element['#value'];
-// $element['data']['old_vid'] = array(
-// '#type' => 'value',
-// '#value' => $file['fid']
-// );
-// $element['data']['vid_transcode_status'] = array(
-// '#type' => 'value',
-// '#value' => VIDEO_RENDERING_PENDING
-// );
-}
-
-/**
- * Add a video conversion rendering process to the queue
- */
-function video_auto_transcode_add_to_queue(&$element, $op) {
- $file = $element['#value'];
-
- //load cck instace settings
-// $field = content_fields($element['#field_name'], $element['#type_name']);
-// $resolution = array_filter(explode(':', $field['widget']['default_resolution']));
-// $element['#item']['data']['height'] = $element['#item']['data']['width'] * ($resolution[1]/$resolution[0]);
-
-// $serialized_data = array('resolution' =>$field['widget']['default_resolution'], 'width' => $element['#item']['data']['width']);
-
- $fid = $file['fid'];
-
- switch($op) {
- case 'insert':
- db_query('INSERT INTO {video_rendering} (fid, pid, status, started, completed)
- VALUES (%d, %d, %d, %d, %d)',
- $fid, 0, VIDEO_RENDERING_PENDING, 0, 0);
- drupal_set_message(t('Video submission queued for processing. Please wait: our servers are preparing your video for web displaying.'));
- break;
-
- case 'update':
- $old_fid = $element['#default_value']['fid'];
- $serialized_data ['old_file'] = $old_fid;
- if($old_fid != $fid) {
- db_query('DELETE FROM {video_rendering} WHERE fid = %d', $old_fid);
- db_query('INSERT INTO {video_rendering} (fid, pid, status, started, completed, serialized_data)
- VALUES (%d, %d, %d, %d, %d, \'%s\')',
- $fid, 0, VIDEO_RENDERING_PENDING, 0, 0, serialize($serialized_data));
- drupal_set_message(t('Video submission queued for processing. Please wait: our servers are preparing your video for web displaying.'));
- }
- break;
- }
-}
-
-function _video_get_content_types() {
- $widget_info = uploadfield_widget_info();
- $content_types = array();
- foreach ($widget_info as $key => $value) {
- $query = "SELECT type_name FROM {content_node_field_instance} WHERE widget_type='%s'";
- $result = db_query($query, $key);
- while ($row = db_fetch_object($result)) {
- $content_types[] = $row->type_name;
- }
- }
- return $content_types;
-}
-
-function _video_get_field_by_content_type($content_type) {
- $type = content_types($content_type);
-
- $fields = $type['fields'];
- $field_name = '';
- foreach ($fields as $field) {
- if ($field['type'] == 'filefield') {
- $db_info = content_database_info($field);
- $db_info = array_merge($db_info, $field);
- return $db_info;
- }
- }
-}
-
-function _video_get_nid_by_video_token($content_type, $fid) {
- $field_info = _video_get_field_by_content_type($content_type);
- $query = "SELECT nid FROM {%s} WHERE %s = '%s'";
- $result = db_query($query, $field_info['table'], $field_info['field_name'] .'_fid', $fid);
- $nid = db_fetch_object($result);
- return $nid;
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_file.inc b/types/uploadfield/uploadfield_file.inc
deleted file mode 100644
index cff6c7f..0000000
--- a/types/uploadfield/uploadfield_file.inc
+++ /dev/null
@@ -1,123 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * hook_file and uploadfield file functions.
- */
-
-/**
- * Implementation of hook_file_insert().
- */
-function uploadfield_file_insert($file) {
-// Currently empty. Thumbnails are now generated on preview.
-}
-
-/**
- * Implementation of hook_file_delete().
- *
- * Delete the admin thumbnail when the original is deleted.
- */
-function uploadfield_file_delete($file) {
-// delete thumb from files
-// file_set_status($file->data['video_thumb_fid'], FILE_STATUS_TEMPORARY);
- db_query('DELETE FROM {files} WHERE fid = %d', $file->data['video_thumb_fid']);
-
- // delete thums directory
- $thumbs_path = variable_get('video_thumb_path', 'video_thumbs');
- //files will save in files/video_thumbs/#fileId folder
- $tmp = file_directory_path(). '/' . $thumbs_path . '/' . $file->fid . '/';
- // rmdir($tmp);
- _file_delete_tree($tmp);
-// if(@rmdir($tmp)) {
-// }
-}
-
-
-// delete dir and its content
-function _file_delete_tree($current_dir) {
- if($dir = @opendir($current_dir)) {
- while (($f = readdir($dir)) !== false) {
- if($f > '0' and filetype($current_dir.$f) == "file") {
- file_delete($current_dir.$f);
- } elseif($f > '0' and filetype($current_dir.$f) == "dir") {
- _file_delete_tree($current_dir.$f."\\");
- }
- }
- closedir($dir);
- rmdir($current_dir);
- }
-}
-
-/**
- * Simple utility function to check if a file is an image.
- */
-function uploadfield_file_is_image($file) {
- return TRUE;
- //TODO : add file validations
- $file = (object)$file;
- return in_array($file->filemime, array('image/jpg', 'image/pjpeg', 'image/jpeg', 'image/png', 'image/gif'));
-}
-
-/**
- * Given a file, return the path the image thumbnail used while editing.
- */
-function uploadfield_file_admin_thumb_path($file, $create_thumb = TRUE) {
- $file = (object)$file;
- $short_path = preg_replace('/^' . preg_quote(file_directory_path(), '/') . '/', '', $file->filepath);
- $filepath = file_directory_path() . '/video_thumb' . $short_path;
-
- if ($create_thumb) {
- uploadfield_create_admin_thumb($file->filepath, $filepath);
- }
-
- return $filepath;
-}
-
-/**
- * Create a thumbnail to be shown while editing an image.
- */
-function uploadfield_create_admin_thumb($source, $destination) {
- if (!is_file($source)) {
- return FALSE;
- }
-
- $info = image_get_info($source);
- $size = explode('x', variable_get('uploadfield_thumb_size', '100x100'));
-
- // Check if the destination image needs to be regenerated to match a new size.
- if (is_file($destination)) {
- $thumb_info = image_get_info($destination);
- if ($thumb_info['width'] != $size[0] && $thumb_info['height'] != $size[1] && ($info['width'] > $size[0] || $info['height'] > $size[1])) {
- unlink($destination);
- }
- else {
- return;
- }
- }
-
- // Ensure the destination directory exists and is writable.
- $directories = explode('/', $destination);
- array_pop($directories); // Remove the file itself.
- // Get the file system directory.
- $file_system = file_directory_path();
- foreach ($directories as $directory) {
- $full_path = isset($full_path) ? $full_path . '/' . $directory : $directory;
- // Don't check directories outside the file system path.
- if (strpos($full_path, $file_system) === 0) {
- field_file_check_directory($full_path, FILE_CREATE_DIRECTORY);
- }
- }
-
- // Create the thumbnail.
- if ($info['width'] <= $size[0] && $info['height'] <= $size[1]) {
- file_copy($source, $destination);
- }
- elseif (image_get_toolkit() && @image_scale($source, $destination, $size[0], $size[1])) {
- // Set permissions. This is done for us when using file_copy().
- @chmod($destination, 0664);
- }
- else {
- drupal_set_message(t('An image thumbnail was not able to be created.'), 'error');
- }
-}
diff --git a/types/uploadfield/uploadfield_formatter.inc b/types/uploadfield/uploadfield_formatter.inc
deleted file mode 100644
index c4c62ac..0000000
--- a/types/uploadfield/uploadfield_formatter.inc
+++ /dev/null
@@ -1,173 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield formatter hooks and callbacks.
- */
-
-//include common player file
-
-/**
- * Define some constants
- */
-defined('VIDEO_RENDERING_PENDING')
- or define('VIDEO_RENDERING_PENDING', 1);
-defined('VIDEO_RENDERING_ACTIVE')
- or define('VIDEO_RENDERING_ACTIVE', 5);
-defined('VIDEO_RENDERING_COMPLETE')
- or define('VIDEO_RENDERING_COMPLETE', 10);
-defined('VIDEO_RENDERING_FAILED')
- or define('VIDEO_RENDERING_FAILED', 20);
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-function theme_uploadfield_formatter_video_plain($element) {
-// print_r($field = content_fields($element['#field_name'], $element['#type_name']););
-// Inside a view $element may contain null data. In that case, just return.
- module_load_include('inc', 'video', '/includes/common');
-
- if (empty($element['#item']['fid'])) {
- return '';
- }
-//print_r($element['#item']['fid']);
- $result = db_query('SELECT vr.status FROM {video_rendering} vr INNER JOIN {files}
- f ON vr.fid = f.fid WHERE vr.fid = f.fid AND f.status = %d AND f.fid = %d',
- FILE_STATUS_PERMANENT, $element['#item']['fid']);
- $status = db_fetch_object($result);
-// print_r($status);
- if($status->status == VIDEO_RENDERING_ACTIVE || $status->status == VIDEO_RENDERING_PENDING) {
- return theme('video_inprogress');
- }
- else if ($status->status == VIDEO_RENDERING_FAILED) {
- return theme('video_encoding_failed');
- }
- else {
- return _video_common_get_player($element);
- }
-// $field = content_fields($element['#field_name']);
-// $item = $element['#item'];
-//
-// $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
-// $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
-//
-// $class = 'uploadfield uploadfield-'. $field['field_name'];
-// return theme('uploadfield_image', $item, $item['data']['alt'], $item['data']['title'], array('class' => $class));
-}
-
-
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-
-function theme_uploadfield_formatter_video_nodelink($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
- // print_r($field);
- // exit;
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $use_default_img = $element['#item']['data']['use_default_video_thumb'];
- if($use_default_img) {
- $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- }
- else if($element['#item']['data']['video_thumb']) {
- // print_r($field['widget']['default_video_thumb']);
- $thumb = array('filepath' => $element['#item']['data']['video_thumb']);
- $imagetag = theme('uploadfield_widget_video_thumb', $thumb);
- }
- $class = 'popups uploadfield uploadfield-nodelink uploadfield-'. $element['#field_name'];
- return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
-
-}
-
-/**
- * use image cache profiles for video thumb display
- * @param object $element
- * @return HTML image file
- */
-
-function theme_uploadfield_formatter_videolinked($element) {
- // Inside a view $element may contain NULL data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
-
- // Extract the preset name from the formatter name.
- $presetname = substr($element['#formatter'], 0, strrpos($element['#formatter'], '_'));
- $style = 'linked';
-
- $item = $element['#item'];
- $item['data']['alt'] = isset($item['data']['alt']) ? $item['data']['alt'] : '';
- $item['data']['title'] = isset($item['data']['title']) ? $item['data']['title'] : NULL;
-
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $use_default_img = $element['#item']['data']['use_default_video_thumb'];
- if($use_default_img) {
- $thumb_path = $field['widget']['default_video_thumb'];
-// $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- }
- else if($element['#item']['data']['video_thumb']) {
- // print_r($field['widget']['default_video_thumb']);
-// $thumb = array('filepath' => $element['#item']['data']['video_thumb']);
- $thumb_path = $element['#item']['data']['video_thumb'];
-// $imagetag = theme('uploadfield_widget_video_thumb', $thumb);
- }
-// die($presetname);
- $imagetag = theme('imagecache', $presetname, $thumb_path, $node->title, $node->title);
- $path = empty($item['nid']) ? '' : 'node/'. $item['nid'];
- $class = "imagecache imagecache-$presetname imagecache-$style imagecache-{$element['#formatter']}";
- return l($imagetag, $path, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/**
- *
- * @param <type> $element
- * @return <type>
- */
-function theme_uploadfield_formatter_video_imagelink($element) {
- $field = content_fields($element['#field_name'], $element['#type_name']);
- // Inside a view $element may contain null data. In that case, just return.
- if (empty($element['#item']['fid'])) {
- return '';
- }
-
- $node = $element['#node'];
- // $imagetag = theme('uploadfield_formatter_video_plain', $element);
- $imagetag = theme('uploadfield_widget_video_thumb', $field['widget']['default_video_thumb']);
- $class = 'popups uploadfield uploadfield-nodelink uploadfield-'. $element['#field_name'];
- return l($imagetag, 'node/'. $node->nid, array('attributes' => array('class' => $class), 'html' => TRUE));
-}
-
-/**
- * Displays a "encoding in progress message"
- */
-function theme_video_inprogress() {
- return '<div class="video-ffmpeg-helper-inprogress">'. t('This video is currently being processed. Please wait.') . '</div>';
-}
-
-
-/**
- * Display an "encoding failed" message"
- */
-function theme_video_encoding_failed() {
- return '<div class="video-ffmpeg-helper-encoding-failed">'. t('The video conversion process has failed. You might want to submit a simpler video format like <em>mpeg</em> or <em>divx avi</em>.<br />If the problem persists please contact website administrators.') . '</div>';
-}
-
-
-/**
- * Implementation of hook_theme().
- */
-function video_ffmpeg_helper_theme() {
- return array(
-
- );
-} \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_thumb.inc b/types/uploadfield/uploadfield_thumb.inc
deleted file mode 100644
index 74aeb80..0000000
--- a/types/uploadfield/uploadfield_thumb.inc
+++ /dev/null
@@ -1,47 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable image support for video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-function video_auto_thumb_process (&$element) {
-//developed for ffmpeg support
- $file = $element['#value'];
-// $field = content_fields($element['#field_name'], $element['#type_name']);
- if (isset($element['preview']) && $file['fid'] != 0) {
- // TODO : change this to use any transcode to generate thumbnails
- $transcoder = variable_get('vid_convertor', 'ffmpeg');
- module_load_include('inc', 'video', '/plugins/' . $transcoder);
- $function = variable_get('vid_convertor', 'ffmpeg') . '_auto_thumbnail';
- if (function_exists($function)) {
- // $thumbs = ffmpeg_auto_thumbnail($file);
- $thumbs = $function($file);
- }
- else {
- drupal_set_message(t('Transcoder not configured properly'), 'error');
- }
- $default_thumb = '';
- $rnd_img = rand(1, variable_get('no_of_video_thumbs', 5));
- $default_thumb = $thumbs[$rnd_img]->filepath;
-
- if(is_array($thumbs)) {
- foreach($thumbs as $fid => $img) {
- $thumbss[$img->filepath] = theme('uploadfield_image', $img, '', '', array('width' => '50'), FALSE);
- }
- }
- }
-
- $element['data']['video_thumb'] = array(
- '#type' => 'radios',
- '#title' => t('Video Thumbnails'),
- '#options' => $thumbss,
- '#default_value' => !empty($file['data']['video_thumb']) ? $file['data']['video_thumb'] : $default_thumb,
- // '#description' => t('Pleaes choose a thumbnail from above'),
- '#weight' => 10,
- '#attributes' => array('class' => 'video-thumbnails'),
- );
- } \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_transcode.inc b/types/uploadfield/uploadfield_transcode.inc
deleted file mode 100644
index 39db634..0000000
--- a/types/uploadfield/uploadfield_transcode.inc
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-//$Id$
-
-/**
- * @file
- * Enable conversion control on video module.
- *
- * @author Heshan Wanigasooriya <heshan at heidisoft dot com, heshanmw at gmail dot com>
- */
-
-function video_auto_transcode_process (&$element) {
-
- } \ No newline at end of file
diff --git a/types/uploadfield/uploadfield_widget.inc b/types/uploadfield/uploadfield_widget.inc
deleted file mode 100644
index fafdb5e..0000000
--- a/types/uploadfield/uploadfield_widget.inc
+++ /dev/null
@@ -1,308 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * uploadfield widget hooks and callbacks.
- */
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'form').
- */
-function uploadfield_widget_settings_form($widget) {
- $form = module_invoke('filefield', 'widget_settings', 'form', $widget);
-
- if ($form['file_extensions']['#default_value'] == 'txt') {
- $form['file_extensions']['#default_value'] = 'mp4 mpeg avi mpg wmv flv';
- }
-
- // Default video player settings.
- $form['player'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Player Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#weight' => 9
- );
-
- $form['player']['default_resolution'] = array(
- '#type' => 'textfield',
- '#title' => t('Default Video Resolution'),
- '#default_value' => !empty($widget['default_resolution']) ? $widget['default_resolution'] : '16:9',
- '#size' => 15,
- '#maxlength' => 5,
- '#description' => t('Default player resolution WIDTH:HEIGHT in px. eg : 16:9 for widescreen or 4:3 for general screen'),
- );
-
- $form['player']['default_width'] = array(
- '#type' => 'textfield',
- '#title' => t('Default Video Player Width'),
- '#default_value' => !empty($widget['default_width']) ? $widget['default_width'] : 640,
- '#size' => 15,
- '#maxlength' => 5,
- '#description' => t('Default player WIDTH:HEIGHT in px. eg : 640 for 640X480 player size if resolution it 4:3'),
- );
-
-
- // Default image settings.
- $form['default'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Thumbnail Settings'),
- '#element_validate' => array('_uploadfield_widget_settings_default_validate'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 10
- );
-
- // Present a video image of the current default image.
- if (!empty($widget['default_video_thumb'])) {
- $form['default']['default_video_thumbnail'] = array(
- '#type' => 'markup',
- '#value' => theme('uploadfield_image', $widget['default_video_thumb'], '', '', array('width' => '150'), FALSE),
- '#prefix' => '<div class="video_thumbnail">',
- '#suffix' => '</div>'
- );
- }
-
- $form['default']['default_video_thumb_upload'] = array(
- '#type' => 'file',
- '#title' => empty($widget['default_video_thumb']) ? t('Upload video thumbnail') : t('Replace video thumbnail with'),
- '#description' => t('Choose a image that will be used as default video thumbnail.'),
- );
-
- // We set this value on 'validate' so we can get CCK to add it
- // as a standard field setting.
- $form['default_video_thumb'] = array(
- '#type' => 'value',
- '#value' => $widget['default_video_thumb'],
- );
-
- // Default image settings.
- $form['plugings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Video Advanced Settings'),
- '#collapsible' => TRUE,
- '#collapsed' => FALSE,
- '#weight' => 10
- );
- $form['plugings']['autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable auto conversion video'),
- '#description' => t('Use ffmpeg(Default) to automatically convert videos to web compatible types eg. FLV, Please make sure to configure convertor settings.'),
- '#default_value' => $widget['autoconversion'],
- );
- $form['plugings']['autothumbnail'] = array(
- '#type' => 'checkbox',
- '#title' => t('Enable auto thumbnail video'),
- '#description' => t('Use ffmpeg(Default) to automatically thumbnails, Please make sure to configure convertor settings.'),
- '#default_value' => $widget['autothumbnail'],
- );
-
-
- return $form;
-}
-
-/**
- * Element specific validation for uploadfield default value.
- *
- * Validated in a separate function from uploadfield_field() to get access
- * to the $form_state variable.
- */
-function _uploadfield_widget_settings_default_validate($element, &$form_state) {
-// Verify the destination exists
- $destination = file_directory_path() .'/video_thumb';
- if (!field_file_check_directory($destination, FILE_CREATE_DIRECTORY)) {
- form_set_error('default_video_thumb', t('The default image could not be uploaded. The destination %destination does not exist or is not writable by the server.', array('%destination' => dirname($destination))));
- return;
- }
-
- $validators = array (
- 'file_validate_is_image' => array(),
- );
-
- // We save the upload here because we can't know the correct path until the file is saved.
- if (!$file = file_save_upload('default_video_thumb_upload', $validators, $destination)) {
- // No upload to save we hope... or file_save_upload() reported an error on its own.
- return;
- }
-
- // Remove old image (if any) & clean up database.
- $old_default = $form_state['values']['default_video_thumb'];
- if (!empty($old_default['fid'])) {
- if (file_delete(file_create_path($old_default['filepath']))) {
- db_query('DELETE FROM {files} WHERE fid=%d', $old_default['fid']);
- }
- }
-
- // Make the file permanent and store it in the form.
- file_set_status($file, FILE_STATUS_PERMANENT);
- $file->timestamp = REQUEST_TIME;
- $form_state['values']['default_video_thumb'] = (array)$file;
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'validate').
- */
-function uploadfield_widget_settings_validate($widget) {
-// Check that only web images are specified in the callback.
- $extensions = array_filter(explode(' ', $widget['file_extensions']));
- $web_extensions = array(
- 'mov', 'mp4', '3gp', '3g2', 'mpg', 'mpeg', // quicktime
- 'divx', //divx
- 'rm', // realplayer
- 'flv', 'f4v', //flash player
- 'swf', // swf player
- 'dir', 'dcr', // dcr player
- 'asf', 'wmv', 'avi', 'mpg', 'mpeg', // windows media
- 'ogg' // ogg theora
- );
- if (count(array_diff($extensions, $web_extensions))) {
- form_set_error('file_extensions', t('Only web-standard videos are supported through the video widget. If needing to upload other types of files, change the widget to use a standard file upload.'));
- }
-
- // Check that set video resolutions are valid.
- foreach (array('default_width') as $numerics) {
- if (!empty($widget[$numerics]) && !preg_match('/^[0-9]+$/', $widget[$numerics])) {
- form_set_error($numerics, t('Please specify default width in integers only (e.g. 640).'));
- }
- }
-
- // Check that set resolutions are valid.
- foreach (array('default_resolution') as $resolution) {
- if (!empty($widget[$resolution]) && !preg_match('/^[0-9]+:[0-9]+$/', $widget[$resolution])) {
- form_set_error($resolution, t('Please specify a resolution in the format WIDTH:HEIGHT (e.g. 16:9).'));
- }
- }
-// Check for convertor is installed
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'save').
- */
-function uploadfield_widget_settings_save($widget) {
- $filefield_settings = module_invoke('filefield', 'widget_settings', 'save', $widget);
- return array_merge($filefield_settings, array('default_video_thumb', 'default_width', 'default_resolution', 'autoconversion', 'autothumbnail'));
-}
-
-/**
- * Element #value_callback function.
- */
-function uploadfield_widget_value($element, $edit = FALSE) {
- $item = filefield_widget_value($element, $edit);
- // print_r($edit);
- // exit;
- // if ($edit) {
- // $item['alt'] = isset($edit['alt']) ? $edit['alt'] : '';
- // $item['title'] = isset($edit['title']) ? $edit['title'] : '';
- // $item['video_thumb_fid'] = isset($edit['default_video_thumb']['fid']) ? $edit['default_video_thumb']['fid'] : 'novalue';
- // }
- // else {
- // $item['alt'] = '';
- // $item['title'] = '';
- // $item['default_video_thumb'] = '';
- // }
- return $item;
-}
-
-/**
- * Element #process callback function.
- */
-function uploadfield_widget_process($element, $edit, &$form_state, $form) {
-// TODO : get play duration/ image thumbnails
- $file = $element['#value'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $element['#theme'] = 'uploadfield_widget_item';
-
- if (isset($element['preview']) && $file['fid'] != 0) {
- //TODO : implement preview video play
- $tml_thumb = !empty($file['data']['video_thumb']) ? array('filepath' => $file['data']['video_thumb']) : $field['widget']['default_video_thumb'];
- $element['preview']['#suffix'] = '<div class="video_thumbnail">' .
- theme('uploadfield_image', $tml_thumb, '', '', array('width' => '150'), FALSE) .
- '</div>';
- }
-
- // Check if using the default width and replace tokens.
- $default_width = user_access('override player width');
- $element['data']['width'] = array(
- '#type' => $default_width ? 'textfield' : 'value',
- '#title' => t('Width for Player'),
- '#default_value' => empty($file['data']['width']) ? $field['widget']['default_width'] : $file['data']['width'],
- '#description' => t('Set player width(in pix) here, make sure your video have good resolution to fit on larger values.'),
- '#size' => 15,
- '#maxlength' => 5,
- '#attributes' => array('class' => 'video-width-text'),
- );
- if(!$default_width){
- $element['data']['width']['#value'] = empty($file['data']['width']) ? $field['widget']['default_width'] : $file['data']['width'];
- }
-
- // only in preview mode and then create thumbnails
- if($field['widget']['autoconversion']) {
- video_module_invoke('convert', $element);
- //bypass auto conversion
- if (user_access('bypass conversion video')) {
- $element['data']['bypass_autoconversion'] = array(
- '#type' => 'checkbox',
- '#title' => t('Bypass auto conversion'),
- '#default_value' => !empty($file['data']['bypass_autoconversion']) ? $file['data']['bypass_autoconversion'] : FALSE,
- '#description' => t('This will bypass your auto conversion of videos.'),
- '#attributes' => array('class' => 'video-bypass-auto-conversion'),
- );
- }
- }
-
- //Create video thubs and save in a directory then we can get thumbnails from it using folder read
-
- // only in preview mode and then create thumbnails
- if($field['widget']['autothumbnail']) {
- video_module_invoke('thumbs', $element);
- }
- // default image default_image
- if (user_access('use default thumbnail') && !empty($field['widget']['default_video_thumb'])) {
- $element['data']['use_default_video_thumb'] = array(
- '#type' => 'checkbox',
- '#title' => t('Override Video Thumbnail with Default'),
- '#default_value' => !empty($file['data']['use_default_video_thumb']) ? $file['data']['use_default_video_thumb'] : FALSE,
- '#description' => t('If you want to use default image instead of using actual thumbnail of video then check.'),
- '#weight' => 9,
- '#attributes' => array('class' => 'video-default-thumbnail'),
- );
- }
-
-
- // creating Update/Insert/Delete API
- // TODO : use if any better solution than this with filefield
- // hook_v_video()
- if($form_state['submitted'] == 1) {
- switch($form_state['values']['op']) {
- case t('Save'):
- // print_r($form);
- // exit;
- // update
- if(!empty($form_state['values']['nid'])) {
- video_module_invoke('update', $element);
- }
- // insert
- else {
- video_module_invoke('insert', $element);
- }
- break;
- case t('Preview'):
- // module_invoke_all('v_preview');
- break;
- case t('Delete'):
- video_module_invoke('delete', $element);
- break;
- }
- }
-
- return $element;
-}
-
-/**
- * FormAPI theme function. Theme the output of an video upload field.
- */
-function theme_uploadfield_widget($element) {
- drupal_add_css(drupal_get_path('module', 'uploadfield') .'/uploadfield.css');
- return theme('form_element', $element, $element['#children']);
-}
diff --git a/types/videoftp/videoftp.info b/types/videoftp/videoftp.info
deleted file mode 100644
index 5832bc6..0000000
--- a/types/videoftp/videoftp.info
+++ /dev/null
@@ -1,12 +0,0 @@
-; $Id$
-name = Video FTP
-description = Allows you to attach videos uploaded through FTP to nodes.
-core = 7.x
-files[]=videoftp.module
-files[]=videoftp.install
-files[]=videoftp.theme.inc
-files[]=videoftp_widget.inc
-dependencies[] = content
-dependencies[] = filefield
-dependencies[] = video
-package = "Video" \ No newline at end of file
diff --git a/types/videoftp/videoftp.install b/types/videoftp/videoftp.install
deleted file mode 100644
index 8349abc..0000000
--- a/types/videoftp/videoftp.install
+++ /dev/null
@@ -1,25 +0,0 @@
-<?php
-// $Id$
-
-/**
- * Implementation of hook_install().
- */
-function videoftp_install() {
- drupal_load('module', 'content');
- content_notify('install', 'videoftp');
-}
-
-function videoftp_uninstall() {
- drupal_load('module', 'content');
- content_notify('uninstall', 'videoftp');
-}
-
-function videoftp_enable() {
- drupal_load('module', 'content');
- content_notify('enable', 'videoftp');
-}
-
-function videoftp_disable() {
- drupal_load('module', 'content');
- content_notify('disable', 'videoftp');
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp.module b/types/videoftp/videoftp.module
deleted file mode 100644
index c07741e..0000000
--- a/types/videoftp/videoftp.module
+++ /dev/null
@@ -1,200 +0,0 @@
-<?php
-// $Id$
-
-/**
- * @file
- * video ftp core hooks and menu callbacks.
- */
-
-module_load_include('inc', 'videoftp', 'videoftp_widget');
-
-/*
- * Implementation of hook_menu().
- */
-function videoftp_menu() {
- $items = array();
- $items['videoftp/ahah/%/%/%'] = array(
- 'page callback' => 'videoftp_js',
- 'page arguments' => array(2, 3, 4),
- //'access callback' => 'videoftp_edit_access',
- 'access arguments' => array(3),
- 'type' => MENU_CALLBACK,
- );
- $items['videoftp/progress'] = array(
- 'page callback' => 'videoftp_progress',
- 'access arguments' => array('access content'),
- 'type' => MENU_CALLBACK,
- );
- return $items;
-}
-
-/**
- * Implementation of hook_theme().
- */
-function videoftp_theme() {
- $theme = array();
- $theme['videoftp_widget'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- $theme['videoftp_widget_item'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- $theme['videoftp_widget_file'] = array(
- 'arguments' => array('element' => NULL),
- 'file' => 'videoftp.theme.inc',
- );
- return $theme;
-}
-
-/**
- * Implementation of CCK's hook_widget_info().
- */
-function videoftp_widget_info() {
- return array(
- 'videoftp_widget' => array(
- 'label' => t('Video FTP'),
- 'field types' => array('filefield'),
- 'multiple values' => CONTENT_HANDLE_CORE,
- 'callbacks' => array('default value' => CONTENT_CALLBACK_CUSTOM),
- 'description' => t('Widget allows you to select video files uploaded through FTP to be attached to the node.'),
- ),
- );
-}
-
-/**
- * Implementation of hook_elements().
- */
-function videoftp_elements() {
- return array(
- 'videoftp_widget' => array(
- '#input' => TRUE,
- '#columns' => array('fid', 'list', 'data', 'filepath'),
- '#process' => array('videoftp_widget_process'),
- '#value_callback' => 'videoftp_widget_value',
- ),
- );
-}
-
-/**
- * Implementation of CCK's hook_widget_settings().
- */
-function videoftp_widget_settings($op, $widget) {
- //load up our include file for the widget
- module_load_include('inc', 'videoftp', 'videoftp_widget');
- switch ($op) {
- case 'form':
- return videoftp_widget_settings_form($widget);
- case 'validate':
- return videoftp_widget_settings_validate($widget);
- case 'save':
- return videoftp_widget_settings_save($widget);
- }
-}
-
-/**
- * Implementation of hook_widget().
- */
-function videoftp_widget(&$form, &$form_state, $field, $items, $delta = NULL) {
- $item = array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => '', 'video_thumb' => ''));
- if (isset($items[$delta])) {
- $item = array_merge($item, $items[$delta]);
- }
- $element = array(
- '#title' => $field['widget']['label'],
- '#type' => $field['widget']['type'],
- '#default_value' => $item,
- );
- return $element;
-}
-
-/**
- * Menu callback; Shared AHAH callback for ftp file attachment and deletions.
- *
- * This rebuilds the form element for a particular field item. As long as the
- * form processing is properly encapsulated in the widget element the form
- * should rebuild correctly using FAPI without the need for additional callbacks
- * or processing.
- */
-function videoftp_js($type_name, $field_name, $delta) {
- module_load_include('inc', 'videoftp', 'videoftp_widget');
- $field = content_fields($field_name, $type_name);
-
- if (empty($field) || empty($_POST['form_build_id'])) {
- // Invalid request.
- drupal_set_message(t('An unrecoverable error occurred.'), 'error');
- print drupal_to_js(array('data' => theme('status_messages')));
- exit;
- }
-
- // Build the new form.
- $form_state = array('submitted' => FALSE);
- $form_build_id = $_POST['form_build_id'];
- $form = form_get_cache($form_build_id, $form_state);
-
- if (!$form) {
- // Invalid form_build_id.
- drupal_set_message(t('An unrecoverable error occurred. This form was missing from the server cache. Try reloading the page and submitting again.'), 'error');
- print drupal_to_js(array('data' => theme('status_messages')));
- exit;
- }
-
- // Build the form. This calls the file field's #value_callback function and
- // saves the uploaded file. Since this form is already marked as cached
- // (the #cache property is TRUE), the cache is updated automatically and we
- // don't need to call form_set_cache().
- $args = $form['#parameters'];
- $form_id = array_shift($args);
- $form['#post'] = $_POST;
- $form = form_builder($form_id, $form, $form_state);
-
- // Update the cached form with the new element at the right place in the form.
- if (module_exists('fieldgroup') && ($group_name = _fieldgroup_field_get_group($type_name, $field_name))) {
- if (isset($form['#multigroups']) && isset($form['#multigroups'][$group_name][$field_name])) {
- $form_element = $form[$group_name][$delta][$field_name];
- }
- else {
- $form_element = $form[$group_name][$field_name][$delta];
- }
- }
- else {
- $form_element = $form[$field_name][$delta];
- }
-
- if (isset($form_element['_weight'])) {
- unset($form_element['_weight']);
- }
- $output = drupal_render($form_element);
- // AHAH is not being nice to us and doesn't know the "other" button (that is,
- // either "Attach" or "Delete") yet. Which in turn causes it not to attach
- // AHAH behaviours after replacing the element. So we need to tell it first.
-
- // Loop through the JS settings and find the settings needed for our buttons.
- $javascript = drupal_add_js(NULL, NULL);
- $videoftp_ahah_settings = array();
- if (isset($javascript['setting'])) {
- foreach ($javascript['setting'] as $settings) {
- if (isset($settings['ahah'])) {
- foreach ($settings['ahah'] as $id => $ahah_settings) {
- if (strpos($id, 'videoftp-attach') || strpos($id, 'videoftp-remove')) {
- $videoftp_ahah_settings[$id] = $ahah_settings;
- }
- }
- }
- }
- }
-
- // Add the AHAH settings needed for our new buttons.
- if (!empty($videoftp_ahah_settings)) {
- $output .= '<script type="text/javascript">jQuery.extend(Drupal.settings.ahah, '. drupal_to_js($videoftp_ahah_settings) .');</script>';
- }
-
- $output = theme('status_messages') . $output;
-
- // For some reason, file uploads don't like drupal_json() with its manual
- // setting of the text/javascript HTTP header. So use this one instead.
- $GLOBALS['devel_shutdown'] = FALSE;
- print drupal_to_js(array('status' => TRUE, 'data' => $output));
- exit;
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp.theme.inc b/types/videoftp/videoftp.theme.inc
deleted file mode 100644
index 42203cb..0000000
--- a/types/videoftp/videoftp.theme.inc
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-//$Id$
-/**
- *
- * @file
- * Theme functions for the videoftp module.
- */
-
-/**
- * FormAPI theme function. Theme the output of an video ftp field.
- */
-function theme_videoftp_widget($element) {
- return theme('form_element', $element, $element['#children']);
-}
-
-function theme_videoftp_widget_item($element) {
- // Put the upload button directly after the upload field.
- $element['ftpselect']['#field_suffix'] = drupal_render($element['videoftp_attach']);
- $element['ftpselect']['#theme'] = 'videoftp_widget_file';
- $output = '<div class="filefield-element clear-block">';
-
- if ($element['fid']['#value'] != 0) {
- $output .= '<div class="widget-preview">';
- $output .= drupal_render($element['preview']);
- $output .= '</div>';
- }
-
- $output .= '<div class="widget-edit">';
- $output .= drupal_render($element);
- $output .= '</div>';
- $output .= '</div>';
-
- return $output;
-}
-
-/**
- * Custom theme function for VideoFTP upload elements.
- *
- * This function allows us to put the "Attach" button immediately after the
- * select field by respecting the #field_suffix property.
- */
-function theme_videoftp_widget_file($element) {
- $output .= '<div class="filefield-upload clear-block">';
- if (isset($element['#field_prefix'])) {
- $output .= $element['#field_prefix'];
- }
- $size = $element['#size'] ? ' size="'. $element['#size'] .'"' : '';
- _form_set_class($element, array('form-select'));
- $multiple = $element['#multiple'];
- $output .= '<select name="'. $element['#name'] .''. ($multiple ? '[]' : '') .'"'. ($multiple ? ' multiple="multiple" ' : '') . drupal_attributes($element['#attributes']) .' id="'. $element['#id'] .'" '. $size .'>'. form_select_options($element) ."</select>\n";
- if (isset($element['#field_suffix'])) {
- $output .= $element['#field_suffix'];
- }
- $output .= '</div>';
-
- return theme('form_element', $element, $output);
-} \ No newline at end of file
diff --git a/types/videoftp/videoftp_widget.inc b/types/videoftp/videoftp_widget.inc
deleted file mode 100644
index 893be77..0000000
--- a/types/videoftp/videoftp_widget.inc
+++ /dev/null
@@ -1,313 +0,0 @@
-<?php
-// $Id:
-
-/**
- * @file
- * videoftp widget hooks and callbacks.
- */
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'form').
- */
-function videoftp_widget_settings_form($widget) {
- $form = array();
- $form['file_extensions'] = array(
- '#type' => 'textfield',
- '#title' => t('Permitted upload file extensions.'),
- '#default_value' => !empty($widget['file_extensions']) ? $widget['file_extensions'] : 'mp4 mpeg avi mpg wmv flv mov',
- '#size' => 64,
- '#description' => t('Extensions a user can attach to this field. Separate extensions with a space and do not include the leading dot. Leaving this blank will allow attachment of a file with any extension.'),
- '#weight' => 1
- );
- $form['path_settings'] = array(
- '#type' => 'fieldset',
- '#title' => t('Path settings'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#weight' => 2,
- );
- $form['path_settings']['file_path'] = array(
- '#type' => 'textfield',
- '#size' => 64,
- '#title' => t('File path'),
- '#default_value' => ltrim(ltrim($widget['file_path'], "videos"), "/"),
- '#description' => t('Optional subdirectory within the "<em>files/videos/</em>" directory where files will be moved and stored. Do not include preceding or trailing slashes.'),
- '#element_validate' => array('video_widget_settings_file_path_validate', '_filefield_widget_settings_file_path_validate'),
- );
- $form['path_settings']['ftp_path'] = array(
- '#type' => 'textfield',
- '#title' => t('FTP Filepath'),
- '#default_value' => !empty($widget['ftp_path']) ? $widget['ftp_path'] : 'ftpvideos',
- '#description' => t('The subdirectory within the "<em>files/</em>" directory where you have upload the videos for attachment. Once the video is attached it will be moved from this directory to the main files directory.'),
- '#required' => TRUE,
- '#weight' => 3,
- );
- //default settings
- $default = video_default_widget_settings($widget);
- $form = $form + $default;
- return $form;
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'validate').
- *
- * //@todo Integrate this into a universal function to share with uploadfield_widget
- */
-function videoftp_widget_settings_validate($widget) {
- // Check that only web images are specified in the callback.
- if(!video_web_extensions($widget['file_extensions'])) {
- form_set_error('file_extensions', t('Only web-standard videos are supported through the videoftp widget. If needing to upload other types of files, change the widget to use a standard file upload.'));
- }
- // Check for our ftp filepath and try to create it, if not it will throw an error.
- $ftp_path = file_directory_path().'/'.$widget['ftp_path'];
- file_check_directory($ftp_path, true, 'ftp_path');
-}
-
-/**
- * Implementation of CCK's hook_widget_settings($op = 'save').
- */
-function videoftp_widget_settings_save($widget) {
- return array('file_extensions', 'file_path', 'ftp_path', 'autothumbnail','autoconversion', 'default_dimensions', 'default_player_dimensions', 'default_video_thumb');
-}
-
-/**
- * The #value_callback for the videoftp_widget type element.
- */
-function videoftp_widget_value($element, $edit = FALSE) {
- if (!$edit) {
- // Creating so we load up our empty values.
- $file = field_file_load($element['#default_value']['fid']);
- $item = $element['#default_value'];
- }
- else {
- // Reset our item array for our data.
- $item = array_merge($element['#default_value'], $edit);
- $field = content_fields($element['#field_name'], $element['#type_name']);
-
- // Uploads take priority over value of fid text field.
- if ($fid = videoftp_save_upload($element)) {
- $item['fid'] = $fid;
- $item['data'] = array(); //reset our thumbnail
- }
- // Check for #videoftp_value_callback values.
- // Because FAPI does not allow multiple #value_callback values like it does
- // for #element_validate and #process, this fills the missing functionality
- // to allow VideoFtp to be extended purely through FAPI.
- elseif (isset($element['#videoftp_value_callback'])) {
- foreach ($element['#videoftp_value_callback'] as $callback) {
- $callback($element, $item);
- }
- }
-
- // Load file if the FID has changed so that it can be saved by CCK.
- $file = field_file_load($item['fid']);
-
- // If the file entry doesn't exist, don't save anything.
- if (empty($file)) {
- $item = array();
- }
-
- // Checkboxes loose their value when empty.
- // If the list field is present make sure its unchecked value is saved.
- if (!empty($field['list_field']) && empty($edit['list'])) {
- $item['list'] = 0;
- }
- }
- // Merge file and item data so it is available to all widgets.
- $item = array_merge($item, $file);
- return $item;
-}
-
-/**
- * Process an individual element.
- */
-function videoftp_widget_process($element, $edit, &$form_state, $form) {
- $item = $element['#value'];
- $field_name = $element['#field_name'];
- $delta = $element['#delta'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $element['#theme'] = 'videoftp_widget_item';
-
- if (isset($element['preview']) && $element['#value']['fid'] != 0) {
- $element['preview']['#value'] = theme('videoftp_widget_preview', $element['#value']);
- }
-
- // Title is not necessary for each individual field.
- if ($field['multiple'] > 0) {
- unset($element['#title']);
- }
-
- // Set up the buttons first since we need to check if they were clicked.
- $element['videoftp_attach'] = array(
- '#type' => 'submit',
- '#value' => t('Attach'),
- '#submit' => array('node_form_submit_build_node'),
- '#ahah' => array( // with JavaScript
- 'path' => 'videoftp/ahah/'. $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
- 'wrapper' => $element['#id'] .'-ahah-wrapper',
- 'method' => 'replace',
- 'effect' => 'fade',
- ),
- '#field_name' => $element['#field_name'],
- '#delta' => $element['#delta'],
- '#type_name' => $element['#type_name'],
- '#upload_validators' => $element['#upload_validators'],
- '#weight' => 100,
- '#post' => $element['#post'],
- );
- $element['videoftp_remove'] = array(
- // With default CCK edit forms, $element['#parents'] is array($element['#field_name'], $element['#delta']).
- // However, if some module (for example, flexifield) places our widget deeper in the tree, we want to
- // use that information in constructing the button name.
- '#name' => implode('_', $element['#parents']) .'_videoftp_remove',
- '#type' => 'submit',
- '#value' => t('Remove'),
- '#submit' => array('node_form_submit_build_node'),
- '#ahah' => array( // with JavaScript
- 'path' => 'videoftp/ahah/'. $element['#type_name'] .'/'. $element['#field_name'] .'/'. $element['#delta'],
- 'wrapper' => $element['#id'] .'-ahah-wrapper',
- 'method' => 'replace',
- 'effect' => 'fade',
- ),
- '#field_name' => $element['#field_name'],
- '#delta' => $element['#delta'],
- '#weight' => 101,
- '#post' => $element['#post'],
- );
-
- // Because the output of this field changes depending on the button clicked,
- // we need to ask FAPI immediately if the remove button was clicked.
- // It's not good that we call this private function, but
- // $form_state['clicked_button'] is only available after this #process
- // callback is finished.
- if (_form_button_was_clicked($element['videoftp_remove'])) {
- // Delete the file if it is currently unused. Note that field_file_delete()
- // does a reference check in addition to our basic status check.
- if (isset($edit['fid'])) {
- $removed_file = field_file_load($edit['fid']);
- if ($removed_file['status'] == 0) {
- field_file_delete($removed_file);
- }
- }
- $item = array('fid' => 0, 'list' => $field['list_default'], 'data' => array('description' => '', 'video_thumb' => ''));
- }
-
- // Set access on the buttons and select.
- $element['videoftp_attach']['#access'] = empty($item['fid']);
- $element['videoftp_remove']['#access'] = !empty($item['fid']);
-
- $options = videoftp_options($field);
- $element['ftpselect'] = array(
- '#type' => 'select',
- '#required' => isset($element['#required']) ? $element['#required'] : $field['required'],
- '#options' => $options,
- '#access' => empty($item['fid']),
- );
-
- // Set the FID.
- $element['fid'] = array(
- '#type' => 'hidden',
- '#value' => $item['fid'],
- );
-
- if ($item['fid'] != 0) {
- $element['preview'] = array(
- '#type' => 'markup',
- '#value' => theme('video_widget_preview', $item),
- );
- }
-
- // placeholder.. will be serialized into the data column. this is a place for widgets
- // to put additional data.
- $element['data'] = array(
- '#tree' => 'true',
- '#access' => !empty($item['fid']),
- );
-
- // Create our thumbnails
- if($field['widget']['autothumbnail']) {
- video_thumb_process($element);
- }
-
- // Add our extra fields if in preview mode
- if(!empty($item['fid'])) {
- video_widget_element_settings($element);
- }
-
- // Set #element_validate in a way that it will not wipe out other
- // validation functions already set by other modules.
- if (empty($element['#element_validate'])) {
- $element['#element_validate'] = array();
- }
- array_unshift($element['#element_validate'], 'videoftp_widget_validate');
-
- // Make sure field info will be available to the validator which
- // does not get the values in $form.
- $form_state['#field_info'][$field['field_name']] = $field;
-
- $element['#attributes']['id'] = $element['#id'] .'-ahah-wrapper';
- $element['#prefix'] = '<div '. drupal_attributes($element['#attributes']) .'>';
- $element['#suffix'] = '</div>';
-
- // Lets use the clicked_button #submit[0] value here instead and see how that works out for now...
- if($form_state['submitted'] == 1) {
- video_widget_process($element, $form_state);
- }
- return $element;
-}
-
-function videoftp_save_upload($element) {
- global $user;
- $upload_name = $element['#field_name'] .'_'. $element['#delta'];
- $delta = $element['#delta'];
- $field = content_fields($element['#field_name'], $element['#type_name']);
- $video = $element['#post'][$field['field_name']][$delta]['ftpselect'];
- $ftp_path = file_directory_path().'/'.$field['widget']['ftp_path'];
-
- if (empty($video) || !file_exists($ftp_path.'/'.$video)) {
- return 0;
- }
-
- $dest = filefield_widget_file_path($field);
- if (!field_file_check_directory($dest, FILE_CREATE_DIRECTORY)) {
- watchdog('filefield', 'The upload directory %directory for the file field %field (content type %type) could not be created or is not accessible. A newly uploaded file could not be saved in this directory as a consequence, and the upload was canceled.', array('%directory' => $dest, '%field' => $element['#field_name'], '%type' => $element['#type_name']));
- form_set_error($upload_name, t('The file could not be uploaded.'));
- return 0;
- }
-
- // Begin building the file object.
- $file = new stdClass();
- $file->uid = $user->uid;
- $file->filename = file_munge_filename(trim(basename($video), '.'), $field['widget']['file_extensions']);
- $file->filepath = $ftp_path.'/'.$video;
- $file->filemime = file_get_mimetype($file->filename);
- $file->filesize = filesize($file->filepath);
- $file->status = FILE_STATUS_TEMPORARY;
- $file->timestamp = REQUEST_TIME;
-
- //lets move our file from the ftp folder to the files directory
- if(file_move($file, $dest)) {
- // Insert new record to the database.
- drupal_write_record('files', $file);
- }
- _field_file_cache($file); // cache the file in order to minimize load queries
- return $file->fid;
-}
-
-function videoftp_options($field) {
- $options = array();
- $options[] = t('Select Video');
- // Lets setup our ftp_path.
- $ftp_path = file_directory_path().'/'.$field['widget']['ftp_path'];
- // We are going to scan the directory and pull out the available video types by extension.
- $extensions = explode(" ",$field['widget']['file_extensions']);
- $video_files = scandir($ftp_path);
- foreach ($video_files as $file) {
- $ext = pathinfo($file);
- if (in_array($ext['extension'], $extensions)) {
- //add the file to the options array for selection
- $options["$file"] = $file;
- }
- }
- return $options;
-} \ No newline at end of file