diff --git a/Gemfile b/Gemfile
index 45ec242d..350e290d 100644
--- a/Gemfile
+++ b/Gemfile
@@ -16,6 +16,8 @@ gem 'jquery-ui-rails'
gem "select2-rails", '3.3.1'
gem 'kaminari'
gem 'time_difference'
+gem "acts_as_unvlogable"
+gem 'youtube_it'
# gem "memcached", "~> 1.4.3"
# gem "memcache-client"
diff --git a/vendor/built_in_modules/video/.gitignore b/vendor/built_in_modules/video/.gitignore
new file mode 100644
index 00000000..1463de6d
--- /dev/null
+++ b/vendor/built_in_modules/video/.gitignore
@@ -0,0 +1,6 @@
+.bundle/
+log/*.log
+pkg/
+test/dummy/db/*.sqlite3
+test/dummy/log/*.log
+test/dummy/tmp/
\ No newline at end of file
diff --git a/vendor/built_in_modules/video/Gemfile b/vendor/built_in_modules/video/Gemfile
new file mode 100644
index 00000000..a6e487f4
--- /dev/null
+++ b/vendor/built_in_modules/video/Gemfile
@@ -0,0 +1,17 @@
+source "http://rubygems.org"
+
+# Declare your gem's dependencies in location.gemspec.
+# Bundler will treat runtime dependencies like base dependencies, and
+# development dependencies will be added by default to the :development group.
+gemspec
+
+# jquery-rails is used by the dummy application
+gem "jquery-rails"
+
+# Declare any dependencies that are still in development here instead of in
+# your gemspec. These might include edge Rails or gems from your path or
+# Git. Remember to move these dependencies to your gemspec before releasing
+# your gem to rubygems.org.
+
+# To use debugger
+# gem 'ruby-debug19', :require => 'ruby-debug'
diff --git a/vendor/built_in_modules/video/MIT-LICENSE b/vendor/built_in_modules/video/MIT-LICENSE
new file mode 100644
index 00000000..406f17b7
--- /dev/null
+++ b/vendor/built_in_modules/video/MIT-LICENSE
@@ -0,0 +1,20 @@
+Copyright 2012 YOURNAME
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/vendor/built_in_modules/video/README.rdoc b/vendor/built_in_modules/video/README.rdoc
new file mode 100644
index 00000000..937b4141
--- /dev/null
+++ b/vendor/built_in_modules/video/README.rdoc
@@ -0,0 +1,3 @@
+= Location
+
+This project rocks and uses MIT-LICENSE.
diff --git a/vendor/built_in_modules/video/Rakefile b/vendor/built_in_modules/video/Rakefile
new file mode 100644
index 00000000..66353374
--- /dev/null
+++ b/vendor/built_in_modules/video/Rakefile
@@ -0,0 +1,39 @@
+#!/usr/bin/env rake
+begin
+ require 'bundler/setup'
+rescue LoadError
+ puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
+end
+begin
+ require 'rdoc/task'
+rescue LoadError
+ require 'rdoc/rdoc'
+ require 'rake/rdoctask'
+ RDoc::Task = Rake::RDocTask
+end
+
+RDoc::Task.new(:rdoc) do |rdoc|
+ rdoc.rdoc_dir = 'rdoc'
+ rdoc.title = 'Location'
+ rdoc.options << '--line-numbers'
+ rdoc.rdoc_files.include('README.rdoc')
+ rdoc.rdoc_files.include('lib/**/*.rb')
+end
+
+APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
+load 'rails/tasks/engine.rake'
+
+
+Bundler::GemHelper.install_tasks
+
+require 'rake/testtask'
+
+Rake::TestTask.new(:test) do |t|
+ t.libs << 'lib'
+ t.libs << 'test'
+ t.pattern = 'test/**/*_test.rb'
+ t.verbose = false
+end
+
+
+task :default => :test
diff --git a/vendor/built_in_modules/video/app/assets/images/gprs/.gitkeep b/vendor/built_in_modules/video/app/assets/images/gprs/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/assets/images/location/.gitkeep b/vendor/built_in_modules/video/app/assets/images/location/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/assets/javascripts/gprs/.gitkeep b/vendor/built_in_modules/video/app/assets/javascripts/gprs/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/assets/javascripts/panel/gprs/back_end/locations.js b/vendor/built_in_modules/video/app/assets/javascripts/panel/gprs/back_end/locations.js
new file mode 100644
index 00000000..dee720fa
--- /dev/null
+++ b/vendor/built_in_modules/video/app/assets/javascripts/panel/gprs/back_end/locations.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/vendor/built_in_modules/video/app/assets/javascripts/panel/location/back_end/locations.js b/vendor/built_in_modules/video/app/assets/javascripts/panel/location/back_end/locations.js
new file mode 100644
index 00000000..dee720fa
--- /dev/null
+++ b/vendor/built_in_modules/video/app/assets/javascripts/panel/location/back_end/locations.js
@@ -0,0 +1,2 @@
+// Place all the behaviors and hooks related to the matching controller here.
+// All this logic will automatically be available in application.js.
diff --git a/vendor/built_in_modules/video/app/assets/stylesheets/gprs/.gitkeep b/vendor/built_in_modules/video/app/assets/stylesheets/gprs/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/assets/stylesheets/location/.gitkeep b/vendor/built_in_modules/video/app/assets/stylesheets/location/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/assets/stylesheets/panel/gprs/back_end/locations.css b/vendor/built_in_modules/video/app/assets/stylesheets/panel/gprs/back_end/locations.css
new file mode 100644
index 00000000..afad32db
--- /dev/null
+++ b/vendor/built_in_modules/video/app/assets/stylesheets/panel/gprs/back_end/locations.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/vendor/built_in_modules/video/app/assets/stylesheets/panel/location/back_end/locations.css b/vendor/built_in_modules/video/app/assets/stylesheets/panel/location/back_end/locations.css
new file mode 100644
index 00000000..afad32db
--- /dev/null
+++ b/vendor/built_in_modules/video/app/assets/stylesheets/panel/location/back_end/locations.css
@@ -0,0 +1,4 @@
+/*
+ Place all the styles related to the matching controller here.
+ They will automatically be included in application.css.
+*/
diff --git a/vendor/built_in_modules/video/app/controllers/.gitkeep b/vendor/built_in_modules/video/app/controllers/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/controllers/panel/video/back_end/channel_videos_controller.rb b/vendor/built_in_modules/video/app/controllers/panel/video/back_end/channel_videos_controller.rb
new file mode 100644
index 00000000..e9ba49fe
--- /dev/null
+++ b/vendor/built_in_modules/video/app/controllers/panel/video/back_end/channel_videos_controller.rb
@@ -0,0 +1,58 @@
+class Panel::Video::BackEnd::ChannelVideosController < OrbitBackendController
+ before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
+ before_filter :force_order_for_user,:except => [:index]
+
+ def index
+ @channel_videos = ChannelVideo.all
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @videos }
+ end
+ end
+
+ def show
+ @channel_video = ChannelVideo.find(params[:id])
+ client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
+ @client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
+
+ respond_to do |format|
+ format.html
+ format.json { render json: @location }
+ end
+ end
+
+ def new
+ @channel_video = ChannelVideo.new
+ end
+
+ def edit
+ @channel_video = ChannelVideo.find(params[:id])
+ end
+
+ def create
+ @channel_video = ChannelVideo.new(params[:channel_video])
+
+ if @channel_video.save
+ redirect_to panel_video_back_end_channel_videos_url
+ else
+ render 'new'
+ end
+ end
+
+ def update
+ @channel_video = ChannelVideo.find(params[:id])
+
+ if @channel_video.update_attributes(params[:channel_video])
+ redirect_to panel_video_back_end_channel_videos_url
+ else
+ render 'edit'
+ end
+ end
+
+ def destroy
+ @channel_video = ChannelVideo.find(params[:id])
+ @channel_video.destroy
+ redirect_to panel_video_back_end_channel_videos_url
+
+ end
+end
\ No newline at end of file
diff --git a/vendor/built_in_modules/video/app/controllers/panel/video/back_end/videos_controller.rb b/vendor/built_in_modules/video/app/controllers/panel/video/back_end/videos_controller.rb
new file mode 100644
index 00000000..078b134a
--- /dev/null
+++ b/vendor/built_in_modules/video/app/controllers/panel/video/back_end/videos_controller.rb
@@ -0,0 +1,74 @@
+class Panel::Video::BackEnd::VideosController < OrbitBackendController
+
+ #before_filter :clean_values, :only => [:create, :update]
+
+ before_filter :force_order_for_visitor,:only => [:index, :new, :edit, :delete]
+ before_filter :force_order_for_user,:except => [:get_videos,:index]
+ # before_filter :for_app_sub_manager,:except => [:index, :new, :edit, :delete, :get_videos]
+
+ def index
+ @videos = Video.all
+ @client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @videos }
+ end
+ end
+
+ def new
+ @video = Video.new
+
+ respond_to do |format|
+ format.html # new.html.erb
+ format.json { render json: @video }
+ end
+ end
+
+ def edit
+ @video = Video.find(params[:id])
+ end
+
+ def show
+ @video = Video.find(params[:id])
+ respond_to do |format|
+ format.html
+ format.json { render json: @video }
+ end
+ end
+
+ def create
+ @video = Video.new(params[:video])
+ @video.save!
+ redirect_to panel_videos_back_end_videos_url
+ end
+
+ def update
+ @video = Video.find(params[:id])
+ @video.update_attributes(params[:video])
+ redirect_to panel_videos_back_end_videos_url
+ end
+
+ def destroy
+ @video = Video.find(params[:id])
+ @video.destroy
+ redirect_to panel_videos_back_end_videos_url
+
+ end
+
+ def get_videos
+ videos = Video.all
+ @data = Array.new
+
+ videos.each do |video|
+ @data << { title: video.title,
+ url: video.url,
+ description: video.description }
+ end
+
+ #print readable json
+ render :json => JSON.pretty_generate({video: @data})
+
+ #render :json => {video: @data}.to_json
+ end
+end
diff --git a/vendor/built_in_modules/video/app/controllers/panel/video/front_end/channel_videos_controller.rb b/vendor/built_in_modules/video/app/controllers/panel/video/front_end/channel_videos_controller.rb
new file mode 100644
index 00000000..c6cd7305
--- /dev/null
+++ b/vendor/built_in_modules/video/app/controllers/panel/video/front_end/channel_videos_controller.rb
@@ -0,0 +1,24 @@
+class Panel::Video::FrontEnd::ChannelVideosController < OrbitWidgetController
+ def initialize
+ super
+ @app_title = 'video'
+ end
+
+ def channel_videos
+ @item = Page.find(params[:page_id]) rescue nil
+ if @item
+ if @item.frontend_data_count
+ @page_num = @item.frontend_data_count
+ else
+ @page_num = 15
+ end
+ @frontend_style = @item.frontend_style
+ end
+ @item = Page.find(params[:page_id]) rescue nil
+ if !params[:category_id].blank? || !params[:tag_id].blank?
+ @channel_video = ChannelVideo.find(@part.widget_options['channel_videos']) rescue nil
+ client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
+ @client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
+ end
+ end
+end
\ No newline at end of file
diff --git a/vendor/built_in_modules/video/app/controllers/panel/video/widget/channel_videos_controller.rb b/vendor/built_in_modules/video/app/controllers/panel/video/widget/channel_videos_controller.rb
new file mode 100644
index 00000000..bccea587
--- /dev/null
+++ b/vendor/built_in_modules/video/app/controllers/panel/video/widget/channel_videos_controller.rb
@@ -0,0 +1,62 @@
+class Panel::Video::Widget::ChannelVideosController < OrbitWidgetController
+
+ def initialize
+ super
+ @app_title = 'video'
+ end
+
+ # GET /bulletins
+ # GET /bulletins.xml
+
+ def channel_videos
+ @part = PagePart.find(params[:part_id])
+
+ if @part.widget_data_count
+ @page_num = @part.widget_data_count
+ else
+ @page_num = 4
+ end
+
+ if @part.widget_field
+ @widget_fields = @part.widget_field
+ else
+ @widget_fields = []
+ end
+
+ @channel_video = ChannelVideo.find(@part.widget_options['channel_videos']) rescue nil
+ client = YouTubeIt::Client.new(:dev_key => "AI39si5KGPg8rhKLBfmeukit2tCSP_B9lT8igiNICbrbgUXQoAdYGvsyCGCmO1wGnr1OW4bDRv-ESolwk-rdBNIAgVTL9VYaEA")
+ @client_videos = client.videos_by(:user => @channel_video.channel_name, :per_page => 5)
+
+
+ end
+
+ # def bulletins_list_and_pic
+
+ # if params[:widget_data_count]
+ # @page_num = params[:widget_data_count];
+ # else
+ # @page_num = 4;
+ # end
+
+ # @title = params[:part_title]
+ # date_now = Time.now
+ # if !params[:category_id].blank?
+ # @bulletins = Bulletin.all.available_for_lang(I18n.locale).can_display.where(:bulletin_category_id => params[:category_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
+ # @current_category = BulletinCategory.from_id(params[:category_id]) rescue nil
+ # elsif !params[:tag_id].blank?
+ # @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page] ).per(@page_num)
+ # else
+ # @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc( :is_top, :postdate).page( params[:page]).per(@page_num )
+ # end
+
+ # get_categorys
+
+ # end
+
+ # def reload_bulletins
+ # @selected_tag = Tag.find(params[:tag_id])
+ # @bulletins = Bulletin.available_for_lang(I18n.locale).can_display.where(:tagged_ids => params[:tag_id]).where(:is_hidden => false).any_of( {deadline: nil,:postdate.lte => date_now} , {:deadline.gte => date_now,:postdate.lte => date_now} ).desc(:is_top, sort).page(params[:page]).per(5) rescue nil
+ # end
+
+
+end
diff --git a/vendor/built_in_modules/video/app/helpers/.gitkeep b/vendor/built_in_modules/video/app/helpers/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/helpers/panel/videos/back_end/videos_helper.rb b/vendor/built_in_modules/video/app/helpers/panel/videos/back_end/videos_helper.rb
new file mode 100644
index 00000000..8cc8935a
--- /dev/null
+++ b/vendor/built_in_modules/video/app/helpers/panel/videos/back_end/videos_helper.rb
@@ -0,0 +1,2 @@
+module Panel::Locations::BackEnd::VideosHelper
+end
diff --git a/vendor/built_in_modules/video/app/mailers/.gitkeep b/vendor/built_in_modules/video/app/mailers/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/models/.gitkeep b/vendor/built_in_modules/video/app/models/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/models/channel_video.rb b/vendor/built_in_modules/video/app/models/channel_video.rb
new file mode 100644
index 00000000..86493e9a
--- /dev/null
+++ b/vendor/built_in_modules/video/app/models/channel_video.rb
@@ -0,0 +1,10 @@
+class ChannelVideo
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ attr_accessible :channel_name
+
+ field :channel_name
+
+ validates_presence_of :channel_name
+end
\ No newline at end of file
diff --git a/vendor/built_in_modules/video/app/models/video.rb b/vendor/built_in_modules/video/app/models/video.rb
new file mode 100644
index 00000000..62b55e55
--- /dev/null
+++ b/vendor/built_in_modules/video/app/models/video.rb
@@ -0,0 +1,8 @@
+class Video
+ include Mongoid::Document
+ include Mongoid::Timestamps
+
+ field :title
+ field :description
+ field :url
+end
diff --git a/vendor/built_in_modules/video/app/uploaders/locations_uploader.rb b/vendor/built_in_modules/video/app/uploaders/locations_uploader.rb
new file mode 100644
index 00000000..55056a5b
--- /dev/null
+++ b/vendor/built_in_modules/video/app/uploaders/locations_uploader.rb
@@ -0,0 +1,61 @@
+class LocationsUploader < CarrierWave::Uploader::Base
+
+ # Include RMagick or ImageScience support:
+ # include CarrierWave::RMagick
+ # include CarrierWave::ImageScience
+ include CarrierWave::MiniMagick
+
+ # Choose what kind of storage to use for this uploader:
+ # storage :file
+ # storage :s3
+
+ # Override the directory where uploaded files will be stored.
+ # This is a sensible default for uploaders that are meant to be mounted:
+ def store_dir
+ "location/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}"
+ end
+
+ # Provide a default URL as a default if there hasn't been a file uploaded:
+ # def default_url
+ # "/images/fallback/" + [version_name, "default.png"].compact.join('_')
+ # end
+
+ # Process files as they are uploaded:
+ # process :scale => [200, 300]
+ #
+ # def scale(width, height)
+ # # do something
+ # end
+
+ # Create different versions of your uploaded files:
+ # version :thumb do
+ # process :scale => [50, 50]
+ # end
+
+ version :thumb do
+ process :resize_to_fill => [150, 120]
+ end
+
+ # Add a white list of extensions which are allowed to be uploaded.
+ # For images you might use something like this:
+ # def extension_white_list
+ # %w(jpg jpeg gif png)
+ # end
+
+ # Override the filename of the uploaded files:
+ # def filename
+ # "something.jpg" if original_filename
+ # end
+
+# def manipulate!
+# raise current_path.inspect
+# image = ::MiniMagick::Image.open(current_path)
+# image = yield(image)
+# image.write(current_path)
+# ::MiniMagick::Image.open(current_path)
+# rescue ::MiniMagick::Error, ::MiniMagick::Invalid => e
+# raise CarrierWave::ProcessingError.new("Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: #{e}")
+# end
+
+end
+
diff --git a/vendor/built_in_modules/video/app/views/.gitkeep b/vendor/built_in_modules/video/app/views/.gitkeep
new file mode 100644
index 00000000..e69de29b
diff --git a/vendor/built_in_modules/video/app/views/panel/video/back_end/channel_videos/_form.html.erb b/vendor/built_in_modules/video/app/views/panel/video/back_end/channel_videos/_form.html.erb
new file mode 100644
index 00000000..27c3be5d
--- /dev/null
+++ b/vendor/built_in_modules/video/app/views/panel/video/back_end/channel_videos/_form.html.erb
@@ -0,0 +1,14 @@
+
+
<%= t('channel_name') %> | +<%= t('videos.show') %> | + <%if is_manager? %> +<%= t('videos.edit') %> | +<%= t('videos.delete') %> | + <% end %> +
---|---|---|---|
<%= video.channel_name %> | +<%= link_to 'Show Channel Videos', panel_video_back_end_channel_video_path(video) %> | + <%if is_manager? %> +<%= link_to 'Edit', edit_panel_video_back_end_channel_video_path(video) %> | +<%= link_to 'Delete Channel', panel_video_back_end_channel_video_path(video), method: :delete , :confirm => t(:sure?) %> | + <% end %> +
+ | <%= t('videos.title') %> | +<%= t('videos.description') %> | + <%if is_manager? %> +<%= t('videos.edit') %> | +<%= t('videos.delete') %> | + <% end %> +
---|---|---|---|---|
<%= video_display.embed_html(400, 300).html_safe %> | +<%= video.title %> | + <% @client_videos = @client.videos_by(:user => 'ntuprs', :per_page => 5) %> + +<% @client_videos.videos.each do |v| %> <% @video = v.video_id.split(/tag:youtube.com,2008:video:+/).last %><% vd = UnvlogIt.new("https://www.youtube.com/watch?v=#{@video}")%><%= vd.embed_html(200, 150).html_safe %> <% end %> |
+ <%if is_manager? %>
+ <%= link_to 'Edit', edit_panel_videos_back_end_video_path(video) %> | +<%= link_to 'Destroy', panel_videos_back_end_video_path(video), method: :delete , :confirm => t(:sure?) %> | + <%end%> +
<%= @vd.title %> +
<%= @vd.title %> +
You may have mistyped the address or the page may have moved.
+Maybe you tried to change something you didn't have access to.
+We've been notified about this issue and we'll take a look at it shortly.
+