diff --git a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb index 3fb6d79..3d3d3a2 100644 --- a/plugins/community_hub/facebook_stream/lib_facebook_stream.rb +++ b/plugins/community_hub/facebook_stream/lib_facebook_stream.rb @@ -7,7 +7,7 @@ require 'json' #'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' # BACKUP TOKEN 'CAAEhsewl0ZAcBAHhipXszZCURSwWLmgvceDbs9mB5baJdLriFxYMEzywmF2fvZBuThuA2Mm7QF8wPd3E6R5pVqVEnC2VhcBb4VrfAnkZC73ZC5g1NRUnKZCB2e6CaRiUBDatR2nf505PeKp7Aj5XxvTdfSqdZCsXxQFYZApPNSUUgkUWm6HwL4rp21MRJXb612sZD' -def facebook_comments(hub, author_id, page_id="participabr", pooling_time=5, token='CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') +def facebook_comments(hub, author_id, page_id, pooling_time, token, proxy_url) #raise hub.id.inspect @graph = Koala::Facebook::API.new(token) diff --git a/plugins/community_hub/lib/community_hub_plugin/hub.rb b/plugins/community_hub/lib/community_hub_plugin/hub.rb index 506ff63..72c19d6 100644 --- a/plugins/community_hub/lib/community_hub_plugin/hub.rb +++ b/plugins/community_hub/lib/community_hub_plugin/hub.rb @@ -5,10 +5,14 @@ class CommunityHubPlugin::Hub < Folder @@twitter_thread_started = false #change to hash @@facebook_thread_started = false #change to hash - - settings_items :hashtags_twitter, :type => :string, :default => "" - settings_items :twitter_enabled, :type => :boolean, :default => false + + settings_items :proxy_url, :type => :string, :default => 'http://161.148.1.167:312' # Remember to use add the port, if needed! + settings_items :twitter_enabled, :type => :boolean, :default => false + settings_items :hashtags_twitter, :type => :string, :default => "participa.br,participabr,arenanetmundial,netmundial" settings_items :facebook_enabled, :type => :boolean, :default => false + settings_items :facebook_page_id, :type => :string, :default => "participabr" + settings_items :facebook_pooling_time, :type => :integer, :default => 5 # Time in seconds + settings_items :facebook_access_token, :type => :string, :default => 'CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH' settings_items :pinned_messages, :type => Array, :default => [] settings_items :pinned_mediations, :type => Array, :default => [] settings_items :mediators, :type => Array, :default => [] @@ -34,10 +38,12 @@ class CommunityHubPlugin::Hub < Folder end def self.twitter_service(hub, action) + #raise hub.inspect + #if self.twitter_enabled == false author_id = 54 if action==:start thread = Thread.new { - Twurl::Stream.run(hub, author_id,'torrent', File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc') + Twurl::Stream.run(hub, author_id, self.hashtags_twitter, File.dirname(__FILE__) + '/../../tweeter_stream/config/twurlrc', self.proxy_url) } unless@@twitter_thread_started @@twitter_thread_started = true end @@ -49,7 +55,7 @@ class CommunityHubPlugin::Hub < Folder if action==:start #facebook_comments(page, author_id, page_id, pooling_time=5, token='CAAD8cd4tMVkBAO3sh2DrzwZCDfeQq9ZAvTz7Jz24ZC26KtMfBoljqaXhD2vBV1zpP0bjrpxXUBzJvKKcFzOm6rMG9Sok7iNVUaxt5iwr7dfMqCvHpMboKpqrqgeLrfCH5ITVTAdezA6ZBSr9iOJrqyCSOYfui0zTmbXJ3FqtshwNRrRy4NPH') thread = Thread.new { - facebook_comments(hub, author_id, page_id) + facebook_comments(hub, author_id, self.facebook_page_id, self.pooling_time, self.facebook_access_token, self.proxy_url) } unless@@facebook_thread_started @@facebook_thread_started = true end diff --git a/plugins/community_hub/tweeter_stream/lib/twurl/stream.rb b/plugins/community_hub/tweeter_stream/lib/twurl/stream.rb index 5f22181..a7b69cd 100755 --- a/plugins/community_hub/tweeter_stream/lib/twurl/stream.rb +++ b/plugins/community_hub/tweeter_stream/lib/twurl/stream.rb @@ -21,7 +21,7 @@ module Twurl Twurl.options.command = 'request' # Not necessary anymore Twurl.options.data = {"track"=>tags} # Twurl.options.proxy = 'http://161.148.1.167:312' # Use for production mode at SERPRO - Twurl.options.proxy = proxy unless proxy.nil? + Twurl.options.proxy = proxy unless proxy.nil? or proxy == '' Twurl.options.trace = false Twurl.options.headers = {} Twurl.options.subcommands=[] diff --git a/plugins/community_hub/views/cms/community_hub_plugin/_hub.rhtml b/plugins/community_hub/views/cms/community_hub_plugin/_hub.rhtml index e89b592..1227eeb 100644 --- a/plugins/community_hub/views/cms/community_hub_plugin/_hub.rhtml +++ b/plugins/community_hub/views/cms/community_hub_plugin/_hub.rhtml @@ -1,25 +1,40 @@