Commit 944c01f8b9b251b659c8745648e87f12dea0afe4

Authored by Antonio Terceiro
2 parents 1a4eb038 0c0fadaa

Merge remote-tracking branch 'origin/rails3'

@@ -15,6 +15,7 @@ gem 'thin' @@ -15,6 +15,7 @@ gem 'thin'
15 gem 'hpricot' 15 gem 'hpricot'
16 gem 'nokogiri' 16 gem 'nokogiri'
17 gem 'rake', :require => false 17 gem 'rake', :require => false
  18 +gem 'rest-client'
18 19
19 # FIXME list here all actual dependencies (i.e. the ones in debian/control), 20 # FIXME list here all actual dependencies (i.e. the ones in debian/control),
20 # with their GEM names (not the Debian package names) 21 # with their GEM names (not the Debian package names)
app/controllers/public/profile_controller.rb
@@ -51,7 +51,7 @@ class ProfileController < PublicController @@ -51,7 +51,7 @@ class ProfileController < PublicController
51 51
52 def communities 52 def communities
53 if is_cache_expired?(profile.communities_cache_key(params)) 53 if is_cache_expired?(profile.communities_cache_key(params))
54 - @communities = profile.communities.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage]) 54 + @communities = profile.communities.includes(relations_to_include).paginate(:per_page => per_page, :page => params[:npage], :total_entries => profile.communities.count)
55 end 55 end
56 end 56 end
57 57
@@ -202,7 +202,8 @@ class ProfileController < PublicController @@ -202,7 +202,8 @@ class ProfileController < PublicController
202 end 202 end
203 203
204 def more_comments 204 def more_comments
205 - activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity], :user_id => @profile}) 205 + profile_filter = @profile.person? ? {:user_id => @profile} : {:target_id => @profile}
  206 + activity = ActionTracker::Record.find(:first, :conditions => {:id => params[:activity]}.merge(profile_filter))
206 comments_count = activity.comments.count 207 comments_count = activity.comments.count
207 comment_page = (params[:comment_page] || 1).to_i 208 comment_page = (params[:comment_page] || 1).to_i
208 comments_per_page = 5 209 comments_per_page = 5
app/views/comment/notifier/notification.html.erb
@@ -1,19 +0,0 @@ @@ -1,19 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %>  
4 -  
5 -<%= word_wrap(_('Title: %s') % @comment_title) %>  
6 -  
7 -<%= _("Comment:") %>  
8 --------------------------------------------------------------------------------  
9 -<%= word_wrap(@comment_body) %>  
10 --------------------------------------------------------------------------------  
11 -  
12 -<%= _('Access the address below to view this comment:') %>  
13 -<%= url_for @comment_url %>  
14 -  
15 -<%= _("Greetings,") %>  
16 -  
17 ---  
18 -<%= _('%s team.') % @environment %>  
19 -<%= url_for @url %>  
app/views/comment/notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,19 @@ @@ -0,0 +1,19 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('%{sender} (%{sender_link}) created a new comment on your article "%{article_title}".') % { :sender => @sender, :sender_link => url_for(@sender_link), :article_title => @article_title }) %>
  4 +
  5 +<%= word_wrap(_('Title: %s') % @comment_title) %>
  6 +
  7 +<%= _("Comment:") %>
  8 +-------------------------------------------------------------------------------
  9 +<%= word_wrap(@comment_body) %>
  10 +-------------------------------------------------------------------------------
  11 +
  12 +<%= _('Access the address below to view this comment:') %>
  13 +<%= url_for @comment_url %>
  14 +
  15 +<%= _("Greetings,") %>
  16 +
  17 +--
  18 +<%= _('%s team.') % @environment %>
  19 +<%= url_for @url %>
app/views/pending_task_notifier/notification.html.erb
@@ -1,25 +0,0 @@ @@ -1,25 +0,0 @@
1 -<%= _("Dear %s") % @person.name %>,  
2 -  
3 -<%= _("You have %d pending task(s).") % @tasks.size %>  
4 -  
5 -<%= @tasks.map{|i| " * #{i.description}"}.join("\n") %>  
6 -  
7 -<%= _("Click in address below to process task(s):") %>  
8 -  
9 -<%= @url_for_pending_tasks %>  
10 -<% @organizations_with_pending_tasks.each do |organization| %>  
11 -<% pending_tasks = @person.pending_tasks_for_organization(organization) %>  
12 -<%= _("%s has %d pending task(s).") % [organization.name, pending_tasks.size] %>  
13 -  
14 -<%= pending_tasks.map{|i| " * #{i.information}"}.join("\n") %>  
15 -  
16 -<%= _("Click in address below to process task(s):") %>  
17 -  
18 -<%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %>  
19 -<% end %>  
20 -  
21 -<%= _('Greetings,') %>  
22 -  
23 ---  
24 -<%= _('%s team.') % @environment %>  
25 -<%= @url %>  
app/views/pending_task_notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,25 @@ @@ -0,0 +1,25 @@
  1 +<%= _("Dear %s") % @person.name %>,
  2 +
  3 +<%= _("You have %d pending task(s).") % @tasks.size %>
  4 +
  5 +<%= @tasks.map{|i| " * #{i.description}"}.join("\n") %>
  6 +
  7 +<%= _("Click in address below to process task(s):") %>
  8 +
  9 +<%= @url_for_pending_tasks %>
  10 +<% @organizations_with_pending_tasks.each do |organization| %>
  11 +<% pending_tasks = @person.pending_tasks_for_organization(organization) %>
  12 +<%= _("%s has %d pending task(s).") % [organization.name, pending_tasks.size] %>
  13 +
  14 +<%= pending_tasks.map{|i| " * #{i.information}"}.join("\n") %>
  15 +
  16 +<%= _("Click in address below to process task(s):") %>
  17 +
  18 +<%= url_for(:host => @default_hostname, :controller => 'tasks', :profile => organization.identifier) %>
  19 +<% end %>
  20 +
  21 +<%= _('Greetings,') %>
  22 +
  23 +--
  24 +<%= _('%s team.') % @environment %>
  25 +<%= @url %>
app/views/scrap/notifier/notification.html.erb
@@ -1,16 +0,0 @@ @@ -1,16 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('%{sender} (%{sender_link}) has left the following scrap for you:') % { :sender => @sender, :sender_link => url_for(@sender_link) }) %>  
4 -  
5 --------------------------------------------------------------------------------  
6 -<%= word_wrap(@scrap_content) %>  
7 --------------------------------------------------------------------------------  
8 -  
9 -<%= _('View this scrap on the wall') %>:  
10 -<%= url_for @wall_url %>  
11 -  
12 -<%= _("Greetings,") %>  
13 -  
14 ---  
15 -<%= _('%s team.') % @environment %>  
16 -<%= url_for @url %>  
app/views/scrap/notifier/notification.text.erb 0 → 100644
@@ -0,0 +1,16 @@ @@ -0,0 +1,16 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('%{sender} (%{sender_link}) has left the following scrap for you:') % { :sender => @sender, :sender_link => url_for(@sender_link) }) %>
  4 +
  5 +-------------------------------------------------------------------------------
  6 +<%= word_wrap(@scrap_content) %>
  7 +-------------------------------------------------------------------------------
  8 +
  9 +<%= _('View this scrap on the wall') %>:
  10 +<%= url_for @wall_url %>
  11 +
  12 +<%= _("Greetings,") %>
  13 +
  14 +--
  15 +<%= _('%s team.') % @environment %>
  16 +<%= url_for @url %>
app/views/task_mailer/invitation_notification.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -<%= @message %>  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/invitation_notification.text.erb 0 → 100644
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +<%= @message %>
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/target_notification.html.erb
@@ -1,10 +0,0 @@ @@ -1,10 +0,0 @@
1 -<%= _('Hello %s,') % @target %>  
2 -  
3 -<%= word_wrap(@message) %>  
4 -  
5 -<%= word_wrap(_('Access your list of tasks or your control panel to see this and other pending actions that need your attention.')) %>  
6 -<%= @tasks_url %>  
7 -  
8 ---  
9 -<%= _('%s team.') % @environment %>  
10 -<%= @url %>  
app/views/task_mailer/target_notification.text.erb 0 → 100644
@@ -0,0 +1,10 @@ @@ -0,0 +1,10 @@
  1 +<%= _('Hello %s,') % @target %>
  2 +
  3 +<%= word_wrap(@message) %>
  4 +
  5 +<%= word_wrap(_('Access your list of tasks or your control panel to see this and other pending actions that need your attention.')) %>
  6 +<%= @tasks_url %>
  7 +
  8 +--
  9 +<%= _('%s team.') % @environment %>
  10 +<%= @url %>
app/views/task_mailer/task_activated.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_activated.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/task_cancelled.text.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<%= _('Dear %s,') % @requestor %>
  2 +
  3 +<%= word_wrap(@message) %>
  4 +
  5 +<%= _('Greetings,') %>
  6 +
  7 +--
  8 +<%= _('%s team.') % @environment %>
  9 +<%= @url %>
app/views/task_mailer/task_cancelled.text.plain.html.erb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<%= _('Dear %s,') % @requestor %>  
2 -  
3 -<%= word_wrap(@message) %>  
4 -  
5 -<%= _('Greetings,') %>  
6 -  
7 ---  
8 -<%= _('%s team.') % @environment %>  
9 -<%= @url %>  
app/views/task_mailer/task_created.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_created.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/task_mailer/task_finished.text.erb 0 → 120000
@@ -0,0 +1 @@ @@ -0,0 +1 @@
  1 +task_cancelled.text.erb
0 \ No newline at end of file 2 \ No newline at end of file
app/views/task_mailer/task_finished.text.plain.html.erb
@@ -1 +0,0 @@ @@ -1 +0,0 @@
1 -task_cancelled.text.plain.html.erb  
2 \ No newline at end of file 0 \ No newline at end of file
app/views/user_mailer/activation_code.html.erb
@@ -1,9 +0,0 @@ @@ -1,9 +0,0 @@
1 -<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>  
2 -  
3 -<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %>  
4 -  
5 -<%= _("Greetings,") %>  
6 -  
7 ---  
8 -<%= _('%s team.') % @environment %>  
9 -<%= url_for @url %>  
app/views/user_mailer/activation_code.text.erb 0 → 100644
@@ -0,0 +1,9 @@ @@ -0,0 +1,9 @@
  1 +<%= _('Hi, %{recipient}!') % { :recipient => @recipient } %>
  2 +
  3 +<%= word_wrap(_('Welcome to %{environment}! To activate your account, follow the link: %{activation_url}') % { :environment => @environment, :activation_url => @url + url_for(:controller => :account, :action => :activate, :activation_code => @activation_code, :redirection => @redirection, :join => @join) }) %>
  4 +
  5 +<%= _("Greetings,") %>
  6 +
  7 +--
  8 +<%= _('%s team.') % @environment %>
  9 +<%= url_for @url %>
app/views/user_mailer/activation_email_notify.html.erb
@@ -1,12 +0,0 @@ @@ -1,12 +0,0 @@
1 -<%= _('Hello %s,') % @name %>  
2 -  
3 -<%= _('Your email %s was just activated.') % [@email] %>  
4 -  
5 -<%= _('You can access your e-mail from anywhere, using the following address:') %>  
6 -<%= @webmail %>  
7 -  
8 -<%= _('Greetings,') %>  
9 -  
10 ---  
11 -<%= _('%s team.') % @environment %>  
12 -<%= @url %>  
app/views/user_mailer/activation_email_notify.text.erb 0 → 100644
@@ -0,0 +1,12 @@ @@ -0,0 +1,12 @@
  1 +<%= _('Hello %s,') % @name %>
  2 +
  3 +<%= _('Your email %s was just activated.') % [@email] %>
  4 +
  5 +<%= _('You can access your e-mail from anywhere, using the following address:') %>
  6 +<%= @webmail %>
  7 +
  8 +<%= _('Greetings,') %>
  9 +
  10 +--
  11 +<%= _('%s team.') % @environment %>
  12 +<%= @url %>
features/step_definitions/web_steps.rb
@@ -27,13 +27,13 @@ end @@ -27,13 +27,13 @@ end
27 27
28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector| 28 When /^(?:|I )press "([^"]*)"(?: within "([^"]*)")?$/ do |button, selector|
29 with_scope(selector) do 29 with_scope(selector) do
30 - first(:button, button).click 30 + click_button(button, :match => :prefer_exact)
31 end 31 end
32 end 32 end
33 33
34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector| 34 When /^(?:|I )follow "([^"]*)"(?: within "([^"]*)")?$/ do |link, selector|
35 with_scope(selector) do 35 with_scope(selector) do
36 - first(:link, link).click 36 + click_link(link, :match => :prefer_exact)
37 end 37 end
38 end 38 end
39 39
plugins/comment_group/public/comment_group_macro.js
@@ -5,7 +5,7 @@ jQuery(document).ready(function($) { @@ -5,7 +5,7 @@ jQuery(document).ready(function($) {
5 5
6 var val = anchor.split('-'); //anchor format = #comment-\d+ 6 var val = anchor.split('-'); //anchor format = #comment-\d+
7 if(val.length!=2 || val[0]!='#comment') return; 7 if(val.length!=2 || val[0]!='#comment') return;
8 - if($('div[data-macro=comment_group_plugin/allow_comment]').length==0) return; //comment_group_plugin/allow_comment div must exists 8 + if($('div[data-macro=comment_group_plugin\\/allow_comment]').length==0) return; //comment_group_plugin/allow_comment div must exists
9 var comment_id = val[1]; 9 var comment_id = val[1];
10 if(!/^\d+$/.test(comment_id)) return; //test for integer 10 if(!/^\d+$/.test(comment_id)) return; //test for integer
11 11
public/javascripts/chat.js
@@ -529,11 +529,27 @@ jQuery(function($) { @@ -529,11 +529,27 @@ jQuery(function($) {
529 function create_conversation_tab(title, jid_id) { 529 function create_conversation_tab(title, jid_id) {
530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) { 530 if (! $('#' + Jabber.tab_prefix + jid_id).length > 0) {
531 // opening chat with selected online friend 531 // opening chat with selected online friend
532 - var tab = $tabs.tabs('add', '#' + Jabber.tab_prefix + jid_id, title); 532 + var panel = $('<div id="'+Jabber.tab_prefix + jid_id+'"></div>').appendTo($tabs);
  533 + panel.append("<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>");
  534 +
  535 + //FIXME
  536 + //var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
  537 + //Jabber.show_notice(jid_id, notice);
  538 +
  539 + // define textarea name as '<TAB_ID>'
  540 + panel.find('textarea').attr('name', panel.id);
  541 +
  542 + if (Jabber.is_a_room(jid_id)) {
  543 + panel.append(Jabber.templates.occupant_list);
  544 + panel.find('.history').addClass('room');
  545 + }
  546 +
  547 + $tabs.find('.ui-tabs-nav').append( "<li><a href='"+('#' + Jabber.tab_prefix + jid_id)+"'><span class=\"unread-messages\" style=\"display:none\"></span>"+title+"</a></li>" );
  548 + $tabs.tabs('refresh');
  549 +
533 var jid = Jabber.jid_of(jid_id); 550 var jid = Jabber.jid_of(jid_id);
534 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat'); 551 $("a[href='#" + Jabber.tab_prefix + jid_id + "']").addClass($('#' + jid_id).attr('class') || 'icon-chat');
535 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid); 552 $('#' + Jabber.tab_prefix + jid_id).find('textarea').attr('data-to', jid);
536 - $tabs.tabs('select', '#' + Jabber.tab_prefix + jid_id);  
537 } 553 }
538 } 554 }
539 555
@@ -555,7 +571,7 @@ jQuery(function($) { @@ -555,7 +571,7 @@ jQuery(function($) {
555 var $tabs = $('#chat-window #tabs').tabs({ 571 var $tabs = $('#chat-window #tabs').tabs({
556 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>', 572 tabTemplate: '<li class="tab"><a href="#{href}"><span class="unread-messages" style="display:none"></span>#{label}</a></li>',
557 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>", 573 panelTemplate: "<div class='conversation'><div class='history'></div><div class='input-div'><div class='icon-chat'></div><textarea class='input'></textarea></div></div>",
558 - add: function(event, ui) { 574 + add: function(event, ui) { //FIXME DEPRECATED
559 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
560 576
561 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html()); 577 var notice = $starting_chat_notice.replace('%{name}', $(ui.tab).html());
@@ -575,7 +591,7 @@ jQuery(function($) { @@ -575,7 +591,7 @@ jQuery(function($) {
575 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 591 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
576 count_unread_messages(jid_id, true); 592 count_unread_messages(jid_id, true);
577 }, 593 },
578 - remove: function(event, ui) { 594 + remove: function(event, ui) { //FIXME DEPRECATED
579 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, ''); 595 var jid_id = ui.panel.id.replace(Jabber.tab_prefix, '');
580 if (Jabber.is_a_room(jid_id)) { 596 if (Jabber.is_a_room(jid_id)) {
581 // exiting from a chat room 597 // exiting from a chat room
public/stylesheets/application.css
@@ -2643,6 +2643,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation @@ -2643,6 +2643,9 @@ div#activation_enterprise label, div#activation_enterprise input, div#activation
2643 background: #B8CFE7; 2643 background: #B8CFE7;
2644 padding: 0px 20px 5px 20px; 2644 padding: 0px 20px 5px 20px;
2645 } 2645 }
  2646 +#TB_window .login-box .button-bar {
  2647 + padding-top: 0;
  2648 +}
2646 .login-box-content .button-bar .button { 2649 .login-box-content .button-bar .button {
2647 position: relative; 2650 position: relative;
2648 } 2651 }
vendor/plugins/ruby_bosh/lib/ruby_bosh.rb
@@ -4,7 +4,6 @@ require &#39;rexml/document&#39; @@ -4,7 +4,6 @@ require &#39;rexml/document&#39;
4 require 'base64' 4 require 'base64'
5 require 'hpricot' 5 require 'hpricot'
6 require 'timeout' 6 require 'timeout'
7 -require 'system_timer'  
8 7
9 class RubyBOSH 8 class RubyBOSH
10 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind' 9 BOSH_XMLNS = 'http://jabber.org/protocol/httpbind'
@@ -15,7 +14,7 @@ class RubyBOSH @@ -15,7 +14,7 @@ class RubyBOSH
15 CLIENT_XMLNS = 'jabber:client' 14 CLIENT_XMLNS = 'jabber:client'
16 15
17 class Error < StandardError; end 16 class Error < StandardError; end
18 - class Timeout < RubyBOSH::Error; end 17 + class TimeoutError < RubyBOSH::Error; end
19 class AuthFailed < RubyBOSH::Error; end 18 class AuthFailed < RubyBOSH::Error; end
20 class ConnFailed < RubyBOSH::Error; end 19 class ConnFailed < RubyBOSH::Error; end
21 20
@@ -134,12 +133,12 @@ class RubyBOSH @@ -134,12 +133,12 @@ class RubyBOSH
134 end 133 end
135 134
136 def deliver(xml) 135 def deliver(xml)
137 - SystemTimer.timeout(@timeout) do 136 + Timeout::timeout(@timeout) do
138 send(xml) 137 send(xml)
139 recv(RestClient.post(@service_url, xml, @headers)) 138 recv(RestClient.post(@service_url, xml, @headers))
140 end 139 end
141 rescue ::Timeout::Error => e 140 rescue ::Timeout::Error => e
142 - raise RubyBOSH::Timeout, e.message 141 + raise RubyBOSH::TimeoutError, e.message
143 rescue Errno::ECONNREFUSED => e 142 rescue Errno::ECONNREFUSED => e
144 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}" 143 raise RubyBOSH::ConnFailed, "could not connect to #{@host}\n#{e.message}"
145 rescue Exception => e 144 rescue Exception => e