diff -urpN video_filter_orig/tinymce/editor_plugin.js video_filter/tinymce/editor_plugin.js --- video_filter_orig/tinymce/editor_plugin.js 1970-01-01 01:00:00.000000000 +0100 +++ video_filter/tinymce/editor_plugin.js 2009-03-04 17:00:41.000000000 +0100 @@ -0,0 +1 @@ +(function(){tinymce.create('tinymce.plugins.VideoFilterPlugin',{init:function(ed,url){ed.addCommand('mceVideoFilter',function(){ed.windowManager.open({file:Drupal.settings.basePath+'video_filter/load',width:480,height:480,inline:1,scrollbars:1})});ed.addButton('videofilter',{title:'Video Filter',cmd:'mceVideoFilter'})},getInfo:function(){return{longname:'Video Filter',author:'Video Filter',authorurl:'http://drupal.org/project/video_filter',infourl:'http://drupal.org/project/video_filter',version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add('videofilter',tinymce.plugins.VideoFilterPlugin)})(); \ No newline at end of file diff -urpN video_filter_orig/tinymce/editor_plugin_src.js video_filter/tinymce/editor_plugin_src.js --- video_filter_orig/tinymce/editor_plugin_src.js 1970-01-01 01:00:00.000000000 +0100 +++ video_filter/tinymce/editor_plugin_src.js 2009-03-04 17:00:41.000000000 +0100 @@ -0,0 +1,35 @@ +(function() { + tinymce.create('tinymce.plugins.VideoFilterPlugin', { + init : function(ed, url) { + // Register commands + ed.addCommand('mceVideoFilter', function() { + ed.windowManager.open({ + file : Drupal.settings.basePath + 'video_filter/load', + width : 480, + height : 480, + inline : 1, + scrollbars : 1 + }); + }); + + // Register buttons + ed.addButton('videofilter', { + title : 'Video Filter', + cmd : 'mceVideoFilter' + }); + }, + + getInfo : function() { + return { + longname : 'Video Filter', + author : 'Video Filter', + authorurl : 'http://drupal.org/project/video_filter', + infourl : 'http://drupal.org/project/video_filter', + version : tinymce.majorVersion + "." + tinymce.minorVersion + }; + } + }); + + // Register plugin + tinymce.PluginManager.add('videofilter', tinymce.plugins.VideoFilterPlugin); +})(); \ No newline at end of file Binary files video_filter_orig/tinymce/images/movie_track.png and video_filter/tinymce/images/movie_track.png differ diff -urpN video_filter_orig/tinymce/jscripts/video_filter.js video_filter/tinymce/jscripts/video_filter.js --- video_filter_orig/tinymce/jscripts/video_filter.js 1970-01-01 01:00:00.000000000 +0100 +++ video_filter/tinymce/jscripts/video_filter.js 2009-03-04 17:00:15.000000000 +0100 @@ -0,0 +1,21 @@ +function insertVideo() { + var ed = tinyMCEPopup.editor, f = document.forms[0], nl = f.elements, v, args = {}, el; + tinyMCEPopup.restoreSelection(); + + // Fixes crash in Safari + if (tinymce.isWebKit) { + ed.getWin().focus(); + } + + if (nl.file.value === '') { + ed.execCommand('mceRepaint'); + tinyMCEPopup.close(); + return; + } + else { + ed.execCommand('mceInsertContent', false, '[video:'+nl.file.value+']'); + ed.undoManager.add(); + tinyMCEPopup.close(); + return; + } +} \ No newline at end of file diff -urpN video_filter_orig/tinymce/langs/en_dlg.js video_filter/tinymce/langs/en_dlg.js --- video_filter_orig/tinymce/langs/en_dlg.js 1970-01-01 01:00:00.000000000 +0100 +++ video_filter/tinymce/langs/en_dlg.js 2009-03-04 15:52:14.000000000 +0100 @@ -0,0 +1,5 @@ +tinyMCE.addI18n('en.videofilter_dlg', { + title: 'Insert Video', + desc: 'Add a 3rd party video.', + instr: "

Instructions

Paste URL's from the following providers:

YouTube
Accepts URLs like http://www.youtube.com/watch?v=uN1qUeId

Google Video
Accepts URLs like http://video.google.com/videoplay?docid=-uN1qUeId

GodTube
Accepts URLs like http://www.godtube.com/view_video.php?viewkey=uN1qUeId

DailyMotion
Accepts URLs like http://www.dailymotion.com/us/featured/video/x59guz_iron-man-addictive-tv-remix_shortfilms

Eyespot
Accepts URLs like http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEx9hoXiEJW07IWpUtT

Jumpcut
Accepts URLs like http://jumpcut.com/view?id=31410FA4169E11DDB25E000423CF385C

Revver
Accepts URLs like http://revver.com/video/856351/the-next-levelwith-nike/

Vimeo
Accepts URLs like http://www.vimeo.com/319782

" +}); diff -urpN video_filter_orig/tinymce/video_filter.css video_filter/tinymce/video_filter.css --- video_filter_orig/tinymce/video_filter.css 1970-01-01 01:00:00.000000000 +0100 +++ video_filter/tinymce/video_filter.css 2009-03-04 15:52:14.000000000 +0100 @@ -0,0 +1,15 @@ +.defaultSkin span.mce_videofilter { + background-image: url('images/movie_track.png'); + background-position: center; + background-repeat: no-repeat; +} + +#mceVideoPopup #file { + width: 97%; + padding:5px; +} + +#mceVideoPopup ul { + margin:0; + padding-left:13px; +} \ No newline at end of file diff -urpN video_filter_orig/video_filter.codecs.inc video_filter/video_filter.codecs.inc --- video_filter_orig/video_filter.codecs.inc 2008-05-05 10:54:43.000000000 +0200 +++ video_filter/video_filter.codecs.inc 2009-03-04 17:12:52.000000000 +0100 @@ -7,53 +7,57 @@ function video_filter_codec_info() $codecs['youtube'] = array( 'name' => t('YouTube'), + 'sample_url' => 'http://www.youtube.com/watch?v=uN1qUeId', 'callback' => 'video_filter_youtube', 'regexp' => '/youtube\.com\/watch\?v=([a-z0-9\-_]+)/i', 'ratio' => 425 / 355, ); $codecs['google'] = array( 'name' => t('Google Video'), + 'sample_url' => 'http://video.google.com/videoplay?docid=-uN1qUeId', 'callback' => 'video_filter_google', 'regexp' => '/video\.google\.com\/videoplay\?docid=(\-?[0-9]+)/', 'ratio' => 400 / 326, ); - $codecs['godtube'] = array( - 'name' => t('GodTube'), - 'callback' => 'video_filter_godtube', - 'regexp' => '/godtube\.com\/view_video\.php\?viewkey=([a-z0-9]+)/', + $codecs['tangle'] = array( + 'name' => t('Tangle'), + 'sample_url' => 'http://www.tangle.com/view_video.php?viewkey=b2e45d2a30cb0f5cad38', + 'callback' => 'video_filter_tangle', + 'regexp' => '/tangle\.com\/view_video\.php\?viewkey=([a-z0-9]+)/', 'ratio' => 300 / 270, ); $codecs['dailymotion'] = array( 'name' => t('DailyMotion'), + 'sample_url' => 'http://www.dailymotion.com/us/featured/video/x59_some_title', 'callback' => 'video_filter_dailymotion', 'regexp' => '/dailymotion\.com\/.*video\/([a-z0-9]+)/i', 'ratio' => 420 / 336, ); $codecs['eyespot'] = array( 'name' => t('Eyespot'), + 'sample_url' => 'http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEx9hoXiEJW07IWpUtT', 'callback' => 'video_filter_eyespot', - // http://eyespot.com/share?cmd=permalink&r=0XCzIG2UEx9hoXiEJW07IWpUtT# 'regexp' => '/eyespot\.com\/.*r=([a-z0-9]+)/i', 'ratio' => 432 / 407, ); $codecs['jumpcut'] = array( 'name' => t('Jumpcut'), + 'sample_url' => 'http://jumpcut.com/view?id=31410FA4169E11DDB25E000423CF385C', 'callback' => 'video_filter_jumpcut', - // http://jumpcut.com/view?id=31410FA4169E11DDB25E000423CF385C 'regexp' => '/jumpcut\.com\/.*id=([A-Z0-9]+)/', 'ratio' => 408 / 324, ); $codecs['revver'] = array( 'name' => t('Revver'), + 'sample_url' => 'http://revver.com/video/856351/the-title/', 'callback' => 'video_filter_revver', - // http://revver.com/video/856351/the-next-levelwith-nike/ 'regexp' => '/revver\.com\/video\/([0-9]+)/', 'ratio' => 408 / 324, ); $codecs['vimeo'] = array( 'name' => t('Vimeo'), + 'sample_url' => 'http://www.vimeo.com/319782', 'callback' => 'video_filter_vimeo', - // http://www.vimeo.com/319782 'regexp' => '/vimeo\.com\/([0-9]+)/', 'ratio' => 400 / 225, ); @@ -73,9 +77,9 @@ function video_filter_google($video) { return video_filter_flash($video); } -function video_filter_godtube($video) { - $video['source'] = 'http://www.godtube.com/flvplayer.swf?viewkey='.$video['codec']['matches'][1]; - +function video_filter_tangle($video) { + $video['source'] = 'http://www.tangle.com/flash/swf/flvplayer.swf?viewkey='.$video['codec']['matches'][1]; + return video_filter_flash($video); } @@ -86,27 +90,19 @@ function video_filter_dailymotion($video } function video_filter_eyespot($video) { - // - $video['source'] = 'http://eyespot.com/flash/medialoader.swf?vurl=http%3A%2F%2Fdownloads.eyespot.com%2Fplay%3Fr%3D'.$video['codec']['matches'][1].'&_autoPlay='.($video['autoplay'] ? 'true' : 'false'); return video_filter_flash($video); } function video_filter_jumpcut($video) { - // - $video['source'] = 'http://jumpcut.com/media/flash/jump.swf?id='.$video['codec']['matches'][1].'&asset_type=movie&asset_id='.$video['codec']['matches'][1].'&eb=1'; return video_filter_flash($video); } function video_filter_revver($video) { - // - - $output = ''; - - $output .= ''; + $output = ''; return $output; } diff -urpN video_filter_orig/video_filter.module video_filter/video_filter.module --- video_filter_orig/video_filter.module 2008-03-19 15:56:25.000000000 +0100 +++ video_filter/video_filter.module 2009-03-04 15:52:14.000000000 +0100 @@ -215,4 +215,93 @@ function video_filter_flash($video, $par return $output; } -?> \ No newline at end of file +/** + * Implementation of hook_menu(). + */ +function video_filter_menu() { + $items = array(); + + $items['video_filter/load'] = array( + 'title' => t('Video Filter'), + 'page callback' => 'video_filter_loader', + 'access arguments' => array('access content'), + 'type' => MENU_CALLBACK, + ); + + return $items; +} + +/** + * Implementation of hook_wysiwyg_plugin(). + */ +function video_filter_wysiwyg_plugin($editor, $version) { + switch ($editor) { + case 'tinymce': + if ($version > 3) { + drupal_add_css(drupal_get_path('module', 'video_filter') . '/tinymce/video_filter.css'); + return array( + 'videofilter' => array( + 'path' => drupal_get_path('module', 'video_filter') . '/tinymce/editor_plugin.js', + 'buttons' => array('videofilter' => t('Video Filter')), + 'url' => 'http://drupal.org/project/video_filter', + ), + ); + } + break; + } +} + +/** + * Output tinymce popup html. + * + * @todo Remove hard-coded TinyMCE integration. + */ +function video_filter_loader() { + $output = ''."\n"; + $output .= "\n"; + $output .= "\n"; + $output .= '{#videofilter_dlg.title}' ."\n"; + $path = base_path() . drupal_get_path('module', 'video_filter'); + $tinymce_path = base_path() . drupal_get_path('module', 'wysiwyg'); + $tinymce_js = $tinymce_path .'/tinymce/jscripts/tiny_mce/tiny_mce_popup.js'; + $output .= '' . "\n"; + $output .= ''."\n"; + $output .= ''."\n"; + $output .= '' . "\n"; + $output .= "\n\n"; + $output .= ''; + $output .= '
' . "\n"; + $output .= '

{#videofilter_dlg.title}

' . "\n"; + $output .= '' . "\n"; + $output .= '
' . "\n"; + $output .= '' . "\n"; + $output .= '
' . "\n"; + $output .= '
' . "\n"; + $output .= '
' . "\n"; + $output .= '' . "\n"; + $output .= '
' . "\n"; + $output .= '
' . "\n"; + $output .= '' . "\n"; + $output .= '
' . "\n"; + $output .= '
' . "\n"; + $output .= '

'. t('Instructions') . '

' . "\n"; + $output .= '

' . t('Insert a 3rd party video from one of the following providers.') . '

' . "\n"; + $output .= _video_filter_instructions(); + $output .= '
' . "\n"; + $output .= '' . "\n"; + $output .= "\n"; + echo $output; +} + +/** + * Parses Codec into instructions for tinymce popup + */ +function _video_filter_instructions(){ + $codecs = module_invoke_all('codec_info'); + $output = "'; + return $output; +} \ No newline at end of file