Commit 35f0b39312459f05f8ddf56a743b0d521c4d44ad

Authored by Victor Costa
2 parents d1cd13c2 a39547e4

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

Conflicts:
	app/views/content_viewer/_article_toolbar.html.erb
app/views/content_viewer/_article_toolbar.html.erb
... ... @@ -38,10 +38,6 @@
38 38 <%= colorbox_button(:new, label_for_new_article(@page), profile.admin_url.merge(:controller => 'cms', :action => 'new', :parent_id => (@page.folder? ? @page : (@page.parent.nil? ? nil : @page.parent)))) unless remove_content_button(:new) %>
39 39 <% end %>
40 40  
41   - <% @plugins.dispatch(:article_toolbar_extra_buttons).each do |plugin_button| %>
42   - <%= instance_eval(&plugin_button) %>
43   - <% end %>
44   -
45 41 <% if @page.accept_uploads? && @page.allow_create?(user) %>
46 42 <%= button('upload-file', _('Upload files'), profile.admin_url.merge(:controller => 'cms', :action => 'upload_files', :parent_id => (@page.folder? ? @page : @page.parent))) unless remove_content_button(:upload)%>
47 43 <% end %>
... ... @@ -57,8 +53,10 @@
57 53 <%= button(:clock, _('All versions'), {:controller => 'content_viewer', :profile => profile.identifier, :action => 'article_versions'}, :id => 'article-versions-link') %>
58 54 <% end %>
59 55  
  56 + <%#*Adds extra buttons to the toolbar%>
  57 + <%= @plugins.dispatch(:article_extra_toolbar_buttons, @page).collect { |content| instance_exec(&content) }.join("") %>
  58 +
60 59 <%= report_abuse(profile, :link, @page) %>
61   -
62 60 </div>
63 61 <div id="article-header">
64 62 <% if @page.blog? and !@page.image.nil? %>
... ...
lib/noosfero/plugin.rb
... ... @@ -498,6 +498,12 @@ class Noosfero::Plugin
498 498 nil
499 499 end
500 500  
  501 + # -> Adds adicional content to article toolbar buttons
  502 + # returns = lambda block that creates html code
  503 + def article_extra_toolbar_buttons(article)
  504 + nil
  505 + end
  506 +
501 507 # -> Adds adicional content to article header
502 508 # returns = lambda block that creates html code
503 509 def article_header_extra_contents(article)
... ...
plugins/video/lib/ext/article.rb 0 → 100644
... ... @@ -0,0 +1,13 @@
  1 +require_dependency 'article'
  2 +
  3 +class Article
  4 +
  5 + def self.folder_types_with_video
  6 + self.folder_types_without_video << 'VideoGallery'
  7 + end
  8 +
  9 + class << self
  10 + alias_method_chain :folder_types, :video
  11 + end
  12 +
  13 +end
... ...
plugins/video/lib/video.rb 0 → 100644
... ... @@ -0,0 +1,167 @@
  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 +
  147 +#To be used for the duration
  148 +#function formatSecondsAsTime(secs) {
  149 +# var hr = Math.floor(secs / 3600);
  150 +# var min = Math.floor((secs - (hr * 3600)) / 60);
  151 +# var sec = Math.floor(secs - (hr * 3600) - (min * 60));
  152 +#
  153 +# if (hr < 10) {
  154 +# hr = "0" + hr;
  155 +# }
  156 +# if (min < 10) {
  157 +# min = "0" + min;
  158 +# }
  159 +# if (sec < 10) {
  160 +# sec = "0" + sec;
  161 +# }
  162 +# if (hr) {
  163 +# hr = "00";
  164 +# }
  165 +#
  166 +# return hr + ':' + min + ':' + sec;
  167 +#}
... ...
plugins/video/lib/video_gallery.rb 0 → 100644
... ... @@ -0,0 +1,63 @@
  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_plugin.rb
1 1 require_dependency File.dirname(__FILE__) + '/video_block'
  2 +require_dependency File.dirname(__FILE__) + '/video'
  3 +require_dependency File.dirname(__FILE__) + '/video_gallery'
2 4  
3 5 class VideoPlugin < Noosfero::Plugin
4 6  
5 7 def self.plugin_name
6   - "Video Block Plugin"
  8 + "Video Content type, Video Block and Video Gallery Plugin"
7 9 end
8 10  
9 11 def self.plugin_description
... ... @@ -11,9 +13,42 @@ class VideoPlugin &lt; Noosfero::Plugin
11 13 end
12 14  
13 15 def self.extra_blocks
14   - {
  16 + {
15 17 VideoBlock => {}
16   - }
  18 + }
  19 + end
  20 +
  21 + def stylesheet?
  22 + true
  23 + end
  24 +
  25 + def content_types
  26 + [VideoPlugin::VideoGallery, VideoPlugin::Video]
  27 + end
  28 +
  29 + def content_remove_new(content)
  30 + if content.kind_of?(VideoPlugin::VideoGallery) or content.kind_of?(VideoPlugin::Video)
  31 + true
  32 + end
17 33 end
18 34  
  35 + def content_remove_upload(content)
  36 + if content.kind_of?(VideoPlugin::VideoGallery) or content.kind_of?(VideoPlugin::Video)
  37 + true
  38 + end
  39 + end
  40 +
  41 + def article_extra_toolbar_buttons(content)
  42 + if content.kind_of?(VideoPlugin::VideoGallery)
  43 + proc do
  44 + content_tag('a', _("New Video"),
  45 + { :id=>"new-video-btn",
  46 + :class=>"button with-text icon-new",
  47 + :href=>url_for(:action => 'new', :type=>'Video', :controller=>'cms', :parent_id => content.id),
  48 + :title=>_("New Video")
  49 + })
  50 + end
  51 + end
  52 + end
  53 +
19 54 end
... ...
plugins/video/public/images/video_generic_thumbnail.jpg 0 → 100644

4.49 KB

plugins/video/public/javascripts/videojs/vjs.vimeo.js 0 → 100644
... ... @@ -0,0 +1,15 @@
  1 +var VimeoState={UNSTARTED:-1,ENDED:0,PLAYING:1,PAUSED:2,BUFFERING:3};
  2 +videojs.Vimeo=videojs.MediaTechController.extend({init:function(a,d,e){videojs.MediaTechController.call(this,a,d,e);this.player_=a;this.player_el_=document.getElementById(this.player_.id());this.player_.controls(!1);this.id_=this.player_.id()+"_vimeo_api";this.el_=videojs.Component.prototype.createEl("iframe",{id:this.id_,className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0,webkitAllowFullScreen:"true",mozallowfullscreen:"true",allowFullScreen:"true"});this.player_el_.insertBefore(this.el_,
  3 +this.player_el_.firstChild);this.baseUrl="https"==document.location.protocol?"https://secure.vimeo.com/video/":"http://player.vimeo.com/video/";this.vimeo={};this.vimeoInfo={};var h=this;this.el_.onload=function(){h.onLoad()};this.startMuted=a.options().muted;this.src(a.options().src)}});videojs.Vimeo.prototype.dispose=function(){this.vimeo.api("unload");delete this.vimeo;this.el_.parentNode.removeChild(this.el_);videojs.MediaTechController.prototype.dispose.call(this)};
  4 +videojs.Vimeo.prototype.src=function(a){this.isReady_=!1;if(a=a.match(/^.*(vimeo\.com\/)((channels\/[A-z]+\/)|(groups\/[A-z]+\/videos\/))?([0-9]+)/))this.videoId=a[5];a={api:1,byline:0,portrait:0,show_title:0,show_byline:0,show_portait:0,fullscreen:1,player_id:this.id_,autoplay:this.player_.options().autoplay?1:0,loop:this.player_.options().loop?1:0};this.el_.src=this.baseUrl+this.videoId+"?"+videojs.Vimeo.makeQueryString(a)};videojs.Vimeo.prototype.load=function(){};
  5 +videojs.Vimeo.prototype.play=function(){this.vimeo.api("play")};videojs.Vimeo.prototype.pause=function(){this.vimeo.api("pause")};videojs.Vimeo.prototype.paused=function(){return this.lastState!==VimeoState.PLAYING&&this.lastState!==VimeoState.BUFFERING};videojs.Vimeo.prototype.currentTime=function(){return this.vimeoInfo.time||0};videojs.Vimeo.prototype.setCurrentTime=function(a){this.vimeo.api("seekTo",a);this.player_.trigger("timeupdate")};
  6 +videojs.Vimeo.prototype.duration=function(){return this.vimeoInfo.duration||0};videojs.Vimeo.prototype.buffered=function(){return videojs.createTimeRange(0,this.vimeoInfo.buffered||0)};videojs.Vimeo.prototype.volume=function(){return this.vimeoInfo.muted?this.vimeoInfo.muteVolume:this.vimeoInfo.volume};videojs.Vimeo.prototype.setVolume=function(a){this.vimeo.api("setvolume",a);this.vimeoInfo.volume=a;this.player_.trigger("volumechange")};
  7 +videojs.Vimeo.prototype.muted=function(){return this.vimeoInfo.muted||!1};videojs.Vimeo.prototype.setMuted=function(a){a?(this.vimeoInfo.muteVolume=this.vimeoInfo.volume,this.setVolume(0)):this.setVolume(this.vimeoInfo.muteVolume);this.vimeoInfo.muted=a;this.player_.trigger("volumechange")};videojs.Vimeo.prototype.onReady=function(){this.isReady_=!0;this.triggerReady();this.startMuted&&(this.setMuted(!0),this.startMuted=!1)};
  8 +videojs.Vimeo.prototype.onLoad=function(){this.vimeo.api&&(this.vimeo.api("unload"),delete this.vimeo);this.vimeo=$f(this.el_);this.vimeoInfo={state:VimeoState.UNSTARTED,volume:1,muted:!1,muteVolume:1,time:0,duration:0,buffered:0,url:this.baseUrl+this.videoId,error:null};var a=this;this.vimeo.addEvent("ready",function(d){a.onReady()});this.vimeo.addEvent("loadProgress",function(d,e){a.onLoadProgress(d)});this.vimeo.addEvent("playProgress",function(d,e){a.onPlayProgress(d)});this.vimeo.addEvent("play",
  9 +function(d){a.onPlay()});this.vimeo.addEvent("pause",function(d){a.onPause()});this.vimeo.addEvent("finish",function(d){a.onFinish()});this.vimeo.addEvent("seek",function(d,e){a.onSeek(d)})};videojs.Vimeo.prototype.onLoadProgress=function(a){var d=!this.vimeoInfo.duration;this.vimeoInfo.duration=a.duration;this.vimeoInfo.buffered=a.percent;this.player_.trigger("progress");d&&this.player_.trigger("durationchange")};videojs.Vimeo.prototype.onPlayProgress=function(a){this.vimeoInfo.time=a.seconds;this.player_.trigger("timeupdate")};
  10 +videojs.Vimeo.prototype.onPlay=function(){this.vimeoInfo.state=VimeoState.PLAYING;this.player_.trigger("play")};videojs.Vimeo.prototype.onPause=function(){this.vimeoInfo.state=VimeoState.PAUSED;this.player_.trigger("pause")};videojs.Vimeo.prototype.onFinish=function(){this.vimeoInfo.state=VimeoState.ENDED;this.player_.trigger("ended")};videojs.Vimeo.prototype.onSeek=function(a){this.vimeoInfo.time=a.seconds;this.player_.trigger("timeupdate");this.player_.trigger("seeked")};
  11 +videojs.Vimeo.prototype.onError=function(a){this.player_.error=a;this.player_.trigger("error")};videojs.Vimeo.isSupported=function(){return!0};videojs.Vimeo.prototype.supportsFullScreen=function(){return!1};videojs.Vimeo.canPlaySource=function(a){return"video/vimeo"==a.type};videojs.Vimeo.makeQueryString=function(a){var d=[],e;for(e in a)a.hasOwnProperty(e)&&d.push(encodeURIComponent(e)+"="+encodeURIComponent(a[e]));return d.join("&")};
  12 +var Froogaloop=function(){function a(m){return new a.fn.init(m)}function d(a,c,b){if(!b.contentWindow.postMessage)return!1;var d=b.getAttribute("src").split("?")[0];a=JSON.stringify({method:a,value:c});"//"===d.substr(0,2)&&(d=window.location.protocol+d);b.contentWindow.postMessage(a,d)}function e(a){var c,b;try{c=JSON.parse(a.data),b=c.event||c.method}catch(d){}"ready"!=b||k||(k=!0);if(a.origin!=l)return!1;a=c.value;var e=c.data,g=""===g?null:c.player_id;c=g?f[g][b]:f[b];b=[];if(!c)return!1;void 0!==
  13 +a&&b.push(a);e&&b.push(e);g&&b.push(g);return 0<b.length?c.apply(null,b):c.call()}function h(a,c,b){b?(f[b]||(f[b]={}),f[b][a]=c):f[a]=c}var f={},k=!1,l="";a.fn=a.prototype={element:null,init:function(a){"string"===typeof a&&(a=document.getElementById(a));this.element=a;a=this.element.getAttribute("src");"//"===a.substr(0,2)&&(a=window.location.protocol+a);a=a.split("/");for(var c="",b=0,d=a.length;b<d;b++){if(3>b)c+=a[b];else break;2>b&&(c+="/")}l=c;return this},api:function(a,c){if(!this.element||
  14 +!a)return!1;var b=this.element,e=""!==b.id?b.id:null,f=c&&c.constructor&&c.call&&c.apply?null:c,g=c&&c.constructor&&c.call&&c.apply?c:null;g&&h(a,g,e);d(a,f,b);return this},addEvent:function(a,c){if(!this.element)return!1;var b=this.element,e=""!==b.id?b.id:null;h(a,c,e);"ready"!=a?d("addEventListener",a,b):"ready"==a&&k&&c.call(null,e);return this},removeEvent:function(a){if(!this.element)return!1;var c=this.element,b=""!==c.id?c.id:null;a:{if(b&&f[b]){if(!f[b][a]){b=!1;break a}f[b][a]=null}else{if(!f[a]){b=
  15 +!1;break a}f[a]=null}b=!0}"ready"!=a&&b&&d("removeEventListener",a,c)}};a.fn.init.prototype=a.fn;window.addEventListener?window.addEventListener("message",e,!1):window.attachEvent("onmessage",e);return window.Froogaloop=window.$f=a}();
0 16 \ No newline at end of file
... ...
plugins/video/public/javascripts/videojs/vjs.youtube.js 0 → 100644
... ... @@ -0,0 +1 @@
  1 +!function(){function addEventListener(element,event,cb){element.addEventListener?element.addEventListener(event,cb,!0):element.attachEvent(event,cb)}function setInnerText(element,text){if("undefined"==typeof element)return!1;var textProperty="innerText"in element?"innerText":"textContent";try{element[textProperty]=text}catch(anException){element.setAttribute("innerText",text)}}videojs.Youtube=videojs.MediaTechController.extend({init:function(player,options,ready){if(this.features.progressEvents=!1,this.features.timeupdateEvents=!1,videojs.MediaTechController.call(this,player,options,ready),this.isIos=/(iPad|iPhone|iPod)/g.test(navigator.userAgent),this.isAndroid=/(Android)/g.test(navigator.userAgent),this.playVideoIsAllowed=!(this.isIos||this.isAndroid),"undefined"!=typeof options.source)for(var key in options.source)options.source.hasOwnProperty(key)&&(player.options()[key]=options.source[key]);this.userQuality=videojs.Youtube.convertQualityName(player.options().quality),this.player_=player,this.playerEl_=document.getElementById(player.id()),this.playerEl_.className+=" vjs-youtube",this.qualityButton=document.createElement("div"),this.qualityButton.setAttribute("class","vjs-quality-button vjs-menu-button vjs-control"),this.qualityButton.setAttribute("tabindex",0);var qualityContent=document.createElement("div");this.qualityButton.appendChild(qualityContent),this.qualityTitle=document.createElement("span"),qualityContent.appendChild(this.qualityTitle),"undefined"!==player.options().quality&&setInnerText(this.qualityTitle,player.options().quality||"auto");var qualityMenu=document.createElement("div");if(qualityMenu.setAttribute("class","vjs-menu"),this.qualityButton.appendChild(qualityMenu),this.qualityMenuContent=document.createElement("ul"),this.qualityMenuContent.setAttribute("class","vjs-menu-content"),qualityMenu.appendChild(this.qualityMenuContent),this.id_=this.player_.id()+"_youtube_api",this.el_=videojs.Component.prototype.createEl("iframe",{id:this.id_,className:"vjs-tech",scrolling:"no",marginWidth:0,marginHeight:0,frameBorder:0}),this.el_.setAttribute("allowFullScreen",""),this.playerEl_.insertBefore(this.el_,this.playerEl_.firstChild),/MSIE (\d+\.\d+);/.test(navigator.userAgent)){var ieVersion=Number(RegExp.$1);this.addIframeBlocker(ieVersion)}else/(iPad|iPhone|iPod|android)/g.test(navigator.userAgent)||(this.el_.className+=" onDesktop",this.addIframeBlocker());this.parseSrc(player.options().src),this.playOnReady=this.player_.options().autoplay||!1,this.forceSSL=!("undefined"!=typeof this.player_.options().forceSSL&&this.player_.options().forceSSL!==!0),this.forceHTML5=!("undefined"!=typeof this.player_.options().forceHTML5&&this.player_.options().forceHTML5!==!0),this.updateIframeSrc();var self=this;player.ready(function(){var controlBar=self.playerEl_.querySelectorAll(".vjs-control-bar")[0];controlBar.appendChild(self.qualityButton),self.playOnReady&&!self.player_.options().ytcontrols&&("undefined"!=typeof self.player_.loadingSpinner&&self.player_.loadingSpinner.show(),"undefined"!=typeof self.player_.bigPlayButton&&self.player_.bigPlayButton.hide()),player.trigger("loadstart")}),this.on("dispose",function(){this.ytplayer&&this.ytplayer.destroy(),this.player_.options().ytcontrols||this.player_.off("waiting",this.bindedWaiting),this.playerEl_.querySelectorAll(".vjs-poster")[0].style.backgroundImage="none",this.el_.parentNode&&this.el_.parentNode.removeChild(this.el_),this.qualityButton.parentNode&&this.qualityButton.parentNode.removeChild(this.qualityButton),"undefined"!=typeof this.player_.loadingSpinner&&this.player_.loadingSpinner.hide(),"undefined"!=typeof this.player_.bigPlayButton&&this.player_.bigPlayButton.hide(),this.iframeblocker&&this.playerEl_.removeChild(this.iframeblocker)})}}),videojs.Youtube.prototype.updateIframeSrc=function(){var params={enablejsapi:1,iv_load_policy:3,playerapiid:this.id(),disablekb:1,wmode:"transparent",controls:this.player_.options().ytcontrols?1:0,html5:this.player_.options().forceHTML5?1:null,playsinline:this.player_.options().playsInline?1:0,showinfo:0,modestbranding:1,rel:0,autoplay:this.playOnReady?1:0,loop:this.player_.options().loop?1:0,list:this.playlistId,vq:this.userQuality,origin:window.location.protocol+"//"+window.location.host};"file:"===window.location.protocol&&delete params.origin;for(var prop in params)!params.hasOwnProperty(prop)||"undefined"!=typeof params[prop]&&null!==params[prop]||delete params[prop];var self=this;if(null===this.videoId)this.el_.src="about:blank",setTimeout(function(){self.triggerReady()},500);else if(this.el_.src=(this.forceSSL||"file:"===window.location.protocol?"https:":window.location.protocol)+"//www.youtube.com/embed/"+this.videoId+"?"+videojs.Youtube.makeQueryString(params),this.player_.options().ytcontrols?this.player_.controls(!1):"undefined"==typeof this.player_.poster()&&setTimeout(function(){var posterEl=self.playerEl_.querySelectorAll(".vjs-poster")[0];posterEl.style.backgroundImage="url(https://img.youtube.com/vi/"+self.videoId+"/0.jpg)",posterEl.style.display=""},100),this.bindedWaiting=function(){self.onWaiting()},this.player_.on("waiting",this.bindedWaiting),videojs.Youtube.apiReady)this.loadYoutube();else if(videojs.Youtube.loadingQueue.push(this),!videojs.Youtube.apiLoading){var tag=document.createElement("script");tag.onerror=function(e){self.onError(e)},tag.src=this.forceSSL||"file:"===window.location.protocol?"https://www.youtube.com/iframe_api":"//www.youtube.com/iframe_api";var firstScriptTag=document.getElementsByTagName("script")[0];firstScriptTag.parentNode.insertBefore(tag,firstScriptTag),videojs.Youtube.apiLoading=!0}},videojs.Youtube.prototype.onWaiting=function(){this.player_.bigPlayButton.hide()},videojs.Youtube.prototype.addIframeBlocker=function(ieVersion){this.iframeblocker=videojs.Component.prototype.createEl("div"),this.iframeblocker.className="iframeblocker",this.iframeblocker.style.position="absolute",this.iframeblocker.style.left=0,this.iframeblocker.style.right=0,this.iframeblocker.style.top=0,this.iframeblocker.style.bottom=0,this.iframeblocker.style.zIndex=9999,ieVersion&&9>ieVersion?this.iframeblocker.style.opacity=.01:this.iframeblocker.style.background="rgba(255, 255, 255, 0.01)";var self=this;addEventListener(this.iframeblocker,"mousemove",function(e){self.player_.userActive()||self.player_.userActive(!0),e.stopPropagation(),e.preventDefault()}),addEventListener(this.iframeblocker,"click",function(){self.paused()?self.play():self.pause()}),this.playerEl_.insertBefore(this.iframeblocker,this.el_.nextSibling)},videojs.Youtube.prototype.parseSrc=function(src){if(this.srcVal=src,src){var regId=/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/,match=src.match(regId);this.videoId=match&&11===match[2].length?match[2]:null;var regPlaylist=/[?&]list=([^#\&\?]+)/;match=src.match(regPlaylist),null!==match&&match.length>1?this.playlistId=match[1]:this.playlistId&&delete this.playlistId;var regVideoQuality=/[?&]vq=([^#\&\?]+)/;match=src.match(regVideoQuality),null!==match&&match.length>1&&(this.userQuality=match[1],setInnerText(this.qualityTitle,videojs.Youtube.parseQualityName(this.userQuality)))}},videojs.Youtube.prototype.src=function(src){if("undefined"!=typeof src){if(this.parseSrc(src),"about:blank"===this.el_.src)return void this.updateIframeSrc();delete this.defaultQuality,null!==this.videoId&&(this.player_.options().autoplay&&this.playVideoIsAllowed?this.ytplayer.loadVideoById({videoId:this.videoId,suggestedQuality:this.userQuality}):this.ytplayer.cueVideoById({videoId:this.videoId,suggestedQuality:this.userQuality}),this.playerEl_.querySelectorAll(".vjs-poster")[0].style.backgroundImage="url(https://img.youtube.com/vi/"+this.videoId+"/0.jpg)",this.player_.poster("https://img.youtube.com/vi/"+this.videoId+"/0.jpg"))}return this.srcVal},videojs.Youtube.prototype.load=function(){},videojs.Youtube.prototype.play=function(){null!==this.videoId&&(this.player_.options().ytcontrols||this.player_.trigger("waiting"),this.isReady_?(this.ytplayer.setVolume(100*this.player_.volume()),this.volumeVal>0?this.ytplayer.unMute():this.ytplayer.mute(),this.playVideoIsAllowed&&this.ytplayer.playVideo()):this.playOnReady=!0)},videojs.Youtube.prototype.pause=function(){this.ytplayer.pauseVideo()},videojs.Youtube.prototype.paused=function(){return this.ytplayer?this.lastState!==YT.PlayerState.PLAYING&&this.lastState!==YT.PlayerState.BUFFERING:!0},videojs.Youtube.prototype.currentTime=function(){return this.ytplayer&&this.ytplayer.getCurrentTime?this.ytplayer.getCurrentTime():0},videojs.Youtube.prototype.setCurrentTime=function(seconds){this.ytplayer.seekTo(seconds,!0),this.player_.trigger("timeupdate")},videojs.Youtube.prototype.duration=function(){return this.ytplayer&&this.ytplayer.getDuration?this.ytplayer.getDuration():0},videojs.Youtube.prototype.currentSrc=function(){return this.srcVal},videojs.Youtube.prototype.volume=function(){return this.ytplayer&&isNaN(this.volumeVal)&&(this.volumeVal=this.ytplayer.getVolume()/100,this.player_.volume(this.volumeVal)),this.volumeVal},videojs.Youtube.prototype.setVolume=function(percentAsDecimal){"undefined"!=typeof percentAsDecimal&&percentAsDecimal!==this.volumeVal&&(this.ytplayer.setVolume(100*percentAsDecimal),this.volumeVal=percentAsDecimal,this.player_.trigger("volumechange"))},videojs.Youtube.prototype.muted=function(){return this.mutedVal},videojs.Youtube.prototype.setMuted=function(muted){muted?(this.ytplayer.mute(),this.player_.volume(0)):(this.ytplayer.unMute(),this.player_.volume(this.volumeVal)),this.mutedVal=muted,this.player_.trigger("volumechange")},videojs.Youtube.prototype.buffered=function(){if(this.ytplayer&&this.ytplayer.getVideoBytesLoaded){var loadedBytes=this.ytplayer.getVideoBytesLoaded(),totalBytes=this.ytplayer.getVideoBytesTotal();if(!loadedBytes||!totalBytes)return 0;var duration=this.ytplayer.getDuration(),secondsBuffered=loadedBytes/totalBytes*duration,secondsOffset=this.ytplayer.getVideoStartBytes()/totalBytes*duration;return videojs.createTimeRange(secondsOffset,secondsOffset+secondsBuffered)}return videojs.createTimeRange(0,0)},videojs.Youtube.prototype.supportsFullScreen=function(){return!0},videojs.Youtube.isSupported=function(){return!0},videojs.Youtube.canPlaySource=function(srcObj){return"video/youtube"===srcObj.type},videojs.Youtube.canControlVolume=function(){return!0},videojs.Youtube.loadingQueue=[],videojs.Youtube.prototype.loadYoutube=function(){this.ytplayer=new YT.Player(this.id_,{events:{onReady:function(e){e.target.vjsTech.onReady()},onStateChange:function(e){e.target.vjsTech.onStateChange(e.data)},onPlaybackQualityChange:function(e){e.target.vjsTech.onPlaybackQualityChange(e.data)},onError:function(e){e.target.vjsTech.onError(e.data)}}}),this.ytplayer.vjsTech=this},videojs.Youtube.makeQueryString=function(args){var array=[];for(var key in args)args.hasOwnProperty(key)&&array.push(key+"="+args[key]);return array.join("&")},window.onYouTubeIframeAPIReady=function(){for(var yt;yt=videojs.Youtube.loadingQueue.shift();)yt.loadYoutube();videojs.Youtube.loadingQueue=[],videojs.Youtube.apiReady=!0},videojs.Youtube.prototype.onReady=function(){this.isReady_=!0,this.triggerReady(),this.player_.trigger("loadedmetadata"),this.player_.trigger("durationchange"),this.player_.trigger("timeupdate"),"undefined"!=typeof this.player_.loadingSpinner&&this.player_.loadingSpinner.hide(),this.player_.options().muted&&this.setMuted(!0),this.playOnReady&&(this.playOnReady=!1,this.play())},videojs.Youtube.prototype.updateQualities=function(){function setupEventListener(el){addEventListener(el,"click",function(){var quality=this.getAttribute("data-val");self.ytplayer.setPlaybackQuality(quality),self.userQuality=quality,setInnerText(self.qualityTitle,videojs.Youtube.parseQualityName(quality));var selected=self.qualityMenuContent.querySelector(".vjs-selected");selected&&videojs.Youtube.removeClass(selected,"vjs-selected"),videojs.Youtube.addClass(this,"vjs-selected")})}var qualities=this.ytplayer.getAvailableQualityLevels(),self=this;if(qualities.indexOf(this.userQuality)<0&&setInnerText(self.qualityTitle,videojs.Youtube.parseQualityName(this.defaultQuality)),0===qualities.length)this.qualityButton.style.display="none";else{for(this.qualityButton.style.display="";this.qualityMenuContent.hasChildNodes();)this.qualityMenuContent.removeChild(this.qualityMenuContent.lastChild);for(var i=0;i<qualities.length;++i){var el=document.createElement("li");el.setAttribute("class","vjs-menu-item"),setInnerText(el,videojs.Youtube.parseQualityName(qualities[i])),el.setAttribute("data-val",qualities[i]),qualities[i]===this.quality&&videojs.Youtube.addClass(el,"vjs-selected"),setupEventListener(el),this.qualityMenuContent.appendChild(el)}}},videojs.Youtube.prototype.onStateChange=function(state){if(state!==this.lastState){switch(state){case-1:this.player_.trigger("durationchange");break;case YT.PlayerState.ENDED:this.player_.options().ytcontrols||(this.playerEl_.querySelectorAll(".vjs-poster")[0].style.display="block","undefined"!=typeof this.player_.bigPlayButton&&this.player_.bigPlayButton.show()),this.player_.trigger("ended");break;case YT.PlayerState.PLAYING:this.playVideoIsAllowed=!0,this.updateQualities(),this.player_.trigger("timeupdate"),this.player_.trigger("durationchange"),this.player_.trigger("playing"),this.player_.trigger("play");break;case YT.PlayerState.PAUSED:this.player_.trigger("pause");break;case YT.PlayerState.BUFFERING:this.player_.trigger("timeupdate"),this.player_.options().ytcontrols||this.player_.trigger("waiting");break;case YT.PlayerState.CUED:}this.lastState=state}},videojs.Youtube.convertQualityName=function(name){switch(name){case"144p":return"tiny";case"240p":return"small";case"360p":return"medium";case"480p":return"large";case"720p":return"hd720";case"1080p":return"hd1080"}return"auto"},videojs.Youtube.parseQualityName=function(name){switch(name){case"tiny":return"144p";case"small":return"240p";case"medium":return"360p";case"large":return"480p";case"hd720":return"720p";case"hd1080":return"1080p"}return"auto"},videojs.Youtube.prototype.onPlaybackQualityChange=function(quality){if("undefined"!=typeof this.defaultQuality||(this.defaultQuality=quality,"undefined"==typeof this.userQuality)){switch(this.quality=quality,setInnerText(this.qualityTitle,videojs.Youtube.parseQualityName(quality)),quality){case"medium":this.player_.videoWidth=480,this.player_.videoHeight=360;break;case"large":this.player_.videoWidth=640,this.player_.videoHeight=480;break;case"hd720":this.player_.videoWidth=960,this.player_.videoHeight=720;break;case"hd1080":this.player_.videoWidth=1440,this.player_.videoHeight=1080;break;case"highres":this.player_.videoWidth=1920,this.player_.videoHeight=1080;break;case"small":this.player_.videoWidth=320,this.player_.videoHeight=240;break;case"tiny":this.player_.videoWidth=144,this.player_.videoHeight=108;break;default:this.player_.videoWidth=0,this.player_.videoHeight=0}this.player_.trigger("ratechange")}},videojs.Youtube.prototype.onError=function(error){this.player_.error(error),(100===error||101===error||150===error)&&(this.player_.bigPlayButton.hide(),this.player_.loadingSpinner.hide(),this.player_.posterImage.hide())},videojs.Youtube.addClass=function(element,classToAdd){-1===(" "+element.className+" ").indexOf(" "+classToAdd+" ")&&(element.className=""===element.className?classToAdd:element.className+" "+classToAdd)},videojs.Youtube.removeClass=function(element,classToRemove){var classNames,i;if(-1!==element.className.indexOf(classToRemove)){for(classNames=element.className.split(" "),i=classNames.length-1;i>=0;i--)classNames[i]===classToRemove&&classNames.splice(i,1);element.className=classNames.join(" ")}};var style=document.createElement("style"),def=" .vjs-youtube .vjs-poster { background-size: 100%!important; }.vjs-youtube .vjs-poster, .vjs-youtube .vjs-loading-spinner, .vjs-youtube .vjs-text-track-display{ pointer-events: none !important; }.vjs-youtube.vjs-user-active .iframeblocker { display: none; }.vjs-youtube.vjs-user-inactive .vjs-tech.onDesktop { pointer-events: none; }.vjs-quality-button > div:first-child > span:first-child { position:relative;top:7px }";style.setAttribute("type","text/css"),document.getElementsByTagName("head")[0].appendChild(style),style.styleSheet?style.styleSheet.cssText=def:style.appendChild(document.createTextNode(def)),Array.prototype.indexOf||(Array.prototype.indexOf=function(elt){var len=this.length>>>0,from=Number(arguments[1])||0;for(from=0>from?Math.ceil(from):Math.floor(from),0>from&&(from+=len);len>from;from++)if(from in this&&this[from]===elt)return from;return-1})}();
0 2 \ No newline at end of file
... ...
plugins/video/public/style.css 0 → 100644
... ... @@ -0,0 +1,25 @@
  1 +.video-gallery-thumbnail {
  2 + position: relative;
  3 + display: inline-block;
  4 + width: 95px;
  5 + height: 85px;
  6 + margin: 1em;
  7 + border: solid #F0F0F0 1px;
  8 + vertical-align: top;
  9 + text-align: center;
  10 + overflow: hidden;
  11 + padding-top: 7px;
  12 + margin-botton: 10px;
  13 +}
  14 +
  15 +.video-gallery-top-box{
  16 + height: 73px;
  17 +}
  18 +
  19 +.video-duration{
  20 + position: absolute;
  21 + bottom: 0px;
  22 + background-color: black;
  23 + font-size: 1em;
  24 + text-color: white;
  25 +}
... ...
plugins/video/views/cms/_video.html.erb 0 → 100644
... ... @@ -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_gallery.html.erb 0 → 100644
... ... @@ -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 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +<div align="center">
  2 +<%if @page.video_provider=='youtube' %>
  3 + <link type="text/css" rel="stylesheet" href="https://vjs.zencdn.net/4.5.1/video-js.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='{ "techOrder": ["youtube"], "src": "<%= @page.video_url %>" }'>
  7 + <%= @page.no_browser_support_message %>
  8 + </video>
  9 + <script src="https://vjs.zencdn.net/4.5.1/video.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="https://vjs.zencdn.net/4.5.1/video-js.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='{ "techOrder": ["vimeo"], "src": "<%= @page.video_url %>", "loop": true, "autoplay": false }'>
  16 + <%= @page.no_browser_support_message %>
  17 + </video>
  18 + <script src="https://vjs.zencdn.net/4.5.1/video.js"></script>
  19 + <script src="/plugins/video/javascripts/videojs/vjs.vimeo.js"></script>
  20 +<% elsif @page.video_provider=='file' %>
  21 + <link href="https://vjs.zencdn.net/4.8/video-js.css" rel="stylesheet">
  22 + <script src="https://vjs.zencdn.net/4.8/video.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='{"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 %>
0 35 \ No newline at end of file
... ...
plugins/video/views/content_viewer/_video_gallery.html.erb 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<%
  2 +def self.list_videos(configure={})
  3 + configure[:recursive] ||= false
  4 + configure[:list_type] ||= :folder
  5 + if !configure[:contents].blank?
  6 + configure[:contents] = configure[:contents].paginate(
  7 + :order => "updated_at DESC",
  8 + :per_page => 16,
  9 + :page => params[:npage]
  10 + )
  11 + render :file => 'shared/video_list', :locals => configure
  12 + else
  13 + content_tag('em', _('(empty folder)'))
  14 + end
  15 + end
  16 +%>
  17 +<% unless video_gallery.body.blank? %>
  18 + <div>
  19 + <%= video_gallery.body %>
  20 + </div>
  21 + <hr/>
  22 +<% end %>
  23 +
  24 +<% if video_gallery.children.empty? %>
  25 + <em><%= _('(empty video gallery)') %></em>
  26 +<% else %>
  27 + <%= list_videos(:contents=>video_gallery.children) %>
  28 +<% end %>
0 29 \ No newline at end of file
... ...
plugins/video/views/content_viewer/video_plugin/video_video.html.erb 0 → 100644
... ... @@ -0,0 +1,34 @@
  1 +<div align="center">
  2 +<%if @page.video_provider=='youtube' %>
  3 + <link type="text/css" rel="stylesheet" href="https://vjs.zencdn.net/4.5.1/video-js.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='{ "techOrder": ["youtube"], "src": "<%= @page.video_url %>" }'>
  7 + <%= @page.no_browser_support_message %>
  8 + </video>
  9 + <script src="https://vjs.zencdn.net/4.5.1/video.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="https://vjs.zencdn.net/4.5.1/video-js.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='{ "techOrder": ["vimeo"], "src": "<%= @page.video_url %>", "loop": true, "autoplay": false }'>
  16 + <%= @page.no_browser_support_message %>
  17 + </video>
  18 + <script src="https://vjs.zencdn.net/4.5.1/video.js"></script>
  19 + <script src="/plugins/video/javascripts/videojs/vjs.vimeo.js"></script>
  20 +<% elsif @page.video_provider=='file' %>
  21 + <link href="https://vjs.zencdn.net/4.8/video-js.css" rel="stylesheet">
  22 + <script src="https://vjs.zencdn.net/4.8/video.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='{"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 %>
0 35 \ No newline at end of file
... ...
plugins/video/views/content_viewer/video_plugin/video_video_gallery.html.erb 0 → 100644
... ... @@ -0,0 +1,28 @@
  1 +<%
  2 +def self.list_videos(configure={})
  3 + configure[:recursive] ||= false
  4 + configure[:list_type] ||= :folder
  5 + if !configure[:contents].blank?
  6 + configure[:contents] = configure[:contents].paginate(
  7 + :order => "updated_at DESC",
  8 + :per_page => 16,
  9 + :page => params[:npage]
  10 + )
  11 + render :file => 'shared/video_list', :locals => configure
  12 + else
  13 + content_tag('em', _('(empty folder)'))
  14 + end
  15 + end
  16 +%>
  17 +<% unless video_gallery.body.blank? %>
  18 + <div>
  19 + <%= video_gallery.body %>
  20 + </div>
  21 + <hr/>
  22 +<% end %>
  23 +
  24 +<% if video_gallery.children.empty? %>
  25 + <em><%= _('(empty video gallery)') %></em>
  26 +<% else %>
  27 + <%= list_videos(:contents=>video_gallery.children) %>
  28 +<% end %>
0 29 \ No newline at end of file
... ...
plugins/video/views/shared/video_list.html.erb 0 → 100644
... ... @@ -0,0 +1,18 @@
  1 +<div>
  2 + <% contents.each do |content| %>
  3 + <%#= py content %>
  4 + <% if content.display_to?(user) %>
  5 + <div class="video-gallery-thumbnail">
  6 + <div class="video-gallery-top-box">
  7 + <%= link_to content.view_url do %>
  8 + <img width="<%= content.thumbnail_fitted_width %>" height="<%= content.thumbnail_fitted_width %>" src='<%= content.video_thumbnail_url %>' class="disable-zoom"/>
  9 + <% end %>
  10 + </div>
  11 + <div class="video-gallery-botton-box">
  12 + <font size="1em"><%= content.title %></font>
  13 + </div>
  14 + </div>
  15 + <% end %>
  16 + <% end %>
  17 +<p><%= pagination_links contents, :param_name => 'npage', :page_links => true %></p>
  18 +</div>
... ...