From 4b68f273ab72cf214e8492b820132204fa4b6cad Mon Sep 17 00:00:00 2001 From: Leandro Nunes dos Santos Date: Mon, 4 Jan 2016 10:24:36 -0300 Subject: [PATCH] removing community_hub --- plugins/community_hub/Gemfile | 3 --- plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb | 18 ------------------ plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb | 219 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/community_hub/facebook_stream/codfish_facebook_api.rb | 86 -------------------------------------------------------------------------------------- plugins/community_hub/facebook_stream/facebook_stream.rb | 56 -------------------------------------------------------- plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb | 48 ------------------------------------------------ plugins/community_hub/facebook_stream/lib_facebook_stream.rb | 117 --------------------------------------------------------------------------------------------------------------------- plugins/community_hub/lib/community_hub_plugin.rb | 30 ------------------------------ plugins/community_hub/lib/community_hub_plugin/hub.rb | 63 --------------------------------------------------------------- plugins/community_hub/lib/community_hub_plugin/hub_helper.rb | 23 ----------------------- plugins/community_hub/lib/community_hub_plugin/listener.rb | 48 ------------------------------------------------ plugins/community_hub/lib/community_hub_plugin/mediation.rb | 23 ----------------------- plugins/community_hub/lib/ext/comment.rb | 5 ----- plugins/community_hub/po/community_hub.pot | 176 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/community_hub/po/pt/community_hub.po | 177 --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- plugins/community_hub/public/icons/community-hub.png | Bin 442 -> 0 bytes plugins/community_hub/public/icons/hub-arrow-right.png | Bin 349 -> 0 bytes plugins/community_hub/public/icons/hub-not-pinned-icon.png | Bin 772 -> 0 bytes plugins/community_hub/public/icons/hub-not-promote-icon.png | Bin 674 -> 0 bytes plugins/community_hub/public/icons/hub-pinned-icon.png | Bin 772 -> 0 bytes plugins/community_hub/public/icons/hub-promote-icon.png | Bin 674 -> 0 bytes plugins/community_hub/public/icons/hub-remove-icon.png | Bin 567 -> 0 bytes plugins/community_hub/public/icons/hub-samarelo-a.png | Bin 424 -> 0 bytes plugins/community_hub/public/icons/hub-samarelo-b.png | Bin 426 -> 0 bytes plugins/community_hub/public/icons/hub-samarelo.gif | Bin 357 -> 0 bytes plugins/community_hub/public/icons/hub-sverde-a.png | Bin 438 -> 0 bytes plugins/community_hub/public/icons/hub-sverde-b.png | Bin 438 -> 0 bytes plugins/community_hub/public/icons/hub-svermelho-a.png | Bin 373 -> 0 bytes plugins/community_hub/public/icons/hub-svermelho-b.png | Bin 374 -> 0 bytes plugins/community_hub/public/icons/hub-time-bg.gif | Bin 807 -> 0 bytes plugins/community_hub/public/icons/logo_facebook_50x50.png | Bin 905 -> 0 bytes plugins/community_hub/public/icons/logo_twitter_50x50.png | Bin 1770 -> 0 bytes plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png | Bin 1106 -> 0 bytes plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png | Bin 1042 -> 0 bytes plugins/community_hub/public/javascripts/community_hub.js | 366 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ plugins/community_hub/public/style.css | 576 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ plugins/community_hub/script/hub_updater | 17 ----------------- plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb | 73 ------------------------------------------------------------------------- plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb | 108 ------------------------------------------------------------------------------------------------------------ plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb | 186 ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ plugins/community_hub/test/test_helper.rb | 38 -------------------------------------- plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb | 18 ------------------ plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb | 128 -------------------------------------------------------------------------------------------------------------------------------- plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb | 31 ------------------------------- plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb | 33 --------------------------------- plugins/community_hub/test/unit/community_hub_plugin_test.rb | 49 ------------------------------------------------- plugins/community_hub/twitter/stream.rb | 69 --------------------------------------------------------------------- plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb | 59 ----------------------------------------------------------- plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb | 3 --- plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb | 11 ----------- plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb | 87 --------------------------------------------------------------------------------------- plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb | 6 ------ plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb | 12 ------------ plugins/community_hub/views/community_hub_plugin_public/_post.html.erb | 34 ---------------------------------- plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb | 7 ------- plugins/community_hub/views/content_viewer/hub.html.erb | 97 ------------------------------------------------------------------------------------------------- plugins/gamification | 2 +- 57 files changed, 1 insertion(+), 3101 deletions(-) delete mode 100644 plugins/community_hub/Gemfile delete mode 100644 plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb delete mode 100644 plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb delete mode 100644 plugins/community_hub/facebook_stream/codfish_facebook_api.rb delete mode 100755 plugins/community_hub/facebook_stream/facebook_stream.rb delete mode 100644 plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb delete mode 100644 plugins/community_hub/facebook_stream/lib_facebook_stream.rb delete mode 100644 plugins/community_hub/lib/community_hub_plugin.rb delete mode 100644 plugins/community_hub/lib/community_hub_plugin/hub.rb delete mode 100644 plugins/community_hub/lib/community_hub_plugin/hub_helper.rb delete mode 100644 plugins/community_hub/lib/community_hub_plugin/listener.rb delete mode 100644 plugins/community_hub/lib/community_hub_plugin/mediation.rb delete mode 100644 plugins/community_hub/lib/ext/comment.rb delete mode 100644 plugins/community_hub/po/community_hub.pot delete mode 100644 plugins/community_hub/po/pt/community_hub.po delete mode 100644 plugins/community_hub/public/icons/community-hub.png delete mode 100644 plugins/community_hub/public/icons/hub-arrow-right.png delete mode 100644 plugins/community_hub/public/icons/hub-not-pinned-icon.png delete mode 100644 plugins/community_hub/public/icons/hub-not-promote-icon.png delete mode 100644 plugins/community_hub/public/icons/hub-pinned-icon.png delete mode 100644 plugins/community_hub/public/icons/hub-promote-icon.png delete mode 100644 plugins/community_hub/public/icons/hub-remove-icon.png delete mode 100644 plugins/community_hub/public/icons/hub-samarelo-a.png delete mode 100644 plugins/community_hub/public/icons/hub-samarelo-b.png delete mode 100644 plugins/community_hub/public/icons/hub-samarelo.gif delete mode 100644 plugins/community_hub/public/icons/hub-sverde-a.png delete mode 100644 plugins/community_hub/public/icons/hub-sverde-b.png delete mode 100644 plugins/community_hub/public/icons/hub-svermelho-a.png delete mode 100644 plugins/community_hub/public/icons/hub-svermelho-b.png delete mode 100644 plugins/community_hub/public/icons/hub-time-bg.gif delete mode 100644 plugins/community_hub/public/icons/logo_facebook_50x50.png delete mode 100644 plugins/community_hub/public/icons/logo_twitter_50x50.png delete mode 100644 plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png delete mode 100644 plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png delete mode 100644 plugins/community_hub/public/javascripts/community_hub.js delete mode 100644 plugins/community_hub/public/style.css delete mode 100755 plugins/community_hub/script/hub_updater delete mode 100644 plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb delete mode 100644 plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb delete mode 100644 plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb delete mode 100644 plugins/community_hub/test/test_helper.rb delete mode 100644 plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb delete mode 100644 plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb delete mode 100644 plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb delete mode 100644 plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb delete mode 100644 plugins/community_hub/test/unit/community_hub_plugin_test.rb delete mode 100644 plugins/community_hub/twitter/stream.rb delete mode 100644 plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_post.html.erb delete mode 100644 plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb delete mode 100644 plugins/community_hub/views/content_viewer/hub.html.erb diff --git a/plugins/community_hub/Gemfile b/plugins/community_hub/Gemfile deleted file mode 100644 index 9edd33a..0000000 --- a/plugins/community_hub/Gemfile +++ /dev/null @@ -1,3 +0,0 @@ -source 'https://rubygems.org' -gem 'twitter', '~> 5.8.0' -gem 'proxifier', '~> 1.0.3' diff --git a/plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb b/plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb deleted file mode 100644 index ad2d85a..0000000 --- a/plugins/community_hub/controllers/myprofile/community_dashboard_plugin_myprofile_controller.rb +++ /dev/null @@ -1,18 +0,0 @@ -class CommunityDashboardPluginMyprofileController < MyProfileController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - before_filter :allow_edit_dashboard, :only => :save_order - - def save_order - dashboard = profile.articles.find(params[:dashboard]) - redirect_to dashboard.url - end - - protected - - def allow_edit_dashboard - render_access_denied unless profile.articles.find(params[:dashboard]).allow_edit?(user) - end - -end diff --git a/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb b/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb deleted file mode 100644 index a57361a..0000000 --- a/plugins/community_hub/controllers/public/community_hub_plugin_public_controller.rb +++ /dev/null @@ -1,219 +0,0 @@ -class CommunityHubPluginPublicController < PublicController - - append_view_path File.join(File.dirname(__FILE__) + '/../../views') - - layout false - - - def new_message - if logged_in? - - begin - hub = Article.find(params[:article_id]) - rescue - hub = nil - end - - if hub - message_data = {} - message_data.merge!(params[:message]) if params[:message] - - message = Comment.new(message_data) - message.author = user - message.title = message_timestamp - message.article = hub - message.ip_address = request.remote_ip - message.user_agent = request.user_agent - message.referrer = request.referrer - - if message && message.save - render :text => {'ok' => true}.to_json, :content_type => 'application/json' - return true - end - end - - end - render :text => {'ok' => false}.to_json, :content_type => 'application/json' - end - - - def new_mediation - if logged_in? - - begin - profile = Profile.find(params[:profile_id]) - rescue - profile = nil - end - - if profile - mediation_data = {} - mediation_data.merge!(params[:article]) if params[:article] - - mediation = CommunityHubPlugin::Mediation.new(mediation_data) - mediation.name = CommunityHubPlugin::Mediation.timestamp - mediation.profile = profile - mediation.last_changed_by = user - mediation.created_by_id = user.id - mediation.source = 'local' - - if mediation && mediation.save - render :text => {'ok' => true}.to_json, :content_type => 'application/json' - return true - end - end - - end - render :text => {'ok' => false}.to_json, :content_type => 'application/json' - end - - - def newer_mediation_comment - latest_id = params[:latest_post] - mediation = params[:mediation] - comments = Comment.find(:all, :conditions => ["id > :id and source_id = :mediation", { :id => latest_id, :mediation => mediation }]) - render :partial => "mediation_comment", :collection => comments - end - - - def newer_comments - latest_post = params[:latest_post] - hub = Article.find(params[:hub]) - posts = Comment.find(:all, :order => "id desc", :conditions => ["id > :id and source_id = :hub", { :id => latest_post, :hub => hub }], :limit => 30) - - if !posts.empty? - oldest_post = posts.last.id - latest_post = posts.first.id - size = posts.size - else - oldest_post = 0 - latest_post = 0 - end - - render :partial => "post", :collection => posts, :locals => { :latest_id => latest_post, :oldest_id => oldest_post, :hub => hub } - end - - - def older_comments - oldest_id = params[:oldest_id] - hub = Article.find(params[:hub]) - posts = Comment.find(:all, :order => "id desc", :conditions => ["id < :id and source_id = :hub", { :id => oldest_id, :hub => hub }], :limit => 30) - - if !posts.empty? - oldest_id = posts.last.id - latest_id = posts.first.id - end - - render :partial => "post", :collection => posts, :locals => { :latest_id => latest_id, :oldest_id => oldest_id, :hub => hub } - end - - - def newer_articles - latest_post = params[:latest_post] - hub = Article.find(params[:hub]) - posts = CommunityHubPlugin::Mediation.find(:all, :order => "id desc", :conditions => ["id > :id and parent_id = :hub", { :id => latest_post, :hub => hub.id }]) - - if !posts.empty? - oldest_post = posts.last.id - latest_post = posts.first.id - else - oldest_post = 0 - latest_post = 0 - end - - render :partial => "mediation", :collection => posts, :locals => { :latest_post => latest_post, :oldest_post => oldest_post, :hub => hub } - end - - - def promote_user - if logged_in? - if (!params[:hub].blank? && !params[:user].blank?) - begin - hub = Article.find(params[:hub]) - rescue - hub = nil - end - if hub && hub.mediator?(user) - begin - user_to_promote = Profile.find(params[:user]) - rescue - user_to_promote = nil - end - if user_to_promote - hub.mediators += [user_to_promote.id] unless hub.mediators.include?(user_to_promote.id) - if hub.save - render :text => {'ok' => true}.to_json, :content_type => 'application/json' - return true - end - end - end - end - end - render :text => {'ok' => false}.to_json, :content_type => 'application/json' - end - - - def pin_message - if logged_in? - if (!params[:hub].blank? && !params[:message].blank?) - - begin - hub = Article.find(params[:hub]) - rescue - hub = nil - end - - if hub && hub.mediator?(user) - begin - message = Comment.find(params[:message]) - rescue - message = nil - end - - if message - author = message.author.blank? ? user : message.author - - mediation = CommunityHubPlugin::Mediation.new - mediation.name = CommunityHubPlugin::Mediation.timestamp - - mediation.profile = hub.profile - mediation.last_changed_by = author - mediation.created_by_id = author.id - mediation.body = message.body - mediation.parent_id = hub.id - mediation.source = 'local' - - if mediation && mediation.save - - if ( message.title == 'hub-message-twitter' ) - mediation.source = 'twitter' - mediation.author_name = message.name - mediation.profile_picture = message.profile_picture - mediation.save - end - - hub.pinned_messages += [message.id] unless hub.pinned_messages.include?(message.id) - hub.pinned_mediations += [mediation.id] unless hub.pinned_mediations.include?(mediation.id) - - if hub && hub.save - render :text => {'ok' => true}.to_json, :content_type => 'application/json' - return true - end - - end - - end - end - end - end - render :text => {'ok' => false}.to_json, :content_type => 'application/json' - end - - - protected - - def message_timestamp - "hub-message-#{(Time.now.to_f * 1000).to_i}" - end - -end diff --git a/plugins/community_hub/facebook_stream/codfish_facebook_api.rb b/plugins/community_hub/facebook_stream/codfish_facebook_api.rb deleted file mode 100644 index ab18a08..0000000 --- a/plugins/community_hub/facebook_stream/codfish_facebook_api.rb +++ /dev/null @@ -1,86 +0,0 @@ -require 'rubygems' -require 'open-uri' -require 'json' - -token = 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' -hashtag = "love" -pooling_time = 10 - - -#Aviso 12/04/2014 -#token que só deverá expirar em 59 dias -#@graph = Koala::Facebook::API.new('CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') -# https://graph.facebook.com/v1.0/search?q=%23nba&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH - -def not_blank(v) - if v == nil || v == "" - false - else - true - end -end - -#if hashtag[0]='#' -# hashtag = hashtag[1,hashtag.length-1] -#end - -extractedComments = [] -initialComments = [] -firstTime = true -read = 1 - -while true - file = open("https://graph.facebook.com/v1.0/search?q=%23#{hashtag}&type=post&access_token=#{token}") - itens = JSON.parse(file.read)['data'] - mostRecent = "" - itens.each{|i| - from = "" - message = "" - if not_blank(i['from']['name']) - from = i['from']['name'] - if not_blank(i['message']) - message += i['message'] - end - if not_blank(message) - if mostRecent == "" or mostRecent < i["created_time"] - mostRecent = i["created_time"] - end - - extractedComments.push("#{from} said: #{message}") - # puts "#{from} said: #{message}" - end - end - } - - extractedComments = extractedComments.uniq - if firstTime - initialComments = extractedComments.clone - firstTime = false - end - -# extractedComments.each{|comment| -# puts comment -# } - -# extractedComments.each{|comment| -# puts comment -# } - - - newComments = extractedComments - initialComments - newComments = newComments.uniq - initialComments += newComments - initialComments = initialComments.uniq - newComments.each{|comment| - puts comment - } - puts "****************************************************************************************************************" - puts "most recent post at #{mostRecent}" - puts "Read: #{read} newComments: #{newComments.length} initialComments: #{initialComments.length} extractedComments: #{extractedComments.length} *******" - - read+=1 - sleep(pooling_time) -end - - - diff --git a/plugins/community_hub/facebook_stream/facebook_stream.rb b/plugins/community_hub/facebook_stream/facebook_stream.rb deleted file mode 100755 index b56297c..0000000 --- a/plugins/community_hub/facebook_stream/facebook_stream.rb +++ /dev/null @@ -1,56 +0,0 @@ -require 'rubygems' -require 'koala' -require 'json' - -#Aviso 12/04/2014 -#token que só deverá expirar em 59 dias -@graph = Koala::Facebook::API.new('CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') -# https://graph.facebook.com/v1.0/search?q=%23dilma&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH - -#feed = @graph.get_connections("participabr", "posts") - -comentariosIniciais = [] -comentariosExtraidos = [] -comentariosNovos = [] - -primeiraVez = true - -while true - - feed = @graph.get_connections("mundoreagindo", "posts") - - array = [] - comentariosExtraidos = [] - feed.each {|f| - if f['comments'] != nil && f['comments']['data'] != nil - array.push(f['comments']['data']) - end - } - - array.each{ |comentarios| - comentarios.each{|comentario| - comentariosExtraidos.push("#{comentario['from']['name']} disse: #{comentario['message']}") - } - } - - comentariosExtraidos = comentariosExtraidos.uniq - - if primeiraVez - comentariosIniciais=comentariosExtraidos.clone - primeiraVez = false - end - -# comentariosExtraidos.each{|comentario| -# puts comentario -# } - - comentariosNovos = comentariosExtraidos - comentariosIniciais - comentariosNovos = comentariosNovos.uniq - comentariosIniciais += comentariosNovos - comentariosIniciais = comentariosIniciais.uniq - comentariosNovos.each{|comentario| - puts comentario - } - - sleep(5) -end diff --git a/plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb b/plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb deleted file mode 100644 index 5a42f1c..0000000 --- a/plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb +++ /dev/null @@ -1,48 +0,0 @@ -require 'rubygems' -require 'koala' -require 'json' - -#Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! Warning!!! -#token will expire at 12/04/2014 (Brazilian date format) + 59 days -#'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' -# BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' - -def deprecated_facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) - pooling_time ||= 5 - Koala.http_service.http_options = { :proxy => proxy_url } unless proxy_url.blank? - - @graph = Koala::Facebook::API.new(token) - initialComments = [] - firstTime = true - while true - feed = @graph.get_connections(page_id, "posts") - array = [] - extractedComments = [] - feed.each {|f| - if f['comments'] != nil && f['comments']['data'] != nil - array.push(f['comments']['data']) - end - } - extractedComments = array.flatten.uniq - if firstTime - initialComments = extractedComments.clone - firstTime = false - end - newComments = extractedComments - initialComments - newComments = newComments.uniq - initialComments += newComments - initialComments = initialComments.uniq - newComments.each{|comment| - puts "#{comment['from']['name']} " + _("said") + ": #{comment['message']}" - noosferoComment = Comment.new - noosferoComment.title = 'hub-message-facebook' - noosferoComment.source = hub - noosferoComment.body = comment['message'] - noosferoComment.author_id = author_id - noosferoComment.name = comment['from']['name'] - noosferoComment.email = 'admin@localhost.local' - noosferoComment.save! - } - sleep(pooling_time) - end -end diff --git a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb deleted file mode 100644 index e00da13..0000000 --- a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb +++ /dev/null @@ -1,117 +0,0 @@ -require 'rubygems' -require 'open-uri' -require 'json' - -def not_blank?(v) - if v == nil || v == "" - false - else - true - end -end - -def save_comment(hub, comment, author_id) - noosferoComment = Comment.new - noosferoComment.title = 'hub-message-facebook' - noosferoComment.source = hub - noosferoComment.body = comment[:message] - noosferoComment.author_id = author_id - noosferoComment.name = comment[:from] - noosferoComment.email = 'admin@localhost.local' - noosferoComment.save! -end - - -def facebook_comments(hub, author_id, hashtag, pooling_time, token) - - pooling_time ||= 10 - token ||= 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' - hashtag ||= "#nba" - #Aviso 12/04/2014 - #token que só deverá expirar em 59 dias - #https://graph.facebook.com/v1.0/search?q=%23nba&type=post&access_token=CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH - # - - #removes extra '#' - if hashtag[0,1]=='#' - hashtag = hashtag[1,hashtag.length-1] - end - - initialComments = [] - firstTime = true - read = 1 - url = "https://graph.facebook.com/v1.0/search?q=%23#{hashtag}&type=post&access_token=#{token}" - mostRecent = "" - - while true - connected = false - tries = 0 - while !connected - begin - tries += 1 - file = open(url) - connected = true - tries = 0 - rescue => e - puts "Error connecting to facebook: #{e.inspect} " - puts file - sleep (10 + 2 ** tries) - end - end - - extractedComments = [] - itens = JSON.parse(file.read)['data'] - itens.each{|i| - from = "" - message = "" - if not_blank?(i['from']['name']) - from = i['from']['name'] - if not_blank?(i['message']) - message += i['message'] - else - if not_blank?(i['description']) - message += i['description'] - else - if not_blank?(i['caption']) - message += i['caption'] - end - end - end - if not_blank?(message) - if mostRecent == "" or mostRecent < i["created_time"] - mostRecent = i["created_time"] - end - extractedComments.push({:from=>from, :message=>message}) - end - end - } - - extractedComments = extractedComments.uniq - if firstTime - initialComments = extractedComments.clone - firstTime = false - extractedComments.each{|comment| - puts "#{comment[:from]} " + _("said") + ": #{comment[:message]}" - save_comment(hub, comment, author_id) - } - end - -# if read == 2 -# extractedComments.push({:from=>"Evandro", :message=>"teste"}) -# end - - newComments = extractedComments - initialComments - newComments = newComments.uniq - initialComments += newComments - initialComments = initialComments.uniq - #y newComments - newComments.each{|comment| - puts "#{comment[:from]} " + _("said") + ": #{comment[:message]}" - save_comment(hub, comment, author_id) - } -# puts url -# puts "Read: #{read} last post #{mostRecent} newComments: #{newComments.length} initialComments: #{initialComments.length} extractedComments: #{extractedComments.length}" - read+=1 - sleep(pooling_time) - end -end \ No newline at end of file diff --git a/plugins/community_hub/lib/community_hub_plugin.rb b/plugins/community_hub/lib/community_hub_plugin.rb deleted file mode 100644 index 5730a99..0000000 --- a/plugins/community_hub/lib/community_hub_plugin.rb +++ /dev/null @@ -1,30 +0,0 @@ -class CommunityHubPlugin < Noosfero::Plugin - - def self.plugin_name - 'Community Hub' - end - - def self.plugin_description - _("New kind of content for communities.") - end - - def stylesheet? - true - end - - def content_types - return [] if !context.kind_of?(CmsController) - if context.respond_to?(:params) && context.params - types = [] - types << CommunityHubPlugin::Hub if context.profile.community? - types - else - [CommunityHubPlugin::Hub] - end - end - - def content_remove_new(page) - page.kind_of?(CommunityHubPlugin::Hub) - end - -end diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb deleted file mode 100644 index 27264fc..0000000 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ /dev/null @@ -1,63 +0,0 @@ -require File.dirname(__FILE__) + '/../../twitter/stream.rb' -require File.dirname(__FILE__) + '/../../facebook_stream/lib_facebook_stream' - -class CommunityHubPlugin::Hub < Folder - - attr_accessible :last_changed_by_id, :integer - - attr_accessible :twitter_enabled, :type => :booelan, :default => false - attr_accessible :twitter_hashtags, :type => :string, :default => "" - attr_accessible :twitter_consumer_key, :type => :string, :default => "" - attr_accessible :twitter_consumer_secret, :type => :string, :default => "" - attr_accessible :twitter_access_token, :type => :string, :default => "" - attr_accessible :twitter_access_token_secret, :type => :string, :default => "" - attr_accessible :facebook_enabled, :type => :string, :default => "" - attr_accessible :facebook_hashtag, :type => :string, :default => "" - attr_accessible :facebook_access_token, :type => :string, :default => "" - - settings_items :twitter_enabled, :type => :boolean, :default => false - settings_items :twitter_hashtags, :type => :string, :default => "" - settings_items :twitter_consumer_key, :type => :string, :default => "" - settings_items :twitter_consumer_secret, :type => :string, :default => "" - settings_items :twitter_access_token, :type => :string, :default => "" - settings_items :twitter_access_token_secret, :type => :string, :default => "" - settings_items :facebook_enabled, :type => :boolean, :default => false - settings_items :facebook_hashtag, :type => :string, :default => "" - settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds - settings_items :facebook_access_token, :type => :string, :default => '' - settings_items :pinned_messages, :type => Array, :default => [] - settings_items :pinned_mediations, :type => Array, :default => [] - settings_items :mediators, :type => Array, :default => [] - - before_create do |hub| - hub.mediators = [hub.author.id] - end - - def notify_comments - false - end - - def self.icon_name(article = nil) - 'community-hub' - end - - def self.short_description - _("Hub") - end - - def self.description - _('Defines a hub.') - end - - def accept_comments? - true - end - - def view_page - "content_viewer/hub" - end - - def mediator?(user) - self.allow_edit?(user) || self.mediators.include?(user.id) - end -end diff --git a/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb b/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb deleted file mode 100644 index 8681abb..0000000 --- a/plugins/community_hub/lib/community_hub_plugin/hub_helper.rb +++ /dev/null @@ -1,23 +0,0 @@ -module CommunityHubPlugin::HubHelper - - def mediator?(hub) - logged_in? && (user && hub.allow_edit?(user) || hub.mediators.include?(user.id)) - end - - def promoted?(hub, person) - logged_in? && (hub.allow_edit?(person) || hub.mediators.include?(person.id)) - end - - def pinned_message?(hub, message_id) - hub.pinned_messages.include?(message_id) ? true : false - end - - def pinned_mediation?(hub, mediation_id) - hub.pinned_mediations.include?(mediation_id) ? true : false - end - - def post_time(time) - _('%{hour}:%{minutes}') % { :hour => time.hour, :minutes => time.strftime("%M") } rescue '' - end - -end diff --git a/plugins/community_hub/lib/community_hub_plugin/listener.rb b/plugins/community_hub/lib/community_hub_plugin/listener.rb deleted file mode 100644 index c74f2f9..0000000 --- a/plugins/community_hub/lib/community_hub_plugin/listener.rb +++ /dev/null @@ -1,48 +0,0 @@ -class CommunityHubPlugin::Listener - - class << self - - def twitter_service(hub) - listen_twitter_stream(hub, nil) - end - - def facebook_service(hub) - facebook_comments(hub, nil, hub.facebook_hashtag, hub.facebook_pooling_time, hub.facebook_access_token) - end - - def run - hubs = {} - loop do - log "searching for hubs" - CommunityHubPlugin::Hub.all.each do |hub| - hub_conf = hubs[hub.id] - if hub_conf.nil? || hub_conf[:hub].updated_at < hub.updated_at - hub_conf[:threads].each {|t| t.terminate} if hub_conf - log "hub #{hub.id} found!!!!!!" - threads = [] - threads << Thread.new { twitter_service(hub) } if hub.twitter_enabled - threads << Thread.new { facebook_service(hub) } if hub.facebook_enabled - hubs[hub.id] = {:threads => threads, :hub => hub} - end - end - sleep(10) - end - end - - def initialize_logger - logdir = File.join(Rails.root, 'log', CommunityHubPlugin::Listener.name.underscore) - FileUtils.makedirs(logdir) if !File.exist?(logdir) - logpath = File.join(logdir, "#{ENV['RAILS_ENV']}_#{Time.now.strftime('%F')}.log") - @logger = Logger.new(logpath) - end - - def log(message) - #puts message - initialize_logger unless @initiated - @initiated ||= true - @logger << "[#{Time.now.strftime('%F %T %z')}] #{message}\n" - end - - end - -end diff --git a/plugins/community_hub/lib/community_hub_plugin/mediation.rb b/plugins/community_hub/lib/community_hub_plugin/mediation.rb deleted file mode 100644 index d26103b..0000000 --- a/plugins/community_hub/lib/community_hub_plugin/mediation.rb +++ /dev/null @@ -1,23 +0,0 @@ -class CommunityHubPlugin::Mediation < Article - - before_save do |mediation| - mediation.advertise = false - mediation.notify_comments = false - nil - end - - settings_items :profile_picture, :type => :string, :default => "" - - def self.timestamp - "hub-mediation-#{(Time.now.to_f * 1000).to_i}" - end - - def self.description - _('Hub mediation') - end - - def self.short_description - _('Hub mediation') - end - -end diff --git a/plugins/community_hub/lib/ext/comment.rb b/plugins/community_hub/lib/ext/comment.rb deleted file mode 100644 index a172ad9..0000000 --- a/plugins/community_hub/lib/ext/comment.rb +++ /dev/null @@ -1,5 +0,0 @@ -require_dependency 'comment' - -class Comment - settings_items :profile_picture, :type => :string, :default => "" -end diff --git a/plugins/community_hub/po/community_hub.pot b/plugins/community_hub/po/community_hub.pot deleted file mode 100644 index 8b26831..0000000 --- a/plugins/community_hub/po/community_hub.pot +++ /dev/null @@ -1,176 +0,0 @@ -# SOME DESCRIPTIVE TITLE. -# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER -# This file is distributed under the same license as the PACKAGE package. -# FIRST AUTHOR , YEAR. -# -#, fuzzy -msgid "" -msgstr "" -"Project-Id-Version: 1.1~rc2-1809-gd4babc7\n" -"POT-Creation-Date: 2015-04-13 19:39-0300\n" -"PO-Revision-Date: 2015-04-13 19:39-0300\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb:36 plugins/community_hub/facebook_stream/lib_facebook_stream.rb:94 -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:109 -msgid "said" -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:45 -msgid "Hub" -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:49 -msgid "Defines a hub." -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin/hub_helper.rb:20 -msgid "%{hour}:%{minutes}" -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:16 plugins/community_hub/lib/community_hub_plugin/mediation.rb:20 -msgid "Hub mediation" -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin.rb:8 -msgid "New kind of content for communities." -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:3 -msgid "HUB Settings:" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:8 -msgid "Title" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:12 -msgid "Description" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:16 -msgid "Image:" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:22 -msgid "Twitter Settings:" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:26 -msgid "Turn on TWITTER" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:28 -msgid "Twitter's Hashtags, comma separated (example: participa.br,participabr)" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:31 -msgid "Twitter's consumer key" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:35 -msgid "Twitter's consumer secret" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:39 -msgid "Twitter's access token" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:43 -msgid "Twitter's access token secret" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:47 -msgid "Facebook Settings:" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:51 -msgid "Turn on FACEBOOK" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:53 -msgid "Facebook's hashtag (example: #participabr)" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:55 -msgid "Facebook's access token" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:57 -msgid "How to get a new access token?" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:14 plugins/community_hub/views/content_viewer/hub.html.erb:54 -msgid "Live" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:18 plugins/community_hub/views/content_viewer/hub.html.erb:58 -msgid "Mediation" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:25 -msgid "Auto scrolling" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:38 -msgid "Message" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:40 -msgid "Type your message here" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:41 plugins/community_hub/views/content_viewer/hub.html.erb:79 -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:11 -msgid "Send" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:93 -msgid "Are you sure that you want to pin this message?" -msgstr "" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:94 -msgid "Are you sure that you want to promote this user?" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb:4 -msgid "General settings" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb:4 -msgid "Embed" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:23 -msgid "Pin message" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:26 -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:40 -msgid "Message pinned" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:29 -msgid "User not promoted" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:32 -msgid "User promoted" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:54 -msgid "Comments" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:10 -msgid "Type your comment here" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb:2 -msgid "BANNER SPACE" -msgstr "" diff --git a/plugins/community_hub/po/pt/community_hub.po b/plugins/community_hub/po/pt/community_hub.po deleted file mode 100644 index 832ee68..0000000 --- a/plugins/community_hub/po/pt/community_hub.po +++ /dev/null @@ -1,177 +0,0 @@ -msgid "" -msgstr "" -"Project-Id-Version: 0.45.0-6097-g490300c\n" -"POT-Creation-Date: 2015-07-23 16:26-0300\n" -"PO-Revision-Date: 2015-04-13 19:39-0300\n" -"Last-Translator: FULL NAME \n" -"Language-Team: LANGUAGE \n" -"Language: \n" -"MIME-Version: 1.0\n" -"Content-Type: text/plain; charset=UTF-8\n" -"Content-Transfer-Encoding: 8bit\n" -"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" - -#: plugins/community_hub/facebook_stream/lib_facebook_koala_stream.rb:36 -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:94 -#: plugins/community_hub/facebook_stream/lib_facebook_stream.rb:109 -msgid "said" -msgstr "disse" - -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:45 -msgid "Hub" -msgstr "Hub" - -#: plugins/community_hub/lib/community_hub_plugin/hub.rb:49 -msgid "Defines a hub." -msgstr "Define um hub." - -#: plugins/community_hub/lib/community_hub_plugin/hub_helper.rb:20 -msgid "%{hour}:%{minutes}" -msgstr "" - -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:16 -#: plugins/community_hub/lib/community_hub_plugin/mediation.rb:20 -msgid "Hub mediation" -msgstr "Mediação do hub" - -#: plugins/community_hub/lib/community_hub_plugin.rb:8 -msgid "New kind of content for communities." -msgstr "Novo tipo de conteúdo para diálogo em comunidades." - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:3 -msgid "HUB Settings:" -msgstr "Configuração do Hub:" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:8 -msgid "Title" -msgstr "Título" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:12 -msgid "Description" -msgstr "Descrição" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:16 -msgid "Image:" -msgstr "Imagem:" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:22 -msgid "Twitter Settings:" -msgstr "Configurações do Twitter:" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:26 -msgid "Turn on TWITTER" -msgstr "Ativar Twitter" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:28 -msgid "Twitter's Hashtags, comma separated (example: participa.br,participabr)" -msgstr "" -"Hashtag do Twitter, separadas por vírgula (exemplo: participa.br,participabr)" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:31 -msgid "Twitter's consumer key" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:35 -msgid "Twitter's consumer secret" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:39 -msgid "Twitter's access token" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:43 -msgid "Twitter's access token secret" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:47 -msgid "Facebook Settings:" -msgstr "Configurações do Facebook:" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:51 -msgid "Turn on FACEBOOK" -msgstr "Ativar Facebook" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:53 -msgid "Facebook's hashtag (example: #participabr)" -msgstr "Hashtag do Facebook (exemplo: #participabr)" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:55 -msgid "Facebook's access token" -msgstr "" - -#: plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb:57 -msgid "How to get a new access token?" -msgstr "Como obter um novo token de acesso?" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:14 -#: plugins/community_hub/views/content_viewer/hub.html.erb:54 -msgid "Live" -msgstr "Ao Vivo" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:18 -#: plugins/community_hub/views/content_viewer/hub.html.erb:58 -msgid "Mediation" -msgstr "Mediação" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:25 -msgid "Auto scrolling" -msgstr "Rolagem automática" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:38 -msgid "Message" -msgstr "Mensagem" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:40 -msgid "Type your message here" -msgstr "Digite sua mensagem aqui" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:41 -#: plugins/community_hub/views/content_viewer/hub.html.erb:79 -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:11 -msgid "Send" -msgstr "Enviar" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:93 -msgid "Are you sure that you want to pin this message?" -msgstr "Tem certeza que deseja fixar esta mensagem?" - -#: plugins/community_hub/views/content_viewer/hub.html.erb:94 -msgid "Are you sure that you want to promote this user?" -msgstr "Tem certeza que deseja promover este usuário?" - -#: plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb:4 -msgid "General settings" -msgstr "Configurações gerais" - -#: plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb:4 -msgid "Embed" -msgstr "" - -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:23 -msgid "Pin message" -msgstr "Fixar mensagem" - -#: plugins/community_hub/views/community_hub_plugin_public/_post.html.erb:26 -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:40 -msgid "Message pinned" -msgstr "Mensagem fixada" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:29 -msgid "User not promoted" -msgstr "Usuário não promovido" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:32 -msgid "User promoted" -msgstr "Usuário promovido" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb:54 -msgid "Comments" -msgstr "Comentários" - -#: plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb:10 -msgid "Type your comment here" -msgstr "Digite seu comentário aqui" - -#: plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb:2 -msgid "BANNER SPACE" -msgstr "" diff --git a/plugins/community_hub/public/icons/community-hub.png b/plugins/community_hub/public/icons/community-hub.png deleted file mode 100644 index 6aadcd0..0000000 Binary files a/plugins/community_hub/public/icons/community-hub.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-arrow-right.png b/plugins/community_hub/public/icons/hub-arrow-right.png deleted file mode 100644 index 6c65f4c..0000000 Binary files a/plugins/community_hub/public/icons/hub-arrow-right.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-not-pinned-icon.png b/plugins/community_hub/public/icons/hub-not-pinned-icon.png deleted file mode 100644 index 9b510c8..0000000 Binary files a/plugins/community_hub/public/icons/hub-not-pinned-icon.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-not-promote-icon.png b/plugins/community_hub/public/icons/hub-not-promote-icon.png deleted file mode 100644 index 4f57c4e..0000000 Binary files a/plugins/community_hub/public/icons/hub-not-promote-icon.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-pinned-icon.png b/plugins/community_hub/public/icons/hub-pinned-icon.png deleted file mode 100644 index 9b510c8..0000000 Binary files a/plugins/community_hub/public/icons/hub-pinned-icon.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-promote-icon.png b/plugins/community_hub/public/icons/hub-promote-icon.png deleted file mode 100644 index 4f57c4e..0000000 Binary files a/plugins/community_hub/public/icons/hub-promote-icon.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-remove-icon.png b/plugins/community_hub/public/icons/hub-remove-icon.png deleted file mode 100644 index 1246778..0000000 Binary files a/plugins/community_hub/public/icons/hub-remove-icon.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-samarelo-a.png b/plugins/community_hub/public/icons/hub-samarelo-a.png deleted file mode 100644 index 453d2a4..0000000 Binary files a/plugins/community_hub/public/icons/hub-samarelo-a.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-samarelo-b.png b/plugins/community_hub/public/icons/hub-samarelo-b.png deleted file mode 100644 index 936bf46..0000000 Binary files a/plugins/community_hub/public/icons/hub-samarelo-b.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-samarelo.gif b/plugins/community_hub/public/icons/hub-samarelo.gif deleted file mode 100644 index 2da3de2..0000000 Binary files a/plugins/community_hub/public/icons/hub-samarelo.gif and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-sverde-a.png b/plugins/community_hub/public/icons/hub-sverde-a.png deleted file mode 100644 index 5bc1c40..0000000 Binary files a/plugins/community_hub/public/icons/hub-sverde-a.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-sverde-b.png b/plugins/community_hub/public/icons/hub-sverde-b.png deleted file mode 100644 index ee21942..0000000 Binary files a/plugins/community_hub/public/icons/hub-sverde-b.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-svermelho-a.png b/plugins/community_hub/public/icons/hub-svermelho-a.png deleted file mode 100644 index 36d4dfc..0000000 Binary files a/plugins/community_hub/public/icons/hub-svermelho-a.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-svermelho-b.png b/plugins/community_hub/public/icons/hub-svermelho-b.png deleted file mode 100644 index 6df643a..0000000 Binary files a/plugins/community_hub/public/icons/hub-svermelho-b.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/hub-time-bg.gif b/plugins/community_hub/public/icons/hub-time-bg.gif deleted file mode 100644 index 43032c7..0000000 Binary files a/plugins/community_hub/public/icons/hub-time-bg.gif and /dev/null differ diff --git a/plugins/community_hub/public/icons/logo_facebook_50x50.png b/plugins/community_hub/public/icons/logo_facebook_50x50.png deleted file mode 100644 index 7e5fdb3..0000000 Binary files a/plugins/community_hub/public/icons/logo_facebook_50x50.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/logo_twitter_50x50.png b/plugins/community_hub/public/icons/logo_twitter_50x50.png deleted file mode 100644 index 4ffd721..0000000 Binary files a/plugins/community_hub/public/icons/logo_twitter_50x50.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png b/plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png deleted file mode 100644 index a43574b..0000000 Binary files a/plugins/community_hub/public/icons/logo_twitter_bird_blue_50x50.png and /dev/null differ diff --git a/plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png b/plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png deleted file mode 100644 index 90fdebd..0000000 Binary files a/plugins/community_hub/public/icons/logo_twitter_bird_white_50x50.png and /dev/null differ diff --git a/plugins/community_hub/public/javascripts/community_hub.js b/plugins/community_hub/public/javascripts/community_hub.js deleted file mode 100644 index 86bc1b4..0000000 --- a/plugins/community_hub/public/javascripts/community_hub.js +++ /dev/null @@ -1,366 +0,0 @@ -var latest_post_id = 0; -var oldest_post_id = 0; -live_scroll_position = 0; -var mediations = []; -var message_interval_id; - -function load_more(tab) { - switch (tab) { - case 'live': - load_more_messages(); - break; - } -} - - -function load_more_messages() { - var hub_id = jQuery(".hub").attr('id'); - var oldest_id = jQuery("#live-posts li.post").last().attr("id"); - - jQuery.ajax({ - url: '/plugin/community_hub/public/older_comments', - type: 'get', - data: { oldest_id: oldest_id, hub: hub_id }, - success: function(data) { - if (data.trim().length > 0) { - jQuery("#live-posts").append(data); - } - }, - error: function(ajax, stat, errorThrown) { - } - }); -} - - -function validate_textarea(txt) { - return (txt.search(/[^\n\s]/)!=-1); -} - - -function toogle_mediation_comments(mediation) { - jQuery("#mediation-comment-list-" + mediation ).toggle(); - jQuery("#mediation-comment-form-" + mediation ).toggle(); -} - - -function new_mediation_comment(button, mediation) { - - if (!validate_textarea(jQuery("#mediation-comment-form-" + mediation + " textarea").val())) { - return false; - } - - for (var i = 0; i < mediations.length; i++) { - mediation_id = mediations[i][0]; - if (mediation_id == mediation) { - interval_id = mediations[i][1]; - clearInterval( interval_id ); - break; - } - - } - - mediations.splice(i, 1); - - var form = jQuery(button).parents("form"); - - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", true); - - jQuery("body").addClass("hub-loading"); - - jQuery.post(form.attr("action"), form.serialize(), function(data) { - jQuery("body").removeClass("hub-loading"); - if (data.ok) { - jQuery("#mediation-comment-form-" + mediation + " textarea").val(''); - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", false); - update_mediation_comments(mediation, false); - mediations.push( [ mediation, setInterval(function() { update_mediation_comments(mediation, false)}, 5000) ] ); - } - else { - jQuery("#mediation-comment-form-" + mediation + " .submit").attr("disabled", false); - mediations.push( [ mediation, setInterval(function() { update_mediation_comments(mediation, false)}, 5000) ] ); - } - }, 'json'); - -} - - -function new_message(button) { - - if (!validate_textarea(jQuery(".hub .form-message #message_body").val())) { - return false; - } - - clearInterval( message_interval_id ); - - var form = jQuery(button).parents("form"); - - jQuery(".hub .form-message .submit").attr("disabled", true); - - jQuery("body").addClass("hub-loading"); - - jQuery.post(form.attr("action"), form.serialize(), function(data) { - jQuery("body").removeClass("hub-loading"); - if (data.ok) { - jQuery(".hub .form-message #message_body").val(''); - jQuery(".hub .form-message .submit").attr("disabled", false); - update_live_stream(); - message_interval_id = setInterval(function() { update_live_stream()}, 5000); - } - else { - jQuery(".hub .form-message .submit").attr("disabled", false); - message_interval_id = setInterval(function() { update_live_stream()}, 5000); - } - }, 'json'); - -} - - -function new_mediation(button) { - - if (!validate_textarea(tinymce.get('article_body').getContent(''))) { - return false; - } - - var form = jQuery(button).parents("form"); - - jQuery(".hub .form-mediation .submit").attr("disabled", true); - - jQuery("body").addClass("hub-loading"); - - tinymce.triggerSave(); - jQuery.post(form.attr("action"), form.serialize(), function(data) { - jQuery("body").removeClass("hub-loading"); - if (data.ok) { - jQuery(".hub .form-mediation .submit").attr("disabled", false); - tinymce.get('article_body').setContent(''); - update_mediations(); - } - else { - jQuery(".hub .form-mediation .submit").attr("disabled", false); - } - }, 'json'); - -} - - -function promote_user(mediation, user_id) { - - if (confirm(DEFAULT_PROMOTE_QUESTION)) { - - var hub_id = jQuery(".hub").attr('id'); - - jQuery.ajax({ - url: '/plugin/community_hub/public/promote_user', - type: 'get', - dataType: 'json', - data: { user: user_id, hub: hub_id }, - success: function(data) { - jQuery(".promote a").filter("#" + mediation).replaceWith( '' ); - }, - error: function(ajax, stat, errorThrown) { - } - }); - - } - -} - - -function pin_message(post_id) { - - if (confirm(DEFAULT_PIN_QUESTION)) { - - var hub_id = jQuery(".hub").attr('id'); - - jQuery.ajax({ - url: '/plugin/community_hub/public/pin_message', - type: 'get', - dataType: 'json', - data: { message: post_id, hub: hub_id }, - success: function(data) { - jQuery(".pin a").filter("#" + post_id).replaceWith( '' ); - }, - error: function(ajax, stat, errorThrown) { - } - }); - - } - -} - - -function update_mediation_comments(mediation, recursive) { - - if (jQuery("#right-tab.show").size() != 0) { - - if (jQuery(".hub #mediation-comment-list-" + mediation).css('display') != "none") { - - var hub_id = jQuery(".hub").attr('id'); - - if (jQuery("#mediation-comment-list-" + mediation + " li").first().length == 0) { - var latest_post_id = 0; - } - else { - var latest_post_id = jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").last().attr('id'); - } - - jQuery.ajax({ - url: '/plugin/community_hub/public/newer_mediation_comment', - type: 'get', - data: { latest_post: latest_post_id, mediation: mediation }, - success: function(data) { - if (data.trim().length > 0) { - jQuery("#mediation-comment-list-" + mediation + "").append(data); - jQuery("#mediation-comment-total-" + mediation).html(jQuery("#mediation-comment-list-" + mediation + " li.mediation-comment").size()); - } - }, - error: function(ajax, stat, errorThrown) { - } - }); - - } - - } - - if (recursive) { - setTimeout(function() { - update_mediation_comments(mediation, true); - }, 5000); - } -} - - -function update_mediations() { - - if (jQuery("#right-tab.show").size() != 0) { - - var hub_id = jQuery(".hub").attr('id'); - - if (jQuery("#mediation-posts li").first().length == 0) { - var latest_post_id = 0; - } - else { - var latest_post_id = jQuery("#mediation-posts li").first().attr('id'); - } - - jQuery.ajax({ - url: '/plugin/community_hub/public/newer_articles', - type: 'get', - data: { latest_post: latest_post_id, hub: hub_id }, - success: function(data) { - jQuery("body").removeClass("hub-loading"); - if (data.trim().length > 0) { - jQuery("#mediation-posts").prepend(data); - } - }, - error: function(ajax, stat, errorThrown) { - } - }); - - } - - setTimeout(update_mediations, 10000); -} - - -function update_live_stream() { - if (jQuery("#left-tab.show").size() != 0) { - - var hub_id = jQuery(".hub").attr('id'); - - if (jQuery("#live-posts li").first().length == 0) { - var latest_post_id = 0; - } - else { - var latest_post_id = jQuery("#live-posts li").first().attr('id'); - } - - jQuery.ajax({ - url: '/plugin/community_hub/public/newer_comments', - type: 'get', - data: { latest_post: latest_post_id, hub: hub_id }, - success: function(data) { - - if (data.trim().length > 0) { - jQuery("#live-posts").prepend(data); - if (jQuery("#auto_scrolling").prop('checked', true)) { - jQuery("#live-posts").scrollTop(0); - } - else { - jQuery("#live-posts").scrollTop(live_scroll_position); - } - } - - if (first_hub_load) { - jQuery("body").removeClass("hub-loading"); - first_hub_load = false; - } - - } - }); - - } -} - -function hub_left_tab_click() { - jQuery("#right-tab").removeClass('show'); - jQuery("#right-tab").addClass('hide'); - jQuery("#left-tab").removeClass('hide'); - jQuery("#left-tab").addClass('show'); -} - -function hub_right_tab_click() { - jQuery("#left-tab").removeClass('show'); - jQuery("#left-tab").addClass('hide'); - jQuery("#right-tab").removeClass('hide'); - jQuery("#right-tab").addClass('show'); - jQuery(".hub #right-tab.show h1.live").click(hub_left_tab_click); - if (first_mediations_load) { - jQuery("body").addClass("hub-loading"); - first_mediations_load = false; - update_mediations(); - } -} - -first_hub_load = true; -first_mediations_load = true; - -jQuery(".hub .envelope").scroll(function() { - jQuery("#auto_scrolling").prop('checked', false); - - - // live stream tab... - if (jQuery("#left-tab.show").size() != 0) { - current_envelope = jQuery(".hub .live .envelope"); - current_list_posts = jQuery(".hub ul#live-posts"); - tab = 'live'; - } - else { - // mediation tab... - if (jQuery("#right-tab.show").size() != 0) { - current_envelope = jQuery(".hub .mediation .envelope"); - current_list_posts = jQuery(".hub ul#mediation-posts"); - tab = 'mediation'; - } - } - - if (current_envelope.scrollTop() == (current_list_posts.height() - current_envelope.height() + 23)) { - load_more(tab); - } - -}); - - -jQuery(document).ready(function() { - - jQuery("#live-posts").scroll(function() { - live_scroll_position = jQuery("#live-posts").scrollTop(); - }); - - jQuery(".hub #left-tab.show h1.mediation").click(hub_right_tab_click); - - jQuery("body").addClass("hub-loading"); - - message_interval_id = setInterval(function() { update_live_stream() }, 5000); - -}); diff --git a/plugins/community_hub/public/style.css b/plugins/community_hub/public/style.css deleted file mode 100644 index 1cf6912..0000000 --- a/plugins/community_hub/public/style.css +++ /dev/null @@ -1,576 +0,0 @@ -#banner-embed-container { - width: 49%; - float: right; -} - -#input-panel { - width: 100%; - padding-top: 10px; - display: inline-block; -} - -#hub-loading { - float: right; -} - -.hub-loading { - cursor: wait; -} - -.icon-newcommunity-hub, -.icon-community-hub { - background-image: url(/plugins/community_hub/icons/community-hub.png) -} - -.hub ul {padding-left: 0px; margin-top: 0;} - -#content .hub h1{ - margin-bottom: 0; -} - -#content .hub .content-tab h1{ - border-color: #D71410 #CCCCCC -moz-use-text-color; - border-left: 1px solid #CCCCCC; - border-right: 1px solid #CCCCCC; - border-style: solid solid none; - border-width: 1px 1px 0; - border-top: 1px solid #D71410; -} - -#content .hub .title { - font-size: 33px; - font-weight: normal; - padding-right: 70px; - color: #4b7421; - font-variant: normal; -} - -.hub .description { - font-size: 14px; -} - -.hub .post { - border-top: 1px solid #ddd; - background: url("images/hub-time-bg.gif") repeat-y left top #fff; - padding: 5px 0; -} - - -.hub .time{ - display: inline-block; - font-size: 8px; - padding-top: 10px; - text-align: center; - vertical-align: top; - width: 35px; -} - -.hub .avatar{ - background-color: lightGray; - display: inline-block; - height: 43px; - margin: 0 10px; - vertical-align: top; - width: 43px; - text-align: center; -} - -.hub .avatar img{ - max-height: 43px; - max-width: 43px; -} - -.hub .message { - display: inline-block; - width: 65%; - float: none; - clear: both; -} - -.hub .show .message { - width: 80%; -} - -.hub .message .author { - font-weight: bold; - display: inline-block; - margin-right: 5px; - padding-bottom: 0px; -} - -.hub .mediation-bar { - display: inline-block; - margin: 10px 0 10px 104px; - width: 83%; -} - -.hub .mediation-bar ul {} - -.hub .mediation-bar ul li { - display: inline-block; - overflow: hidden; - width: 16px; -} - -.hub .mediation-bar ul li.likes-dislikes{ - overflow: visible; - text-indent: 0px; - width: auto; - vertical-align: top; -} - -.hub .mediation-bar ul li.pin { - height: 25px; -} - -.hub .remove{} - -.hub .mediation-bar ul li a{ - text-indent: -10000px; -} - -.hub .not-promoted { - opacity: 0.5; - filter: alpha(opacity=50); -} - -.hub .pin .not-pinned { - opacity: 0.5; - filter: alpha(opacity=50); -} - -.hub .mediation-bar ul li.pin { - float: right; -} - -.hub ul.mediation-comment-list{ - margin-left: 80px; - display: inline-block; - padding: 10px 0; - background-color: #fff; - margin-bottom: 10px; -} - -.hub ul.mediation-comment-list li { - margin-bottom: 2px; -} - -.hub .mediation-comment-form { - margin-left: 70px; - margin-top: 10px; -} - -.hub input.button.with-text.icon-add.submit{ - display: block; -} - -.hub .live { - border: 0px solid lightGray; - display: inline-block; - float: left; - width: 49%; - margin-bottom: 2em; -} - -.hub .envelope { - height: 500px; - overflow-x: hidden; - overflow-y: scroll; - margin-bottom: 14px; - border: 1px solid lightgray; - width: 100%; - display: inline-block; - margin-top: 0; -} - -.hub ul#live-posts, .hub ul#mediation-posts{ - border-bottom: 1px solid lightgray; - padding-top: 10px; -} - -/*modificação da scroll bar*/ -.hub div.envelope::-webkit-scrollbar-button { - height: 0; - width: 0; -} - -.hub div.envelope::-webkit-scrollbar-thumb { - background-clip: padding-box; - background-color: rgba(0,0,0,.3); - border: 5px solid transparent; - border-radius: 10px; - min-height: 20px; - min-width: 20px; - height: 5px; - width: 5px; -} - -.hub div.envelope::-webkit-scrollbar { - height: 15px; - width: 15px; -} - -/*fim de modificação da scroll bar*/ - -.hub #live-posts .post { - background-color:#fff; -} - -.hub ul#mediation-posts .post{ - background-color:#eee; - border-color: #fff; - padding-bottom: 10px; -} - -/*novos elementos: h1.live - h1.mediation*/ -#content .main-block .hub .live h1.live, -#content .main-block .hub .mediation h1.mediation { - border: 1px solid lightGray; - border-top: 1px solid #96110D; - border-bottom: 0px solid #FFFFFF; - top: 3px; - float: left; - font-weight: normal; - margin-bottom: -1px; - position: relative; - width: 60%; -background-color: white; -z-index: 99; -} - -#content .main-block .hub .live h1.live{ - float: left; - margin-right: 20px; - margin-left: 0px; - text-align: center; -} - -#content .main-block .hub .mediation h1.mediation{ - float: right; - margin-right: 0px; - margin-left: 20px; - top: 0px; - left: 2px; - text-align: center; -} - -#content .main-block .hub .live h1.mediation, -#content .main-block .hub .mediation h1.live { - display: inline-block; - background-color: #EEEEEE; - border-bottom: 1px solid #CCCCCC; - border-top-color: #CCCCCC; - color: gray; - position: relative; - width: 30%; - text-align: center; - margin-top: 8px; - line-height: 27px; - cursor: pointer; - top: 1px; -} - -#content .main-block .hub .live h1.mediation {} - -#content .main-block .hub .mediation h1.live { - margin-left: 20px; - top:1px; -} - - -/*fim de novos elementos: h1.live - h1.mediation*/ - - -#content .hub .live .title { - color: #D71410; - display: inline-block; - font-size: 14px; - font-family: arial, sans-serif; - padding-right: 0; - width: 70%; -} -#content .hub .live .on-air { - background-color: #96110D; - border-radius: 10px 10px 10px 10px; - color: white; - display: inline-block; - font-size: 16px; - font-weight: bold; - padding: 0 0.5em; - text-align: center; - vertical-align: top; - width: 20%; - -} -#content .hub .live .off-air { - background-color: gray; - border-radius: 10px 10px 10px 10px; - color: black; - display: inline-block; - font-size: 16px; - font-weight: bold; - padding: 0 0.5em; - text-align: center; - text-transform: uppercase; - vertical-align: top; - width: 20%; -} - -/****aba live fechada****/ - - -.hub .live.hide { - width: 10%; -} - -.hub .live.hide ul#live-posts{ - overflow-x: visible; - overflow-y: visible; - background-color: lightGray; -} - -.hub .live.hide ul#live-posts li{ - display: none; -} - -#content .hub .live.hide h1 { - text-align: center; - cursor: pointer; -} - -#content .hub .live.hide h1 .title { - display: none; -} -#content .hub .live.hide .on-air, -#content .hub .live.hide .off-air { - width: auto; -} - -/****fim aba live fechada****/ - -/****aba live aberta****/ - -.hub .live.show { - width: 100%; -} - -.hub .live.show ul#live-posts .li{ - -} - -#content .hub .live.show .on-air, -#content .hub .live.show .off-air{ -margin-right: 10px; -} - -/****fim aba mlive aberta****/ - - -/**************************************/ - - -.hub .mediation { - border: 0px solid lightGray; - display: inline-block; - clear: right; - float: none; - margin-left: 1%; - width: 50%; - margin-bottom: 2em; -} - -#content .main-block .hub .mediation h1{ - border: 1px solid lightGray -} - -#content .hub .mediation .title { - color: gray; - display: inline-block; - font-size: 14px; - font-family: Arial, sans-serif; - padding-right: 0; -} -.hub .mediation .expand { - float: right; - padding-right: 1em; -} - -/****aba mediation fechada****/ - -.hub .mediation.hide { - border: 0px solid lightGray; - display: inline-block; - clear: right; - float: none; - margin-left: 1%; - width: 10%; - margin-bottom: 0em; -} - -#content .main-block .hub .mediation.hide h1{ - cursor: pointer; -} - -#content .hub .mediation.hide .title { - display: inline-block; - font-size: 14px; - font-family: arial, sans-serif; - padding-right: 0; - width: 100%; -} -.hub .mediation.hide .expand { - display: none; -} - - -.hub .mediation.hide ul#mediation-posts { -height: 500px; -overflow-x: visible; -overflow-y: visible; -border-width: 0 1px 1px; -border-style: solid; -border-color: lightGray; -padding-top: 10px; -background-color: lightgray; -} - -.hub .mediation.hide ul#mediation-posts li{ -display: none; -} - -/****fim aba mediation fechada****/ - -/****aba mediation aberta****/ - -.hub .mediation.show { - width: 100%; -} - -#content .hub .mediation.show .title { - display: inline-block; - font-family: arial, sans-serif; - padding-right: 0; -} - -.hub .mediation.show ul#mediation-posts li{ - -} - -/****fim aba mediation aberta****/ - -.hub .mediation.hide, -.hub .live.hide { - display: none; - visibility: hidden; -} - -.hub .mediation.show, -.hub .live.show { - display: inline-block; - visibility: visible; -} - -.hub .form-mediation { - width: 60%; - display: inline-block; - padding: 10px; - border: 1px solid #c0c0c0; - overflow-x: hidden; -} - -.hub .form-message { - height: 148px; - padding: 10px; - border: 1px solid #c0c0c0; -} - - -.hub div.settings { - display: inline-block; - margin-left: 1%; - margin-top: 10px; - vertical-align: top; - width: 35%; -} - -.hub ul.settings li { - height: 50px; - line-height: 50px; - margin-bottom: 10px; - padding: 0 10px; - background: url("images/hub-arrow-right.png") no-repeat 90% top #ed8e01; -} - -.hub ul.settings span.collapse { - padding-right: 0.5em; - float: right; -} - -.hub div.banner { - height: 70px; - background-color: #6d6d6d; - text-align: center; - padding-top: 30px; -} - -.hub div.banner span { - color: white; - font-family: Arial Black, arial, sans-serif; - font-size: large; - font-weight: normal; - display: block; -} - -.hub div.embed { - margin-top: 10px; - padding: 8px; - border: 1px solid #c0c0c0; -} - -.hub div.embed textarea.code { - background-color: #f0f0f0; - border: 1px solid #f0f0f0; - height: 195px; - resize: none; -} - -#content .hub ul.settings li a{ - color: white; - font-family: Arial Black, arial, sans-serif; - font-size: large; - font-weight: normal; -} - -#content .hub ul.settings li a:hover { - text-decoration: none; -} - -#content .hub form input.button.submit { - font-family: Arial Black, arial, sans-serif; - font-size: small; - font-weight: normal; - color: #333; - margin-top: 10px; -} - -textarea#message_body { - width: auto; - margin-left: 80px; -} - -.post .comment-count { - margin-left: 80px; - padding: 5px 10px; - background-color: white; - display: inline-block; - border-radius: 5px; - font-weight: bold; - display: block; - margin-bottom: -5px; - margin-top: 10px; - max-width: 100px; -} - -.hub ul.mediation-comment-list { - width: 80%; -} diff --git a/plugins/community_hub/script/hub_updater b/plugins/community_hub/script/hub_updater deleted file mode 100755 index 6f398ca..0000000 --- a/plugins/community_hub/script/hub_updater +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env ruby - -require 'daemons' -require 'optparse' - -NOOSFERO_ROOT = File.expand_path(File.dirname(__FILE__) + '/../../../') - -Daemons.run_proc('hub') do - Dir.chdir NOOSFERO_ROOT - require './config/environment' - - unless ENV['PROXY'].blank? - ENV['NO_PROXY'] ||= 'localhost' - require 'proxifier/env' - end - CommunityHubPlugin::Listener.run -end diff --git a/plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb b/plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb deleted file mode 100644 index a275e18..0000000 --- a/plugins/community_hub/test/functional/community_hub_plugin_cms_controller_test.rb +++ /dev/null @@ -1,73 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class CmsController; def rescue_action(e) raise e end; end - -class CmsControllerTest < ActionController::TestCase - - def setup - @controller = CmsController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - user = create_user('testinguser') - - @environment = user.environment - - @community = Community.create!( - :name => 'Sample community', - :identifier => 'sample-community', - :environment => @environment - ) - - @community.add_admin(user.person) - - @community.save! - - @hub = CommunityHubPlugin::Hub.new( - :abstract => 'abstract', - :body => 'body', - :name => 'test-hub', - :profile => @community, - :last_changed_by_id => user - ) - - @hub.save! - - login_as(user.login) - - end - - should 'be able to edit hub settings' do - get :edit, :id => @hub.id, :profile => @community.identifier - assert_tag :tag => 'input', :attributes => { :id => 'article_name' } - assert_tag :tag => 'textarea', :attributes => { :id => 'article_body' } - assert_tag :tag => 'input', :attributes => { :id => 'article_twitter_enabled' } - assert_tag :tag => 'input', :attributes => { :id => 'article_twitter_hashtags' } - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_enabled' } - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_hashtag' } - assert_tag :tag => 'input', :attributes => { :id => 'article_facebook_access_token' } - end - - should 'be able to save hub' do - get :edit, :id => @hub.id, :profile => @community.identifier - post :edit, :id => @hub.id, :profile => @community.identifier, :article => { - :name => 'changed', - :body => 'changed', - :twitter_enabled => true, - :twitter_hashtags => 'changed', - :facebook_enabled => true, - :facebook_hashtag => 'changed', - :facebook_access_token => 'changed' - } - @hub.reload - assert_equal 'changed', @hub.name - assert_equal 'changed', @hub.body - assert_equal true, @hub.twitter_enabled - assert_equal 'changed', @hub.twitter_hashtags - assert_equal true, @hub.facebook_enabled - assert_equal 'changed', @hub.facebook_hashtag - assert_equal 'changed', @hub.facebook_access_token - end - -end - diff --git a/plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb b/plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb deleted file mode 100644 index c2cbf35..0000000 --- a/plugins/community_hub/test/functional/community_hub_plugin_content_viewer_controller_test.rb +++ /dev/null @@ -1,108 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require 'content_viewer_controller' - -class ContentViewerController; def rescue_action(e) raise e end; end - -class ContentViewerControllerTest < ActionController::TestCase - - all_fixtures - - def setup - @controller = ContentViewerController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - @user = create_user('testinguser').person - - @environment = @user.environment - - @community = Community.create!( - :name => 'Sample community', - :identifier => 'sample-community', - :environment => @environment - ) - - @hub = CommunityHubPlugin::Hub.new( - :abstract => 'abstract', - :body => 'body', - :name => 'test-hub', - :profile => community, - :last_changed_by_id => user.id - ) - - @hub.save! - - end - - attr_reader :user, :environment, :community, :hub - should 'display live tab' do - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :id => 'left-tab' } - end - - should 'display mediation tab' do - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :id => 'right-tab' } - end - - should 'display auto scroll checkbox for live stream content' do - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :id => 'left-tab' }, :descendant => { - :tag => 'span', :descendant => { - :tag => 'input', :attributes => { :id => 'auto_scrolling', :type => 'checkbox' } - } - } - end - - should 'not display auto scroll setting for mediation content' do - get :view_page, @hub.url - assert_no_tag :tag => 'div', :attributes => { :id => 'right-tab' }, :descendant => { - :tag => 'span', :descendant => { - :tag => 'input', :attributes => { :id => 'auto_scrolling', :type => 'checkbox' } - } - } - end - - should 'not display message form if user is not logged' do - get :view_page, @hub.url - assert_no_tag :tag => 'div', :attributes => { :class => 'form-message' } - end - - should 'not display mediation form if user is not loged' do - get :view_page, @hub.url - assert_no_tag :tag => 'div', :attributes => { :class => 'form-mediation' } - end - - should 'display message form if user is logged' do - user = create_user('visitor') - login_as(user.login) - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :class => 'form-message' } - end - - should 'display mediation form if user is logged and is hub''s mediator' do - login_as(user.user.login) - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :class => 'form-mediation' } - end - - should 'not display mediation form if user is logged but is not hub''s mediator' do - visitor = create_user('visitor') - login_as(visitor.login) - assert_no_tag :tag => 'div', :attributes => { :class => 'form-mediation' } - end - - should 'display link to hub''s settings if user is mediator' do - login_as(user.user.login) - get :view_page, @hub.url - assert_tag :tag => 'div', :attributes => { :class => 'settings' } - end - - should 'not display link to hub''s settings if user is not mediator' do - visitor = create_user('visitor') - login_as(visitor.login) - get :view_page, @hub.url - assert_no_tag :tag => 'div', :attributes => { :class => 'settings' } - end - -end diff --git a/plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb b/plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb deleted file mode 100644 index e2aa8d9..0000000 --- a/plugins/community_hub/test/functional/community_hub_plugin_public_controller_test.rb +++ /dev/null @@ -1,186 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' -require File.dirname(__FILE__) + '/../../controllers/public/community_hub_plugin_public_controller' - -class CommunityHubPluginPublicController; def rescue_action(e) raise e end; end - -class CommunityHubPluginPublicControllerTest < ActionController::TestCase - - all_fixtures - - def setup - @controller = CommunityHubPluginPublicController.new - @request = ActionController::TestRequest.new - @response = ActionController::TestResponse.new - - @user = create_user('testinguser').person - - @environment = @user.environment - - @community = Community.create!( - :name => 'Sample community', - :identifier => 'sample-community', - :environment => @environment - ) - - @community.save! - - @hub = CommunityHubPlugin::Hub.new( - :abstract => 'abstract', - :body => 'body', - :name => 'test-hub', - :profile => community, - :last_changed_by_id => user.id - ) - - @hub.save! - - end - - attr_reader :user, :environment, :community, :hub - - should 'display pin message flag if user is logged and mediator' do - message = create_message( hub, user ) - login_as(user.user.login) - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'pin' } - end - - should 'not display pin message flag if user is not mediator' do - message = create_message( hub, user ) - visitor = create_user('visitor') - login_as(visitor.login) - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } - assert_no_tag :tag => 'li', :attributes => { :class => 'pin' } - end - - should 'pin message flag is link if message has not been pinned' do - message = create_message( hub, user ) - login_as(user.user.login) - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'pin' }, :descendant => { - :tag => 'a', :descendant => { - :tag => 'img', :attributes => { :class => 'not-pinned' } - } - } - end - - should 'ping message flag is not link if message has beem pinned' do - message = create_message( hub, user ) - hub.pinned_messages += [message.id] - hub.save - login_as(user.user.login) - xhr :get, :newer_comments, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'pin' }, :descendant => { - :tag => 'img', :attributes => { :class => 'pinned' } - } - end - - should 'display promote user flag if user is logged and mediator' do - mediation = create_mediation(hub, user, community) - login_as(user.user.login) - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'promote' } - end - - should 'not display promote user flag if user is not mediator' do - mediation = create_mediation(hub, user, community) - visitor = create_user('visitor') - login_as(visitor.login) - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } - assert_no_tag :tag => 'li', :attributes => { :class => 'promote' } - end - - should 'promote user flag is link if user has not been promoted' do - visitor = create_user('visitor').person - mediation = create_mediation(hub, visitor, community) - login_as(user.user.login) - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { - :tag => 'a', :descendant => { - :tag => 'img', :attributes => { :class => 'not-promoted' } - } - } - end - - should 'promote user flag is not link if user has been promoted' do - mediation = create_mediation(hub, user, community) - login_as(user.user.login) - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { - :tag => 'img', :attributes => { :class => 'promoted' } - } - end - - should 'promote user flag is not link if user is hub''s owner' do - mediation = create_mediation(hub, user, community) - login_as(user.user.login) - xhr :get, :newer_articles, { :latest_post => 0, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :class => 'promote' }, :descendant => { - :tag => 'img', :attributes => { :class => 'promoted' } - } - end - - should 'should create new message' do - login_as(user.user.login) - xhr :post, :new_message, { :article_id => hub.id, :message => {"body"=>"testmessage"} } - response = JSON.parse(@response.body) - assert_equal true, response['ok'] - end - - should 'should create new mediation' do - login_as(user.user.login) - xhr :post, :new_mediation, { :profile_id => community.id, :article => { "parent_id" => hub.id , "body" => "

testmediation

" } } - response = JSON.parse(@response.body) - assert_equal true, response['ok'] - end - - should 'should create new mediation comment' do - login_as(user.user.login) - mediation = create_mediation(hub, user, community) - xhr :post, :new_message, { "article_id" => mediation.id, "message" => {"body"=>"testmediationcomment"} } - response = JSON.parse(@response.body) - assert_equal true, response['ok'] - end - - should 'should get newer messages' do - message1 = create_message( hub, user ) - message2 = create_message( hub, user ) - message3 = create_message( hub, user ) - xhr :get, :newer_comments, { :latest_post => message2.id, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :id => message3.id } - end - - should 'should get oldest messages' do - message1 = create_message( hub, user ) - message2 = create_message( hub, user ) - message3 = create_message( hub, user ) - xhr :get, :older_comments, { :oldest_id => message2.id, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :id => message1.id } - end - - should 'should get newer mediations' do - mediation1 = create_mediation(hub, user, community) - mediation2 = create_mediation(hub, user, community) - mediation3 = create_mediation(hub, user, community) - xhr :get, :newer_articles, { :latest_post => mediation2.id, :hub => hub.id } - assert_tag :tag => 'li', :attributes => { :id => mediation3.id } - end - - should 'should promote user' do - login_as(user.user.login) - visitor = create_user('visitor').person - xhr :post, :promote_user, { :hub => hub.id, :user => visitor.id } - response = JSON.parse(@response.body) - assert_equal true, response['ok'] - end - - should 'should pin message' do - login_as(user.user.login) - message = create_message( hub, user ) - xhr :post, :pin_message, { :hub => hub.id, :message => message.id } - response = JSON.parse(@response.body) - assert_equal true, response['ok'] - end - -end - diff --git a/plugins/community_hub/test/test_helper.rb b/plugins/community_hub/test/test_helper.rb deleted file mode 100644 index 4aedadb..0000000 --- a/plugins/community_hub/test/test_helper.rb +++ /dev/null @@ -1,38 +0,0 @@ -require File.dirname(__FILE__) + '/../../../test/test_helper' - -def create_hub(name, community, user) - hub = CommunityHubPlugin::Hub.new(:abstract => 'abstract', :body => 'body', :name => name, :profile => community, :last_changed_by_id => user.id ) - hub.save! - hub -end - -def create_mediation(hub, community) - mediation = CommunityHubPlugin::Mediation.new(:profile => community) - mediation.name = CommunityHubPlugin::Mediation.timestamp - mediation.save! - mediation -end - -def create_message(hub,user) - message = Comment.new - message.author = user - message.title = "hub-message-#{(Time.now.to_f * 1000).to_i}" - message.body = 'body' - message.article = hub - message.save! - message -end - -def create_mediation(hub, user, community) - - #raise community.inspect - mediation = CommunityHubPlugin::Mediation.new - mediation.name = CommunityHubPlugin::Mediation.timestamp - mediation.profile = community - mediation.last_changed_by = user - mediation.created_by_id = user.id - mediation.source = 'local' - mediation.parent_id = hub.id - mediation.save! - mediation -end diff --git a/plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb b/plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb deleted file mode 100644 index 4fdaba4..0000000 --- a/plugins/community_hub/test/unit/community_hub_plugin/hub_helper_test.rb +++ /dev/null @@ -1,18 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class HubHelperTest < ActiveSupport::TestCase - - include CommunityHubPlugin::HubHelper - include NoosferoTestHelper - - should 'return time formated to hh:mm' do - t = Time.utc(2014,"jan",1,17,40,0) - assert_equal post_time(t), "17:40" - end - - should 'return empty string if param is not time' do - i = 1 - assert_equal post_time(i), '' - end - -end diff --git a/plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb b/plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb deleted file mode 100644 index 138d1b1..0000000 --- a/plugins/community_hub/test/unit/community_hub_plugin/hub_test.rb +++ /dev/null @@ -1,128 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class HubTest < ActiveSupport::TestCase - - def setup - @env = fast_create(Environment) - @user = create_user('testuser', :environment => @env).person - @comm = fast_create(Community, :environment_id => @env.id) - @hub = create_hub('hub', @comm, @user) - end - - should 'has setting twitter_enable' do - assert_respond_to @hub, :twitter_enabled - end - - should 'default value of setting twitter_enabled is false' do - assert_equal @hub.twitter_enabled, false - end - - should 'has setting twitter_hashtags' do - assert_respond_to @hub, :twitter_hashtags - end - - should 'default value of setting twitter_hashtags is blank' do - assert_equal @hub.twitter_hashtags, "" - end - - should 'has setting twitter_consumer_key' do - assert_respond_to @hub, :twitter_consumer_key - end - - should 'default value of setting twitter_consumer is blank' do - assert_equal @hub.twitter_consumer_key, "" - end - - should 'has setting twitter_consumer_secret' do - assert_respond_to @hub, :twitter_consumer_secret - end - - should 'default value of setting twitter_consumer_secret is blank' do - assert_equal @hub.twitter_consumer_secret, "" - end - - should 'has setting twitter_access_token' do - assert_respond_to @hub, :twitter_access_token - end - - should 'default value of setting twitter_access_token is blank' do - assert_equal @hub.twitter_access_token, "" - end - - should 'has setting twitter_access_token_secret' do - assert_respond_to @hub, :twitter_access_token_secret - end - - should 'default value of setting twitter_access_token_secret' do - assert_equal @hub.twitter_access_token_secret, "" - end - - should 'has setting facebook_enabled' do - assert_respond_to @hub, :facebook_enabled - end - - should 'default value of setting facebook_enabled is false' do - assert_equal @hub.facebook_enabled, false - end - - should 'has setting facebook_pooling_time' do - assert_respond_to @hub, :facebook_pooling_time - end - - should 'default value of setting facebook_pooling_time id five (5)' do - assert_equal @hub.facebook_pooling_time, 5 - end - - should 'has setting facebook_access_token' do - assert_respond_to @hub, :facebook_access_token - end - - should 'default value of setting facebook_access_token is blank' do - assert_equal @hub.facebook_access_token, "" - end - - should 'has pinned_messages' do - assert_respond_to @hub, :pinned_messages - end - - should 'default value of pinned_messags' do - assert_equal @hub.pinned_messages, [] - end - - should 'has pinned_mediations' do - assert_respond_to @hub, :pinned_mediations - end - - should 'default value of pinned_mediations' do - assert_equal @hub.pinned_mediations, [] - end - - should 'has mediators' do - assert_respond_to @hub, :mediators - end - - should 'hub creator is mediator by default' do - assert @hub.mediators.include?(@user.id) - end - - should 'describe yourself' do - assert CommunityHubPlugin::Hub.description - end - - should 'has a short descriptionf' do - assert CommunityHubPlugin::Hub.short_description - end - - should 'accept comments by default' do - assert @hub.accept_comments? - end - - should 'do not notify comments by default' do - assert !@hub.notify_comments - end - - should 'has a view page' do - assert @hub.view_page - end - -end diff --git a/plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb b/plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb deleted file mode 100644 index 4eb231e..0000000 --- a/plugins/community_hub/test/unit/community_hub_plugin/listener_test.rb +++ /dev/null @@ -1,31 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class ListenerTest < ActiveSupport::TestCase - - should 'initialize logger' do - logger = CommunityHubPlugin::Listener.initialize_logger - logfile = logger.instance_variable_get(:@logdev).instance_variable_get(:@filename) - assert_instance_of(Logger, logger) - assert File.exists?(logfile) - end - - should 'log message' do - logdir = File.join(Rails.root, 'log', CommunityHubPlugin::Listener.name.underscore) - - if File.exists?(logdir) - Dir.foreach(logdir) { |f| - fn = File.join(logdir, f); - File.delete(fn) if f != '.' && f != '..' - } - end - - logger = CommunityHubPlugin::Listener.initialize_logger - CommunityHubPlugin::Listener.log('testmessage') - - logfile = logger.instance_variable_get(:@logdev).instance_variable_get(:@filename) - text = File.open(logfile).read - - assert_match /testmessage/, text - end - -end diff --git a/plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb b/plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb deleted file mode 100644 index edb0fd6..0000000 --- a/plugins/community_hub/test/unit/community_hub_plugin/mediation_test.rb +++ /dev/null @@ -1,33 +0,0 @@ -require File.dirname(__FILE__) + '/../../test_helper' - -class MediationTest < ActiveSupport::TestCase - - def setup - @env = fast_create(Environment) - @user = create_user('testuser', :environment => @env).person - @comm = fast_create(Community, :environment_id => @env.id) - @hub = create_hub('hub', @comm, @user) - @mediation = create_mediation(@hub, @user, @comm) - end - - should 'has setting profile_picture' do - assert_respond_to @mediation, :profile_picture - end - - should 'default value of setting profile_picture is blank' do - assert_equal @mediation.profile_picture, "" - end - - should 'generate timestamp for mediation' do - assert CommunityHubPlugin::Mediation.timestamp - end - - should 'default value of advertise is false' do - assert !@mediation.advertise - end - - should 'default value of notify comments is false' do - assert !@mediation.notify_comments - end - -end diff --git a/plugins/community_hub/test/unit/community_hub_plugin_test.rb b/plugins/community_hub/test/unit/community_hub_plugin_test.rb deleted file mode 100644 index 25d2d1f..0000000 --- a/plugins/community_hub/test/unit/community_hub_plugin_test.rb +++ /dev/null @@ -1,49 +0,0 @@ -require File.dirname(__FILE__) + '/../test_helper' - -class CommunityHubPluginTest < ActiveSupport::TestCase - - def setup - @plugin = CommunityHubPlugin.new - @profile = fast_create(Community) - @params = {} - @plugin.stubs(:context).returns(self) - end - - attr_reader :profile, :params - - should 'has name' do - assert CommunityHubPlugin.plugin_name - end - - should 'describe yourself' do - assert CommunityHubPlugin.plugin_description - end - - should 'has stylesheet' do - assert @plugin.stylesheet? - end - - should 'return Hub as a content type if profile is a community' do - assert_includes @plugin.content_types, CommunityHubPlugin::Hub - end - - should 'do not return Hub as a content type if profile is not a community' do - @profile = Organization.new - assert_not_includes @plugin.content_types, CommunityHubPlugin::Hub - end - - should 'do not return Hub as a content type if there is a parent' do - parent = fast_create(Blog, :profile_id => @profile.id) - @params[:parent_id] = parent.id - assert_not_includes @plugin.content_types, CommunityHubPlugin::Hub - end - - should 'return true at content_remove_new if page is a Hub' do - assert @plugin.content_remove_new(CommunityHubPlugin::Hub.new) - end - - should 'return false at content_remove_new if page is not a Hub' do - assert !@plugin.content_remove_new(Article.new) - end - -end diff --git a/plugins/community_hub/twitter/stream.rb b/plugins/community_hub/twitter/stream.rb deleted file mode 100644 index aa81a12..0000000 --- a/plugins/community_hub/twitter/stream.rb +++ /dev/null @@ -1,69 +0,0 @@ -require 'rubygems' -require 'twitter' -require 'iconv' - -#disable address resolv to avoid problems with proxy -class Resolv - def self.getaddress(host) - host - end -end - -#Filters non-UTF8 octets -def UTF8Filter(string) - ic = Iconv.new('UTF-8//IGNORE', 'UTF-8') - #Attention please, don't remove + ' ')[0..-2] it is used for UTF8 validation - ic.iconv(string + ' ')[0..-2] -end - -def listen_twitter_stream(hub, author_id) - - connected = false - tries = 0 - while !connected - begin - tries += 1 - client = Twitter::Streaming::Client.new do |config| - config.consumer_key = hub.twitter_consumer_key - config.consumer_secret = hub.twitter_consumer_secret - config.access_token = hub.twitter_access_token - config.access_token_secret = hub.twitter_access_token_secret - end - puts client.inspect - connected = true - tries = 0 - rescue => e - puts "Error connecting to twitter stream: #{e.inspect}" - sleep (10 + 2 ** tries) - end - end - - tries = 0 - while true - begin - tries += 1 - client.filter(:track => hub.twitter_hashtags) do |object| - if object.is_a?(Twitter::Tweet) - comment = Comment.new - comment.title = 'hub-message-twitter' - comment.source = hub - comment.body = UTF8Filter(object.text) - comment.profile_picture = object.user.profile_image_url.to_s - comment.author_id = author_id - comment.name = UTF8Filter(object.user.screen_name) - comment.email = 'admin@localhost.local' - - tries = 0 - begin - comment.save! - rescue => e - puts "Error writing twitter comment #{e.inspect}" - end - end - end - rescue => e - puts "Error reading twitter stream #{e.inspect}" - sleep (10 + 2 ** tries) - end - end -end diff --git a/plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb b/plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb deleted file mode 100644 index 906eae2..0000000 --- a/plugins/community_hub/views/cms/community_hub_plugin/_hub.html.erb +++ /dev/null @@ -1,59 +0,0 @@ -
- -

<%= _("HUB Settings:") %>

- - <%= required_fields_message %> - -
- <%= required labelled_form_field(_('Title'), text_field(:article, 'name', :size => '64', :maxlength => 150)) %> -
- -
- <%= required labelled_form_field(_('Description'), text_area(:article, 'body', :style => 'width: 99%;')) %> -
- - <%= fields_for 'article[image_builder]', @article.image do |i| %> - <%= file_field_or_thumbnail(_('Image:'), @article.image, i) %> - <% end %> - -
- -
-

<%= _('Twitter Settings:') %>

-
- - <%= check_box(:article, :twitter_enabled) %> - <%= _("Turn on TWITTER") %> - - <%= labelled_form_field(_('Twitter\'s Hashtags, comma separated (example: participa.br,participabr)'), text_field(:article, :twitter_hashtags)) %> - -
- <%= labelled_form_field(_('Twitter\'s consumer key'), text_field(:article, :twitter_consumer_key)) %> -
- -
- <%= labelled_form_field(_('Twitter\'s consumer secret'), text_field(:article, :twitter_consumer_secret)) %> -
- -
- <%= labelled_form_field(_('Twitter\'s access token'), text_field(:article, :twitter_access_token)) %> -
- -
- <%= labelled_form_field(_('Twitter\'s access token secret'), text_field(:article, :twitter_access_token_secret)) %> -
-
-
-

<%= _('Facebook Settings:') %>

-
- - <%= check_box(:article, :facebook_enabled) %> - <%= _("Turn on FACEBOOK") %> - - <%= labelled_form_field(_('Facebook\'s hashtag (example: #participabr)'), text_field(:article, :facebook_hashtag)) %> - - <%= labelled_form_field(_('Facebook\'s access token'), text_field(:article, :facebook_access_token)) %> -
- <%= _('How to get a new access token?') %> -
-
diff --git a/plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb deleted file mode 100644 index 4453ecc..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_banner.html.erb +++ /dev/null @@ -1,3 +0,0 @@ - \ No newline at end of file diff --git a/plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb deleted file mode 100644 index dc69d6a..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_embed.html.erb +++ /dev/null @@ -1,11 +0,0 @@ -<% extend CommunityHubPlugin::HubHelper %> - -
- Embed / <%= _("Embed") %> - -
\ No newline at end of file diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb deleted file mode 100644 index 9c807ea..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation.html.erb +++ /dev/null @@ -1,87 +0,0 @@ -<% extend CommunityHubPlugin::HubHelper %> - -
  • - - - - <% total_mediation_comments = mediation.comments.count %> - - - <%= link_to( "#{total_mediation_comments} " + _("Comments") , '#', - :class => 'display-comment-form', - :id => 'top-post-comment-button', - :onclick => "toogle_mediation_comments(#{mediation.id}); return false;") %> - - - - - - - <% if logged_in? && mediation.accept_comments? %> - - <% end %> - -
  • diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb deleted file mode 100644 index 5219927..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment.html.erb +++ /dev/null @@ -1,6 +0,0 @@ -
  • -
      -
    • <%= image_tag(profile_icon(mediation_comment.author, :minor)) %>
    • -
    • <%= mediation_comment.author_name %>: <%= mediation_comment.body %>
    • -
    -
  • \ No newline at end of file diff --git a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb deleted file mode 100644 index 904ec5c..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_mediation_comment_form.html.erb +++ /dev/null @@ -1,12 +0,0 @@ -<%= form_for :message, - :method => 'post', - :url => { - :controller => 'community_hub_plugin_public', - :action => 'new_message', - :article_id => mediation.id - } do |f| %> - <%= f.text_area(:body, - :rows => 4, - :placeholder => _('Type your comment here')) %> - <%= submit_button('add', _('Send'), :onclick => "new_mediation_comment(this,#{mediation.id}); return false;") %> -<% end %> diff --git a/plugins/community_hub/views/community_hub_plugin_public/_post.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_post.html.erb deleted file mode 100644 index 6f26978..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_post.html.erb +++ /dev/null @@ -1,34 +0,0 @@ -<% extend CommunityHubPlugin::HubHelper %> - -
  • -
      -
    • <%= post_time(post.created_at) %>
    • -
    • - <% if post.title == 'hub-message-twitter' %> - <%= image_tag(post.profile_picture, :alt => "Twitter") %> - <% elsif post.title == 'hub-message-facebook' %> - <%= image_tag('/plugins/community_hub/icons/logo_facebook_50x50.png', :alt => "Facebook") %> - <% else %> - <%= image_tag(profile_icon(post.author, :minor)) if post.author %> - <% end %> -
    • -
    • <%= post.author_name %>: <%= post.body %>
    • - - <% if mediator?(hub) && post.title != 'hub-message-facebook' %> -
    • -
        -
      • - <% if !pinned_message?(hub, post.id) %> - - " /> - - <% else %> - " /> - <% end %> -
      • -
      -
    • - <% end %> - -
    -
  • diff --git a/plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb b/plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb deleted file mode 100644 index 68e6f50..0000000 --- a/plugins/community_hub/views/community_hub_plugin_public/_settings.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -
    -
      -
    • - <%= link_to _("General settings"), :controller => 'cms', :action => 'edit', :id => @page.id %> -
    • -
    -
    diff --git a/plugins/community_hub/views/content_viewer/hub.html.erb b/plugins/community_hub/views/content_viewer/hub.html.erb deleted file mode 100644 index bb94ab2..0000000 --- a/plugins/community_hub/views/content_viewer/hub.html.erb +++ /dev/null @@ -1,97 +0,0 @@ -<% extend CommunityHubPlugin::HubHelper %> - -
    - -
    <%= @page.title %> HUB
    - -
    <%= @page.body %>
    - -
    - -
    - -

    - <%= _("Live") %> -

    - -

    - <%= _("Mediation") %> -

    - -
    -
      -
      - - <%= check_box_tag 'auto_scrolling', 'yes', true %><%= _("Auto scrolling") %> - - <% if logged_in? %> -
      -
      - - <%= form_for :message, - :method => 'post', - :url => { - :controller => 'community_hub_plugin_public', - :action => 'new_message', - :article_id => @page.id - } do |f| %> - <%= _("Message") %>: -
      - <%= f.text_area :body, :style => "width: 99%;", :cols => "38", :rows => "5", :placeholder => _("Type your message here") %> - <%= submit_button('add', _('Send'), :onclick => 'new_message(this); return false;') %> - - <% end %> - -
      -
      - <% end %> - -
      - -
      - -

      - <%= _("Live") %> -

      - -

      - <%= _("Mediation") %> -

      - -
      -
        -
        - - <% if logged_in? && mediator?(@page) %> -
        - - <%= render :file => 'shared/tiny_mce' %> - - <%= form_for :article, - :method => 'post', - :url => { - :controller => 'community_hub_plugin_public', - :action => 'new_mediation', - :profile_id => profile.id - } do |f| %> - <%= f.hidden_field :parent_id, :value => @page.id %> - <%= f.text_area :body, :style => "width: 100%;", :class => "mceEditor" %> - <%= submit_button('add', _('Send'), :onclick => 'new_mediation(this); return false;') %> - <% end %> - -
        - - <%= render :partial => "community_hub_plugin_public/settings" %> - - <% end %> - -
        - -
        - - - -<%= javascript_include_tag '/plugins/community_hub/javascripts/community_hub.js' %> \ No newline at end of file diff --git a/plugins/gamification b/plugins/gamification index bea83c2..d94cfe7 160000 --- a/plugins/gamification +++ b/plugins/gamification @@ -1 +1 @@ -Subproject commit bea83c2384fd561acb4cddf17454616dd91fabd7 +Subproject commit d94cfe72d24d6ba5ca19732fea55ed8273389a61 -- libgit2 0.21.2