Commit 17d350cb0fbb5afea3432c4129daeea5a22e0d87

Authored by Evandro Jr
2 parents 85002c49 3d67fa30

Merge branch 'I4-Video-Gallery-Plugin' into stable

plugins/video/lib/ext/article.rb
@@ -2,10 +2,12 @@ require_dependency 'article' @@ -2,10 +2,12 @@ require_dependency 'article'
2 2
3 class Article 3 class Article
4 4
  5 + #FIXME This should be done via hotspot
5 def self.folder_types_with_video 6 def self.folder_types_with_video
6 - self.folder_types_without_video << 'VideoGallery' 7 + self.folder_types_without_video << 'VideoPlugin::VideoGallery'
7 end 8 end
8 9
  10 + #FIXME This should be done via hotspot
9 class << self 11 class << self
10 alias_method_chain :folder_types, :video 12 alias_method_chain :folder_types, :video
11 end 13 end
plugins/video/lib/video.rb
@@ -1,145 +0,0 @@ @@ -1,145 +0,0 @@
1 -require 'noosfero/translatable_content'  
2 -require 'application_helper'  
3 -require 'net/http'  
4 -  
5 -class Video < Article  
6 -  
7 - settings_items :video_url, :type => :string, :default => 'http://'  
8 - settings_items :video_width, :type => :integer, :default => 499  
9 - settings_items :video_height, :type => :integer, :default => 353  
10 - #youtube, vimeo, file  
11 - settings_items :video_provider, :type => :string  
12 - settings_items :video_format, :type => :string  
13 - settings_items :video_id, :type => :string  
14 - settings_items :video_thumbnail_url, :type => :string, :default => '/plugins/video/images/video_generic_thumbnail.jpg'  
15 - settings_items :video_thumbnail_width, :type=> :integer  
16 - settings_items :video_thumbnail_height, :type=> :integer  
17 - settings_items :video_duration, :type=> :integer, :default => 0  
18 -  
19 - attr_accessible :video_url  
20 -  
21 - before_save :detect_video  
22 -  
23 - def self.type_name  
24 - _('Video')  
25 - end  
26 -  
27 - def can_display_versions?  
28 - true  
29 - end  
30 -  
31 - def self.short_description  
32 - _('Embedded Video')  
33 - end  
34 -  
35 - def self.description  
36 - _('Display embedded videos.')  
37 - end  
38 -  
39 - include ActionView::Helpers::TagHelper  
40 - def to_html(options={})  
41 - article = self  
42 - proc do  
43 - render :partial => 'content_viewer/video', :locals => {:article => article}  
44 - end  
45 - end  
46 -  
47 - def fitted_width  
48 - 499  
49 - end  
50 -  
51 - def fitted_height  
52 - ((fitted_width * self.video_height) / self.video_width).to_i  
53 - end  
54 -  
55 - def thumbnail_fitted_width  
56 - 80  
57 - end  
58 -  
59 - def thumbnail_fitted_height  
60 - ((thumbnail_fitted_width * self.video_thumbnail_height) / self.video_thumbnail_width).to_i  
61 - end  
62 -  
63 - def no_browser_support_message  
64 - '<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>'  
65 - end  
66 -  
67 - private  
68 -  
69 - YOUTUBE_ID_FORMAT = '\w-'  
70 -  
71 - def detect_video  
72 - if is_youtube?  
73 - self.video_provider = 'youtube'  
74 - self.video_id = extract_youtube_id  
75 - url = "http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D#{self.video_id}&format=json"  
76 - resp = Net::HTTP.get_response(URI.parse(url))  
77 - buffer = resp.body  
78 - vid = JSON.parse(buffer)  
79 - self.video_thumbnail_url = vid['thumbnail_url']  
80 - self.video_width = vid['width']  
81 - self.video_height = vid['height']  
82 - self.video_thumbnail_width = vid['thumbnail_width']  
83 - self.video_thumbnail_height = vid['thumbnail_height']  
84 - url = "http://gdata.youtube.com/feeds/api/videos/#{self.video_id}?alt=json";  
85 - resp = Net::HTTP.get_response(URI.parse(url))  
86 - buffer = resp.body  
87 - vid = JSON.parse(buffer)  
88 - self.video_duration = vid['entry']['media$group']['media$content'][0]['duration']  
89 - elsif is_vimeo?  
90 - self.video_provider = 'vimeo'  
91 - self.video_id = extract_vimeo_id  
92 - url = "http://vimeo.com/api/v2/video/#{self.video_id}.json"  
93 - resp = Net::HTTP.get_response(URI.parse(url))  
94 - buffer = resp.body  
95 - vid = JSON.parse(buffer)  
96 - vid = vid[0]  
97 - #raise vid.to_yaml  
98 - self.video_thumbnail_url = vid['thumbnail_large']  
99 - self.video_width = vid['width']  
100 - self.video_height = vid['height']  
101 - self.video_thumbnail_width = 640  
102 - self.video_thumbnail_height = 360  
103 - elsif true  
104 - self.video_format = detect_format  
105 - self.video_provider = 'file'  
106 - end  
107 - end  
108 -  
109 - def detect_format  
110 - video_type = 'video/unknown'  
111 - if /.mp4/i =~ self.video_url or /.mov/i =~ self.video_url  
112 - video_type='video/mp4'  
113 - elsif /.webm/i =~ self.video_url  
114 - video_type='video/webm'  
115 - elsif /.og[vg]/i =~ self.video_url  
116 - video_type='video/ogg'  
117 - end  
118 - video_type  
119 - end  
120 -  
121 - def is_youtube?  
122 - video_url.match(/.*(youtube.com.*v=[#{YOUTUBE_ID_FORMAT}]+|youtu.be\/[#{YOUTUBE_ID_FORMAT}]+).*/) ? true : false  
123 - end  
124 -  
125 - def is_vimeo?  
126 - video_url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/([A-z]|\/)*[[:digit:]]+/) ? true : false  
127 - end  
128 -  
129 - def is_video_file?  
130 - video_url.match(/\.(mp4|ogg|ogv|webm)/) ? true : false  
131 - end  
132 -  
133 - def extract_youtube_id  
134 - return nil unless is_youtube?  
135 - youtube_match = video_url.match("v=([#{YOUTUBE_ID_FORMAT}]*)")  
136 - youtube_match ||= video_url.match("youtu.be\/([#{YOUTUBE_ID_FORMAT}]*)")  
137 - youtube_match[1] unless youtube_match.nil?  
138 - end  
139 -  
140 - def extract_vimeo_id  
141 - return nil unless is_vimeo?  
142 - vimeo_match = video_url.match('([[:digit:]]*)$')  
143 - vimeo_match[1] unless vimeo_match.nil?  
144 - end  
145 -end  
146 \ No newline at end of file 0 \ No newline at end of file
plugins/video/lib/video_block.rb
@@ -1,62 +0,0 @@ @@ -1,62 +0,0 @@
1 -class VideoBlock < Block  
2 -  
3 - attr_accessible :url, :width, :height  
4 -  
5 - settings_items :url, :type => :string, :default => ""  
6 - settings_items :width, :type => :integer, :default => 400  
7 - settings_items :height, :type => :integer, :default => 315  
8 -  
9 - YOUTUBE_ID_FORMAT = '\w-'  
10 -  
11 - def is_youtube?  
12 - url.match(/.*(youtube.com.*v=[#{YOUTUBE_ID_FORMAT}]+|youtu.be\/[#{YOUTUBE_ID_FORMAT}]+).*/) ? true : false  
13 - end  
14 -  
15 - def is_vimeo?  
16 - url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false  
17 - end  
18 -  
19 - def is_video_file?  
20 - url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false  
21 - end  
22 -  
23 - def format_embed_video_url_for_youtube  
24 - "//www.youtube-nocookie.com/embed/#{extract_youtube_id}?rel=0&wmode=transparent" if is_youtube?  
25 - end  
26 -  
27 - def format_embed_video_url_for_vimeo  
28 - "//player.vimeo.com/video/#{extract_vimeo_id}" if is_vimeo?  
29 - end  
30 -  
31 - def self.description  
32 - _('Display a Video')  
33 - end  
34 -  
35 - def help  
36 - _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)')  
37 - end  
38 -  
39 - def content(args={})  
40 - block = self  
41 -  
42 - proc do  
43 - render :file => 'video_block', :locals => { :block => block }  
44 - end  
45 - end  
46 -  
47 - private  
48 -  
49 - def extract_youtube_id  
50 - return nil unless is_youtube?  
51 - youtube_match = url.match("v=([#{YOUTUBE_ID_FORMAT}]*)")  
52 - youtube_match ||= url.match("youtu.be\/([#{YOUTUBE_ID_FORMAT}]*)")  
53 - youtube_match[1] unless youtube_match.nil?  
54 - end  
55 -  
56 - def extract_vimeo_id  
57 - return nil unless is_vimeo?  
58 - vimeo_match = url.match('([[:digit:]]*)$')  
59 - vimeo_match[1] unless vimeo_match.nil?  
60 - end  
61 -  
62 -end  
plugins/video/lib/video_gallery.rb
@@ -1,63 +0,0 @@ @@ -1,63 +0,0 @@
1 -class VideoGallery < Folder  
2 -  
3 - def self.type_name  
4 - _('Video Gallery')  
5 - end  
6 -  
7 - settings_items :thumbnail_width, :type => :integer, :default => 50  
8 - settings_items :thumbnail_height, :type => :integer, :default => 50  
9 - settings_items :videos_per_row, :type => :integer, :default => 5  
10 -  
11 - validate :not_belong_to_blog  
12 -  
13 - def not_belong_to_blog  
14 - errors.add(:parent, "A video gallery should not belong to a blog.") if parent && parent.blog?  
15 - end  
16 -  
17 - acts_as_having_settings :field => :setting  
18 -  
19 - xss_terminate :only => [ :body ], :with => 'white_list', :on => 'validation'  
20 -  
21 - include WhiteListFilter  
22 - filter_iframes :body  
23 - def iframe_whitelist  
24 - profile && profile.environment && profile.environment.trusted_sites_for_iframe  
25 - end  
26 -  
27 - def self.short_description  
28 - _('Video Gallery')  
29 - end  
30 -  
31 - def self.description  
32 - _('A gallery of link to videos that are hosted elsewhere.')  
33 - end  
34 -  
35 - include ActionView::Helpers::TagHelper  
36 - def to_html(options = {})  
37 - video_gallery = self  
38 - proc do  
39 - render :partial => 'content_viewer/video_gallery', :locals => {:video_gallery => video_gallery}  
40 - end  
41 - end  
42 -  
43 - def video_gallery?  
44 - true  
45 - end  
46 -  
47 - def can_display_hits?  
48 - false  
49 - end  
50 -  
51 - def accept_comments?  
52 - false  
53 - end  
54 -  
55 - def self.icon_name(article = nil)  
56 - 'Video gallery'  
57 - end  
58 -  
59 - def news(limit = 30, highlight = false)  
60 - profile.recent_documents(limit, ["articles.type != ? AND articles.highlighted = ? AND articles.parent_id = ?", 'Folder', highlight, id])  
61 - end  
62 -  
63 -end  
plugins/video/lib/video_gallery_helper.rb
@@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
1 -module VideoGalleryHelper  
2 -  
3 - def list_videos(configure={})  
4 - configure[:recursive] ||= false  
5 - configure[:list_type] ||= :folder  
6 - if !configure[:contents].blank?  
7 - configure[:contents] = configure[:contents].paginate(  
8 - :order => "updated_at DESC",  
9 - :per_page => 16,  
10 - :page => params[:npage]  
11 - )  
12 - render :file => 'shared/video_list', :locals => configure  
13 - else  
14 - content_tag('em', _('(empty folder)'))  
15 - end  
16 - end  
17 -  
18 -end  
19 \ No newline at end of file 0 \ No newline at end of file
plugins/video/lib/video_plugin.rb
1 -require_dependency File.dirname(__FILE__) + '/video_block'  
2 -require_dependency File.dirname(__FILE__) + '/video'  
3 -require_dependency File.dirname(__FILE__) + '/video_gallery'  
4 -  
5 class VideoPlugin < Noosfero::Plugin 1 class VideoPlugin < Noosfero::Plugin
6 2
7 def self.plugin_name 3 def self.plugin_name
@@ -14,7 +10,7 @@ class VideoPlugin &lt; Noosfero::Plugin @@ -14,7 +10,7 @@ class VideoPlugin &lt; Noosfero::Plugin
14 10
15 def self.extra_blocks 11 def self.extra_blocks
16 { 12 {
17 - VideoBlock => {} 13 + VideoPlugin::VideoBlock => {}
18 } 14 }
19 end 15 end
20 16
@@ -44,7 +40,7 @@ class VideoPlugin &lt; Noosfero::Plugin @@ -44,7 +40,7 @@ class VideoPlugin &lt; Noosfero::Plugin
44 content_tag('a', _("New Video"), 40 content_tag('a', _("New Video"),
45 { :id=>"new-video-btn", 41 { :id=>"new-video-btn",
46 :class=>"button with-text icon-new", 42 :class=>"button with-text icon-new",
47 - :href=>url_for(:action => 'new', :type=>'Video', :controller=>'cms', :parent_id => content.id), 43 + :href=>url_for(:action => 'new', :type=>'VideoPlugin::Video', :controller=>'cms', :parent_id => content.id),
48 :title=>_("New Video") 44 :title=>_("New Video")
49 }) 45 })
50 end 46 end
plugins/video/lib/video_plugin/video.rb 0 → 100644
@@ -0,0 +1,145 @@ @@ -0,0 +1,145 @@
  1 +require 'noosfero/translatable_content'
  2 +require 'application_helper'
  3 +require 'net/http'
  4 +
  5 +class VideoPlugin::Video < Article
  6 +
  7 + settings_items :video_url, :type => :string, :default => 'http://'
  8 + settings_items :video_width, :type => :integer, :default => 499
  9 + settings_items :video_height, :type => :integer, :default => 353
  10 + #youtube, vimeo, file
  11 + settings_items :video_provider, :type => :string
  12 + settings_items :video_format, :type => :string
  13 + settings_items :video_id, :type => :string
  14 + settings_items :video_thumbnail_url, :type => :string, :default => '/plugins/video/images/video_generic_thumbnail.jpg'
  15 + settings_items :video_thumbnail_width, :type=> :integer
  16 + settings_items :video_thumbnail_height, :type=> :integer
  17 + settings_items :video_duration, :type=> :integer, :default => 0
  18 +
  19 + attr_accessible :video_url
  20 +
  21 + before_save :detect_video
  22 +
  23 + def self.type_name
  24 + _('Video')
  25 + end
  26 +
  27 + def can_display_versions?
  28 + true
  29 + end
  30 +
  31 + def self.short_description
  32 + _('Embedded Video')
  33 + end
  34 +
  35 + def self.description
  36 + _('Display embedded videos.')
  37 + end
  38 +
  39 + include ActionView::Helpers::TagHelper
  40 + def to_html(options={})
  41 + article = self
  42 + proc do
  43 + render :partial => 'content_viewer/video_plugin/video', :locals => {:article => article}
  44 + end
  45 + end
  46 +
  47 + def fitted_width
  48 + 499
  49 + end
  50 +
  51 + def fitted_height
  52 + ((fitted_width * self.video_height) / self.video_width).to_i
  53 + end
  54 +
  55 + def thumbnail_fitted_width
  56 + 80
  57 + end
  58 +
  59 + def thumbnail_fitted_height
  60 + ((thumbnail_fitted_width * self.video_thumbnail_height) / self.video_thumbnail_width).to_i
  61 + end
  62 +
  63 + def no_browser_support_message
  64 + '<p class="vjs-no-js">To view this video please enable JavaScript, and consider upgrading to a web browser that <a href="http://videojs.com/html5-video-support/" target="_blank">supports HTML5 video</a></p>'
  65 + end
  66 +
  67 + private
  68 +
  69 + YOUTUBE_ID_FORMAT = '\w-'
  70 +
  71 + def detect_video
  72 + if is_youtube?
  73 + self.video_provider = 'youtube'
  74 + self.video_id = extract_youtube_id
  75 + url = "http://www.youtube.com/oembed?url=http%3A//www.youtube.com/watch?v%3D#{self.video_id}&format=json"
  76 + resp = Net::HTTP.get_response(URI.parse(url))
  77 + buffer = resp.body
  78 + vid = JSON.parse(buffer)
  79 + self.video_thumbnail_url = vid['thumbnail_url']
  80 + self.video_width = vid['width']
  81 + self.video_height = vid['height']
  82 + self.video_thumbnail_width = vid['thumbnail_width']
  83 + self.video_thumbnail_height = vid['thumbnail_height']
  84 + url = "http://gdata.youtube.com/feeds/api/videos/#{self.video_id}?alt=json";
  85 + resp = Net::HTTP.get_response(URI.parse(url))
  86 + buffer = resp.body
  87 + vid = JSON.parse(buffer)
  88 + self.video_duration = vid['entry']['media$group']['media$content'][0]['duration']
  89 + elsif is_vimeo?
  90 + self.video_provider = 'vimeo'
  91 + self.video_id = extract_vimeo_id
  92 + url = "http://vimeo.com/api/v2/video/#{self.video_id}.json"
  93 + resp = Net::HTTP.get_response(URI.parse(url))
  94 + buffer = resp.body
  95 + vid = JSON.parse(buffer)
  96 + vid = vid[0]
  97 + #raise vid.to_yaml
  98 + self.video_thumbnail_url = vid['thumbnail_large']
  99 + self.video_width = vid['width']
  100 + self.video_height = vid['height']
  101 + self.video_thumbnail_width = 640
  102 + self.video_thumbnail_height = 360
  103 + elsif true
  104 + self.video_format = detect_format
  105 + self.video_provider = 'file'
  106 + end
  107 + end
  108 +
  109 + def detect_format
  110 + video_type = 'video/unknown'
  111 + if /.mp4/i =~ self.video_url or /.mov/i =~ self.video_url
  112 + video_type='video/mp4'
  113 + elsif /.webm/i =~ self.video_url
  114 + video_type='video/webm'
  115 + elsif /.og[vg]/i =~ self.video_url
  116 + video_type='video/ogg'
  117 + end
  118 + video_type
  119 + end
  120 +
  121 + def is_youtube?
  122 + video_url.match(/.*(youtube.com.*v=[#{YOUTUBE_ID_FORMAT}]+|youtu.be\/[#{YOUTUBE_ID_FORMAT}]+).*/) ? true : false
  123 + end
  124 +
  125 + def is_vimeo?
  126 + video_url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/([A-z]|\/)*[[:digit:]]+/) ? true : false
  127 + end
  128 +
  129 + def is_video_file?
  130 + video_url.match(/\.(mp4|ogg|ogv|webm)/) ? true : false
  131 + end
  132 +
  133 + def extract_youtube_id
  134 + return nil unless is_youtube?
  135 + youtube_match = video_url.match("v=([#{YOUTUBE_ID_FORMAT}]*)")
  136 + youtube_match ||= video_url.match("youtu.be\/([#{YOUTUBE_ID_FORMAT}]*)")
  137 + youtube_match[1] unless youtube_match.nil?
  138 + end
  139 +
  140 + def extract_vimeo_id
  141 + return nil unless is_vimeo?
  142 + vimeo_match = video_url.match('([[:digit:]]*)$')
  143 + vimeo_match[1] unless vimeo_match.nil?
  144 + end
  145 +end
plugins/video/lib/video_plugin/video_block.rb 0 → 100644
@@ -0,0 +1,62 @@ @@ -0,0 +1,62 @@
  1 +class VideoPlugin::VideoBlock < Block
  2 +
  3 + attr_accessible :url, :width, :height
  4 +
  5 + settings_items :url, :type => :string, :default => ""
  6 + settings_items :width, :type => :integer, :default => 400
  7 + settings_items :height, :type => :integer, :default => 315
  8 +
  9 + YOUTUBE_ID_FORMAT = '\w-'
  10 +
  11 + def is_youtube?
  12 + url.match(/.*(youtube.com.*v=[#{YOUTUBE_ID_FORMAT}]+|youtu.be\/[#{YOUTUBE_ID_FORMAT}]+).*/) ? true : false
  13 + end
  14 +
  15 + def is_vimeo?
  16 + url.match(/^(http[s]?:\/\/)?(www.)?(vimeo.com|player.vimeo.com\/video)\/[[:digit:]]+/) ? true : false
  17 + end
  18 +
  19 + def is_video_file?
  20 + url.match(/.*(mp4|ogg|ogv|webm)$/) ? true : false
  21 + end
  22 +
  23 + def format_embed_video_url_for_youtube
  24 + "//www.youtube-nocookie.com/embed/#{extract_youtube_id}?rel=0&wmode=transparent" if is_youtube?
  25 + end
  26 +
  27 + def format_embed_video_url_for_vimeo
  28 + "//player.vimeo.com/video/#{extract_vimeo_id}" if is_vimeo?
  29 + end
  30 +
  31 + def self.description
  32 + _('Display a Video')
  33 + end
  34 +
  35 + def help
  36 + _('This block presents a video from youtube, vimeo and some video formats (mp4, ogg, ogv and webm)')
  37 + end
  38 +
  39 + def content(args={})
  40 + block = self
  41 +
  42 + proc do
  43 + render :file => 'video_block', :locals => { :block => block }
  44 + end
  45 + end
  46 +
  47 + private
  48 +
  49 + def extract_youtube_id
  50 + return nil unless is_youtube?
  51 + youtube_match = url.match("v=([#{YOUTUBE_ID_FORMAT}]*)")
  52 + youtube_match ||= url.match("youtu.be\/([#{YOUTUBE_ID_FORMAT}]*)")
  53 + youtube_match[1] unless youtube_match.nil?
  54 + end
  55 +
  56 + def extract_vimeo_id
  57 + return nil unless is_vimeo?
  58 + vimeo_match = url.match('([[:digit:]]*)$')
  59 + vimeo_match[1] unless vimeo_match.nil?
  60 + end
  61 +
  62 +end
plugins/video/lib/video_plugin/video_gallery.rb 0 → 100644
@@ -0,0 +1,63 @@ @@ -0,0 +1,63 @@
  1 +class VideoPlugin::VideoGallery < Folder
  2 +
  3 + def self.type_name
  4 + _('Video Gallery')
  5 + end
  6 +
  7 + settings_items :thumbnail_width, :type => :integer, :default => 50
  8 + settings_items :thumbnail_height, :type => :integer, :default => 50
  9 + settings_items :videos_per_row, :type => :integer, :default => 5
  10 +
  11 + validate :not_belong_to_blog
  12 +
  13 + def not_belong_to_blog
  14 + errors.add(:parent, "A video gallery should not belong to a blog.") if parent && parent.blog?
  15 + end
  16 +
  17 + acts_as_having_settings :field => :setting
  18 +
  19 + xss_terminate :only => [ :body ], :with => 'white_list', :on => 'validation'
  20 +
  21 + include WhiteListFilter
  22 + filter_iframes :body
  23 + def iframe_whitelist
  24 + profile && profile.environment && profile.environment.trusted_sites_for_iframe
  25 + end
  26 +
  27 + def self.short_description
  28 + _('Video Gallery')
  29 + end
  30 +
  31 + def self.description
  32 + _('A gallery of link to videos that are hosted elsewhere.')
  33 + end
  34 +
  35 + include ActionView::Helpers::TagHelper
  36 + def to_html(options = {})
  37 + video_gallery = self
  38 + proc do
  39 + render :partial => 'content_viewer/video_plugin/video_gallery', :locals => {:video_gallery => video_gallery}
  40 + end
  41 + end
  42 +
  43 + def video_gallery?
  44 + true
  45 + end
  46 +
  47 + def can_display_hits?
  48 + false
  49 + end
  50 +
  51 + def accept_comments?
  52 + false
  53 + end
  54 +
  55 + def self.icon_name(article = nil)
  56 + 'Video gallery'
  57 + end
  58 +
  59 + def news(limit = 30, highlight = false)
  60 + profile.recent_documents(limit, ["articles.type != ? AND articles.highlighted = ? AND articles.parent_id = ?", 'Folder', highlight, id])
  61 + end
  62 +
  63 +end
plugins/video/lib/video_plugin/video_gallery_helper.rb 0 → 100644
@@ -0,0 +1,18 @@ @@ -0,0 +1,18 @@
  1 +module VideoPlugin::VideoGalleryHelper
  2 +
  3 + def list_videos(configure={})
  4 + configure[:recursive] ||= false
  5 + configure[:list_type] ||= :folder
  6 + if !configure[:contents].blank?
  7 + configure[:contents] = configure[:contents].paginate(
  8 + :order => "updated_at DESC",
  9 + :per_page => 16,
  10 + :page => params[:npage]
  11 + )
  12 + render :file => 'shared/video_list', :locals => configure
  13 + else
  14 + content_tag('em', _('(empty folder)'))
  15 + end
  16 + end
  17 +
  18 +end
plugins/video/test/functional/video_plugin_environment_design_controller_test.rb
@@ -21,9 +21,9 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase @@ -21,9 +21,9 @@ class EnvironmentDesignControllerTest &lt; ActionController::TestCase
21 @environment.enabled_plugins = ['VideoPlugin'] 21 @environment.enabled_plugins = ['VideoPlugin']
22 @environment.save! 22 @environment.save!
23 23
24 - VideoBlock.delete_all 24 + VideoPlugin::VideoBlock.delete_all
25 25
26 - @block = VideoBlock.new 26 + @block = VideoPlugin::VideoBlock.new
27 @block.box = @environment.boxes.first 27 @block.box = @environment.boxes.first
28 @block.save! 28 @block.save!
29 end 29 end
plugins/video/test/functional/video_plugin_profile_design_controller_test.rb
@@ -18,11 +18,11 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase @@ -18,11 +18,11 @@ class ProfileDesignControllerTest &lt; ActionController::TestCase
18 @environment.enabled_plugins = ['VideoPlugin'] 18 @environment.enabled_plugins = ['VideoPlugin']
19 @environment.save! 19 @environment.save!
20 20
21 - VideoBlock.delete_all 21 + VideoPlugin::VideoBlock.delete_all
22 @box1 = Box.create!(:owner => @profile) 22 @box1 = Box.create!(:owner => @profile)
23 @profile.boxes = [@box1] 23 @profile.boxes = [@box1]
24 24
25 - @block = VideoBlock.new 25 + @block = VideoPlugin::VideoBlock.new
26 @block.box = @box1 26 @block.box = @box1
27 @block.save! 27 @block.save!
28 28
plugins/video/test/unit/video_block_test.rb
@@ -4,94 +4,94 @@ class VideoBlockTest &lt; ActiveSupport::TestCase @@ -4,94 +4,94 @@ class VideoBlockTest &lt; ActiveSupport::TestCase
4 ### Tests for YouTube 4 ### Tests for YouTube
5 5
6 should "is_youtube return true when the url contains http://youtube.com" do 6 should "is_youtube return true when the url contains http://youtube.com" do
7 - block = VideoBlock.new 7 + block = VideoPlugin::VideoBlock.new
8 block.url = "http://youtube.com/?v=XXXXX" 8 block.url = "http://youtube.com/?v=XXXXX"
9 assert block.is_youtube? 9 assert block.is_youtube?
10 end 10 end
11 11
12 should "is_youtube return true when the url contains https://youtube.com" do 12 should "is_youtube return true when the url contains https://youtube.com" do
13 - block = VideoBlock.new 13 + block = VideoPlugin::VideoBlock.new
14 block.url = "https://youtube.com/?v=XXXXX" 14 block.url = "https://youtube.com/?v=XXXXX"
15 assert block.is_youtube? 15 assert block.is_youtube?
16 end 16 end
17 17
18 should "is_youtube return true when the url contains https://www.youtube.com" do 18 should "is_youtube return true when the url contains https://www.youtube.com" do
19 - block = VideoBlock.new 19 + block = VideoPlugin::VideoBlock.new
20 block.url = "https://www.youtube.com/?v=XXXXX" 20 block.url = "https://www.youtube.com/?v=XXXXX"
21 assert block.is_youtube? 21 assert block.is_youtube?
22 end 22 end
23 23
24 should "is_youtube return true when the url contains www.youtube.com" do 24 should "is_youtube return true when the url contains www.youtube.com" do
25 - block = VideoBlock.new 25 + block = VideoPlugin::VideoBlock.new
26 block.url = "www.youtube.com/?v=XXXXX" 26 block.url = "www.youtube.com/?v=XXXXX"
27 assert block.is_youtube? 27 assert block.is_youtube?
28 end 28 end
29 29
30 should "is_youtube return true when the url contains youtube.com" do 30 should "is_youtube return true when the url contains youtube.com" do
31 - block = VideoBlock.new 31 + block = VideoPlugin::VideoBlock.new
32 block.url = "youtube.com/?v=XXXXX" 32 block.url = "youtube.com/?v=XXXXX"
33 assert block.is_youtube? 33 assert block.is_youtube?
34 end 34 end
35 35
36 should "is_youtube return false when the url not contains youtube video ID" do 36 should "is_youtube return false when the url not contains youtube video ID" do
37 - block = VideoBlock.new 37 + block = VideoPlugin::VideoBlock.new
38 block.url = "youtube.com/" 38 block.url = "youtube.com/"
39 assert !block.is_youtube? 39 assert !block.is_youtube?
40 end 40 end
41 41
42 should "is_youtube return false when the url contains empty youtube video ID" do 42 should "is_youtube return false when the url contains empty youtube video ID" do
43 - block = VideoBlock.new 43 + block = VideoPlugin::VideoBlock.new
44 block.url = "youtube.com/?v=" 44 block.url = "youtube.com/?v="
45 assert !block.is_youtube? 45 assert !block.is_youtube?
46 end 46 end
47 47
48 should "is_youtube return false when the url contains an invalid youtube link" do 48 should "is_youtube return false when the url contains an invalid youtube link" do
49 - block = VideoBlock.new 49 + block = VideoPlugin::VideoBlock.new
50 block.url = "http://www.yt.com/?v=XXXXX" 50 block.url = "http://www.yt.com/?v=XXXXX"
51 assert !block.is_youtube? 51 assert !block.is_youtube?
52 end 52 end
53 53
54 should "format embed video for youtube videos" do 54 should "format embed video for youtube videos" do
55 - block = VideoBlock.new 55 + block = VideoPlugin::VideoBlock.new
56 block.url = "youtube.com/?v=XXXXX" 56 block.url = "youtube.com/?v=XXXXX"
57 assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube 57 assert_match /\/\/www.youtube-nocookie.com\/embed/, block.format_embed_video_url_for_youtube
58 end 58 end
59 59
60 should "format embed video return nil if is not a youtube url" do 60 should "format embed video return nil if is not a youtube url" do
61 - block = VideoBlock.new 61 + block = VideoPlugin::VideoBlock.new
62 block.url = "http://www.yt.com/?v=XXXXX" 62 block.url = "http://www.yt.com/?v=XXXXX"
63 assert_nil block.format_embed_video_url_for_youtube 63 assert_nil block.format_embed_video_url_for_youtube
64 end 64 end
65 65
66 should "extract youtube id from youtube video url's if it's a valid youtube full url" do 66 should "extract youtube id from youtube video url's if it's a valid youtube full url" do
67 - block = VideoBlock.new 67 + block = VideoPlugin::VideoBlock.new
68 id = 'oi43jre2d2' 68 id = 'oi43jre2d2'
69 block.url = "youtube.com/?v=#{id}" 69 block.url = "youtube.com/?v=#{id}"
70 assert_equal id, block.send('extract_youtube_id') 70 assert_equal id, block.send('extract_youtube_id')
71 end 71 end
72 72
73 should "extract youtube id from youtube video url's if it has underline and hyphen" do 73 should "extract youtube id from youtube video url's if it has underline and hyphen" do
74 - block = VideoBlock.new 74 + block = VideoPlugin::VideoBlock.new
75 id = 'oi43_re-d2' 75 id = 'oi43_re-d2'
76 block.url = "youtube.com/?v=#{id}" 76 block.url = "youtube.com/?v=#{id}"
77 assert_equal id, block.send('extract_youtube_id') 77 assert_equal id, block.send('extract_youtube_id')
78 end 78 end
79 79
80 should "extract youtube id from youtube video url's if it's a valid youtube short url" do 80 should "extract youtube id from youtube video url's if it's a valid youtube short url" do
81 - block = VideoBlock.new 81 + block = VideoPlugin::VideoBlock.new
82 id = 'oi43jre2d2' 82 id = 'oi43jre2d2'
83 block.url = "youtu.be/#{id}" 83 block.url = "youtu.be/#{id}"
84 assert_equal id, block.send('extract_youtube_id') 84 assert_equal id, block.send('extract_youtube_id')
85 end 85 end
86 86
87 should "extract_youtube_id return nil if the url it's not a valid youtube url" do 87 should "extract_youtube_id return nil if the url it's not a valid youtube url" do
88 - block = VideoBlock.new 88 + block = VideoPlugin::VideoBlock.new
89 block.url = "http://www.yt.com/?v=XXXXX" 89 block.url = "http://www.yt.com/?v=XXXXX"
90 assert_nil block.send('extract_youtube_id') 90 assert_nil block.send('extract_youtube_id')
91 end 91 end
92 92
93 should "extract_youtube_id return nil if youtue url there is no id" do 93 should "extract_youtube_id return nil if youtue url there is no id" do
94 - block = VideoBlock.new 94 + block = VideoPlugin::VideoBlock.new
95 block.url = "youtube.com/" 95 block.url = "youtube.com/"
96 assert_nil block.send('extract_youtube_id') 96 assert_nil block.send('extract_youtube_id')
97 end 97 end
@@ -99,111 +99,111 @@ class VideoBlockTest &lt; ActiveSupport::TestCase @@ -99,111 +99,111 @@ class VideoBlockTest &lt; ActiveSupport::TestCase
99 #### Tests for Vimeo Videos 99 #### Tests for Vimeo Videos
100 100
101 should "is_vimeo return true when the url contains http://vimeo.com" do 101 should "is_vimeo return true when the url contains http://vimeo.com" do
102 - block = VideoBlock.new 102 + block = VideoPlugin::VideoBlock.new
103 block.url = "http://vimeo.com/98979" 103 block.url = "http://vimeo.com/98979"
104 assert block.is_vimeo? 104 assert block.is_vimeo?
105 end 105 end
106 106
107 should "is_vimeo return true when the url contains https://vimeo.com" do 107 should "is_vimeo return true when the url contains https://vimeo.com" do
108 - block = VideoBlock.new 108 + block = VideoPlugin::VideoBlock.new
109 block.url = "https://vimeo.com/989798" 109 block.url = "https://vimeo.com/989798"
110 assert block.is_vimeo? 110 assert block.is_vimeo?
111 end 111 end
112 112
113 should "is_vimeo return true when the url contains https://www.vimeo.com" do 113 should "is_vimeo return true when the url contains https://www.vimeo.com" do
114 - block = VideoBlock.new 114 + block = VideoPlugin::VideoBlock.new
115 block.url = "https://www.vimeo.com/98987" 115 block.url = "https://www.vimeo.com/98987"
116 assert block.is_vimeo? 116 assert block.is_vimeo?
117 end 117 end
118 118
119 should "is_vimeo return true when the url contains www.vimeo.com" do 119 should "is_vimeo return true when the url contains www.vimeo.com" do
120 - block = VideoBlock.new 120 + block = VideoPlugin::VideoBlock.new
121 block.url = "www.vimeo.com/989798" 121 block.url = "www.vimeo.com/989798"
122 assert block.is_vimeo? 122 assert block.is_vimeo?
123 end 123 end
124 124
125 should "is_vimeo return true when the url contains vimeo.com" do 125 should "is_vimeo return true when the url contains vimeo.com" do
126 - block = VideoBlock.new 126 + block = VideoPlugin::VideoBlock.new
127 block.url = "vimeo.com/09898" 127 block.url = "vimeo.com/09898"
128 assert block.is_vimeo? 128 assert block.is_vimeo?
129 end 129 end
130 130
131 should "is_vimeo return false when the url not contains vimeo video ID" do 131 should "is_vimeo return false when the url not contains vimeo video ID" do
132 - block = VideoBlock.new 132 + block = VideoPlugin::VideoBlock.new
133 block.url = "vimeo.com/home" 133 block.url = "vimeo.com/home"
134 assert !block.is_vimeo? 134 assert !block.is_vimeo?
135 end 135 end
136 136
137 should "is_vimeo return false when the url contains empty vimeo video ID" do 137 should "is_vimeo return false when the url contains empty vimeo video ID" do
138 - block = VideoBlock.new 138 + block = VideoPlugin::VideoBlock.new
139 block.url = "vimeo.com/" 139 block.url = "vimeo.com/"
140 assert !block.is_vimeo? 140 assert !block.is_vimeo?
141 end 141 end
142 142
143 should "is_vimeo return false when the url contains an invalid vimeo link" do 143 should "is_vimeo return false when the url contains an invalid vimeo link" do
144 - block = VideoBlock.new 144 + block = VideoPlugin::VideoBlock.new
145 block.url = "http://www.vmsd.com/98979" 145 block.url = "http://www.vmsd.com/98979"
146 assert !block.is_vimeo? 146 assert !block.is_vimeo?
147 end 147 end
148 148
149 should "format embed video for vimeo videos" do 149 should "format embed video for vimeo videos" do
150 - block = VideoBlock.new 150 + block = VideoPlugin::VideoBlock.new
151 block.url = "vimeo.com/09898" 151 block.url = "vimeo.com/09898"
152 assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo 152 assert_match /\/\/player.vimeo.com\/video\/[[:digit:]]+/, block.format_embed_video_url_for_vimeo
153 end 153 end
154 154
155 should "format embed video return nil if is not a vimeo url" do 155 should "format embed video return nil if is not a vimeo url" do
156 - block = VideoBlock.new 156 + block = VideoPlugin::VideoBlock.new
157 block.url = "http://www.yt.com/?v=XXXXX" 157 block.url = "http://www.yt.com/?v=XXXXX"
158 assert_nil block.format_embed_video_url_for_vimeo 158 assert_nil block.format_embed_video_url_for_vimeo
159 end 159 end
160 160
161 should "extract vimeo id from vimeo video url's if it's a valid vimeo url" do 161 should "extract vimeo id from vimeo video url's if it's a valid vimeo url" do
162 - block = VideoBlock.new 162 + block = VideoPlugin::VideoBlock.new
163 id = '23048239432' 163 id = '23048239432'
164 block.url = "vimeo.com/#{id}" 164 block.url = "vimeo.com/#{id}"
165 assert_equal id, block.send('extract_vimeo_id') 165 assert_equal id, block.send('extract_vimeo_id')
166 end 166 end
167 167
168 should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do 168 should "extract_vimeo_id return nil if the url it's not a valid vimeo url" do
169 - block = VideoBlock.new 169 + block = VideoPlugin::VideoBlock.new
170 block.url = "http://www.yt.com/XXXXX" 170 block.url = "http://www.yt.com/XXXXX"
171 assert_nil block.send('extract_vimeo_id') 171 assert_nil block.send('extract_vimeo_id')
172 end 172 end
173 173
174 should "extract_vimeo_id return nil if vimeo url there is no id" do 174 should "extract_vimeo_id return nil if vimeo url there is no id" do
175 - block = VideoBlock.new 175 + block = VideoPlugin::VideoBlock.new
176 block.url = "vimeo.com/" 176 block.url = "vimeo.com/"
177 assert_nil block.send('extract_youtube_id') 177 assert_nil block.send('extract_youtube_id')
178 end 178 end
179 179
180 # Other video formats 180 # Other video formats
181 should "is_video return true if url ends with mp4" do 181 should "is_video return true if url ends with mp4" do
182 - block = VideoBlock.new 182 + block = VideoPlugin::VideoBlock.new
183 block.url = "http://www.vmsd.com/98979.mp4" 183 block.url = "http://www.vmsd.com/98979.mp4"
184 assert block.is_video_file? 184 assert block.is_video_file?
185 end 185 end
186 186
187 should "is_video return true if url ends with ogg" do 187 should "is_video return true if url ends with ogg" do
188 - block = VideoBlock.new 188 + block = VideoPlugin::VideoBlock.new
189 block.url = "http://www.vmsd.com/98979.ogg" 189 block.url = "http://www.vmsd.com/98979.ogg"
190 assert block.is_video_file? 190 assert block.is_video_file?
191 end 191 end
192 192
193 should "is_video return true if url ends with ogv" do 193 should "is_video return true if url ends with ogv" do
194 - block = VideoBlock.new 194 + block = VideoPlugin::VideoBlock.new
195 block.url = "http://www.vmsd.com/98979.ogv" 195 block.url = "http://www.vmsd.com/98979.ogv"
196 assert block.is_video_file? 196 assert block.is_video_file?
197 end 197 end
198 198
199 should "is_video return true if url ends with webm" do 199 should "is_video return true if url ends with webm" do
200 - block = VideoBlock.new 200 + block = VideoPlugin::VideoBlock.new
201 block.url = "http://www.vmsd.com/98979.webm" 201 block.url = "http://www.vmsd.com/98979.webm"
202 assert block.is_video_file? 202 assert block.is_video_file?
203 end 203 end
204 204
205 should "is_video return false if url ends without mp4, ogg, ogv, webm" do 205 should "is_video return false if url ends without mp4, ogg, ogv, webm" do
206 - block = VideoBlock.new 206 + block = VideoPlugin::VideoBlock.new
207 block.url = "http://www.vmsd.com/98979.mp4r" 207 block.url = "http://www.vmsd.com/98979.mp4r"
208 assert !block.is_video_file? 208 assert !block.is_video_file?
209 block.url = "http://www.vmsd.com/98979.oggr" 209 block.url = "http://www.vmsd.com/98979.oggr"
@@ -215,7 +215,7 @@ class VideoBlockTest &lt; ActiveSupport::TestCase @@ -215,7 +215,7 @@ class VideoBlockTest &lt; ActiveSupport::TestCase
215 end 215 end
216 216
217 should 'display video block partial' do 217 should 'display video block partial' do
218 - block = VideoBlock.new 218 + block = VideoPlugin::VideoBlock.new
219 self.expects(:render).with(:file => 'video_block', :locals => { 219 self.expects(:render).with(:file => 'video_block', :locals => {
220 :block => block 220 :block => block
221 }) 221 })
plugins/video/test/unit/video_plugin_test.rb
@@ -2,7 +2,7 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39; @@ -2,7 +2,7 @@ require File.dirname(__FILE__) + &#39;/../test_helper&#39;
2 class VideoPluginTest < ActiveSupport::TestCase 2 class VideoPluginTest < ActiveSupport::TestCase
3 3
4 should "return VideoBlock in extra_blocks class method" do 4 should "return VideoBlock in extra_blocks class method" do
5 - assert VideoPlugin.extra_blocks.keys.include?(VideoBlock) 5 + assert VideoPlugin.extra_blocks.keys.include?(VideoPlugin::VideoBlock)
6 end 6 end
7 7
8 end 8 end
plugins/video/views/cms/_video.html.erb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -<%= required_fields_message %>  
2 -  
3 -<div>  
4 -<%= required f.text_field('name', :size => '64', :maxlength => 150) %>  
5 -<%= required labelled_form_field _('URL of the video'), text_field(:article, :video_url, :size => 300) %>  
6 -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>  
7 -<%= render :partial => 'general_fields' %>  
8 -<%= render :partial => 'translatable' %>  
9 -</div>  
10 -  
11 -  
12 -  
plugins/video/views/cms/_video_gallery.html.erb
@@ -1,6 +0,0 @@ @@ -1,6 +0,0 @@
1 -<%= required_fields_message %>  
2 -  
3 -<%= required f.text_field('name', :size => '64', :maxlength => 150) %>  
4 -<%= render :partial => 'general_fields' %>  
5 -  
6 -<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>  
plugins/video/views/cms/video_plugin/_video.html.erb 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +<%= required_fields_message %>
  2 +
  3 +<div>
  4 +<%= required f.text_field('name', :size => '64', :maxlength => 150) %>
  5 +<%= required labelled_form_field _('URL of the video'), text_field(:article, :video_url, :size => 300) %>
  6 +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>
  7 +<%= render :partial => 'general_fields' %>
  8 +<%= render :partial => 'translatable' %>
  9 +</div>
  10 +
  11 +
  12 +
plugins/video/views/cms/video_plugin/_video_gallery.html.erb 0 → 100644
@@ -0,0 +1,6 @@ @@ -0,0 +1,6 @@
  1 +<%= required_fields_message %>
  2 +
  3 +<%= required f.text_field('name', :size => '64', :maxlength => 150) %>
  4 +<%= render :partial => 'general_fields' %>
  5 +
  6 +<%= labelled_form_field(_('Description:'), text_area(:article, :body, :rows => 3, :cols => 64)) %>
plugins/video/views/content_viewer/_video.html.erb
@@ -1,34 +0,0 @@ @@ -1,34 +0,0 @@
1 -<div align="center">  
2 -<%if @page.video_provider=='youtube' %>  
3 - <link type="text/css" rel="stylesheet" href="/plugins/video/css/video-js-4.5.1.css" />  
4 - <video id="embedded_video" src="" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"  
5 - width="<%= @page.fitted_width %>" height="<%= @page.fitted_height %>"  
6 - data-setup='<%=CGI::escapeHTML("{ \"techOrder\": [\"youtube\"], \"src\": \"#{@page.video_url}\" }") %>'>  
7 - <%= @page.no_browser_support_message %>  
8 - </video>  
9 - <script src="/plugins/video/javascripts/videojs/video-4.5.1.js"></script>  
10 - <script src="/plugins/video/javascripts/videojs/vjs.youtube.js"></script>  
11 - <% elsif @page.video_provider=='vimeo' %>  
12 - <link type="text/css" rel="stylesheet" href="/plugins/video/css/video-js-4.5.1.css" />  
13 - <video id="embedded_video" src="" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"  
14 - width="<%= @page.fitted_width %>" height="<%= @page.fitted_height %>"  
15 - data-setup='<%=CGI::escapeHTML("{ \"techOrder\": [\"vimeo\"], \"src\": \"#{@page.video_url}\", \"loop\": true, \"autoplay\": false }") %>'>  
16 - <%= @page.no_browser_support_message %>  
17 - </video>  
18 - <script src="/plugins/video/javascripts/videojs/video-4.5.1.js"></script>  
19 - <script src="/plugins/video/javascripts/videojs/vjs.vimeo.js"></script>  
20 -<% elsif @page.video_provider=='file' %>  
21 - <link href="/plugins/video/css/video-js-4.8.5.css" rel="stylesheet">  
22 - <script src="/plugins/video/javascripts/videojs/video-4.8.5.js"></script>  
23 - <video id="embedded_video" class="video-js vjs-default-skin vjs-big-play-centered"  
24 - height="353" width="499"  
25 - controls preload="auto"  
26 - data-setup='<%=CGI::escapeHTML("{ \"example_option\":true}") %>'>  
27 - <source src="<%= @page.video_url %>" type='<%= @page.video_format %>' />  
28 - <%= @page.no_browser_support_message %>  
29 - </video>  
30 -<% end %>  
31 -<br style="clear:both" />  
32 -</div>  
33 -<% _("Description:") %>  
34 -<%= @page.body %>  
plugins/video/views/content_viewer/_video_gallery.html.erb
@@ -1,14 +0,0 @@ @@ -1,14 +0,0 @@
1 -<% extend VideoPlugin::VideoGalleryHelper %>  
2 -  
3 -<% unless video_gallery.body.blank? %>  
4 - <div>  
5 - <%= video_gallery.body %>  
6 - </div>  
7 - <hr/>  
8 -<% end %>  
9 -  
10 -<% if video_gallery.children.empty? %>  
11 - <em><%= _('(empty video gallery)') %></em>  
12 -<% else %>  
13 - <%= list_videos(:contents=>video_gallery.children) %>  
14 -<% end %>  
15 \ No newline at end of file 0 \ No newline at end of file
plugins/video/views/content_viewer/video_plugin/_video.html.erb 0 → 100644
@@ -0,0 +1,34 @@ @@ -0,0 +1,34 @@
  1 +<div align="center">
  2 +<%if @page.video_provider=='youtube' %>
  3 + <link type="text/css" rel="stylesheet" href="/plugins/video/css/video-js-4.5.1.css" />
  4 + <video id="embedded_video" src="" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"
  5 + width="<%= @page.fitted_width %>" height="<%= @page.fitted_height %>"
  6 + data-setup='<%=CGI::escapeHTML("{ \"techOrder\": [\"youtube\"], \"src\": \"#{@page.video_url}\" }") %>'>
  7 + <%= @page.no_browser_support_message %>
  8 + </video>
  9 + <script src="/plugins/video/javascripts/videojs/video-4.5.1.js"></script>
  10 + <script src="/plugins/video/javascripts/videojs/vjs.youtube.js"></script>
  11 + <% elsif @page.video_provider=='vimeo' %>
  12 + <link type="text/css" rel="stylesheet" href="/plugins/video/css/video-js-4.5.1.css" />
  13 + <video id="embedded_video" src="" class="video-js vjs-default-skin vjs-big-play-centered" controls preload="auto"
  14 + width="<%= @page.fitted_width %>" height="<%= @page.fitted_height %>"
  15 + data-setup='<%=CGI::escapeHTML("{ \"techOrder\": [\"vimeo\"], \"src\": \"#{@page.video_url}\", \"loop\": true, \"autoplay\": false }") %>'>
  16 + <%= @page.no_browser_support_message %>
  17 + </video>
  18 + <script src="/plugins/video/javascripts/videojs/video-4.5.1.js"></script>
  19 + <script src="/plugins/video/javascripts/videojs/vjs.vimeo.js"></script>
  20 +<% elsif @page.video_provider=='file' %>
  21 + <link href="/plugins/video/css/video-js-4.8.5.css" rel="stylesheet">
  22 + <script src="/plugins/video/javascripts/videojs/video-4.8.5.js"></script>
  23 + <video id="embedded_video" class="video-js vjs-default-skin vjs-big-play-centered"
  24 + height="353" width="499"
  25 + controls preload="auto"
  26 + data-setup='<%=CGI::escapeHTML("{ \"example_option\":true}") %>'>
  27 + <source src="<%= @page.video_url %>" type='<%= @page.video_format %>' />
  28 + <%= @page.no_browser_support_message %>
  29 + </video>
  30 +<% end %>
  31 +<br style="clear:both" />
  32 +</div>
  33 +<% _("Description:") %>
  34 +<%= @page.body %>
plugins/video/views/content_viewer/video_plugin/_video_gallery.html.erb 0 → 100644
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
  1 +<% extend VideoPlugin::VideoGalleryHelper %>
  2 +
  3 +<% unless video_gallery.body.blank? %>
  4 + <div>
  5 + <%= video_gallery.body %>
  6 + </div>
  7 + <hr/>
  8 +<% end %>
  9 +
  10 +<% if video_gallery.children.empty? %>
  11 + <em><%= _('(empty video gallery)') %></em>
  12 +<% else %>
  13 + <%= list_videos(:contents=>video_gallery.children) %>
  14 +<% end %>
0 \ No newline at end of file 15 \ No newline at end of file
plugins/video/views/shared/video_plugin/video_block.html.erb 0 → 100644
@@ -0,0 +1,21 @@ @@ -0,0 +1,21 @@
  1 +<h3 class="block-title">
  2 + <span><%=block.title%></span>
  3 +</h3>
  4 +<div class="video-block-data">
  5 + <% if block.is_youtube? %>
  6 + <div class='youtube'>
  7 + <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_youtube, :width => block.width, :height => block.height }%>
  8 + </div>
  9 + <% elsif block.is_vimeo? %>
  10 + <div class='vimeo'>
  11 + <%= render :partial => 'box_organizer/iframe_video_block', :locals => { :url => block.format_embed_video_url_for_vimeo, :width => block.width, :height => block.height }%>
  12 + </div>
  13 + <% elsif block.is_video_file? %>
  14 + <div class='video'>
  15 + <%= render :partial => 'box_organizer/html5_video_block', :locals => { :url => block.url, :width => block.width, :height => block.height }%>
  16 + </div>
  17 + <% else %>
  18 + <span class='alert-block'><%= _("Register a valid url (Vimeo, Youtube, video files)") %></span>
  19 + <% end %>
  20 +
  21 +</div>